commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
e8a5a97ea18120915dba74b9a73fdca4eb381568
Fix indentation level
tail/tests/test_tail.py
tail/tests/test_tail.py
""" Tests for the tail implementation """ from tail import FileBasedTail def test_tail_from_file(): """Tests that tail works as advertised from a file""" from unittest.mock import mock_open, patch, Mock # The mock_data we are using for our test mock_data = """A B C D E F """ mocked_open = mock_o...
""" Tests for the tail implementation """ from tail import FileBasedTail def test_tail_from_file(): """Tests that tail works as advertised from a file""" from unittest.mock import mock_open, patch, Mock # The mock_data we are using for our test mock_data = """A B C D E F """ mocked_open = mock_o...
Python
0.035546
17951915f22d12223373bec5e8003b4de666b843
__main__ compatible with python 3.5
pyqualtrics/__main__.py
pyqualtrics/__main__.py
# -*- coding: utf-8 -*- # # This file is part of the pyqualtrics package. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/Baguage/pyqualtrics # # Licensed under the Apache License, Version 2.0...
# -*- coding: utf-8 -*- # # This file is part of the pyqualtrics package. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/Baguage/pyqualtrics # # Licensed under the Apache License, Version 2.0...
Python
0.999665
33efe92104ad139f9313d91ae7b2eea8a76da9d7
fix flake8
pyscalambda/__init__.py
pyscalambda/__init__.py
from pyscalambda.operands import Underscore from pyscalambda.operators import UnaryOperator from pyscalambda.quote import quote from pyscalambda.scalambdable import scalambdable_const, scalambdable_func, scalambdable_iterator from pyscalambda.utility import convert_operand _ = Underscore(0) _1 = Underscore(1) _2 =...
from pyscalambda.operands import Underscore from pyscalambda.operators import UnaryOperator from pyscalambda.quote import quote from pyscalambda.scalambdable import scalambdable_const, scalambdable_func, scalambdable_iterator from pyscalambda.utility import convert_operand _ = Underscore(0) _1 = Underscore(1) _2 =...
Python
0
4b6117fd4835cbde52e8d3fba79e46c2ec63a637
Add explanatory comments about the parent-child relationships
mapit/management/commands/find_parents.py
mapit/management/commands/find_parents.py
# This script is used after Boundary-Line has been imported to # associate shapes with their parents. With the new coding # system coming in, this could be done from a BIG lookup table; however, # I reckon P-in-P tests might be quick enough... from django.core.management.base import NoArgsCommand from mapit.models imp...
# This script is used after Boundary-Line has been imported to # associate shapes with their parents. With the new coding # system coming in, this could be done from a BIG lookup table; however, # I reckon P-in-P tests might be quick enough... from django.core.management.base import NoArgsCommand from mapit.models imp...
Python
0
5d94f90126260f147822ba8d3afe9c1c0a85e943
Discard FASTA headers by default.
pypeline/common/formats/msa.py
pypeline/common/formats/msa.py
#!/usr/bin/python # # Copyright (c) 2012 Mikkel Schubert <MSchubert@snm.ku.dk> # # 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 rights #...
#!/usr/bin/python # # Copyright (c) 2012 Mikkel Schubert <MSchubert@snm.ku.dk> # # 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 rights #...
Python
0
c0824d3cb9cba811ba36c2f8937e91716f5a50df
Fix lint
ci/run_script.py
ci/run_script.py
""" Run tests and linters on Travis CI. """ import os import subprocess import sys from pathlib import Path import pytest def run_test(test_filename: str) -> None: """ Run pytest with a given filename. """ path = Path('tests') / 'mock_vws' / test_filename result = pytest.main( [ ...
""" Run tests and linters on Travis CI. """ import os import subprocess import sys from pathlib import Path import pytest def run_test(test_filename: str) -> None: """ Run pytest with a given filename. """ path = Path('tests') / 'mock_vws' / test_filename result = pytest.main([ '-vvv', ...
Python
0.000032
2d60ef3a9ff53c1623747fd1a00df4d788dd3777
fix tobler init
pysal/model/tobler/__init__.py
pysal/model/tobler/__init__.py
from tobler import area_weighted from tobler import dasymetric from tobler import model
from tobler import area_weighted from tobler import data from tobler import dasymetric
Python
0.000124
d1c88387a129d64488a5ca2dee56d7fac36ffbf1
Disable GCC fallback, add time logging.
clang_wrapper.py
clang_wrapper.py
#!/usr/bin/env python import optparse import os import subprocess import sys import time WORLD_PATH = os.path.dirname(os.path.abspath(__file__)) COMPILER_PATH = {'gcc': 'gcc', 'clang': WORLD_PATH + '/third_party/llvm-build/Release+Asserts/bin/clang' } FILTER = {'gcc': ['-Qunused-arguments', '-no-integrated-as', '-...
#!/usr/bin/env python import optparse import os import subprocess import sys WORLD_PATH = os.path.dirname(os.path.abspath(__file__)) COMPILER_PATH = {'gcc': 'gcc', 'clang': WORLD_PATH + '/third_party/llvm-build/Release+Asserts/bin/clang' } FILTER = {'gcc': ['-Qunused-arguments', '-no-integrated-as', '-mno-global-m...
Python
0
deebd351b09108d95b4759b179ad84b48b6c933e
Fix typo in random-seed's help
pytest_test_groups/__init__.py
pytest_test_groups/__init__.py
from random import Random import math def get_group_size(total_items, total_groups): return int(math.ceil(float(total_items) / total_groups)) def get_group(items, group_size, group_id): start = group_size * (group_id - 1) end = start + group_size if start >= len(items) or start < 0: raise V...
from random import Random import math def get_group_size(total_items, total_groups): return int(math.ceil(float(total_items) / total_groups)) def get_group(items, group_size, group_id): start = group_size * (group_id - 1) end = start + group_size if start >= len(items) or start < 0: raise V...
Python
0.002549
2eca98c216a590c6163c8236c392f19ddd8d85d9
update to 4.4.12
tensorgraph/__init__.py
tensorgraph/__init__.py
# import json # from os.path import dirname # # with open(dirname(__file__) + '/pkg_info.json') as fp: # _info = json.load(fp) # __version__ = _info['version'] __version__ = "4.4.12" from .stopper import EarlyStopper from .sequential import Sequential from .graph import Graph from .node import StartNode, HiddenNo...
# import json # from os.path import dirname # # with open(dirname(__file__) + '/pkg_info.json') as fp: # _info = json.load(fp) # __version__ = _info['version'] __version__ = "4.4.10" from .stopper import EarlyStopper from .sequential import Sequential from .graph import Graph from .node import StartNode, HiddenNo...
Python
0
c986507b9c020a2a81a290299f7ce74748641254
update linkedinviewer
linkedinviewer.py
linkedinviewer.py
from linkedin import linkedin import oauthlib class Linkedinviewer (object): def __init__ (self, cred_file): self.cred_file = cred_file self.authentication = None self.application = None def authenticate(self): # Authenticate with LinkedIn app credential cred_list = N...
from linkedin import linkedin import oauthlib class Linkedinviewer (object): def __init__ (self, cred_file): self.cred_file = cred_file self.authentication = None self.application = None def authenticate(self): # Authenticate with LinkedIn app credential cred_list = N...
Python
0
4f5d81b48a5bb48771b82f30e3853472550ee65c
add demo about using file iterator
python/src/file_iter.py
python/src/file_iter.py
# Copyright (c) 2014 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list ofconditions and the fol...
# Copyright (c) 2014 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list ofconditions and the fol...
Python
0
61c693005de95557172ff78c85de2d5dc4be66f1
use N for missing nucleotides
vcfkit/phylo.py
vcfkit/phylo.py
#! /usr/bin/env python """ usage: vk phylo fasta <vcf> [<region>] vk phylo tree (nj|upgma) [--plot] <vcf> [<region>] options: -h --help Show this screen. --version Show version. """ from docopt import docopt from vcfkit import __version__ from utils.vcf import * from subpro...
#! /usr/bin/env python """ usage: vk phylo fasta <vcf> [<region>] vk phylo tree (nj|upgma) [--plot] <vcf> [<region>] options: -h --help Show this screen. --version Show version. """ from docopt import docopt from vcfkit import __version__ from utils.vcf import * from subpro...
Python
0.004823
6aead3bfc4ef7a0140238855e118e4017af1ab73
Change order of tests
pywikibot/comms/http.py
pywikibot/comms/http.py
# -*- coding: utf-8 -*- """ Basic HTTP access interface. This module handles communication between the bot and the HTTP threads. This module is responsible for - Setting up a connection pool - Providing a (blocking) interface for HTTP requests - Translate site objects with query strings into urls - U...
# -*- coding: utf-8 -*- """ Basic HTTP access interface. This module handles communication between the bot and the HTTP threads. This module is responsible for - Setting up a connection pool - Providing a (blocking) interface for HTTP requests - Translate site objects with query strings into urls - U...
Python
0.000008
68e58114919208b69a01880f52e8b8e2918a4edb
make failing ogr/shape comparison a todo
tests/python_tests/ogr_and_shape_geometries_test.py
tests/python_tests/ogr_and_shape_geometries_test.py
#!/usr/bin/env python from nose.tools import * from utilities import execution_path, Todo import os, sys, glob, mapnik def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) # TODO - fix truncation in shapefile......
#!/usr/bin/env python from nose.tools import * from utilities import execution_path import os, sys, glob, mapnik def setup(): # All of the paths used are relative, if we run the tests # from another directory we need to chdir() os.chdir(execution_path('.')) # TODO - fix truncation in shapefile... polys...
Python
0.000004
8e57bac9ca41bfcccfabc8524ddc2a8730ac4609
Update quality_score_filter.py
python/quality_score_filter.py
python/quality_score_filter.py
from Bio import SeqIO import math from Tkinter import Tk import sys name = sys.argv[1] qs = float(sys.argv[3]) output = sys.argv[2] count = 0 for rec in SeqIO.parse(name, "fastq"): count += 1 qual_sequences = [] cnt = 0 for rec in SeqIO.parse(name, "fastq"): rec.letter_annotations["phred_quality"] probs...
from Bio import SeqIO import math from Tkinter import Tk import sys name = sys.argv[1] qs = float(sys.argv[3]) output = sys.argv[2] count = 0 for rec in SeqIO.parse(name, "fastq"): count += 1 print("%i reads in fastq file" % count) qual_sequences = [] # Setup an empty list cnt = 0 for rec in SeqIO.parse(name, "...
Python
0.000002
fa2c69bf4399f3a96505fe33050433f275ff6e0b
Bump version to 0.0.3
streamer/__init__.py
streamer/__init__.py
__version__ = "0.0.3"
__version__ = "0.0.2"
Python
0.000001
2304dcf3ebf189d7c3b1a00211a288e359c4cbb5
Rename signals for consistency
volt/signals.py
volt/signals.py
"""Signals for hooks.""" # Copyright (c) 2012-2022 Wibowo Arindrarto <contact@arindrarto.dev> # SPDX-License-Identifier: BSD-3-Clause from typing import Any import structlog from blinker import signal, NamedSignal from structlog.contextvars import bound_contextvars log = structlog.get_logger(__name__) post_site_l...
"""Signals for hooks.""" # Copyright (c) 2012-2022 Wibowo Arindrarto <contact@arindrarto.dev> # SPDX-License-Identifier: BSD-3-Clause from typing import Any import structlog from blinker import signal, NamedSignal from structlog.contextvars import bound_contextvars log = structlog.get_logger(__name__) post_site_l...
Python
0.000011
b58dcf4ce81b234de6701468296f4185ed63a8e2
Add filters to the admin interface
voting/admin.py
voting/admin.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from voting.models import Position, SACYear, Nomination def make_rejected(ModelAdmin, request, queryset): queryset.update(is_rejected=True) make_rejected.short_description = "رفض المرشحـ/ين المختار/ين" class Nominat...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from voting.models import Position, SACYear, Nomination def make_rejected(ModelAdmin, request, queryset): queryset.update(is_rejected=True) make_rejected.short_description = "رفض المرشحـ/ين المختار/ين" class Nominat...
Python
0
4ea4f12fe589d44b2f27f6e8a645f463b15d146a
Use raw_id_fields for TeamMembership inline to avoid select field with *all* users.
studygroups/admin.py
studygroups/admin.py
from django.contrib import admin # Register your models here. from studygroups.models import Course from studygroups.models import StudyGroup from studygroups.models import Meeting from studygroups.models import Application from studygroups.models import Reminder from studygroups.models import Profile from studygr...
from django.contrib import admin # Register your models here. from studygroups.models import Course from studygroups.models import StudyGroup from studygroups.models import Meeting from studygroups.models import Application from studygroups.models import Reminder from studygroups.models import Profile from studygr...
Python
0
847fc43b572384f8afcd395ada275b053e24a193
Fix aiohttp test
tests/test_aiohttp.py
tests/test_aiohttp.py
try: import aiohttp import aiohttp.web except ImportError: skip_tests = True else: skip_tests = False import asyncio import unittest from uvloop import _testbase as tb class _TestAioHTTP: def test_aiohttp_basic_1(self): PAYLOAD = '<h1>It Works!</h1>' * 10000 async def on_reque...
try: import aiohttp import aiohttp.server except ImportError: skip_tests = True else: skip_tests = False import asyncio import unittest from uvloop import _testbase as tb class _TestAioHTTP: def test_aiohttp_basic_1(self): PAYLOAD = b'<h1>It Works!</h1>' * 10000 class HttpRequ...
Python
0.000009
61969ac21d7eda1162cdedd3f066aa8e396fb5ba
Fix test output
raven/scripts/runner.py
raven/scripts/runner.py
""" raven.scripts.runner ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from __future__ import print_function import logging import os import sys import time from optparse import Opti...
""" raven.scripts.runner ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from __future__ import print_function import logging import os import sys import time from optparse import Opti...
Python
0.988755
8b6cbdbae4dedfbbf025a7ecb20c7d7b3959ed11
support to overwrite position in border
rbgomoku/core/player.py
rbgomoku/core/player.py
from core import OverwritePositionException from core.board import Piece class AIPlayer: """ Abstract AI players. To construct an AI player: Construct an instance (of its subclass) with the game Board """ def __init__(self, board, piece): self._board = board self.my_piece = ...
from core.board import Piece class AIPlayer: """ Abstract AI players. To construct an AI player: Construct an instance (of its subclass) with the game Board """ def __init__(self, board, piece): self._board = board self.my_piece = piece self.opponent = Piece.WHITE if...
Python
0
f0b7eea8a603e331be6db71beb2766d022dacb23
Refactor the method who check for changes in user agent
tests/test_browser.py
tests/test_browser.py
# -*- coding: utf-8 -*- from __future__ import with_statement import __builtin__ try: import unittest2 as unittest except ImportError: import unittest import warnings from splinter.exceptions import DriverNotFoundError from splinter.utils import deprecate_driver_class from fake_webapp import EXAMPLE_APP ...
# -*- coding: utf-8 -*- from __future__ import with_statement import __builtin__ try: import unittest2 as unittest except ImportError: import unittest import warnings from splinter.exceptions import DriverNotFoundError from splinter.utils import deprecate_driver_class from fake_webapp import EXAMPLE_APP ...
Python
0.00001
2b7d52369206f6a6b9f0ceb4afe28e73e652e806
Fix typo s/router/route
loafer/consumer.py
loafer/consumer.py
# -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 import asyncio import json from functools import partial import logging import boto3 import botocore.exceptions from .conf import settings from .exceptions import ConsumerError logger = logging.getLogger(__name__) class SQSConsumer(object): def __init__(self...
# -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 import asyncio import json from functools import partial import logging import boto3 import botocore.exceptions from .conf import settings from .exceptions import ConsumerError logger = logging.getLogger(__name__) class SQSConsumer(object): def __init__(self...
Python
0.999975
cc78aef74876049a4548398133bad64e405351de
Remove redundant parameters from wagtailuserbar tag; trigger a DeprecationWarning if people are still passing a css path
wagtail/wagtailadmin/templatetags/wagtailuserbar.py
wagtail/wagtailadmin/templatetags/wagtailuserbar.py
import warnings from django import template from wagtail.wagtailadmin.views import userbar from wagtail.wagtailcore.models import Page register = template.Library() @register.simple_tag(takes_context=True) def wagtailuserbar(context, css_path=None): if css_path is not None: warnings.warn( "P...
from django import template from wagtail.wagtailadmin.views import userbar from wagtail.wagtailcore.models import Page register = template.Library() @register.simple_tag(takes_context=True) def wagtailuserbar(context, current_page=None, items=None): # Find request object request = context['request'] ...
Python
0
42162048981e26aecb942ca936de86dc1dd82041
Fix #23 actors.Worker identity sent on polling for activity task
swf/actors/worker.py
swf/actors/worker.py
#! -*- coding:utf-8 -*- from swf.actors import Actor from swf.models import ActivityTask from swf.exceptions import PollTimeout class ActivityWorker(Actor): """Activity task worker actor implementation Once started, will start polling for activity task, to process, and emitting heartbeat until it's stop...
#! -*- coding:utf-8 -*- from swf.actors import Actor from swf.models import ActivityTask from swf.exceptions import PollTimeout class ActivityWorker(Actor): """Activity task worker actor implementation Once started, will start polling for activity task, to process, and emitting heartbeat until it's stop...
Python
0
153f7b28e5b4763dd41f95b4840dcf56d9895393
Update bot.py
code/bot1/bot.py
code/bot1/bot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tweepy, time, sys # pip install tweepy import sys sys.path.append("..") from course_config import * argfile = str(sys.argv[1]) # go to https://dev.twitter.com/ and register application # you need CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import tweepy, time, sys # pip install tweepy import sys sys.path.append("..") from course_config import * argfile = str(sys.argv[1]) # need CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, ACCESS_SECRET auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) au...
Python
0.000001
0bc98e3cbab019af6f0543c6618387511e354f5f
Add unittests for WhisperFinder
tests/test_finders.py
tests/test_finders.py
import os import random import time from . import TestCase, WHISPER_DIR from graphite_api.app import app from graphite_api.intervals import Interval, IntervalSet from graphite_api.node import LeafNode, BranchNode from graphite_api.storage import Store from graphite_api._vendor import whisper class FinderTest(TestCa...
import random import time from . import TestCase from graphite_api.intervals import Interval, IntervalSet from graphite_api.node import LeafNode, BranchNode from graphite_api.storage import Store class FinderTest(TestCase): def test_custom_finder(self): store = Store([DummyFinder()]) nodes = lis...
Python
0
9e2bdfece7f5cd9e02b15e9fe11c432e10a12418
update api tests
test/test_naarad_api.py
test/test_naarad_api.py
# coding=utf-8 """ © 2013 LinkedIn Corp. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License.?You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
# coding=utf-8 """ © 2013 LinkedIn Corp. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License.?You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
Python
0.000001
628a1418e64ba45890daee2d85223277f3a11a54
insert asset_specific_data into deck_spawn test
test/test_peerassets.py
test/test_peerassets.py
import pytest import pypeerassets as pa @pytest.mark.parametrize("prov", [pa.Explorer, pa.Cryptoid]) def test_find_deck(prov): provider = prov(network="tppc") deck = pa.find_deck(provider, 'b6a95f94fef093ee9009b04a09ecb9cb5cba20ab6f13fe0926aeb27b8671df43', 1) assert deck.__dict__ == {'asset_specific_da...
import pytest import pypeerassets as pa @pytest.mark.parametrize("prov", [pa.Explorer, pa.Cryptoid]) def test_find_deck(prov): provider = prov(network="tppc") deck = pa.find_deck(provider, 'b6a95f94fef093ee9009b04a09ecb9cb5cba20ab6f13fe0926aeb27b8671df43', 1) assert deck.__dict__ == {'asset_specific_da...
Python
0.000001
678cfd5d1acb1d1c3ed031deb8afb181c661650e
Refactor github_hook(): split github_pull_request() and update_project() into separate functions
wrapweb/hook.py
wrapweb/hook.py
# Copyright 2015 The Meson development team # # 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 ...
# Copyright 2015 The Meson development team # # 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 ...
Python
0.000147
0085e36491aa14f80c8979ee25c1ad0039bc3f00
Extend the 'test_parse_to_audio_requirement_bug' test case
tests/test_parsers.py
tests/test_parsers.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- """Contains test cases for the parsers module.""" from __future__ import unicode_literals import sys import os.path import unittest PATH = os.path.realpath(os.path.abspath(__file__)) sys.path.insert(0, os.path.dirname(os.path.dirname(PATH))) try: from youtube_dl_gu...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """Contains test cases for the parsers module.""" from __future__ import unicode_literals import sys import os.path import unittest PATH = os.path.realpath(os.path.abspath(__file__)) sys.path.insert(0, os.path.dirname(os.path.dirname(PATH))) try: from youtube_dl_gu...
Python
0.999918
3c811b3f0a0fd974cdac2e53dfe0a6cb1ee44e55
update process tests, move to using example_resume.yml
tests/test_process.py
tests/test_process.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 Christopher C. Strelioff <chris.strelioff@gmail.com> # # Distributed under terms of the MIT license. """test_process.py Test (non-command line) methods in the process.py module. """ import unittest import os import tempfile import ...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2014 Christopher C. Strelioff <chris.strelioff@gmail.com> # # Distributed under terms of the MIT license. """test_process.py Test (non-command line) methods in the process.py module. """ import unittest import os import tempfile import ...
Python
0
ee1532cc226987904666eeb0bda61445455d04e3
Increase test timeout
tests/test_run_app.py
tests/test_run_app.py
import ssl from unittest import mock from aiohttp import web def test_run_app_http(loop, mocker): mocker.spy(loop, 'create_server') loop.call_later(0.05, loop.stop) app = web.Application(loop=loop) mocker.spy(app, 'startup') web.run_app(app, print=lambda *args: None) assert loop.is_closed(...
import ssl from unittest import mock from aiohttp import web def test_run_app_http(loop, mocker): mocker.spy(loop, 'create_server') loop.call_later(0.02, loop.stop) app = web.Application(loop=loop) mocker.spy(app, 'startup') web.run_app(app, print=lambda *args: None) assert loop.is_closed(...
Python
0.000001
e5b3de7ef4b068d1ce01e8fc9aec59b9182d8662
fix error in wizard tests
tests/test_wizards.py
tests/test_wizards.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import sys from distutils.version import LooseVersion import cms from .base import BaseTest try: from unittest import skipIf except ImportError: from unittest2 import skipIf class WizardTest(BaseTest): de...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import sys from distutils.version import LooseVersion import cms from .base import BaseTest try: from unittest import skipIf except ImportError: from unittest2 import skipIf class WizardTest(BaseTest): de...
Python
0.000001
d8b322439a5fdaf31ec52dc7c2a2ff9e18c12316
solve import error on install magpie
magpie/__init__.py
magpie/__init__.py
# -*- coding: utf-8 -*- import logging import sys LOGGER = logging.getLogger(__name__) def includeme(config): # import needs to be here, otherwise ImportError happens during setup.py install (modules not yet installed) from magpie import constants LOGGER.info("Adding MAGPIE_MODULE_DIR='{}' to path.".forma...
# -*- coding: utf-8 -*- from magpie import constants import logging import sys LOGGER = logging.getLogger(__name__) def includeme(config): LOGGER.info("Adding MAGPIE_MODULE_DIR='{}' to path.".format(constants.MAGPIE_MODULE_DIR)) sys.path.insert(0, constants.MAGPIE_MODULE_DIR) # include magpie components ...
Python
0.000006
5dfcd4ea8633a6bc658cccd654fce2cc7c217269
Add helpful message to end of installer.
nbdiff/install.py
nbdiff/install.py
from __future__ import print_function from . import __path__ as NBDIFF_PATH import subprocess import re import os import shutil import sys def install(): profile_name = 'nbdiff' create_cmd = ['ipython', 'profile', 'create', profile_name] message = subprocess.Popen(create_cmd, stderr=subprocess.PIPE) m...
from . import __path__ as NBDIFF_PATH import subprocess import re import os import shutil import sys def install(): profile_name = 'nbdiff' create_cmd = ['ipython', 'profile', 'create', profile_name] message = subprocess.Popen(create_cmd, stderr=subprocess.PIPE) message_str = message.stderr.read() ...
Python
0
390fa07c191d79290b1ef83c268f38431f68093a
Fix import in test client.
tests/clients/simple.py
tests/clients/simple.py
# -*- coding: utf-8 -*- import os import sys base = os.path.dirname(os.path.abspath(__file__)) sys.path.append(base) from base import jsonrpyc class MyClass(object): def one(self): return 1 def twice(self, n): return n * 2 def arglen(self, *args, **kwargs): return len(args) ...
# -*- coding: utf-8 -*- from base import jsonrpyc class MyClass(object): def one(self): return 1 def twice(self, n): return n * 2 def arglen(self, *args, **kwargs): return len(args) + len(kwargs) if __name__ == "__main__": rpc = jsonrpyc.RPC(MyClass())
Python
0
3b706a6fb345d1b6c33c3ab8d438949fc35887d3
NotImplementedException should be called NotImplementedError
nbviewer/index.py
nbviewer/index.py
#----------------------------------------------------------------------------- # Copyright (C) 2014 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #-----------------------------------------------------...
#----------------------------------------------------------------------------- # Copyright (C) 2014 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #-----------------------------------------------------...
Python
0.998718
7c6754a439f8fa1c7ebe5c12b9c51651c02c35c4
修改post参数,添加全局editor配置
manage/new_post.py
manage/new_post.py
import datetime import json import os.path import re import shutil from pypinyin import lazy_pinyin from common import file from manage import get_excerpt def get_name(nameinput): name_raw = re.sub("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]+", "", nameinput) namelist = lazy_pinyin(name_raw) name = ...
import datetime import json import os.path import re import shutil from pypinyin import lazy_pinyin from common import file from manage import get_excerpt def get_name(nameinput): name_raw = re.sub("[\s+\.\!\/_,$%^*(+\"\']+|[+——!,。?、~@#¥%……&*()]+", "", nameinput) namelist = lazy_pinyin(name_raw) name = ...
Python
0
7bd2bfa8deb59c97f7630ed10fe70fd7e8bd8587
Update dependency bazelbuild/bazel to latest version
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,...
Python
0.000007
73d0be7a432340b4ecd140ad1cc8792d3f049779
Use SelfAttribute instead of explicit lambda
tests/factories/user.py
tests/factories/user.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. import factory from factory.faker import Faker from pycroft.model.user import User from...
# -*- coding: utf-8 -*- # Copyright (c) 2016 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. import factory from factory.faker import Faker from pycroft.model.user import User from...
Python
0
5c1a404353a0cdcd49610a21d7d19b79898ac7e3
make mpi example a little more verbose
tests/helloworld_mpi.py
tests/helloworld_mpi.py
#!/usr/bin/env python # This is an example MPI4Py program that is used # by different examples and tests. import sys import time import traceback from mpi4py import MPI try : print "start" SLEEP = 10 name = MPI.Get_processor_name() comm = MPI.COMM_WORLD print "mpi rank %d/%d/%s" % (comm.ran...
#!/usr/bin/env python # This is an example MPI4Py program that is used # by different examples and tests. from mpi4py import MPI import time SLEEP = 10 name = MPI.Get_processor_name() comm = MPI.COMM_WORLD print "mpi rank %d/%d/%s" % (comm.rank, comm.size, name) time.sleep(SLEEP) comm.Barrier() # wait for ...
Python
0.000069
3bb6017897f9b8c859c2d3879c2e9d51b899f57c
Increase number of iterations for xor neural net
neuralnets/xor.py
neuralnets/xor.py
import numpy as np from net import NeuralNet net = NeuralNet(2, 1, 3, 1, 342047) output_dot = True inputs = np.array([[1,1], [0,0], [1,0], [0,1]]) outputs = np.array([[0], [0], [1], [1]]) for i in xr...
import numpy as np from net import NeuralNet net = NeuralNet(2, 1, 3, 1, 342047) output_dot = True inputs = np.array([[1,1], [0,0], [1,0], [0,1]]) outputs = np.array([[0], [0], [1], [1]]) for i in xr...
Python
0.000002
2c37ed091baf12e53885bfa06fdb835bb8de1218
Add Bitbucket to skipif marker reason
tests/skipif_markers.py
tests/skipif_markers.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ skipif_markers -------------- Contains pytest skipif markers to be used in the suite. """ import pytest import os try: os.environ[u'TRAVIS'] except KeyError: travis = False else: travis = True try: os.environ[u'DISABLE_NETWORK_TESTS'] except KeyErr...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ skipif_markers -------------- Contains pytest skipif markers to be used in the suite. """ import pytest import os try: os.environ[u'TRAVIS'] except KeyError: travis = False else: travis = True try: os.environ[u'DISABLE_NETWORK_TESTS'] except KeyErr...
Python
0
44dac786339716ad8cc05f6790b73b5fc47be812
Remove extra comma to avoid flake8 test failure in CircleCI
config/jinja2.py
config/jinja2.py
from django.urls import reverse from django.utils import translation from django.template.backends.jinja2 import Jinja2 from jinja2 import Environment class FoodsavingJinja2(Jinja2): app_dirname = 'templates' def environment(**options): env = Environment(extensions=['jinja2.ext.i18n'], **options) env.gl...
from django.urls import reverse from django.utils import translation from django.template.backends.jinja2 import Jinja2 from jinja2 import Environment class FoodsavingJinja2(Jinja2): app_dirname = 'templates' def environment(**options): env = Environment(extensions=['jinja2.ext.i18n',], **options) env.g...
Python
0.000001
b447fa44ca1dd2e9d21af4ce61ee6092fe3c94ec
Update test_cmatrices to new interface
tests/test_cmatrices.py
tests/test_cmatrices.py
# to run this test, from directory above: # setenv PYTHONPATH /path/to/pyradiomics/radiomics # nosetests --nocapture -v tests/test_features.py import logging from nose_parameterized import parameterized import numpy import six from radiomics import cMatsEnabled, getFeatureClasses from testUtils import custom_name_fu...
# to run this test, from directory above: # setenv PYTHONPATH /path/to/pyradiomics/radiomics # nosetests --nocapture -v tests/test_features.py import logging from nose_parameterized import parameterized import numpy import six from radiomics import cMatsEnabled, getFeatureClasses from testUtils import custom_name_fu...
Python
0
3b408ed7702100b7f1755f819e05bb61b1740957
add medialab events search- left todo: json and date
media_lab_prado.py
media_lab_prado.py
# http://medialab-prado.es/events/2016-12-01 # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import urllib.request import datetime date = "2017-01-02" url = "http://medialab-prado.es/events/" + date request = urllib.request.urlopen(url) if request.getcode() == 200: request = request.read() soup = BeautifulSo...
# http://medialab-prado.es/events/2016-12-01
Python
0
769e6209db066b8b5908426850fd300fd29098e8
Fix codemirror mode and language name
tcl_kernel/kernel.py
tcl_kernel/kernel.py
from ipykernel.kernelbase import Kernel try: import Tkinter except ImportError: import tkinter as Tkinter __version__ = '0.0.1' class TclKernel(Kernel): implementation = 'tcl_kernel' implementation_version = __version__ language_info = {'name': 'Tcl', 'codemirror_mode': 'Tcl',...
from ipykernel.kernelbase import Kernel try: import Tkinter except ImportError: import tkinter as Tkinter __version__ = '0.0.1' class TclKernel(Kernel): implementation = 'tcl_kernel' implementation_version = __version__ language_info = {'name': 'bash', 'codemirror_mode': 'shel...
Python
0.00003
c517eb40b73151a9b14f46f1991ab692d8b81702
Add docstring for simulation class methods
teemof/simulation.py
teemof/simulation.py
# Date: August 2017 # Author: Kutay B. Sezginel """ Simulation class for reading and initializing Lammps simulations """ import pprint from teemof.read import read_run, read_trial, read_trial_set from teemof.parameters import k_parameters, plot_parameters from teemof.visualize import plot_thermal_conductivity, plot_dis...
# Date: August 2017 # Author: Kutay B. Sezginel """ Simulation class for reading and initializing Lammps simulations """ import pprint from teemof.read import read_run, read_trial, read_trial_set from teemof.parameters import k_parameters, plot_parameters from teemof.visualize import plot_thermal_conductivity, plot_dis...
Python
0
b646e4f376db710101e2c1825bd384b2727e6a79
Disable on win32
tests/test_dateentry.py
tests/test_dateentry.py
import sys import datetime import unittest from kiwi.ui.dateentry import DateEntry class TestDateEntry(unittest.TestCase): def setUp(self): self.date = datetime.date.today() def testGetSetDate(self): if sys.platform == 'win32': return entry = DateEntry() entry.set_...
import datetime import unittest from kiwi.ui.dateentry import DateEntry class TestDateEntry(unittest.TestCase): def setUp(self): self.date = datetime.date.today() def testGetSetDate(self): entry = DateEntry() entry.set_date(self.date) self.assertEqual(entry.get_date(), self.da...
Python
0.000002
17ad68fe77b124fa760857c9e93cbd3d4f9d293e
Write XML of input file to tempdir as well
tests/test_hintfonts.py
tests/test_hintfonts.py
from __future__ import print_function, division, absolute_import import glob from os.path import basename import pytest from fontTools.misc.xmlWriter import XMLWriter from fontTools.cffLib import CFFFontSet from fontTools.ttLib import TTFont from psautohint.autohint import ACOptions, hintFiles from .differ import ma...
from __future__ import print_function, division, absolute_import import glob from os.path import basename import pytest from fontTools.misc.xmlWriter import XMLWriter from fontTools.cffLib import CFFFontSet from fontTools.ttLib import TTFont from psautohint.autohint import ACOptions, hintFiles from .differ import ma...
Python
0
6e67a9e8eedd959d9d0193e746a375099e9784ef
Use bytes instead of str where appropriate for Python 3
toodlepip/consoles.py
toodlepip/consoles.py
class Console(object): def __init__(self, shell, stdout): self._shell = shell self._stdout = stdout def run(self, description, command, **kwargs): return self.run_all(description, [command], **kwargs) def run_all(self, description, commands, quiet=False, cwd=None): ...
class Console(object): def __init__(self, shell, stdout): self._shell = shell self._stdout = stdout def run(self, description, command, **kwargs): return self.run_all(description, [command], **kwargs) def run_all(self, description, commands, quiet=False, cwd=None): ...
Python
0.000561
8034a521692d9857b0d36e2efced40bb69f5efda
Refactor test for and operator
tests/test_operators.py
tests/test_operators.py
from pytest import mark from intervals import IntInterval class TestComparisonOperators(object): def test_eq_operator(self): assert IntInterval([1, 3]) == IntInterval([1, 3]) assert not IntInterval([1, 3]) == IntInterval([1, 4]) def test_ne_operator(self): assert not IntInterval([1, 3...
from pytest import mark from intervals import IntInterval class TestComparisonOperators(object): def test_eq_operator(self): assert IntInterval([1, 3]) == IntInterval([1, 3]) assert not IntInterval([1, 3]) == IntInterval([1, 4]) def test_ne_operator(self): assert not IntInterval([1, 3...
Python
0
5a817413b91adece6f5191d7fe0bf5b4baa430af
Fix test
tests/test_retrieval.py
tests/test_retrieval.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy from numpy.testing import assert_allclose from theano import tensor from dictlearn.vocab import Vocabulary from dictlearn.retrieval import ( vec2str, Dictionary, Retrieval) from dictlearn.ops...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy from numpy.testing import assert_allclose from theano import tensor from dictlearn.vocab import Vocabulary from dictlearn.retrieval import ( vec2str, Dictionary, Retrieval) from dictlearn.ops...
Python
0.000004
006e933a44241e30e1e54c24966d0859aa7c853d
test hub via vanilla, to check imports
tests/unit/test_core.py
tests/unit/test_core.py
import time import vanilla import vanilla.core def test_lazy(): class C(object): @vanilla.core.lazy def now(self): return time.time() c = C() want = c.now time.sleep(0.01) assert c.now == want def test_Scheduler(): s = vanilla.core.Scheduler() s.add(4, 'f2')...
import time import vanilla.core def test_lazy(): class C(object): @vanilla.core.lazy def now(self): return time.time() c = C() want = c.now time.sleep(0.01) assert c.now == want def test_Scheduler(): s = vanilla.core.Scheduler() s.add(4, 'f2') s.add(9, '...
Python
0
f20e76034eef1ea8b7b7f98ace521a3a6346103c
remove default 0.0.0.0 for ip address to pave the way for a unique constraint on the ip address column. Of course this means that network_id needs to be nullable. All of this weakens this table in a way that is making me unhappy. This can and will be solved with more clever check constraints (i.e. network_id can't be n...
1.2.1/src/lib/python2.5/aquilon/aqdb/hw/interface.py
1.2.1/src/lib/python2.5/aquilon/aqdb/hw/interface.py
#!/ms/dist/python/PROJ/core/2.5.0/bin/python # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # $Header$ # $Change$ # $DateTime$ # $Author$ # Copyright (C) 2008 Morgan Stanley # # This module is part of Aquilon """Classes and Tables relating to network interfaces""" fro...
#!/ms/dist/python/PROJ/core/2.5.0/bin/python # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # $Header$ # $Change$ # $DateTime$ # $Author$ # Copyright (C) 2008 Morgan Stanley # # This module is part of Aquilon """Classes and Tables relating to network interfaces""" fro...
Python
0.000001
bae05fd5c15e9360d09dd9456b6d4f1122ddf213
Print the url of dependency JARs being downloaded in buck build
tools/download_jar.py
tools/download_jar.py
#!/usr/bin/python # Copyright (C) 2013 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 ap...
#!/usr/bin/python # Copyright (C) 2013 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 ap...
Python
0.000603
4043468de4fc448b6fda670f33b7f935883793a7
add a test to ensure False is never passed to Git.execute
test/git/test_git.py
test/git/test_git.py
import os from test.testlib import * from git import Git, GitCommandError class TestGit(object): def setup(self): base = os.path.join(os.path.dirname(__file__), "../..") self.git = Git(base) @patch(Git, 'execute') def test_method_missing_calls_execute(self, git): git.return_value =...
import os from test.testlib import * from git import Git, GitCommandError class TestGit(object): def setup(self): base = os.path.join(os.path.dirname(__file__), "../..") self.git = Git(base) @patch(Git, 'execute') def test_method_missing_calls_execute(self, git): git.return_value =...
Python
0
374e10b908fbedf73f3ad40634bb680206da0652
Add setUp
test/test_quality.py
test/test_quality.py
# -*- coding: utf-8 -*- import unittest from pychord import QualityManager, Chord class TestQuality(unittest.TestCase): def setUp(self): self.quality_manager = QualityManager() def test_eq(self): q1 = self.quality_manager.get_quality("m7-5") q2 = self.quality_manager.get_quality("m7...
# -*- coding: utf-8 -*- import unittest from pychord import QualityManager, Chord class TestQuality(unittest.TestCase): def setUp(self): self.quality_manager = QualityManager() def test_eq(self): q1 = self.quality_manager.get_quality("m7-5") q2 = self.quality_manager.get_quality("m7...
Python
0.000002
3707ed6b193a5eed9ec4505f6a283fdaff07ad5e
fix deprecated method
mifiel/api_auth.py
mifiel/api_auth.py
""" [ApiAuth](https://github.com/mgomes/api_auth) for python Based on https://github.com/pd/httpie-api-auth by Kyle Hargraves Usage: import requests requests.get(url, auth=ApiAuth(app_id, secret_key)) """ import hmac, base64, hashlib, datetime from requests.auth import AuthBase from urllib.parse import urlparse class...
""" [ApiAuth](https://github.com/mgomes/api_auth) for python Based on https://github.com/pd/httpie-api-auth by Kyle Hargraves Usage: import requests requests.get(url, auth=ApiAuth(app_id, secret_key)) """ import hmac, base64, hashlib, datetime from requests.auth import AuthBase from urllib.parse import urlparse class...
Python
0.000053
c0894d3c14b8273364454dfa13c94311578ff698
update for diverse usage
mk-1strecurring.py
mk-1strecurring.py
#!/usr/bin/env python3 # (C) Mikhail Kolodin, 2018, ver. 2018-05-31 1.1 # class ic test task: find 1st recurring character in a string import random import string MINSIZE = 1 # min size of test string MAXSIZE = 19 # its max size TESTS = 10 # no of tests alf = string.ascii_uppercase # test alphabe...
#!/usr/bin/env python3 # (C) Mikhail Kolodin, 2018, ver. 1.0 # class ic test task: find 1st recurring character in a string import random import string MINSIZE = 1 # min size of test string MAXSIZE = 9 # its max size TESTS = 10 # no of tests alf = string.ascii_uppercase # test alphabet arr = []...
Python
0
e379f35a15956204f09aa593979fe0a0186cf56e
Update the upload tool
tools/upload_build.py
tools/upload_build.py
"""This script upload a newly-build version of CocoMUD for Windows. The Download wiki page on Redmine are updated. Requirements: This script needs 'python-redmine', which you can obtain with pip install python-redmine """ import argparse from json import dumps import os import re import sys from urllib...
"""This script upload a newly-build version of CocoMUD for Windows. The Download wiki page on Redmine are updated. Requirements: This script needs 'python-redmine', which you can obtain with pip install python-redmine """ import argparse from json import dumps import os import re import sys import urll...
Python
0
3d331ecdb9cb0e64050eb3e4ece27242e1714b3e
Update C_Temperature_Vertical_sections.py
Cas_1/Temperature/C_Temperature_Vertical_sections.py
Cas_1/Temperature/C_Temperature_Vertical_sections.py
import numpy as np import matplotlib.pyplot as plt from xmitgcm import open_mdsdataset plt.ion() dir1 = '/homedata/bderembl/runmit/test_southatlgyre' ds1 = open_mdsdataset(dir1,iters='all',prefix=['T']) Height = ds1.T.Z print(Height) nx = int(len(ds1.T.XC)/2) print(nx) ny = int(len(ds1.T.YC)/2) print(ny) nt = -...
import numpy as np import matplotlib.pyplot as plt from xmitgcm import open_mdsdataset plt.ion() dir1 = '/homedata/bderembl/runmit/test_southatlgyre' ds1 = open_mdsdataset(dir1,iters='all',prefix=['T']) Height = ds1.T.Z print(Height) nx = int(len(ds1.T.XC)/2) print(nx) ny = int(len(ds1.T.YC)/2) print(ny) nt = -...
Python
0.000001
b2542f8c3625150f9716eb0b1fcb44ee15520ae8
fix path to nvim files
mod/vim/install.py
mod/vim/install.py
import packages import util def run(): spell_dir = '~/.config/vim/spell/' choices = [ 'vim', 'gvim', # gvim supports for X11 clipboard, but has more dependencies ] choice = None while choice not in choices: choice = input('Which package to install? (%s) ' % choices).lower...
import packages import util def run(): spell_dir = '~/.config/vim/spell/' choices = [ 'vim', 'gvim', # gvim supports for X11 clipboard, but has more dependencies ] choice = None while choice not in choices: choice = input('Which package to install? (%s) ' % choices).lower...
Python
0
6d2e66ab5b9b452474701ffc5035e4a8106db637
Add test_Record unit tests
tests/test_Record.py
tests/test_Record.py
import unittest import os, shutil from GeometrA.src.Record import * from GeometrA.src.File.WorkSpace import WorkSpace RECORD_FILE = './tests/record.log' class RecordTestSuite(unittest.TestCase): @classmethod def setUpClass(cls): path = './tests/Project0' if os.path.isdir(path): s...
# import unittest # # import os, shutil # # from GeometrA.src.Record import * # from GeometrA.src.File.WorkSpace import WorkSpace # # RECORD_FILE = './tests/record.log' # # class RecordTestSuite(unittest.TestCase): # @classmethod # def setUpClass(cls): # path = './tests/Project0' # if os.path.is...
Python
0.000001
36e066ae645eb9b874ff1ce814708bd024c519e0
add support to get git revision from toymaker.
toymakerlib/toymaker.py
toymakerlib/toymaker.py
#! /usr/bin/env python import sys import os import getopt import optparse import traceback import toydist from toydist.core.utils import \ subst_vars, pprint from toydist.core.platforms import \ get_scheme from toydist.core.descr_parser import \ ParseError from toydist.commands.core import \ ...
#! /usr/bin/env python import sys import os import getopt import optparse import traceback import toydist from toydist.core.utils import \ subst_vars, pprint from toydist.core.platforms import \ get_scheme from toydist.core.descr_parser import \ ParseError from toydist.commands.core import \ ...
Python
0
d9407ebda411d49212da35e27f08718dade1cd02
Support Info is unable to read package version and git version
modules/support.py
modules/support.py
# -*- coding: utf-8 -*- """Support Information module. The module provides functions to gain information to be included in issues. It neither contains normal functionality nor is it used by GitGutter. """ import os import subprocess import textwrap import sublime import sublime_plugin # get absolute path of the pack...
# -*- coding: utf-8 -*- """Support Information module. The module provides functions to gain information to be included in issues. It neither contains normal functionality nor is it used by GitGutter. """ import os import subprocess import textwrap import sublime import sublime_plugin PACKAGE = os.path.basename(os.p...
Python
0
3425c2c9d19c1d0a54dafde6cc70d571421c82a9
Fix string app import error for python 3.5
tests/test_config.py
tests/test_config.py
import logging import socket import pytest from uvicorn import protocols from uvicorn.config import Config from uvicorn.middleware.debug import DebugMiddleware from uvicorn.middleware.wsgi import WSGIMiddleware async def asgi_app(): pass def wsgi_app(): pass def test_debug_app(): config = Config(app...
import logging import socket import pytest from uvicorn import protocols from uvicorn.config import Config from uvicorn.middleware.debug import DebugMiddleware from uvicorn.middleware.wsgi import WSGIMiddleware async def asgi_app(): pass def wsgi_app(): pass def test_debug_app(): config = Config(app...
Python
0.999224
1df8efb63333e89777820a96d78d5a59252b303d
Rename test specific to with gpg
tests/test_config.py
tests/test_config.py
import unittest import figgypy.config import sys import os class TestConfig(unittest.TestCase): def test_config_load_with_gpg(self): os.environ['FIGGY_GPG_HOME']='tests/resources/test-keys' c = figgypy.config.Config('tests/resources/test-config.yaml') self.assertEqual(c.db['host'], 'db.hec...
import unittest import figgypy.config import sys import os class TestConfig(unittest.TestCase): def test_config_load(self): os.environ['FIGGY_GPG_HOME']='tests/resources/test-keys' c = figgypy.config.Config('tests/resources/test-config.yaml') self.assertEqual(c.db['host'], 'db.heck.ya') ...
Python
0
c5f44c9dda9905e9aa817c1945d49892e686f9cd
Fix failing test
tests/test_models.py
tests/test_models.py
# -*- coding: utf-8 -*- import datetime as dt import pytest from doorman.models import Node, Pack, Query, Tag, FilePath from .factories import NodeFactory, PackFactory, QueryFactory, TagFactory @pytest.mark.usefixtures('db') class TestNode: def test_factory(self, db): node = NodeFactory(host_identi...
# -*- coding: utf-8 -*- import datetime as dt import pytest from doorman.models import Node, Pack, Query, Tag, FilePath from .factories import NodeFactory, PackFactory, QueryFactory, TagFactory @pytest.mark.usefixtures('db') class TestNode: def test_factory(self, db): node = NodeFactory(host_identi...
Python
0.000209
66eddf04efd46fb3dbeae34c4d82f673a88be70f
Test the ability to add phone to the person
tests/test_person.py
tests/test_person.py
from copy import copy from unittest import TestCase from address_book import Person class PersonTestCase(TestCase): def test_get_groups(self): pass def test_add_address(self): basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42'] person = Pers...
from copy import copy from unittest import TestCase from address_book import Person class PersonTestCase(TestCase): def test_get_groups(self): pass def test_add_address(self): basic_address = ['Russian Federation, Kemerovo region, Kemerovo, Kirova street 23, apt. 42'] person = Pers...
Python
0.000032
5017ee713fd03902aa502836654e1961fb7575f1
test form action url
tests/test_plugin.py
tests/test_plugin.py
from bs4 import BeautifulSoup from cms.api import add_plugin from cms.models import Placeholder from django.core.urlresolvers import reverse from django.test import TestCase from cmsplugin_feedback.cms_plugins import FeedbackPlugin, \ DEFAULT_FORM_FIELDS_ID, DEFAULT_FORM_CLASS from cmsplugin_feedback.forms import ...
from bs4 import BeautifulSoup from cms.api import add_plugin from cms.models import Placeholder from django.test import TestCase from cmsplugin_feedback.cms_plugins import FeedbackPlugin, \ DEFAULT_FORM_FIELDS_ID, DEFAULT_FORM_CLASS from cmsplugin_feedback.forms import FeedbackMessageForm class FeedbackPluginTes...
Python
0.000002
5e2b9410a7db019e4ad1056ec0a3d507374e5e4b
Make sure that get_user_config is called in replay.dump
tests/test_replay.py
tests/test_replay.py
# -*- coding: utf-8 -*- """ test_replay ----------- """ import json import os import pytest from cookiecutter import replay, utils from cookiecutter.config import get_user_config @pytest.fixture def replay_dir(): """Fixture to return the expected replay directory.""" return os.path.expanduser('~/.cookiecu...
# -*- coding: utf-8 -*- """ test_replay ----------- """ import json import os import pytest from cookiecutter import replay, utils from cookiecutter.config import get_user_config @pytest.fixture def replay_dir(): """Fixture to return the expected replay directory.""" return os.path.expanduser('~/.cookiecu...
Python
0.000005
02bd3772fcf20d9dc54bd94c125c2efc6ae01537
Make sure structs are pickleable
tests/test_struct.py
tests/test_struct.py
#!/usr/bin/env python """ Contains various tests for the `Struct` class of the base module. :file: StructTests.py :date: 30/08/2015 :authors: - Gilad Naaman <gilad@naaman.io> """ from .utils import * ######################### # "Structs" for testing # ######################### class SmallStruct(Struct): on...
#!/usr/bin/env python """ Contains various tests for the `Struct` class of the base module. :file: StructTests.py :date: 30/08/2015 :authors: - Gilad Naaman <gilad@naaman.io> """ from .utils import * ######################### # "Structs" for testing # ######################### class SmallStruct(Struct): on...
Python
0.000225
28f6af7f84860535a1a82750df286f78320a6856
Fix monkeypatching
tests/test_things.py
tests/test_things.py
from __future__ import division import stft import numpy import pytest @pytest.fixture(params=[1, 2]) def channels(request): return request.param @pytest.fixture(params=[0, 1, 4]) def padding(request): return request.param @pytest.fixture(params=[2048]) def length(request): return request.param @pyt...
from __future__ import division import stft import numpy import pytest @pytest.fixture(params=[1, 2]) def channels(request): return request.param @pytest.fixture(params=[0, 1, 4]) def padding(request): return request.param @pytest.fixture(params=[2048]) def length(request): return request.param @pyt...
Python
0.000001
36200dea5889bdf4ad920adc1ab04ae3870f74ac
Edit varnet model (#5096)
tests/test_varnet.py
tests/test_varnet.py
# Copyright (c) MONAI Consortium # 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, so...
# Copyright (c) MONAI Consortium # 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, so...
Python
0.000004
ddd3947514900d99bc644b8a791a92807bee4f2c
use mock
tests/test_worker.py
tests/test_worker.py
import functools import unittest from unittest import mock as um from tornado import ioloop as ti, gen as tg from acddl import worker class TestWorker(unittest.TestCase): def setUp(self): self._worker = worker.Worker() self._worker.start() self.assertTrue(self._worker.is_alive()) d...
import unittest import functools from tornado import ioloop as ti, gen as tg from acddl import worker class TestWorker(unittest.TestCase): def setUp(self): self._worker = worker.Worker() self._worker.start() self.assertTrue(self._worker.is_alive()) def tearDown(self): async...
Python
0.000016
3e84dcb7b449db89ca6ce2b91b34a5e8f8428b39
Allow sub- and superscript tags
core/markdown.py
core/markdown.py
from markdown.extensions import nl2br, sane_lists, fenced_code from pymdownx import magiclink from mdx_unimoji import UnimojiExtension import utils.markdown markdown_extensions = [ magiclink.MagiclinkExtension(), nl2br.Nl2BrExtension(), utils.markdown.ExtendedLinkExtension(), sane_lists.SaneListExtensi...
from markdown.extensions import nl2br, sane_lists, fenced_code from pymdownx import magiclink from mdx_unimoji import UnimojiExtension import utils.markdown markdown_extensions = [ magiclink.MagiclinkExtension(), nl2br.Nl2BrExtension(), utils.markdown.ExtendedLinkExtension(), sane_lists.SaneListExtensi...
Python
0.000006
b3c55b059293d664d3e029b9c3d03203ff4af5a5
remove ws
resturo/tests/models.py
resturo/tests/models.py
from ..models import Organization as BaseOrganization from ..models import Membership as BaseMembership class Organization(BaseOrganization): """ """ class Membership(BaseMembership): """ Provide non-abstract implementation for Membership model, define some roles """ ROLE_MEMBER = 1
from ..models import Organization as BaseOrganization from ..models import Membership as BaseMembership class Organization(BaseOrganization): """ """ class Membership(BaseMembership): """ Provide non-abstract implementation for Membership model, define some roles """ ROLE_MEMBER = 1
Python
0.000054
32dd33126c9fa0076c8d7c9e8024a709674f8614
Bump Version 0.0.28 -> 0.0.29
threebot/__init__.py
threebot/__init__.py
# -*- encoding: utf-8 -*- __version__ = '0.0.29'
# -*- encoding: utf-8 -*- __version__ = '0.0.28'
Python
0
363583654998e404baba9b72860d2465bb3d339e
Remove convoluted meshgrid statement.
mplstyles/plots.py
mplstyles/plots.py
from matplotlib import cm import matplotlib.pyplot as plt from mplstyles import cmap as colormap import numpy as np import scipy.ndimage def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_smoothing=0,contour_opts={},label_opts={},imshow_opts={},clegendlabels=[],label=False): ax = pl...
from matplotlib import cm import matplotlib.pyplot as plt from mplstyles import cmap as colormap import numpy as np import scipy.ndimage def contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_smoothing=0,contour_opts={},label_opts={},imshow_opts={},clegendlabels=[],label=False): ax = pl...
Python
0.000005
7177f7e0263d8a5f2adf458f9bfe33bff12137e0
fix syntax error
n_sided_polygon.py
n_sided_polygon.py
import turtle import turtlehack import random # A function that draws an n-sided polygon def n_sided_polygon(turtle, n, color="#FFFFFF", line_thickness=1): ''' Draw an n-sided polygon input: turtle, n, line_length ''' # for n times: # Draw a line, then turn 360/n degrees and draw another # set initial paramete...
import turtle import turtlehack import random # A function that draws an n-sided polygon def n_sided_polygon(turtle, n, color="#FFFFFF", line_thickness=1): ''' Draw an n-sided polygon input: turtle, n, line_length ''' # for n times: # Draw a line, then turn 360/n degrees and draw another # set initial paramete...
Python
0.000003
458d61ffb5161394f8080cea59716b2f9cb492f3
Add error message for not implemented error
nbgrader_config.py
nbgrader_config.py
c = get_config() c.CourseDirectory.db_assignments = [dict(name="1", duedate="2019-12-09 17:00:00 UTC")] c.CourseDirectory.db_students = [ dict(id="foo", first_name="foo", last_name="foo") ] c.ClearSolutions.code_stub = {'python': '''##### Implement this part of the code ##### raise NotImplementedError("Code not imp...
c = get_config() c.CourseDirectory.db_assignments = [dict(name="1", duedate="2019-12-09 17:00:00 UTC")] c.CourseDirectory.db_students = [ dict(id="foo", first_name="foo", last_name="foo") ] c.ClearSolutions.code_stub = {'python': '##### Implement this part of the code #####\nraise NotImplementedError()'}
Python
0.000001
1cae5cf5b2874eb2bafc9486d4873abfa1a58366
Add log_to_file method
toolsweb/__init__.py
toolsweb/__init__.py
# -*- coding: utf-8 -*- import flask import jinja2 import logging import os.path import oursql def connect_to_database(database, host): default_file = os.path.expanduser('~/replica.my.cnf') if not os.path.isfile(default_file): raise Exception('Database access not configured for this account!') ...
# -*- coding: utf-8 -*- import flask import jinja2 import os.path import oursql def connect_to_database(database, host): default_file = os.path.expanduser('~/replica.my.cnf') if not os.path.isfile(default_file): raise Exception('Database access not configured for this account!') return oursql...
Python
0.000008
cf8cc12b9a3bb4cfb550db1c75b1fa24db3c357d
{{{config.options}}} returns a list in some circumstances.
trac/tests/config.py
trac/tests/config.py
# -*- coding: iso8859-1 -*- # # Copyright (C) 2005 Edgewall Software # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de> # # Trac is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # Lic...
# -*- coding: iso8859-1 -*- # # Copyright (C) 2005 Edgewall Software # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de> # # Trac is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # Lic...
Python
0.999999
9ff4fbcdf5b21d263e8b20abb0a3d0395ce28981
Document the reason for accepting only `POST` requests on `/wiki_render`, and allow `GET` requests from `TRAC_ADMIN` for testing purposes.
trac/wiki/web_api.py
trac/wiki/web_api.py
# -*- coding: utf-8 -*- # # Copyright (C) 2009 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consists o...
# -*- coding: utf-8 -*- # # Copyright (C) 2009 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consists o...
Python
0
bb696f7c5b97563339f04206e649b54759fc9c6b
add transform for in__id to base get method
actions/lib/action.py
actions/lib/action.py
from st2actions.runners.pythonrunner import Action import requests __all__ = [ 'NetboxBaseAction' ] class NetboxBaseAction(Action): """Base Action for all Netbox API based actions """ def __init__(self, config): super(NetboxBaseAction, self).__init__(config) def get(self, endpoint_uri...
from st2actions.runners.pythonrunner import Action import requests __all__ = [ 'NetboxBaseAction' ] class NetboxBaseAction(Action): """Base Action for all Netbox API based actions """ def __init__(self, config): super(NetboxBaseAction, self).__init__(config) def get(self, endpoint_uri...
Python
0.000001
e1074fbc814b238a8d6d878810a8ac665a169f03
Fix template name in views
nomadblog/views.py
nomadblog/views.py
from django.views.generic import ListView, DetailView from django.shortcuts import get_object_or_404 from django.conf import settings from nomadblog.models import Blog, Category from nomadblog import get_post_model DEFAULT_STATUS = getattr(settings, 'PUBLIC_STATUS', 0) POST_MODEL = get_post_model() class NomadBlog...
from django.views.generic import ListView, DetailView from django.shortcuts import get_object_or_404 from django.conf import settings from nomadblog.models import Blog, Category from nomadblog import get_post_model DEFAULT_STATUS = getattr(settings, 'PUBLIC_STATUS', 0) POST_MODEL = get_post_model() class NomadBlog...
Python
0
44161337282d14a48bde278b6e1669e8b3c94e4e
Bump version to 0.1.7
notify/__init__.py
notify/__init__.py
__version__ = "0.1.7"
__version__ = "0.1.6"
Python
0.000001
72a827b8cca6dc100e7f0d2d92e0c69aa67ec956
change name and docstring
apps/auth/iufOAuth.py
apps/auth/iufOAuth.py
from social.backends.oauth import BaseOAuth2 # see http://psa.matiasaguirre.net/docs/backends/implementation.html class IUFOAuth2(BaseOAuth2): """IUF OAuth authentication backend""" name = 'iuf' AUTHORIZATION_URL = 'https://iufinc.org/login/oauth/authorize' ACCESS_TOKEN_URL = 'https://iufinc.org/login/...
from social.backends.oauth import BaseOAuth2 # see http://psa.matiasaguirre.net/docs/backends/implementation.html class IUFOAuth2(BaseOAuth2): """Github OAuth authentication backend""" name = 'github' AUTHORIZATION_URL = 'https://iufinc.org/login/oauth/authorize' ACCESS_TOKEN_URL = 'https://iufinc.org/...
Python
0.000002
140f96ab4cddebd465ad2fdcca4560c683ca5770
add django-markdown url for tutorials app
oeplatform/urls.py
oeplatform/urls.py
"""oeplatform URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
"""oeplatform URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
Python
0
7c77a7b14432a85447ff74e7aa017ca56c86e662
Make api-tokens view exempt from CSRF checks
oidc_apis/views.py
oidc_apis/views.py
from django.http import JsonResponse from django.views.decorators.http import require_http_methods from oidc_provider.lib.utils.oauth2 import protected_resource_view from django.views.decorators.csrf import csrf_exempt from .api_tokens import get_api_tokens_by_access_token @csrf_exempt @require_http_methods(['GET', ...
from django.http import JsonResponse from django.views.decorators.http import require_http_methods from oidc_provider.lib.utils.oauth2 import protected_resource_view from .api_tokens import get_api_tokens_by_access_token @require_http_methods(['GET', 'POST']) @protected_resource_view(['openid']) def get_api_tokens_v...
Python
0.000001
0417707ab0dca78f0daa8aa3b9003913ba90bbac
Add length and highway attribute to the edges
osmABTS/network.py
osmABTS/network.py
""" Road network formation ====================== The primary purpose of this model is to abstract a road connectivity network from the complicated OSM raw GIS data. The network is going to be stored as a NetworkX graph. The nodes are going to be just the traffic junctions and the dead ends of the road traffic system...
""" Road network formation ====================== The primary purpose of this model is to abstract a road connectivity network from the complicated OSM raw GIS data. The network is going to be stored as a NetworkX graph. The nodes are going to be just the traffic junctions and the dead ends of the road traffic system...
Python
0
7e9dd7469f88d676959141534809b0bc10fc9a66
Print newline on de-initialization.
picotui/context.py
picotui/context.py
from .screen import Screen class Context: def __init__(self, cls=True, mouse=True): self.cls = cls self.mouse = mouse def __enter__(self): Screen.init_tty() if self.mouse: Screen.enable_mouse() if self.cls: Screen.cls() return self ...
from .screen import Screen class Context: def __init__(self, cls=True, mouse=True): self.cls = cls self.mouse = mouse def __enter__(self): Screen.init_tty() if self.mouse: Screen.enable_mouse() if self.cls: Screen.cls() return self ...
Python
0
1a8ab29c9f7a02730cababc077f196f9b21e26d4
Use own repo slug by default for Bitbucket.deploy_key.all() .
bitbucket/deploy_key.py
bitbucket/deploy_key.py
# -*- coding: utf-8 -*- URLS = { # deploy keys 'GET_DEPLOY_KEYS': 'repositories/%(username)s/%(repo_slug)s/deploy-keys', 'SET_DEPLOY_KEY': 'repositories/%(username)s/%(repo_slug)s/deploy-keys', 'GET_DEPLOY_KEY': 'repositories/%(username)s/%(repo_slug)s/deploy-key/%(key_id)s', 'DELETE_DEPLOY_KEY': 'r...
# -*- coding: utf-8 -*- URLS = { # deploy keys 'GET_DEPLOY_KEYS': 'repositories/%(username)s/%(repo_slug)s/deploy-keys', 'SET_DEPLOY_KEY': 'repositories/%(username)s/%(repo_slug)s/deploy-keys', 'GET_DEPLOY_KEY': 'repositories/%(username)s/%(repo_slug)s/deploy-key/%(key_id)s', 'DELETE_DEPLOY_KEY': 'r...
Python
0
6650e5898ca058d1dc8494dbc3d0ba2e2d8c1e4c
Compute the distance between two points on the globe and determine if air travel is possible between them in the time between when localities were recorded
alerts/geomodel/alert.py
alerts/geomodel/alert.py
from datetime import datetime import math from operator import attrgetter from typing import List, NamedTuple, Optional import netaddr from alerts.geomodel.config import Whitelist from alerts.geomodel.locality import State, Locality _AIR_TRAVEL_SPEED = 1000.0 # km/h _EARTH_RADIUS = 6373.0 # km # approximate _DEFA...
from datetime import datetime from operator import attrgetter from typing import List, NamedTuple, Optional import netaddr from alerts.geomodel.config import Whitelist from alerts.geomodel.locality import State, Locality _DEFAULT_SUMMARY = 'Authenticated action taken by a user outside of any of '\ 'their known ...
Python
0.998967
451c821118eff98d7e92b3a3f46b1a76048abbb5
add wiki canned response
androiddev_bot/config.py
androiddev_bot/config.py
import praw # Put your vars here suspect_title_strings = ['?', 'help', 'stuck', 'why', 'my', 'feedback'] subreddit = 'androiddev' # Canned responses cans = { 'questions_thread': "Removed because, per sub rules, this doesn't merit its own post. We have a questions thread every day, please use it for questions lik...
import praw # Put your vars here suspect_title_strings = ['?', 'help', 'stuck', 'why', 'my', 'feedback'] subreddit = 'androiddev' # Canned responses cans = { 'questions_thread': "Removed because, per sub rules, this doesn't merit its own post. We have a questions thread every day, please use it for questions lik...
Python
0
e5dcea13a27b90f89469518386a1748f3e141b5b
Improve docs of doQuery.py file.
app/lib/query/doQuery.py
app/lib/query/doQuery.py
# -*- coding: utf-8 -*- """ Receive SQL query in stdin, send to configured database file, then return the query result rows. Note that db queries don't have to done through python like this, but can be done in SQL directly. For example: $ sqlite3 path/to/db -csv -header < path/to/query > path/to/report Usage: ...
# -*- coding: utf-8 -*- """ Receive SQL query in stdin, send to configured database file, then return the query result rows. Usage: ## methods of input: # Pipe text to the script. $ echo "SELECT * FROM Trend LIMIT 10" | python -m lib.query.doQuery # Redirect text from .sql file to the script. $ p...
Python
0