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
db8a5a8b0316d8784f275b61835a40b9c6bcd8f7
Made option type as integer
hyde.py
hyde.py
#!/usr/bin/env python import os import sys import threading from optparse import OptionParser from hydeengine import Generator, Initializer, Server #import cProfile PROG_ROOT = os.path.dirname(os.path.abspath( __file__ )) def main(argv): parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 0.3b") ...
#!/usr/bin/env python import os import sys import threading from optparse import OptionParser from hydeengine import Generator, Initializer, Server #import cProfile PROG_ROOT = os.path.dirname(os.path.abspath( __file__ )) def main(argv): parser = OptionParser(usage="%prog [-f] [-q]", version="%prog 0.3b") ...
Python
0.999965
4d810f6f447cdab43187e6da1cca2830766731f1
add config check test
tests/test_05_task.py
tests/test_05_task.py
# ________________________________________________________________________ # # Copyright (C) 2014 Andrew Fullford # # 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.ap...
# ________________________________________________________________________ # # Copyright (C) 2014 Andrew Fullford # # 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.ap...
Python
0.000001
83006927725a16615930b748e2a46a85cafc6430
Fix one more typo on make_nearest_neighbour_index
tensorflow_hub/pip_package/setup.py
tensorflow_hub/pip_package/setup.py
# Copyright 2018 The TensorFlow Hub Authors. 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 app...
# Copyright 2018 The TensorFlow Hub Authors. 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 app...
Python
0.999999
ddfc569ba310ce2de3b4a4ae63111556646496f8
remove more f-strings
tests/test_keyfile.py
tests/test_keyfile.py
# MIT licensed # Copyright (c) 2018 lilydjwg <lilydjwg@gmail.com>, et al. import os import tempfile import contextlib from nvchecker.source import HTTPError import pytest pytestmark = [pytest.mark.asyncio] @contextlib.contextmanager def unset_github_token_env(): token = os.environ.get('NVCHECKER_GITHUB_TOKEN') ...
# MIT licensed # Copyright (c) 2018 lilydjwg <lilydjwg@gmail.com>, et al. import os import tempfile import contextlib from nvchecker.source import HTTPError import pytest pytestmark = [pytest.mark.asyncio] @contextlib.contextmanager def unset_github_token_env(): token = os.environ.get('NVCHECKER_GITHUB_TOKEN') ...
Python
0.000118
1fa3acf2b926162235372f34d368aab31acc14b0
Add unittest exception for timedelta on Python < 2.6
tests/test_max_age.py
tests/test_max_age.py
# -*- coding: utf-8 -*- """ test ~~~~ Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2014 by Cory Dolphin. :license: MIT, see LICENSE for more details. """ from datetime import timedelta import sys...
# -*- coding: utf-8 -*- """ test ~~~~ Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2014 by Cory Dolphin. :license: MIT, see LICENSE for more details. """ from datetime import timedelta from tests...
Python
0
b8374e20640630044f59e4b4733e588345e07ab5
Fix unittest in asyncio debug mode
tests/test_prepare.py
tests/test_prepare.py
import inspect from asyncpg import _testbase as tb class TestPrepare(tb.ConnectedTestCase): async def test_prepare_1(self): st = await self.con.prepare('SELECT 1 = $1 AS test') rec = await st.get_first_row(1) self.assertTrue(rec['test']) self.assertEqual(len(rec), 1) sel...
import inspect from asyncpg import _testbase as tb class TestPrepare(tb.ConnectedTestCase): async def test_prepare_1(self): st = await self.con.prepare('SELECT 1 = $1 AS test') rec = await st.get_first_row(1) self.assertTrue(rec['test']) self.assertEqual(len(rec), 1) sel...
Python
0.000006
a44e3be0b0a6188dfa85fcb53433b64ca81f5f46
test output_subprocess
tests/test_process.py
tests/test_process.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Test scriptharness/process.py """ from __future__ import absolute_import, division, print_function, \ unicode_literals import mock import os import psutil from scriptharness.exceptions import ScriptHarnessFatal import scriptharness.process as shpro...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Test scriptharness/process.py """ from __future__ import absolute_import, division, print_function, \ unicode_literals import mock import os import psutil from scriptharness.exceptions import ScriptHarnessFatal import scriptharness.process as shpro...
Python
0.000185
9e62b41dc762b1088bd5c1474678d7e7ed120add
test case with stage parameter
tests/test_profile.py
tests/test_profile.py
import os import sys import pytest from pkgstack.profile import Profile TESTS_PATH=os.path.realpath(os.path.dirname(__file__)) def test_profile_create(tmpdir): config = Profile(os.path.join(TESTS_PATH, 'resources/sample.yml')).config assert config == [ {'install': 'pytest', 'stage': 'test'}, ...
import os import sys import pytest from pkgstack.profile import Profile TESTS_PATH=os.path.realpath(os.path.dirname(__file__)) def test_profile_create(tmpdir): config = Profile(os.path.join(TESTS_PATH, 'resources/sample.yml')).config assert config == [ {'install': 'pytest', 'stage': 'test'}, ...
Python
0.000001
0cef40e4ee30acbee12e179196dfc65c69890518
Add a failed-connect test for sock_connect
tests/test_sockets.py
tests/test_sockets.py
import asyncio import socket import uvloop from uvloop import _testbase as tb _SIZE = 1024 * 1024 class _TestSockets: async def recv_all(self, sock, nbytes): buf = b'' while len(buf) < nbytes: buf += await self.loop.sock_recv(sock, nbytes - len(buf)) return buf def tes...
import asyncio import socket import uvloop from uvloop import _testbase as tb _SIZE = 1024 * 1024 class _TestSockets: async def recv_all(self, sock, nbytes): buf = b'' while len(buf) < nbytes: buf += await self.loop.sock_recv(sock, nbytes - len(buf)) return buf def tes...
Python
0.000003
244fc6b436398055f650ea3a64e9388586604cd9
Add test for group collection access.
testsuite/test_acl.py
testsuite/test_acl.py
import pytest pytestmark = pytest.mark.django_db def test_collections_acl_users(client): from django.contrib.auth.models import User, AnonymousUser from hoover.search.models import Collection from hoover.search.views import collections_acl anonymous = AnonymousUser() alice = User.objects.create_us...
import pytest pytestmark = pytest.mark.django_db def test_collections_acl(client): from django.contrib.auth.models import User, AnonymousUser from hoover.search.models import Collection from hoover.search.views import collections_acl anonymous = AnonymousUser() alice = User.objects.create_user('al...
Python
0
fa7b2a707be689c57d744d0ada5049dfb6b15789
Set leave=False on pbar
thinc/neural/train.py
thinc/neural/train.py
from __future__ import unicode_literals, print_function from .optimizers import Eve, Adam, SGD, linear_decay from .util import minibatch import numpy.random from tqdm import tqdm class Trainer(object): def __init__(self, model, **cfg): self.ops = model.ops self.model = model self.L2 = cf...
from __future__ import unicode_literals, print_function from .optimizers import Eve, Adam, SGD, linear_decay from .util import minibatch import numpy.random from tqdm import tqdm class Trainer(object): def __init__(self, model, **cfg): self.ops = model.ops self.model = model self.L2 = cf...
Python
0.000189
603bfdc9cb0f9bf8e29306e161728423f1f57f86
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.000001
34721c0078d564538a4cf20ac15560a1bf119bac
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.000021
fd641ebb631d4b7d03bf978de2dc22f4c2966dd5
Update 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.000016
b3abe856ff2e430f64c60d28b77e95c73b842b47
fix wrong table header
src/search.py
src/search.py
import xml.etree.ElementTree as ET import texttable as tt import re from config import user_id, password from datetime import date from wos import WosClient def _draw_table(data): # Generate table tab = tt.Texttable() tab.add_rows(data) tab.set_cols_align(['l', 'l', 'l']) tab.header(['Year', 'Tit...
import xml.etree.ElementTree as ET import texttable as tt import re from config import user_id, password from datetime import date from wos import WosClient def _draw_table(data): # Generate table tab = tt.Texttable() tab.add_rows(data) tab.set_cols_align(['l', 'l', 'l']) tab.header(['year', 'id'...
Python
0.000008
cdfa28910b48ae8847203ea8ad9ab8f173a64027
Format with black.
spotseeker_server/org_filters/__init__.py
spotseeker_server/org_filters/__init__.py
""" Copyright 2013 Board of Trustees, University of Illinois 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 appli...
""" Copyright 2013 Board of Trustees, University of Illinois 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 appli...
Python
0
f09c65f980fd9a7364d038ca8eb0b007f74677f5
Increase version
tinymce_4/__init__.py
tinymce_4/__init__.py
# -*- coding: utf-8 -*- __version__ = '0.0.25-dev'
# -*- coding: utf-8 -*- __version__ = '0.0.24'
Python
0
197fad99d2e60064dca76bec41400390bc0a2937
Remove mail templates since we're not testing them here; might be good to include a test for this elsewhere
helpdesk/tests/test_get_email.py
helpdesk/tests/test_get_email.py
from helpdesk.models import Queue, Ticket from helpdesk.management.commands.get_email import process_email from django.test import TestCase from django.core import mail from django.core.management import call_command from django.test.client import Client from django.utils import six from django.core.urlresolvers import...
from helpdesk.models import Queue, Ticket from helpdesk.management.commands.get_email import process_email from django.test import TestCase from django.core import mail from django.core.management import call_command from django.test.client import Client from django.utils import six from django.core.urlresolvers import...
Python
0
fb705488aedeec3de842cd0be1b7aff9fe018962
Allow to specify additional external links for Javadocs
tools/bzl/javadoc.bzl
tools/bzl/javadoc.bzl
# Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# Copyright (C) 2016 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
Python
0
cca2ef0f3700c4eafe66c8f751ecb2fc03318e2b
Disable boto3 deprecation warning logs
tools/delete_fleet.py
tools/delete_fleet.py
import sys from time import sleep import boto3 from botocore.exceptions import ClientError boto3.compat.filter_python_deprecation_warnings() def describe_fleets(region, fleet_id): ec2 = boto3.client('ec2', region_name=region) response = ec2.describe_fleets( FleetIds=[ fleet_id ], ...
import sys from time import sleep import boto3 from botocore.exceptions import ClientError def describe_fleets(region, fleet_id): ec2 = boto3.client('ec2', region_name=region) response = ec2.describe_fleets( FleetIds=[ fleet_id ], ) errors = response['Fleets'][0]['Errors'] ...
Python
0
8a6370f7c91fec6c220bc2e438a236816c636341
Revert throttle Arlo api calls (#13174)
homeassistant/components/arlo.py
homeassistant/components/arlo.py
""" This component provides support for Netgear Arlo IP cameras. For more details about this component, please refer to the documentation at https://home-assistant.io/components/arlo/ """ import logging import voluptuous as vol from requests.exceptions import HTTPError, ConnectTimeout from homeassistant.helpers impo...
""" This component provides support for Netgear Arlo IP cameras. For more details about this component, please refer to the documentation at https://home-assistant.io/components/arlo/ """ import logging from datetime import timedelta import voluptuous as vol from requests.exceptions import HTTPError, ConnectTimeout ...
Python
0
b221ed2e83cd352b1eec0ad74a3e02946db39197
Add an example of yielding a dict in plpy
examples/spouse_example/plpy_extractor/udf/ext_people.py
examples/spouse_example/plpy_extractor/udf/ext_people.py
#! /usr/bin/env python import ddext import itertools # Format of plpy_extractor: # Anything Write functions "init", "run" will not be accepted. # In "init", import libraries, specify input variables and return types # In "run", write your extractor. Return a list containing your results, each item in the list should ...
#! /usr/bin/env python import ddext import itertools # Format of plpy_extractor: # Anything Write functions "init", "run" will not be accepted. # In "init", import libraries, specify input variables and return types # In "run", write your extractor. Return a list containing your results, each item in the list should ...
Python
0.000875
3010b38a15ca90f51a72e0cf3698ca218aaa144f
Remove an execution warning.
requests_graph.py
requests_graph.py
#!/usr/bin/env python3 import sys import time import array import datetime import requests import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt NB_HOURS = 24 GRANULOMETRY = 15 # must be a divisor of 60 if len(sys.argv) != 2: print('Syntax: %s file.png' % sys.argv[0]) exit(1) # Get data da...
#!/usr/bin/env python3 import sys import time import array import datetime import requests import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt NB_HOURS = 24 GRANULOMETRY = 15 # must be a divisor of 60 if len(sys.argv) != 2: print('Syntax: %s file.png' % sys.argv[0]) exit(1) # Get data da...
Python
0.000005
a240cbaa13be8682e5611241634a761df581efff
fix format
sw-project.py
sw-project.py
# Import the SDK import facebook # import the secret token import secret # For date and time operations from datetime import datetime, date, time # open connection g = facebook.GraphAPI(secret.ACCESS_TOKEN) # retrieve friends friends = g.get_connections("me", "friends")['data'] # retrieve their likes likes = {friend...
# Import the SDK import facebook # import the secret token import secret # For date and time operations from datetime import datetime, date, time # open connection g = facebook.GraphAPI(secret.ACCESS_TOKEN) # retrieve friends friends = g.get_connections("me", "friends")['data'] # retrieve their likes likes = { frien...
Python
0.00006
e99239184cffbdc1ca08ba0050f6e4f23e1155fd
Allow import error to propagate up
romanesco/spark.py
romanesco/spark.py
import six import romanesco import os import sys from ConfigParser import ConfigParser, NoOptionError def setup_spark_env(): # Setup pyspark try: spark_home = romanesco.config.get('spark', 'spark_home') # If not configured try the environment if not spark_home: spark_home...
import six import romanesco import os import sys from ConfigParser import ConfigParser, NoOptionError def setup_spark_env(): # Setup pyspark try: spark_home = romanesco.config.get('spark', 'spark_home') # If not configured try the environment if not spark_home: spark_home...
Python
0
7a81c289d944bad4505a51c80b701f5f11159787
stop bandwagon leaving temp files around
apps/bandwagon/tests/test_tasks.py
apps/bandwagon/tests/test_tasks.py
import os import shutil import tempfile from django.conf import settings from nose.tools import eq_ from PIL import Image from amo.tests.test_helpers import get_image_path from bandwagon.tasks import resize_icon def test_resize_icon(): somepic = get_image_path('mozilla.png') src = tempfile.NamedTemporaryF...
import os import shutil import tempfile from django.conf import settings from nose.tools import eq_ from PIL import Image from amo.tests.test_helpers import get_image_path from bandwagon.tasks import resize_icon def test_resize_icon(): somepic = get_image_path('mozilla.png') src = tempfile.NamedTemporaryF...
Python
0
4e7bc1dc4cc571f09667a9b29ceff8b5acdfbb13
Drop supplementary variables from formula
apps/metricsmanager/serializers.py
apps/metricsmanager/serializers.py
from rest_framework import serializers from .models import * from .formula import validate_formula from .formula import ComputeSemantics from drf_compound_fields import fields as compound_fields class MetricSerializer(serializers.ModelSerializer): formula = serializers.CharField() creator_path = serializers.F...
from rest_framework import serializers from .models import * from .formula import validate_formula from .formula import ComputeSemantics from drf_compound_fields import fields as compound_fields class MetricSerializer(serializers.ModelSerializer): formula = serializers.CharField() creator_path = serializers.F...
Python
0
c8847c21b724e4875e0cafde5bbf85409c351754
update docstrings for the pkg state
salt/states/pkg.py
salt/states/pkg.py
''' Package Management ================== Salt can manage software packages via the pkg state module, packages can be set up to be installed, latest, removed and purged. Package management declarations are typically rather simple: .. code-block:: yaml vim: pkg: - installed ''' def installed(name): ...
''' State enforcing for packages ''' def installed(name): ''' Verify that the package is installed, return the packages changed in the operation and a bool if the job was sucessfull ''' if __salt__['pkg.version'](name): return {'name': name, 'changes': {}, 'r...
Python
0
0926cc173151dd223e517cabd03e7f0b5bd6c7b2
Change DOI extraction in PubMed client
indra/databases/pubmed_client.py
indra/databases/pubmed_client.py
import urllib, urllib2 from functools32 import lru_cache import xml.etree.ElementTree as ET pubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi' pubmed_fetch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' pmid_convert = 'http://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/' @lru_cac...
import urllib, urllib2 from functools32 import lru_cache import xml.etree.ElementTree as ET pubmed_search = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi' pubmed_fetch = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi' pmid_convert = 'http://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/' @lru_cac...
Python
0
c95e54b558d9a910181715df291402c44e0d8d55
Specify only luci buckets instead of hardcoding trybot names
infra/bots/update_meta_config.py
infra/bots/update_meta_config.py
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Update meta/config of the specified Skia repo.""" import argparse import json import os import subprocess import sys import urllib2 import git_utils ...
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Update meta/config of the specified Skia repo.""" import argparse import json import os import subprocess import sys import urllib2 import git_utils ...
Python
0.999011
216bb86730436f4b2d167d917a903dcd982b7897
remove log for values modifier disabled
openedx/core/djangoapps/appsembler/sites/config_values_modifier.py
openedx/core/djangoapps/appsembler/sites/config_values_modifier.py
""" Tahoe: Configuration modifiers for Tahoe. """ from urllib.parse import urlsplit from logging import getLogger from django.conf import settings from openedx.core.djangoapps.appsembler.sites.waffle import ENABLE_CONFIG_VALUES_MODIFIER log = getLogger(__name__) class TahoeConfigurationValueModifier: """ ...
""" Tahoe: Configuration modifiers for Tahoe. """ from urllib.parse import urlsplit from logging import getLogger from django.conf import settings from openedx.core.djangoapps.appsembler.sites.waffle import ENABLE_CONFIG_VALUES_MODIFIER log = getLogger(__name__) class TahoeConfigurationValueModifier: """ ...
Python
0
0da1b4f4041ebe415782d36f6f69af91faad024f
Include some useful links for future development
src/dataset/retriever.py
src/dataset/retriever.py
""" Subset of reuters 21578, "ModApte", considering only received categories. util: - http://www.nltk.org/book/ch02.html - https://miguelmalvarez.com/2015/03/20/classifying-reuters-21578-collection-with-python-representing-the-data/ might be useful: - http://www.nltk.org/howto/corpus.html - https://miguelmalvarez.co...
""" Subset of reuters 21578, "ModApte", considering only received categories. """ from nltk.corpus import reuters class ReutersCollection: interest_categories = [] documents = [] train_docs = [] test_docs = [] """ Initializes the collection considering only the received categories. :par...
Python
0
2209d03532d6c0ed7d55cf4cf759fd82585b5ad3
Update item.py
item.py
item.py
import pygame class Item(pygame.sprite.Sprite): def __init__(self, level, *groups): super(Item, self).__init__(*groups) #the game level self.level = level #base image self.level.animator.set_Img(6,0) self.image = self.level.animator.get_Img().convert() self.image.set_colorkey((255,0,0)) #type sel...
import pygame class Item(pygame.sprite.Sprite): def __init__(self, level, *groups): super(Item, self).__init__(*groups) #the game level self.level = level #base image #self.level.animator.set_Img(0,5) #self.image = self.level.animator.get_Img().convert() #self.image.set_colorkey((255,0,0)) self.level....
Python
0
f408b1368b641be2349266a59b32f7fd1fa53265
Fix a couple of minor bugs
stream.py
stream.py
from StringIO import StringIO import sys from eventlet.corolocal import local _installed = False _save_out = None _save_err = None class _StreamLocal(local): def __init__(self): # Initialize the output and error streams self.out = StringIO() self.err = StringIO() _stlocal = _StreamLoc...
from StringIO import StringIO import sys from eventlet.corolocal import local _installed = False _save_out = None _save_err = None class _StreamLocal(local): def __init__(self): # Initialize the output and error streams self.out = StringIO() self.err = StringIO() _stlocal = _StreamLoc...
Python
0.000029
cbcb89a7a3ee4884768e272bbe3435bb6e08d224
Add constraints for the same column and the same row
sudoku.py
sudoku.py
import datetime def generate_info(name, version, depends): return { "{name}-{version}-0.tar.bz2".format(name=name, version=version): { "build": "0", "build_number": 0, "date": datetime.date.today().strftime("%Y-%m-%d"), "depends": depends, "name":...
import datetime def generate_info(name, version, depends): return { "{name}-{version}-0.tar.bz2".format(name=name, version=version): { "build": "0", "build_number": 0, "date": datetime.date.today().strftime("%Y-%m-%d"), "depends": depends, "name":...
Python
0.000009
2fb9e916155fce16a807c1c7eebf4a607c22ef94
Correct Celery support to be backwards compatible (fixes GH-124)
raven/contrib/celery/__init__.py
raven/contrib/celery/__init__.py
""" raven.contrib.celery ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: from celery.task import task except ImportError: from celery.decorators import task from celery.signals import after_setup_logger, ...
""" raven.contrib.celery ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: from celery.task import task except ImportError: from celery.decorators import task from celery.signals import after_setup_logger, ...
Python
0
3f09216ed6afc8fc2173dae40c4776fef4b4d4d2
update docstring, clarify variable name
matchzoo/datapack.py
matchzoo/datapack.py
"""Matchzoo DataPack, pair-wise tuple (feature) and context as input.""" import typing from pathlib import Path import dill import pandas as pd class DataPack(object): """ Matchzoo DataPack data structure, store dataframe and context. Example: >>> features = [([1,3], [2,3]), ([3,0], [1,6])] ...
"""Matchzoo DataPack, pair-wise tuple (feature) and context as input.""" import typing from pathlib import Path import dill import pandas as pd class DataPack(object): """ Matchzoo DataPack data structure, store dataframe and context. Example: >>> features = [([1,3], [2,3]), ([3,0], [1,6])] ...
Python
0.000001
8fb149400a115fd0abf595c6716aed22c396eb86
remove call to curCycle in panic() The panic() function already prints the current tick value. This call to curCycle() is as such redundant. Since we are trying to move towards multiple clock domains, this call will print misleading time.
src/mem/slicc/ast/AST.py
src/mem/slicc/ast/AST.py
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood # Copyright (c) 2009 The Hewlett-Packard Development Company # 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 co...
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood # Copyright (c) 2009 The Hewlett-Packard Development Company # 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 co...
Python
0
80fafd59340bc749967880d04e429d5c077db34b
Add an another lazy if
main.py
main.py
#!/usr/bin/python3 # # The MIT License (MIT) # # Copyright (c) 2013 Andrian Nord # # 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/python3 # # The MIT License (MIT) # # Copyright (c) 2013 Andrian Nord # # 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.000182
723abaf9bb1ad6d0b8c67e06522bb1d87f3ab82d
Fix broken test, handle terminate on the REQUEST
test/test_listallobjects_handler.py
test/test_listallobjects_handler.py
from handler_fixture import StationHandlerTestCase from groundstation.transfer.request_handlers import handle_listallobjects from groundstation.transfer.response_handlers import handle_terminate import groundstation.transfer.response as response from groundstation.proto.object_list_pb2 import ObjectList class TestH...
from handler_fixture import StationHandlerTestCase from groundstation.transfer.request_handlers import handle_listallobjects from groundstation.transfer.response_handlers import handle_terminate import groundstation.transfer.response as response from groundstation.proto.object_list_pb2 import ObjectList class TestH...
Python
0
4c5550420b8a9f1bf88f4329952f6e2a161cd20f
Fix test on kaos with latest qt5
test/test_panels/test_navigation.py
test/test_panels/test_navigation.py
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
Python
0
6878860d8b8d3377960a8310b6b733a4cbc30959
use environment variable
main.py
main.py
import os import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") if __name__ == "__main__": application = tornado.web.Application([ (r"/", MainHandler), ]) application.listen(os.environ['PORT']) tornado....
import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") if __name__ == "__main__": application = tornado.web.Application([ (r"/", MainHandler), ]) application.listen(80) tornado.ioloop.IOLoop.current().st...
Python
0.000008
0daee4c4a3d8864d77e45363064e40b5c529de3b
Align help messages better. Use consistent quotes.
main.py
main.py
""" # ---------------------------------------------------------------------- # main.py # # Main module for the Llama compiler # http://courses.softlab.ntua.gr/compilers/2012a/llama2012.pdf # # Author: Nick Korasidis <Renelvon@gmail.com> # ---------------------------------------------------------------------- """ impor...
""" # ---------------------------------------------------------------------- # main.py # # Main module for the Llama compiler # http://courses.softlab.ntua.gr/compilers/2012a/llama2012.pdf # # Author: Nick Korasidis <Renelvon@gmail.com> # ---------------------------------------------------------------------- """ impor...
Python
0
944515624ec57f94b6bdb4e9a46988b9604f4c3b
add basic command line parser.
main.py
main.py
#!/usr/bin/python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai import sys import argparse import re import logging lg = logging.getLogger("DRIVE_MAIN") lg.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('[%(name)s] %(levelname)s - %(message)s') ch.s...
#!/usr/bin/python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai import sys import argparse import re def main(): print("YMK Goodbye World!!!") if __name__ == '__main__': main()
Python
0
4bcf8ea9572b90782e2f1d6150ec96e28002378f
set loglevel to warning
main.py
main.py
""" The MIT License (MIT) Copyright (c) 2014 Kord Campbell, StackGeek 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 to use, copy, mo...
""" The MIT License (MIT) Copyright (c) 2014 Kord Campbell, StackGeek 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 to use, copy, mo...
Python
0.000001
c126348a70f316c9ef25d70dc87d6b25f69f83af
remove routes
main.py
main.py
from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True from util import today from models import Event from google.appengine.ext import ndb import twilio.twiml @app.route('/message', methods=['GET', 'POST']) def reply(): query = Event.query(Event.date == today()) messages = [] for event ...
from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True from util import today from models import Event from google.appengine.ext import ndb import twilio.twiml @app.route('/') def hello(): """Return a friendly HTTP greeting.""" return 'Hello World!' @app.route('/message', methods=['GET', 'P...
Python
0.00178
60ae3ae54ccc573983cb9c283844eab1b62ba7a7
Use multiprocessing instead of threading
main.py
main.py
#!/usr/bin/env python ############################################################################### # bitcoind-ncurses by Amphibian # thanks to jgarzik for bitcoinrpc # wumpus and kylemanna for configuration file parsing # all the users for their suggestions and testing # and of course the bitcoin dev team for that ...
#!/usr/bin/env python ############################################################################### # bitcoind-ncurses by Amphibian # thanks to jgarzik for bitcoinrpc # wumpus and kylemanna for configuration file parsing # all the users for their suggestions and testing # and of course the bitcoin dev team for that ...
Python
0.000001
46db44a83d7683c985e0637956674e4e0506b28f
support custom figure names
main.py
main.py
#!/usr/bin/env python3 import numpy as np import torch import matplotlib import matplotlib.pyplot as plt from torch.autograd import Variable import atexit class PhnSpkGenerator(): def __init__(self, mu, cov, phn, spk): self._mu = mu self._cov = cov self._phn = phn self._spk = sp...
#!/usr/bin/env python3 import numpy as np import torch import matplotlib import matplotlib.pyplot as plt from torch.autograd import Variable import atexit class PhnSpkGenerator(): def __init__(self, mu, cov, phn, spk): self._mu = mu self._cov = cov self._phn = phn self._spk = sp...
Python
0
401a2ff9f12837965050b117fcd05a07fb3a8928
Implement autoindent
main.py
main.py
#!/usr/bin/env python import os.path import re import sys import tkinter as tk import tkinter.filedialog import tkinter.scrolledtext VERSION = [0, 0, 0] class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack(expand=1, fill='both') self.cr...
#!/usr/bin/env python import os.path import sys import tkinter as tk import tkinter.filedialog import tkinter.scrolledtext VERSION = [0, 0, 0] class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack(expand=1, fill='both') self.createWidget...
Python
0.000002
50a025032cfa07a842291637cb4d8240edcb60ea
Rename TabConverter to TapConverter
main.py
main.py
import os import re from TapConverter import TapConverter import settings import sandschreiber from werkzeug import secure_filename from flask import Flask, render_template, request, redirect, jsonify app = Flask(__name__) app.jinja_env.filters['basename'] = os.path.basename ss = sandschreiber.AsyncSandschreiber(sett...
import os import re from TapConverter import TapConverter import settings import sandschreiber from werkzeug import secure_filename from flask import Flask, render_template, request, redirect, jsonify app = Flask(__name__) app.jinja_env.filters['basename'] = os.path.basename ss = sandschreiber.AsyncSandschreiber(sett...
Python
0.000024
affc8e0f0be765f5adc31113ad535852e01cc75a
Fix unique ID Verisure alarm control panel (#51087)
homeassistant/components/verisure/alarm_control_panel.py
homeassistant/components/verisure/alarm_control_panel.py
"""Support for Verisure alarm control panels.""" from __future__ import annotations import asyncio from homeassistant.components.alarm_control_panel import ( FORMAT_NUMBER, AlarmControlPanelEntity, ) from homeassistant.components.alarm_control_panel.const import ( SUPPORT_ALARM_ARM_AWAY, SUPPORT_ALARM...
"""Support for Verisure alarm control panels.""" from __future__ import annotations import asyncio from homeassistant.components.alarm_control_panel import ( FORMAT_NUMBER, AlarmControlPanelEntity, ) from homeassistant.components.alarm_control_panel.const import ( SUPPORT_ALARM_ARM_AWAY, SUPPORT_ALARM...
Python
0
34a3b5c626e077907c46835b1759a818b3fc332a
Make 2-legged calls with the help of tweepy, Twitter API lib.
uservoice/__init__.py
uservoice/__init__.py
from Crypto.Cipher import AES import base64 import hashlib import urllib import operator import array import simplejson as json import urllib import urllib2 import datetime import pytz from tweepy import oauth def generate_sso_token(subdomain_name, sso_key, user_attributes): current_time = (datetime.datetime.now(p...
from Crypto.Cipher import AES import base64 import hashlib import urllib import operator import array import simplejson as json import urllib import urllib2 import datetime import pytz from tweepy import oauth def generate_sso_token(subdomain_name, sso_key, user_attributes): current_time = (datetime.datetime.n...
Python
0
98f986aaa938f5aa43183042d2a4b0ad58c3f03d
remove debugging
sbudget/sbudget.py
sbudget/sbudget.py
import os import sqlite3 import string import random import time from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash app = Flask(__name__) app.config.from_object(__name__) app.config.update(dict( DATABASE=os.path.join(app.root_path, 'sbudget.db'), SECRET_KEY=''...
import os import sqlite3 import string import random import time from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash app = Flask(__name__) app.config.from_object(__name__) app.config.update(dict( DATABASE=os.path.join(app.root_path, 'sbudget.db'), SECRET_KEY=''...
Python
0.000065
3be6ed2f32492d79b639e657cbf5782451b527e7
Disable broken upload test
tests/frontend/views/upload_test.py
tests/frontend/views/upload_test.py
import os from io import BytesIO import pytest from skylines.database import db from skylines.model import User pytestmark = pytest.mark.usefixtures('db_session', 'files_folder') HERE = os.path.dirname(__file__) DATADIR = os.path.join(HERE, '..', '..', 'data') @pytest.fixture(scope='function') def bill(app): ...
import os from io import BytesIO import pytest from skylines.database import db from skylines.model import User pytestmark = pytest.mark.usefixtures('db_session', 'files_folder') HERE = os.path.dirname(__file__) DATADIR = os.path.join(HERE, '..', '..', 'data') @pytest.fixture(scope='function') def bill(app): ...
Python
0
71a1d2b40a03bde4969f0eea5f2c48d4ba7ace1b
Fix batch tests on Python 3
tests/integration/cli/test_batch.py
tests/integration/cli/test_batch.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Testing Libs from tests.support.case import ShellCase class BatchTest(ShellCase): ''' Integration tests fo...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Nicole Thomas <nicole@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Testing Libs from tests.support.case import ShellCase class BatchTest(ShellCase): ''' Integration tests fo...
Python
0.000679
6f391d4113b55f538cfeed26c36b17846c7b758f
fix alt-svc test
tests/level4/test_http3_response.py
tests/level4/test_http3_response.py
import pytest import os import socket import time import sys #@pytest.mark.skip def test_http2 (launch): serve = './examples/http3.py' with launch (serve, port = 30371, quic = 30371, ssl = True) as engine: resp = engine.http2.get ('/hello?num=1') assert resp.text == 'hello' if sys.versi...
import pytest import os import socket import time import sys #@pytest.mark.skip def test_http2 (launch): serve = './examples/http3.py' with launch (serve, port = 30371, quic = 30371, ssl = True) as engine: resp = engine.http2.get ('/hello?num=1') assert resp.text == 'hello' assert 'alt-...
Python
0.000002
1e9ebf139ae76eddfe8dd01290e41735e7d1011b
Rewrite syntax to be Python 3.5+
IPython/utils/tests/test_openpy.py
IPython/utils/tests/test_openpy.py
import io import os.path import nose.tools as nt from IPython.utils import openpy mydir = os.path.dirname(__file__) nonascii_path = os.path.join(mydir, '../../core/tests/nonascii.py') def test_detect_encoding(): with open(nonascii_path, 'rb') as f: enc, lines = openpy.detect_encoding(f.readline) nt.a...
import io import os.path import nose.tools as nt from IPython.utils import openpy mydir = os.path.dirname(__file__) nonascii_path = os.path.join(mydir, '../../core/tests/nonascii.py') def test_detect_encoding(): with open(nonascii_path, 'rb') as f: enc, lines = openpy.detect_encoding(f.readline) nt.a...
Python
0.999892
a5b111833f3edd050c9d45553d9e21afa9fa1d57
fix mysql bug
everyclass/__init__.py
everyclass/__init__.py
import logging from flask import Flask, g, render_template, send_from_directory, session from flask_cdn import CDN from htmlmin import minify from termcolor import cprint from raven.contrib.flask import Sentry from elasticapm.contrib.flask import ElasticAPM from elasticapm.handlers.logging import LoggingHandler from ...
import logging from flask import Flask, g, render_template, send_from_directory, session from flask_cdn import CDN from htmlmin import minify from termcolor import cprint from raven.contrib.flask import Sentry from elasticapm.contrib.flask import ElasticAPM from elasticapm.handlers.logging import LoggingHandler from ...
Python
0
64ed1185fca6ba60e06d508ac401f68d5be1ce56
bring tests up to #442 change
tests/python_tests/load_map_test.py
tests/python_tests/load_map_test.py
#!/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('.')) # We expect these files to not raise any # exc...
#!/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('.')) # We expect these files to not raise any # exc...
Python
0
24b7d3d0904a75e1e26ccfc34834ae495edb8146
Fix for skipping django-configurations tests when running on Python < 2.6
tests/test_django_configurations.py
tests/test_django_configurations.py
"""Tests which check the various ways you can set DJANGO_SETTINGS_MODULE If these tests fail you probably forgot to install django-configurations. """ import sys import pytest # importing configurations fails on 2.5, even though it might be installed if sys.version_info < (2, 6): pytest.skip('django-configuration...
"""Tests which check the various ways you can set DJANGO_SETTINGS_MODULE If these tests fail you probably forgot to install django-configurations. """ import pytest pytest.importorskip('configurations') pytestmark = pytest.mark.skipif("sys.version_info < (2,6) ") BARE_SETTINGS = ''' from configurations import Sett...
Python
0.000002
cf2a9f0918bc56a9015c745108f6de5ae8c60773
Add status
my-ACG/update-episodes/anime1_me.py
my-ACG/update-episodes/anime1_me.py
# -*- coding: utf-8 -*- import argparse import importlib import os import sys os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__)) import pywikibot sys.path.append('..') animeSite = importlib.import_module('util.anime1_me', 'Anime1Me').Anime1Me() site = pywikibot.Site() site.login() datasite = ...
# -*- coding: utf-8 -*- import argparse import importlib import os import sys os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__)) import pywikibot sys.path.append('..') animeSite = importlib.import_module('util.anime1_me', 'Anime1Me').Anime1Me() site = pywikibot.Site() site.login() datasite = ...
Python
0.000001
86113d1b53827a2d0c106734c5fd04e9ad935529
disable layout optimizer for grappler, due to conv2d filter error
scripts/convert.py
scripts/convert.py
"""Run Grappler optimizers in the standalone mode. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import sys import os from absl import flags from tensorflow.python.tools import freeze_graph from tensorflow.core.protobuf import...
"""Run Grappler optimizers in the standalone mode. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import sys import os from absl import flags from tensorflow.python.tools import freeze_graph from tensorflow.core.protobuf import...
Python
0
ad14d77a137c924357bca51d39b91b4d502d2ce6
Improve pylint score
scripts/extract.py
scripts/extract.py
""" ## CODE OWNERS: Kyle Baird, Shea Parkes ### OWNERS ATTEST TO THE FOLLOWING: * The `master` branch will meet Milliman QRM standards at all times. * Deliveries will only be made from code in the `master` branch. * Review/Collaboration notes will be captured in Pull Requests. ### OBJECTIVE: Extract data from ...
""" ## CODE OWNERS: Kyle Baird, Shea Parkes ### OWNERS ATTEST TO THE FOLLOWING: * The `master` branch will meet Milliman QRM standards at all times. * Deliveries will only be made from code in the `master` branch. * Review/Collaboration notes will be captured in Pull Requests. ### OBJECTIVE: Extract data from ...
Python
0
f276d6fdb412b8ad93de8ba6d921d29a57710077
Update usage message
server/messages.py
server/messages.py
'''Endpoints messages.''' from protorpc import messages class Status(messages.Enum): OK = 1 MISSING_DATA = 2 EXISTS = 3 BAD_DATA = 4 ERROR = 5 NO_DEVICE = 6 class DataMessage(messages.Message): device_id = messages.StringField(1) status = messages.EnumField(Status, 2) class Status...
'''Endpoints messages.''' from protorpc import messages class Status(messages.Enum): OK = 1 MISSING_DATA = 2 EXISTS = 3 BAD_DATA = 4 ERROR = 5 NO_DEVICE = 6 class DataMessage(messages.Message): device_id = messages.StringField(1) status = messages.EnumField(Status, 2) class Status...
Python
0
917dde63ece9e552427487c7639be64e1b113d3d
Update zibra download fields.
vdb/zibra_download.py
vdb/zibra_download.py
import os, re, time, datetime, csv, sys import rethinkdb as r from Bio import SeqIO from download import download from download import parser class zibra_download(download): def __init__(self, **kwargs): download.__init__(self, **kwargs) self.virus_specific_fasta_fields = [] if __name__=="__main__...
import os, re, time, datetime, csv, sys import rethinkdb as r from Bio import SeqIO from download import download from download import parser class zibra_download(download): def __init__(self, **kwargs): download.__init__(self, **kwargs) self.virus_specific_fasta_fields = [] if __name__=="__main__...
Python
0
749441ed678f69ba813b3af74454af5b1e855482
Refactor and cleanup model mixins.
openbudget/commons/mixins/models.py
openbudget/commons/mixins/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField from openbudget.settings import base as settings class ClassMethodMixin(object): """A mixin for commonly used classmethods on models.""" @classmethod def get_class_name(cls): value...
from django.db import models from django.utils.translation import ugettext_lazy as _ from uuidfield import UUIDField class ClassMethodMixin(object): """Mixin for commonly used class methods on models""" @classmethod def get_class_name(cls): value = cls.__name__.lower() return value clas...
Python
0
bf90f726da9954edb69f4c0cb29206ff82444d63
Add custom admin classes
src/recipi/food/admin.py
src/recipi/food/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from recipi.food.models import ( FoodGroup, Food, Language, LanguageDescription, Nutrient, Weight, Footnote) class FoodGroupAdmin(admin.ModelAdmin): pass class FoodAdmin(admin.ModelAdmin): pass class LanguageAdmin(admin.ModelAdmin): pas...
# -*- coding: utf-8 -*- from django.contrib import admin from recipi.food.models import ( FoodGroup, Food, Language, LanguageDescription, Nutrient, Weight, Footnote) admin.site.register(FoodGroup) admin.site.register(Food) admin.site.register(Language) admin.site.register(LanguageDescription) admin.site.regi...
Python
0
cf7f5dc359bb49743750c9ace6c317092b275653
remove the use of refine_results because it is changed to private method
mmrp.py
mmrp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import logging.config import json LOGGING_CONF_FILE = 'logging.json' DEFAULT_LOGGING_LVL = logging.INFO path = LOGGING_CONF_FILE value = os.getenv('LOG_CFG', None) if value: path = value if os.path.exists(path): with open(path, 'rt') as f: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import logging.config import json LOGGING_CONF_FILE = 'logging.json' DEFAULT_LOGGING_LVL = logging.INFO path = LOGGING_CONF_FILE value = os.getenv('LOG_CFG', None) if value: path = value if os.path.exists(path): with open(path, 'rt') as f: ...
Python
0.000001
e701286478d0c460d0a8a2e2fd5b73bf124a90ec
make a better error message when removing reservations that does not exist
opennsa/backends/common/calendar.py
opennsa/backends/common/calendar.py
""" Backend reservation calendar. Inteded usage is for NRM backend which does not have their own reservation calendar. Right now it is very minimal, but should be enough for basic service. Author: Henrik Thostrup Jensen <htj@nordu.net> Copyright: NORDUnet (2011) """ import datetime from opennsa import error cla...
""" Backend reservation calendar. Inteded usage is for NRM backend which does not have their own reservation calendar. Right now it is very minimal, but should be enough for basic service. Author: Henrik Thostrup Jensen <htj@nordu.net> Copyright: NORDUnet (2011) """ import datetime from opennsa import error cla...
Python
0.000002
8e6662a4aaf654ddf18c1c4e733c58db5b9b5579
Add cache in opps menu list via context processors
opps/channels/context_processors.py
opps/channels/context_processors.py
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from django.core.cache import cache from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(requ...
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(request) opps_menu = Channel.objects...
Python
0
621565e0daa4e06ff6a67f985af124fa7f101d77
Refactor dbaas test helpers
dbaas/dbaas/tests/helpers.py
dbaas/dbaas/tests/helpers.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from physical.tests.factory import InstanceFactory class UsedAndTotalValidator(object): @staticmethod def assertEqual(a, b): assert a == b, "{} NOT EQUAL {}".format(a, b) @classmethod def instances_sizes(cls, i...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from physical.tests import factory as factory_physical class InstanceHelper(object): @staticmethod def check_instance_is_master(instance): """ Method for mock the real check_instance_is_master. T...
Python
0
56aa00210b5adb663abea62ecd297f094dcbfeb0
remove prodigal from the subcommand module
diagnostic_primers/scripts/subcommands/__init__.py
diagnostic_primers/scripts/subcommands/__init__.py
# -*- coding: utf-8 -*- """Module providing subcommands for pdp.""" from .subcmd_config import subcmd_config from .subcmd_filter import subcmd_filter from .subcmd_eprimer3 import subcmd_eprimer3 from .subcmd_primersearch import subcmd_primersearch from .subcmd_dedupe import subcmd_dedupe from .subcmd_blastscreen impor...
# -*- coding: utf-8 -*- """Module providing subcommands for pdp.""" from .subcmd_config import subcmd_config from .subcmd_prodigal import subcmd_prodigal from .subcmd_filter import subcmd_filter from .subcmd_eprimer3 import subcmd_eprimer3 from .subcmd_primersearch import subcmd_primersearch from .subcmd_dedupe import...
Python
0.000002
ebb7f4ca18e099fb2902fa66cbb68c29baa98917
fix download_chromedriver.py to return fast when file exists
dev/download_chromedriver.py
dev/download_chromedriver.py
#!/usr/bin/env python import os, stat import requests import zipfile DESTINATION_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'files') DOWNLOAD_URL = "http://chromedriver.storage.googleapis.com" MAC_DRIVER_NAME = 'chromedriver_mac64.zip' if not os.path.exists(DESTINATION_DIR): os.mkdir(DE...
#!/usr/bin/env python import os, stat import requests import zipfile DESTINATION_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'files') DOWNLOAD_URL = "http://chromedriver.storage.googleapis.com" MAC_DRIVER_NAME = 'chromedriver_mac64.zip' if not os.path.exists(DESTINATION_DIR): os.mkdir(DE...
Python
0
a7116bca501c04c85b9b8563d94b9e0ce9b6f511
Revert "fixed translation"
topaz/objects/functionobject.py
topaz/objects/functionobject.py
import copy from topaz.frame import BuiltinFrame from topaz.objects.objectobject import W_BaseObject class W_FunctionObject(W_BaseObject): _immutable_fields_ = ["name", "w_class", "visibility"] PUBLIC = 0 PROTECTED = 1 PRIVATE = 2 def __init__(self, name, w_class=None, visibility=PUBLIC): ...
import copy from topaz.frame import BuiltinFrame from topaz.objects.objectobject import W_BaseObject class W_FunctionObject(W_BaseObject): _immutable_fields_ = ["name", "w_class", "visibility"] PUBLIC = 0 PROTECTED = 1 PRIVATE = 2 def __init__(self, name, w_class=None, visibility=PUBLIC): ...
Python
0
f9b38aa0f38e86a718d851057c26f945e6b872a9
Update BatteryAlarm.py
20140707-ProgramaDeAlertaBateria/BatteryAlarm.py
20140707-ProgramaDeAlertaBateria/BatteryAlarm.py
#!usr/bin/env python #coding=utf-8 # Es necesario editar # sudo vim /etc/crontab # Edicionar: */15 * * * * root python /JAIMEANDRES/ArchivosSistema/BatteryAlarm.py # # Reiniciar servicio de cron: sudo service cron stop / start # # Este archivo requiere tener en su misma carpeta el archivo # ReproductorDeSonidos.py...
#!usr/bin/env python #coding=utf-8 # Es necesario editar # sudo vim /etc/crontab # Edicionar: */15 * * * * root python /JAIMEANDRES/ArchivosSistema/BatteryAlarm.py # # Reiniciar servicio de cron: sudo service cron stop / start # # Este archivo requiere tener en su misma carpeta el archivo # ReproductorDeSonidos.py...
Python
0
1256f695a441049438565285f48c9119e5211cf5
Enable follow redirection.
pyaem/bagofrequests.py
pyaem/bagofrequests.py
import cStringIO from handlers import unexpected as handle_unexpected import pycurl import requests import urllib def request(method, url, params, handlers, **kwargs): curl = pycurl.Curl() body_io = cStringIO.StringIO() if method == 'post': curl.setopt(pycurl.POST, 1) curl.setopt(pycurl.POSTFIELDS, urllib....
import cStringIO from handlers import unexpected as handle_unexpected import pycurl import requests import urllib def request(method, url, params, handlers, **kwargs): curl = pycurl.Curl() body_io = cStringIO.StringIO() if method == 'post': curl.setopt(pycurl.POST, 1) curl.setopt(pycurl.POSTFIELDS, urllib....
Python
0
7f7f32d032c68197b2152eeb8d9189f3d1493b57
Bump version number for development
pybinding/__about__.py
pybinding/__about__.py
"""Package for numerical tight-binding calculations in solid state physics""" __title__ = "pybinding" __version__ = "0.9.0.dev" __summary__ = "Package for tight-binding calculations" __url__ = "https://github.com/dean0x7d/pybinding" __author__ = "Dean Moldovan" __copyright__ = "2015-2016, " + __author__ __email__ = "d...
"""Package for numerical tight-binding calculations in solid state physics""" __title__ = "pybinding" __version__ = "0.8.1" __summary__ = "Package for tight-binding calculations" __url__ = "https://github.com/dean0x7d/pybinding" __author__ = "Dean Moldovan" __copyright__ = "2015-2016, " + __author__ __email__ = "dean0...
Python
0
0c44f657dd8ad285fa2713d0ab6a367c50a7da4c
If empty string, then is ok
pybossa/auditlogger.py
pybossa/auditlogger.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa 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...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa 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...
Python
0.999999
2ed332ea21c20d8e533ddcbd758755fea9da0ecd
Improve syntax
virtool/labels/api.py
virtool/labels/api.py
import virtool.http.routes import virtool.utils import virtool.validators import virtool.labels.checks import virtool.db.utils from virtool.api.response import bad_request, json_response, no_content, not_found routes = virtool.http.routes.Routes() @routes.get("/api/labels") async def find(req): """ Get a...
import virtool.http.routes import virtool.utils import virtool.validators import virtool.labels.checks import virtool.db.utils from virtool.api.response import bad_request, json_response, no_content, not_found routes = virtool.http.routes.Routes() @routes.get("/api/labels") async def find(req): """ Get a...
Python
0.978611
b6371a582ca944094b1c7955f2c9e908535ccc5d
clean import
virtuoso/textindex.py
virtuoso/textindex.py
from sqlalchemy import Column from sqlalchemy.orm.attributes import InstrumentedAttribute from sqlalchemy.schema import _CreateDropBase, Table, Index from sqlalchemy.sql.expression import (func, literal_column) from sqlalchemy.sql import ddl from sqlalchemy.sql.base import _bind_or_error class TextIndex(Index): _...
from sqlalchemy import Column from sqlalchemy.orm.attributes import InstrumentedAttribute from sqlalchemy.schema import _CreateDropBase, Table, Index from sqlalchemy.sql.expression import ( TextClause, func, literal_column, ColumnCollection, ClauseElement) from sqlalchemy.sql import ddl from sqlalchemy.sql.base imp...
Python
0.000001
df5b98422b1198f353cf3b0df20429b29334bd06
Add separator kwarg to `StringCommand` init.
pyinfra/api/command.py
pyinfra/api/command.py
from six.moves import shlex_quote from .operation_kwargs import get_executor_kwarg_keys class MaskString(str): pass class QuoteString(object): def __init__(self, obj): self.object = obj class PyinfraCommand(object): def __init__(self, *args, **kwargs): self.executor_kwargs = { ...
from six.moves import shlex_quote from .operation_kwargs import get_executor_kwarg_keys class MaskString(str): pass class QuoteString(object): def __init__(self, obj): self.object = obj class PyinfraCommand(object): def __init__(self, *args, **kwargs): self.executor_kwargs = { ...
Python
0
771daafda877050c8fe23b034a0c51ec97502715
update code which generates list of possible article names
pages/controllers/blog_article.py
pages/controllers/blog_article.py
from core import database as database from core.exceptions import NotFoundError, ServerError from core.markdown import MarkdownParser from core.article_helpers import get_article, get_all_articles import core.functions import yaml def get_page_data(path, get, post, variables): article = get_article(get.get('name', '...
from core import database as database from core.exceptions import NotFoundError, ServerError from core.markdown import MarkdownParser from core.article_helpers import get_article import core.functions import yaml def get_page_data(path, get, post, variables): article = get_article(get.get('name', '')) if not arti...
Python
0.00004
9b9ac5f3c557b5915d3ccdd8421b7433c6583212
fix flake8
dojo/tools/wpscan/parser.py
dojo/tools/wpscan/parser.py
import json import hashlib from urllib.parse import urlparse from dojo.models import Endpoint, Finding __author__ = 'dr3dd589' class WpscanJSONParser(object): def __init__(self, file, test): self.dupes = dict() self.items = () if file is None: return tree = json.load...
import json import hashlib from urllib.parse import urlparse from dojo.models import Endpoint, Finding __author__ = 'dr3dd589' class WpscanJSONParser(object): def __init__(self, file, test): self.dupes = dict() self.items = () if file is None: return tree = json.load(f...
Python
0
7060f48df582dcfae1768cc37d00a25e0e2e1f6f
Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int
app/views/comment_view.py
app/views/comment_view.py
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
Python
0.000025
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65
allow markdownlint to be disabled for specific lines (#4)
pymarkdownlint/lint.py
pymarkdownlint/lint.py
from __future__ import print_function from pymarkdownlint import rules class MarkdownLinter(object): def __init__(self, config): self.config = config @property def line_rules(self): return [rule for rule in self.config.rules if isinstance(rule, rules.LineRule)] def _apply_line_rules(...
from __future__ import print_function from pymarkdownlint import rules class MarkdownLinter(object): def __init__(self, config): self.config = config @property def line_rules(self): return [rule for rule in self.config.rules if isinstance(rule, rules.LineRule)] def _apply_line_rules(...
Python
0.000002
e4ecc0f8049f1388188f0a64b373a7e90b2dc1e9
Update at 2017-07-22 15-01-48
plot.py
plot.py
from sys import argv from pathlib import Path import matplotlib as mpl mpl.use('Agg') import seaborn as sns sns.set_style("darkgrid") import matplotlib.pyplot as plt import pandas as pd # from keras.utils import plot_model # plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False) def plot_s...
from sys import argv import matplotlib as mpl mpl.use('Agg') import seaborn as sns sns.set_style("darkgrid") import matplotlib.pyplot as plt import pandas as pd # from keras.utils import plot_model # plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=False) def plot_svg(log, name): df = p...
Python
0
dc4bc70ad3f13b8ff400f6c8f999b555096a75cb
Update test cases for conf module
test/test_conf.py
test/test_conf.py
# coding=utf8 """ Test Cases for jshost. Input:a PyEchartsConfg object with cusom jshost and force_embed flag by user. Test Target: js_embed (should render <script> in embed mode) """ from __future__ import unicode_literals from nose.tools import eq_ from pyecharts.conf import PyEchartsConfig from pyecharts.constants...
# coding=utf8 from __future__ import unicode_literals from pyecharts.conf import PyEchartsConfig def test_config(): pec = PyEchartsConfig(jshost='https://demo') assert pec.jshost == 'https://demo' pec.jshost = 'https://demo/' assert pec.jshost == 'https://demo' pec.force_js_embed = True ass...
Python
0
6e7dfe97cdce58f892f88560e4b4709e6625e6bd
Clean up package level imports
metatlas/__init__.py
metatlas/__init__.py
__version__ = '0.2' from .mzml_loader import mzml_to_hdf from .h5_query import plot_heatmap, plot_spectrogram, plot_XIC from .h5_query import get_data, get_XIC, get_heatmap, get_spectrogram
__version__ = '0.2' from .mzml_loader import mzml_to_hdf from .h5_query import plot_heatmap, plot_spectrogram, plot_xic from .h5_query import get_data, get_XIC, get_HeatMapRTMZ, get_spectrogram
Python
0
db6a6da8fe1bdd73fbd971153a4fda6975fc7b4e
update version
methylpy/__init__.py
methylpy/__init__.py
__version__ = '1.2.9'
__version__ = '1.2.8'
Python
0
8234a22ca090c38b80ffd650b490d1dd8cbe766d
test for fix/18
test/test_ipv4.py
test/test_ipv4.py
from csirtg_indicator import Indicator from csirtg_indicator.exceptions import InvalidIndicator def _not(data): for d in data: d = Indicator(d) assert d.itype is not 'ipv4' def test_ipv4_ipv6(): data = ['2001:1608:10:147::21', '2001:4860:4860::8888'] _not(data) def test_ipv4_fqdn(): ...
from csirtg_indicator import Indicator from csirtg_indicator.exceptions import InvalidIndicator def _not(data): for d in data: d = Indicator(d) assert d.itype is not 'ipv4' def test_ipv4_ipv6(): data = ['2001:1608:10:147::21', '2001:4860:4860::8888'] _not(data) def test_ipv4_fqdn(): ...
Python
0
a8090276b86e12a798be56000dc9831b07544ead
disable review test for now
test/test_main.py
test/test_main.py
import os import sys import unittest from mock import patch import json import shutil import satsearch.main as main import satsearch.config as config from nose.tools import raises testpath = os.path.dirname(__file__) config.DATADIR = testpath class Test(unittest.TestCase): """ Test main module """ args = '...
import os import sys import unittest from mock import patch import json import shutil import satsearch.main as main import satsearch.config as config from nose.tools import raises testpath = os.path.dirname(__file__) config.DATADIR = testpath class Test(unittest.TestCase): """ Test main module """ args = '...
Python
0
aa3e36cc37b2ddcc5d166965f8abeff560e6b0f1
Use test database on alembic when necessary
migrations/config.py
migrations/config.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import logging from logging.handlers import SysLogHandler from dotenv import load_dotenv load_dotenv('.env') # Storage if not os.envi...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import logging from logging.handlers import SysLogHandler from dotenv import load_dotenv load_dotenv('.env') # Storage DATABASE_URL =...
Python
0
0d8766849bedea43cf2eab006327cb942f61c3af
add testing function
test/test_yaml.py
test/test_yaml.py
from __future__ import division, absolute_import, print_function import confuse import yaml import unittest from . import TempDir def load(s): return yaml.load(s, Loader=confuse.Loader) class ParseTest(unittest.TestCase): def test_dict_parsed_as_ordereddict(self): v = load("a: b\nc: d") sel...
from __future__ import division, absolute_import, print_function import confuse import yaml import unittest from . import TempDir def load(s): return yaml.load(s, Loader=confuse.Loader) class ParseTest(unittest.TestCase): def test_dict_parsed_as_ordereddict(self): v = load("a: b\nc: d") sel...
Python
0.000004
421f32947fc2035d7578899a51be779f72983a74
Document `replace` parameter
girder/utility/setting_utilities.py
girder/utility/setting_utilities.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware 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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware 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 ...
Python
0.000003
c08e25172d362176c8abed3d2bf54c2cf13da303
Fix test for settings_helpers
glue/tests/test_settings_helpers.py
glue/tests/test_settings_helpers.py
from mock import patch import os from glue.config import SettingRegistry from glue._settings_helpers import load_settings, save_settings def test_roundtrip(tmpdir): settings = SettingRegistry() settings.add('STRING', 'green', str) settings.add('INT', 3, int) settings.add('FLOAT', 5.5, float) se...
from mock import patch import os from glue.config import SettingRegistry from glue._settings_helpers import load_settings, save_settings def test_roundtrip(tmpdir): settings = SettingRegistry() settings.add('STRING', 'green', str) settings.add('INT', 3, int) settings.add('FLOAT', 5.5, float) se...
Python
0.000001
01917a077681949d29eb48173e031b5dfd441e0d
update angle.py
test/function/angle/angle.py
test/function/angle/angle.py
import numpy as np def angle2D(vec1,vec2): length1 = np.linalg.norm(vec1) length2 = np.linalg.norm(vec2) print("length ", length1, length2) if length1 < 1e-16: return 0. if length2 < 1e-16: return 0. return np.arccos(np.dot(vec1,vec2)/(length1*length2)) def angle3D(vec1, vec2):...
import numpy as np def angle2D(vec1,vec2): length1 = np.linalg.norm(vec1) length2 = np.linalg.norm(vec2) print("length ", length1, length2) return np.arccos(np.dot(vec1,vec2)/(length1*length2)) def angle3D(vec1, vec2): # return the angle v1 = vec1[[0,1]] v2 = vec2[[0,1]] a3 = angle2D(v...
Python
0.000001
77593739e13f472d844076d38f31b4a767332840
Improve list of locations in admin
dthm4kaiako/events/admin.py
dthm4kaiako/events/admin.py
"""Module for admin configuration for the events application.""" import logging from django.contrib import admin from django.utils.timezone import now from django.contrib.gis.db import models as geomodels from django.utils.translation import gettext_lazy as _ from events.models import ( Event, Session, Loca...
"""Module for admin configuration for the events application.""" import logging from django.contrib import admin from django.utils.timezone import now from django.contrib.gis.db import models as geomodels from django.utils.translation import gettext_lazy as _ from events.models import ( Event, Session, Loca...
Python
0
c59e03b7e87544eb1b954c96275bc6e8546e8a0b
Remove time code
cactusbot/services/beam/handler.py
cactusbot/services/beam/handler.py
"""Handle data from Beam.""" from logging import getLogger import json import asyncio from ...packets import MessagePacket, EventPacket from .api import BeamAPI from .chat import BeamChat from .constellation import BeamConstellation from .parser import BeamParser class BeamHandler: """Handle data from Beam se...
"""Handle data from Beam.""" from logging import getLogger import json import asyncio import time from ...packets import MessagePacket, EventPacket from .api import BeamAPI from .chat import BeamChat from .constellation import BeamConstellation from .parser import BeamParser class BeamHandler: """Handle data ...
Python
0.023487
dc1b26de1f4fd027f6662ac99b6a11cb53360db6
Use dict instead of iterable of sets for single values
grapheme/grapheme_property_group.py
grapheme/grapheme_property_group.py
import json import os from enum import Enum class GraphemePropertyGroup(Enum): PREPEND = "Prepend" CR = "CR" LF = "LF" CONTROL = "Control" EXTEND = "Extend" REGIONAL_INDICATOR = "Regional_Indicator" SPACING_MARK = "SpacingMark" L = "L" V = "V" T = "T" LV = "LV" LVT = "L...
import json import os from enum import Enum class GraphemePropertyGroup(Enum): PREPEND = "Prepend" CR = "CR" LF = "LF" CONTROL = "Control" EXTEND = "Extend" REGIONAL_INDICATOR = "Regional_Indicator" SPACING_MARK = "SpacingMark" L = "L" V = "V" T = "T" LV = "LV" LVT = "L...
Python
0
2b3281863f11fa577dd6504e58f6faec8ada2259
Change order of API call
qiime_studio/api/v1.py
qiime_studio/api/v1.py
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
Python
0.000001