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
c16fb96de6154dec7bf0fc934dd9f7e1ac4b69f4
bump version
curtsies/__init__.py
curtsies/__init__.py
"""Terminal-formatted strings""" __version__='0.1.15' from .window import FullscreenWindow, CursorAwareWindow from .input import Input from .termhelpers import Nonblocking, Cbreak, Termmode from .formatstring import FmtStr, fmtstr from .formatstringarray import FSArray, fsarray
"""Terminal-formatted strings""" __version__='0.1.14' from .window import FullscreenWindow, CursorAwareWindow from .input import Input from .termhelpers import Nonblocking, Cbreak, Termmode from .formatstring import FmtStr, fmtstr from .formatstringarray import FSArray, fsarray
Python
0
0601e5214a75921696f50691285166dcda06288b
switch VR separator to --
tcpbridge/tcpbridge.py
tcpbridge/tcpbridge.py
#!/usr/bin/env python3 import select import socket import sys class TcpBridge: def __init__(self): self.sockets = [] self.socket2remote = {} def routerintf2addr(self, hostintf): hostname, interface = hostintf.split("/") try: res = socket.getaddrinfo(hostname, "1...
#!/usr/bin/env python3 import select import socket import sys class TcpBridge: def __init__(self): self.sockets = [] self.socket2remote = {} def routerintf2addr(self, hostintf): hostname, interface = hostintf.split("/") try: res = socket.getaddrinfo(hostname, "1...
Python
0
e468abbc033a48d0222f50cf85319802f05fc57a
Check doctest
custom/onse/tests.py
custom/onse/tests.py
import doctest from datetime import date from nose.tools import assert_equal from custom.onse import tasks def test_get_last_quarter(): test_dates = [ (date(2020, 1, 1), '2019Q4'), (date(2020, 3, 31), '2019Q4'), (date(2020, 4, 1), '2020Q1'), (date(2020, 6, 30), '2020Q1'), ...
from datetime import date from nose.tools import assert_equal from custom.onse.tasks import get_last_quarter def test_get_last_quarter(): test_dates = [ (date(2020, 1, 1), '2019Q4'), (date(2020, 3, 31), '2019Q4'), (date(2020, 4, 1), '2020Q1'), (date(2020, 6, 30), '2020Q1'), ...
Python
0
e6357827a670c71e2489b5468b89a65153719ba4
Fix syntax (backward compatible)
social/strategies/tornado_strategy.py
social/strategies/tornado_strategy.py
import json from tornado.template import Loader, Template from social.utils import build_absolute_uri from social.strategies.base import BaseStrategy, BaseTemplateStrategy class TornadoTemplateStrategy(BaseTemplateStrategy): def render_template(self, tpl, context): path, tpl = tpl.rsplit('/', 1) ...
import json from tornado.template import Loader, Template from social.utils import build_absolute_uri from social.strategies.base import BaseStrategy, BaseTemplateStrategy class TornadoTemplateStrategy(BaseTemplateStrategy): def render_template(self, tpl, context): path, tpl = tpl.rsplit('/', 1) ...
Python
0.000001
e6c994b87fed7c12fae4b52c6311d105fe45ddbf
Make logging even better
giftwrap_plugins/builders/package_meta.py
giftwrap_plugins/builders/package_meta.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2015, IBM # Copyright 2015, Craig Tracey <craigtracey@gmail.com> # 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 ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2015, IBM # Copyright 2015, Craig Tracey <craigtracey@gmail.com> # 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 ...
Python
0
6bfab23170c108c50c9b2dc4988e8670ed677d65
Allow including html files. Build script made executable.
build.py
build.py
#!/usr/bin/python import distutils.core from os import path import re include_folder = 'slides' include_templates = ['{}.html', '{}.md'] include_regex = re.compile('@@([a-zA-Z0-9-_]+)') in_file = 'index.html' out_folder = '../dist' out_file_name = 'index.html' dirs_to_copy = ['css', 'js', 'lib', 'plugin'] def main()...
import distutils.core from os import path import re include_folder = 'slides' include_template = '{}.md' include_regex = re.compile('@@([a-zA-Z0-9-_]+)') in_file = 'index.html' out_folder = '../dist' out_file_name = 'index.html' dirs_to_copy = ['css', 'js', 'lib', 'plugin'] def main(): print('Copying static dire...
Python
0
9179907357c6e8aad33a8a5e5cd39b164b2f9cc0
Update BUILD_OSS to 4680.
src/data/version/mozc_version_template.bzl
src/data/version/mozc_version_template.bzl
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
Python
0
db2bb0356cfdf486a9e628726cd4e5879311fe8b
update version
src/BJRobot/version.py
src/BJRobot/version.py
VERSION = '0.5.0'
VERSION = '0.4.0'
Python
0
137271045313a12bbe9388ab1ac6c8cb786b32b7
Reset mock befor running test.
guardian/testapp/tests/test_management.py
guardian/testapp/tests/test_management.py
from __future__ import absolute_import from __future__ import unicode_literals from guardian.compat import get_user_model from guardian.compat import mock from guardian.compat import unittest from guardian.management import create_anonymous_user import django mocked_get_init_anon = mock.Mock() class TestGetAnonymo...
from __future__ import absolute_import from __future__ import unicode_literals from guardian.compat import get_user_model from guardian.compat import mock from guardian.compat import unittest from guardian.management import create_anonymous_user import django mocked_get_init_anon = mock.Mock() class TestGetAnonymo...
Python
0
30020d3826a2460288b6a57963753787020a945a
Implement support for the 'D' type in packb()
temporenc/temporenc.py
temporenc/temporenc.py
import struct SUPPORTED_TYPES = set([ 'D', 'T', 'DT', 'DTZ', 'DTS', 'DTSZ', ]) STRUCT_32 = struct.Struct('>L') def packb(type=None, year=None, month=None, day=None): """ Pack date and time information into a byte string. :return: encoded temporenc value :rtype: bytes ""...
def packb(type=None, year=None, month=None, day=None): raise NotImplementedError()
Python
0.00022
7c63030bd70b32ec4c13ff4273d103ddbb0ffa0f
include tumblrprofile in djangoadmin
hackathon_starter/hackathon/admin.py
hackathon_starter/hackathon/admin.py
from django.contrib import admin from hackathon.models import UserProfile, Profile, InstagramProfile, TwitterProfile, MeetupToken, GithubProfile, LinkedinProfile, TumblrProfile # Register your models here. class TwitterProfileAdmin(admin.ModelAdmin): list_display = ('user','twitter_user') admin.site.register(UserPro...
from django.contrib import admin from hackathon.models import UserProfile, Profile, InstagramProfile, TwitterProfile, MeetupToken, GithubProfile, LinkedinProfile # Register your models here. class TwitterProfileAdmin(admin.ModelAdmin): list_display = ('user','twitter_user') admin.site.register(UserProfile) admin.sit...
Python
0.000002
c3df7d5adf551213c94f2d0e0598552ce6ee9aaf
move collection list filtering logic to db query
hs_collection_resource/page_processors.py
hs_collection_resource/page_processors.py
from django.http import HttpResponseRedirect, HttpResponseForbidden from django.db.models import Q from mezzanine.pages.page_processors import processor_for from hs_core import page_processors from hs_core.models import BaseResource from hs_core.views import add_generic_context from hs_core.views.utils import get_my_r...
from django.http import HttpResponseRedirect from mezzanine.pages.page_processors import processor_for from hs_core import page_processors from hs_core.models import BaseResource from hs_core.views import add_generic_context from hs_core.views.utils import get_my_resources_list from .models import CollectionResource ...
Python
0
75a0dec32210432374b45dbed2845dfe171b9b36
Set version number to 0.4.1
climlab/__init__.py
climlab/__init__.py
__version__ = '0.4.1' # This list defines all the modules that will be loaded if a user invokes # from climLab import * # totally out of date! #__all__ = ["constants", "thermo", "orbital_table", # "long_orbital_table", "insolation", "ebm", # "column", "convadj"] #from climlab import radiation...
__version__ = '0.4.1dev' # This list defines all the modules that will be loaded if a user invokes # from climLab import * # totally out of date! #__all__ = ["constants", "thermo", "orbital_table", # "long_orbital_table", "insolation", "ebm", # "column", "convadj"] #from climlab import radiat...
Python
0.999999
85af2e031479c78aaef433e2294648125916251a
Improve color palette for cycling Curves
src/rnaseq_lib/plot/opts.py
src/rnaseq_lib/plot/opts.py
import holoviews as hv color_sequence = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'] gen...
gene_curves_opts = { 'Curve': {'plot': dict(height=120, width=600, tools=['hover'], invert_xaxis=True, yrotation=45, yaxis='left'), 'style': dict(line_width=1.5)}, 'Curve.Percentage_of_Normal_Samples': {'plot': dict(xaxis=None, invert_yaxis=True), 'style'...
Python
0.000001
72c5168ff71223db32ef37a12fd8781f28bfc433
change CTCP VERSION reply
circa.py
circa.py
#!/usr/bin/env python3 import sdirc import yaml import threading import importlib import modules VERSION = "1.0" class Circa(sdirc.Client): def __init__(self, **conf): conf["autoconn"] = False conf["prefix"] = conf["prefix"] if "prefix" in conf else "!" sdirc.Client.__init__(self, **conf) self.modules = {}...
#!/usr/bin/env python3 import sdirc import yaml import threading import importlib import modules VERSION = "1.0" class Circa(sdirc.Client): def __init__(self, **conf): conf["autoconn"] = False conf["prefix"] = conf["prefix"] if "prefix" in conf else "!" sdirc.Client.__init__(self, **conf) self.modules = {}...
Python
0
dc6100fea3097d97e7065bd653093798eac84909
Allow passing in of timezone
kairios/templatetags/kairios_tags.py
kairios/templatetags/kairios_tags.py
import calendar as cal import datetime from django import template from django.util import timezone import pytz register = template.Library() def delta(year, month, d): mm = month + d yy = year if mm > 12: mm, yy = mm % 12, year + mm / 12 elif mm < 1: mm, yy = 12 + mm, year - 1 ...
import calendar as cal import datetime from django import template register = template.Library() def delta(year, month, d): mm = month + d yy = year if mm > 12: mm, yy = mm % 12, year + mm / 12 elif mm < 1: mm, yy = 12 + mm, year - 1 return yy, mm @register.inclusion_tag("kair...
Python
0.000001
fd7577d34ef206869517f3717070880d098d4d8b
change URL dispach rules
cms_content/urls.py
cms_content/urls.py
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * from cms_content.views import * from cms_content.models import * from cms_content.utils.queryset import queryset_iterator urlpatterns = patterns ('', url(r'^$', section_list, {'sections': CMSSection.objects.all()}, name='section'), url(r'^(?P<sl...
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * from cms_content.views import * from cms_content.models import * from cms_content.utils.queryset import queryset_iterator urlpatterns = patterns ('', url(r'^$', section_list, {'sections': CMSSection.objects.all()}, name='section'), url(r'^(?P<sl...
Python
0
56b98c3f8a091132cd2dc9c1a717df9cdd96439c
Improve titles
src/sentry/constants.py
src/sentry/constants.py
""" sentry.constants ~~~~~~~~~~~~~~~~ These settings act as the default (base) settings for the Sentry-provided web-server :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from django.utils.datastructures import SortedDict from django.utils....
""" sentry.constants ~~~~~~~~~~~~~~~~ These settings act as the default (base) settings for the Sentry-provided web-server :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from django.utils.datastructures import SortedDict from django.utils....
Python
0.001441
2f24f483dbd8ed860556dd934c8923c89e378fce
whoops - null text, return 0 length
library/pyjamas/ui/platform/TextBoxBasemshtml.py
library/pyjamas/ui/platform/TextBoxBasemshtml.py
class TextBoxBase: def getCursorPos(self): try : elem = self.getElement() tr = elem.document.selection.createRange() if tr.parentElement().uniqueID != elem.uniqueID: return -1 return -tr.move("character", -65535) except: pri...
class TextBoxBase: def getCursorPos(self): try : elem = self.getElement() tr = elem.document.selection.createRange() if tr.parentElement().uniqueID != elem.uniqueID: return -1 return -tr.move("character", -65535) except: pri...
Python
0.999352
ce83a4fb2f650380b7683ea688791e078b6fe7ec
Fix wrong redirect on logout
src/sleepy/web/views.py
src/sleepy/web/views.py
from django.contrib import messages from django.contrib.auth import REDIRECT_FIELD_NAME, logout from django.core.urlresolvers import reverse_lazy from django.views.generic import RedirectView, TemplateView from django.utils.http import is_safe_url from django.utils.translation import ugettext class IndexView(Template...
from django.contrib import messages from django.contrib.auth import REDIRECT_FIELD_NAME, logout from django.core.urlresolvers import reverse_lazy from django.views.generic import RedirectView, TemplateView from django.utils.http import is_safe_url from django.utils.translation import ugettext class IndexView(Template...
Python
0.000003
800bd152baa9eef06f647e98994b0a5b9f4b2012
Update manual_matches for new format
membership/management/commands/manual_matches.py
membership/management/commands/manual_matches.py
# encoding: UTF-8 from __future__ import with_statement from django.db.models import Q, Sum from django.core.management.base import BaseCommand from django.core.exceptions import ObjectDoesNotExist from django.core.management.base import NoArgsCommand from django.contrib.auth.models import User import logging logger...
# encoding: UTF-8 from __future__ import with_statement from django.db.models import Q, Sum from django.core.management.base import BaseCommand from django.core.exceptions import ObjectDoesNotExist from django.core.management.base import NoArgsCommand from django.contrib.auth.models import User import logging logger...
Python
0
e8389c211ef56869cd9c6c1177aa6a610a915aa2
Fix manifest and add format to properties
combine/manifest.py
combine/manifest.py
# Copyright (c) 2010 John Reese # Licensed under the MIT license import yaml from combine import CombineError MANIFEST_FORMAT = 1 class Manifest: def __init__(self): self.properties = {"manifest-format": MANIFEST_FORMAT} self.actions = [] def add_property(self, name, value): self.p...
# Copyright (c) 2010 John Reese # Licensed under the MIT license import yaml from combine import Change, CombineError MANIFEST_FORMAT = 1 class Manifest: def __init__(self): self.properties = {} self.actions = [] def add_property(self, name, value): self.properties[name] = value ...
Python
0
291f11c6325a1ae082845be81692bc64521eab7e
refactor create-kdtree script
py/legacypipe/create-kdtrees.py
py/legacypipe/create-kdtrees.py
import os from astrometry.libkd.spherematch import * from astrometry.util.fits import fits_table import numpy as np # This script creates the survey-ccd-*.kd.fits kd-trees from # survey-ccds-*.fits.gz (zeropoints) files # def create_kdtree(infn, outfn): readfn = infn # gunzip if infn.endswith('.gz'): ...
import os from astrometry.libkd.spherematch import * from astrometry.util.fits import fits_table import numpy as np # This script creates the survey-ccd-*.kd.fits kd-trees from # survey-ccds-*.fits.gz (zeropoints) files # indir = '/global/projecta/projectdirs/cosmo/work/legacysurvey/dr8/DECaLS/' outdir = '/global/cs...
Python
0.000004
7b746d2d4ae732ee1eae326254f3a6df676a7973
Add __str__ function for SgTable
components/table.py
components/table.py
"""A class to store tables.""" class SgTable: """A class to store tables.""" def __init__(self): self._fields = [] self._table = [] def __len__(self): return len(self._table) def __iter__(self): for row in self._table: yield row def __getitem__(self,...
"""A class to store tables.""" class SgTable: """A class to store tables.""" def __init__(self): self._fields = [] self._table = [] def __len__(self): return len(self._table) def __iter__(self): for row in self._table: yield row def __getitem__(self,...
Python
0.999052
8a45ca4dff9957a6fce07dfa067633fcd842bc51
Update cpp.py
conda/libdev/cpp.py
conda/libdev/cpp.py
import os from SCons.Defaults import Delete def generate(env): """Add Builders and construction variables to the Environment.""" if not 'cpp' in env['TOOLS'][:-1]: env.Tool('system') env.Tool('prefix') def BuildCpp(env, target, sources): # Code to build "target" from "...
import os from SCons.Defaults import Move def generate(env): """Add Builders and construction variables to the Environment.""" if not 'cpp' in env['TOOLS'][:-1]: env.Tool('system') env.Tool('prefix') def BuildCpp(env, target, sources): # Code to build "target" from "so...
Python
0.000001
e58b94f29888ac1c48bec77cb08fc90919c7720b
add filename attribute
src/twelve_tone/midi.py
src/twelve_tone/midi.py
from miditime.miditime import MIDITime class MIDIFile(object): def __init__(self, BPM=120, filename='example.mid'): self.pattern = MIDITime(BPM, filename) self.step_counter = 0 self.filename = filename def create(self, notes): midinotes = [] offset = 60 attack...
from miditime.miditime import MIDITime class MIDIFile(object): def __init__(self, BPM=120, filename='example.mid'): self.pattern = MIDITime(BPM, filename) self.step_counter = 0 def create(self, notes): midinotes = [] offset = 60 attack = 200 beats = 1 ...
Python
0.000002
70f0d321325f3a7d9966c11c39dfb2ef6ecea97e
add testcase for SNMPv3
scripts/cli/test_service_snmp.py
scripts/cli/test_service_snmp.py
#!/usr/bin/env python3 # # Copyright (C) 2019-2020 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as # published by the Free Software Foundation. # # This program is distributed in the h...
#!/usr/bin/env python3 # # Copyright (C) 2019-2020 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as # published by the Free Software Foundation. # # This program is distributed in the h...
Python
0.000004
aa46499c43bd7e4162dc657fa898b1df5e2dcee9
Exclude windows from extended ascii mode because travis is unhappy
src/compas/__main__.py
src/compas/__main__.py
# -*- coding: utf-8 -*- from __future__ import print_function import sys import pkg_resources import compas if __name__ == '__main__': c = 'DCDHDCACDHDCAEDEACDHDCAEDEACDHDCAEDCDEACDHDCADCACDEADHDCAEDADEACDHDADADADHDCACDCAEDEACDCACDHDCAEDEACDCAEDEACDCAEDBACDHDAEDEACDADADCAEDBADHDAGDEACDADEADCAEDEADHDBADEDCAEDEAC...
# -*- coding: utf-8 -*- from __future__ import print_function import sys import pkg_resources import compas if __name__ == '__main__': c = 'DCDHDCACDHDCAEDEACDHDCAEDEACDHDCAEDCDEACDHDCADCACDEADHDCAEDADEACDHDADADADHDCACDCAEDEACDCACDHDCAEDEACDCAEDEACDCAEDBACDHDAEDEACDADADCAEDBADHDAGDEACDADEADCAEDEADHDBADEDCAEDEAC...
Python
0
ee9646c5e71dcbaf776d9f9f929dead5e5c1fa82
Revert "cookie.value() didn't really need to be a string, since QSettings will take a QVariant anyways."
python/pyphantomjs/cookiejar.py
python/pyphantomjs/cookiejar.py
''' This file is part of the PyPhantomJS project. Copyright (C) 2011 James Roe <roejames12@hotmail.com> This program 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 ...
''' This file is part of the PyPhantomJS project. Copyright (C) 2011 James Roe <roejames12@hotmail.com> This program 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 ...
Python
0
1c8bd21fe895260254684d3e2b2f9f5b70fdb91f
Fix error msg
python/smurff/smurff/prepare.py
python/smurff/smurff/prepare.py
import numpy as np import scipy as sp import pandas as pd import scipy.sparse import numbers from .helper import SparseTensor def make_train_test(Y, ntest): """Splits a sparse matrix Y into a train and a test matrix. Y scipy sparse matrix (coo_matrix, csr_matrix or csc_matrix) ntest either a...
import numpy as np import scipy as sp import pandas as pd import scipy.sparse import numbers from .helper import SparseTensor def make_train_test(Y, ntest): """Splits a sparse matrix Y into a train and a test matrix. Y scipy sparse matrix (coo_matrix, csr_matrix or csc_matrix) ntest either a...
Python
0.000023
980b3eded1e06c8f152b873531273c1b0154a755
Update Visualization-commandCenter.py
dataCenter/Visualization-commandCenter.py
dataCenter/Visualization-commandCenter.py
import matplotlib.pyplot as plt; plt.rcdefaults() import numpy as np import matplotlib.pyplot as plt import pickle with open('firefox-bot/config/iframe.txt', 'r') as loginInfo: newName = loginInfo.readline() newName = newName.rstrip() def load_obj(name): with open(name + '.pkl', 'rb') as f: ...
import matplotlib.pyplot as plt; plt.rcdefaults() import numpy as np import matplotlib.pyplot as plt import pickle with open('firefox-bot/config/iframe.txt', 'r') as loginInfo: newName = loginInfo.readline() newName = newName.rstrip() def load_obj(name): with open(name + '.pkl', 'rb') as f: ...
Python
0
18be6e0d3ee656f150e54bc0abe3959d92e2b35c
add message for script completion to dashboard
cea/api.py
cea/api.py
""" Provide access to the scripts exported by the City Energy Analyst. """ from __future__ import print_function import datetime def register_scripts(): import cea.config import cea.scripts import importlib config = cea.config.Configuration() def script_wrapper(cea_script): module_path =...
""" Provide access to the scripts exported by the City Energy Analyst. """ from __future__ import print_function def register_scripts(): import cea.config import cea.scripts import importlib config = cea.config.Configuration() def script_wrapper(cea_script): module_path = cea_script.mod...
Python
0
ef5c049a4c32e69c9ce88c958ae8272bdfddeba4
Add area info in check price result
check_price.py
check_price.py
# -*- coding:utf-8 -*- import pymysql import pymysql.cursors from prettytable import PrettyTable from colorama import init, Fore import pdb database_name = "house_price_04" # 打开数据库连接 db=pymysql.connect("localhost","root","aB123456",database_name,charset='utf8mb4') # 使用cursor()方法获取操作游标 cursor=db.cursor() #输入要查询的小区名称 ...
# -*- coding:utf-8 -*- import pymysql import pymysql.cursors from prettytable import PrettyTable from colorama import init, Fore database_name = "house_price_04" # 打开数据库连接 db=pymysql.connect("localhost","root","aB123456",database_name,charset='utf8mb4') # 使用cursor()方法获取操作游标 cursor=db.cursor() #输入要查询的小区名称 check_name= ...
Python
0
864669eb606f0831c6503894c87c62ea3841654e
fix for HUnion
hwt/hdl/types/utils.py
hwt/hdl/types/utils.py
from typing import Union, List from hwt.hdl.types.array import HArray from hwt.hdl.types.bits import Bits from hwt.hdl.types.hdlType import HdlType from hwt.hdl.types.stream import HStream from hwt.hdl.types.struct import HStruct from hwt.hdl.types.typeCast import toHVal from hwt.hdl.types.union import HUnion from hwt...
from typing import Union, List from hwt.hdl.types.array import HArray from hwt.hdl.types.bits import Bits from hwt.hdl.types.hdlType import HdlType from hwt.hdl.types.stream import HStream from hwt.hdl.types.struct import HStruct from hwt.hdl.types.typeCast import toHVal from hwt.hdl.types.union import HUnion from hwt...
Python
0.000005
94dfdbeae55d4c47c7b1161c68795429ebc0687a
fix pprintInterface for unit with array intf
hwt/simulator/utils.py
hwt/simulator/utils.py
from random import Random import sys from hwt.serializer.serializerClases.indent import getIndent from hwt.synthesizer.interfaceLevel.interfaceUtils.proxy import InterfaceProxy from hwt.synthesizer.interfaceLevel.mainBases import InterfaceBase def valueHasChanged(valA, valB): return valA.val is not valB.val or v...
from random import Random import sys from hwt.serializer.serializerClases.indent import getIndent from hwt.synthesizer.interfaceLevel.interfaceUtils.proxy import InterfaceProxy def valueHasChanged(valA, valB): return valA.val is not valB.val or valA.vldMask != valB.vldMask def agent_randomize(agent, timeQuantu...
Python
0
222e2bf4728440fdff2675756b4aa08aba4585fb
Update __init__.py
app/__init__.py
app/__init__.py
from flask import Flask, render_template from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.moment import Moment from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.pagedown import PageDown from flask.ext.flatpages import FlatPages from config import config from .util import...
from flask import Flask, render_template from flask.ext.mail import Mail from flask.ext.login import LoginManager from flask.ext.moment import Moment from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.pagedown import PageDown from flask.ext.flatpages import FlatPages from config import config mail = Mail() mom...
Python
0.000072
690696493f110899282ad22f9b02d3d0fd91fe31
Rewrite wirecloud.catalogue.admin module
src/wirecloud/catalogue/admin.py
src/wirecloud/catalogue/admin.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of Wirecloud. # Wirecloud 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 versio...
# -*- coding: utf-8 -*- #...............................licence........................................... # # (C) Copyright 2008 Telefonica Investigacion y Desarrollo # S.A.Unipersonal (Telefonica I+D) # # This file is part of Morfeo EzWeb Platform. # # Morfeo EzWeb Platform is free software: you can ...
Python
0.000002
bc467365ebd287d96109ea0771403a10d3f56580
set upload limit
app/__init__.py
app/__init__.py
from flask import Flask from flask_bootstrap import Bootstrap from flask_mail import Mail from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_pagedown import PageDown from config import config import os import flask_sijax bootstrap = Bootstrap() mail ...
from flask import Flask from flask_bootstrap import Bootstrap from flask_mail import Mail from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_pagedown import PageDown from config import config import os import flask_sijax bootstrap = Bootstrap() mail ...
Python
0.000001
a2e5e2d5b75acafe5b1de0b92a9206a6a2ec4d25
Fix py36 unit tests
blazar/tests/api/test_root.py
blazar/tests/api/test_root.py
# Copyright (c) 2014 Bull. # # 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, sof...
# Copyright (c) 2014 Bull. # # 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, sof...
Python
0.000008
1bde8a92f47d49c6bea286a66fe89a3ccaca80a0
Fix for .env being loaded for manage.py commands
app/__init__.py
app/__init__.py
from flask import Flask from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_pagedown import PageDown bootstrap = Bootstrap() moment = Moment() db = SQLAlchemy() pagedown = PageDown() login_manager = LoginManager(...
from flask import Flask from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_pagedown import PageDown from config import config bootstrap = Bootstrap() moment = Moment() db = SQLAlchemy() pagedown = PageDown() log...
Python
0
cea50cbe5e0b16758c5eada3a16d121d2880c6ce
Fix PEP8 issue
i3pystatus/pomodoro.py
i3pystatus/pomodoro.py
import subprocess from datetime import datetime, timedelta from i3pystatus import IntervalModule STOPPED = 0 RUNNING = 1 BREAK = 2 class Pomodoro(IntervalModule): """ This plugin shows Pomodoro timer. Left click starts/restarts timer. Right click stops it. """ settings = ( ('sound...
import subprocess from datetime import datetime, timedelta from i3pystatus import IntervalModule STOPPED = 0 RUNNING = 1 BREAK = 2 class Pomodoro(IntervalModule): """ This plugin shows Pomodoro timer. Left click starts/restarts timer. Right click stops it. """ settings = ( ('sound...
Python
0
fb236951e1658beb32bd6dc45cf8d49a4636162a
Add tests for repr on tables
blaze/api/tests/test_table.py
blaze/api/tests/test_table.py
from blaze.api.table import Table, compute, table_repr from blaze.data.python import Python from blaze.compute.core import compute from blaze.compute.python import compute from datashape import dshape import pandas as pd data = (('Alice', 100), ('Bob', 200)) t = Table(data, columns=['name', 'amount']) def t...
from blaze.api.table import Table, compute, table_repr from blaze.data.python import Python from blaze.compute.core import compute from blaze.compute.python import compute from datashape import dshape data = (('Alice', 100), ('Bob', 200)) t = Table(data, columns=['name', 'amount']) def test_resources(): ...
Python
0.000005
a085573261c0ed69b6bcabc40c4914a1623dc757
Add link to FB
bot/app/buffer.py
bot/app/buffer.py
from buffpy import API from buffpy.managers.profiles import Profiles from spacelaunchnow import config hashtags = '''\n . . .⠀⠀ .⠀⠀ .⠀⠀ #SpaceLaunchNow #space #spacex #nasa #rocket #mars #aerospace #earth #solarsystem #iss #elonmusk #moonlanding #spaceshuttle #spacewalk #esa #science #picoftheday #blueorigin #Florida...
from buffpy import API from buffpy.managers.profiles import Profiles from spacelaunchnow import config hashtags = '''\n . . .⠀⠀ .⠀⠀ .⠀⠀ #SpaceLaunchNow #space #spacex #nasa #rocket #mars #aerospace #earth #solarsystem #iss #elonmusk #moonlanding #spaceshuttle #spacewalk #esa #science #picoftheday #blueorigin #Florida...
Python
0
d89252a2bbbe0677d2ad184f4c519e2b4d6ee9bd
Add JSON to data.
bot/serializer.py
bot/serializer.py
from bot.models import Launch, Notification, DailyDigestRecord from rest_framework import serializers class NotificationSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Notification fields = ( 'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '...
from bot.models import Launch, Notification, DailyDigestRecord from rest_framework import serializers class NotificationSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Notification fields = ( 'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '...
Python
0.000001
43a53981c3da2db8a4d06c883cd72442b72eb4be
Update spec_driven_model/tests/fake_mixin.py
spec_driven_model/tests/fake_mixin.py
spec_driven_model/tests/fake_mixin.py
# Copyright 2021 Akretion - Raphael Valyi <raphael.valyi@akretion.com> # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). from odoo import fields, models class PoXsdMixin(models.AbstractModel): _description = "Abstract Model for PO XSD" _name = "spec.mixin.poxsd" _field_prefix =...
# Copyright 2021 Akretion - Raphael Valyi <raphael.valyi@akretion.com> # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). from odoo import fields, models class PoXsdMixin(models.AbstractModel): _description = "Abstract Model for PO XSD" _name = "spec.mixin.poxsd" _field_prefix =...
Python
0
2934120b3743fac2b388eba19d8c0a22b44d8f0a
Update error message
tests/core/test_evaluation_parameters.py
tests/core/test_evaluation_parameters.py
from timeit import timeit import pytest from great_expectations.data_asset.evaluation_parameters import parse_evaluation_parameter from great_expectations.exceptions import EvaluationParameterError def test_parse_evaluation_parameter(): # Substitution alone is ok assert parse_evaluation_parameter("a", {"a":...
from timeit import timeit import pytest from great_expectations.data_asset.evaluation_parameters import parse_evaluation_parameter from great_expectations.exceptions import EvaluationParameterError def test_parse_evaluation_parameter(): # Substitution alone is ok assert parse_evaluation_parameter("a", {"a":...
Python
0
9b2cc65a792eb850d982653100ac948990904125
Display microseconds in integer decimal
appstats/filters.py
appstats/filters.py
# encoding: utf-8 import json def json_filter(value): return json.dumps(value) def count_filter(value): if value is None: return "" count = float(value) base = 1000 prefixes = [ ('K'), ('M'), ('G'), ('T'), ('P'), ('E'), ('Z'), ...
# encoding: utf-8 import json def json_filter(value): return json.dumps(value) def count_filter(value): if value is None: return "" count = float(value) base = 1000 prefixes = [ ('K'), ('M'), ('G'), ('T'), ('P'), ('E'), ('Z'), ...
Python
0.99978
f07a05f6a6edd0ef481dd9a24c1556b345fe7686
Remove attempt to import module that no longer exists
iati/tests/conftest.py
iati/tests/conftest.py
"""Configuration to exist in the global scope for pytest.""" import collections import pytest import iati.default import iati.resources import iati.tests.utilities import iati pytest_plugins = [ # name required by pytest # pylint: disable=invalid-name 'iati.tests.fixtures.comparison', 'iati.tests.fixtures.v...
"""Configuration to exist in the global scope for pytest.""" import collections import pytest import iati.default import iati.resources import iati.tests.utilities import iati pytest_plugins = [ # name required by pytest # pylint: disable=invalid-name 'iati.tests.fixtures.comparison', 'iati.tests.fixtures.u...
Python
0.000195
0c160c8e787a9019571f358b70633efa13cad466
Support for inbox.util.eas in the /inbox-eas repo; this is where EAS-specific util code would live.
inbox/util/__init__.py
inbox/util/__init__.py
""" Non-server-specific utility modules. These shouldn't depend on any code from the inbox module tree! Don't add new code here! Find the relevant submodule, or use misc.py if there's really no other place. """ # Allow out-of-tree submodules. from pkgutil import extend_path __path__ = extend_path(__path__,...
""" Non-server-specific utility modules. These shouldn't depend on any code from the inbox module tree! Don't add new code here! Find the relevant submodule, or use misc.py if there's really no other place. """
Python
0
6c28b693fdcf6a1dc481b486c6c6233ae08d72e1
exclude thread itself from duplicates search when saving edits
askapp/forms.py
askapp/forms.py
from snowpenguin.django.recaptcha2.fields import ReCaptchaField from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget from registration.forms import RegistrationFormTermsOfService from django.utils.translation import ugettext_lazy as _ from django import forms from .models import Profile, Thread, Post cla...
from snowpenguin.django.recaptcha2.fields import ReCaptchaField from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget from registration.forms import RegistrationFormTermsOfService from django.utils.translation import ugettext_lazy as _ from django import forms from .models import Profile, Thread, Post cla...
Python
0
933a082a76c6c9b72aaf275f45f0d155f66eeacf
Fix Python 3.3 calling another virtualenv as a subprocess.
asv/__init__.py
asv/__init__.py
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import sys if sys.version_info >= (3, 3): # OS X framework builds of Python 3.3 can not call other 3.3 # virtual...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals)
Python
0.000004
3eddbd56328e245a1f952dccbe38d121657640c3
Add ends_with flag to fabfile if we want it to end early.
auto/fabfile.py
auto/fabfile.py
from fabric.api import * from ssh_util import * from collections import OrderedDict import os, sys, json VERBOSE = False TASKS = [ ('local', ['dump_api']), ('remote', ['parse_api', '-m 8']), ('remote', ['scrape', '-m 8']), ('local', ['download']), ('remote', ['extract']), ('local', ['create_do...
from fabric.api import * from ssh_util import * from collections import OrderedDict import os, sys, json VERBOSE = False TASKS = [ ('local', ['dump_api']), ('remote', ['parse_api', '-m 8']), ('remote', ['scrape', '-m 8']), ('local', ['download']), ('remote', ['extract']), ('local', ['create_do...
Python
0
6535495c6bbe17122c86eb657243d675300cc382
add visit_Attribute to adjust numpy fns
autodiff/ast.py
autodiff/ast.py
import logging import meta import ast import numpy as np import theano import theano.tensor as T logger = logging.getLogger('pyautodiff') def istensor(x): tensortypes = (theano.tensor.TensorConstant, theano.tensor.TensorVariable) return isinstance(x, tensortypes) def isvar(x): varty...
import logging import meta import ast import numpy as np import theano import theano.tensor as T logger = logging.getLogger('pyautodiff') def istensor(x): tensortypes = (theano.tensor.TensorConstant, theano.tensor.TensorVariable) return isinstance(x, tensortypes) def isvar(x): varty...
Python
0
91ef2866d14348971326df39d7868ad5c424b64c
remove the 10 article limit that was used for testing
autoindex_sk.py
autoindex_sk.py
#!/usr/bin/env python3 import sys import csv from bs4 import BeautifulSoup import autoindex from rdflib import Graph, URIRef, Literal from rdflib.namespace import DC, DCTERMS, SKOS, XSD def autoindex_doc(text, url, title, date, author, place): g = Graph() uri = URIRef(url) g.add((uri, DCTERMS.title, Lit...
#!/usr/bin/env python3 import sys import csv from bs4 import BeautifulSoup import autoindex from rdflib import Graph, URIRef, Literal from rdflib.namespace import DC, DCTERMS, SKOS, XSD def autoindex_doc(text, url, title, date, author, place): g = Graph() uri = URIRef(url) g.add((uri, DCTERMS.title, Lit...
Python
0
5d21942823ea21a3c2eb38e43b4b8b4fa2ec2ac1
Allow mayday.us for CORS
backend/util.py
backend/util.py
"""General utilities.""" import urlparse import logging def ConstantTimeIsEqual(a, b): """Securely compare two strings without leaking timing information.""" if len(a) != len(b): return False acc = 0 for x, y in zip(a, b): acc |= ord(x) ^ ord(y) return acc == 0 # TODO(hjfreyer): Pull into some kin...
"""General utilities.""" import urlparse import logging def ConstantTimeIsEqual(a, b): """Securely compare two strings without leaking timing information.""" if len(a) != len(b): return False acc = 0 for x, y in zip(a, b): acc |= ord(x) ^ ord(y) return acc == 0 # TODO(hjfreyer): Pull into some kin...
Python
0
7e742489017bc444f496b1f4cf6ed391caf49ba2
allow enter to close change note type diag (#651)
aqt/modelchooser.py
aqt/modelchooser.py
# -*- coding: utf-8 -*- # Copyright: Damien Elmes <anki@ichi2.net> # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from aqt.qt import * from anki.hooks import addHook, remHook, runHook from aqt.utils import shortcut import aqt class ModelChooser(QHBoxLayout): def __init__(self, mw...
# -*- coding: utf-8 -*- # Copyright: Damien Elmes <anki@ichi2.net> # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from aqt.qt import * from anki.hooks import addHook, remHook, runHook from aqt.utils import shortcut import aqt class ModelChooser(QHBoxLayout): def __init__(self, mw...
Python
0
52873e4238a54cb93f403d509d2bebef8971ec9b
Work around deprecation warning with new cssutils versions.
django_assets/filter/cssutils/__init__.py
django_assets/filter/cssutils/__init__.py
import logging import logging.handlers from django.conf import settings from django_assets.filter import BaseFilter __all__ = ('CSSUtilsFilter',) class CSSUtilsFilter(BaseFilter): """Minifies CSS by removing whitespace, comments etc., using the Python `cssutils <http://cthedot.de/cssutils/>`_ l...
import logging import logging.handlers from django.conf import settings from django_assets.filter import BaseFilter __all__ = ('CSSUtilsFilter',) class CSSUtilsFilter(BaseFilter): """Minifies CSS by removing whitespace, comments etc., using the Python `cssutils <http://cthedot.de/cssutils/>`_ l...
Python
0
52d804aac69bceb9dee9c1b21044551b80bcdfdc
Fix handling default for `--output` option in `people_search` cmd.
linkedin_scraper/commands/people_search.py
linkedin_scraper/commands/people_search.py
from getpass import getpass from scrapy.commands.crawl import Command as BaseCommand def sanitize_query(query): return query.replace(' ', '+') class Command(BaseCommand): def short_desc(self): return "Scrap people from LinkedIn" def syntax(self): return "[options] <query>" def add...
from getpass import getpass from scrapy.commands.crawl import Command as BaseCommand def sanitize_query(query): return query.replace(' ', '+') class Command(BaseCommand): def short_desc(self): return "Scrap people from LinkedIn" def syntax(self): return "[options] <query>" def add...
Python
0
637b3c36e9a5952fc29ceaa705703e94f9f172d3
Update app_settings.py
django_project/wms_client/app_settings.py
django_project/wms_client/app_settings.py
# coding=utf-8 """Settings file for WMS Client. """ from django.conf import settings # Allow base django project to override settings default_leaflet_tiles = ( 'OpenStreetMap', 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', ('© <a href="http://www.openstreetmap.org" target="_parent">OpenStreetMa...
# coding=utf-8 """Settings file for WMS Client. """ from django.conf import settings # Allow base django project to override settings default_leaflet_tiles = ( 'OpenStreetMap', 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', ('© <a hr ef="http://www.openstreetmap.org" target="_parent">OpenStree...
Python
0.000002
cdb4f7088ba49c0e2b590d8b818226e4e59eb45e
Fix tests.
st2client/tests/unit/test_config_parser.py
st2client/tests/unit/test_config_parser.py
# coding=utf-8 # Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you...
# coding=utf-8 # Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you...
Python
0
4071c77a6e598c27f7a8b2195ff5e68332120615
Fix formatting.
st2common/st2common/cmd/validate_config.py
st2common/st2common/cmd/validate_config.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Python
0.000017
d35aed562b3c9eba6f7de7ac4aa7d6ad7723ec0a
Add listnener decos
cogs/cancer.py
cogs/cancer.py
from discord.ext.commands import Cog class Cancer(Cog): def __init__(self, bot): self.bot = bot self.ok_list = [198101180180594688, 246291440106340352] @Cog.listener async def on_member_join(self, member): if member.guild.id not in self.ok_list: return await me...
from discord.ext import commands class Cancer(commands.Cog): def __init__(self, bot): self.bot = bot self.ok_list = [198101180180594688, 246291440106340352] async def on_member_join(self, member): if member.guild.id not in self.ok_list: return await member.guild.sy...
Python
0
1b3c9e5f46f48865882f1087ced0ade168233711
fix formatting and caching
cogs/stonks.py
cogs/stonks.py
import discord import json from datetime import datetime from discord.ext import commands from utils.aiohttp_wrap import aio_get_json class Stonks(commands.Cog): URL = "https://finnhub.io/api/v1/quote" TTL = 60 * 15 def __init__(self, bot): self.bot = bot self.session = bot.aio_session ...
import discord import json from datetime import datetime from discord.ext import commands from utils.aiohttp_wrap import aio_get_json class Stonks(commands.Cog): URL = "https://finnhub.io/api/v1/quote" def __init__(self, bot): self.bot = bot self.session = bot.aio_session self.redis...
Python
0.000001
50e69a0d53dffbc961b865f583ca071dfb49648c
Reformat class
mediacloud/mediawords/util/sql.py
mediacloud/mediawords/util/sql.py
import time import datetime # noinspection PyPackageRequirements import dateutil.parser from mediawords.util.perl import decode_string_from_bytes_if_needed def get_sql_date_from_epoch(epoch: int) -> str: # Returns local date by default, no need to set timezone try: return datetime.datetime.fromtimes...
import time import datetime # noinspection PyPackageRequirements import dateutil.parser from mediawords.util.perl import decode_string_from_bytes_if_needed def get_sql_date_from_epoch(epoch: int) -> str: # Returns local date by default, no need to set timezone try: return datetime.datetime.fromtimes...
Python
0
b87711d62a1f2c4974f945625312d8a33ba91fb6
convert grp_members into a lambda and add usr_search lambda
code-samples/membersOfDomainGroup.py
code-samples/membersOfDomainGroup.py
#!/usr/bin/env python # print a list of members of a domain group param = { '-f': 'mail', # field name '-s': '\n', # separator } import getopt import ldap import re import sys try: param.update(dict(getopt.getopt(sys.argv[1:], 'g:f:s:')[0])) if '-g' not in param: sys.stderr.write("-g parameter is required\n")...
#!/usr/bin/env python # print a list of members of a domain group param = { '-f': 'mail', # field name '-s': '\n', # separator } import getopt import ldap import re import sys try: param.update(dict(getopt.getopt(sys.argv[1:], 'g:f:s:')[0])) if '-g' not in param: sys.stderr.write("-g parameter is required\n")...
Python
0.000032
1189a06433d1a38662124d5799eb2610c31d5100
remove commented out code
src/buzzfeed/clean_parsed_colombia.py
src/buzzfeed/clean_parsed_colombia.py
""" Script to clean the Colombia data from BuzzFeed Zika data repository Run this script from the root directory e.g., `~/git/vbi/zika_data_to_cdc' from there you can run `python src/buzfeed/clean_parsed_colombia.py` """ import os import sys import re import pandas as pd sys.path.append(os.getcwd()) import src.help...
""" Script to clean the Colombia data from BuzzFeed Zika data repository Run this script from the root directory e.g., `~/git/vbi/zika_data_to_cdc' from there you can run `python src/buzfeed/clean_parsed_colombia.py` """ import os import sys import re import pandas as pd sys.path.append(os.getcwd()) import src.help...
Python
0
f47ebbe4dcacdd0ef96799a5d11925e0a8b6d5d5
fix import path
test/test_resultset.py
test/test_resultset.py
from unittest import TestCase from statscraper import ResultSet from pandas.api import types as ptypes class TestResultSet(TestCase): def test_pandas_export(self): result = ResultSet() result.append({'city': "Voi", 'value': 45483}) df = result.pandas self.assertTrue(ptypes.is_num...
from unittest import TestCase from statscraper.base_scraper import ResultSet from pandas.api import types as ptypes class TestResultSet(TestCase): def test_pandas_export(self): result = ResultSet() result.append({'city': "Voi", 'value': 45483}) df = result.pandas self.assertTrue(...
Python
0.000007
cf5ad85a35824646a30d90de79d72f4068dade50
Fix failing QML test with Qt 5.9 due to assert
tests/QtQml/bug_557.py
tests/QtQml/bug_557.py
############################################################################# ## ## Copyright (C) 2016 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the test suite of PySide2. ## ## $QT_BEGIN_LICENSE:GPL-EXCEPT$ ## Commercial License Usage ## Licensees holding valid commercial ...
############################################################################# ## ## Copyright (C) 2016 The Qt Company Ltd. ## Contact: https://www.qt.io/licensing/ ## ## This file is part of the test suite of PySide2. ## ## $QT_BEGIN_LICENSE:GPL-EXCEPT$ ## Commercial License Usage ## Licensees holding valid commercial ...
Python
0
a5b034704b75496cd1357b66f5fe0bbabb27a114
Implement ``plot_tree`` method
astrodendro/plot.py
astrodendro/plot.py
import numpy as np class DendrogramPlotter(object): """ A class to plot a dendrogram object """ def __init__(self, dendrogram): # should we copy to ensure immutability? self.dendrogram = dendrogram self._cached_positions = None self.sort() def sort(self, sort_key...
import numpy as np class DendrogramPlotter(object): """ A class to plot a dendrogram object """ def __init__(self, dendrogram): # should we copy to ensure immutability? self.dendrogram = dendrogram self._cached_positions = None self.sort() def sort(self, sort_key...
Python
0.000029
5392bf25d16166162d53ddc1f063907d72444a92
add in new tests for new functionality
tests/cloudlet_test.py
tests/cloudlet_test.py
from cement.core import handler, hook from cement.utils import test from nepho import cli from nepho.cli.base import Nepho import nose class NephoTestApp(Nepho): class Meta: argv = [] config_files = [] # Test Cloudlet class a_TestNephoCloudlet(test.CementTestCase): app_class = NephoTestApp ...
from cement.core import handler, hook from cement.utils import test from nepho import cli from nepho.cli.base import Nepho import nose class NephoTestApp(Nepho): class Meta: argv = [] config_files = [] # Test Cloudlet class a_TestNephoCloudlet(test.CementTestCase): app_class = NephoTestApp ...
Python
0
2ddfb4f0f4f2de060399a6e5b519a7f4b788ace5
make it possible to show languages for selected values on a map
autotyp/adapters.py
autotyp/adapters.py
from sqlalchemy.orm import joinedload from clld.interfaces import IParameter, IValue, IIndex from clld.db.meta import DBSession from clld.db.models.common import ValueSet from clld.web.adapters.base import Index from clld.web.adapters.geojson import GeoJsonParameter from clld.web.maps import SelectedLanguagesMap cla...
from sqlalchemy.orm import joinedload from clld.interfaces import IParameter, ILanguage, IIndex from clld.db.meta import DBSession from clld.db.models.common import ValueSet from clld.web.adapters.base import Index from clld.web.adapters.geojson import GeoJsonParameter from clld.web.maps import SelectedLanguagesMap ...
Python
0
c80761c6a9ed668329891100e658c34a43f07891
Rename and improve assert_learning -> arp_cache_rtts
tests/devices_tests.py
tests/devices_tests.py
""" Devices tests """ from nose.tools import * from nose.plugins.skip import Skip, SkipTest from mininet.topo import LinearTopo from mininet.net import Mininet from mininet.util import dumpNodeConnections from mininet.log import setLogLevel from mininet.node import CPULimitedHost from mininet.link import TCLink from...
""" Devices tests """ from nose.tools import * from nose.plugins.skip import Skip, SkipTest from mininet.topo import LinearTopo from mininet.net import Mininet from mininet.util import dumpNodeConnections from mininet.log import setLogLevel from mininet.node import CPULimitedHost from mininet.link import TCLink from...
Python
0
e3d082588db63690a846007beb8ddd42ebd4144e
Include pages urls into the main url patterns
config/urls.py
config/urls.py
from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView from django.views import defaults as default_views urlpatterns = [ # Django Admin, use {% url 'admin:index' %} url...
from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView from django.views import defaults as default_views urlpatterns = [ # Django Admin, use {% url 'admin:index' %} url...
Python
0.000001
2f412d6d98e6b03c1e3997d6acb0d15cace12e28
remove trailing spaces
coopy/utils.py
coopy/utils.py
def method_or_none(instance, name): method = getattr(instance, name) if (name[0:2] == '__' and name[-2,:] == '__') or \ not callable(method) : return None return method def action_check(obj): return (hasattr(obj, '__readonly'), hasattr(obj, '__unl...
def method_or_none(instance, name): method = getattr(instance, name) if (name[0:2] == '__' and name[-2,:] == '__') or \ not callable(method) : return None return method def action_check(obj): return (hasattr(obj, '__readonly'), hasattr(obj...
Python
0.999463
919a4f183e9a09ded7cf6272f9be300f22408c08
fix method or none method name comparison
coopy/utils.py
coopy/utils.py
def method_or_none(instance, name): method = getattr(instance, name) if (name[0:2] == '__' and name[-2:] == '__') or \ not callable(method) : return None return method def action_check(obj): return (hasattr(obj, '__readonly'), hasattr(obj, '__unlo...
def method_or_none(instance, name): method = getattr(instance, name) if (name[0:2] == '__' and name[-2,:] == '__') or \ not callable(method) : return None return method def action_check(obj): return (hasattr(obj, '__readonly'), hasattr(obj, '__unl...
Python
0.000002
b59f21ee28cc8eaf56cbc49fd7926e243e92276f
Fix bug for users with Space inside their usernames.
core/models.py
core/models.py
from django.core.exceptions import AppRegistryNotReady from django.core.urlresolvers import reverse_lazy from django.conf import settings from django.db import models from django.db.models.signals import post_save, pre_save from django.utils.translation import ugettext as _ class Profile(models.Model): about_me =...
from django.core.exceptions import AppRegistryNotReady from django.core.urlresolvers import reverse_lazy from django.conf import settings from django.db import models from django.db.models.signals import post_save from django.utils.translation import ugettext as _ class Profile(models.Model): about_me = models.Te...
Python
0
b1eb69620bbe875d117498ed95e009a019e54fab
Fix vote app URL patterns
votes/urls.py
votes/urls.py
from django.conf.urls import include, url from django.views.generic import TemplateView from votes.views import VoteView, results, system_home urlpatterns = [ url(r'^$', system_home, name="system"), url(r'^(?P<vote_name>[\w-]+)/$', VoteView.as_view(), name="vote"), url(r'^(?P<vote_name>[\w-]+)/results/$'...
from django.conf.urls import include, url from django.views.generic import TemplateView from votes.views import VoteView, results, system_home urlpatterns = [ url(r'^$', system_home, name="system"), url(r'^(?P<vote_name>[\w-]+)$', VoteView.as_view(), name="vote"), url(r'^(?P<vote_name>[\w-]+)/results$', ...
Python
0.000002
1d0b114c7e918c87e14d9ea7a7c49cb9120db68b
Bump version (#128)
vt/version.py
vt/version.py
"""Defines VT release version.""" __version__ = '0.17.3'
"""Defines VT release version.""" __version__ = '0.17.2'
Python
0
1034699a21dc0cf4862624d076d487deae7df9e2
add NullHandler to avoid "no handlers could be found" error.
Lib/fontTools/__init__.py
Lib/fontTools/__init__.py
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * import logging # add a do-nothing handler to the libary's top-level logger, to avoid # "no handlers could be found" error if client doesn't configure logging log = logging.getLogger(__name__) log.addHandler(logging.NullH...
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * version = "3.0"
Python
0
44620b2fa69500e1cada5622fa96eedd9c931006
Add test for MessageBeep()
Lib/test/test_winsound.py
Lib/test/test_winsound.py
# Ridiculously simple test of the winsound module for Windows. import winsound, time for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!" winsound.MessageBeep() time.sleep(0.5) winsound.MessageBeep(winsound.MB_OK) time.sleep(0.5) winsound.MessageBeep...
# Ridiculously simple test of the winsound module for Windows. import winsound for i in range(100, 2000, 100): winsound.Beep(i, 75) print "Hopefully you heard some sounds increasing in frequency!"
Python
0
df77f4de261e3f21cc95f56fbb4dd738c02a2dd1
Put all test metrics on the same row of the dataframe.
src/graph_world/models/benchmarker.py
src/graph_world/models/benchmarker.py
import json import os from abc import ABC, abstractmethod import apache_beam as beam import gin import pandas as pd class Benchmarker(ABC): def __init__(self): self._model_name = '' def GetModelName(self): return self._model_name # Train and test the model. # Arguments: # * element: output of t...
import json import os from abc import ABC, abstractmethod import apache_beam as beam import gin import pandas as pd class Benchmarker(ABC): def __init__(self): self._model_name = '' def GetModelName(self): return self._model_name # Train and test the model. # Arguments: # * element: output of t...
Python
0
886105ba5f4a8b53fbf5a39f7cb3dc48ce544a3a
add total days check
cgi-bin/oa-gdd.py
cgi-bin/oa-gdd.py
#!/usr/bin/python """ Produce a OA GDD Plot, dynamically! $Id: $: """ import sys, os sys.path.insert(0, '/mesonet/www/apps/iemwebsite/scripts/lib') os.environ[ 'HOME' ] = '/tmp/' os.environ[ 'USER' ] = 'nobody' import iemplot import cgi import datetime import network import iemdb COOP = iemdb.connect('coop', bypass=Tr...
#!/usr/bin/python """ Produce a OA GDD Plot, dynamically! $Id: $: """ import sys, os sys.path.insert(0, '/mesonet/www/apps/iemwebsite/scripts/lib') os.environ[ 'HOME' ] = '/tmp/' os.environ[ 'USER' ] = 'nobody' import iemplot import cgi import datetime import network import iemdb COOP = iemdb.connect('coop', bypass=Tr...
Python
0.000006
53a86e2318256e6edcca3d1e4ce2981a29bd8208
Add flask-email configs
web/config.py
web/config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class BaseConfiguration(object): DEBUG = False TESTING = False ADMINS = frozenset(['youremail@yourdomain.com']) SECRET_KEY = 'SecretKeyForSessionSigning' THREADS_PER_PAGE = 8 DATABASE = 'app.db' DATABASE_PATH = os.path.join(...
import os basedir = os.path.abspath(os.path.dirname(__file__)) class BaseConfiguration(object): DEBUG = False TESTING = False ADMINS = frozenset(['youremail@yourdomain.com']) SECRET_KEY = 'SecretKeyForSessionSigning' THREADS_PER_PAGE = 8 DATABASE = 'app.db' DATABASE_PATH = os.path.join(...
Python
0.000001
d08012b044e7340ce7f8c41ce5634d72f40de35d
Update test_server.py
server-functional/test_server.py
server-functional/test_server.py
import requests import unittest import json import logging import zlib import sys from colorama import init, Fore, Back, Style logger = logging.getLogger('test_server') ENDPOINT = "you_forgot_to_provide_the_endpoint_as_the_first_command_line_argument" class TestErrorHandling(unittest.TestCase): def check_parsable_b...
import requests import unittest import json import logging logger = logging.getLogger('test_server') ENDPOINT = "http://localhost:8801/api" class TestErrorHandling(unittest.TestCase): def check_parsable_but_not_ok(self): try: self.assertNotEqual(self.resp.json()["status"], "OK") except Exception as e: log...
Python
0.000003
ff2958c25812fb9486e8611e44c93ba32b737866
migrate res.company object to new API
l10n_br_stock_account/res_company.py
l10n_br_stock_account/res_company.py
# -*- encoding: utf-8 -*- ############################################################################### # # # Copyright (C) 2011 Renato Lima - Akretion # # ...
# -*- encoding: utf-8 -*- ############################################################################### # # # Copyright (C) 2011 Renato Lima - Akretion # # ...
Python
0
5000eea27c511ad036f03b64e2be7dc69bac0845
Add `JSONField`
jacquard/odm/fields.py
jacquard/odm/fields.py
import abc import copy class BaseField(object, metaclass=abc.ABCMeta): def __init__(self, null=False, default=None): self.null = null self.default = default @abc.abstractmethod def transform_to_storage(self, value): raise NotImplementedError() @abc.abstractmethod def tran...
import abc class BaseField(object, metaclass=abc.ABCMeta): def __init__(self, null=False, default=None): self.null = null self.default = default @abc.abstractmethod def transform_to_storage(self, value): raise NotImplementedError() @abc.abstractmethod def transform_from_s...
Python
0
aa3a8ee76f85ef1c3c4c0beb7b6c46a0c69961f1
allow absent of tornado
http2/__init__.py
http2/__init__.py
# -*- coding: utf-8 -*- try: from tornado import version_info except ImportError: pass else: if version_info[0] >= 4: from http2.torando4 import *
# -*- coding: utf-8 -*- from tornado import version_info if version_info[0] >= 4: from http2.torando4 import * else: raise NotImplementedError()
Python
0.000096
ea1fbd21761b5fbe60f179988114320dcb93cf92
remove unused attr
benchbuild/extensions/base.py
benchbuild/extensions/base.py
""" Extension base-classes for compile-time and run-time experiments. """ import collections as c import logging import typing as tp from abc import ABCMeta from benchbuild.utils import run LOG = logging.getLogger(__name__) class Extension(metaclass=ABCMeta): """An experiment functor to implement composable exp...
""" Extension base-classes for compile-time and run-time experiments. """ import collections as c import logging import typing as tp from abc import ABCMeta import attr from benchbuild.utils import run LOG = logging.getLogger(__name__) class Extension(metaclass=ABCMeta): """An experiment functor to implement c...
Python
0.000018
50b7345c1dcb3c2fcc05fa61108fa1649ae17a0c
Add admin filters
django_iceberg/admin.py
django_iceberg/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from django_iceberg.models import UserIcebergModel class UserIcebergModelAdmin(admin.ModelAdmin): list_display = ('user', 'environment', 'last_updated', 'application_namespace') list_filter = ('environment', 'last_updated') search_fields = ('user_...
# -*- coding: utf-8 -*- from django.contrib import admin from django_iceberg.models import UserIcebergModel class UserIcebergModelAdmin(admin.ModelAdmin): list_display = ('user', 'environment', 'last_updated', 'application_namespace') raw_id_fields = ("user",) admin.site.register(UserIcebergModel, UserIc...
Python
0
019a1ab10b71d4bb768e96957e9d485efeb588fc
add admin class for Attachment model --- djangobb_forum/admin.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
djangobb_forum/admin.py
djangobb_forum/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from django.contrib.auth import admin as auth_admin from django.contrib.auth.models import User from djangobb_forum.models import Category, Forum, Topic, Post, Profile, Reputation, \ Report, Ban, Attachment class CategoryAdmin(admin.ModelAdmin): list_d...
# -*- coding: utf-8 -*- from django.contrib import admin from django.contrib.auth import admin as auth_admin from django.contrib.auth.models import User from djangobb_forum.models import Category, Forum, Topic, Post, Profile, Reputation,\ Report, Ban class CategoryAdmin(admin.ModelAdmin): list_display = ['na...
Python
0
8a6b88c38b2844fba03b6664fe828ebbd5a08a68
use pkdlog so it passes test for pkdp
tests/pkdebug2_test.py
tests/pkdebug2_test.py
# -*- coding: utf-8 -*- u"""pytest for `pykern.pkdebug` :copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function def test_format(capsys): from pykern import pkconfig ...
# -*- coding: utf-8 -*- u"""pytest for `pykern.pkdebug` :copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function def test_format(capsys): from pykern import pkconfig ...
Python
0
db4b63ee097116c5be711d1b6a69100065f1a885
update format unicode
weby/utils.py
weby/utils.py
# coding=utf8 from datetime import datetime, date import json def format_dic(dic): """将 dic 格式化为 JSON,处理日期等特殊格式""" for key, value in dic.iteritems(): dic[key] = format_value(value) return dic def format_value(value, include_fields=[], is_compact=True): if isinstance(value, dict): re...
# coding=utf8 from datetime import datetime, date def format_dic(dic): """将 dic 格式化为 JSON,处理日期等特殊格式""" for key, value in dic.iteritems(): dic[key] = format_value(value) return dic def format_value(value): if isinstance(value, dict): return format_dic(value) elif isinstance(valu...
Python
0.000009
72df56880ffaf0aba3b6f919d5a7f2add32623dc
Update binary_clock.py
binary_clock.py
binary_clock.py
__author__ = 'tim mcguire' import datetime import math import Tkinter import sys,os def to_binary(dec, width): x = width - 1 answer = "" while x >= 0: current_power = math.pow(2, x) # how many powers of two fit into dec? how_many = int(dec / current_power) answer += str(how...
__author__ = 'tim mcguire' import datetime import math import Tkinter import sys,os def to_binary(dec, width): x = width - 1 answer = "" while x >= 0: current_power = math.pow(2, x) # how many powers of two fit into dec? how_many = int(dec / current_power) answer += str(how...
Python
0.000002
36ca52e816a2938c6723e3ec2ed4a350958c78d8
remove comments
binary_clock.py
binary_clock.py
__author__ = 'tim mcguire' import datetime import math import Tkinter def to_binary(dec, width): x = width - 1 answer = "" while x >= 0: current_power = math.pow(2, x) # how many powers of two fit into dec? how_many = int(dec / current_power) answer += str(how_many) ...
__author__ = 'tim mcguire' import datetime import math import Tkinter def to_binary(dec, width): x = width - 1 answer = "" while x >= 0: current_power = math.pow(2, x) # how many powers of two fit into dec? how_many = int(dec / current_power) answer += str(how_many) ...
Python
0
e59d6be5a31dbe775f6481d079f0f4e81a27a9ce
Add import of the re module to the utils module
classyfd/utils.py
classyfd/utils.py
""" Contains utility functions used within this library that are also useful outside of it. """ import os import pwd import string import random import re # Operating System Functions def determine_if_os_is_posix_compliant(): """ Determine if the operating system is POSIX compliant or not Return V...
""" Contains utility functions used within this library that are also useful outside of it. """ import os import pwd import string import random # Operating System Functions def determine_if_os_is_posix_compliant(): """ Determine if the operating system is POSIX compliant or not Return Value: ...
Python
0
00e865178f8e1762e7cd1ec8d44713d73cc58c47
tidy up of DynTypedNode in python
clast/__init__.py
clast/__init__.py
import _clast from _clast import * def __get(self, kind): return getattr(self, '_get_' + kind.__name__)() # Monkey patch an extra method on that we can't do in C++ _clast.DynTypedNode.get = __get
import _clast from _clast import * ## REPRESENTATIVE CLASSES ONLY def cxxRecordDecl(*args): return _clast._cxxRecordDecl(list(args)) def decl(*args): return _clast._decl(list(args)) def stmt(*args): return _clast._stmt(list(args)) def forStmt(*args): return _clast._forStmt(list(args)) def hasLoopI...
Python
0.000001
a3ad232c3f9734e94ed09088b260ff7f6bd722d7
Fix wordExists()
Library.py
Library.py
import dataset import re from Generator import generateWord db = None phonemes = {} allophones = {} declensions = {} categories = {} def transcribePhonemes(word): '''Transcribe from orthographic representation to phonetic representation. ''' for current, new in phonemes.items(): word = re.su...
import dataset import re from Generator import generateWord db = None phonemes = {} allophones = {} declensions = {} categories = {} def transcribePhonemes(word): '''Transcribe from orthographic representation to phonetic representation. ''' for current, new in phonemes.items(): word = re.su...
Python
0.001251
da1fc79f8eb476f7ed22d7969a1558ab6a1e3f5d
Use a name for the fabricated type that makes clearer it is fabricated
src/zeit/cms/content/add.py
src/zeit/cms/content/add.py
# Copyright (c) 2009 gocept gmbh & co. kg # See also LICENSE.txt import datetime import grokcore.component as grok import urllib import zeit.cms.content.interfaces import zeit.cms.repository.interfaces import zope.browser.interfaces import zope.component import zope.interface class ContentAdder(object): zope.in...
# Copyright (c) 2009 gocept gmbh & co. kg # See also LICENSE.txt import datetime import grokcore.component as grok import urllib import zeit.cms.content.interfaces import zeit.cms.repository.interfaces import zope.browser.interfaces import zope.component import zope.interface class ContentAdder(object): zope.in...
Python
0.000018
a4db65ff4c5b3edd4739b0864f4e1641b37b3b87
Remove wrong comment
setuptools/tests/test_logging.py
setuptools/tests/test_logging.py
import inspect import logging import os import pytest setup_py = """\ from setuptools import setup setup( name="test_logging", version="0.0" ) """ @pytest.mark.parametrize( "flag, expected_level", [("--dry-run", "INFO"), ("--verbose", "DEBUG")] ) def test_verbosity_level(tmp_path, monkeypatch, flag, e...
import inspect import logging import os import pytest setup_py = """\ from setuptools import setup setup( name="test_logging", version="0.0" ) """ @pytest.mark.parametrize( "flag, expected_level", [("--dry-run", "INFO"), ("--verbose", "DEBUG")] ) def test_verbosity_level(tmp_path, monkeypatch, flag, e...
Python
0
ef4e84d2defbf4899f0a1745fce5162e2510c1f7
test "merge-patches --help"
rhcephpkg/tests/test_merge_patches.py
rhcephpkg/tests/test_merge_patches.py
import pytest import subprocess from rhcephpkg import MergePatches from rhcephpkg.tests.util import CallRecorder def git(*args): """ shortcut for shelling out to git """ cmd = ['git'] + list(args) subprocess.check_call(cmd) class TestMergePatches(object): def test_help(self, capsys): mergep...
import pytest import subprocess from rhcephpkg import MergePatches from rhcephpkg.tests.util import CallRecorder def git(*args): """ shortcut for shelling out to git """ cmd = ['git'] + list(args) subprocess.check_call(cmd) class TestMergePatches(object): def test_on_debian_branch(self, testpkg, mo...
Python
0.000001