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
75ab7e06d78d0534e700b5a910419cd655b156ba
Add --crawl_since flag when not providing repos file
git_downloader.py
git_downloader.py
#!/usr/bin/env python # import sys, os, argparse, logging, fnmatch, posixpath, socket import github if sys.version_info < (3, 0): # python 2 import urlparse from urllib import urlretrieve else: # python 3 import urllib.parse as urlparse from urllib.request import urlretrieve def main(args, lo...
#!/usr/bin/env python # import sys, os, argparse, logging, fnmatch, posixpath, socket from github import Github if sys.version_info < (3, 0): # python 2 import urlparse from urllib import urlretrieve else: # python 3 import urllib.parse as urlparse from urllib.request import urlretrieve def ma...
Python
0
0352f542341fe25be74c0130e7e50394c6f0bb6d
add interactive message colorization
gitmagic/fixup.py
gitmagic/fixup.py
import gitmagic import git.cmd import tempfile def fixup(repo, destination_picker, change_finder, args={}): repo.index.reset() for change in change_finder(repo): _apply_change(repo, change) destination_commits = destination_picker.pick(change) if not destination_commits: rep...
import gitmagic import git.cmd import tempfile def fixup(repo, destination_picker, change_finder, args={}): repo.index.reset() for change in change_finder(repo): _apply_change(repo, change) destination_commits = destination_picker.pick(change) if not destination_commits: rep...
Python
0.000001
835b1ff03d517c4a621237d3cd1682df1322e0e8
add missing build dependency to py-execnet (#6443)
var/spack/repos/builtin/packages/py-execnet/package.py
var/spack/repos/builtin/packages/py-execnet/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
98e2e0bdefd3fb7941d589c01b7a7fa92f8375e6
add fuzzing test for ZstdDecompressor.write_to()
tests/test_decompressor_fuzzing.py
tests/test_decompressor_fuzzing.py
import io import os try: import unittest2 as unittest except ImportError: import unittest try: import hypothesis import hypothesis.strategies as strategies except ImportError: raise unittest.SkipTest('hypothesis not available') import zstd from . common import ( make_cffi, random_input_d...
import os try: import unittest2 as unittest except ImportError: import unittest try: import hypothesis import hypothesis.strategies as strategies except ImportError: raise unittest.SkipTest('hypothesis not available') import zstd from . common import ( random_input_data, ) @unittest.skipUn...
Python
0
baed814d73ea645794d172614bb79f456730b42c
Fix auth providers to work around Python's broken import system.
apps/auth/providers.py
apps/auth/providers.py
# Universal Subtitles, universalsubtitles.org # # Copyright (C) 2012 Participatory Culture Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, ...
# Universal Subtitles, universalsubtitles.org # # Copyright (C) 2012 Participatory Culture Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, ...
Python
0
8f429a41f3541c5f32a9809a529dd800f7dafa0a
Fix log output for Docker daemonised
temp2dash.py
temp2dash.py
import json import os import requests import sys import time import traceback from temperusb import TemperHandler URL = os.environ['DASHING_URL'] SCALE = float(os.environ['TEMP_SCALE']) OFFSET = float(os.environ['TEMP_OFFSET']) SENSOR = int(os.environ['TEMP_SENSOR']) SLEEP = int(os.environ['SLEEP_TIME']) th = TemperH...
import json import os import requests import sys import time import traceback from temperusb import TemperHandler URL = os.environ['DASHING_URL'] SCALE = float(os.environ['TEMP_SCALE']) OFFSET = float(os.environ['TEMP_OFFSET']) SENSOR = int(os.environ['TEMP_SENSOR']) SLEEP = int(os.environ['SLEEP_TIME']) th = TemperH...
Python
0.000002
fd380c79b9644e6a51086e590812aef6e9377a22
Add test case to reproduce dnsmasq.set_config failure in #34263
tests/unit/modules/dnsmasq_test.py
tests/unit/modules/dnsmasq_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( mock_open, MagicMock, patch, NO_MOCK, NO_MOCK_...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing Libs from salttesting import TestCase, skipIf from salttesting.mock import ( mock_open, MagicMock, patch, NO_MOCK, NO_MOCK_...
Python
0
6e9f329f5a770955370e93c926c25d511ba8b981
Update the_ends_test/FunctionsUnitTest.py
the_ends_test/FunctionsUnitTest.py
the_ends_test/FunctionsUnitTest.py
import unittest from the_ends.functions import function_finder import sys sys.path.insert(0, '/the_ends') class TheEndsTestCases(unittest.TestCase): def setUp(self): pass # before test cases def tearDown(self): pass # after test cases def test_isupper(self): # example ...
import unittest from the_ends.functions import function_finder class TheEndsTestCases(unittest.TestCase): def setUp(self): pass # before test cases def tearDown(self): pass # after test cases def test_isupper(self): # example test self.assertTrue('FOO'.isupper(...
Python
0.000003
76829380376c31ea3f1e899770d1edffd1afc047
Change gravatar url to use https
apps/profiles/utils.py
apps/profiles/utils.py
import hashlib def get_gravatar_url(email): email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() return "https://www.gravatar.com/avatar/{}".format(email_hash)
import hashlib def get_gravatar_url(email): email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() return "http://www.gravatar.com/avatar/{}".format(email_hash)
Python
0
c7f50eb666423ce3cc08d5e0714f4d18d672d326
clean up test
corehq/apps/hqadmin/tests/test_utils.py
corehq/apps/hqadmin/tests/test_utils.py
from django.test import TestCase, override_settings from pillowtop.listener import BasicPillow from corehq.apps.domain.models import Domain from ..utils import pillow_seq_store, EPSILON from ..models import PillowCheckpointSeqStore class DummyPillow(BasicPillow): document_class = Domain def run(self): ...
from django.test import TestCase from pillowtop.listener import BasicPillow from corehq.apps.domain.models import Domain from ..utils import pillow_seq_store, EPSILON from ..models import PillowCheckpointSeqStore def import_settings(): class MockSettings(object): PILLOWTOPS = {'test': ['corehq.apps.hqadm...
Python
0.000001
11ef828a8180ba17f522e03ac198440feab40aa0
Update version
apt_select/__init__.py
apt_select/__init__.py
__version__ = '1.0.2'
__version__ = '1.0.1'
Python
0
a3a408b9345291ca9a1999a779879afe0296f0a3
Update grayscale.py
08_Image_Processing/Color_Spaces/grayscale/grayscale.py
08_Image_Processing/Color_Spaces/grayscale/grayscale.py
import os, cv2 import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec _projectDirectory = os.path.dirname(__file__) _imagesDirectory = os.path.join(_projectDirectory, "images") _images = [] for _root, _dirs, _files in os.walk(_imagesDirectory): for _file in _files: i...
import os, cv2 import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec _projectDirectory = os.path.dirname(__file__) _imagesDirectory = os.path.join(_projectDirectory, "images") _images = [] for _root, _dirs, _files in os.walk(_imagesDirectory): for _file in _files: i...
Python
0.000001
37167a9473a99931efbc60a8e46400ed017c8fa4
set up initial condition arrays
Assignment_5_partial_differentials/P440_Assign5_Exp2.py
Assignment_5_partial_differentials/P440_Assign5_Exp2.py
''' Kaya Baber Physics 440 - Computational Physics Assignment 5 - PDEs Exploration 2 - Parabolic PDEs: The Wave Equation ''' import numpy as np from numpy import linalg as LA import matplotlib.pyplot as plt import math import cmath L = 2.*math.pi #set the x range to (0->2pi) N = 1000 #number of spatial inte...
''' Kaya Baber Physics 440 - Computational Physics Assignment 5 - PDEs Exploration 2 - Parabolic PDEs: The Wave Equation ''' import numpy as np from numpy import linalg as LA import matplotlib.pyplot as plt import math #make initial velocity array in real space #make initial density array in real space #fft both to f...
Python
0.000001
60b2c0db865fcf09636359888ead82ffc7666ae3
Add test for failed login when user is not active
yunity/userauth/tests/test_api.py
yunity/userauth/tests/test_api.py
from django.contrib import auth from rest_framework import status from rest_framework.test import APITestCase from yunity.users.factories import UserFactory class TestUserAuthAPI(APITestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.user = UserFactory() cls.disabled_...
from django.contrib import auth from rest_framework import status from rest_framework.test import APITestCase from yunity.users.factories import UserFactory class TestUserAuthAPI(APITestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.user = UserFactory() cls.url = '/a...
Python
0.000001
67773a4b848d14bf6e6b160eb918e036971b7f0e
Use Python 3 type syntax in zerver/webhooks/semaphore/view.py.
zerver/webhooks/semaphore/view.py
zerver/webhooks/semaphore/view.py
# Webhooks for external integrations. from typing import Any, Dict import ujson from django.http import HttpRequest, HttpResponse from django.utils.translation import ugettext as _ from zerver.decorator import api_key_only_webhook_view from zerver.lib.actions import check_send_stream_message from zerver.lib.request ...
# Webhooks for external integrations. from typing import Any, Dict import ujson from django.http import HttpRequest, HttpResponse from django.utils.translation import ugettext as _ from zerver.decorator import api_key_only_webhook_view from zerver.lib.actions import check_send_stream_message from zerver.lib.request ...
Python
0
753893ac5ddaf6b17454180cea55b2ce0b94b571
fix comparación
account_analytic_cost_line/models/account.py
account_analytic_cost_line/models/account.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2016 Comunitea All Rights Reserved # $Jesús Ventosinos Mayor <jesus@comunitea.com>$ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2016 Comunitea All Rights Reserved # $Jesús Ventosinos Mayor <jesus@comunitea.com>$ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
Python
0.000102
d9d68abe350d253d6952041d61872bd3eec5f95d
FIX after duplicating an old invoice and validating it, get The invoice date cannot be later than the date of registration
account_invoice_entry_date/models/account.py
account_invoice_entry_date/models/account.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2004-2010 ISA srl (<http://www.isa.it>). # Copyright (C) 2014 Associazione Odoo Italia # http://www.openerp-italia.org> # # This program is free software: you can redistribute it and/or m...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2004-2010 ISA srl (<http://www.isa.it>). # Copyright (C) 2014 Associazione Odoo Italia # http://www.openerp-italia.org> # # This program is free software: you can redistribute it and/or m...
Python
0.000001
b3c1aa9b3415240e03ae790d58df72d8442ae761
Fix PEP8
account_statement_so_completion/statement.py
account_statement_so_completion/statement.py
# -*- coding: utf-8 -*- ############################################################################### # # # Author: Joel Grand-Guillaume # # Copyright 2011-2012 Camptocamp SA ...
# -*- coding: utf-8 -*- ############################################################################### # # # Author: Joel Grand-Guillaume # # Copyright 2011-2012 Camptocamp SA ...
Python
0.005634
8a082670b108f36f95e5c421df41ea964843d122
Rename method
cartoframes/data/services/bq_datasets.py
cartoframes/data/services/bq_datasets.py
import os import requests from carto.utils import ResponseStream # from carto.auth import APIKeyAuthClient from carto.exceptions import CartoException # TODO: this shouldn't be hardcoded DO_ENRICHMENT_API_URL = 'http://localhost:7070/bq' class BQDataset: def __init__(self, name_id): self.name = name_id...
import os import requests from carto.utils import ResponseStream # from carto.auth import APIKeyAuthClient from carto.exceptions import CartoException # TODO: this shouldn't be hardcoded DO_ENRICHMENT_API_URL = 'http://localhost:7070/bq' class BQDataset: def __init__(self, name_id): self.name = name_id...
Python
0.000002
872f5d997ec48b1c8eb7771ec3771f05dc27cd96
Put in target states for each state
catching_raindrops/catching_raindrops.py
catching_raindrops/catching_raindrops.py
# catching_raindrops.py 08/03/2016 D.J.Whale # game parameters CUP_CAPACITY = 5 SPEED = 6 MAX_MISSES = 3 AUTO_EMPTY = False SENSITIVITY = 400 def get_cup_position(): acc = accelerometer.get_x()/SENSITIVITY return math.clamp(0, 4, acc+2) def show_splash_screen(): pass # TODO show an animation until...
# catching_raindrops.py 08/03/2016 D.J.Whale # game parameters CUP_CAPACITY = 5 SPEED = 6 MAX_MISSES = 3 AUTO_EMPTY = False SENSITIVITY = 400 def get_cup_position(): acc = accelerometer.get_x()/SENSITIVITY return math.clamp(0, 4, acc+2) def show_splash_screen(): pass # TODO show an animation until...
Python
0.999999
8d8f470ad0788b1e6e91155f07b351de04051824
add test for search by name and pagination
app/mod_bucketlists/tests/test_bucketlist.py
app/mod_bucketlists/tests/test_bucketlist.py
from app.test_config import BaseTestCase class BucketListTestCase(BaseTestCase): def test_creates_new_bucketlist_with_token(self): data = { 'bucket_name': 'Christmas' } response = self.client.post('/bucketlists/', data=data, headers=self.token, follow_redirects=True) s...
from app.test_config import BaseTestCase class BucketListTestCase(BaseTestCase): def test_creates_new_bucketlist_with_token(self): data = { 'bucket_name': 'Christmas' } response = self.client.post('/bucketlists/', data=data, headers=self.token, follow_redirects=True) s...
Python
0
7855d8a4a4c3151f0b3f4da04696322cca92ee06
fix tests
cla_frontend/apps/cla_auth/tests/urls.py
cla_frontend/apps/cla_auth/tests/urls.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import http from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from . import base from django.core.urlresolvers import reverse_lazy @login_required def test_view(request): retur...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import http from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from . import base @login_required def test_view(request): return http.HttpResponse('logged in') zone_url = patt...
Python
0.000001
4bc0b7981f6eaa1744c90d0c080b9678af52d624
fix bug in picture specs
apps/project_sheet/project_pictures_specs.py
apps/project_sheet/project_pictures_specs.py
""" Specification for image manipulation throw imagekit """ from imagekit.specs import ImageSpec from imagekit import processors from imagekit.processors import ImageProcessor from imagekit.lib import ImageColor, Image class Center(ImageProcessor): """ Generic image centering processor """ width = Non...
""" Specification for image manipulation throw imagekit """ from imagekit.specs import ImageSpec from imagekit import processors from imagekit.processors import ImageProcessor from imagekit.lib import ImageColor class Center(ImageProcessor): """ Generic image centering processor """ width = None he...
Python
0
354eea19773b652e705f68648c68c235bfa27dd7
Fix weird naming
twisted/plugins/nanoplay_plugin.py
twisted/plugins/nanoplay_plugin.py
from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from twisted.internet import reactor from twisted.application import service, strports from nanoplay import PayloadProtocol, ControlProtocol, CustomServer, Player class Options(usage.Options): optParameters = ...
from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from twisted.internet import reactor from twisted.application import service, strports from nanoplay import PayloadProtocol, ControlProtocol, CustomServer, Player class Options(usage.Options): optParameters = ...
Python
0.030363
25f0bd4064e527006b492a2242586c8025a2cd9d
Fix bug in normalization
athenet/algorithm/derest/layers/inception.py
athenet/algorithm/derest/layers/inception.py
from athenet.algorithm.derest.layers import DerestSoftmaxLayer,\ DerestReluLayer, DerestPoolLayer, DerestNormLayer, DerestLayer, \ DerestFullyConnectedLayer, DerestConvolutionalLayer, DerestDropoutLayer from athenet.layers import Softmax, ReLU, PoolingLayer, LRN, \ ConvolutionalLayer, Dropout, FullyConnecte...
from athenet.algorithm.derest.layers import DerestSoftmaxLayer,\ DerestReluLayer, DerestPoolLayer, DerestNormLayer, DerestLayer, \ DerestFullyConnectedLayer, DerestConvolutionalLayer, DerestDropoutLayer from athenet.layers import Softmax, ReLU, PoolingLayer, LRN, \ ConvolutionalLayer, Dropout, FullyConnecte...
Python
0.000002
b3eb2ef5e65ee18384b3d49981d604cbcf30c400
Rename noop setup to 'noop'.
buzzmobile/tests/test_utils/rostest_utils.py
buzzmobile/tests/test_utils/rostest_utils.py
"""A collection of utilities to make testing with ros less painful. """ import os import random import subprocess import unittest import socket def rand_port(): """Picks a random port number. This is potentially unsafe, but shouldn't generally be a problem. """ return random.randint(10311, 12311) ...
"""A collection of utilities to make testing with ros less painful. """ import os import random import subprocess import unittest import socket def rand_port(): """Picks a random port number. This is potentially unsafe, but shouldn't generally be a problem. """ return random.randint(10311, 12311) ...
Python
0.000007
5eb11aa2a41e2d2448cf81d3ef4416a7aaf3a537
change db location to match reinit.sh script
calebasse/settings/local_settings_example.py
calebasse/settings/local_settings_example.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'calebasse/calebasse.sqlite3', } }
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'calebasse.sqlite3', } }
Python
0
717721018eff9897d2488b48aa932fcaa3694615
Fix crash
chatterbot/adapters/logic/closest_meaning.py
chatterbot/adapters/logic/closest_meaning.py
from chatterbot.adapters.exceptions import EmptyDatasetException from .base_match import BaseMatchAdapter from nltk.corpus import wordnet from nltk.corpus import stopwords from nltk import word_tokenize class ClosestMeaningAdapter(BaseMatchAdapter): def __init__(self, **kwargs): super(ClosestMeaningAdap...
from chatterbot.adapters.exceptions import EmptyDatasetException from .base_match import BaseMatchAdapter from nltk.corpus import wordnet from nltk.corpus import stopwords from nltk import word_tokenize class ClosestMeaningAdapter(BaseMatchAdapter): def __init__(self, **kwargs): super(ClosestMeaningAdap...
Python
0.000011
26d104b5758d41954d0da4a3447cc22c089c1cf0
fix migrations
cmsplugin_iframe2/migrations/0001_initial.py
cmsplugin_iframe2/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2017-04-01 18:26 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion from ..conf import settings class Migration(migrations.Migration): initial = True dependencies = [ ('cms', '0016...
# -*- coding: utf-8 -*- # Generated by Django 1.9.9 on 2017-04-01 18:26 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('cms', '0016_auto_20160608_1535'), ] ...
Python
0.000002
4c96d4c2132575f89abdd3dd41eef5bb27a210e8
Fix timezone warnings in factory.py
apps/core/factories.py
apps/core/factories.py
from factory import Faker, Iterator, SubFactory from factory.django import DjangoModelFactory from django.utils import timezone from apps.data.factories import EntryFactory, RepositoryFactory from faker import Faker as faker_Faker from . import models def Get_date_with_timezone(): TZ = timezone.get_default_timez...
from factory import Faker, Iterator, SubFactory from factory.django import DjangoModelFactory from apps.data.factories import EntryFactory, RepositoryFactory from . import models class SpeciesFactory(DjangoModelFactory): name = Faker('word') reference = SubFactory(EntryFactory) repository = SubFactory(R...
Python
0.000015
53f5e4cfdf3c841cb3cb87c7a63cc9d2d24d2ae6
error when employee res_partner relation it is false
hr_employee_catch_partner/models/hr_employee.py
hr_employee_catch_partner/models/hr_employee.py
# -*- coding: utf-8 -*- # (c) 2016 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api class HrEmployee(models.Model): _inherit = 'hr.employee' @api.multi def onchange_user(self, user_id): user_obj = self.env['res.users'...
# -*- coding: utf-8 -*- # (c) 2016 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api class HrEmployee(models.Model): _inherit = 'hr.employee' @api.multi def onchange_user(self, user_id): user_obj = self.env['res.users'...
Python
0.999991
322cf2ad0909b021c2f0c740943fe0e3b443d630
Update backend
app/urlshortener/__init__.py
app/urlshortener/__init__.py
import redis from app.urlshortener.name import getNthName class URLShortener: def __init__(self, default_ttl): self.r = redis.StrictRedis(host='localhost', port=6379, db=0) self.new_namespace = 'lyli' self.old_namespace = 'shorturl' # This can be removed on 29.11.2014 at 22:50 ...
import redis from app.urlshortener.name import getNthName class URLShortener: def __init__(self): self.r = redis.StrictRedis(host='localhost', port=6379, db=0) self.namespace = 'shorturl' self.ttl = 60*60*24*7*2 # two weeks def shorten(self, url, name): existing_url = sel...
Python
0.000001
7ef6132194ccd207c554521209ba3472bf523940
Make factories return unicode data
common/djangoapps/student/tests/factories.py
common/djangoapps/student/tests/factories.py
from student.models import (User, UserProfile, Registration, CourseEnrollmentAllowed, CourseEnrollment) from django.contrib.auth.models import Group from datetime import datetime from factory import DjangoModelFactory, SubFactory, PostGenerationMethodCall, post_generation, Sequence from uuid...
from student.models import (User, UserProfile, Registration, CourseEnrollmentAllowed, CourseEnrollment) from django.contrib.auth.models import Group from datetime import datetime from factory import DjangoModelFactory, SubFactory, PostGenerationMethodCall, post_generation, Sequence from uuid...
Python
0.005613
0d1518bc9a329a8ccf6ed2559998ab8e65cbcb33
Don't assert the response is a JSON response
argonauts/testutils.py
argonauts/testutils.py
import json import functools from django.conf import settings from django.test import Client, TestCase __all__ = ['JsonTestClient', 'JsonTestCase'] class JsonTestClient(Client): def _json_request(self, method, url, data=None, *args, **kwargs): method_func = getattr(super(JsonTestClient, self), method) ...
import json import functools from django.conf import settings from django.test import Client, TestCase __all__ = ['JsonTestClient', 'JsonTestCase'] class JsonTestClient(Client): def _json_request(self, method, url, data=None, *args, **kwargs): method_func = getattr(super(JsonTestClient, self), method) ...
Python
0.99848
20bbacc8683512ba877654e810a0ce65876804c7
Use keyword to construct the help message.
appointments/handlers/new.py
appointments/handlers/new.py
from __future__ import unicode_literals from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from .base import AppointmentHandler from ..forms import NewMessageForm from ..models import Timeline, TimelineSubscription, now class NewHandler(AppointmentHandler): "Subscribes a user...
from __future__ import unicode_literals from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from .base import AppointmentHandler from ..forms import NewMessageForm from ..models import Timeline, TimelineSubscription, now class NewHandler(AppointmentHandler): "Subscribes a user...
Python
0.000002
bbc5953cbaf29ef3421049db3c7ac00fd94c3734
Clean up nocookie code
pelican_youtube/youtube.py
pelican_youtube/youtube.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 Kura # 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, modify, merge, ...
# -*- coding: utf-8 -*- # Copyright (c) 2013 Kura # 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, modify, merge, ...
Python
0.000411
6a58541a0fe1a942c3a2c187eb0358bd8350a51f
Change default output folder of minimize-content-pack.py.
minimize-content-pack.py
minimize-content-pack.py
""" minimize-content-pack Remove assessment items, subtitles and po files from a content pack. Usage: minimize-content-pack.py <old-content-pack-path> <out-path> """ import zipfile from pathlib import Path from docopt import docopt ITEMS_TO_TRANSFER = [ "metadata.json", "content.db", "backend.mo", ...
""" minimize-content-pack Remove assessment items, subtitles and po files from a content pack. Usage: minimize-content-pack.py <old-content-pack-path> <out-path> """ import zipfile from pathlib import Path from docopt import docopt ITEMS_TO_TRANSFER = [ "metadata.json", "content.db", "backend.mo", ...
Python
0
35e6559bd13f46679333e72b6356a82a0657cce4
fix thinko in kepler test
gala/potential/potential/tests/test_against_galpy.py
gala/potential/potential/tests/test_against_galpy.py
"""Test some builtin potentials against galpy""" # Third-party import numpy as np from astropy.constants import G import astropy.units as u import pytest # This project from ...._cconfig import GSL_ENABLED from ....units import galactic from ..builtin import (KeplerPotential, MiyamotoNagaiPotential, ...
"""Test some builtin potentials against galpy""" # Third-party import numpy as np from astropy.constants import G import astropy.units as u import pytest # This project from ...._cconfig import GSL_ENABLED from ....units import galactic from ..builtin import (KeplerPotential, MiyamotoNagaiPotential, ...
Python
0
20f7102daf411a07ec922fceb2fac6c00356a84b
Revert "Version in function"
asgi_redis/__init__.py
asgi_redis/__init__.py
import pkg_resources from .core import RedisChannelLayer from .local import RedisLocalChannelLayer __version__ = pkg_resources.require('asgi_redis')[0].version
import pkg_resources from .core import RedisChannelLayer from .local import RedisLocalChannelLayer def get_version(): return pkg_resources.require('asgi_redis')[0].version
Python
0
ea0847a1c509b2eba1e652b597f2921b0c19da2d
Add field for name in mail dict
mail_parser.py
mail_parser.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- import os, sys from email.parser import Parser import json import re def parse_mail(file_in): """ Extract Subject & Body of mail file headers must be formatted as a block of RFC 2822 style """ # filename_out = os.path.splitext(os.path.basenam...
#!/usr/bin/env python3 # -*- coding: utf8 -*- import os, sys from email.parser import Parser import json import re def parse_mail(file_in): """ Extract Subject & Body of mail file headers must be formatted as a block of RFC 2822 style """ # filename_out = os.path.splitext(os.path.basenam...
Python
0
ae916c1ee52941bb5a1ccf87abe2a9758897bd08
Add deprecation warnings and message to getlines function
IPython/utils/ulinecache.py
IPython/utils/ulinecache.py
""" This module has been deprecated since IPython 6.0. Wrapper around linecache which decodes files to unicode according to PEP 263. """ import functools import linecache import sys from warnings import warn from IPython.utils import py3compat from IPython.utils import openpy getline = linecache.getline # getlines ...
""" Wrapper around linecache which decodes files to unicode according to PEP 263. """ import functools import linecache import sys from IPython.utils import py3compat from IPython.utils import openpy getline = linecache.getline # getlines has to be looked up at runtime, because doctests monkeypatch it. @functools.wr...
Python
0
eec612ae54010485bb53403ada88f723d9a21cc1
Use Dict Comprehension and add criticality
InterviewSchedulerGurobi.py
InterviewSchedulerGurobi.py
from gurobipy import * from datetime import datetime def read_input_csv(filename): row_header, matrix, col_header = list(), dict(), set() with open(filename) as f: for csvline in f: csvline = csvline.strip() if len(row_header) == 0: row_header = csvline.split(',...
from gurobipy import * from datetime import datetime def read_input_csv(filename): row_header, matrix, col_header = list(), dict(), set() with open(filename) as f: for csvline in f: csvline = csvline.strip() if len(row_header) == 0: row_header = csvline.split(',...
Python
0.000001
59f324229acfab30811cc61b3880770292699a6d
update country in email to group
tola/util.py
tola/util.py
import unicodedata import urllib2 import json import sys from activitydb.models import Country, TolaUser from django.contrib.auth.models import User from django.core.mail import send_mail, mail_admins, mail_managers, EmailMessage #CREATE NEW DATA DICTIONARY OBJECT def siloToDict(silo): parsed_data = {} key_v...
import unicodedata import urllib2 import json import sys from activitydb.models import Country, TolaUser from django.contrib.auth.models import User from django.core.mail import send_mail, mail_admins, mail_managers, EmailMessage #CREATE NEW DATA DICTIONARY OBJECT def siloToDict(silo): parsed_data = {} key_v...
Python
0.000001
04065919be55d8e4371cc1e7fec1a0148298ccf7
throw if obj is not serializable
mygeotab/serializers.py
mygeotab/serializers.py
# -*- coding: utf-8 -*- """ mygeotab.serializers ~~~~~~~~~~~~~~~~~~~~ JSON serialization and deserialization helper objects for the MyGeotab API. """ import re import arrow import six use_rapidjson = False try: import rapidjson DATETIME_MODE = rapidjson.DM_SHIFT_TO_UTC | rapidjson.DM_ISO8601 use_rapi...
# -*- coding: utf-8 -*- """ mygeotab.serializers ~~~~~~~~~~~~~~~~~~~~ JSON serialization and deserialization helper objects for the MyGeotab API. """ import re import arrow import six use_rapidjson = False try: import rapidjson DATETIME_MODE = rapidjson.DM_SHIFT_TO_UTC | rapidjson.DM_ISO8601 use_rapi...
Python
0.000008
c2c4e47f5cdae6e683e87dcc8c7b536633755c5a
fix with black formatter
examples/distribuited_execution_terraform/aws/plan/basic.py
examples/distribuited_execution_terraform/aws/plan/basic.py
import time from locust import HttpUser, task, between class Quickstart(HttpUser): wait_time = between(1, 5) @task def google(self): self.client.request_name = "google" self.client.get("https://google.com/") @task def microsoft(self): self.client.request_name = "microsoft...
import time from locust import HttpUser, task, between class Quickstart(HttpUser): wait_time = between(1, 5) @task def google(self): self.client.request_name = "google" self.client.get("https://google.com/") @task def microsoft(self): self.client.request_name = "microsoft"...
Python
0.000029
c43bfe9bdec958b18573a9d0fa87cd6a881d6281
Fix python 3 compatibility issue for StringIO
test/test_provider_object_store_service.py
test/test_provider_object_store_service.py
# Python 3 compatibility fix try: from StringIO import StringIO except ImportError: from io import StringIO import uuid from test.helpers import ProviderTestBase import test.helpers as helpers class ProviderObjectStoreServiceTestCase(ProviderTestBase): def __init__(self, methodName, provider): ...
import StringIO import uuid from test.helpers import ProviderTestBase import test.helpers as helpers class ProviderObjectStoreServiceTestCase(ProviderTestBase): def __init__(self, methodName, provider): super(ProviderObjectStoreServiceTestCase, self).__init__( methodName=methodName, provider...
Python
0.000004
a967fbb3b38e0788ccbde0650076ab05e693806a
Bump version number.
nativeconfig/version.py
nativeconfig/version.py
VERSION = '3.0.0'
VERSION = '2.9.1'
Python
0
4fa4645b7802cc358a99888391b47d8ce82bbcae
fix custom.intrahealth.tests.test_fluffs:TestFluffs.test_taux_de_satifisfaction_fluff
custom/intrahealth/tests/test_fluffs.py
custom/intrahealth/tests/test_fluffs.py
from __future__ import absolute_import from __future__ import unicode_literals import os from django.core import management from corehq.apps.receiverwrapper.auth import AuthContext from corehq.apps.receiverwrapper.util import submit_form_locally from corehq.util.test_utils import softer_assert import xml.etree.Elemen...
from __future__ import absolute_import from __future__ import unicode_literals import os from django.core import management from corehq.apps.receiverwrapper.auth import AuthContext from corehq.apps.receiverwrapper.util import submit_form_locally from corehq.util.test_utils import softer_assert import xml.etree.Elemen...
Python
0.000001
1bfab9dd43fc52bfdea0943703ee530e3b0f98de
remove SpecsParser
neurodocker/__init__.py
neurodocker/__init__.py
# Author: Jakub Kaczmarzyk <jakubk@mit.edu> from __future__ import absolute_import import logging import sys LOG_FORMAT = '[NEURODOCKER %(asctime)s %(levelname)s]: %(message)s' logging.basicConfig(stream=sys.stdout, datefmt='%H:%M:%S', level=logging.INFO, format=LOG_FORMAT) from neurodocker.dock...
# Author: Jakub Kaczmarzyk <jakubk@mit.edu> from __future__ import absolute_import import logging import sys LOG_FORMAT = '[NEURODOCKER %(asctime)s %(levelname)s]: %(message)s' logging.basicConfig(stream=sys.stdout, datefmt='%H:%M:%S', level=logging.INFO, format=LOG_FORMAT) from neurodocker imp...
Python
0.000001
7d839c4b2a04c82d4198d84e30fdbb94415cb58d
Add more comments, send/recv method args to spawn-based MPI classes.
neurokernel/mpi_proc.py
neurokernel/mpi_proc.py
#!/usr/bin/env python """ Classes for managing MPI-based processes. """ import inspect import os import sys # Use dill for mpi4py object serialization to accomodate a wider range of argument # possibilities than possible with pickle: import dill from mpi4py import MPI MPI.pickle.dumps = dill.dumps MPI.pickle.loads =...
#!/usr/bin/env python """ Classes for managing MPI-based processes. """ import inspect import os import sys # Use dill for mpi4py object serialization to accomodate a wider range of argument # possibilities than possible with pickle: import dill from mpi4py import MPI MPI.pickle.dumps = dill.dumps MPI.pickle.loads =...
Python
0
44d74984bd4168eddb4cc5f9c0e77aad4e498a02
fix broken plots
moca/plotter/__init__.py
moca/plotter/__init__.py
from .plotter import create_plot
from .seqstats import perform_t_test from .seqstats import get_pearson_corr from .plotter import create_plot
Python
0.000006
d2f1595fbb9e8d29e2126aa9453f4159e9b85a0d
add event to receive panel on focus
guicomm/events.py
guicomm/events.py
import wx.lib.newevent # plot data (NewPlotEvent, EVT_NEW_PLOT) = wx.lib.newevent.NewEvent() # print the messages on statusbar (StatusEvent, EVT_STATUS) = wx.lib.newevent.NewEvent() #create a panel slicer (SlicerPanelEvent, EVT_SLICER_PANEL) = wx.lib.newevent.NewEvent() #print update paramaters for panel s...
import wx.lib.newevent # plot data (NewPlotEvent, EVT_NEW_PLOT) = wx.lib.newevent.NewEvent() # print the messages on statusbar (StatusEvent, EVT_STATUS) = wx.lib.newevent.NewEvent() #create a panel slicer (SlicerPanelEvent, EVT_SLICER_PANEL) = wx.lib.newevent.NewEvent() #print update paramaters for panel s...
Python
0
1c51ca868a3a1a2b3110b76ec7b563aa7d9d9c58
update tests
hs_core/tests/api/native/test_folder_download_zip.py
hs_core/tests/api/native/test_folder_download_zip.py
import os from django.contrib.auth.models import Group from django.test import TestCase from hs_core.hydroshare.users import create_account from hs_core.hydroshare.resource import add_resource_files, create_resource from hs_core.models import GenericResource from hs_core.tasks import create_temp_zip from django_irods....
import os from django.contrib.auth.models import Group from django.test import TestCase from hs_core.hydroshare.users import create_account from hs_core.hydroshare.resource import add_resource_files, create_resource from hs_core.models import GenericResource from hs_core.tasks import create_temp_zip from django_irods....
Python
0
a0e07c3ecf84219b79889509e29da0b800e36a97
fix angle normalization in get_draw_angles()
src/ezdxf/addons/drawing/utils.py
src/ezdxf/addons/drawing/utils.py
# Created: 06.2020 # Copyright (c) 2020, Matthew Broadway # License: MIT License import enum import math from math import tau from typing import Union, List from ezdxf.addons.drawing.type_hints import Radians from ezdxf.entities import Face3d, Solid, Trace from ezdxf.math import Vector, Z_AXIS, OCS def normalize_ang...
# Created: 06.2020 # Copyright (c) 2020, Matthew Broadway # License: MIT License import enum import math from math import tau from typing import Union, List from ezdxf.addons.drawing.type_hints import Radians from ezdxf.entities import Face3d, Solid, Trace from ezdxf.math import Vector, Z_AXIS, OCS def normalize_ang...
Python
0.000001
272bb8da7a44e5a0ccb7953e0ccdfd7ab473e9f1
Fix test_postgresql dependency analysis.
test/units/module_utils/test_postgresql.py
test/units/module_utils/test_postgresql.py
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) import sys from units.compat import unittest from units.compat.mock import patch, MagicMock from ansible.module_utils.six.moves import builtins from ansible.module_utils._text import to_n...
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) import sys from units.compat import unittest from units.compat.mock import patch, MagicMock from ansible.module_utils.six.moves import builtins from ansible.module_utils._text import to_n...
Python
0
ad42d5df34074bfb21229a962d4b2a548a796e9a
Update data_validation/jellyfish_distance.py
data_validation/jellyfish_distance.py
data_validation/jellyfish_distance.py
# Copyright 2020 Google LLC # # 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 2020 Google LLC # # 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
7c2f915b0ca89db2c44a73af8db3f803687f068b
reimplement load_library and backup_library
unskipper.py
unskipper.py
#! /usr/bin/env python3 # unskipper.py will prune all skipcounts from your Quod Libet library; # the resulting lack of '~#skipcount' in your per-song entries will all # be interpreted by QL as being skipcount 0. import os import sys import shutil import quodlibet.library HOME = os.getenv("HOME") QLDIR = ".quodlibet...
#! /usr/bin/env python3 # unskipper.py will prune all skipcounts from your Quod Libet library; # the resulting lack of '~#skipcount' in your per-song entries will all # be interpreted by QL as being skipcount 0. import os import sys import shutil import pickle HOME = os.getenv("HOME") QLDIR = ".quodlibet" PATH_TO_S...
Python
0.000001
ba8e7f03469b55e8517361ade605804cb87757e3
Update res_partner.py
l10n_ro_fiscal_validation/models/res_partner.py
l10n_ro_fiscal_validation/models/res_partner.py
# Copyright (C) 2018 Forest and Biomass Romania # Copyright (C) 2020 NextERP Romania # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import time import requests from odoo import api, fields, models CEDILLATRANS = bytes.maketrans( u"\u015f\u0163\u015e\u0162".encode("utf8"), u"\u0219\u021...
# Copyright (C) 2018 Forest and Biomass Romania # Copyright (C) 2020 NextERP Romania # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import time import requests from odoo import api, fields, models CEDILLATRANS = bytes.maketrans( u"\u015f\u0163\u015e\u0162".encode("utf8"), u"\u0219\u021...
Python
0
a889d4726189d1a7c9a9fbd074ca2c1d6eca9d98
delete unnecessary constraint
chainercv/links/model/extraction_chain.py
chainercv/links/model/extraction_chain.py
import chainer import collections class ExtractionChain(chainer.Chain): def __init__(self, layers, layer_names=None): super(ExtractionChain, self).__init__() if not isinstance(layers, collections.OrderedDict): layers = collections.OrderedDict( [(str(i), function) for ...
import chainer import collections class ExtractionChain(chainer.Chain): def __init__(self, layers, layer_names=None): super(ExtractionChain, self).__init__() if not isinstance(layers, collections.OrderedDict): if layer_names is not None: raise ValueError('`layer_names...
Python
0.000024
ce143f40f3131bbd04e40cacec50cae3e725b598
use new package module
updatecmd.py
updatecmd.py
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import package import files import shutil import pwd import grp import files def doUpdate(cfg, root, pkgName, binaries = 1, sources = 0): if root == "/": print "using srs to update to your actual system is dumb." import sys sys.exit(0) if pkgNam...
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import package import files import shutil import pwd import grp import files def doUpdate(cfg, root, pkgName, binaries = 1, sources = 0): if root == "/": print "using srs to update to your actual system is dumb." import sys sys.exit(0) if pkgNam...
Python
0
6ebf6e6f2e8c4e2be5e4778089a8d4a66432c88b
update ProgressHook
chainercv/utils/iterator/progress_hook.py
chainercv/utils/iterator/progress_hook.py
from __future__ import division import sys import time class ProgressHook(object): """A hook class reporting the progress of iteration. This is a hook class designed for :func:`~chainercv.utils.apply_prediction_to_iterator`. Args: n_total (int): The number of images. This argument is option...
from __future__ import division import sys import time class ProgressHook(object): """A hook class reporting the progress of iteration. This is a hook class designed for :func:`~chainercv.utils.apply_prediction_to_iterator`. Args: n_total (int): The number of images. This argument is option...
Python
0
39c50ed20cbd282c1e351057cc67d7234ca0a37d
incorrect histogram
assignment-1/utilities.py
assignment-1/utilities.py
from random import expovariate, randint from queue import Queue import matplotlib.pyplot as plt import numpy as np class Packet: def __init__(self, arrival_time, service_time): self.arrival_time = arrival_time self.service_time = service_time class Generator: def __init__(self, arrival_lambd...
from random import expovariate, randint from queue import Queue import matplotlib.pyplot as plt import numpy as np class Packet: def __init__(self, arrival_time, service_time): self.arrival_time = arrival_time self.service_time = service_time class Generator: def __init__(self, arrival_lambd...
Python
0.999014
22f293ff16dd977c6a37b64566b37405d81cb767
Make the KeyIdentifier.key_id field a property.
atlassian_jwt_auth/key.py
atlassian_jwt_auth/key.py
import os import re import requests class KeyIdentifier(object): """ This class represents a key identifier """ def __init__(self, identifier): self.__key_id = validate_key_identifier(identifier) @property def key_id(self): return self.__key_id def validate_key_identifier(identif...
import os import re import requests class KeyIdentifier(object): """ This class represents a key identifier """ def __init__(self, identifier): self.key_id = validate_key_identifier(identifier) def validate_key_identifier(identifier): """ returns a validated key identifier. """ regex = re...
Python
0
a8d6959d32b50cab41e05ae9e1eed75c1b7d3fa7
Add replace to routes.all
respite/urls/routes.py
respite/urls/routes.py
from respite.inflector import pluralize, cc2us class Route(object): """A route instance connects a path and method to a view.""" def __init__(self, regex, view, method, name): """ Initialize a route. Arguments: regex -- A string describing a regular expression to which the ...
from respite.inflector import pluralize, cc2us class Route(object): """A route instance connects a path and method to a view.""" def __init__(self, regex, view, method, name): """ Initialize a route. Arguments: regex -- A string describing a regular expression to which the ...
Python
0.000006
fab58f03eaf09b9f286a10f5a91a945f53a92a29
Drop native specification
splauncher/core.py
splauncher/core.py
from __future__ import print_function __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>" __date__ = "$May 18, 2015 16:52:18 EDT$" import datetime import os import logging drmaa_logger = logging.getLogger(__name__) try: import drmaa except ImportError: # python-drmaa is not installed. drmaa_logger...
from __future__ import print_function __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>" __date__ = "$May 18, 2015 16:52:18 EDT$" import datetime import os import logging drmaa_logger = logging.getLogger(__name__) try: import drmaa except ImportError: # python-drmaa is not installed. drmaa_logger...
Python
0
e61247230b291bcf9f9dcc3050876b9f812c6541
change url for methodcheck thanks steve steiner http://www.atxconsulting.com/blog/tjfontaine/2010/02/09/updated-linode-api#comment-195
methodcheck.py
methodcheck.py
#!/usr/bin/python """ A quick script to verify that api.py is in sync with Linode's published list of methods. Copyright (c) 2009 Ryan Tucker <rtucker@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal i...
#!/usr/bin/python """ A quick script to verify that api.py is in sync with Linode's published list of methods. Copyright (c) 2009 Ryan Tucker <rtucker@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal i...
Python
0
cc413b49ce9dd63fcbe9396a5ac1c8c68872a6c1
Update information in pkginfo, including the version information.
astroid/__pkginfo__.py
astroid/__pkginfo__.py
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of astroid. # # astroid is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the #...
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of astroid. # # astroid is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the #...
Python
0
a891594150a4456e0894f2b5b70f2bd4b650bd77
use debug to log dqn_freeze model update to prevent log overflow
rl/agent/dqn_freeze.py
rl/agent/dqn_freeze.py
import os import numpy as np from rl.agent.double_dqn import DoubleDQN from rl.agent.dqn import DQN from keras.models import load_model from rl.util import logger class DQNFreeze(DoubleDQN): ''' Extends DQN agent to freeze target Q network and periodically update them to the weights of the exploratio...
import os import numpy as np from rl.agent.double_dqn import DoubleDQN from rl.agent.dqn import DQN from keras.models import load_model from rl.util import logger class DQNFreeze(DoubleDQN): ''' Extends DQN agent to freeze target Q network and periodically update them to the weights of the exploratio...
Python
0
cf837175763cd99e19dd95f14c9ac0dfd705bffd
set global 'sqlalchemy' log level to ERROR so it is insulated from other logging configs [ticket:353]
lib/sqlalchemy/logging.py
lib/sqlalchemy/logging.py
# logging.py - adapt python logging module to SQLAlchemy # Copyright (C) 2006 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides a few functions used by instances to turn on/off their loggi...
# logging.py - adapt python logging module to SQLAlchemy # Copyright (C) 2006 Michael Bayer mike_mp@zzzcomputing.com # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides a few functions used by instances to turn on/off their loggi...
Python
0.000001
38efa9aa11f949fc8bd0b6c4d1a673ca3416dd3c
Fix up iterator implementation in LISTALLOBJECTs
groundstation/transfer/request_handlers/listallobjects.py
groundstation/transfer/request_handlers/listallobjects.py
import groundstation.transfer.request from groundstation import settings from groundstation import logger log = logger.getLogger(__name__) def chunks(l, n): """ Yield successive n-sized chunks from l. """ for i in xrange(0, len(l), n): yield l[i:i+n] def handle_listallobjects(self): if not ...
import groundstation.transfer.request from groundstation import settings from groundstation import logger log = logger.getLogger(__name__) def chunks(l, n): """ Yield successive n-sized chunks from l. """ for i in xrange(0, len(l), n): yield l[i:i+n] def handle_listallobjects(self): if not ...
Python
0.00006
1fc0026aa72f7fcf66c221de402971023361e6c3
implement memo logger
spyne/util/memo.py
spyne/util/memo.py
# # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This libra...
# # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This libra...
Python
0.000001
ae044f507f3bcf508648b1a73a802b657009cd48
fix nxos_reboot command format (#30549)
lib/ansible/modules/network/nxos/nxos_reboot.py
lib/ansible/modules/network/nxos/nxos_reboot.py
#!/usr/bin/python # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distribut...
#!/usr/bin/python # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distribut...
Python
0
b8ed081ac4cc5953aaf5b1a2091fefa59d375bf1
Add logging for extension
uno_image.py
uno_image.py
""" Example usage of UNO, graphic objects and networking in LO extension """ import logging import uno import unohelper from com.sun.star.task import XJobExecutor class ImageExample(unohelper.Base, XJobExecutor): '''Class that implements the service registered in LibreOffice''' def __init__(self, context): ...
""" Example usage of UNO, graphic objects and networking in LO extension """ import uno import unohelper from com.sun.star.task import XJobExecutor class ImageExample(unohelper.Base, XJobExecutor): '''Class that implements the service registered in LibreOffice''' def __init__(self, context): self.con...
Python
0.000001
d790a1d4a98a4f9931e38745df434f96077d3518
Add simple sklearn tuner test
tests/kerastuner/engine/base_tuner_test.py
tests/kerastuner/engine/base_tuner_test.py
# Copyright 2019 The Keras Tuner Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
# Copyright 2019 The Keras Tuner Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
Python
0
67d26378653c2764f0c95beae991370344644716
add reset method.
rmake/lib/publisher.py
rmake/lib/publisher.py
# # Copyright (c) 2006 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licen...
# # Copyright (c) 2006 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licen...
Python
0
22a2c4ec841741297825f0e8ac301d6cad3b739b
Add replace for "0x2212" to -.
translate.py
translate.py
#!/usr/bin/env python3 import re # подцепляем словарь из внешнего файла import translate_dict as dictionary input_text = None filename = None def replace_lang(text, dic): langs = re.findall('(?:^Languages|(?<= ))(\w+)[, ]*', text) langru = "Языки " for lang in langs: try: langru = l...
#!/usr/bin/env python3 import re # подцепляем словарь из внешнего файла import translate_dict as dictionary input_text = None filename = None def replace_lang(text, dic): langs = re.findall('(?:^Languages|(?<= ))(\w+)[, ]*', text) langru = "Языки " for lang in langs: try: langru = l...
Python
0
807d197ca0c131c9ef5f4a683be04c7df8f715bb
Add goToAlias button (my position) to Overkiz integration (#76694)
homeassistant/components/overkiz/button.py
homeassistant/components/overkiz/button.py
"""Support for Overkiz (virtual) buttons.""" from __future__ import annotations from dataclasses import dataclass from pyoverkiz.types import StateType as OverkizStateType from homeassistant.components.button import ButtonEntity, ButtonEntityDescription from homeassistant.config_entries import ConfigEntry from homea...
"""Support for Overkiz (virtual) buttons.""" from __future__ import annotations from homeassistant.components.button import ButtonEntity, ButtonEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import EntityCategory fro...
Python
0
77e09f2f085bc894c1f45e94662e32a981e9b0db
Convert Chinese quotation
PythonScript/Helper/Helper.py
PythonScript/Helper/Helper.py
# This Python file uses the following encoding: utf-8 def main(): try: fileName = "MengZi_Traditional.md" filePath = "../../source/" + fileName content = None with open(filePath,'r') as file: content = file.read().decode("utf-8") content = content.replace(u"「",u'“...
def main(): try: fileName = "MengZi_Traditional.md" filePath = "../../source/" + fileName with open(filePath, 'r') as file: for line in file: print line except IOError: print ("The file (" + filePath + ") does not exist.") if __name__ == '__main__': ...
Python
0.999998
44733bc3e1b530d3deda89c8ebf9cd6c20a8e6c1
Fix the context manager to return a connection object (fix #41)
pyathena/connection.py
pyathena/connection.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import logging import os import time from boto3.session import Session from pyathena.converter import TypeConverter from pyathena.cursor import Cursor from pyathena.error import NotSupportedError from pyathena.form...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals import logging import os import time from boto3.session import Session from pyathena.converter import TypeConverter from pyathena.cursor import Cursor from pyathena.error import NotSupportedError from pyathena.form...
Python
0.000004
4545fd9f5a6652ff787da6db1f4868aa81f82f75
change font
string_recorder/string_recorder.py
string_recorder/string_recorder.py
import io import shutil import subprocess import tempfile class StringRecorder(object): def __init__(self, font='Courier', max_frames=100000): self.tmp_dir = tempfile.mkdtemp() self.max_frames = max_frames self.__frame_t = 0 self.height = -1 self.width = -1 def __del_...
import io import shutil import subprocess import tempfile class StringRecorder(object): font = 'consolas' def __init__(self, max_frames=100000): self.tmp_dir = tempfile.mkdtemp() self.max_frames = max_frames self.__frame_t = 0 self.height = -1 self.width = -1 def...
Python
0.000002
35825bbf06d7eb98c9e06cbd98e610659627c3d4
ajuste conta dv
pyboleto/bank/safra.py
pyboleto/bank/safra.py
# -*- coding: utf-8 -*- from ..data import BoletoData, CustomProperty class BoletoSafra(BoletoData): """ Boleto Safra """ agencia_cedente = CustomProperty('agencia_cedente', 5) conta_cedente = CustomProperty('conta_cedente', 8) conta_cedente_dv = CustomProperty('conta_cedente_dv',1) noss...
# -*- coding: utf-8 -*- from ..data import BoletoData, CustomProperty class BoletoSafra(BoletoData): """ Boleto Safra """ agencia_cedente = CustomProperty('agencia_cedente', 5) conta_cedente = CustomProperty('conta_cedente', 8) conta_cedente_dv = CustomProperty('conta_cedente_dv',1) noss...
Python
0.000001
eccaff6482b4dcf4555cf05d425223b9c5afad97
use cfdisk if available, per recommendation in fdisk man; make compatible with Ubuntu
salt/modules/qemu_nbd.py
salt/modules/qemu_nbd.py
''' Qemu Command Wrapper ==================== The qemu system comes with powerful tools, such as qemu-img and qemu-nbd which are used here to build up kvm images. ''' # Import python libs import os import glob import tempfile import time # Import third party tools import yaml # Import salt libs import salt.utils im...
''' Qemu Command Wrapper ==================== The qemu system comes with powerful tools, such as qemu-img and qemu-nbd which are used here to build up kvm images. ''' # Import python libs import os import glob import tempfile import time # Import third party tools import yaml # Import salt libs import salt.utils im...
Python
0
34e121f22adac487b7dbd5f79d3e2033a89fabd6
fix mask utils unittest
plugin_tests/polygon_and_mask_utils_test.py
plugin_tests/polygon_and_mask_utils_test.py
# -*- coding: utf-8 -*- """ Created on Sun Aug 11 22:50:03 2019 @author: tageldim """ import unittest import os import girder_client from pandas import read_csv from histomicstk.utils.polygon_and_mask_utils import ( get_image_from_htk_response, get_bboxes_from_slide_annotations, _get_idxs_for_all_ro...
# -*- coding: utf-8 -*- """ Created on Sun Aug 11 22:50:03 2019 @author: tageldim """ import unittest import os import girder_client from pandas import read_csv from histomicstk.utils.polygon_and_mask_utils import ( get_image_from_htk_response, get_bboxes_from_slide_annotations, _get_idxs_for_all_ro...
Python
0
670bc221b7af6398c90dbbde64feb22003c97690
Revert "Violate architecture (on purpose)"
squad/api/views.py
squad/api/views.py
from django.shortcuts import get_object_or_404 from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponseForbidden from django.http import HttpResponse import logging from squad.http import read_file_upload from squad.core....
from django.shortcuts import get_object_or_404 from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponseForbidden from django.http import HttpResponse import logging # an architecture violation from squad.frontend import vie...
Python
0
d8241adb51dcb81b99013aa23744a7a4a45f7d84
fix self importer
mod_pbxproj.py
mod_pbxproj.py
# MIT License # # Copyright (c) 2016 Ignacio Calderon aka kronenthaler # # 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,...
# MIT License # # Copyright (c) 2016 Ignacio Calderon aka kronenthaler # # 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,...
Python
0.000001
b221251b13882789c2ed95e4cd24b2327e068711
Bump @graknlabs_client_java and @graknlabs_benchmark
dependencies/graknlabs/dependencies.bzl
dependencies/graknlabs/dependencies.bzl
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later v...
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later v...
Python
0.000001
7b1d8bd1b2a8b1cb78ec9ab13b61acde977e5642
remove ability to create/delete volumes on v2
api/v2/views/volume.py
api/v2/views/volume.py
import django_filters from rest_framework import viewsets from core.models import Volume from api.v2.serializers.details import VolumeSerializer from core.query import only_current_source class VolumeFilter(django_filters.FilterSet): min_size = django_filters.NumberFilter(name="size", lookup_type='gte') max_s...
import django_filters from rest_framework import viewsets from core.models import Volume from api.v2.serializers.details import VolumeSerializer from core.query import only_current_source class VolumeFilter(django_filters.FilterSet): min_size = django_filters.NumberFilter(name="size", lookup_type='gte') max_s...
Python
0.000001
7f709b974c37020054634c09589ffb9922c36737
Fix typo in variable name.
model/model.py
model/model.py
#! /usr/bin/env python2.7 import lib.database class Model(object): @classmethod def init_model(cls, table, primary_key): cls._table = table cls._primary_key = primary_key cls._db = lib.database.db try: cls._db.cursor.execute("SELECT * FROM %s WHERE FALSE"%cls._table) cls.COLUMNS = set([desc.name for d...
#! /usr/bin/env python2.7 import lib.database class Model(object): @classmethod def init_model(cls, table, primary_key): cls._table = table cls._primary_key = primary_key cls._db = lib.database.db try: cls._db.cursor.execute("SELECT * FROM %s WHERE FALSE"%cls._table) cls.COLUMNS = set([desc.name for d...
Python
0.000014
daee45e358f61d2e9cfef109efd9f474f7e91a4d
Add viz import to top level __init__
pycroscopy/__init__.py
pycroscopy/__init__.py
""" The Pycroscopy package. Submodules ---------- .. autosummary:: :toctree: _autosummary core """ from . import core from .core import * from .io import translators from . import analysis from . import processing from . import viz from .__version__ import version as __version__ from .__version__ import t...
""" The Pycroscopy package. Submodules ---------- .. autosummary:: :toctree: _autosummary core """ from . import core from .core import * from .io import translators from . import analysis from . import processing from .__version__ import version as __version__ from .__version__ import time as __time__ _...
Python
0
efa4aede4b9faa9f0fc8639e4495ca8e98127d15
Bump @graknlabs_verification
dependencies/graknlabs/dependencies.bzl
dependencies/graknlabs/dependencies.bzl
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
Python
0
dd83da792fbe1c90da855fe7d298f446a839f8ca
change for localhost in door.py
paulla.ircbot/src/paulla/ircbot/plugins/door.py
paulla.ircbot/src/paulla/ircbot/plugins/door.py
import irc3 from irc3.plugins.cron import cron import requests from datetime import datetime @irc3.plugin class Door: """ Door state plugin """ def __init__(self, bot): self.bot = bot self.log = self.bot.log @irc3.event(irc3.rfc.MY_PRIVMSG) def question(self, mask, event, tar...
import irc3 from irc3.plugins.cron import cron import requests from datetime import datetime @irc3.plugin class Door: """ Door state plugin """ def __init__(self, bot): self.bot = bot self.log = self.bot.log @irc3.event(irc3.rfc.MY_PRIVMSG) def question(self, mask, event, tar...
Python
0.000001
d564d73622902f10f46ae53d2e72090b9f93cc7b
Fix for AC-694, we weren't saving the instance if using the cached user
awx/main/middleware.py
awx/main/middleware.py
from django.conf import settings from django.contrib.auth.models import User from django.db.models.signals import pre_save, post_save from django.utils.functional import curry from awx.main.models import ActivityStream, AuthToken import json import uuid import urllib2 class ActivityStreamMiddleware(object): def p...
from django.conf import settings from django.contrib.auth.models import User from django.db.models.signals import pre_save, post_save from django.utils.functional import curry from awx.main.models import ActivityStream, AuthToken import json import uuid import urllib2 class ActivityStreamMiddleware(object): def p...
Python
0
f90f7bd226c42e900074f0c7bfcc5210e580b5ed
Fix error reporting to actually set the right response code.
obstaravania/serving.py
obstaravania/serving.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from data_model import Firma, Obstaravanie, Firma, Candidate, Session import db from utils import obstaravanieToJson, getEidForIco from jinja2 import Template import json from paste import httpserver import webapp2 db.connect(False) class MyServer(webapp2.RequestHandler...
#!/usr/bin/env python # -*- coding: utf-8 -*- from data_model import Firma, Obstaravanie, Firma, Candidate, Session import db from utils import obstaravanieToJson, getEidForIco from jinja2 import Template import json from paste import httpserver import webapp2 db.connect(False) def errorJSON(code, text): d = {"c...
Python
0
a228f73ea12fa4fcfa29bc2249c74c9e94954cff
Test function name adjustment.
cnxrepo/tests.py
cnxrepo/tests.py
# -*- coding: utf-8 -*- """Application tests""" import os import transaction from nose import with_setup from pyramid import testing from pyramid.paster import get_appsettings HERE = os.path.abspath(os.path.dirname(__file__)) TEST_RESOURCE_FILENAME = 'test-resource.png' with open(os.path.join(HERE, TEST_RESOURCE_FILE...
# -*- coding: utf-8 -*- """Application tests""" import os import transaction from nose import with_setup from pyramid import testing from pyramid.paster import get_appsettings HERE = os.path.abspath(os.path.dirname(__file__)) TEST_RESOURCE_FILENAME = 'test-resource.png' with open(os.path.join(HERE, TEST_RESOURCE_FILE...
Python
0
1916f45ed5d6a77a585153a4daacc8a6ab48b3a3
fix conftest.py
dit/conftest.py
dit/conftest.py
""" Configuration for tests. """ from hypothesis import settings settings.register_profile("dit", deadline=None) settings.load_profile("dit")
""" Configuration for tests. """ from hypothesis import settings settings.default.deadline = None
Python
0.000102
7d43e6fd794fa1ef942a39937a653d5b18e867de
reorganize automatic dashboard
.github/scripts/create_dashboard.py
.github/scripts/create_dashboard.py
import os from glob import glob statuses = glob("workflow_testing_indicator/notebooks/*/*/*.png") user = "probml" base_url = f"https://github.com/{user}/pyprobml/tree/" get_url = lambda x: f'<img width="20" alt="image" src=https://raw.githubusercontent.com/{user}/pyprobml/{x}>' get_nb_url = lambda x: os.path.join(base...
import os from glob import glob statuses = glob("workflow_testing_indicator/notebooks/*/*/*.png") user = "probml" base_url = f"https://github.com/{user}/pyprobml/tree/" get_url = lambda x: f'<img width="20" alt="image" src=https://raw.githubusercontent.com/{user}/pyprobml/{x}>' get_nb_url = lambda x: os.path.join(base...
Python
0.000073
2bac8c8df7a6f99fdc8a4efbdf2a094d3c6a7bae
fix link type data
product_template_multi_link/__manifest__.py
product_template_multi_link/__manifest__.py
# Copyright 2017-Today GRAP (http://www.grap.coop). # @author Sylvain LE GAL <https://twitter.com/legalsylvain> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Product Multi Links (Template)", "version": "13.0.1.1.0", "category": "Generic Modules", "author": "GRAP, ACSONE SA/...
# Copyright 2017-Today GRAP (http://www.grap.coop). # @author Sylvain LE GAL <https://twitter.com/legalsylvain> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Product Multi Links (Template)", "version": "13.0.1.1.0", "category": "Generic Modules", "author": "GRAP, ACSONE SA/...
Python
0.000012
e19a99a555cd39cd380b7ede12da2190eb164eec
Make CSV errors into warnings
ingestors/tabular/csv.py
ingestors/tabular/csv.py
import io import csv import logging from followthemoney import model from ingestors.ingestor import Ingestor from ingestors.support.encoding import EncodingSupport from ingestors.support.table import TableSupport from ingestors.exc import ProcessingException log = logging.getLogger(__name__) class CSVIngestor(Inges...
import io import csv import logging from followthemoney import model from ingestors.ingestor import Ingestor from ingestors.support.encoding import EncodingSupport from ingestors.support.table import TableSupport from ingestors.exc import ProcessingException log = logging.getLogger(__name__) class CSVIngestor(Inges...
Python
0.998737
3c0e18944c7ff712288ccb16e439e07d4db0b3c1
Fix init migration dependency
cmsplugin_date/migrations/0001_initial.py
cmsplugin_date/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cms', '0003_auto_20140926_2347'), ] operations = [ migrations.CreateModel( name='Date', fields=[ ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Date', fields=[ ('cmsplugin_ptr', models.OneToO...
Python
0.000003
890263898e23de06b6b864898d753362fd604c92
debug output for dupe=false
address_deduper/views/address.py
address_deduper/views/address.py
from address_deduper.views.base import * from address_normalizer.deduping.near_duplicates import * from address_normalizer.models.address import * class AddressView(BaseView): blueprint = Blueprint('addresses', __name__, url_prefix='/addresses') @classmethod def address_from_params(cls, require_str...
from address_deduper.views.base import * from address_normalizer.deduping.near_duplicates import * from address_normalizer.models.address import * class AddressView(BaseView): blueprint = Blueprint('addresses', __name__, url_prefix='/addresses') @classmethod def address_from_params(cls, require_str...
Python
0.009255