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 |
|---|---|---|---|---|---|---|---|
5a21e98880a7e903f335ada22856248f346dad5a | remove mutable class-level variable that's always overridden by a fresh instance variable with the same name (at least within this code, and I'm going to assume that's how it's meant to be used) | oonib/testhelpers/http_helpers.py | oonib/testhelpers/http_helpers.py | import json
import random
import string
from twisted.application import internet, service
from twisted.internet import protocol, reactor, defer
from twisted.protocols import basic
from twisted.web import resource, server, static, http
from twisted.web.microdom import escape
from cyclone.web import RequestHandler, App... | Python | 0 | @@ -1237,25 +1237,8 @@
= ''
-%0A headers = %5B%5D
%0A%0A
@@ -1279,32 +1279,58 @@
__init__(self):%0A
+ self.headers = %5B%5D%0A
self.req
@@ -3089,11 +3089,14 @@
-p =
+return
sel
@@ -3111,48 +3111,8 @@
ol()
-%0A p.headers = %5B%5D%0A return p
%0A%0Acl
|
7138cd2fb7a5dc8a5044f15b19d3d53a1486dec3 | order by companies by name, helps when viewing adding companies to jobs entry form | companies/models.py | companies/models.py | from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from markupfield.fields import MarkupField
from cms.models import NameSlugModel
DEFAULT_MARKUP_TYPE = getattr(settings, 'DEFAULT_MARKUP_TYPE', 'restructuredtext')
class Company(NameSlugModel):
... | Python | 0 | @@ -745,8 +745,38 @@
anies')%0A
+ ordering = ('name', )%0A
|
f283dc1f710c8eca452d39f63f5b3b956e5676c8 | Fix the xs-tape9 option | transmutagen/origen.py | transmutagen/origen.py | import argparse
import os
from subprocess import run
from pyne.utils import toggle_warnings
import warnings
toggle_warnings()
warnings.simplefilter('ignore')
from pyne.origen22 import (nlbs, write_tape5_irradiation, write_tape4,
parse_tape9, merge_tape9, write_tape9, parse_tape6)
from pyne.material import from_at... | Python | 0.999998 | @@ -591,25 +591,25 @@
ment('xs
--
+_
tape9',
dest='xs
@@ -604,17 +604,20 @@
9',
-dest
+metavar
='xs
-_
+-
tape
|
a0c5299b2d1107972bbfeaf6b9b5e11847c95b59 | Set workpackage of entry when loading zeiterfassung | trex/models/project.py | trex/models/project.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.db import models, transaction
class BaseQuerySet(models.QuerySet):
use_for_rel... | Python | 0 | @@ -2109,16 +2109,74 @@
r=user,%0A
+ workpackage=zentry.get_workpackage(),%0A
|
da1d77291da0e683a3fbf89b60c9a7f9c2bee64a | use set for deps | compiler/js/code.py | compiler/js/code.py | import re
def scan(text):
str_context = False
escape = False
c_comment = False
cpp_comment = False
begin = 0
invalid = []
for i in xrange(0, len(text)):
c = text[i]
if escape:
escape = False
continue
if cpp_comment:
if c == "\n":
cpp_comment = False
end = i
invalid.append((begin, end... | Python | 0 | @@ -2150,18 +2150,21 @@
%09deps =
-%5B%5D
+set()
%0A%09for m
@@ -2514,20 +2514,17 @@
%09%09deps.a
-ppen
+d
d((%22%25s._
@@ -2572,28 +2572,25 @@
e:%0A%09%09%09deps.a
-ppen
+d
d((path, tar
@@ -2636,20 +2636,17 @@
%09%09deps.a
-ppen
+d
d((paren
|
10e7388eec8d16f5a69e5d4f3b9e6cf56a1c956e | Remove explicit byte string from migration 0003 (#298) | silk/migrations/0003_request_prof_file.py | silk/migrations/0003_request_prof_file.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 18:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('silk', '0002_auto_update_uuid4_id_field'),
]
operations = [
migrations.AddFi... | Python | 0.000004 | @@ -438,17 +438,16 @@
load_to=
-b
''),%0A
|
30452b9fe815a2b68826b739625d1c06886fb17e | Remove redundant isinstance() check | pact/group.py | pact/group.py | import itertools
from .base import PactBase
class PactGroup(PactBase):
def __init__(self, pacts=None, lazy=True):
if pacts is None:
pacts = []
self._pacts = list(pacts)
self._finished_pacts = []
self._is_lazy = lazy
super(PactGroup, self).__init__()
def _... | Python | 0.000015 | @@ -565,56 +565,8 @@
p):%0A
- if isinstance(pact, PactGroup):%0A
|
1b3657adf92b52d731fd0d9248f517a0cee58019 | Compute the difference with the previous timestamp | src/remora_parse_fs.py | src/remora_parse_fs.py | #!/usr/bin/env python
#
#========================================================================
# HEADER
#========================================================================
#% DESCRIPTION
#% remora_parse_fs
#%
#% DO NOT call this script directory. This is a postprocessing
#% tool called by REMORA
#%
#==========... | Python | 1 | @@ -3523,24 +3523,108 @@
in results:%0A
+ if (j==0):%0A out_vals = out_vals + %22 0 %22%0A else:%0A
out_
@@ -3658,16 +3658,32 @@
ts%5Bi%5D%5Bj%5D
+-results%5Bi%5D%5Bj-1%5D
) + %22
|
628e77501340b89a77649a0c798f77d8ef4a4d1f | Update processors.py | dax/processors.py | dax/processors.py | import os
import re
import task
import logging
import XnatUtils
#Logger for logs
logger = logging.getLogger('dax')
class Processor(object):
""" Base class for processor """
def __init__(self, walltime_str, memreq_mb, spider_path, version=None, ppn=1, xsitype='proc:genProcData'):
""" init function """
... | Python | 0.000001 | @@ -2726,149 +2726,8 @@
or()
-%0A %0A def write_pbs(self, filename):%0A %22%22%22 function that write the pbs for the assessor %22%22%22%0A raise NotImplementedError()
%0A%0Acl
|
7dc9085bf0665efc3083b64c0b34cb7c8c92ae31 | update now drops duplicates | dblib/dbUpdate.py | dblib/dbUpdate.py | import pymongo
import multiprocessing
import multiprocessing.connection
import time
SIZE = 128
NUM_NODES = 3
def recv_data(sock,dataQueue,cQueue):
connect = sock.accept()
cQueue.put("listen")
data = connect.recv()
dataQueue.put(data)
connect.close()
print("received data")
exit(0)
def db_s... | Python | 0 | @@ -748,12 +748,16 @@
,%7B%22$
-push
+addToSet
%22:ne
|
e76d6ad7a4670bfa47ba506343aff2e5f118f976 | fix rsync options for use in shared scenarios | myriadeploy/update_myria_jar_only.py | myriadeploy/update_myria_jar_only.py | #!/usr/bin/env python
import myriadeploy
import subprocess
import sys
def host_port_list(workers):
return [str(worker[0]) + ':' + str(worker[1]) for worker in workers]
def get_host_port_path(node, default_path):
if len(node) == 2:
(hostname, port) = node
if default_path is None:
... | Python | 0 | @@ -1105,17 +1105,19 @@
del%22, %22-
-a
+rlD
Lvz%22%5D +
|
4ab79d5f72a2c518d6ced8f1db645ac84c2ce64b | fix ALLOWED_HOSTS in base settings | treeherder/settings/base.py | treeherder/settings/base.py | # Django settings for webapp project.
import os
from treeherder import path
# needed to setup celery
import djcelery
djcelery.setup_loader()
# These settings can all be optionally set via env vars, or in local.py:
TREEHERDER_DATABASE_NAME = os.environ.get("TREEHERDER_DATABASE_NAME", "")
TREEHERDER_DATABASE_USER = os... | Python | 0 | @@ -5558,16 +5558,61 @@
= True%0A%0A
+ALLOWED_HOSTS = %5B%22.treeherder.mozilla.org%22%5D%0A%0A
try:%0A
@@ -6519,31 +6519,4 @@
URL%0A
-ALLOWED_HOSTS = %5BSITE_URL%5D%0A
|
afbef65bd28f0058edf39579125e2ccb35a72aee | Update test_multivariate.py to Python 3.4 | nb_twitter/test/test_multivariate.py | nb_twitter/test/test_multivariate.py | # -*- coding: utf-8 -*-
# test_multivariate.py
# nb_twitter/nb_twitter/bayes
#
# Created by Thomas Nelson <tn90ca@gmail.com>
# Preston Engstrom <pe12nh@brocku.ca>
# Created..........................2015-06-29
# Modified.........................2015-06-29
#
# This script was developed for use as part of the ... | Python | 0.000009 | @@ -257,18 +257,18 @@
2015-06-
-29
+30
%0A#%0A# Thi
@@ -761,17 +761,17 @@
)%0A%0Aprint
-
+(
%22C%5Ct%5Ct=%22
@@ -784,23 +784,24 @@
sifier.C
+)
%0Aprint
-
+(
%22D%5Ct%5Ct=%22
@@ -814,23 +814,24 @@
sifier.D
+)
%0Aprint
-
+(
%22N%5Ct%5Ct=%22
@@ -844,23 +844,24 @@
sifier.N
+)
%0Aprint
-
+(
%22V%5Ct%5Ct=%22... |
45b0af75824c1f7715c464ae2dfc35ac8d7a9767 | Add additional_tags parameter to upload and pass through client args to httplib2. | cloudshark/cloudshark.py | cloudshark/cloudshark.py |
import httplib2
import io
import json
import os
import urllib
class CloudsharkError(Exception):
def __init__(self, msg, error_code=None):
self.msg = msg
self.error_code = error_code
def __str__(self):
return repr('%s: %s' % (self.error_code, self.msg))
class Cloudshark(object):
... | Python | 0 | @@ -343,19 +343,34 @@
rl,token
+,client_args=%7B%7D
):%0A
-
@@ -410,16 +410,55 @@
= token
+%0A self.client_args = client_args
%0A%0A de
@@ -624,32 +624,50 @@
= httplib2.Http(
+**self.client_args
)%0A (respo
@@ -1147,32 +1147,50 @@
= httplib2.Http(
+**self.client_args
)%0A (res... |
1b668fa59624bc1f73f5fceebecbbadfc0038156 | support arrow DictionaryType | packages/vaex-arrow/vaex_arrow/dataset.py | packages/vaex-arrow/vaex_arrow/dataset.py | __author__ = 'maartenbreddels'
import logging
import pyarrow as pa
import pyarrow.parquet as pq
import vaex.dataset
import vaex.file.other
from .convert import column_from_arrow_array
logger = logging.getLogger("vaex_arrow")
class DatasetArrow(vaex.dataset.DatasetLocal):
"""Implements storage using arrow"""
... | Python | 0 | @@ -865,17 +865,16 @@
ltered =
-
self._l
@@ -930,17 +930,16 @@
ex_end =
-
self._l
@@ -1149,16 +1149,330 @@
unks%5B0%5D%0A
+ if isinstance(arrow_array.type, pa.DictionaryType):%0A column = column_from_arrow_array(arrow_array.indices)%0A labels = column_from_arrow_array(a... |
52239a9b6cd017127d52c29ac0e2a0d3818e7d9e | Add new lab_members fieldset_website to fieldsets for cms_lab_members | cms_lab_members/admin.py | cms_lab_members/admin.py | from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from lab_members.models import Scientist
from lab_members.admin import ScientistAdmin
class CMSScientistAdmin(PlaceholderAdminMixin, ScientistAdmin):
fieldsets = [
ScientistAdmin.fieldset_basic,
Scientist... | Python | 0 | @@ -296,16 +296,57 @@
_basic,%0A
+ ScientistAdmin.fieldset_website,%0A
|
dda3ebfcb9fff7f7304ee72c087dca9f8556fe6c | Update yadisk.py | cogs/utils/api/yadisk.py | cogs/utils/api/yadisk.py | import json
import requests
DEVICE_ID = '141f72b7-fd02-11e5-981a-00155d860f42'
DEVICE_NAME = 'DroiTaka'
CLIENT_ID = 'b12710fc26ee46ba82e34b97f08f2305'
CLIENT_SECRET = '4ff2284115644e04acc77c54526364d2'
class YaDisk(object):
def __init__(self, token):
self.session = requests.session()
self.session.headers.update... | Python | 0.000001 | @@ -623,16 +623,17 @@
st('http
+s
://oauth
|
2eb1535c3bb137216548bacaf9f7a22cd9e0e8a2 | Fix incorrect double-quotes. | colour/plotting/graph.py | colour/plotting/graph.py | # -*- coding: utf-8 -*-
"""
Automatic Colour Conversion Graph Plotting
==========================================
Defines the automatic colour conversion graph plotting objects:
- :func:`colour.plotting.plot_automatic_colour_conversion_graph`
"""
from __future__ import division
from colour.graph import CONVERSION... | Python | 0.000178 | @@ -2568,17 +2568,17 @@
lor=
-%22
+'
#263238
-%22
+'
)%0A
|
8b0cb0bdd3e5c5a31de2f6c8dce5ed041940a80e | fix bad indentation | skopt/tests/test_acquisition.py | skopt/tests/test_acquisition.py | from math import log
import numpy as np
import pytest
from scipy import optimize
from sklearn.multioutput import MultiOutputRegressor
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.tes... | Python | 0.00089 | @@ -4995,20 +4995,16 @@
model)%0A
-
asse
@@ -5041,10 +5041,10 @@
in e
-xc
+rr
.val
|
14043a783e2ebd6c4a27a38f08ca75e6e31dd5d8 | Add show admin panel | cinemair/shows/admin.py | cinemair/shows/admin.py | from django.contrib import admin
from . import models
class ShowsInline(admin.TabularInline):
model = models.Show
extra = 0
| Python | 0 | @@ -128,8 +128,407 @@
tra = 0%0A
+%0A%0A@admin.register(models.Show)%0Aclass Show(admin.ModelAdmin):%0A fieldsets = (%0A (None, %7B%22fields%22: (%22cinema%22, %22movie%22, %22datetime%22)%7D),%0A )%0A list_display = (%22id%22, %22cinema%22, %22movie%22, %22datetime%22)%0A #list_editable = (,)%0A ... |
059254eed4bcc32bbb2ded134f70701b535c1b15 | Fix stray merge content | data/admin.py | data/admin.py | from django.contrib import admin
from models import (SchoolData, HeadTeacher, InboundSMS, AcademicAchievementCode,
TeacherPerformanceData, LearnerPerformanceData)
<<<<<<< HEAD
from actions import export_select_fields_csv_action
from rts.utils import DistrictIdFilter
=======
from actions import expor... | Python | 0.000003 | @@ -180,21 +180,8 @@
ta)%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
from
@@ -232,96 +232,8 @@
ion%0A
-from rts.utils import DistrictIdFilter%0A=======%0Afrom actions import export_as_csv_action%0A
from
@@ -290,24 +290,8 @@
ons%0A
-%3E%3E%3E%3E%3E%3E%3E develop%0A
%0A%0A%0Ac
|
9e1b3893a676f0fff7d601245fd06ec5df7fb61f | bump version | circleparse/__init__.py | circleparse/__init__.py | from circleparse.replay import parse_replay_file, parse_replay
__version__ = "6.0.0"
| Python | 0 | @@ -74,13 +74,13 @@
__ = %226.
-0
+1
.0%22%0A
|
0251d41a46165f76b8e76da716bbc280723ce767 | Make the circuits.web.loggers.Logger understand and respect X-Forwarded-For request headers when logging the remote host | circuits/web/loggers.py | circuits/web/loggers.py | # Module: loggers
# Date: 6th November 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""Logger Component
This module implements Logger Components.
"""
import os
import sys
import rfc822
import datetime
from circuits.core import handler, BaseComponent
def formattime():
now = dateti... | Python | 0 | @@ -1355,46 +1355,176 @@
-atoms = %7B%22h%22: remote.name or remote.ip
+if %22X-Forwarded-For%22 in inheaders:%0A host = inheaders%5B%22X-Forwarded-For%22%5D%0A else:%0A host = remote.name or remote.ip%0A%0A atoms = %7B%22h%22: host
,%0A
|
c1beb674852b7362101f066c2f357a4276c83528 | Add python3 compatibility to smart_cache | cjktools/smart_cache.py | cjktools/smart_cache.py | # -*- coding: utf-8 -*-
#
# smart_cache.py
# cjktools
#
"""
This module implements a smart caching function, with dependencies.
"""
import common
import cPickle as pickle
import types
import os
from os import path
def disk_proxy_direct(method, cache_file, dependencies=[]):
"""
Creates a proxy for an expen... | Python | 0.000001 | @@ -147,33 +147,8 @@
mon%0A
-import cPickle as pickle%0A
impo
@@ -187,16 +187,86 @@
t path%0A%0A
+from six import string_types%0Afrom six.moves import cPickle as pickle%0A%0A
%0Adef dis
@@ -866,33 +866,33 @@
print
-
+(
'%5Bcache miss: %25s
@@ -916,32 +916,33 @@
name(cache_file)
+)
%0A # c... |
3026d78dc6e2a0f6f391819370f2369df94e77eb | Move Data Portal / Other to bottom of contact select | ckanext/nhm/settings.py | ckanext/nhm/settings.py | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
from collections import OrderedDict
# the order here matters as the default option should always be first in the dict so that it is
# automatically selected in combo boxes that use this li... | Python | 0 | @@ -380,55 +380,8 @@
t(%5B%0A
- ('Data Portal / Other', 'data@nhm.ac.uk'),%0A
@@ -864,11 +864,58 @@
c.uk'),%0A
+ ('Data Portal / Other', 'data@nhm.ac.uk'),%0A
%5D)%0A
|
2105143c63292ec225258b3ca129156d858cf972 | Use OrderParameterDistribution objects in wetting. | coex/wetting.py | coex/wetting.py | """Find the wetting properties of a direct or expanded ensemble
grand canonical simulation.
"""
import numpy as np
def get_cos_theta(s, d):
"""Calculate the cosine of the contact angle.
Args:
s: A float (or numpy array): the spreading coefficient.
d: A float (or numpy array): the drying coef... | Python | 0 | @@ -462,36 +462,44 @@
ing_coefficient(
-lnpi
+distribution
):%0A %22%22%22Calcul
@@ -549,55 +549,96 @@
-lnpi: The logarithm of the probability distribu
+distribution: An OrderParameterDistribution from a direct (GC)%0A drying simula
tion
@@ -778,36 +778,62 @@
potential = -
-lnpi
+distribution... |
a962e631b0fc997a6a5569244463c3f96da8b671 | add extra fwhm2sigma test | lib/neuroimaging/fmri/tests/test_utils.py | lib/neuroimaging/fmri/tests/test_utils.py | import unittest
import numpy as N
import scipy
from neuroimaging.fmri.utils import CutPoly, WaveFunction, sigma2fwhm, fwhm2sigma
class utilTest(unittest.TestCase):
def test_CutPoly(self):
f = CutPoly(2.0)
t = N.arange(0, 10.0, 0.1)
y = f(t)
scipy.testing.assert_almost_equal(y,... | Python | 0.000001 | @@ -1173,32 +1173,72 @@
(1.0, 5.0, 0.1)%0A
+ sigma = N.arange(1.0, 5.0, 0.1)%0A
scipy.te
@@ -1299,16 +1299,96 @@
, fwhm)%0A
+ scipy.testing.assert_almost_equal(fwhm2sigma(sigma2fwhm(sigma)), sigma)%0A
|
43c46d69580ebdfaa663653fabd3222bdf51fa76 | Remove pdb from pepper_rpg.py | pepper_rpg.py | pepper_rpg.py | class Color:
""" Adds basic colors for print statements """
RED = '\033[91m'
PURPLE = '\033[95m'
YELLOW = '\033[93m'
END = '\033[0m'
def showInstructions():
""" print a main menu and the commands """
print(Color.PURPLE + "Welcome to Pepper RPG v 1.0!" + Color.END)
print("========")
... | Python | 0.000009 | @@ -4219,46 +4219,8 @@
oom%0A
- # import pdb; pdb.set_trace()%0A
|
108763ace5f250922387aacffab4a668155cfe67 | deploy script changes | deploy/fabfile.py | deploy/fabfile.py | # -*- coding: utf-8 -*-
# http://docs.fabfile.org/en/1.5/tutorial.html
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager
@_contextmanager
def virtualenv():
with prefix(env.virtualenv_activate):
yield
env.hosts = ['176.58.125.166']
env.... | Python | 0.000001 | @@ -422,17 +422,16 @@
'source
-.
venv/bin
@@ -985,23 +985,23 @@
loy/
-wsgi_handler.py
+rootio_web.wsgi
%22)%0A%0A
@@ -1171,29 +1171,42 @@
-#todo: alembic update
+run(%22python manage.py migrate up%22)
%0A
@@ -1255,16 +1255,17 @@
i()%0A
+#
restart_
|
34fa7433ea6f04089a420e0392605147669801d1 | Revert "added more crappy codes" | dummy.py | dummy.py | import os
def foo():
"""
This is crappy function. should be removed using git checkout
"""
if True == True:
return True
else:
return False
def main():
pass
if __name__ == '__main__':
main()
| Python | 0 | @@ -93,61 +93,19 @@
%22%22%0A%09
-if True == True:%0A%09%09return True%0A%09else:%0A%09%09return False%0A
+return None
%0A%0Ade
|
4c25ae60bcf65d206e9bb3ee7467a2106021a490 | fix usage of version with svn import (#71) | vcstool/clients/svn.py | vcstool/clients/svn.py | import os
from xml.etree.ElementTree import fromstring
from .vcs_base import VcsClientBase, which
class SvnClient(VcsClientBase):
type = 'svn'
_executable = None
@staticmethod
def is_repository(path):
return os.path.isdir(os.path.join(path, '.svn'))
def __init__(self, path):
su... | Python | 0 | @@ -3803,17 +3803,17 @@
l += '@%25
-d
+s
' %25 comm
|
e4850d9ba5cb4733862194298cdbb8a34766b39f | update tests for new api | reddit.py | reddit.py | import json, random, urllib2
def declare():
return {"reddit": "privmsg", "guess": "privmsg"}
def callback(self):
channel = self.channel
command = self.command
user = self.user
msg = self.message
type = self.type
isop = self.isop
if command == 'guess':
u = 'SwordOrSheath'
e... | Python | 0 | @@ -2296,134 +2296,270 @@
-u
+c
= %22
-joe!username@hostmask%22%0A c = '#test'%0A%0A if callback(api, '', True
+#test%22%0A %0A setattr(api, 'isop', True)%0A setattr(api, 'type', 'privmsg')%0A setattr(api, 'command', 'reddit')%0A setattr(api, 'user', 'joe!username@hostmask')%0A setattr(a... |
fb3949f74271b98caa427eee9d1be5d36e370627 | modify components from list to set | rdhinet.py | rdhinet.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dongdong Tian @ USTC
#
# Revision History:
# 2014-09-03 Dongdong Tian Initial Coding
#
"""Extract SAC data files from Hi-net WIN32 files
Usage:
rdhinet.py DIRNAME [-C <comps>] [-D <outdir>] [-P <procs>]
rdhinet.py -h
Options:
-h Sh... | Python | 0 | @@ -347,46 +347,59 @@
s%3E
-Components list separated with commas.
+Selection of components to extract.%0A
Ava
@@ -418,32 +418,16 @@
ents are
-%0A
U, N, E
@@ -433,17 +433,16 @@
E, X, Y.
-
%5Bdefaul
@@ -449,11 +449,9 @@
t: U
-,N,
+N
E%5D%0A
@@ -3533,16 +3533,20 @@
comps =
+... |
acd0b8803579ece5b52a3158c05140ff1287f0be | Handle string values better in FilterComparison.__str__ | odin/filtering.py | odin/filtering.py | # -*- coding: utf-8 -*-
from .traversal import TraversalPath
class FilterAtom(object):
"""
Base filter statement
"""
def __call__(self, resource):
raise NotImplementedError()
def any(self, collection):
return any(self(r) for r in collection)
def all(self, collection):
... | Python | 0.000019 | @@ -17,16 +17,27 @@
f-8 -*-%0A
+import six%0A
from .tr
@@ -1818,32 +1818,154 @@
__str__(self):%0A
+ value = self.value%0A if isinstance(self.value, six.string_types):%0A value = '%22%7B%7D%22'.format(value)%0A%0A
if self.
@@ -2134,29 +2134,24 @@
tor_symbol,
-self.
value)%0A ... |
55b3dd5caed31fe884bb652453ae6e29bf789e65 | add try/catch around stats logging | omgeo/__init__.py | omgeo/__init__.py | import copy
import logging
from omgeo.places import PlaceQuery
from omgeo.postprocessors import DupePicker, SnapPoints
import time
stats_logger = logging.getLogger('omgeo.stats')
class Geocoder():
"""
Class for building a custom geocoder using external APIs.
"""
DEFAULT_SOURCES = [['omgeo.services.Es... | Python | 0 | @@ -2938,32 +2938,59 @@
, waterfall=None
+, force_stats_logging=False
):%0A %22%22%22%0A
@@ -5113,16 +5113,33 @@
dict__)%0A
+ try:%0A
@@ -5168,16 +5168,123 @@
s_dict)%0A
+ except Exception as exception:%0A if force_stats_logging:%0A raise exception%0A
... |
e5421ed64887e05c60bedae956cb3a31fb6d9130 | Version bump to 2.1.0 | wagtailnews/version.py | wagtailnews/version.py | version_info = (0, 18, 1)
version = '.'.join(map(str, version_info))
| Python | 0 | @@ -13,16 +13,15 @@
= (
-0
+2
, 1
-8
,
-1
+0
)%0Ave
|
3de9ff408d911d536a45ba3bd6aafa64a178627b | Fix lint | weasyprint/svg/text.py | weasyprint/svg/text.py | """
weasyprint.svg.text
-------------------
Draw text.
"""
from math import cos, radians, sin
from .bounding_box import EMPTY_BOUNDING_BOX, extend_bounding_box
from .utils import color, normalize, size
class TextBox:
"""Dummy text box used to draw text."""
def __init__(self, pango_layout, styl... | Python | 0.000032 | @@ -191,15 +191,8 @@
port
- color,
nor
|
178bde1703bbb044f8af8c70a57517af4490a3c0 | Fix duplicate cookie issue and header parsing | databot/handlers/download.py | databot/handlers/download.py | import time
import requests
import bs4
from databot.recursive import call
class DownloadErrror(Exception):
pass
def dump_response(response):
return {
'headers': dict(response.headers),
'cookies': dict(response.cookies),
'status_code': response.status_code,
'encoding': respon... | Python | 0.000001 | @@ -31,16 +31,27 @@
port bs4
+%0Aimport cgi
%0A%0Afrom d
@@ -225,29 +225,24 @@
'cookies':
-dict(
response.coo
@@ -245,16 +245,26 @@
.cookies
+.get_dict(
),%0A
@@ -1105,16 +1105,23 @@
ent_type
+_header
= data.
@@ -1157,16 +1157,85 @@
nt-Type'
+, '')%0A content_type, params = cgi.parse_header(content_... |
3722a807adf7d9458dd48d02bb3362aceeaf9051 | Fix error | datasets/tests/test_views.py | datasets/tests/test_views.py | from django.test import Client, TestCase
from datasets.models import *
from datasets.views import *
from datasets.forms import *
from datasets.management.commands.generate_fake_data import create_sounds, create_users, create_annotations
class ContributeTest(TestCase):
fixtures = ['datasets/fixtures/initial.json']
... | Python | 0.000004 | @@ -501,32 +501,97 @@
category(self):%0A
+ dataset = Dataset.objects.get(short_name='fsd')%0A %0A
# get a
@@ -627,16 +627,16 @@
otation%0A
-
@@ -927,32 +927,59 @@
), 12)%0A %0A
+ # create form data%0A
form_dat
@@ -1604,28 +1604,47 @@
%253%5D%0A
+%0A
... |
5de8209ec751fec9178a86e713393d8eafb7a124 | Abort when strange things happen | emwin.py | emwin.py | from time import strptime, mktime
import logging
import sys
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s'))
log = logging.getLogger('emwin')
log.addHandler(handler)
log.setLevel(logging.DEBUG)
class Connection(object):
def __init__(self,... | Python | 0.000008 | @@ -26,16 +26,22 @@
, mktime
+, time
%0Aimport
@@ -356,69 +356,425 @@
ock%0A
-%0A def __iter__(self):%0A buf = ''%0A while True:
+ self.ident = 'ByteBlast Client%7CNM-emwin@synack.me%7CV1'%0A self.ident = ''.join(%5Bchr(ord(x) %5E 0xFF) for x in self.ident%5D)%0A%0A def __iter__(se... |
32446090486db452342ec76606d28a05f6736e81 | Update tracking.py | panoptes/state/states/default/tracking.py | panoptes/state/states/default/tracking.py | import time
def on_enter(event_data):
""" The unit is tracking the target. Proceed to observations. """
pan = event_data.model
pan.say("Checking our tracking")
next_state = 'parking'
try:
pan.say("I'm adjusting the tracking rate")
pan.observatory.update_tracking()
next_sta... | Python | 0.000001 | @@ -259,24 +259,25 @@
e%22)%0A
+#
pan.observat
|
027b0b3471e62574f0b6025ba93b45756c8cd70e | correct bug scf only parsing, name error | data_magic.py | data_magic.py | import re
import hashlib
from parser import *
def line():
print('----------------------')
def debug(simulations, id_s):
for y in simulations[id_s]:
print(y)
print(simulations[id_s][y])
line()
def file_parser(file, log=None):
"""
file: name of the file as string
log: Tex... | Python | 0 | @@ -5163,32 +5163,38 @@
simulation
+s%5Bkey%5D
.update(e.parsed
@@ -5218,32 +5218,38 @@
simulation
+s%5Bkey%5D
%5B'damage'%5D = Tru
@@ -5274,16 +5274,18 @@
se()%0A
+ #
debug(s
|
cbae828ee9eb91a2373a415f1a1521fb5dee3100 | Add method to generate list of abscissa dicts | datac/main.py | datac/main.py | # -*- coding: utf-8 -*-
import copy
| Python | 0 | @@ -29,8 +29,1140 @@
rt copy%0A
+%0Adef init_abscissa(params, abscissae, abscissa_name):%0A %22%22%22%0A List of dicts to initialize object w/ calc method%0A%0A This method generates a list of dicts; each dict is sufficient to initialize an object featuring a calculator method of interest. This list can be th... |
cd5053ac36e13b57e95eeb1241032c97b48a4a85 | Drop try/catch that causes uncaught errors in the Observer to be silently ignored | planetstack/openstack_observer/backend.py | planetstack/openstack_observer/backend.py | import threading
import time
from observer.event_loop import PlanetStackObserver
from observer.event_manager import EventListener
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
class Backend:
def run(self):
try:
# start the openstack observer
obser... | Python | 0 | @@ -244,21 +244,8 @@
f):%0A
- try:%0A
@@ -669,78 +669,6 @@
rt()
-%0A except:%0A logger.log_exc(%22Exception in child thread%22)
%0A%0A
|
b725ef74f8e6f0887737e13783062b987fb3dd77 | bump to 7.0.3 final | device_inventory/__init__.py | device_inventory/__init__.py | VERSION = (7, 0, 3, 'beta', 6)
def get_version():
"Returns a PEP 386-compliant version number from VERSION."
assert len(VERSION) == 5
assert VERSION[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha relea... | Python | 0.000002 | @@ -18,16 +18,17 @@
3, '
-beta', 6
+final', 0
)%0A%0A%0A
|
584c2f69df66bd08ace0652da7337e8e71a72099 | Use bool for zero_mask. Requires pytorch 1.7+ | projects/transformers/models/sparse_embedding.py | projects/transformers/models/sparse_embedding.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | Python | 0.000001 | @@ -2405,18 +2405,78 @@
rch.bool
+,%0A device=module.weight.device
)%0A
-
@@ -2657,85 +2657,8 @@
se%0A%0A
- # Use float16 because pytorch distributed nccl doesn't support bools%0A
@@ -2708,15 +2708,8 @@
mask
-.half()
)%0A%0A
@@ -2768,16 +2768,16 @@
(self):%0A
... |
3587c608cde4f273d33a572c0bf44dbe2b003250 | better initial negative rate | python/alpenglow/experiments/FactorExperiment.py | python/alpenglow/experiments/FactorExperiment.py | import alpenglow.Getter as rs
import alpenglow as prs
class FactorExperiment(prs.OnlineExperiment):
"""FactorExperiment(dimension=10,begin_min=-0.01,begin_max=0.01,learning_rate=0.05,regularization_rate=0.0,negative_rate=0.0)
This class implements an online version of the well-known matrix factorization reco... | Python | 0.998618 | @@ -2457,18 +2457,18 @@
ve_rate=
+1
0
-.
0,%0A
|
37fa40a9b5260f8090adaa8c15d3767c0867574f | Create a list of messages that contain system time. | python/fusion_engine_client/messages/__init__.py | python/fusion_engine_client/messages/__init__.py | from .core import *
from . import ros
message_type_to_class = {
# Navigation solution messages.
PoseMessage.MESSAGE_TYPE: PoseMessage,
PoseAuxMessage.MESSAGE_TYPE: PoseAuxMessage,
GNSSInfoMessage.MESSAGE_TYPE: GNSSInfoMessage,
GNSSSatelliteMessage.MESSAGE_TYPE: GNSSSatelliteMessage,
# Sensor m... | Python | 0.00003 | @@ -883,8 +883,117 @@
sage,%0A%7D%0A
+%0Amessages_with_system_time = %5Bt for t, c in message_type_to_class.items() if hasattr(c(), 'system_time_ns')%5D%0A
|
82f68c3a0bd734dc9a639d9c257b26f5720c0d9c | add prepare_dir | decorators.py | decorators.py | __author__ = 'zz'
from functools import wraps
from requests import Timeout, ConnectionError
from socket import timeout as socket_timeout
import logging
from .models import ArbitraryAccessObject
from shutil import get_terminal_size
timeouts = (Timeout, socket_timeout, ConnectionError)
def threading_lock(lock):
... | Python | 0.000001 | @@ -1,21 +1,13 @@
-__author__ = 'zz'
+import os
%0A%0Afr
@@ -273,16 +273,33 @@
Error)%0A%0A
+__author__ = 'zz'
%0A%0A%0Adef t
@@ -2448,28 +2448,304 @@
**kwargs)%0A return wrapper
+%0A%0A%0Adef prepare_dir(dirname):%0A def decorator(func):%0A @wraps(func)%0A def wrapper(*args, **kwargs):%0A ... |
9ff314c9481605e174769416dec1b71e16936b83 | Fix unicode error when creating SHA1 sum for ical UID | demo/utils.py | demo/utils.py | from datetime import datetime, time, timedelta
import hashlib
def export_event(event, format='ical'):
# Only ical format supported at the moment
if format != 'ical':
return
# Begin event
# VEVENT format: http://www.kanzaki.com/docs/ical/vevent.html
ical_components = [
'BEGIN:VCALE... | Python | 0.000184 | @@ -1446,27 +1446,23 @@
-uid = hashlib.sha1(
+event_string =
even
@@ -1488,16 +1488,72 @@
atetime)
+%0A uid = hashlib.sha1(event_string.encode('utf-8')
).hexdig
|
6188363861cc3310e48556d33ec8a92758c88215 | Fix code | dbaas_zabbix/provider.py | dbaas_zabbix/provider.py | # -*- coding: utf-8 -*-
import logging
LOG = logging.getLogger(__name__)
STATUS_ENABLE = 0
STATUS_DISABLE = 1
def set_client_group(attribute):
def decorator(method):
def wrapper(*args, **kwargs):
self = args[0]
kwargs["hostgroups"] = list(getattr(self.dbaas_api, attribute))
... | Python | 0.000927 | @@ -6177,17 +6177,16 @@
oupid':
-'
hostgrou
@@ -6189,17 +6189,16 @@
group_id
-'
%7D,%0A
|
d99dfa94a42d70900e31c36023602bea3e5efdfb | Bump forgotten version to 3.2 | debinterface/__init__.py | debinterface/__init__.py | # -*- coding: utf-8 -*-
"""Imports for easier use"""
from .adapter import NetworkAdapter
from .adapterValidation import NetworkAdapterValidation
from .dnsmasqRange import (DnsmasqRange,
DEFAULT_CONFIG as DNSMASQ_DEFAULT_CONFIG)
from .hostapd import Hostapd
from .interfaces import Interfaces
f... | Python | 0 | @@ -428,9 +428,9 @@
'3.
-1
+2
.0'%0A
|
e9e6d5a6c42ff1522010f003fbed2cd324eab48e | Update cluster config | configs/config_cluster.py | configs/config_cluster.py | CDNA = '/home/cmb-panasas2/skchoudh/genomes/hg19/kallisto/hg19'
GENOMES_DIR='/home/cmb-panasas2/skchoudh/genomes'
OUT_DIR = '/home/cmb-panasas2/skchoudh/HuR_results/analysis/rna_seq_star_hg38_annotated'
RAWDATA_DIR ='/home/cmb-06/as/skchoudh/data/HuR_Mouse_Human_liver/rna-seq/Penalva_L_08182016'
SAMPLES=['HepG2_CTRL1_S... | Python | 0.000001 | @@ -162,16 +162,13 @@
lts/
-analysis
+human
/rna
@@ -193,16 +193,98 @@
otated'%0A
+SRC_DIR = '/home/cmb-panasas2/skchoudh/github_projects/clip_seq_pipeline/scripts'%0A
RAWDATA_
@@ -809,10 +809,363 @@
on.gtf'%0A
+GENE_NAMES = GENOMES_DIR + '/' + GENOME_BUILD + '/annotation/' + GENOME_BUILD+'_gene_names_stripped.tsv... |
64a54f6ca784e9cabc9048b9fe14f8594ad5e5c6 | fix signal to create a SocialUser profile object | src/moderation/signals.py | src/moderation/signals.py | import logging
import random
import os
from django.db.utils import DatabaseError
from django.db import transaction
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
from moderation.thumbnail import generate_thumbnail
from moderation.models import (
... | Python | 0 | @@ -3979,34 +3979,24 @@
ttr(instance
-.moderator
, 'profile')
|
79eb9241ac8ce36b14512287bc473a426db50cf1 | Use elif to make it faster. | Example/Pluton/Plugins/Example/Example.py | Example/Pluton/Plugins/Example/Example.py | import clr
import sys
clr.AddReferenceByPartialName("UnityEngine")
clr.AddReferenceByPartialName("Pluton")
import UnityEngine
import Pluton
from Pluton import InvItem
from System import *
from UnityEngine import *
class Example:
def On_PlayerConnected(self, player):
for p in Server.ActivePlayers:
if(p.Name != p... | Python | 0 | @@ -779,24 +779,26 @@
ventory)%0A%09%09%09
+el
if(cmd.cmd =
@@ -976,24 +976,26 @@
.Z + 3))%0A%09%09%09
+el
if(cmd.cmd =
@@ -1194,8 +1194,9 @@
.args)))
+%0A
|
9af1cbe0676ca71edecfa6d44c66690a5a583b01 | Rewrite for clarity | constructive_hierarchy.py | constructive_hierarchy.py | '''Reason about a directed graph in which the (non-)existence of some edges
must be inferred by the disconnectedness of certain vertices. Collect (truthy)
evidence for boolean function return values.'''
def transitive_closure_dict(vertices, edges):
'''Find the transitive closure of a dict mapping vertices to their... | Python | 0.000008 | @@ -225,16 +225,22 @@
re_dict(
+known_
vertices
@@ -241,32 +241,32 @@
rtices, edges):%0A
-
'''Find the
@@ -338,25 +338,29 @@
-neighbour
+found_vertice
s = %7Bb:
vert
@@ -355,16 +355,22 @@
s = %7Bb:
+known_
vertices
@@ -385,16 +385,20 @@
a, b),)%0A
+
@@ -429,24 +429,30 @@
ges if a in... |
7760d75bb5ca38d2c96924e0ea1d65485cdc5c6f | Update version 0.12.2 -> 0.12.3 | dimod/__init__.py | dimod/__init__.py | # Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Python | 0.000001 | @@ -697,17 +697,17 @@
= '0.12.
-2
+3
'%0A%0Afrom
|
a06204dcc8f9527135de7b1711234a03230d3e47 | Change the name of the class that takes care of user ID validation. | src/server/rest_api.py | src/server/rest_api.py | #!/usr/bin/env python3
#
# Copyright (c) 2016 Erik Nordstrøm <erik@nordstroem.no>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS... | Python | 0 | @@ -1115,19 +1115,18 @@
DValidat
-ion
+or
:%0A%0A d
@@ -4232,19 +4232,18 @@
DValidat
-ion
+or
(), Requ
|
8d72c58ac607f75c0a10ca9b79be9da59907cc7a | Update dev setting | src/server/settings.py | src/server/settings.py | """
Django settings for server project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | Python | 0 | @@ -2088,20 +2088,27 @@
AME' : '
-edge
+toolbox_dev
',%0A
|
4d983708981029f0c0c5d103f8329427ff824b1f | add user output when generating key pair | conda_build/main_sign.py | conda_build/main_sign.py | # (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... | Python | 0.000004 | @@ -622,16 +622,67 @@
(name):%0A
+ print(%22Generating public/private key pair...%22)%0A
rand
@@ -821,34 +821,31 @@
S_DIR)%0A%0A
-with open(
+path =
join(KEYS_DI
@@ -848,24 +848,87 @@
S_DIR, name)
+%0A print(%22Storing private key: %25s%22 %25 path)%0A with open(path
, 'wb') as f
@@ -993,26 +993... |
580f8f477ccffa022f64c0f11686d51eb659ca26 | Add a levelname Python logging key that is consistent with Java level names. | openquake/logs.py | openquake/logs.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuake is distributed in the hope that it will be... | Python | 0.999954 | @@ -4166,16 +4166,98 @@
=W0105%0A%0A
+ LEVELNAMES = %7B%0A 'WARNING': 'WARN',%0A 'CRITICAL': 'FATAL',%0A %7D%0A%0A
# py
@@ -6165,16 +6165,17 @@
# the
+y
reach d
@@ -6333,24 +6333,145 @@
y%5D = value%0A%0A
+ new_record.__dict__%5B'loglevel'%5D = %5C%0A self.LEVELNAMES.g... |
0d8591cca2b7d9687c8915e1caf6f6af85e974f6 | Comment PEP | TBFW/core.py | TBFW/core.py | # coding=utf-8
import gc
import json
import random
import socket
import threading
import time
import traceback
import urllib
from datetime import datetime
from logging import getLogger, Formatter, FileHandler, INFO, CRITICAL
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
fr... | Python | 0 | @@ -378,17 +378,16 @@
anager%0A%0A
-%0A
class Co
@@ -853,16 +853,17 @@
mId%0A%0A%09%09#
+
connect
@@ -888,24 +888,25 @@
fo.Host)%0A%09%09#
+
self.db = co
@@ -914,24 +914,25 @@
nect.bot%0A%09%09#
+
self.db.auth
@@ -1002,16 +1002,17 @@
hod)%0A%09%09#
+
self.Set
@@ -5136,16 +5136,17 @@
%5D.remove(plugin)
+... |
00b7cf15877dc17d07d591c893671decb6b869e2 | Enable touch events for smoothness tests. | tools/perf/measurements/smoothness.py | tools/perf/measurements/smoothness.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from metrics import power
from measurements import smoothness_controller
from telemetry.page import page_measurement
class Smoothness(page_measurement.... | Python | 0.00001 | @@ -587,16 +587,77 @@
rking')%0A
+ options.AppendExtraBrowserArgs('--touch-events=enabled')%0A
powe
|
afb37f495f32ab03ea1a2b2dff566ae3d20eff5b | fix exception raising in svg2pdf | IPython/nbconvert/transformers/svg2pdf.py | IPython/nbconvert/transformers/svg2pdf.py | """Module containing a transformer that converts outputs in the notebook from
one format to another.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license i... | Python | 0.000001 | @@ -3506,21 +3506,20 @@
r
-eturn
+aise
TypeErr
|
cf2004cec6e84cbec213f9e70dd8245327af541d | Update api.py | example/services/api.py | example/services/api.py | # external imports
from nautilus import APIGateway
from graphene import Schema, ObjectType, String, Mutation, Boolean
from nautilus.api import ServiceObjectType
from nautilus.api.fields import Connection
from nautilus.network import dispatchAction
from nautilus.conventions import getCRUDAction
# local imports
from .rec... | Python | 0.000001 | @@ -1172,32 +1172,8 @@
ry%0A%0A
-%0A# third party imports%0A%0A
clas
|
c4b83c9554ca0f501ac42c63a53394ff8b90c2af | bump version to 20190807 | acbs/__init__.py | acbs/__init__.py | __version__ = '20181007'
| Python | 0 | @@ -15,11 +15,11 @@
'201
-810
+908
07'%0A
|
c1c2ce6faa236fd37cf7b484b08f370d435d59f5 | Make pyflakes happy | di-cleaner.py | di-cleaner.py | #!/usr/bin/env python
import argparse
import atexit
import logging
import sys
from datetime import datetime
from pprint import pformat
from operator import itemgetter
from docker import Client
from humanfriendly import format_size
DEFAULT_DOCKER_BASE_URL = 'unix://var/run/docker.sock'
HELP_DOCKER_BASE_URL = (
'Re... | Python | 0.00006 | @@ -4198,13 +4198,8 @@
tion
- as e
:%0A
|
99cfafa9e0382e71644731590a1cc5737183e506 | add exclude flag and some additional regexes to exclude strings that shouldn't be translated | django-template-i18n-lint.py | django-template-i18n-lint.py | #! /usr/bin/python
"""
Prints out all
"""
import os
import re
import sys
from optparse import OptionParser
def location(str, pos):
"""Given a string str and an integer pos, find the line number and character in that line that correspond to pos"""
lineno, charpos = 1, 1
counter = 0
for char in str:
... | Python | 0 | @@ -1511,32 +1511,210 @@
ummary)=%22%5B%5E%22%5D*?%22
+%0A %0A # Any html attribute that's not value or title%0A %7C%5Ba-z:-%5D+?(?%3C!alt)(?%3C!value)(?%3C!title)(?%3C!summary)=%5B%5E%5CW%5D*?%5B(%5Cw%7C%3E)%5D%0A %0A %7C%5B(SELECTED%7CCHECKED)%5D
%0A%0A # HTM
@@ -1907,16 +... |
ec831928b9e065b523eae2621f51091a8e332c71 | Be more verbose | pissuu/api.py | pissuu/api.py | import requests
import md5
import json
class IssuuAPI(object):
def __init__(self, key, secret):
"""
Initialize an API client with the given ``key`` and ``secret``.
"""
self.key = key
self.secret = secret
def add_bookmark(self):
"""
Add a bookmark.
... | Python | 0.999847 | @@ -3260,17 +3260,40 @@
as JSON
-'
+: %25s' %25 response.content
)%0A%0A
|
2b20e803733db09ad4643be00b2af11ecea1eeb8 | Increase version to 0.11.0 (#394) | opsdroid/const.py | opsdroid/const.py | """Constants used by OpsDroid."""
import os
__version__ = "0.10.0"
DEFAULT_GIT_URL = "https://github.com/opsdroid/"
MODULES_DIRECTORY = "opsdroid-modules"
DEFAULT_ROOT_PATH = os.path.expanduser("~/.opsdroid")
DEFAULT_LOG_FILENAME = os.path.join(DEFAULT_ROOT_PATH, 'output.log')
DEFAULT_MODULES_PATH = os.path.join(DEFA... | Python | 0 | @@ -56,17 +56,17 @@
_ = %220.1
-0
+1
.0%22%0A%0ADEF
|
058d006aef033b324d9facde848ee004fc54f9f4 | Add serialisation check | plot_check.py | plot_check.py | from scanpointgenerator import LineGenerator, CompoundGenerator
from scanpointgenerator.rectangular_roi import RectangularROI
from scanpointgenerator.circular_roi import CircularROI
from scanpointgenerator.spiralgenerator import SpiralGenerator
from scanpointgenerator.lissajousgenerator import LissajousGenerator
from s... | Python | 0 | @@ -2725,21 +2725,351 @@
)%0A%0A%0A
-grid_check()%0A
+def serialise_grid_check():%0A%0A x = LineGenerator(%22x%22, %22mm%22, 0.0, 4.0, 5, alternate_direction=True)%0A y = LineGenerator(%22y%22, %22mm%22, 0.0, 3.0, 4)%0A%0A gen = CompoundGenerator(%5Bx, y%5D, %5B%5D, %5B%5D)%0A%0A plot_generator(gen)%0A%0A ... |
a27eebab1381c5b94c9cf7e9411dda417198ce0c | fix paste logger | elmyra.ip.access.epo/setup.py | elmyra.ip.access.epo/setup.py | import os
from setuptools import setup, find_packages
#from distutils.core import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
# ----------------------------------------------
... | Python | 0.000008 | @@ -545,24 +545,49 @@
e==1.7.5.1',
+%0A 'PasteScript 1.7.5',
%0A%0A # cach
|
5f43ac2dbca1caba21b2d6f4afbc798323a0d79f | Clear memory more actively | osmhm/__init__.py | osmhm/__init__.py | import fetch
import filters
import inserts
import tables
import config
import send_notification
def run(time_type='hour', history=False, suspicious=False, monitor=True,
notification=False, notifier=send_notification.send_mail):
"""
"""
import osmhm
import osmdt
import datetime
import t... | Python | 0 | @@ -1217,16 +1217,44 @@
_stream)
+%0A del data_stream
%0A%0A
@@ -1419,16 +1419,44 @@
_object)
+%0A del data_object
%0A%0A
@@ -2074,16 +2074,60 @@
ifier)%0A%0A
+ del changesets, objects, users%0A%0A
|
71b6df9745b677187f4e36eda2a54db2ffc54676 | Remove extra slash | democracylab/settings.py | democracylab/settings.py | """
Django settings for democracylab project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impo... | Python | 0.00007 | @@ -4627,9 +4627,8 @@
'')
-%5C
%0A%0AGO
|
9e146c540f01cd243bf9886763fde45c5897396a | Remove network and executable on uninstall | dip/config.py | dip/config.py | """
Dip configuration.
"""
import collections
import os
import re
import subprocess
import time
import sys
from copy import deepcopy
import click
import compose.cli.command
import easysettings
import git
from . import __version__
from . import colors
from . import defaults
from . import exc
from . import utils
DEFAUL... | Python | 0 | @@ -2525,32 +2525,396 @@
nfig entry. %22%22%22%0A
+ # Remove executable%0A try:%0A path = os.path.join(self%5Bname%5D.path, name)%0A os.remove(path)%0A except (OSError, IOError):%0A pass%0A%0A # Remove network%0A try:%0A self%5Bname%5D.proj... |
8f4f1e8cc45daa8cf49f050200ce17a48f008e5a | Fix process entity migration | resolwe/flow/migrations/0023_process_entity_2.py | resolwe/flow/migrations/0023_process_entity_2.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-01 03:15
from __future__ import unicode_literals
from django.db import migrations
def migrate_flow_collection(apps, schema_editor):
"""Migrate 'flow_collection' field to 'entity_type'."""
Process = apps.get_model('flow', 'Process')
Descript... | Python | 0.000006 | @@ -543,16 +543,82 @@
if
+(process.entity_descriptor_schema is not None and%0A
not Desc
@@ -692,16 +692,17 @@
exists()
+)
:%0A
|
21b453946bfa35c7730d5ab15e62b48d299170ed | Update password loading test | osfclient/tests/test_listing.py | osfclient/tests/test_listing.py | """Test `osf ls` command"""
from unittest import mock
from unittest.mock import patch, MagicMock, PropertyMock, mock_open
from osfclient import OSF
from osfclient.cli import list_
from osfclient.tests.mocks import MockProject
@patch('osfclient.cli.OSF')
def test_anonymous_doesnt_use_password(MockOSF):
args = M... | Python | 0 | @@ -684,54 +684,93 @@
-mock_open_func = mock_open(read_data=%22
+def simple_getenv(key):%0A if key == 'OSF_PASSWORD':%0A return '
secret
-%22)
+'
%0A%0A
@@ -802,42 +802,75 @@
li.o
-p
+s.get
en
+v
',
- mock_open_func, create=True)
+%0A side_effect=simple_getenv) as mock_geten... |
65db3a0c9fd0330c5bdca8125d2e752ef4774dd5 | add an arrow to show the direction of the route | osmroutes2maps.py | osmroutes2maps.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
from collections import defaultdict
from shapely.geometry import LineString, Point
from shapely.ops import linemerge
import gmplot
import urllib
import sys
import codecs
import pyproj
import yattag
import hashlib
routes = defaultdict(list)
osmfile = sys.argv[1... | Python | 0.000008 | @@ -2562,23 +2562,235 @@
map.
-plot(lats, lngs
+add_symbol('arrowSymbol', %7B'path': 'google.maps.SymbolPath.FORWARD_CLOSED_ARROW',%0A 'scale': 2%7D)%0A%0A gmap.plot(lats, lngs, icons=%7B'icon': 'arrowSymbol', 'offset': '7%25', 'repeat': '7%25'%7D
)%0A
|
e9060c166987a18aa9faf3b790b80135b319ecca | Update example.py | libs/python/example.py | libs/python/example.py | #!/usr/bin/env python
import postscriptbarcode
c=postscriptbarcode.BWIPP("../barcode.ps")
c.get_version()
| Python | 0.000001 | @@ -72,16 +72,44 @@
IPP(%22../
+../build/monolithic_package/
barcode.
|
068a94a455448b3fc2ee552616658d9f980104ea | Add comment. | numpy/distutils/command/bdist_rpm.py | numpy/distutils/command/bdist_rpm.py | import os
import sys
from distutils.command.bdist_rpm import bdist_rpm as old_bdist_rpm
class bdist_rpm(old_bdist_rpm):
def _make_spec_file(self):
spec_file = old_bdist_rpm._make_spec_file(self)
setup_py = os.path.basename(sys.argv[0])
if setup_py == 'setup.py':
return spec_fil... | Python | 0.000001 | @@ -201,16 +201,109 @@
le(self)
+%0A%0A # Replace hardcoded setup.py script name%0A # with the real setup script name.
%0A
|
6af3eacec303abfe6f260581687a38d89f7b7474 | Fix wavelength issue for QE65000 | oceanoptics/spectrometers/QE65xxx.py | oceanoptics/spectrometers/QE65xxx.py | # tested
# ----------------------------------------------------------
from oceanoptics.base import OceanOpticsBase as _OOBase
from oceanoptics.base import OceanOpticsTEC as _OOTEC
import struct
#----------------------------------------------------------
class _QE65xxx(_OOBase, _OOTEC):
def _set_integration_time(... | Python | 0.000001 | @@ -1485,16 +1485,261 @@
65000')%0A
+ # The QE65000 needs a -10 offset for calculating the wavelengths%0A # due to some legacy issues...%0A self._wl = sum( self._wl_factors%5Bi%5D *%0A np.arange(-10, self._pixels - 10, dtype=np.float64)**i for i in range(4) )%0A
|
7655ba80da745ef2491a7ef872683620d6328304 | Disable verbose logging by default | designateclient/shell.py | designateclient/shell.py | # Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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 r... | Python | 0.000001 | @@ -866,16 +866,46 @@
ssage)s'
+%0A DEFAULT_VERBOSE_LEVEL = 0
%0A%0A de
@@ -1136,16 +1136,16 @@
)%0A%0A
+
@@ -1188,348 +1188,8 @@
_)%0A%0A
- def configure_logging(self):%0A super(DesignateShell, self).configure_logging()%0A%0A # Set requests logging%0A requests_logger = ... |
654bd1be9dc2c22f77186f94bedcf1e06dbf3887 | Update import django re_path to support Django 4.0 | djangoql/admin.py | djangoql/admin.py | import json
from django.contrib import messages
from django.contrib.admin.views.main import ChangeList
from django.core.exceptions import FieldError, ValidationError
from django.db import DataError
from django.forms import Media
from django.http import HttpResponse
from django.template.loader import render_to_string
f... | Python | 0 | @@ -725,32 +725,37 @@
from django.
+conf.
urls import re_p
@@ -769,32 +769,122 @@
ept ImportError:
+%0A try: # Django %3E= 4.0%0A from django.urls import re_path%0A except ImportError:
# Django %3C2.0%0A
@@ -879,20 +879,25 @@
Django %3C
+
2.0%0A
+
from
|
ba81c1d04a9896f1e24ca43592b93b26047705ef | Clean up command output | openstackclient/compute/v2/server.py | openstackclient/compute/v2/server.py | # Copyright 2012 OpenStack LLC.
# 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 b... | Python | 0.999995 | @@ -2309,16 +2309,19 @@
g.info('
+v2.
List_Ser
@@ -2327,98 +2327,31 @@
rver
-()')%0A self.log.info(' run(%25s)' %25 parsed_args)%0A self.app.stdout.write('hi!%5Cn'
+.run(%25s)' %25 parsed_args
)%0A%0Ac
@@ -2758,16 +2758,19 @@
g.info('
+v2.
Show_Ser
@@ -2776,98 +2776,31 @@
rver
-()')%0A self.... |
f4303bfba961ef7775e8a2f7c5e85980d6931bd5 | add hashbang | fetch.py | fetch.py | import json
import urllib2
import time
import collections
import ConfigParser
import MySQLdb as db
config = ConfigParser.RawConfigParser()
config.read('config.cfg')
db_host = config.get('mysql', 'host')
db_user = config.get('mysql', 'uname')
db_pass = config.get('mysql', 'pw')
db_name = config.get('mysql', 'db_name')... | Python | 0.000087 | @@ -1,12 +1,31 @@
+#!/usr/bin/python%0A%0A
import json%0A
|
f095e0a1a7aa3b277f86eb9029e9c663e1304a59 | Allow using non-local boost | config/cbang/__init__.py | config/cbang/__init__.py | from SCons.Script import *
import inspect
import os
def GetHome():
path = inspect.getfile(inspect.currentframe())
return os.path.dirname(os.path.abspath(path))
def ConfigLocalBoost(env):
boost_source = os.environ.get('BOOST_SOURCE', None)
if not boost_source: raise Exception, 'BOOST_SOURCE not set'
... | Python | 0.000001 | @@ -1505,20 +1505,16 @@
%0A if
-not
ConfigBo
@@ -1522,20 +1522,250 @@
st(conf)
- and
+:%0A disable_local = env.get('disable_local', %5B%5D)%0A if isinstance(disable_local, str): disable_local = disable_local.split()%0A disable_local.append('boost')%0A env.Replace(disable_local = disa... |
56ac633029c9d7ef40415e1881d2cb3c18c83d7b | Bump to version 0.17.1 | ckanny/__init__.py | ckanny/__init__.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
ckanny
~~~~~~
Miscellaneous CKAN utility scripts
Examples:
literal blocks::
python example_google.py
Attributes:
module_level_variable1 (int): Module level variables may be documented in
"""
from __future__ import (
absolute_import, divisi... | Python | 0 | @@ -472,17 +472,17 @@
= '0.17.
-0
+1
'%0A%0A__tit
|
20ffbab08c244ec788e8a6114ccdbf38e39d97b6 | Fix unclassifiable problem | classifier/demo.py | classifier/demo.py | """
This is a demo about how to use LibLINEAR to do the prediction
==============================================================
Usage: python demo.py
Author: Wenjun Wang
Date: June 18, 2015
"""
import pickle
import datetime
from liblinearutil import *
from feature import convert_query
# Read training file
#y, x ... | Python | 0.999999 | @@ -900,20 +900,18 @@
= '
-next comment
+Alan Black
'%0A#
@@ -1033,16 +1033,107 @@
'-b 0')%0A
+# Cannot classify it to any class%0Aif p_val%5B0%5D%5Bint(p_label%5B0%5D)-1%5D == 0:%0A p_label%5B0%5D = -1%0A
print p_
|
d1af8b3814edb3e38c27c36c25875809d26a76c7 | Comment HTTP handler | amerigo.py | amerigo.py | #!/usr/bin/env python
import socket
import http.server
import threading
import struct
import geojson
import argparse
import logging as log
FILE = "./position.geojson"
UDP_ADDR = "0.0.0.0"
UDP_PORT = 49000
# Relate the dataset (integer key) to the data (list of values)
rosetta = {1: ["real_time", "total_time", "miss... | Python | 0.000001 | @@ -682,16 +682,114 @@
ndler):%0A
+ %22%22%22%0A Turn the SimpleHTTPRequestHandler into a logging, simple%0A request handler%0A %22%22%22%0A%0A
def
|
6c1f487aa7ac472fc7f726b21d26c841625b176d | Edit feed content | routes.py | routes.py | from flask import Flask, render_template, redirect, url_for, request, session,\
flash, jsonify
from werkzeug.contrib.atom import AtomFeed
import os
import psycopg2
from functools import wraps
import urlparse
import datetime
app = Flask(__name__)
app.secret_key = os.environ['SECRET_KEY']
def connectDB(wrapped):
... | Python | 0.000001 | @@ -2873,16 +2873,20 @@
+ str(i
+ + 1
),%0A
@@ -2915,16 +2915,31 @@
ement%5B0%5D
+.strip() + ': '
+ annou
|
da31be1c27c7568fa50c89f28b04ad763481f541 | Remove unused import | rparse.py | rparse.py | #!/usr/bin/env python
# Copyright 2015, Dmitry Veselov
from re import sub
from plyplus import Grammar, STransformer, \
ParseError, TokenizeError
try:
# Python 2.x and pypy
from itertools import imap as map
from itertools import ifilter as filter
except ImportError:
# Python 3.x alrea... | Python | 0.000001 | @@ -52,27 +52,8 @@
lov%0A
-from re import sub%0A
from
|
6fdee7b4cda74d7e57d901607ef07e511a80d4c9 | Add white lines to separate methods. | rtmbot.py | rtmbot.py | #!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
import glob
import yaml
import json
import os
import sys
import time
import logging
from argparse import ArgumentParser
from slackclient import SlackClient
def dbg(debug_string):
if debug:
logging.info(debug_string)
class RtmBot(object):
... | Python | 0 | @@ -460,16 +460,17 @@
= None%0A
+%0A
def
@@ -634,24 +634,25 @@
m_connect()%0A
+%0A
def star
@@ -922,24 +922,25 @@
e.sleep(.1)%0A
+%0A
def auto
@@ -1140,16 +1140,17 @@
g = now%0A
+%0A
def
@@ -1423,24 +1423,25 @@
name, data)%0A
+%0A
def outp
@@ -1980,16 +1980,17 @@
= True%0A
+%0A
d... |
c3951f942633438e91e43b523a814bf1a3528295 | Add impl to analyzer. | analyze.py | analyze.py | #!/bin/python
from __future__ import print_function, division
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="""Analyze shogi board state in a photo""",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
args = parser.parse_args()
| Python | 0 | @@ -62,24 +62,63 @@
%0Aimport
-argparse
+cv%0Aimport cv2%0Aimport argparse%0Aimport preprocess
%0A%0Aif __n
@@ -308,36 +308,636 @@
er)%0A
-%0A args = parser.parse_args(
+ parser.add_argument(%0A 'photo', metavar='PHOTO', nargs=1, type=str,%0A help='Photo image path')%0A parser.add_argument(%0... |
f39c5650372c37585a1331e251c931758a7f240e | fix issue with absolute path | default.py | default.py | import socket
import plugin
import ssl
import user
class bot(object):
def __init__(self, server):
self.server = server
self.port = 6667
self.ssl = None
self.channels = []
self.connectedChannels = []
self.nick = 'default_nick'
self.realName = 'default_nick de... | Python | 0.000001 | @@ -43,16 +43,26 @@
ort user
+%0Aimport os
%0A%0Aclass
@@ -4730,17 +4730,62 @@
= open(
-'
+os.path.dirname(os.path.realpath(__file__))+'/
config.i
|
6c2adf0ff9f5026a4280b3e374429dcb7ef48dce | Enable using script directly | openfisca_web_api_preview/scripts/serve.py | openfisca_web_api_preview/scripts/serve.py | # -*- coding: utf-8 -*-
import sys
import imp
import os.path
import logging
import argparse
from gunicorn.app.base import BaseApplication
from gunicorn.six import iteritems
from gunicorn import config
from openfisca_core.scripts import add_minimal_tax_benefit_system_arguments
from ..app import create_app
from imp im... | Python | 0 | @@ -278,17 +278,41 @@
ts%0Afrom
-.
+openfisca_web_api_preview
.app imp
@@ -3254,28 +3254,88 @@
rser
-):%0A command_line_
+ = None):%0A if not parser:%0A parser = argparse.ArgumentParser()%0A
pars
@@ -3588,37 +3588,24 @@
figuration,
-command_line_
parser)%0A%0A
|
b5b40dc232b04a2cfa75438bb5143ffdb103a57c | split a method | AlphaTwirl/EventReader/ProgressReporter.py | AlphaTwirl/EventReader/ProgressReporter.py | # Tai Sakuma <sakuma@fnal.gov>
import multiprocessing
import time
from ProgressReport import ProgressReport
##____________________________________________________________________________||
class ProgressReporter(object):
def __init__(self, queue, pernevents = 1000):
self.queue = queue
self.perneve... | Python | 0.999953 | @@ -495,16 +495,97 @@
return%0A
+ self._report(event, component)%0A%0A def _report(self, event, component):%0A
|
6cc803f68876689629fa2c2bae1413d46a0d2002 | Update different-ways-to-add-parentheses.py | Python/different-ways-to-add-parentheses.py | Python/different-ways-to-add-parentheses.py | # Time: O(n * 4^n / n^(3/2)) ~= n * (Catalan numbers) = n * (C(2n, n) - C(2n, n - 1))
# Space: O(n^2 * 4^n / n^(3/2))
#
# Given a string of numbers and operators, return all possible
# results from computing all the different possible ways to
# group numbers and operators. The valid operators are +, - and *.
#
#
# Exa... | Python | 0.000014 | @@ -4,20 +4,16 @@
ime: O(
-n *
4%5En / n%5E
@@ -22,21 +22,16 @@
/2)) ~=
-n * (
Catalan
@@ -41,17 +41,11 @@
bers
-)
=
-n * (
C(2n
@@ -63,17 +63,16 @@
, n - 1)
-)
%0A# Space
|
c00b7d6af8c3fdbd45d08e69a06e4f03e4294219 | change to write from write_to_xhtml | epub_clean/unit_tests_epub.py | epub_clean/unit_tests_epub.py | import copy
import unittest
import os
import os.path
import shutil
import tempfile
import time
import lxml.html
import chapter
from constants import *
import epub
class TestEpub(unittest.TestCase):
def setUp(self):
chapter_dir = os.path.join(TEST_DIR, 'test_chapters')
chapter_factory = chapter.... | Python | 0.000001 | @@ -3736,17 +3736,8 @@
rite
-_to_xhtml
(out
|
08ae9fdccb285c4597fef83961ee1fbe2d04b86f | Fix to make_html_report | openquake/engine/tools/make_html_report.py | openquake/engine/tools/make_html_report.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | Python | 0.000002 | @@ -5041,20 +5041,16 @@
ormat())
-%5B1:%5D
%0A pag
|
ec013d194e2b26155949bf89a5cd03ef4a013cc5 | Add import unicode on csv_importer | passpie/importers/csv_importer.py | passpie/importers/csv_importer.py | import csv
from passpie.importers import BaseImporter
from passpie._compat import is_python2
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
for row in csv_reader:
if is_python2():
yield [unicode(cell, 'utf-8') f... | Python | 0.000004 | @@ -85,16 +85,25 @@
_python2
+, unicode
%0A%0A%0Adef u
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.