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
063acbeb5c95bf8e02aff7cf7f238606d814567a
change billet
totvserprm/financial.py
totvserprm/financial.py
# -*- coding: utf-8 -*- from datetime import datetime from baseapi import BaseApi import uuid class Client(BaseApi): dataservername = 'FinCFODataBR' def create(self,**kwargs): return super(Client, self).create({ 'NewDataSet': { 'FCFO': { 'ATIVO': kwargs....
# -*- coding: utf-8 -*- from datetime import datetime from baseapi import BaseApi class Client(BaseApi): dataservername = 'FinCFODataBR' def create(self,**kwargs): return super(Client, self).create({ 'NewDataSet': { 'FCFO': { 'ATIVO': kwargs.get('ativo')...
Python
0.000001
e4e10ee0ae5a18cfec0e15b7b85986b7f4fc4f9d
Fix prefetched fields in Institutions in API
feder/institutions/viewsets.py
feder/institutions/viewsets.py
import django_filters from rest_framework import filters, viewsets from teryt_tree.rest_framework_ext.viewsets import custom_area_filter from .models import Institution, Tag from .serializers import InstitutionSerializer, TagSerializer class InstitutionFilter(filters.FilterSet): jst = django_filters.CharFilter(m...
import django_filters from rest_framework import filters, viewsets from teryt_tree.rest_framework_ext.viewsets import custom_area_filter from .models import Institution, Tag from .serializers import InstitutionSerializer, TagSerializer class InstitutionFilter(filters.FilterSet): jst = django_filters.CharFilter(m...
Python
0.000007
9bdaf963843a9f0b44487ea3b258b50b328153d8
Remove redis connection logic from each view, make it global, keep it threadsafe
firetower/web/firetower_web.py
firetower/web/firetower_web.py
from calendar import timegm import datetime import time from flask import Flask, render_template from firetower import redis_util REDIS_HOST = "localhost" REDIS_PORT = 6379 REDIS = redis_util.Redis(REDIS_HOST, REDIS_PORT) app = Flask(__name__) def timestamp(dttm): return timegm(dttm.utctimetuple()) @app...
from calendar import timegm import datetime import time from flask import Flask, render_template from firetower import redis_util REDIS_HOST = "localhost" REDIS_PORT = 6379 app = Flask(__name__) def timestamp(dttm): return timegm(dttm.utctimetuple()) @app.route("/") def root(): lines = [] redis ...
Python
0
1c48f9ad2c2a66d7c15c9216665b7f802d3498b4
Set deprecation_summary_result so we can summarize deprecations and they get written to the report plist if specified.
SharedProcessors/DeprecationWarning.py
SharedProcessors/DeprecationWarning.py
#!/usr/bin/python # # Copyright 2019 Greg Neagle # # 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...
#!/usr/bin/python # # Copyright 2019 Greg Neagle # # 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
1e139567767a98914df90ec152d543bb8bfde38c
add test
basic_zappa_project/public/views_tests.py
basic_zappa_project/public/views_tests.py
from basic_zappa_project.test_utils import BaseTestCase class TestViews(BaseTestCase): def test_status(self): expected = {'status': 'ok'} response = self.client.get('/status') self.assert200(response) self.assertEqual(response.json, expected) def test_about(self): res...
from basic_zappa_project.test_utils import BaseTestCase class TestViews(BaseTestCase): def test_status(self): expected = {'status': 'ok'} response = self.client.get('/status') self.assert200(response) self.assertEqual(response.json, expected) def test_about(self): res...
Python
0.000002
a82fc92938a647de620cf8a96fd5907c08060c32
fix mistake
scripts/install/install.py
scripts/install/install.py
import os import subprocess import os.path def apt_get_install(fname): with open(fname, 'r') as f: items = f.readlines() for item in items: os.system('sudo apt-get install -y %s' % (item)) def npm_global_install(fname): with open(fname, 'r') as f: items = f.readlines() for item...
import os import subprocess import os.path def apt_get_install(what): with open(fname, 'r') as f: items = f.readlines() for item in items: os.system('sudo apt-get install -y %s' % (item)) def npm_global_install(what): with open(fname, 'r') as f: items = f.readlines() for item i...
Python
0.999908
5179172b4a6d61ea60fec9cd7624725031017482
Make use of the sqlite3 package
dump.py
dump.py
#!/usr/bin/env python import glob, os, sqlite3, sys sys.path.append(os.path.abspath("csv2sqlite")) import csv2sqlite setup_sql = { "job_events": """ DROP TABLE IF EXISTS `job_events`; CREATE TABLE `job_events` ( `time` INTEGER NOT NULL, `missing info` INTEGER, ...
#!/usr/bin/env python import glob, os, subprocess, sys sys.path.append(os.path.abspath("csv2sqlite")) import csv2sqlite setup_sql = { "job_events": """ DROP TABLE IF EXISTS `job_events`; CREATE TABLE `job_events` ( `time` INTEGER NOT NULL, `missing info` INTEGER, ...
Python
0.000001
7f22812917846dbc420eee8c80cf3a4ee7d2fc1c
fix typo in tag (#618)
scripts/publish_release.py
scripts/publish_release.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Insert a TOML header into the latest release note.""" from __future__ import absolute_import, print_function import sys from datetime import date from glob import glob from builtins import open from os.path import join, basename from shutil import copy def insert_br...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Insert a TOML header into the latest release note.""" from __future__ import absolute_import, print_function import sys from datetime import date from glob import glob from builtins import open from os.path import join, basename from shutil import copy def insert_br...
Python
0.000048
19c0e8d856049677bc7de2bc293a87a0aac306f8
Fix wsgi config file access for HTTPD
httpd/keystone.py
httpd/keystone.py
import os from paste import deploy from keystone import config from keystone.common import logging LOG = logging.getLogger(__name__) CONF = config.CONF config_files = ['/etc/keystone/keystone.conf'] CONF(project='keystone', default_config_files=config_files) conf = CONF.config_file[0] name = os.path.basename(__fil...
import os from paste import deploy from keystone import config from keystone.common import logging LOG = logging.getLogger(__name__) CONF = config.CONF config_files = ['/etc/keystone.conf'] CONF(config_files=config_files) conf = CONF.config_file[0] name = os.path.basename(__file__) if CONF.debug: CONF.log_opt_...
Python
0.000001
b7e3901411059bbfa8ab83ec1f6fbf135aa50172
Update UserTime.py
Cogs/UserTime.py
Cogs/UserTime.py
import datetime import pytz from Cogs import FuzzySearch def setup(bot): # This module isn't actually a cog return def getClockForTime(time_string): # Assumes a HH:MM PP format try: time = time_string.split() time = time[0].split(":") hour = int(time[0]) minute = int(time[1]) except: ...
import datetime import pytz from Cogs import FuzzySearch def setup(bot): # This module isn't actually a cog return def getUserTime(member, settings, time = None, strft = "%Y-%m-%d %I:%M %p"): # Returns a dict representing the time from the passed member's perspective offset = settings.getGlobalUser...
Python
0.000001
8eea594e684053a7fbfe1f2f946343cf809be058
Rename server tests
treecat/serving_test.py
treecat/serving_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools import numpy as np import pytest from treecat.serving import TreeCatServer from treecat.testutil import TINY_CONFIG from treecat.testutil import TINY_DATA from treecat.testutil import TINY_MA...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools import numpy as np import pytest from treecat.serving import TreeCatServer from treecat.testutil import TINY_CONFIG from treecat.testutil import TINY_DATA from treecat.testutil import TINY_MA...
Python
0.000001
1ba8cadf93e80107902e142c4644d03668592c5f
add global and directive specific compat options
cautodoc.py
cautodoc.py
# coding=utf-8 """Hawkmoth - Sphinx C Domain autodoc directive extension""" __author__ = "Jani Nikula <jani@nikula.org>" __copyright__ = "Copyright (c) 2016-2017, Jani Nikula <jani@nikula.org>" __version__ = '0.1' __license__ = "BSD 2-Clause, see LICENSE for details" import glob import os import re import stat impor...
# coding=utf-8 """Hawkmoth - Sphinx C Domain autodoc directive extension""" __author__ = "Jani Nikula <jani@nikula.org>" __copyright__ = "Copyright (c) 2016-2017, Jani Nikula <jani@nikula.org>" __version__ = '0.1' __license__ = "BSD 2-Clause, see LICENSE for details" import glob import os import re import stat impor...
Python
0
fa21acc470d9c32619b3c67dcce54c7b0a69a07a
Fix inadvertent requirement of hg, svn, git, etc.
lib/spack/spack/test/__init__.py
lib/spack/spack/test/__init__.py
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
############################################################################## # Copyright (c) 2013, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 ...
Python
0.000001
671ca30892e3ebeb0a9140f95690853b4b92dc02
Fix reverse since we deprecated post_object_list
post/views.py
post/views.py
from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from post.models import Post from jmbo.generic.views import GenericObjectDetail, GenericObjectList from jmbo.view_modifiers import DefaultViewModifier class ObjectList(GenericObjectList): def get_extra_context(self, *...
from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from post.models import Post from jmbo.generic.views import GenericObjectDetail, GenericObjectList from jmbo.view_modifiers import DefaultViewModifier class ObjectList(GenericObjectList): def get_extra_context(self, *...
Python
0.000014
a03c61430abac8cac5e522a3bf391175cd261cec
fix tests
gammafit/tests/test_onezone.py
gammafit/tests/test_onezone.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u import numpy as np from numpy.testing import assert_approx_equal electronozmpars={ 'seedspec':'CMB', 'index':2.0, 'cutoff':1e13, 'beta':1.0, 'ngamd':100, 'gmin':1e4, 'g...
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import units as u import numpy as np from numpy.testing import assert_approx_equal electronozmpars={ 'seedspec':'CMB', 'index':2.0, 'cutoff':1e13, 'beta':1.0, 'ngamd':100, 'gmin':1e4, 'g...
Python
0.000001
3eeeb844b3936063f4f0192d46577e3f9397c107
Fix ordering in cursor test
search/tests/test_query.py
search/tests/test_query.py
import datetime import unittest from google.appengine.api import search as search_api from ..indexes import DocumentModel, Index from ..fields import TZDateTimeField, TextField from ..query import SearchQuery from ..ql import Q from .. import timezone from .base import AppengineTestCase class FakeDocument(Document...
import datetime import unittest from google.appengine.api import search as search_api from ..indexes import DocumentModel, Index from ..fields import TZDateTimeField, TextField from ..query import SearchQuery from ..ql import Q from .. import timezone from .base import AppengineTestCase class FakeDocument(Document...
Python
0.000002
74e4e5e507d908950d4458dff5ba4aa5c712866f
Allow localization of "Self Informations"
searx/plugins/self_info.py
searx/plugins/self_info.py
''' searx is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. searx is distributed in the hope that it will be useful, but WITHOUT ANY WA...
''' searx is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. searx is distributed in the hope that it will be useful, but WITHOUT ANY WA...
Python
0
34b2c332b8d1209985b37f4e440954a15d4004d3
create directly tar.gz into final directory
datadownloader/views.py
datadownloader/views.py
import os import tarfile import subprocess from datetime import datetime from sendfile import sendfile from django.views.generic import View, TemplateView from django.conf import settings from django.shortcuts import redirect def get_base_path(): if hasattr(settings, 'DATA_DOWNLOADER_PATH'): base_path = s...
import os import tarfile import subprocess from datetime import datetime from sendfile import sendfile from django.views.generic import View, TemplateView from django.conf import settings from django.shortcuts import redirect def get_base_path(): if hasattr(settings, 'DATA_DOWNLOADER_PATH'): base_path = s...
Python
0
7477f969cd8efd624e7f378f7838270c53c2755e
Allow make_reverb_dataset's caller to set max_in_flight_samples_per_worker. Default behavior is unchanged.
acme/datasets/reverb.py
acme/datasets/reverb.py
# python3 # Copyright 2018 DeepMind Technologies Limited. 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 re...
# python3 # Copyright 2018 DeepMind Technologies Limited. 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 re...
Python
0.000012
d04ded85e01c4a9e0960d57a37ecd83fc92fa5cd
Add a fallback to mini_installer_tests' quit_chrome.py exit logic.
chrome/test/mini_installer/quit_chrome.py
chrome/test/mini_installer/quit_chrome.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Quits Chrome. This script sends a WM_CLOSE message to each window of Chrome and waits until the process terminates. """ import optparse import os import...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Quits Chrome. This script sends a WM_CLOSE message to each window of Chrome and waits until the process terminates. """ import optparse import pywintype...
Python
0.003252
eba39b722d6d025ec351beeb35e7dadd55ef82f5
correctly treat hashes as little endian
blockchain.py
blockchain.py
#!/usr/bin/env python3 import binascii import datetime class BlockChain: def __init__(self, data, handler=None): self.data = data self.handler = handler self.index = 0 self.block_count = 0 while self.index < len(self.data): self.parse_block() self....
#!/usr/bin/env python3 import binascii import datetime class BlockChain: def __init__(self, data, handler=None): self.data = data self.handler = handler self.index = 0 self.block_count = 0 while self.index < len(self.data): self.parse_block() self....
Python
0.998601
202d0a199a59a0e8ca5651785aa4497b1e0047e7
Add default implementation of Language.validate_code
importkit/meta.py
importkit/meta.py
## # Copyright (c) 2008-2012 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import functools import os from semantix import exceptions as sx_errors from .loader import LanguageSourceFileLoader from .import_ import finder class LanguageMeta(type): languages = [] def __new__(cls, name, ...
## # Copyright (c) 2008-2012 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import functools import os from semantix import exceptions as sx_errors from .loader import LanguageSourceFileLoader from .import_ import finder class LanguageMeta(type): languages = [] def __new__(cls, name, ...
Python
0
2d55d95c623bef4848131878061887854ff8a971
Update utils.py
deeplab_resnet/utils.py
deeplab_resnet/utils.py
from PIL import Image import numpy as np import tensorflow as tf n_classes = 21 # colour map label_colours = [(0,0,0) # 0=background ,(128,0,0),(0,128,0),(128,128,0),(0,0,128),(128,0,128) # 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle ,(0,128,128),(12...
from PIL import Image import numpy as np # colour map label_colours = [(0,0,0) # 0=background ,(128,0,0),(0,128,0),(128,128,0),(0,0,128),(128,0,128) # 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle ,(0,128,128),(128,128,128),(64,0,0),(192,0,0),(64,128,0...
Python
0.000001
a62b5955d9801f25736c42545191ff5a76a2e5b1
Refactor UserFactory and add CommentFactory
blog/tests.py
blog/tests.py
from django.test import TestCase from .models import BlogPost, Comment from django.contrib.auth.models import User class UserFactory(object): def create(self, username="user001", email="email@domain.com", password="password123456"): user = User.objects.create_user(username = username, email = email, passwo...
from django.test import TestCase from .models import BlogPost from django.contrib.auth.models import User class UserFactory(object): def create(self): user = User.objects.create_user(username = "user001", email = "email@domain.com", password = "password123456") return user class BlogPostFactory(ob...
Python
0
420d104d9e674b96363db5c986ea9eea4d411c92
Add updated template settings to conftests
conftest.py
conftest.py
""" Configuration file for py.test """ import django def pytest_configure(): from django.conf import settings settings.configure( DEBUG=True, USE_TZ=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "test.sqlite3...
""" Configuration file for py.test """ import django def pytest_configure(): from django.conf import settings settings.configure( DEBUG=True, USE_TZ=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "test.sqlite3...
Python
0
8d6287397b47fcaf98cadc59349f1db68c7b2d93
Update 1.4_replace_whitespace.py
CrackingCodingInterview/1.4_replace_whitespace.py
CrackingCodingInterview/1.4_replace_whitespace.py
""" Replace all whitespace in a string with '%20' """ def replace(string): for i in string: string.replace("", %20) return string
""" Replace all whitespace in a string with '%20' """
Python
0.000001
8a1b902b729597f5c8536b235d7add887f097fdd
Drop box should be off by default. SSL should be on by default, HTTP should be off.
twistedcaldav/config.py
twistedcaldav/config.py
## # Copyright (c) 2005-2006 Apple Computer, Inc. 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 ap...
## # Copyright (c) 2005-2006 Apple Computer, Inc. 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 ap...
Python
0.000025
3e8d6e31f576fb857a1415c85a227f56225b8f06
fix database path
blogconfig.py
blogconfig.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # 博客名和简介 blogname = "I'm SErHo" blogdesc = "SErHo's Blog, Please Call me Serho Liu." blogcover = "//dn-serho.qbox.me/blogbg.jpg" # Picky 目录和数据库 picky = "/home/serho/website/picky" database = "/home/serho/website/newblog.db" # 其他设置 # disqus = "serho" # secret = "use ra...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 博客名和简介 blogname = "I'm SErHo" blogdesc = "SErHo's Blog, Please Call me Serho Liu." blogcover = "//dn-serho.qbox.me/blogbg.jpg" # Picky 目录和数据库 picky = "/home/serho/website/picky" database = "//home/serho/website/newblog.db" # 其他设置 # disqus = "serho" # secret = "use r...
Python
0.000002
1630bb891bf57052984301b9dd191826ca7ba18e
Update test_biobambam.py
tests/test_biobambam.py
tests/test_biobambam.py
""" .. Copyright 2017 EMBL-European Bioinformatics Institute 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 applic...
""" .. Copyright 2017 EMBL-European Bioinformatics Institute 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 applic...
Python
0.000002
1e3e6ea6c24e275a5a08f096968ae14aab2dfd22
Support custom schema classes.
muffin_rest/peewee.py
muffin_rest/peewee.py
"""Support Muffin-Peewee.""" from muffin_rest import RESTHandler, RESTNotFound, Filter, Filters, RESTOptions try: from marshmallow_peewee import ModelSchema except ImportError: import logging logging.error('Marshmallow-Peewee should be installed to use the integration.') raise class PWFilter(Filter):...
"""Support Muffin-Peewee.""" from muffin_rest import RESTHandler, RESTNotFound, Filter, Filters, RESTOptions try: from marshmallow_peewee import ModelSchema except ImportError: import logging logging.error('Marshmallow-Peewee should be installed to use the integration.') raise class PWFilter(Filter):...
Python
0
8fa0dca5cd5187126a10197883348fc6b16544b5
Test get campaigns by email
tests/test_campaigns.py
tests/test_campaigns.py
import os import vcr import unittest from hatchbuck.api import HatchbuckAPI from hatchbuck.objects import Contact class TestCampaigns(unittest.TestCase): def setUp(self): # Fake key can be used with existing cassettes self.test_api_key = os.environ.get("HATCHBUCK_API_KEY", "ABC123") @vcr.use...
import os import vcr import unittest from hatchbuck.api import HatchbuckAPI from hatchbuck.objects import Contact class TestCampaigns(unittest.TestCase): def setUp(self): # Fake key can be used with existing cassettes self.test_api_key = os.environ.get("HATCHBUCK_API_KEY", "ABC123") @vcr.use...
Python
0
eb58615d0fa7f4469be01f9e8dcb1cf44b8ce85e
correct context problem
close_residual_order_unlink/unlink_mrp.py
close_residual_order_unlink/unlink_mrp.py
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
Python
0.999969
d8a83ea3433948447c307a894b16c2b8a12247e8
Kill defaulting to json for now.
api/base.py
api/base.py
from django.contrib.auth.models import User from django.conf.urls.defaults import url from django.core.urlresolvers import reverse from tastypie.bundle import Bundle from tastypie.resources import ModelResource from tastypie import fields from tastypie.authentication import BasicAuthentication from tastypie.authorizati...
from django.contrib.auth.models import User from django.conf.urls.defaults import url from django.core.urlresolvers import reverse from tastypie.bundle import Bundle from tastypie.resources import ModelResource from tastypie import fields from tastypie.authentication import BasicAuthentication from tastypie.authorizati...
Python
0
69f46596f189786fce0e2a087e6870e5d3059331
Fix figshare harvester date range (#764)
share/harvesters/com_figshare_v2.py
share/harvesters/com_figshare_v2.py
import pendulum from furl import furl from share.harvest import BaseHarvester class FigshareHarvester(BaseHarvester): VERSION = 1 page_size = 50 def _do_fetch(self, start_date, end_date): url = furl(self.config.base_url).set(query_params={ 'order_direction': 'asc', 'ord...
import pendulum from furl import furl from share.harvest import BaseHarvester class FigshareHarvester(BaseHarvester): VERSION = 1 page_size = 50 def do_harvest(self, start_date, end_date): return self.fetch_records(furl(self.config.base_url).set(query_params={ 'order_direction': 'a...
Python
0.000003
83f54f57170115cda98e7d1aa68972c60b865647
Fix test_upgrades_to_html.py test
cnxupgrade/tests/test_upgrades_to_html.py
cnxupgrade/tests/test_upgrades_to_html.py
# -*- coding: utf-8 -*- # ### # Copyright (c) 2013, Rice University # This software is subject to the provisions of the GNU Affero General # Public License version 3 (AGPLv3). # See LICENCE.txt for details. # ### """Tests for to_html command-line interface. """ import sys import unittest from . import DB_CONNECTION_...
# -*- coding: utf-8 -*- # ### # Copyright (c) 2013, Rice University # This software is subject to the provisions of the GNU Affero General # Public License version 3 (AGPLv3). # See LICENCE.txt for details. # ### """Tests for to_html command-line interface. """ import sys import unittest from . import DB_CONNECTION_...
Python
0.000021
e20f0d3ada72cb21185ca0c3c1d22a77ee254de0
fix rogue tab
tests/test_get_paths.py
tests/test_get_paths.py
import sys import os from goatools.obo_parser import GODag ROOT = os.path.dirname(os.path.abspath(__file__)) + "/data/" def print_paths(paths, PRT=sys.stdout): for path in paths: PRT.write('\n') for GO in path: PRT.write('{}\n'.format(GO)) def chk_results(actual_paths, expected_path...
import sys import os from goatools.obo_parser import GODag ROOT = os.path.dirname(os.path.abspath(__file__)) + "/data/" def print_paths(paths, PRT=sys.stdout): for path in paths: PRT.write('\n') for GO in path: PRT.write('{}\n'.format(GO)) def chk_results(actual_paths, expected_...
Python
0.000001
e42690a6f225952ddb6417edc90e27892c18d2a2
Move api to root.
api/main.py
api/main.py
from bottle import route, request, response, run, view from collections import OrderedDict from parser import parse_response from server import query_server import bottle import json import os @route('/') @view('api/views/index') def index(): site = "%s://%s" % (request.urlparts.scheme, request.urlparts.netloc) ...
from bottle import route, request, response, run, view from collections import OrderedDict from parser import parse_response from server import query_server import bottle import json import os @route('/api/') @view('api/views/index') def index(): site = "%s://%s" % (request.urlparts.scheme, request.urlparts.netloc...
Python
0
ee3b712611ed531843134ef4ce94cb45c726c127
Fix filename creation in csv export action
nap/extras/actions.py
nap/extras/actions.py
from django.http import StreamingHttpResponse from django.utils.encoding import force_text from .models import modelserialiser_factory from .simplecsv import CSV class ExportCsv(object): def __init__(self, serialiser=None, label=None, **opts): self.serialiser = serialiser self.opts = opts ...
from django.http import StreamingHttpResponse from django.utils.encoding import force_text from .models import modelserialiser_factory from .simplecsv import CSV class ExportCsv(object): def __init__(self, serialiser=None, label=None, **opts): self.serialiser = serialiser self.opts = opts ...
Python
0.000024
85a6030ddebaaef2644640b1d3e8e9447a730a78
send utcnow instead of just now
uiharu/bin/collector.py
uiharu/bin/collector.py
from __future__ import print_function import argparse import datetime import logging.config import socket import sys import sqlalchemy as sa from uiharu.collector import TemperatureCollector from uiharu.config import ConfigAction from uiharu.periodic_sleeper import PeriodicSleeper from uiharu.models import Temperatu...
from __future__ import print_function import argparse import datetime import logging.config import socket import sys import sqlalchemy as sa from uiharu.collector import TemperatureCollector from uiharu.config import ConfigAction from uiharu.periodic_sleeper import PeriodicSleeper from uiharu.models import Temperatu...
Python
0
1e03772e601fb6ed0eb6aa59555af61c29b2650f
remove fungible in parent class constructor call
amaascore/assets/cfd.py
amaascore/assets/cfd.py
from __future__ import absolute_import, division, print_function, unicode_literals from datetime import datetime, date from dateutil import parser from amaascore.assets.derivative import Derivative class ContractForDifference(Derivative): def __init__(self, asset_manager_id, asset_id, asset_issuer_id=None, ass...
from __future__ import absolute_import, division, print_function, unicode_literals from datetime import datetime, date from dateutil import parser from amaascore.assets.derivative import Derivative class ContractForDifference(Derivative): def __init__(self, asset_manager_id, asset_id, asset_issuer_id=None, ass...
Python
0.000001
274c9e3273ec6966a6b0a0e5c51e8b230fe468e6
Refactor to use api.views.
api/user.py
api/user.py
""" Atmosphere service user rest api. """ from rest_framework import status from rest_framework.response import Response from threepio import logger from service.accounts.eucalyptus import AccountDriver from core.models import AtmosphereUser as User from core.models.provider import Provider from api.serializers im...
""" Atmosphere service user rest api. """ #from django.contrib.auth.models import User as AuthUser from core.models import AtmosphereUser as AuthUser from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status from threepio import logger from service.acc...
Python
0
63eaf0faf56a70fadbd37f0acac6f5e61c7b19eb
Change sleep function to the end to do repeat everytime
checkdns.py
checkdns.py
# coding=utf8 # 31.220.16.242 # 216.58.222.46 import socket import time import webbrowser def checkdns(): print time.ctime() retorno = True try: ip = socket.gethostbyname('google.com') print ("O IP do host verificado é: " + ip) if ip == "216.58.22.46": ...
# coding=utf8 # 31.220.16.242 # 216.58.222.46 import socket import time import webbrowser def checkdns(): print time.ctime() retorno = True try: ip = socket.gethostbyname('google.com') print ("O IP do host verificado é: " + ip) if ip == "216.58.222.46": ...
Python
0
4c819629552a31748e4bb266c1c13726276d7944
Use cross version compatible iteration
tests/test_renderers.py
tests/test_renderers.py
import unittest from asciimatics.renderers import StaticRenderer from asciimatics.screen import Screen class TestRenderers(unittest.TestCase): def test_static_renderer(self): """ Check that the base static renderer class works. """ # Check basic API for a renderer... render...
import unittest from asciimatics.renderers import StaticRenderer from asciimatics.screen import Screen class TestRenderers(unittest.TestCase): def test_static_renderer(self): """ Check that the base static renderer class works. """ # Check basic API for a renderer... render...
Python
0
90b991c19ef5249a09410b19c33f2c8bfe9b5ca7
Install pypy for proper architechture.
braid/pypy.py
braid/pypy.py
import re from os import path from fabric.api import cd, task, sudo, abort from braid import info from braid.utils import fails pypyURLs = { 'x86_64': 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux64.tar.bz2', 'x86': 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux.tar.bz2', } pypy...
from os import path from fabric.api import cd, task, sudo from braid import fails pypyURL = 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux64.tar.bz2' setuptoolsURL = 'http://peak.telecommunity.com/dist/ez_setup.py' pipURL = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py' pypyDir = '/opt/pypy-2...
Python
0
25030673476f9eb99a4eff980d7bb050fdaa2568
Print size of result lists in check_files
analysis/check_files.py
analysis/check_files.py
#!/usr/bin/env python # vim: set sw=2 ts=2 softtabstop=2 expandtab: import argparse import os import logging import sys import yaml try: # Try to use libyaml which is faster from yaml import CLoader as Loader, CDumper as Dumper except ImportError: # fall back on python implementation from yaml import Loader, D...
#!/usr/bin/env python # vim: set sw=2 ts=2 softtabstop=2 expandtab: import argparse import os import logging import sys import yaml try: # Try to use libyaml which is faster from yaml import CLoader as Loader, CDumper as Dumper except ImportError: # fall back on python implementation from yaml import Loader, D...
Python
0
fefdea2a81bec7bdb8678671c0eb2dea8f7dea83
Disable TOTP token sync
hoover/site/settings/common.py
hoover/site/settings/common.py
from pathlib import Path base_dir = Path(__file__).absolute().parent.parent.parent.parent INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'hoover.search', ) ...
from pathlib import Path base_dir = Path(__file__).absolute().parent.parent.parent.parent INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'hoover.search', ) ...
Python
0
d115c0ceb08a350f7b367f61627ced5ab03df833
Remove useless space
sklearn_porter/language/__init__.py
sklearn_porter/language/__init__.py
# -*- coding: utf-8 -*- import sklearn_porter.language.c import sklearn_porter.language.go import sklearn_porter.language.java import sklearn_porter.language.js import sklearn_porter.language.php import sklearn_porter.language.ruby LANGUAGES = { c.KEY: c, go.KEY: go, java.KEY: java, js.KEY: js, ph...
# -*- coding: utf-8 -*- import sklearn_porter.language.c import sklearn_porter.language.go import sklearn_porter.language.java import sklearn_porter.language.js import sklearn_porter.language.php import sklearn_porter.language.ruby LANGUAGES = { c.KEY: c, go.KEY: go, java.KEY: java, js.KEY: js, ...
Python
0.000001
3fdad9fb89d70b8d81483b646e16d20f076e0ebd
Test urxvt alpha
tests/test_sequences.py
tests/test_sequences.py
"""Test sequence functions.""" import unittest import unittest.mock import io from pywal import sequences from pywal import util # Import colors. COLORS = util.read_file_json("tests/test_files/test_file.json") class Testsequences(unittest.TestCase): """Test the sequence functions.""" def test_set_special(...
"""Test sequence functions.""" import unittest import unittest.mock import io from pywal import sequences from pywal import util # Import colors. COLORS = util.read_file_json("tests/test_files/test_file.json") class Testsequences(unittest.TestCase): """Test the sequence functions.""" def test_set_special(...
Python
0.000019
b86348349906c88b6946f757485cf41f909a9a91
fix subtitle test for newer versions of ffmpeg
tests/test_subtitles.py
tests/test_subtitles.py
import sys from .common import * from av.subtitles.subtitle import * class TestSubtitle(TestCase): def test_movtext(self): path = fate_suite('sub/MovText_capability_tester.mp4') fh = av.open(path) subs = [] for packet in fh.demux(): try: subs.extend...
import sys from .common import * from av.subtitles.subtitle import * class TestSubtitle(TestCase): def test_movtext(self): path = fate_suite('sub/MovText_capability_tester.mp4') fh = av.open(path) subs = [] for packet in fh.demux(): try: subs.extend...
Python
0
4a7484bccc9a92353681fb155f15629fa1059cd1
Format users
slackbot/get_scoreboard.py
slackbot/get_scoreboard.py
import logging from typing import Dict, List, Tuple from werkzeug.datastructures import ImmutableMultiDict from database.main import connect, channel_resp from database.team import check_all_scores logger = logging.getLogger(__name__) def get_scoreboard(form: ImmutableMultiDict) -> Dict[str, str]: logger.debug...
import logging from typing import Dict, List, Tuple from werkzeug.datastructures import ImmutableMultiDict from database.main import connect, channel_resp from database.team import check_all_scores logger = logging.getLogger(__name__) def get_scoreboard(form: ImmutableMultiDict) -> Dict[str, str]: logger.debug...
Python
0.000001
29bfc1049352f59fca0b625d0ecbc7177fb565c7
Change default value for certificate location.
py509/x509.py
py509/x509.py
import socket import uuid from OpenSSL import crypto def make_serial(): """Make a random serial number.""" return uuid.uuid4().int def make_pkey(key_type=crypto.TYPE_RSA, key_bits=4096): """Make a public/private key pair.""" key = crypto.PKey() key.generate_key(key_type, key_bits) return key def make...
import socket import uuid from OpenSSL import crypto def make_serial(): """Make a random serial number.""" return uuid.uuid4().int def make_pkey(key_type=crypto.TYPE_RSA, key_bits=4096): """Make a public/private key pair.""" key = crypto.PKey() key.generate_key(key_type, key_bits) return key def make...
Python
0.000024
e05a4f17fcf0ec1bedcc8188d584d31616c4e0af
Update test_toml_file.py
tests/test_toml_file.py
tests/test_toml_file.py
import os from tomlkit.toml_document import TOMLDocument from tomlkit.toml_file import TOMLFile def test_toml_file(example): original_content = example("example") toml_file = os.path.join(os.path.dirname(__file__), "examples", "example.toml") toml = TOMLFile(toml_file) content = toml.read() ass...
import os from tomlkit.toml_document import TOMLDocument from tomlkit.toml_file import TOMLFile def test_toml_file(example): original_content = example("example") toml_file = os.path.join(os.path.dirname(__file__), "examples", "example.toml") toml = TOMLFile(toml_file) content = toml.read() ass...
Python
0.000002
210bf81fa0c7296c6e48e112dacc29ad2b89af0c
add raw_id_fields for users and topics
pybb/admin.py
pybb/admin.py
# -*- coding: utf-8 from django.utils.translation import ugettext_lazy as _ from django.contrib import admin from pybb.models import Category, Forum, Topic, Post, Profile, Read class CategoryAdmin(admin.ModelAdmin): list_display = ['name', 'position', 'forum_count'] list_per_page = 20 ordering = ['position...
# -*- coding: utf-8 from django.utils.translation import ugettext_lazy as _ from django.contrib import admin from pybb.models import Category, Forum, Topic, Post, Profile, Read class CategoryAdmin(admin.ModelAdmin): list_display = ['name', 'position', 'forum_count'] list_per_page = 20 ordering = ['position...
Python
0
b108cb874288ab6d2ee17b2fd807a95509b3e2c5
properly reverse emails as usernames in urls
api/urls.py
api/urls.py
from django.conf.urls import url, include from .views import LocationApi, IssueView, IssueCommentView, UserSearch, IssueStatusView, CommentDetailView, \ MentionView, UserInformationApi, UserDetailView app_name = 'issue_tracker_api' urlpatterns = [ url(r'^$', LocationApi.as_view()), url( r'^issue/(...
from django.conf.urls import url, include from .views import LocationApi, IssueView, IssueCommentView, UserSearch, IssueStatusView, CommentDetailView, \ MentionView, UserInformationApi, UserDetailView app_name = 'issue_tracker_api' urlpatterns = [ url(r'^$', LocationApi.as_view()), url( r'^issue/(...
Python
0.999932
d1b8ab844d153a240c3f71965c0258b91613ea0f
Move test for adding devices to cache of nonexistent pool
tests/whitebox/integration/pool/test_init_cache.py
tests/whitebox/integration/pool/test_init_cache.py
# Copyright 2020 Red Hat, 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 2020 Red Hat, 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
12cc5e752f9aa4700b57e3647c3676aba70bb996
use valid exception for Python 2.7
tests/whitelist_test.py
tests/whitelist_test.py
# -*- coding: utf-8 -*- import pytest from riprova import ErrorWhitelist, NotRetriableError def test_error_whitelist(): whitelist = ErrorWhitelist() assert type(ErrorWhitelist.WHITELIST) is set assert len(whitelist._whitelist) > 4 assert type(whitelist._whitelist) is set assert whitelist._whiteli...
# -*- coding: utf-8 -*- import pytest from riprova import ErrorWhitelist, NotRetriableError def test_error_whitelist(): whitelist = ErrorWhitelist() assert type(ErrorWhitelist.WHITELIST) is set assert len(whitelist._whitelist) > 4 assert type(whitelist._whitelist) is set assert whitelist._whiteli...
Python
0.000122
f000504c624e3b07a0df4c823a2f422dc1294ed9
fix test case
testss/test_training.py
testss/test_training.py
import os from unittest import TestCase from mlimages.model import ImageProperty from mlimages.training import TrainingData import testss.env as env class TestLabel(TestCase): def test_make_mean(self): td = self.get_testdata() mean_image_file = os.path.join(os.path.dirname(td.label_file.path), "m...
import os from unittest import TestCase from mlimages.model import LabelFile, ImageProperty import testss.env as env class TestLabel(TestCase): def test_make_mean(self): lf = self.get_label_file() mean_image_file = os.path.join(os.path.dirname(lf.path), "mean_image.png") imp = ImageProper...
Python
0.000022
69ba0847bde12b4da61502076f633eee856ec728
Improve get_user and get_netmask method
netadmin/shortcuts.py
netadmin/shortcuts.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Adriano Monteiro Marques # # Author: Amit Pal <amix.pal@gmail.com> # # 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, ei...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Adriano Monteiro Marques # # Author: Piotrek Wasilewski <wasilewski.piotrek@gmail.com> # # 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 Sof...
Python
0.000001
eadec2e53404407a7f40df483d1f3d75b599a667
Fix PID location
cax/main.py
cax/main.py
from cax.tasks import checksum, clear, copy import os import sys import logging import time from cax.config import password import daemonocle def main2(): password() # Check password specified logging.basicConfig(filename='example.log', level=logging.DEBUG, fo...
from cax.tasks import checksum, clear, copy import os import sys import logging import time from cax.config import password import daemonocle def main2(): password() # Check password specified logging.basicConfig(filename='example.log', level=logging.DEBUG, fo...
Python
0.000004
61cb2f72d94e8bd771e3130d68f753513e5818d5
Add lstrip, rstrip, strip methods
ansi_str.py
ansi_str.py
import re _ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') def strip_ansi(value): return _ansi_re.sub('', value) def len_exclude_ansi(value): return len(strip_ansi(value)) class ansi_str(str): """A str subclass, specialized for strings containing ANSI escapes. When you call the ``len`` metho...
import re _ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') def strip_ansi(value): return _ansi_re.sub('', value) def len_exclude_ansi(value): return len(strip_ansi(value)) class ansi_str(str): """A str subclass, specialized for strings containing ANSI escapes. When you call the ``len`` metho...
Python
0
bc2c1a9d4c060242db1273e9608c629b2e0243cc
Fix _version.py
thermostate/_version.py
thermostate/_version.py
"""The version of thermohw.""" __version_info__ = (0, 4, 1, 'dev0') # type: Tuple[int, int, int, str] __version__ = '.'.join([str(v) for v in __version_info__ if str(v)])
"""The version of thermohw.""" from typing import Tuple __version_info__: Tuple[int, int, int, str] = (0, 4, 1, 'dev0') __version__ = '.'.join([str(v) for v in __version_info__ if str(v)])
Python
0.998479
556e0e3474e379427a08e1646274f596c7e4e5ef
Remove unused but circular import
angular_flask/models.py
angular_flask/models.py
from angular_flask import db class Wig(db.Model): id = db.Column(db.Integer, primary_key=True) span = db.Column(db.String) def __repr__(self): return "Wig: {}".format(self.id) class WigValue(db.Model): id = db.Column(db.Integer, primary_key=True) position = db.Column(db.Integer) value...
from datetime import datetime from angular_flask import db from angular_flask import app class Wig(db.Model): id = db.Column(db.Integer, primary_key=True) span = db.Column(db.String) def __repr__(self): return "Wig: {}".format(self.id) class WigValue(db.Model): id = db.Column(db.Integer, pr...
Python
0
01674bb349e9850b26aeae212ad77aa992f18ab5
bump version
lava_scheduler_app/__init__.py
lava_scheduler_app/__init__.py
# Copyright (C) 2011 Linaro Limited # # Author: Michael Hudson-Doyle <michael.hudson@linaro.org> # # This file is part of LAVA Scheduler. # # LAVA Scheduler is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License version 3 as # published by the Free Software...
# Copyright (C) 2011 Linaro Limited # # Author: Michael Hudson-Doyle <michael.hudson@linaro.org> # # This file is part of LAVA Scheduler. # # LAVA Scheduler is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License version 3 as # published by the Free Software...
Python
0
cb5a8ac1b74cdeeea5901bb22d8600ace8f5b6e1
Allow parsing lists of dictionaries as well as dictionaries in JSON structures
tools/json_extractor.py
tools/json_extractor.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (c) 2013-2016 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without ...
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (c) 2013-2016 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without ...
Python
0.000003
df35ebdcebc8704f964d3301004fcaf88e70336f
fix filereader cd:/ replacement
tools/lib/filereader.py
tools/lib/filereader.py
import os from tools.lib.url_file import URLFile DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/") def FileReader(fn, debug=False): if fn.startswith("cd:/"): fn = fn.replace("cd:/", DATA_PREFIX) if fn.startswith("http://") or fn.startswith("https://"): return URLFile(fn, debug=debug) r...
import os from tools.lib.url_file import URLFile DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/") def FileReader(fn, debug=False): if fn.startswith("cd:/"): fn.replace("cd:/", DATA_PREFIX) if fn.startswith("http://") or fn.startswith("https://"): return URLFile(fn, debug=debug) return...
Python
0
2bf8f7beac5ee32e7cb3085da392055603ab88d6
Fix request method
users/tests/test_api.py
users/tests/test_api.py
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from ..models import User class UserTest(APITestCase): """Tests for /users/ API endpoints.""" def test_view_user_logged_out(self): user = User.objects.create(name="Trey", email...
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from ..models import User class UserTest(APITestCase): """Tests for /users/ API endpoints.""" def test_view_user_logged_out(self): user = User.objects.create(name="Trey", email...
Python
0.000001
8c759f531e6a3cdc0e2b40321153147a7ec00b40
update docstrings to reflect recent AcademicDatabase refactoring
angular_flask/classtime/academic_calendar.py
angular_flask/classtime/academic_calendar.py
import sys import re from academic_databases.abstract_academicdb import AcademicDatabase class AcademicCalendar(object): """ Manages academic calendar information, including terms, courses and sections. Connects to an institution's course database using any implementation of the AcademicDatabase...
import sys import re from academic_databases.abstract_academicdb import AcademicDatabase class AcademicCalendar(object): """ Gives access to academic calendar data contained in an LDAP server """ def __init__(self, institution_name): """ Initialize the Calendar with a database conn...
Python
0
1a740734f1f51cd5a64443a82a116eb14abf31fd
Use __future__.py from CPython.
Languages/IronPython/IronPython/Lib/__future__.py
Languages/IronPython/IronPython/Lib/__future__.py
"""Record of phased-in incompatible language changes. Each line is of the form: FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," CompilerFlag ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: (...
##################################################################################### # # Copyright (c) Microsoft Corporation. All rights reserved. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of t...
Python
0
ab78bf2c47a8bec5c1d0c5a7951dba1c98f5c28e
Revert file to moneymanager master branch.
check_gm.py
check_gm.py
#!/usr/bin/env python3 # vi:tabstop=4:expandtab:shiftwidth=4:softtabstop=4:autoindent:smarttab import os, sys import sqlite3 import urllib.request err = False for version in range (7, 14): fname = 'tables_v1.sql' if version < 12 else 'tables.sql' url = 'https://cdn.jsdelivr.net/gh/moneymanagerex/database@v%i/...
#!/usr/bin/env python3 # vi:tabstop=4:expandtab:shiftwidth=4:softtabstop=4:autoindent:smarttab import os, sys import sqlite3 import urllib.request err = False for version in range (7, 14): fname = 'tables_v1.sql' if version < 12 else 'tables.sql' url = 'https://cdn.jsdelivr.net/gh/moneymanagerex/database@v%i/...
Python
0
81bd4c6a7b94803e57a64f47bacbf3d5059282bd
add node
checkbst.py
checkbst.py
""" This is a very common interview question. Given a binary tree, check whether it’s a binary search tree or not. Simple as that.. http://www.ardendertat.com/2011/10/10/programming-interview-questions-7-binary-search-tree-check/ """ class Node: def __init__(self, val=None): self.left, self.right, self....
""" This is a very common interview question. Given a binary tree, check whether it’s a binary search tree or not. Simple as that.. http://www.ardendertat.com/2011/10/10/programming-interview-questions-7-binary-search-tree-check/ """
Python
0.000001
3a5b96d5d666521a97598fe9d30b8e007242f8aa
swap from published/test:compile to published/compile in CI to try and speed things up a little
ci/build.py
ci/build.py
#!/usr/bin/env python import os from subprocess import check_call, check_output import json import sys is_master_commit = ( os.environ['TRAVIS_PULL_REQUEST'] == "false" and os.environ['TRAVIS_BRANCH'] == "master" ) all_versions = [ "2.10.4", "2.10.5", "2.10.6", "2.11.3", "2.11.4", "2.11.5", "2.11.6",...
#!/usr/bin/env python import os from subprocess import check_call, check_output import json import sys is_master_commit = ( os.environ['TRAVIS_PULL_REQUEST'] == "false" and os.environ['TRAVIS_BRANCH'] == "master" ) all_versions = [ "2.10.4", "2.10.5", "2.10.6", "2.11.3", "2.11.4", "2.11.5", "2.11.6",...
Python
0
175bbd2f181d067712d38beeca9df4063654103a
Update script to remove extension from filename
nlppln/frog_to_saf.py
nlppln/frog_to_saf.py
#!/usr/bin/env python import click import os import codecs import json from xtas.tasks._frog import parse_frog, frog_to_saf @click.command() @click.argument('input_files', nargs=-1, type=click.Path(exists=True)) @click.argument('output_dir', nargs=1, type=click.Path()) def frog2saf(input_files, output_dir): if n...
#!/usr/bin/env python import click import os import codecs import json from xtas.tasks._frog import parse_frog, frog_to_saf @click.command() @click.argument('input_files', nargs=-1, type=click.Path(exists=True)) @click.argument('output_dir', nargs=1, type=click.Path()) def frog2saf(input_files, output_dir): if n...
Python
0.000002
b3426bcd217c336f8807a5474b47dea72a994eb9
Rename `op`-parameter to `request`.
ioctl/__init__.py
ioctl/__init__.py
import ctypes import fcntl import sys # In Python 2, the bytearray()-type does not support the buffer interface, # and can therefore not be used in ioctl(). # This creates a couple of helper functions for converting to and from if sys.version_info < (3, 0): import array def _to_bytearray(value): retur...
import ctypes import fcntl import sys # In Python 2, the bytearray()-type does not support the buffer interface, # and can therefore not be used in ioctl(). # This creates a couple of helper functions for converting to and from if sys.version_info < (3, 0): import array def _to_bytearray(value): retur...
Python
0
0ac4fe1431fd04aa2645a4afc3d4d2fbfb21bb90
Update plone profile: copy of black, plus three settings.
isort/profiles.py
isort/profiles.py
"""Common profiles are defined here to be easily used within a project using --profile {name}""" from typing import Any, Dict black = { "multi_line_output": 3, "include_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "ensure_newline_before_comments": True, "line_length": 8...
"""Common profiles are defined here to be easily used within a project using --profile {name}""" from typing import Any, Dict black = { "multi_line_output": 3, "include_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "ensure_newline_before_comments": True, "line_length": 8...
Python
0
0a4da4bc40813362b9d6c67c2fb02f33a807f3fe
fix error on tax view
l10n_it_account/__openerp__.py
l10n_it_account/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010-2013 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero ...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2010-2013 Associazione OpenERP Italia # (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero ...
Python
0
87c2cf3f8f8ea2e890aa648d33e93e051632e86d
change billets
totvserprm/financial.py
totvserprm/financial.py
# -*- coding: utf-8 -*- from datetime import datetime from baseapi import BaseApi class Client(BaseApi): dataservername = 'FinCFODataBR' def create(self,**kwargs): return super(Client, self).create({ 'NewDataSet': { 'FCFO': { 'ATIVO': kwargs.get('ativo')...
# -*- coding: utf-8 -*- from datetime import datetime from baseapi import BaseApi class Client(BaseApi): dataservername = 'FinCFODataBR' def create(self,**kwargs): # codigo de coligada para o contexto, diferente do dataset codcoligada_contexto = kwargs.get('codcoligada_contexto') if no...
Python
0.000001
9cce47d37f6e2d08a66b9deedfc6f2f74b02720a
add int validator
tpl/prompt/validator.py
tpl/prompt/validator.py
# -*- coding:utf-8 -*- from prompt_toolkit.validation import Validator, ValidationError class StrValidator(Validator): def validate(self, document): pass class IntValidator(Validator): def validate(self, document): text = document.text for index, char in enumerate(text): ...
# -*- coding:utf-8 -*- from prompt_toolkit.validation import Validator, ValidationError class StrValidator(Validator): def validate(self, document): pass
Python
0.00002
4f73601c843ff9507064b85ddd33179af9fed653
Raise stderr message
utils/unfiltered_pbf.py
utils/unfiltered_pbf.py
# -*- coding: utf-8 -*- import logging import os from string import Template from subprocess import PIPE, Popen from .artifact import Artifact from .osm_xml import OSM_XML LOG = logging.getLogger(__name__) class InvalidOsmXmlException(Exception): pass class UnfilteredPBF(object): name = 'full_pbf' de...
# -*- coding: utf-8 -*- import logging import os from string import Template from subprocess import PIPE, Popen from .artifact import Artifact from .osm_xml import OSM_XML LOG = logging.getLogger(__name__) class InvalidOsmXmlException(Exception): pass class UnfilteredPBF(object): name = 'full_pbf' de...
Python
0.00001
aaee820075b150b641e511dbdb45e6d1ff3da529
Update description of function attibute in class SchemaIndicatorType
api/schema_indicator.py
api/schema_indicator.py
from database.model_indicator import ModelIndicatorType, ModelIndicator, ModelIndicatorParameterType, ModelIndicatorParameter, ModelIndicatorResult from graphene_sqlalchemy import SQLAlchemyObjectType import graphene import logging # Load logging configuration log = logging.getLogger(__name__) class AttributeIndicat...
from database.model_indicator import ModelIndicatorType, ModelIndicator, ModelIndicatorParameterType, ModelIndicatorParameter, ModelIndicatorResult from graphene_sqlalchemy import SQLAlchemyObjectType import graphene import logging # Load logging configuration log = logging.getLogger(__name__) class AttributeIndicat...
Python
0
451e20818c7fbcc0b45500c71c5c5beee96eb316
update jaxlib
jaxlib/version.py
jaxlib/version.py
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0
1c15d302c2a1df22b4dd89f3215decf141a4c20e
return None if there is an error during scan
abilian/services/antivirus/__init__.py
abilian/services/antivirus/__init__.py
# coding=utf-8 """ """ from __future__ import absolute_import try: import clamd cd = clamd.ClamdUnixSocket() CLAMD_AVAILABLE = True except ImportError: CLAMD_AVAILABLE = False from abilian.core.models.blob import Blob from ..base import Service class AntiVirusService(Service): """ Antivirus service ""...
# coding=utf-8 """ """ from __future__ import absolute_import try: import clamd cd = clamd.ClamdUnixSocket() CLAMD_AVAILABLE = True except ImportError: CLAMD_AVAILABLE = False from abilian.core.models.blob import Blob from ..base import Service class AntiVirusService(Service): """ Antivirus service ""...
Python
0.998415
8e10657f94023a69967345114ee221c8d579c05d
Fix error with new issue while not login.
trackit/issues/views.py
trackit/issues/views.py
from django.shortcuts import render, get_object_or_404, redirect from .models import Ticket, Label, User, Comment import hashlib # Create your views here. def home(request): issue = Ticket.objects.filter().order_by('-id') readit = [] for i in issue: issue_get = {} issue_get['id'] = i.id ...
from django.shortcuts import render, get_object_or_404, redirect from .models import Ticket, Label, User, Comment import hashlib # Create your views here. def home(request): issue = Ticket.objects.filter().order_by('-id') readit = [] for i in issue: issue_get = {} issue_get['id'] = i.id ...
Python
0
7e4b66fe3df07afa431201de7a5a76d2eeb949a1
Fix django custom template tag importing
app/main.py
app/main.py
#!/usr/bin/env python import env_setup; env_setup.setup(); env_setup.setup_django() from django.template import add_to_builtins add_to_builtins('agar.django.templatetags') from webapp2 import RequestHandler, Route, WSGIApplication from agar.env import on_production_server from agar.config import Config from agar.dj...
#!/usr/bin/env python from env_setup import setup_django setup_django() from env_setup import setup setup() from webapp2 import RequestHandler, Route, WSGIApplication from agar.env import on_production_server from agar.config import Config from agar.django.templates import render_template class MainApplicationConf...
Python
0.000001
35c52ecbe34611f003d8f647dafdb15c00d70212
update doc
python/git_pull_codedir/git_pull_codedir.py
python/git_pull_codedir/git_pull_codedir.py
# -*- coding: utf-8 -*- #!/usr/bin/python ##------------------------------------------------------------------- ## @copyright 2017 DennyZhang.com ## Licensed under MIT ## https://raw.githubusercontent.com/DennyZhang/devops_public/master/LICENSE ## ## File : git_pull_codedir.py ## Author : Denny <denny@dennyzhang.com>...
# -*- coding: utf-8 -*- #!/usr/bin/python ##------------------------------------------------------------------- ## @copyright 2017 DennyZhang.com ## Licensed under MIT ## https://raw.githubusercontent.com/DennyZhang/devops_public/master/LICENSE ## ## File : git_pull_codedir.py ## Author : Denny <denny@dennyzhang.com>...
Python
0
3ab5586ec4ac9ff3ac3fd7583bc9a71c7b5cd27a
fix lockedNormal, use MItMeshPolygon instead of MItMeshVertex, fix Fix() fucntion
python/medic/plugins/Tester/lockedNormal.py
python/medic/plugins/Tester/lockedNormal.py
from medic.core import testerBase from maya import OpenMaya class LockedNormal(testerBase.TesterBase): Name = "LockedNormal" Description = "vertex(s) which has locked normal" Fixable = True def __init__(self): super(LockedNormal, self).__init__() def Match(self, node): return nod...
from medic.core import testerBase from maya import OpenMaya class LockedNormal(testerBase.TesterBase): Name = "LockedNormal" Description = "vertex(s) which has locked normal" Fixable = True def __init__(self): super(LockedNormal, self).__init__() def Match(self, node): return nod...
Python
0
e74b4867f9067e28686aecd19eb6f1d352ee28bf
fix imports
game.py
game.py
import random from characters import guests as people from adventurelib import when, start import rooms from sys import exit murder_config_people = list(people) random.shuffle(murder_config_people) murder_location = random.choice(list(rooms.rooms)) murderer = random.choice(list(people)) current_config_people = list...
import random from characters import guests as people from adventurelib import Item, Bag, when, start import rooms import characters from sys import exit murder_config_people = list(people) random.shuffle(murder_config_people) murder_location = random.choice(list(rooms.rooms)) murderer = random.choice(list(people)) ...
Python
0.000002
38f682604b7ed69799cc795eaead631dbd384c7e
allow ttl of 0
nsone/rest/records.py
nsone/rest/records.py
# # Copyright (c) 2014 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. from . import resource class Records(resource.BaseResource): ROOT = 'zones' def _buildBody(self, zone, domain, type, answers, ttl=None): body = {} body['zone'] = zone body['domai...
# # Copyright (c) 2014 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. from . import resource class Records(resource.BaseResource): ROOT = 'zones' def _buildBody(self, zone, domain, type, answers, ttl=None): body = {} body['zone'] = zone body['domai...
Python
0.002377
aaba085cd2e97c8c23e6724da3313d42d12798f0
Make sure request.user is a user
app/grandchallenge/annotations/validators.py
app/grandchallenge/annotations/validators.py
from rest_framework import serializers from django.conf import settings def validate_grader_is_current_retina_user(grader, context): """ This method checks if the passed grader equals the request.user that is passed in the context. Only applies to users that are in the retina_graders group. """ re...
from rest_framework import serializers from django.conf import settings def validate_grader_is_current_retina_user(grader, context): """ This method checks if the passed grader equals the request.user that is passed in the context. Only applies to users that are in the retina_graders group. """ re...
Python
0.999944
445740ee2630eca017b4899b96fef8ffeda0e7ea
update gist extension
gist.py
gist.py
""" This is the gist share button, and a %gist magic, as a Python extension. You can also get just the gist button without this extension by adding the contents of gist.js to static/js/custom.js in your profile. This code requires that you have the jist rubygem installed and properly configured. """ gist_js = r""" ...
""" This is the gist share button, and a %gist magic, as a Python extension. You can also get just the gist button without this extension by adding the contents of gist.js to static/js/custom.js in your profile. This code requires that you have the jist rubygem installed and properly configured. """ gist_js = r""" ...
Python
0
9108f24183b2743647a8ed3ab354673e945d5f2a
Update release number
mailparser_version/__init__.py
mailparser_version/__init__.py
__version__ = "1.1.0"
__version__ = "1.0.0"
Python
0.000001
7e457272b4e9d3b0de1bb0fc0cbf8b6bae4dc911
add test scrip
test_rsn.py
test_rsn.py
#!/usr/bin/env python import argparse import logging from prettytable import PrettyTable from dns.flags import DO from dns.resolver import query, Resolver class RsnServer(object): def __init__(self, server): self.logger = logging.getLogger('RsnServer') self.server = server self.i...
#!/usr/bin/env python import argparse import logging from prettytable import PrettyTable from dns.flags import DO from dns.resolver import query, Resolver class RsnServer(object): def __init__(self, server): self.logger = logging.getLogger('RsnServer') self.server = server ...
Python
0.000001
8128791c5b4cb8d185ceb916df2b6aa896f17453
add test for custom ylabels
test_run.py
test_run.py
#! /usr/bin/env python # Load Libraries import matplotlib as mpl mpl.use('SVG') import matplotlib.pyplot as plt # %matplotlib inline import seaborn as sns sns.set(style='ticks',context='talk') import bootstrap_contrast as bsc import pandas as pd import numpy as np import scipy as sp # Dummy dataset dataset=list() f...
#! /usr/bin/env python # Load Libraries import matplotlib as mpl mpl.use('SVG') import matplotlib.pyplot as plt # %matplotlib inline import seaborn as sns sns.set(style='ticks',context='talk') import bootstrap_contrast as bsc import pandas as pd import numpy as np import scipy as sp # Dummy dataset dataset=list() f...
Python
0
0ca45e92a92e71d080af6e2104f4f625e31559f0
Tweak mysql query string in test.
blaze/compute/tests/test_mysql_compute.py
blaze/compute/tests/test_mysql_compute.py
from __future__ import absolute_import, print_function, division from getpass import getuser import pytest sa = pytest.importorskip('sqlalchemy') pytest.importorskip('pymysql') from odo import odo, drop, discover import pandas as pd import numpy as np from blaze import symbol, compute from blaze.utils import exam...
from __future__ import absolute_import, print_function, division from getpass import getuser import pytest sa = pytest.importorskip('sqlalchemy') pytest.importorskip('pymysql') from odo import odo, drop, discover import pandas as pd import numpy as np from blaze import symbol, compute from blaze.utils import exam...
Python
0
a6c4540877e00df93fb5de3ce76e3a7393c1c587
Change notes.
timegaps.py
timegaps.py
# -*- coding: utf-8 -*- # Copyright 2014 Jan-Philip Gehrcke. See LICENSE file for details. """ Feature brainstorm: - reference implementation with cmdline interface - comprehensive API for systematic unit testing and library usage - remove or move or noop mode - extensive logging - parse mtime fro...
# -*- coding: utf-8 -*- # Copyright 2014 Jan-Philip Gehrcke. See LICENSE file for details. """ Feature brainstorm: - reference implementation with cmdline interface - comprehensive API for systematic unit testing and library usage - remove or move or noop mode - extensive logging - parse mtime fro...
Python
0
ede42576daca2f4ea3ede8fa92852c623ede5196
fix typo - do not try to catch socket.errno :)
lib/exaproxy/network/poller.py
lib/exaproxy/network/poller.py
#!/usr/bin/env python # encoding: utf-8 """ server.py Created by Thomas Mangin on 2011-11-30. Copyright (c) 2011 Exa Networks. All rights reserved. """ # http://code.google.com/speed/articles/web-metrics.html import os import struct import time import socket import errno import select from exaproxy.util.logger impo...
#!/usr/bin/env python # encoding: utf-8 """ server.py Created by Thomas Mangin on 2011-11-30. Copyright (c) 2011 Exa Networks. All rights reserved. """ # http://code.google.com/speed/articles/web-metrics.html import os import struct import time import socket import errno import select from exaproxy.util.logger impo...
Python
0
b30854cb21e10f1d9496750737250da7ad02ad38
add 'list' function
datapath/vhd/tapdisk.py
datapath/vhd/tapdisk.py
#!/usr/bin/env python import os import signal import xapi import commands def log(txt): print >>sys.stderr, txt # [run dbg cmd] executes [cmd], throwing a BackendError if exits with # a non-zero exit code. def run(dbg, cmd): code, output = commands.getstatusoutput(cmd) if code <> 0: log("%s: %s e...
#!/usr/bin/env python import os import signal import xapi import commands def log(txt): print >>sys.stderr, txt # [run dbg cmd] executes [cmd], throwing a BackendError if exits with # a non-zero exit code. def run(dbg, cmd): code, output = commands.getstatusoutput(cmd) if code <> 0: log("%s: %s e...
Python
0
4bc436ac4d441987d602b3af10517125c78c56e0
remove use of BeautifulSoup from parse_paragraph_as_list
lib/parse_paragraph_as_list.py
lib/parse_paragraph_as_list.py
def parse_paragraph_as_list(string_with_br): paragraph = ' '.join(string_with_br.split()) lines = [s.strip() for s in paragraph.split('<br>')] return [l for l in lines if l]
from bs4 import BeautifulSoup def parse_paragraph_as_list(string_with_br): strings = BeautifulSoup(string_with_br, 'html.parser').strings splitted = [' '.join(s.split()).strip() for s in strings] return [s for s in splitted if s]
Python
0.000006
ac6ce056e6b05531d81c550ae3e1e1d688ece4a0
Make serializer commet more clear
jwt_auth/serializers.py
jwt_auth/serializers.py
from .models import User from rest_framework import serializers class UserSerializer(serializers.ModelSerializer): password = serializers.CharField(max_length=20, min_length=8, trim_whitespace=False, write_only=True) class Meta: model = User fields = ('id', 'nickname', 'username', 'email', 'pa...
from .models import User from rest_framework import serializers class UserSerializer(serializers.ModelSerializer): password = serializers.CharField(max_length=20, min_length=8, trim_whitespace=False, write_only=True) class Meta: model = User fields = ('id', 'nickname', 'username', 'email', 'pa...
Python
0.000001
b7a84ce7f0049229693fe12bf7a8bb1a7177d3b6
convert values to float before multiplying with pi
django_geo/distances.py
django_geo/distances.py
import math class distances: @staticmethod def geographic_distance(lat1, lng1, lat2, lng2): lat1 = float(lat1) lng1 = float(lng1) lat2 = float(lat2) lng2 = float(lng2) lat1 = (lat1 * math.pi) / 180 lng1 = (lng1 * math.pi) / 180 lat2 = (lat2 * math.pi) / 180 lng2 = (lng2 * math....
import math class distances: @staticmethod def geographic_distance(lat1, lng1, lat2, lng2): lat1 = (lat1 * math.pi) / 180 lng1 = (lng1 * math.pi) / 180 lat2 = (lat2 * math.pi) / 180 lng2 = (lng2 * math.pi) / 180 a = (math.sin(lat1)*math.sin(lat2))+(math.cos(lat1)*math.cos(lat2)*math.cos(lng2 - lng1)) retu...
Python
0.000001
4259019196c473431d4291f2910ab0164e319ffb
update simu.py for 0.3.0.
bin/simu.py
bin/simu.py
#!/usr/bin/env python3 import sys import os import traceback import subprocess IVERILOG_PATH = 'iverilog' ROOT_DIR = '.' + os.path.sep TEST_DIR = ROOT_DIR + 'tests' TMP_DIR = ROOT_DIR + '.tmp' sys.path.append(ROOT_DIR) from polyphony.compiler.__main__ import compile_main, logging_setting from polyphony.compiler.env ...
#!/usr/bin/env python3 import sys import os import traceback import logging import profile from subprocess import call, check_call, check_output ROOT_DIR = './' TEST_DIR = ROOT_DIR+'tests' TMP_DIR = ROOT_DIR+'.tmp' sys.path.append(ROOT_DIR) from polyphony.compiler.__main__ import compile_main, logging_setting from po...
Python
0