commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
29cebab613c483147fa2c10cf024c05269f64fe4 | Fix bug in setup_relative_calculation script where setup_dict was erroneously used instead of setup_options | scripts/setup_relative_calculation.py | scripts/setup_relative_calculation.py | import yaml
from perses.dispersed import relative_setup
import numpy as np
import pickle
import progressbar
import os
import sys
import logging
from simtk import unit
logging.basicConfig(level=logging.DEBUG)
if __name__ == "__main__":
try:
yaml_filename = sys.argv[1]
except IndexError as e:
yam... | Python | 0 | @@ -965,16 +965,75 @@
mplete%22)
+%0A print('setup_dict keys: %7B%7D'.format(setup_dict.keys()))
%0A%0A n_
@@ -1065,20 +1065,23 @@
= setup_
-dict
+options
%5B'n_equi
@@ -4347,8 +4347,9 @@
vent'%5D))
+%0A
|
ed00bc79d18ccaf40b6c5f3e325e8202ed0f2e77 | Add necessary setting to support feature | isort/settings.py | isort/settings.py | """isort/settings.py.
Defines how the default settings for isort should be loaded
(First from the default setting dictionary at the top of the file, then overridden by any settings
in ~/.isort.conf if there are any)
Copyright (C) 2013 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any per... | Python | 0 | @@ -4974,16 +4974,54 @@
': False
+,%0A 'lines_after_imports': -1
%7D%0A%0A%0A@lru
|
56f24e52f961da414f0610e6bd815812b4a14ef6 | Update utils.py | classifier/utils.py | classifier/utils.py | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Python | 0.000001 | @@ -1497,32 +1497,86 @@
for line in f:%0A
+ if len(line.rstrip('%5Cn').split('%5Ct')) == 3:%0A
source, su
@@ -1612,32 +1612,36 @@
n').split('%5Ct')%0A
+
yield %5Bsou
|
a0e1d0c557e37d5a1a76e349c3a75a3ba32e102c | Add fixed width for textbox | src/aerial_autonomy/aerial_autonomy_gui.py | src/aerial_autonomy/aerial_autonomy_gui.py | #!/usr/bin/env python
"""
@package aerial_autonomy GUI source code
to provide user the ability to
trigger events from GUI to state machine
@package aerial_autonomy.aerial_autonomy_gui
Generate a GUI to trigger events for state machine
@author: gowtham
"""
import argparse
import sip
from qt_gui.plugin import Plugin
fr... | Python | 0.000001 | @@ -7934,8 +7934,63 @@
) + 10)%0A
+ text_box.setFixedWidth(doc_size.width()+6)%0A
|
c28112624b3c735c610f756a6bff1497e9516c64 | Revise naive alg to more intuitive one: separate checking index and value | alg_find_peak_1D.py | alg_find_peak_1D.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def find_peak_naive(arr):
"""Find peak by naive iteration.
Time complexity: O(n).
"""
for i in range(len(arr)):
if i == 0 and arr[i] > arr[i + 1]:
return arr[i]
eli... | Python | 0.000016 | @@ -250,20 +250,32 @@
f i == 0
- and
+:%0A if
arr%5Bi%5D
@@ -284,24 +284,28 @@
arr%5Bi + 1%5D:%0A
+
@@ -350,20 +350,32 @@
rr) - 1)
- and
+:%0A if
arr%5Bi%5D
@@ -384,24 +384,28 @@
arr%5Bi - 1%5D:%0A
+
@@ -432,39 +432,11 @@
el
-if (0 %3C i %3C (len(ar... |
8a44ec213272536d59d16118e2a13c533299242e | fix missing = in SystemCSerializer | hwt/serializer/systemC/serializer.py | hwt/serializer/systemC/serializer.py | from jinja2.environment import Environment
from jinja2.loaders import PackageLoader
from hwt.hdlObjects.types.enum import Enum
from hwt.hdlObjects.types.enumVal import EnumVal
from hwt.serializer.generic.serializer import GenericSerializer
from hwt.serializer.serializerClases.nameScope import LangueKeyword
from hwt.se... | Python | 0.001621 | @@ -1180,16 +1180,18 @@
witchStm
+ =
env.get
|
d767b5990a088fa3fe45639873f2034fd25cb044 | update precision of accuracy displayed in weight file name | all_cnn_96/train.py | all_cnn_96/train.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
from argparse import ArgumentParser
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, CSVLogger, LearningRateScheduler
from net import IMG_SIZE_DEFAULT, BETA_DEFAULT, KERNEL_SIZE_DEFAULT, NB_FILTERS_DEFAULT
from utils import prepare_dirs, load... | Python | 0 | @@ -3498,17 +3498,17 @@
al_acc:.
-2
+4
f%7D.h5').
|
60d2c4142aae168c0b079e94d45529c14d387e1d | Fix in the case of no parent node | hyperstream/channels/base_channel.py | hyperstream/channels/base_channel.py | # The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... | Python | 0.020588 | @@ -5427,18 +5427,24 @@
-if
+stream =
self.st
@@ -5459,16 +5459,102 @@
ream_id%5D
+%0A if not stream.parent_node:%0A continue%0A if stream
.parent_
|
dbec204b242ab643de162046ba73dca32043c6c2 | Implement __getattr__ to reduce code | space-age/space_age.py | space-age/space_age.py | class SpaceAge(object):
def __init__(self, seconds):
self.seconds = seconds
@property
def years(self):
return self.seconds/31557600
def on_earth(self):
return round(self.years, 2)
def on_mercury(self):
return round(self.years/0.2408467, 2)
def on_venus(self):
... | Python | 0.99731 | @@ -25,587 +25,513 @@
-def __init__(self, seconds):%0A self.seconds = seconds%0A%0A @property%0A def years(self):%0A return self.seconds/31557600%0A%0A def on_earth(self):%0A return round(self.years, 2)%0A%0A def on_mercury(self):%0A return round(self.years/0.2408467, 2)%0A... |
a28bb36aeb887d11b9cf8391e03264a81b40b84a | add base entity construct | sparc/entity/entity.py | sparc/entity/entity.py | from BTrees.OOBTree import OOBTree
from zope.annotation.interfaces import IAnnotations
from zope.annotation.interfaces import IAnnotatable
from zope.annotation.interfaces import IAttributeAnnotatable
from zope.component import adapts
from zope.component.factory import Factory
from zope.interface import implements
from ... | Python | 0.000001 | @@ -312,32 +312,8 @@
nts%0A
-from zope import schema%0A
from
@@ -566,16 +566,155 @@
seTags%0A%0A
+class BaseSchemaObject(object):%0A def __init__(self, **kwargs):%0A for k, v in kwargs.iteritems():%0A setattr(self, k, v)%0A%0A
class Sp
|
2732ac448d6a31678629324dc47f89a33ecd261b | Manage service choicefield display in inline form | billjobs/admin.py | billjobs/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from .models import Bill, BillLine, Service, UserProfile
class BillLineInline(admin.TabularIn... | Python | 0 | @@ -1,24 +1,80 @@
+from django import forms%0Afrom django.db.models import Q%0A
from django.contrib impo
@@ -78,24 +78,24 @@
mport admin%0A
-
from django.
@@ -329,24 +329,576 @@
serProfile%0A%0A
+class BillLineInlineForm(forms.ModelForm):%0A def __init__(self, *args, **kwargs):%0A super(BillLineInlineForm... |
8b275ccb96b8fe3c2c3919e11f08e988219a1e14 | Add the process PID in the logs | src/diamond/utils/log.py | src/diamond/utils/log.py | # coding=utf-8
import logging
import logging.config
import sys
import os
class DebugFormatter(logging.Formatter):
def __init__(self, fmt=None):
if fmt is None:
fmt = '%(created)s\t[%(processName)s:%(levelname)s]\t%(message)s'
self.fmt_default = fmt
self.fmt_prefix = fmt.repla... | Python | 0.000001 | @@ -187,16 +187,17 @@
fmt =
+(
'%25(creat
@@ -202,16 +202,40 @@
ated)s%5Ct
+' +%0A '
%5B%25(proce
@@ -245,16 +245,28 @@
ame)s:%25(
+process)d:%25(
levelnam
@@ -271,16 +271,40 @@
ame)s%5D%5Ct
+' +%0A '
%25(messag
@@ -299,32 +299,33 @@
'%25(message)s'
+)
%0A self... |
d2917cb2131b9b08fa6457b195606fcc0220eef1 | Fix X509 construcor | ctypescrypto/x509.py | ctypescrypto/x509.py | from ctypes import c_void_p
from ctypescrypto.bio import Membio
from ctypescrypto.pkey import PKey
from ctypescrypto.oid import Oid
from ctypescrypto.exception import LibCryptoError
from ctypescrypto import libcrypto
class X509Error(LibCryptoError):
pass
class X509Name:
def __init__(self,ptr):
self.ptr=ptr
def ... | Python | 0.000018 | @@ -1480,16 +1480,24 @@
uired%22)%0A
+%09%09else:%0A
%09%09%09b=Mem
|
97dde187c6e660a517639475f95565907db3eec4 | Fix test. | test_check_blockers.py | test_check_blockers.py | from unittest import TestCase
from mock import Mock, patch
import check_blockers
JUJUBOT_USER = {'login': 'jujubot', 'id': 7779494}
OTHER_USER = {'login': 'user', 'id': 1}
class CheckBlockers(TestCase):
def test_parse_args(self):
args = check_blockers.parse_args(['master', '17'])
self.assertEq... | Python | 0.000001 | @@ -5869,26 +5869,24 @@
= %5B
-%22%7B%5C
+'%7B
%22result
-%5C%22
%22: %5B%5D%7D
+'
%5D%0A
|
419db3c559d836d6ba77c758212a55051e6c8fab | Add FIXME for module as function arg | test_obj_dict_tools.py | test_obj_dict_tools.py | from obj_dict_tools import *
from nose.tools import raises
@dict_fields(['name', 'size'])
class Simple:
def __init__(self, name=None, size=None):
self.name = name
self.size = size
@dict_fields(['first', 'second'])
class Pair:
def __init__(self, first=None, second=None):
self.first ... | Python | 0 | @@ -625,16 +625,77 @@
': 100%7D%0A
+ # FIXME: Explicitly passing in a module is undesirable. %0A
s =
|
b6f57d8aaeff8f85c89c381b972113810a468412 | use lat, lon | models.py | models.py | from random import choice, randint
import urllib2, json
from pushbullet import PushBullet
from os import environ
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, geocoded_ip, mandrill):
ip = ip
latitude = form.get... | Python | 0.000137 | @@ -581,21 +581,16 @@
_ip%5B'lat
-itude
'%5D%0A
@@ -620,22 +620,16 @@
_ip%5B'lon
-gitude
'%5D%0A%0A
|
a0f96b2b25d309c8934ffe9a197f3d66c9097b52 | replace phone to email for privacy | models.py | models.py | from app import db
from datetime import datetime
class Profile(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
gender = db.Column(db.String(1))
age = db.Column(db.Integer())
description = db.Column(db.String(300))
date = db.Column(db.DateTim... | Python | 0.000189 | @@ -238,16 +238,66 @@
eger())%0A
+ email = db.Column(db.String(50), unique=True)%0A
desc
|
ab331ab886a024f73fb7de4a8448d99c096a638c | Add .dev suffix and bump to next version. | haiku/__init__.py | haiku/__init__.py | # Copyright 2019 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 required by ... | Python | 0.000007 | @@ -4337,17 +4337,21 @@
= %220.0.
-3
+4.dev
%22%0A%0A__all
|
d0c4e48268af96bf809118529132254e050eeabd | Fix dataclass_json docstring (#201) | dataclasses_json/api.py | dataclasses_json/api.py | import abc
import json
from enum import Enum
from typing import (Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar,
Union)
from stringcase import (camelcase, pascalcase, snakecase,
spinalcase) # type: ignore
from dataclasses_json.cfg import config
from dataclasses_... | Python | 0 | @@ -4374,17 +4374,17 @@
e=Letter
-c
+C
ase.CAME
|
7a1be98a80104c01c6262502307d1cdee3d21a5e | Fix event change streaming when start/end times change | models.py | models.py | import secrets
from os import environ
import dateutil.parser
import pytz
import sqlalchemy
from sqlalchemy import create_engine, Column, Integer, String, TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.inspection import inspect
... | Python | 0.000001 | @@ -3183,16 +3183,17 @@
if '
+_
start_ti
@@ -3211,16 +3211,17 @@
ges or '
+_
end_time
|
ebfc34686ab893b4b84b4cd810e18213123dc1ee | remove comment | datajoint/connection.py | datajoint/connection.py | """
This module hosts the Connection class that manages the connection to the mysql database,
and the `conn` function that provides access to a persistent connection in datajoint.
"""
import warnings
from contextlib import contextmanager
import pymysql as client
import logging
from . import config
from . import DataJ... | Python | 0 | @@ -4389,31 +4389,8 @@
gs)
-# TODO insert reconnect
%0A
|
9c8bde1e57ad2e70c7b3b9188bff9b90e85434e6 | Send email and push | models.py | models.py | from random import choice
import urllib2, json
from pushbullet import PushBullet
'''
Checks if the current login attempt is a security threat or not.
Performs the required action in each case
'''
def is_safe(form, ip, mandrill):
ip = ip
geo = form.get('geo', None)
os = form.get('os', None)... | Python | 0 | @@ -18,16 +18,25 @@
t choice
+, randint
%0A%0Aimport
@@ -85,16 +85,38 @@
hBullet%0A
+from os import environ
%0A''' %0ACh
@@ -269,16 +269,18 @@
ip
+
= ip%0A
@@ -284,15 +284,60 @@
-geo
+latitude = form.get('latitude', None)%0A longitude
= f
@@ -345,19 +345,25 @@
rm.get('
-geo
+longitude
... |
2f4aa70b86ad3a6d7672b7fc14d054a3c87bf1a3 | Add result param to registration callback for easier client-side parsing | models.py | models.py | # Copyright (c) 2010, Scott Ferguson
# 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... | Python | 0 | @@ -4795,16 +4795,30 @@
cessful'
+, result = '1'
)%0Apost_s
|
0980b517300cd9838497de8ae7ccf7276be2e365 | support atshit.com | attracker_project/settings.py | attracker_project/settings.py | """
Django settings for attracker_project project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# ... | Python | 0 | @@ -893,16 +893,29 @@
0.0.0.0'
+,'atshit.com'
%5D%0A%0A%0A# Ap
|
ea8cbcaf41f01a46390882fbc99e6e14d70a49d1 | Create an API auth token for every newly created user | src/mmw/apps/user/models.py | src/mmw/apps/user/models.py | # -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
class ItsiUserManager(models.Manager):
def create_itsi_user(self, user, itsi_id):
itsi_user = self.create(user=user, itsi_id=itsi_id)
return itsi_user
class ItsiUser(models.Model):
user = models.... | Python | 0 | @@ -16,16 +16,50 @@
tf-8 -*-
+%0A%0Afrom django.conf import settings
%0Afrom dj
@@ -124,16 +124,409 @@
models%0A
+from django.db.models.signals import post_save%0Afrom django.dispatch import receiver%0A%0Afrom rest_framework.authtoken.models import Token%0A%0A%0A@receiver(post_save, sender=settings.AUTH_USER_MODEL)... |
8a304e7c09a2e6a01454d686a882a8e139be7a3d | make async dbus call, return result in deferred method | dbus-tools/dbus-send.py | dbus-tools/dbus-send.py | ###############################################################################
# Copyright 2012 Intel Corporation.
#
# 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... | Python | 0.000001 | @@ -2107,18 +2107,40 @@
efer
- dbus call
+red reply to return dbus results
%0A
@@ -2140,24 +2140,29 @@
lts%0A
+self.
request = de
@@ -2188,108 +2188,115 @@
-request.addCallback(self.dbusCallback)%0A reactor.callLater(0, request.callback, (method, args)
+# dbus method async call%0A met... |
1bbfce6c64debb9f9377d1a912604f32ace9dca5 | Update runsegment.py | bin/runsegment.py | bin/runsegment.py | #!/usr/bin/python
import os
import numpy as np
import shutil
import common
from segment import normalizefile, segmentfile
def runAll(args):
print('\n\n\nYou have requested to normalize and segment bincounts files')
print('\tWARNING:')
print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CAN... | Python | 0.000001 | @@ -1480,16 +1480,17 @@
od'%5D)%7D%09%0A
+#
%09methodD
@@ -1507,34 +1507,16 @@
= False%0A
-%09print methodDict%0A
%09sampleN
@@ -1565,36 +1565,8 @@
ct%7D%0A
-%09print sampleNormMethodDict%0A
%09%0A%09i
@@ -1684,16 +1684,34 @@
== 1)%5D%0A
+%09%09%09print refSlice%0A
%09%09%09metho
@@ -1763,16 +1763,39 @@
name'... |
4f27b87b9ee600c7c1c05ae9fece549b9c18e2a4 | Create default instance in middleware if not found. | speeches/middleware.py | speeches/middleware.py | from instances.models import Instance
class InstanceMiddleware:
"""This middleware sets request.instance to the default Instance for all
requests. This can be changed/overridden if you use SayIt in a way that
uses multiple instances."""
def process_request(self, request):
request.instance = Ins... | Python | 0 | @@ -307,16 +307,19 @@
instance
+, _
= Insta
@@ -333,16 +333,26 @@
ects.get
+_or_create
(label='
|
cb54c04049050d853f874e92c83061aad911a19a | Update qotd-parser.py | intelmq/bots/parsers/shadowserver/qotd-parser.py | intelmq/bots/parsers/shadowserver/qotd-parser.py | import csv
import StringIO
from intelmq.lib.bot import Bot, sys
from intelmq.lib.event import Event
from intelmq.bots import utils
class ShadowServerQotdParserBot(Bot):
def process(self):
report = self.receive_message()
if report:
report = report.strip()
columns = {
... | Python | 0.000001 | @@ -1489,16 +1489,28 @@
nt.add('
+application_
protocol
|
08ee872020b9365d7b79a305328b62a18a9a4fa1 | fix the problem output format is wrong | mondai.py | mondai.py | import random
import sys
field_size_max = 32
field_size_min = 20
field_threshold_min = 0.00 #threshold of obstacle
field_threshold_max = 0.30
block_size_max = 8
block_cells_min = 4
blocks_ratio_min = 0.7 #blank cells in field / cells of blocks
blocks_ratio_max = 1.5
blocks_threshold_min = 0.05 #threshold of making ra... | Python | 1 | @@ -546,28 +546,16 @@
false)%0A
- print()%0A
prin
|
17b57ac411d1be0794dec1e3dd5a62206aad389e | version number format | build.py | build.py | import os
import sys
from pybuilder.core import init, use_plugin
from pybuilder.vcs import VCSRevision
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin('python.cram')
... | Python | 0.000078 | @@ -1908,17 +1908,17 @@
on = '%25s
--
+.
%25s' %25 (p
|
2980c30a8de6cbdf5d22bb269c16f8c5ad499ba8 | Fix build output (dots on one line) | build.py | build.py | import argparse
from utils import build_docker_image
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--nocache', action='store_true', default=False)
args = parser.parse_args()
for item in build_docker_image(nocache=args.nocache):
print item.values()[0]
if __name__ == '__m... | Python | 0 | @@ -1,12 +1,22 @@
+import re%0A
import argpa
@@ -19,16 +19,16 @@
rgparse%0A
-
from uti
@@ -221,19 +221,33 @@
-for item in
+content = ''%0A stream =
bui
@@ -287,40 +287,277 @@
che)
-:%0A print item.values()%5B0%5D
+%0A for item in stream:%0A buff = item.get('stream', item.get('status'))%0... |
442de67baae52e6d7382c7c9618a9c1c7c831713 | version bump after fixing debian tests again | curtsies/__init__.py | curtsies/__init__.py | """Terminal-formatted strings"""
__version__='0.2.5'
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 | @@ -47,9 +47,9 @@
0.2.
-5
+6
'%0A%0Af
|
c16fb96de6154dec7bf0fc934dd9f7e1ac4b69f4 | bump version | curtsies/__init__.py | curtsies/__init__.py | """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 | @@ -48,9 +48,9 @@
.1.1
-4
+5
'%0A%0Af
|
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... | Python | 0 | @@ -554,16 +554,17 @@
split(%22-
+-
%22)%0A
|
e468abbc033a48d0222f50cf85319802f05fc57a | Check doctest | custom/onse/tests.py | custom/onse/tests.py | 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 | @@ -1,12 +1,27 @@
+import doctest%0A
from datetim
@@ -92,22 +92,16 @@
onse
-.tasks
import
get_
@@ -96,32 +96,21 @@
import
-get_last_quarter
+tasks
%0A%0A%0Adef t
@@ -540,16 +540,22 @@
arter =
+tasks.
get_last
@@ -625,8 +625,99 @@
_value)%0A
+%0A%0Adef test_doctests():%0A results = doctest.testmod(tasks... |
fe97597fa2cce2a8e6671c0b8975ecab3a78918f | update should be centralized | depl/deploy/__init__.py | depl/deploy/__init__.py | """
Deploys have the same name as in ``grammar.yml``, are stored as python modules
in the ``deploy`` package. These need to contain a ``load()`` function that
returns a list of commands - either python functions (remember to use fabric!)
- or strings that need to be executed, as well as a list of dependencies.
Depende... | Python | 0.000002 | @@ -1614,32 +1614,45 @@
-sudo('apt-get -q update'
+package_manager.run_update(force=True
)%0A%0A%0A
@@ -4239,27 +4239,40 @@
_update(self
+, force=False
):%0A
-
if s
@@ -4286,32 +4286,62 @@
tem() == 'apt':%0A
+ if not force:%0A
with
@@ -4350,24 +4350,28 @@
arn_only():%0A
+... |
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)
... | Python | 0.000001 | @@ -973,20 +973,42 @@
urn
-%7Bkey:
+dict((key,
val%5B0%5D
+)%0A
for
@@ -1054,17 +1054,17 @@
ritems()
-%7D
+)
%0A%0A de
|
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 ... | Python | 0 | @@ -1639,24 +1639,25 @@
build()%0A
+%0A
LOG.info
@@ -1652,51 +1652,24 @@
-LOG.info(%22Python Dependency metadata:%5Cn%5Cn%22)
+logged_deps = %22%22
%0A
@@ -1754,26 +1754,98 @@
-LOG.info(deps_info
+logged_deps += deps_info%0A LOG.info(%22Python Dependency metadata:%5Cn%5Cn%25s%22, logg... |
07cc567d4270d46981ce28f682186546033fc500 | Implement recursion for runcommand | myfuse.py | myfuse.py | #!/usr/bin/env python
from __future__ import with_statement
import subprocess
import inspect
import os
import sys
import errno
import fuse
#from fuse import Fuse, FuseOSError
class Passthrough(fuse.Operations):
def __init__(self, root):
self.root = root
# Helpers
# =======
def runcommand... | Python | 0.000019 | @@ -121,16 +121,30 @@
rt errno
+%0Aimport string
%0A%0Aimport
@@ -353,109 +353,630 @@
-start = path%5B6:%5D%0A cmd = %22gcc -P -E -xc++-header %22 + os.path.join(self.root, start) + %22 -o - %3E
+cmd_template= string.Template(%22gcc -P -E -xc++-header $input -o - %3E /tmp/.output%22)%0A if path.f... |
6bfab23170c108c50c9b2dc4988e8670ed677d65 | Allow including html files. Build script made executable. | build.py | build.py | 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 | @@ -1,12 +1,30 @@
+#!/usr/bin/python%0A
import distu
@@ -110,18 +110,31 @@
late
+s
=
+ %5B'%7B%7D.html',
'%7B%7D.md'
%0Ainc
@@ -129,16 +129,17 @@
'%7B%7D.md'
+%5D
%0Ainclude
@@ -906,86 +906,8 @@
()%0A%0A
- matches = include_regex.findall(text) #save matches to print them%0A
@@ -1001,170 +100... |
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 ... | Python | 0 | @@ -1605,18 +1605,18 @@
OSS = 46
-66
+80
%0A%0A# Numb
|
0f81fd138b1d3a83cc6ba5beab97ac34924da23f | use newer API to start activities | harmony/client.py | harmony/client.py | """Client class for connecting to the Logitech Harmony."""
import json
import logging
import time
import sleekxmpp
from sleekxmpp.xmlstream import ET
LOGGER = logging.getLogger(__name__)
class HarmonyClient(sleekxmpp.ClientXMPP):
"""An XMPP client for connecting to the Logitech Harmony."""
def __init__(s... | Python | 0 | @@ -2197,16 +2197,94 @@
ty%5B1%5D)%0A%0A
+ def _timestamp(self):%0A return str(int(round(time.time() * 1000)))%0A%0A
def
@@ -2743,20 +2743,26 @@
ony.
+activity
engine?
-start
+run
acti
@@ -2829,17 +2829,49 @@
mestamp=
-0
+' + self._timestamp() + ':async=1
'%0A
|
db2bb0356cfdf486a9e628726cd4e5879311fe8b | update version | src/BJRobot/version.py | src/BJRobot/version.py | VERSION = '0.4.0'
| Python | 0 | @@ -10,9 +10,9 @@
'0.
-4
+5
.0'%0A
|
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... | Python | 0 | @@ -531,16 +531,59 @@
tings):%0A
+ mocked_get_init_anon.reset_mock()%0A%0A
|
30020d3826a2460288b6a57963753787020a945a | Implement support for the 'D' type in packb() | temporenc/temporenc.py | temporenc/temporenc.py |
def packb(type=None, year=None, month=None, day=None):
raise NotImplementedError()
| Python | 0.00022 | @@ -1,59 +1,1081 @@
%0A
-def packb(type=None, year=None, month=None, day=None):
+import struct%0A%0ASUPPORTED_TYPES = set(%5B%0A 'D',%0A 'T',%0A 'DT',%0A 'DTZ',%0A 'DTS',%0A 'DTSZ',%0A%5D)%0A%0ASTRUCT_32 = struct.Struct('%3EL')%0A%0A%0Adef packb(type=None, year=None, month=None, day=None):%0A %22%... |
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
# Register your models here.
class TwitterProfileAdmin(admin.ModelAdmin):
list_display = ('user','twitter_user')
admin.site.register(UserProfile)
admin.sit... | Python | 0.000002 | @@ -154,16 +154,31 @@
nProfile
+, TumblrProfile
%0A%0A# Regi
@@ -548,9 +548,43 @@
rofile)%0A
+admin.site.register(TumblrProfile)
%0A
|
4f842014ee96506c3198a2da373b91067b8eec9d | Add ability to forget hive device when removing integration (#74144) | homeassistant/components/hive/__init__.py | homeassistant/components/hive/__init__.py | """Support for the Hive devices and services."""
from __future__ import annotations
from collections.abc import Awaitable, Callable, Coroutine
from functools import wraps
import logging
from typing import Any, TypeVar
from aiohttp.web_exceptions import HTTPException
from apyhiveapi import Hive
from apyhiveapi.helper.... | Python | 0 | @@ -280,24 +280,30 @@
veapi import
+ Auth,
Hive%0Afrom a
@@ -3568,16 +3568,337 @@
ad_ok%0A%0A%0A
+async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -%3E None:%0A %22%22%22Remove a config entry.%22%22%22%0A hive = Auth(entry.data%5B%22username%22%5D, entry.data%5B%22password%22%5D)%0A aw... |
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
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 | @@ -37,16 +37,70 @@
Redirect
+, HttpResponseForbidden%0Afrom django.db.models import Q
%0Afrom me
@@ -551,595 +551,8 @@
t)%0A%0A
- user = request.user%0A if user.is_authenticated():%0A user_all_accessible_resource_list = get_my_resources_list(user)%0A else: # anonymous user%0A user_all_access... |
75a0dec32210432374b45dbed2845dfe171b9b36 | Set version number to 0.4.1 | climlab/__init__.py | climlab/__init__.py | __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 | @@ -17,11 +17,8 @@
.4.1
-dev
'%0A%0A#
|
cb70fbc9d104cae2433b3a6eccc719718d7c2b63 | Fix `changed` status that always returns False | lib/ansible/modules/extras/packaging/composer.py | lib/ansible/modules/extras/packaging/composer.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | Python | 0 | @@ -3584,25 +3584,11 @@
-return (re.match(
+if
%22Not
@@ -3617,26 +3617,70 @@
ate%22
-,
+ in
string
-) != None)
+:%0A return False%0A else:%0A return True
%0A%0Ade
|
85af2e031479c78aaef433e2294648125916251a | Improve color palette for cycling Curves | src/rnaseq_lib/plot/opts.py | src/rnaseq_lib/plot/opts.py | 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 | @@ -1,12 +1,329 @@
+import holoviews as hv%0A%0Acolor_sequence = %5B'#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c',%0A '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5',%0A '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f',%0A '#c7c7c7', '#bcbd22', '#dbd... |
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 = {}... | Python | 0 | @@ -696,19 +696,22 @@
%0A%09%09self.
-say
+notice
(fr, %22%5Cx
|
d29f88ae898a64896bc63bbdf79daba0a496c19f | Add lm task. | cli/r.py | cli/r.py | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Lic... | Python | 0.015995 | @@ -1023,16 +1023,380 @@
ort *%0A%0A%0A
+@task%0Adef lm(inpath):%0A %22%22%22%0A fab r.lm:/sample/sample_regression%0A %22%22%22%0A run('mkdir %25s' %25 env.dir)%0A with cd(env.dir):%0A run('''cat %3C%3C'EOF' %3E r.lm.R%0Adf %3C- read.table(%22%25(inpath)s%22, header=F, sep=%22 %22, stringsAsFact... |
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
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 | @@ -61,16 +61,61 @@
emplate%0A
+from django.util import timezone%0A%0Aimport pytz
%0A%0Aregist
@@ -438,16 +438,25 @@
te=None,
+ tz=None,
**kwarg
@@ -496,16 +496,118 @@
UNDAY)%0A%0A
+ if tz:%0A today = timezone.localtime(timezone.now(), pytz.timezone(tz)).date()%0A else:%0A
toda
|
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... | Python | 0 | @@ -433,35 +433,38 @@
url(r'%5E(?P%3Cslug%3E
-%5Cw*
+%5B-%5Cw%5D+
)/(?P%3Cpath%3E%5Cw*)/
@@ -458,19 +458,22 @@
?P%3Cpath%3E
-%5Cw*
+%5B-%5Cw%5D+
)/(?P%3Cna
@@ -480,13 +480,13 @@
me%3E%5B
+-
%5Cw
--%5D*
+%5D+
)/$'
|
8686bf54eab7358dbd096aac277155b86db94d42 | add new keyword | src/IpmiLibrary/bmc.py | src/IpmiLibrary/bmc.py | #
# Kontron IpmiLibrary
#
# author: Michael Walle <michael.walle@kontron.com>
# author: Heiko Thiery <heiko.thiery@kontron.com>
#
from mapping import *
from robot import utils
from robot.utils import asserts
from utils import int_any_base
class Bmc:
def issue_bmc_cold_reset(self):
"""Sends a _bmc cold rese... | Python | 0 | @@ -1228,24 +1228,453 @@
cturer_id)%0A%0A
+ def device_should_support(self, supported_function):%0A %22%22%22The device can support the following functions:%0A 'SENSOR', 'SDR_REPOSITORY', 'SEL', 'FRU_INVENTORY',%0A 'IPMB_EVENT_RECEIVER', 'IPMB_EVENT_GENERATOR', 'BRIDGE', 'CHASSIS'.%0A %2... |
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.... | Python | 0.001441 | @@ -2797,16 +2797,23 @@
'Rails 3
+ (Ruby)
',%0A '
@@ -2843,10 +2843,146 @@
'iOS',%0A
+ 'express': 'Express (Node.js)',%0A 'connect': 'Express (Node.js)',%0A 'django': 'Django (Python)',%0A 'flask': 'Flask (Python)',%0A
%7D%0A
|
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... | Python | 0.999352 | @@ -605,16 +605,28 @@
return
+tr.text and
len(tr.t
@@ -629,16 +629,21 @@
tr.text)
+ or 0
%0A
|
a549c863deeb15952aa710273ae7a448892d227e | Add support for debug messages | cocoa/controller.py | cocoa/controller.py | # Copyright 2009 Google 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 applicable law or ... | Python | 0 | @@ -2959,16 +2959,29 @@
or=False
+, debug=False
):%0A %22
|
5c8f7ba13ae33c0f87b89e9721a66b0e3f001f5e | Change the number of urls catched once | crawl.py | crawl.py | #coding=utf-8
import os
import time
import urllib2
from bs4 import BeautifulSoup
import socket
from Indexbuild import IndexBuilder
class crawl:
baseurl=''
req_header = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
req_timeout = 5
urlqueue=[]
urls=[]
inde... | Python | 0.000016 | @@ -867,17 +867,18 @@
ount %3C=
-1
+50
0):#%E6%90%9C%E7%B4%A2%E7%BD%91%E9%A1%B5
@@ -1647,17 +1647,17 @@
sleep(0.
-1
+2
)%0A%09%09%09%09%09n
@@ -2669,17 +2669,36 @@
cept
-:%0A%09%09%09pass
+ Exception as e:%0A%09%09%09print(e)
%0A%09%0A%0A
|
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... | Python | 0.000003 | @@ -456,16 +456,23 @@
e_lazy('
+sleepy-
home')%0A
|
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 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 | @@ -95,16 +95,8 @@
port
- Change,
Com
@@ -195,16 +195,50 @@
ties = %7B
+%22manifest-format%22: MANIFEST_FORMAT
%7D%0A
|
0c5f8c97e98499478fe3261303af106c5c701de7 | fix handouts, oops | commands/handout.py | commands/handout.py | import config
import random
import datetime, time
import math
def execute(parser, bot, user, args):
argslow = args.lower().strip()
# saidPlease = argslow.startswith("please") or argslow.startswith("pls") or argslow.startswith("plz")
saidPlease = False # lol
userData = bot.getUserDetails(user)
... | Python | 0 | @@ -3874,13 +3874,14 @@
dout
-Choic
+Messag
es))
|
bdba5fb157862880af786090bb02f236207e2f37 | fix precedence bug | src/apipkg/__init__.py | src/apipkg/__init__.py | """
apipkg: control the exported namespace of a Python package.
see https://pypi.python.org/pypi/apipkg
(c) holger krekel, 2009 - MIT license
"""
import os
import sys
from types import ModuleType
from .version import version as __version__ # NOQA:F401
def _py_abspath(path):
"""
special version of abspath
... | Python | 0.000002 | @@ -6261,17 +6261,16 @@
attrname
-)
if attr
@@ -6281,16 +6281,17 @@
else %22%22
+)
%0A rep
|
799f0bbd87fe5d455d4859201e604490f493ae0c | Fix form stuff so that we get all the form details | browser.py | browser.py | # Copyright (C) Adam Piper, 2012
# See COPYING for licence details (GNU AGPLv3)
import pycurl
import StringIO
from lxml.html import fromstring
from urllib import urlencode
from datetime import datetime
class Browser(object):
@classmethod
def check_curl(cls, item):
return item in pycurl.version_info()[... | Python | 0 | @@ -2924,16 +2924,51 @@
rn dict(
+filter(lambda pair: pair%5B0%5D != '',
self._fo
@@ -2975,21 +2975,23 @@
rm.f
-orm_value
+ields.item
s())
+)
%0A%0A
|
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
#
indir = '/global/projecta/projectdirs/cosmo/work/legacysurvey/dr8/DECaLS/'
outdir = '/global/cs... | Python | 0.000004 | @@ -222,261 +222,104 @@
%0A#%0A%0A
-indir = '/global/projecta/projectdirs/cosmo/work/legacysurvey/dr8/DECaLS/'%0Aoutdir = '/global/cscratch1/sd/dstn/dr8new'%0A%0Abands = 'grizY'%0A%0Afor band in bands:%0A infn = indir + 'survey-ccds-decam-%25s.fits.gz' %25 band%0A print('Input:', infn)%0A%0A # gunzip%0A
+def ... |
e01875e5be3d41ba0631f26254d22666c851bb10 | Handle all exceptions on webapp2. Pretty ghettoish. | src/auth_controller.py | src/auth_controller.py | import credentials
import logging
import webapp2
from webapp2_extras import (auth, sessions, jinja2)
from simpleauth import SimpleAuthHandler
class BaseRequestHandler(webapp2.RequestHandler):
"""This class is mostly copy-paste from
https://github.com/crhym3/simpleauth/blob/master/example/handlers.py
... | Python | 0 | @@ -4625,16 +4625,137 @@
_attrs%0A%0A
+ def handle_exception(self, exception, debug):%0A logging.exception(exception)%0A self.redirect_to('home')%0A%0A
%0Aclass P
|
d397d38ebbc4124180af4c8be36f014936681e6e | update default product plan when DefaultProductPlan already exists | corehq/apps/accounting/bootstrap/utils.py | corehq/apps/accounting/bootstrap/utils.py | # Use modern Python
from __future__ import absolute_import, print_function, unicode_literals
from corehq.apps.accounting.models import (
FeatureType,
SoftwarePlanEdition,
SoftwarePlanVisibility,
)
from corehq.apps.accounting.utils import log_accounting_error, log_accounting_info
import six
FEATURE_TYPES =... | Python | 0 | @@ -2612,200 +2612,8 @@
()%0A%0A
- default_product_plan = DefaultProductPlan(%0A edition=edition, is_trial=is_trial%0A )%0A default_product_plan.is_report_builder_enabled = is_report_builder_enabled%0A%0A
@@ -3103,32 +3103,255 @@
n.DoesNotExist:%0A
+ default_product_pl... |
bab795306cbba98a4f64e478af3c19f814b962cb | reset structlog context after each test | relengapi/blueprints/base/__init__.py | relengapi/blueprints/base/__init__.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import logging
import os
import sys
from alembic import command
from alembic.co... | Python | 0 | @@ -413,16 +413,53 @@
rent_app
+%0Afrom nose.plugins.base import Plugin
%0A%0Aimport
@@ -537,24 +537,79 @@
cSubcommand%0A
+from relengapi.lib import logging as relengapi_logging%0A
from relenga
@@ -2655,24 +2655,341 @@
, %22head%22)%0A%0A%0A
+class ResetLogging(Plugin):%0A%0A %22%22%22Reset the logging context ... |
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,... | Python | 0.999052 | @@ -748,16 +748,158 @@
= value
+%0A%0A def __str__(self):%0A ret = str(self._fields)%0A for row in self._table:%0A ret += %22%5Cn%22 + str(row)%0A return ret
%0A %0A
|
8a45ca4dff9957a6fce07dfa067633fcd842bc51 | Update cpp.py | conda/libdev/cpp.py | conda/libdev/cpp.py | 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 | @@ -34,11 +34,13 @@
ort
-Mov
+Delet
e%0A%0Ad
|
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
def create(self, notes):
midinotes = []
offset = 60
attack = 200
beats = 1
... | Python | 0.000002 | @@ -192,16 +192,49 @@
nter = 0
+%0A self.filename = filename
%0A%0A de
|
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... | Python | 0.000004 | @@ -2932,16 +2932,1056 @@
er()))%0A%0A
+ def test_snmpv3(self):%0A %22%22%22 Check if SNMPv3 can be configured and service runs%22%22%22%0A%0A self.session.set(base_path + %5B'v3', 'engineid', '0xaffedeadbeef'%5D)%0A self.session.set(base_path + %5B'v3', 'group', 'default', 'mode', 'ro'%5D)%0A ... |
b470de3eafbb8ac8526874cf4e3f112fdbdd27c7 | Add /e and /h to swarm xcopy to ensure subfolders and permissions are correctly copied over. | scripts/tools/swarm_bot_setup.py | scripts/tools/swarm_bot_setup.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Setup a given bot to become a swarm bot by installing the
required files and setting up any required scripts. The bot's OS must ... | Python | 0.000002 | @@ -1808,16 +1808,22 @@
xcopy /i
+ /e /h
'%0A else
|
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... | Python | 0 | @@ -1019,16 +1019,34 @@
pas.IPY
+or compas.WINDOWS
else ' %E2%96%8C
|
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
... | Python | 0 | @@ -1255,16 +1255,20 @@
ame()),
+str(
cookie.v
@@ -1274,16 +1274,17 @@
value())
+)
%0A%0A
|
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... | Python | 0.000023 | @@ -677,22 +677,24 @@
pe:
-%25s
%22 +
+str(
type(Y))
%0A
@@ -689,16 +689,17 @@
type(Y))
+)
%0A if
|
4f92ec41493ab115d11b4068c175b98b7afac22f | Use the DESCRIPTOR.full_name instead of __class__.__name__ for ProtobufProcess | src/compactor/process.py | src/compactor/process.py | import threading
from .context import Context
from .pid import PID
class Process(object):
ROUTE_ATTRIBUTE = '__route__'
INSTALL_ATTRIBUTE = '__mailbox__'
class Error(Exception): pass
class UnboundProcess(Error): pass
@classmethod
def route(cls, path):
if not path.startswith('/'):
raise ValueE... | Python | 0.000068 | @@ -3172,34 +3172,36 @@
ge_type.
-__class__._
+DESCRIPTOR.full
_name
-__
%0A def
@@ -3458,26 +3458,28 @@
age.
-__class__._
+DESCRIPTOR.full
_name
-__
, me
|
b85787a27eac97ed6c9617203aab0e0a62a4960a | Add file checkk | camgrab.py | camgrab.py | #!/usr/bin/python
# The MIT License (MIT)
#
# Copyright (c) 2014 Corrado Ubezio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | Python | 0.000001 | @@ -3461,16 +3461,51 @@
atetime%0A
+ from os import makedirs, path%0A%0A
cfg
@@ -3540,16 +3540,16 @@
.json')%0A
-
%0A # M
@@ -3698,16 +3698,343 @@
'%5D, now)
+%0A%0A try:%0A makedirs(picturesDirName)%0A except OSError, e:%0A if not path.isdir(picturesDirName):%0A # If the ... |
bca7388a1186d2557def93ff016f1a6ab82b1d7c | Fix another moved module | carebot.py | carebot.py | # from analytics import Analytics
import datetime
from models import Story
import re
from slackbot.bot import Bot
from slackbot.bot import respond_to
from slackbot.bot import listen_to
# Set up analytics to handle inquiries
# a = Analytics()
LINGER_RATE_REGEX = '[Ww]hat is the linger rate on ((\w*-*)+)?'
START_TRACKI... | Python | 0 | @@ -48,16 +48,21 @@
me%0Afrom
+util.
models i
|
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:
... | Python | 0 | @@ -243,21 +243,16 @@
rstrip()
-%0D%0A
%0D%0Adef l
@@ -392,17 +392,16 @@
newName
-'
)%0D%0Aprint
|
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
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 | @@ -107,16 +107,31 @@
unction%0A
+import datetime
%0A%0Adef re
@@ -898,32 +898,298 @@
-script_module.main(confi
+t0 = datetime.datetime.now()%0A script_module.main(config)%0A%0A # print success message%0A msg = %22Script completed. Execution time: %25.2fs%22 %25 (datetime.dateti... |
f4c6a4f9ca1ce27e122e9c277706a7bd41ade6c5 | Fix OSS build problems after cl/483572970 | testing/build_defs.bzl | testing/build_defs.bzl | # Copyright 2022 The Centipede Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Python | 0.000002 | @@ -4510,21 +4510,8 @@
-cmp
-,control-flow
%22,%0A
|
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
database_name = "house_price_04"
# 打开数据库连接
db=pymysql.connect("localhost","root","aB123456",database_name,charset='utf8mb4')
# 使用cursor()方法获取操作游标
cursor=db.cursor()
#输入要查询的小区名称
check_name= ... | Python | 0 | @@ -121,16 +121,27 @@
it, Fore
+%0Aimport pdb
%0A%0Adataba
@@ -312,16 +312,60 @@
%E6%9F%A5%E8%AF%A2%E7%9A%84%E5%B0%8F%E5%8C%BA%E5%90%8D%E7%A7%B0%0A
+%0Adata=%5B%5D%0A%0Adef main():%0A%0A%09global check_name %0A%09
check_na
@@ -387,16 +387,17 @@
%E5%8C%BA%E5%90%8D%E7%A7%B0%EF%BC%9A%22);%0A
+%09
#%E7%94%A8%E4%BA%8E... |
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... | Python | 0.000005 | @@ -3578,25 +3578,15 @@
(t,
-(
HStruct
-, HUnion)
):%0A
|
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
def valueHasChanged(valA, valB):
return valA.val is not valB.val or valA.vldMask != valB.vldMask
def agent_randomize(agent, timeQuantu... | Python | 0 | @@ -171,16 +171,83 @@
ceProxy%0A
+from hwt.synthesizer.interfaceLevel.mainBases import InterfaceBase%0A
%0A%0Adef va
@@ -970,16 +970,22 @@
s =
+ %22 %22 +
repr(s)
@@ -1067,13 +1067,8 @@
()),
- %22 %22,
s%5D)
@@ -1491,17 +1491,16 @@
)%0A%0A%0Adef
-_
pprintAg
@@ -1496,33 +1496,39 @@
ef pprintAgents(
-i
+... |
210c5e14084224f936aeb12652dd2772efd75a08 | Remove a test logging statement. | heat-translator/tosca/elements/nodetype.py | heat-translator/tosca/elements/nodetype.py | from capabilitytype import CapabilityTypeDef
from interfacestype import InterfacesTypeDef
from tosca.log.toscalog import logger
import os
from properties import PropertyDef
import relationshiptype
from relationshiptype import RelationshipType
from statefulentitytype import StatefulEntityType
from yaml_parser import Par... | Python | 0.000001 | @@ -787,36 +787,8 @@
f):%0A
- logger.info('adsf')%0A
|
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
mail = Mail()
mom... | Python | 0.000072 | @@ -296,16 +296,42 @@
config%0A%0A
+from .util import assets%0A%0A
mail = M
|
690696493f110899282ad22f9b02d3d0fd91fe31 | Rewrite wirecloud.catalogue.admin module | src/wirecloud/catalogue/admin.py | src/wirecloud/catalogue/admin.py | # -*- 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 | @@ -23,201 +23,77 @@
-%0A%0A#
-...............................licence...........................................%0A#%0A# (C) Copyright 2008 Telefonica Investigacion y Desarrollo%0A# S.A.Unipersonal (Telefonica I+D)%0A#%0A#
+ Copyright (c) 2013 CoNWeT Lab., Universidad Polit%C3%A9cnica de Madrid%0A%0A#
Th... |
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 ... | Python | 0.000001 | @@ -553,16 +553,72 @@
name__)%0A
+ app.config%5B'MAX_CONTENT_LENGTH'%5D = 16 * 1024 * 1024%0A
app.
|
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... | Python | 0.000008 | @@ -572,50 +572,8 @@
e.%0A%0A
-from oslo_serialization import jsonutils%0A%0A
from
@@ -597,16 +597,16 @@
ort api%0A
+
%0A%0Aclass
@@ -715,32 +715,9 @@
s =
-jsonutils.dump_as_bytes(
+%7B
%0A
@@ -725,17 +725,16 @@
-%7B
%22version
@@ -737,17 +737,16 @@
sions%22:%0A
-
@@ -786,17 +786,16 @@... |
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
from config import config
bootstrap = Bootstrap()
moment = Moment()
db = SQLAlchemy()
pagedown = PageDown()
log... | Python | 0 | @@ -203,34 +203,8 @@
Down
-%0Afrom config import config
%0A%0Abo
@@ -456,16 +456,193 @@
name__)%0A
+ # import config here rather than at module level to ensure that .env values%0A # are loaded into the environment first when running manage.py%0A from config import config%0A
app.
|
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... | Python | 0 | @@ -2500,16 +2500,17 @@
+
'time':
@@ -2507,32 +2507,33 @@
'time': text,%0A
+
'
@@ -2585,32 +2585,33 @@
%0A
+
'total_pomodoro'
@@ -2631,17 +2631,16 @@
pomodoro
-,
%0A
|
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
data = (('Alice', 100),
('Bob', 200))
t = Table(data, columns=['name', 'amount'])
def test_resources():
... | Python | 0.000005 | @@ -195,16 +195,36 @@
dshape%0A%0A
+import pandas as pd%0A
%0Adata =
@@ -1536,20 +1536,382 @@
ert '...' in result%0A
+%0A%0Adef test_mutable_backed_repr():%0A mutable_data = %5Brange(2)%5D%0A mutable_backed_table = Table(mutable_data, columns=%5B%22mutable%22%5D)%0A repr(mutable_backed_table)%0A%0A%0Adef t... |
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... | Python | 0 | @@ -1650,24 +1650,85 @@
cebook')%5B0%5D%0A
+ if link:%0A message = message + %22%5Cn%22 + link%0A
retu
|
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', '... | Python | 0.000001 | @@ -727,79 +727,17 @@
s =
-(%0A 'url', 'timestamp', 'messages', 'count', 'data'%0A )
+'__all__'
%0A%0A%0Ac
|
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 =... | Python | 0 | @@ -911,8 +911,220 @@
UR%22).id%0A
+%0A def _valid_field_parameter(self, field, name):%0A if name in (%22xsd_type%22, %22xsd_required%22, %22choice%22):%0A return True%0A else:%0A return super()._valid_field_parameter(field, name)%0A
|
462d394a755675347bbc3c9751ddc0def72dfd08 | refactor add_host function save host only if confirmed | botnet/fabfile.py | botnet/fabfile.py | #!/usr/bin/env python
import os
from fabric.api import env, run, sudo, execute, local, settings, hide, open_shell, parallel
from fabric.contrib.console import confirm
import paramiko
import getpass
from tabulate import tabulate
file_hosts = "hosts.txt"
paramiko.util.log_to_file("paramiko.log")
env.colorize_errors = ... | Python | 0 | @@ -823,33 +823,34 @@
except
-Exception
+ValueError
:%0A
@@ -1586,24 +1586,25 @@
= password%0A
+%0A
# Append
@@ -1635,16 +1635,76 @@
ts file%0A
+ if confirm(%22Add the new host to the hosts file? %22):%0A
if p
@@ -1724,32 +1724,36 @@
t None:%0A
+
line = new_host
@@ -... |
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":... | Python | 0 | @@ -3269,41 +3269,97 @@
rt %22
-unsupported operand type(s) for +
+Error while evaluating evaluation parameter expression: could not convert string to float
%22 in
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.