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 |
|---|---|---|---|---|---|---|---|
a5f42d195dc7d2fb6fefc29dac2e4e7d4b6479a4 | Put docstring at the top. | numscons/core/compiler_config.py | numscons/core/compiler_config.py | from ConfigParser import SafeConfigParser, ConfigParser
from os.path import join as pjoin, dirname as pdirname
from numscons.core.utils import partial
"""Module to handle compiler configuration.
Configurations are set into config files, and are obtained from get_*_config
functions. The object returned by those funct... | Python | 0 | @@ -1,157 +1,4 @@
-from ConfigParser import SafeConfigParser, ConfigParser%0Afrom os.path import join as pjoin, dirname as pdirname%0A%0Afrom numscons.core.utils import partial%0A%0A
%22%22%22M
@@ -304,16 +304,169 @@
es.%22%22%22%0A%0A
+from ConfigParser import SafeConfigParser, ConfigParser%0Afrom os.path import joi... |
b287aa2670f6260594b6047c6f6d5dc7b9dd31b1 | Use correct override_settings in liberation test | liberation/tests.py | liberation/tests.py | ##
# Copyright (C) 2014 Jessica Tallon & Matt Molyneaux
#
# This file is part of Inboxen.
#
# Inboxen is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | Python | 0 | @@ -5212,19 +5212,8 @@
ith
-test.utils.
over
|
e7f51a120a9b71a4a2a00ae5094857abb5bbf26a | Make this helper a little easier to use | lab/parser.py | lab/parser.py | """Parser.py: a main for invoking code in coverage/parser.py"""
import glob, os, sys
from optparse import OptionParser
import disgen
from coverage.misc import CoverageException
from coverage.parser import ByteParser, CodeParser
class AdHocMain(object):
"""An ad-hoc main for code parsing experiments."""
de... | Python | 0.000003 | @@ -232,21 +232,22 @@
%0A%0Aclass
-AdHoc
+Parser
Main(obj
@@ -264,16 +264,8 @@
%22%22%22A
-n ad-hoc
mai
@@ -1386,38 +1386,32 @@
self.
-adhoc_
one_file(options
@@ -1415,16 +1415,71 @@
ons, f)%0A
+ elif not args:%0A parser.print_help()%0A
@@ -1501,22 +1501,16 @@
self.
-... |
d3966eca1aff39640ae8a781d64e4e0525275110 | Add linhomy.candidate and linhomy.cdr_matrices to linhomy.selftest. | py/linhomy/selftest.py | py/linhomy/selftest.py | '''Run self-test on all modules
Run this as a module and it will perform the self-test.
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
if __name__ == '__main__':
import doctest
... | Python | 0 | @@ -333,16 +333,77 @@
linhomy%0A
+ import linhomy.candidate%0A import linhomy.cdr_matrices%0A
impo
@@ -725,16 +725,73 @@
inhomy,%0A
+ linhomy.candidate,%0A linhomy.cdr_matrices,%0A
|
505214b9146f31244d60b13a15b86142a11abe4b | add print_duration_context() | py/phl/phlsys_timer.py | py/phl/phlsys_timer.py | """Determine the wall clock duration of events."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_timer
#
# Public Classes:
# Timer
# .start
# .stop
# .restart
# .duration
#... | Python | 0.000009 | @@ -334,16 +334,43 @@
ctions:%0A
+# print_duration_context%0A
# time
@@ -675,16 +675,181 @@
etime%0A%0A%0A
+@contextlib.contextmanager%0Adef print_duration_context(name):%0A with timer_context() as t:%0A yield%0A print %22%7B%7D took %7B%7D secs%22.format(name, t.duration)%0A%0A%0A
@context
|
849587e22a99a084d974bd67fd32a4542f9eb961 | Add a log to help finding graphs problems | module/plugins/graphs/graphs.py | module/plugins/graphs/graphs.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | Python | 0.000002 | @@ -954,16 +954,47 @@
random%0A
+from shinken.log import logger%0A
%0A%0A### Wi
@@ -1462,16 +1462,87 @@
!= 200:%0A
+ logger.error(%22%5BWebUI-graph%5D Image URL not found: %25s%22, url)%0A
@@ -2747,20 +2747,16 @@
, 9999)%0A
-
%0A ret
|
170aef54155d4674a02a7ffab558b948f8ddd906 | change function name | bluesky/plan_tools.py | bluesky/plan_tools.py | import matplotlib.pyplot as plt
from matplotlib import collections as mcollections
from matplotlib import patches as mpatches
def path_plotter(plan, x_motor, y_motor, ax=None, probe_size=None):
"""Plot the raster path for this plan
Parameters
----------
plan : iterable
Must yield `Msg` objects... | Python | 0.000091 | @@ -130,19 +130,23 @@
ef p
-ath_plotter
+lot_raster_path
(pla
|
e926cd5201b1c818727b0aa6939e4ac6214b5e74 | Remove unused code | pyathenajdbc/cursor.py | pyathenajdbc/cursor.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from future.utils import raise_from
from past.builtins.misc import xrange
from pyathenajdbc.error import (DatabaseError, NotSupportedError, ProgrammingError)
from pyathenajdbc.util import (attach_thr... | Python | 0.000006 | @@ -4258,647 +4258,8 @@
()%0A%0A
- # def _rows(self):%0A # for field in self._result_set.__javaclass__.getDeclaredFields():%0A # print(field.name)%0A # if field.name == 'row':%0A # field.setAccessible(True)%0A # return field.get(self._result_set).get()%0A ... |
082a2fac6fa3ea9ba09e4e83eb987770c3e9cb75 | Fix bugs of return None data | catalog_api_demo/catalog_api_demo/views.py | catalog_api_demo/catalog_api_demo/views.py | from django.shortcuts import render
from django.template import RequestContext
from django.utils.encoding import uri_to_iri
from django.views.decorators.csrf import csrf_protect
from .forms import *
from get_access_token import get_access_token
import json
import re
import requests
import urlparse
from urllib import u... | Python | 0.998693 | @@ -1617,16 +1617,83 @@
.text))%0A
+%09if type(response_data) is dict:%0A%09%09response_data = %5Bresponse_data%5D%0A
%09return
|
6fd0924a92c33e4b6bb7570ac6847cfe8eb7c939 | read file as binary | corehq/apps/hqmedia/tasks.py | corehq/apps/hqmedia/tasks.py | from __future__ import absolute_import
from __future__ import unicode_literals
import os
import tempfile
from wsgiref.util import FileWrapper
from celery.task import task
from celery.utils.log import get_task_logger
from django.conf import settings
import zipfile
from corehq.apps.app_manager.dbaccessors import get_app
... | Python | 0.000059 | @@ -72,16 +72,36 @@
iterals%0A
+from io import open%0A
import o
@@ -6417,16 +6417,22 @@
en(fpath
+, 'rb'
)),%0A
|
6195a0665ed467f5a86f6e4ee5aab54bd1262ff7 | add data to api requests | pybamboo/connection.py | pybamboo/connection.py | import simplejson as json
import requests
from pybamboo.exceptions import ErrorParsingBambooData,\
ErrorRetrievingBambooData
DEFAULT_BAMBOO_URL = 'http://bamboo.io'
OK_STATUS_CODES = (200, 201, 202)
class Connection(object):
"""
Object that defines a connection to a bamboo instance.
"""
def _... | Python | 0.000001 | @@ -796,16 +796,29 @@
method%5D(
+%0A
self.url
@@ -824,16 +824,27 @@
l + url,
+ data=data,
files=f
|
a146ffdfdab8f02510f914c532fc193730da5559 | Update annual_emissions.py | cea/plots/optimization/annual_emissions.py | cea/plots/optimization/annual_emissions.py | from __future__ import division
from __future__ import print_function
import plotly.graph_objs as go
import cea.plots.optimization
from cea.plots.variable_naming import NAMING, COLOR
__author__ = "Daren Thomas"
__copyright__ = "Copyright 2019, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Jimeno A.... | Python | 0 | @@ -2997,108 +2997,8 @@
f):%0A
- self.multi_criteria = False # TODO: add capabilities to plot muticriteria in this plot too%0A
@@ -3060,19 +3060,8 @@
reto
-_with_multi
()%0A
@@ -3142,16 +3142,47 @@
fields)%0A
+ self.data_clean = data%0A
|
7a99a4d03fb00d25384135fd06c7fa8464c76539 | Fix __init__.py | pybitflyer/__init__.py | pybitflyer/__init__.py | Python | 0.0011 | @@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-%0A%0Afrom .pybitflyer import API%0A
| |
3bf84802d34bd96681a44f6d42f950bfc7071c11 | fix chat_room | chat/views.py | chat/views.py | import random
import string
from django.db import transaction
from django.shortcuts import render, redirect
import haikunator
from .models import Room
def about(request):
return render(request, "chat/about.html")
# def new_room(request):
# """
# Randomly create a new room, and redirect to it.
# """
# ... | Python | 0.000001 | @@ -1946,16 +1946,37 @@
=label,
+gameStart=gameStart,
playNumb
@@ -1988,37 +1988,16 @@
ayNumber
-, gameStart=gameStart
, roleLi
|
e1ec65c9ba1b1c6750df33d6669595a4be27d515 | add test case for prefixes | coupons/tests/test_models.py | coupons/tests/test_models.py | from datetime import timedelta
import re
from django.utils import timezone
from django.test import TestCase
from coupons.models import Coupon
from coupons.settings import (
CODE_LENGTH,
CODE_CHARS,
SEGMENT_LENGTH,
SEGMENT_SEPARATOR,
)
class CouponTestCase(TestCase):
def test_generate_code(self):... | Python | 0.000005 | @@ -951,16 +951,20 @@
te_code(
+%22%22,
True)%0A
@@ -1965,8 +1965,207 @@
oupon))%0A
+%0A def test_prefix(self):%0A coupon = Coupon.objects.create_coupon('monetary', 100, None, None, %22prefix-%22)%0A print coupon.code%0A self.assertTrue(coupon.code.startswith(%22prefix-%22))%0A
|
0ef92a444c23f3115d0396fca104ecf4bab9bc79 | Update the next_state method to take a history stack instead of a state | boardserver/server.py | boardserver/server.py | import json
import random
import sys
import gevent, gevent.local, gevent.queue, gevent.server
class Server(object):
def __init__(self, board, addr=None, port=None):
self.board = board
self.states = []
self.local = gevent.local.local()
self.server = None
# player message qu... | Python | 0 | @@ -4098,20 +4098,16 @@
f.states
-%5B-1%5D
, action
|
dbe999de4798a4eed6f96073664715a181a12539 | fix FlaskMixin.handle_user_exception (closes #2) | cantal_tools/flask.py | cantal_tools/flask.py | """This module provides Cantal Flask integration.
"""
from .metrics import appflow, web
web.ensure_branches('handle_request', 'handle_exception', 'render_template')
class FlaskMixin:
"""Flask App mixin.
Accepts extra keyword-only argument ``metrics``.
"""
def wsgi_app(self, environ, start_response... | Python | 0 | @@ -46,16 +46,62 @@
ion.%0A%22%22%22
+%0Afrom werkzeug.exceptions import HTTPException
%0A%0Afrom .
@@ -253,67 +253,8 @@
xin.
-%0A%0A Accepts extra keyword-only argument %60%60metrics%60%60.%0A
%22%22%22%0A
@@ -487,24 +487,73 @@
n(self, e):%0A
+ if not isinstance(e, HTTPException):%0A
we... |
06f888af3916e403129ef905bc4e78538c802917 | Add a storing function for delta dumps in feeddigger | feeddigger/feeddigger.py | feeddigger/feeddigger.py | # by SK and AM
import nltk
import re
from urllib2 import urlopen
import opml
import feedparser
import boto
import simplejson
from time import mktime
from datetime import datetime, date, time, timedelta
from xml.etree.ElementTree import Element, SubElement, Comment
from xml.dom import minidom
from xml.etree import Elem... | Python | 0.000001 | @@ -417,16 +417,32 @@
port Key
+%0Aimport requests
%0A%0AAWS_AC
@@ -499,16 +499,54 @@
OTHING%22%0A
+SERVER_URL = %22http://localhost:9999/%22%0A
%0A%0Aclass
@@ -1838,16 +1838,180 @@
return%0A%0A
+def storeDeltaDump(timestamp,deltadump):%0A payload = %7B'timestamp':timestamp,'deltadump':deltadump%7D%0A r = r... |
304e017ca3db298a28ccdae66916f041842c56c8 | fix setting user's token after requesting new one | bookmarks/api/auth.py | bookmarks/api/auth.py | """Auth API endpoints."""
from flask import g, url_for, request
from flask_smorest import abort, Blueprint
from flask_login import login_required, logout_user
from bookmarks import csrf, db, utils
from bookmarks.users.models import User
from .schemas import UserPOSTSchema, TokenSchema, RequestPasswordResetSchema, R... | Python | 0 | @@ -754,117 +754,124 @@
-# TODO check if need to call login_user, also research what authenticated = True does (cause it is not called
+token = g.user.generate_auth_token()%0A g.user.auth_token = token%0A db.session.add(g.user)%0A db.session.commit(
)%0A
@@ -893,36 +893,13 @@
n':
-g.user.generate_au... |
86ad3180cab5b2519467d2e4a6a3d75975224054 | Update regression test w/ checksums so they sync w/ codewarrior0's master | run_regression_test.py | run_regression_test.py | #!/usr/bin/env python
import tempfile
import sys
import subprocess
import shutil
import os
import mclevel
import hashlib
import contextlib
import gzip
import fnmatch
import tarfile
import zipfile
def generate_file_list(directory):
for dirpath, dirnames, filenames in os.walk(directory):
for filename in fil... | Python | 0 | @@ -3959,48 +3959,48 @@
, '
-0f4cbb81f7f109cee10606b82f27fb2681a22f50
+6ae14eceab8e0c600799463a77113448b2d9ff8c
', %5B
@@ -4155,48 +4155,48 @@
, '
-28355eae867235859b88a4405d0dd34144ff02e7
+00bc507daa3c07fee065973da4b81a099124650f
', %5B
|
16d50a2b971ddfd4014c89e1bbe8bf52188eb205 | add col | feedhoos/worker/admin.py | feedhoos/worker/admin.py | from django.contrib import admin
from feedhoos.worker.models.entry import EntryModel
from feedhoos.finder.models.feed import FeedModel
from feedhoos.reader.models.bookmark import BookmarkModel
admin.site.register(EntryModel)
admin.site.register(FeedModel)
admin.site.register(BookmarkModel)
| Python | 0.999843 | @@ -192,69 +192,414 @@
l%0A%0A%0A
-admin.site.register(EntryModel)%0Aadmin.site.register(FeedModel
+class EntryModelAdmin(admin.ModelAdmin):%0A list_display = ('id', %22feed_id%22, %22updated%22, 'url', 'title')%0Aadmin.site.register(EntryModel, EntryModelAdmin)%0A%0A%0Aclass FeedModelAdmin(admin.ModelAdmin):%0A ... |
1db3b5c5f00bbcc9063826429b26ac123acce882 | implementing get_paper(). might not work | bot/intent_handler.py | bot/intent_handler.py | import json
import logging
import re
from bs4 import BeautifulSoup
import requests
from site_scraping import papers_from_embedded_script
from formatter import build_message, paper_snippet
logger = logging.getLogger(__name__)
ASP_BaseURL = 'http://www.arxiv-sanity.com/'
class ApiAiIntentHandler(object):
def __i... | Python | 0.999999 | @@ -3578,16 +3578,17 @@
f, set,
+p
id):%0A
@@ -3656,33 +3656,245 @@
-raise NotImplementedError
+paperURL = ASP_BaseURL + %22/%22 + str(pid)%0A paper = papers_from_embedded_script(paperURL)%5B0%5D # only get first, rest are related papers%0A return build_message(text=%22*Here's your paper*%22, ... |
d1ec58364cf4cfaea1d1b0a7276615f5357225e5 | allow filtering journal by place_flag/check_service/check_flag | checker/ctf_gameserver/checker/abstract.py | checker/ctf_gameserver/checker/abstract.py | #!/usr/bin/python3
from abc import ABCMeta, abstractmethod
import logging
import json
import socket
import requests
import urllib3
from .constants import *
class AbstractChecker(metaclass=ABCMeta):
"""Base class for custom checker scripts
Individual checkers should import `BaseChecker` which does the
r... | Python | 0.000001 | @@ -1045,16 +1045,52 @@
, tick))
+%0A self._checker_action = None
%0A%0A @p
@@ -1265,24 +1265,181 @@
r to use%22%22%22%0A
+ if self._checker_action:%0A extra = %7B'CHECKER_ACTION' : self._checker_action%7D%0A return logging.LoggerAdapter(self._logger, extra)%0A
retu
@@... |
569c3a28e662ccef251acc6494047ec9c83556c2 | Add forbid_dtd flag, since we don't need any DTDs. | rest_framework/parsers.py | rest_framework/parsers.py | """
Parsers are used to parse the content of incoming HTTP requests.
They give us a generic way of being able to handle various media types
on the request, such as form content or json encoded data.
"""
from __future__ import unicode_literals
from django.conf import settings
from django.http import QueryDict
from djan... | Python | 0 | @@ -4832,16 +4832,33 @@
r=parser
+, forbid_dtd=True
)%0A
|
2d2194986b32deb054c0f0bc72ee77a8875dc02e | Remove useless '\r' from the output. | src/TkExscript/QueueWatcher.py | src/TkExscript/QueueWatcher.py | # Copyright (C) 2007-2009 Samuel Abels.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANT... | Python | 0 | @@ -1873,36 +1873,57 @@
-self.widget.data_queue.put((
+data = data.replace('%5Cr%5Cn', '%5Cn')%0A func =
self
@@ -1948,17 +1948,16 @@
t.insert
-,
%0A
@@ -1961,35 +1961,41 @@
-
+self.widget.data_queue.put((func,
(EN
|
1d1469e927a3bbbb8b25140c14f251f34516d720 | Fix tweepy errror imports | botometer/__init__.py | botometer/__init__.py | from __future__ import print_function
import time
import warnings
from functools import wraps
import requests
from requests import ConnectionError, Timeout
import tweepy
from tweepy import RateLimitError, TweepError
class NoTimelineError(ValueError):
def __init__(self, sn, *args, **kwargs):
msg = "user '... | Python | 0.000252 | @@ -175,16 +175,22 @@
m tweepy
+.error
import
|
8559e6515e463ea0954ab7a4fdd77ed3a6abcaed | Update database model to actually store summary on update | cronenberg/model/database.py | cronenberg/model/database.py | import json
from datetime import datetime
from ..application import db
from .web import EntityEncoder
# =============================================================================
# Database model
# =============================================================================
class Dashboard(db.Model):
id = db.... | Python | 0 | @@ -2100,16 +2100,27 @@
iption',
+ 'summary',
'import
@@ -2210,16 +2210,105 @@
d%5Battr%5D)
+%0A if 'tags' in d:%0A self.tags = %5BTag.canonicalize(t) for t in d%5B'tags'%5D%5D
%0A%0A @c
|
b82c310e6fffea2c5ef9ed04007b574cd50e8831 | Add another possible rc file location in rcfile | boyle/utils/rcfile.py | boyle/utils/rcfile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from os.path import join, expanduser
import os
import socket
import logging
log = logging.getLogger(__name__)
try: # Python 2
import ConfigParser as confiparser
except ImportError: # Python 3
import config... | Python | 0.000001 | @@ -1360,17 +1360,81 @@
h_path,
-'
+ '%25src' %25 appname) or '',%0A join(additional_search_path, '.
%25src' %25
@@ -3607,16 +3607,102 @@
n args,%0A
+ .appnamerc file found in 'path' folder variable in args,%0A
|
b7779de98d7e5040b9cdda563b04beb33b027f7c | Fix name regex in inspection. | bpython/inspection.py | bpython/inspection.py | # The MIT License
#
# Copyright (c) 2009-2010 the bpython authors.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, cop... | Python | 0 | @@ -1673,16 +1673,17 @@
A-Z_%5D%5Cw*
+$
')%0A%0A%0Acla
|
727109289edb5cf142921a5304e6b92dfec5981e | Add singleton types | mappyfile/tokens.py | mappyfile/tokens.py | # Move projection to singleton list?
COMPOSITE_NAMES = frozenset("""
align
anchorpoint
angle
antialias
backgroundcolor
bandsitem
bindvals
browseformat
buffer
character
class
classitem
classgroup
cluster
color
compfilter
composite
compop
config... | Python | 0.001628 | @@ -2027,21 +2027,12 @@
rmat
-%0A
-querymap
%0A
@@ -2143,21 +2143,8 @@
nom%0A
- scalebar%0A
@@ -2656,24 +2656,77 @@
metadata%0A
+ pattern%0A projection%0A querymap%0A scalebar%0A
validati
|
73f076c002861c363e4c4a4b7e40ca3217a4d5dc | Fix gradx for matern. | pygp/kernels/matern.py | pygp/kernels/matern.py | """
Implementation of the squared-exponential kernels.
"""
# future imports
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# global imports
import numpy as np
# local imports
from ._base import RealKernel
from ._distances import rescale, diff, sqdist, sqd... | Python | 0 | @@ -1536,202 +1536,22 @@
-if self._iso:%0A return 1 if (self._d == 1) else %5C%0A r if (self._d == 3) else %5C%0A r*(1+r)/3.%0A else:%0A return 1/r
+return 1
@@ -1596,21 +1596,21 @@
+r
-1
@... |
c1e97f5a2a53f5886be06c43a0bd5e66b6fb76cb | fix import | lightning/types/three.py | lightning/types/three.py | from lightning.types.base import Base
from lightning.types.decorators import viztype
from lightning.types.utils import vecs_to_points_three, add_property
@viztype
class Scatter3(Base):
_name = 'scatter3'
@staticmethod
def clean(x, y, z, color=None, label=None, alpha=None, size=None):
"""
... | Python | 0.000001 | @@ -146,16 +146,97 @@
property
+%0Afrom numpy import ndarray, asarray%0Afrom lightning.types.utils import array_to_im
%0A%0A@vizty
|
ab1028ccd73ea39d14f1eee57b91b303b31e2d63 | Bump version for v0.2.0 release. | briefcase/__init__.py | briefcase/__init__.py | from __future__ import print_function, unicode_literals, absolute_import, division
__all__ = [
'__version__',
]
# Examples of valid version strings
# __version__ = '1.2.3.dev1' # Development release 1
# __version__ = '1.2.3a1' # Alpha Release 1
# __version__ = '1.2.3b1' # Beta Release 1
# __version__ = '... | Python | 0 | @@ -456,9 +456,9 @@
'0.
-1.9
+2.0
'%0A
|
08433e45da17ff74185d3588a0d5a2240e2b40a9 | Fix super call in config. | law/config.py | law/config.py | # -*- coding: utf-8 -*-
"""
law Config file interface.
"""
__all__ = ["Config"]
import os
try:
# python 3
from configparser import ConfigParser
except ImportError:
# python 2
from ConfigParser import ConfigParser
_no_default = object()
class Parser(ConfigParser):
def optionxform(self, opti... | Python | 0 | @@ -887,28 +887,13 @@
ue =
- super(Parser,
self
-)
.get
|
4b031d15f5d0e4f7665625b98fd615f16fadff87 | add shell of ncdc.pytables.get_data | pyhis/ncdc/pytables.py | pyhis/ncdc/pytables.py | import os
import tempfile
import tables
from pyhis.ncdc import core
from pyhis import util
# default hdf5 file path
HDF5_FILE_PATH = util.get_default_h5file()
class NCDCValue(tables.IsDescription):
date = tables.StringCol(8)
flag = tables.StringCol(1)
value = tables.StringCol(20)
last_modified = ta... | Python | 0.000001 | @@ -4,25 +4,15 @@
ort
-os%0Aimport tempfil
+datetim
e%0A%0Ai
@@ -324,16 +324,464 @@
l(26)%0A%0A%0A
+def get_data(station_codes, start_date=None, end_date=None, parameters=None,%0A path=None):%0A if isinstance(station_codes, basestring):%0A return _get_station_data(station_codes, start_date, end_dat... |
dbc9b9b1bac2a05f8561be56ff15d528426a4740 | make references readonly in admin (too slow to low otherwise) | laws/admin.py | laws/admin.py | from django.contrib import admin
from laws.models import Law
class LawAdmin(admin.ModelAdmin):
list_filter = ["title"]
list_display = ["title", "section", "psection", "num_references", "level", "order", "text", "source"]
admin.site.register(Law, LawAdmin)
| Python | 0 | @@ -222,16 +222,54 @@
source%22%5D
+%0A readonly_fields = ('references',)
%0A%0Aadmin.
|
2b2da6988465b335ebc04ff8b955bc5f1c2e84e5 | Enhance crawl command with argv parameters | pyjobs_web/pyjobsweb/commands/crawl.py | pyjobs_web/pyjobsweb/commands/crawl.py | # -*- coding: utf-8 -*-
import os
from pyjobs_crawlers.run import start_crawlers
from crawlers import PyJobsWebConnector
from pyjobsweb.commands import AppContextCommand
class CrawlCommand(AppContextCommand):
def take_action(self, parsed_args):
super(CrawlCommand, self).take_action(parsed_args)
... | Python | 0.000001 | @@ -219,37 +219,34 @@
def
-take_action(self, parsed_args
+get_parser(self, prog_name
):%0A
@@ -251,16 +251,25 @@
%0A
+ parser =
super(C
@@ -291,106 +291,495 @@
lf).
-take_action(
+get_parser(prog_name)%0A%0A
parse
+r.ad
d_arg
-s)%0A os.environ%5B'SCRAPY_SETTINGS_MODULE'%5D = 'pyjobs_craw... |
ec7e1123a96c0521f5cb4500c49406b9464f6227 | Make migration idempotent | migrations/003_add_capped_collections.py | migrations/003_add_capped_collections.py | """
Add capped collections for real time data
"""
import logging
log = logging.getLogger(__name__)
def up(db):
capped_collections = [
"fco_pay_legalisation_post_realtime",
"fco_pay_legalisation_drop_off_realtime",
"fco_pay_register_birth_abroad_realtime",
"fco_pay_register_death_a... | Python | 0 | @@ -500,16 +500,66 @@
%0A %5D%0A%0A
+ existing_collections = db.collection_names()%0A%0A
for
@@ -597,16 +597,76 @@
ctions:%0A
+ if not collection_name in existing_collections:%0A
@@ -732,16 +732,20 @@
e=5040)%0A
+
|
93118e5065fb3b0d7601051111a144fe1dd80675 | Use django-leaflet if it exists | livinglots_lots/admin.py | livinglots_lots/admin.py | from django.conf.urls import patterns, url
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from livinglots import get_lot_model, get_lotgroup_model
from .admin_views import AddToGroupView
from .... | Python | 0.000002 | @@ -73,57 +73,8 @@
min%0A
-from django.contrib.gis.admin import OSMGeoAdmin%0A
from
@@ -160,16 +160,165 @@
direct%0A%0A
+try:%0A from leaflet.admin import LeafletGeoAdmin as GeoAdmin%0Aexcept ImportError:%0A from django.contrib.gis.admin import OSMGeoAdmin as GeoAdmin%0A%0A
from liv
@@ -452,19 +452,16 @@
otA... |
6b70a5c824d544348503b37edb52ff2e35b2f1ce | Update player.py | player.py | player.py | '''
Defines a class Player
Data Members:
data # a dictionary of the high-level log info. contains:
logs
date
id
title
results # number of results (capped at 1000 games)
success # false if retrieval url was formatted bad
Methods:
__init__(self, id64)
load_data(self, id64)
... | Python | 0 | @@ -569,16 +569,21 @@
):%0D%0A
+self.
load_dat
@@ -584,21 +584,16 @@
ad_data(
-self,
id64)%0D%0A
@@ -679,17 +679,10 @@
%22 +
-steam_
id
-_
64%0D%0A
@@ -689,16 +689,20 @@
json
+_obj
= urlli
@@ -722,17 +722,16 @@
open(url
-1
)%0D%0A o
@@ -749,16 +749,20 @@
g = json
+_obj
.read().
@@ -821,12 +82... |
1e5abadfb190acdf2361d09ab518d22e119cf9f4 | Put correct path to sync_unit_tests target in all_android.gyp | build/all_android.gyp | build/all_android.gyp | # 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.
# This is all.gyp file for Android to prevent breakage in Android and other
# platform; It will be churning a lot in the short term and eventually be mer... | Python | 0.000003 | @@ -1115,56 +1115,8 @@
s',%0A
- '../chrome/chrome.gyp:sync_unit_tests',%0A
@@ -1235,32 +1235,76 @@
sql_unittests',%0A
+ '../sync/sync.gyp:sync_unit_tests',%0A
'../ipc/
|
8e1d29c5618ddc3d24fd82995e6e4f411fb0650f | fix redis subscribe to ignore messages, skip nonetypes | dockerstats/dockerstats.py | dockerstats/dockerstats.py | import json,yaml,logging
from datetime import datetime
from redis import StrictRedis
from collector import StatCollector
from container import Container
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger('dockerstats')
class Stat(object):
"""
Stat object, created from json received from stat co... | Python | 0 | @@ -186,13 +186,12 @@
ing.
-DEBUG
+INFO
)%0Alo
@@ -662,17 +662,16 @@
')%5B-1%5D%0A%0A
-%0A
def
@@ -1622,16 +1622,46 @@
.pubsub(
+ignore_subscribe_messages=True
)%0A
@@ -1718,16 +1718,80 @@
ers = %7B%7D
+%0A self.start_collectors(redis)%0A self.run_forever()
%0A%0A de
@@ -1847,20 +184... |
cf7dee9bc0d0f62f7874fab250126fdc2bbf5218 | Change default constructor to read code from string. Class method for files. | parser.py | parser.py | #! /usr/bin/env python
from __future__ import print_function
import re
import sys
import warnings
class Instruction:
"""Class that represents a twttr instruction."""
def __init__(self, instruction):
"""Create an instruction given its string."""
match = re.match(r"([a-zA-Z]+): (.+)", instruction)
if match =... | Python | 0 | @@ -1718,19 +1718,19 @@
_(self,
-fil
+cod
e):%0A%09%09%22%22
@@ -1752,24 +1752,30 @@
r using the
+given
twttr progra
@@ -1779,28 +1779,8 @@
gram
- from the given file
.%22%22%22
@@ -1834,36 +1834,35 @@
%0A%0A%09%09
-with open(file, 'r') as f:%0A%09
+lines = code.splitlines()%0A%0A
%09%09fo
@@ -1875,12 +1875,... |
42f3aa527f64a0996f52059894751631c812d73f | Bump version to 2.0.0b7 | rpi_backlight/__init__.py | rpi_backlight/__init__.py | import time
from contextlib import contextmanager
from pathlib import Path
from tempfile import gettempdir
from typing import Any, Callable, Iterator, Union
__author__ = "Linus Groh"
__version__ = "2.0.0b6"
__all__ = ["Backlight"]
_BACKLIGHT_SYSFS_PATH = "/sys/class/backlight/rpi_backlight/"
_EMULATOR_SYSFS_TMP_FILE_... | Python | 0 | @@ -202,9 +202,9 @@
0.0b
-6
+7
%22%0A__
|
d3d52a0b0d8da64edcfb725bf1256dd9fef8f3ac | fix help msg | cc/taskclient.py | cc/taskclient.py | #! /usr/bin/env python
"""Simple command-line client for task sending.
"""
import sys
import uuid
import cc.task
from cc.reqs import BaseMessage, TaskSendMessage
from cc.taskmgr import TaskManager
from skytools import DBScript
from cc.crypto import CryptoContext
from cc.stream import CCReqStream
from zmq.eventloop i... | Python | 0.000002 | @@ -573,16 +573,21 @@
-send':
+task_
handler=
@@ -588,16 +588,21 @@
ndler=
+task_
host=%0A%22%22
|
95c776612076936454560f990e691c61e87c2c51 | Raise ChefError to match the exception raised when no API info can be found. | chef/fabric.py | chef/fabric.py | from chef.api import ChefAPI, autoconfigure
from chef.environment import Environment
from chef.exceptions import ChefError, ChefAPIVersionError
from chef.search import Search
class Roledef(object):
"""Represents a Fabric roledef for a Chef role."""
def __init__(self, name, api, hostname_attr, environment=None)... | Python | 0 | @@ -1245,13 +1245,12 @@
ise
-Value
+Chef
Erro
|
fdb0da2fdec16bde1c24e9c7b8029e64fd0b280c | Make about_plugins_ui.py not use automation apis for checking whether a plugin is enabled or not. Right now, this test only uses webdriver, and pyauto just for starting the browser and navigating to a page. | chrome/test/functional/about_plugins_ui.py | chrome/test/functional/about_plugins_ui.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.
import os
import re
import pyauto_functional # Must be imported before pyauto
import pyauto
import pyauto_utils
class AboutPlug... | Python | 0.000011 | @@ -1426,16 +1426,24 @@
ed(self,
+ driver,
plugin_
@@ -1449,16 +1449,16 @@
_name):%0A
-
%22%22%22C
@@ -1492,24 +1492,62 @@
%0A%0A Args:%0A
+ driver: A Chrome driver object.%0A
plugin
@@ -1660,108 +1660,104 @@
-for plugin in self.GetPluginsInfo().Plugins():%0A if re.search(plugin_name... |
87d1b24d8ee806c5aa6cf73d83472b129b0f87fe | Add random GT to a given vcf | mitty/simulation/genome/sampledgenome.py | mitty/simulation/genome/sampledgenome.py | import pysam
from numpy.random import choice
import math
def assign_random_gt(input_vcf, outname, sample_name="HG", default_af=0.01):
vcf_pointer = pysam.VariantFile(filename=input_vcf)
new_header = vcf_pointer.header.copy()
if "GT" not in new_header.formats:
new_header.formats.add("GT", "1", "Str... | Python | 0.000064 | @@ -42,20 +42,8 @@
ice%0A
-import math%0A
%0A%0Ade
@@ -451,27 +451,23 @@
ault_af
-- math.pow(
+* (1 +
default_
@@ -468,19 +468,16 @@
fault_af
-, 2
), defau
@@ -483,25 +483,29 @@
ult_af,
-math.pow(
+default_af *
default_
@@ -506,20 +506,16 @@
fault_af
-, 2)
%5D%0A wi
@@ -920,46 +920,31 @@
af
-- math.... |
4260babfc83f2d9d5ad5a1122885330554fb841d | add pybloom folder | config/wsgi.py | config/wsgi.py | """
WSGI config for document_similarity project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... | Python | 0 | @@ -1105,16 +1105,261 @@
ction%22)%0A
+os.environ%5B'DJANGO_SETTINGS_MODULE'%5D = 'config.settings.production'%0Aos.environ%5B'DJANGO_SECRET_KEY'%5D = 'dg_*bcao4v-yq6f90-f2hn+ysl9&)y=0d_b=g3qgu2ij)9x5hh%3E'%0Aos.environ%5B'DATABASE_URL'%5D = 'sqlite:///data.db'%0Aos.environ%5B'DJANGO_ADMIN_URL'%5D = 'admin'
%0A# This... |
45d6622f2f3b2383dd312101c8cd95367396152e | Update transformation command | rsk_mind/core/commands.py | rsk_mind/core/commands.py | import argparse, os
def update_engine(setting):
pass
def transformation(setting):
DATASOURCE = setting.DATASOURCE
datasource = DATASOURCE['IN']['class'](*DATASOURCE['IN']['params'])
dataset = datasource.read()
datasource = DATASOURCE['OUT']['class'](*DATASOURCE['OUT']['params'])
datasource... | Python | 0.000001 | @@ -225,16 +225,100 @@
read()%0A%0A
+ dataset.setTransformer(setting.TRANSFORMER)%0A dataset.applyTransformations()%0A%0A
data
|
09dfa61ce07c64320a545374f02c13c63f4a1600 | Add display of visitor counts to admin | pylinks/links/admin.py | pylinks/links/admin.py | from django.contrib import admin
from pylinks.main.admin import ModelAdmin
from pylinks.links import models
class CategoryAdmin(ModelAdmin):
prepopulated_fields = {
'slug': ('title',)
}
search_fields = ('title',)
admin.site.register(models.Category, CategoryAdmin)
class LinkAdmin(ModelAdmin):
... | Python | 0 | @@ -383,24 +383,58 @@
y__title',)%0A
+ readonly_fields = ('visits',)%0A
search_f
|
54d64a029dc80c6bf452d18e520bb9fb8d085888 | Use hacking import_exceptions for gettextutils._ | openstack/common/versionutils.py | openstack/common/versionutils.py | # Copyright (c) 2013 OpenStack Foundation
# 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 ... | Python | 0.000036 | @@ -767,16 +767,8 @@
rt _
- # noqa
%0Afro
|
1f8b54d22cee5653254514bf07c1b4cb1eb147cb | Remove test item from config grabbing script | _grabconfig.py | _grabconfig.py | #!/usr/bin/env python2
import os, shutil
files = ["/etc/crontab",
"/usr/local/bin/ssu", "/usr/local/bin/xyzzy",
"/home/dagon/.bashrc","/home/dagon/.i3status.conf", "/home/dagon/.profile", "/home/dagon/.vimrc", "/home/dagon/.i3/config", "/home/dagon/.vim",
"/home/dagon/.config/bless", "/home/... | Python | 0 | @@ -342,20 +342,8 @@
tor%22
-, %22/bla.txt%22
%5D%0A%0Af
|
de31d92a07d85e83088c04a542b5fdf927a05797 | Remove redundant code | cairis/core/Target.py | cairis/core/Target.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | Python | 0.999999 | @@ -1126,179 +1126,4 @@
ale%0A
- %0A def __getitem__(self,idx): %0A if (idx == 0): %0A return self.theName%0A elif (idx == 1):%0A return self.theEffectiveness%0A else:%0A return self.theRationale%0A
|
83014a98639d58e7211e15cccbc5dc665b3af553 | fix syntax in _modules/pg.py | _modules/pg.py | _modules/pg.py | #!/usr/bin/env python
# vim: set fileencoding=utf-8 filetype=python :
"""
Simple wrapper for pg_dump and pg_restore.
http://www.postgresql.org/docs/9.4/static/app-pgrestore.html
"""
from __future__ import unicode_literals
from datetime import datetime
import logging
log = logging.getLogger(__name__)
import os.path
f... | Python | 0.000017 | @@ -615,11 +615,13 @@
ask=
+'
007
+'
):%0A
|
ee28e56c403389ac5baf1810fced232327931bdd | remove unused import from service command base | flow/commands/service.py | flow/commands/service.py | from flow.commands.base import CommandBase
from flow.configuration.inject.redis_conf import RedisConfiguration
from injector import inject, Injector
from twisted.internet import defer
import flow.interfaces
import logging
LOG = logging.getLogger(__name__)
@inject(storage=flow.interfaces.IStorage, broker=flow.interf... | Python | 0 | @@ -40,76 +40,8 @@
ase%0A
-from flow.configuration.inject.redis_conf import RedisConfiguration%0A
from
|
7ca2b660a316cc6a52dc111cd738e0b7779a55e5 | set new version number for development | salmonella/__init__.py | salmonella/__init__.py | VERSION = (0, 5, 1, "f") # following PEP 386
DEV_N = None # for PyPi releases, set this to None
def get_version(short=False):
version = "%s.%s" % (VERSION[0], VERSION[1])
if short:
return version
if VERSION[2]:
version = "%s.%s" % (version, VERSION[2])
if VERSION[3] != "f":
v... | Python | 0.000001 | @@ -14,13 +14,18 @@
5,
-1, %22f
+2, %22a%22, %221
%22)
@@ -52,20 +52,17 @@
DEV_N =
-None
+1
# for
|
94ebb0039f783912ef4fd638e0bc7ea5d0b98915 | Update parser.py | parser.py | parser.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from standards.WLC import getWLC
from standards.WSC import getWSC
from standards.HC import getHC
from standards.BC import getBC
import re
import datetime
malformed = False
def log(msg):
with open('log.out', "a") as f:
f.write(str(datetime.datetime.now()) + ": " +... | Python | 0 | @@ -2695,24 +2695,25 @@
%22%5Cn**Westmin
+t
ser Larger C
@@ -3215,16 +3215,17 @@
Westmins
+t
er Short
|
dd1bcf71c6548f99e6bc133bf890c87440e13535 | Add a running state which can be used to know when a workflow is running. | taskflow/states.py | taskflow/states.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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
#
# ... | Python | 0.000001 | @@ -990,16 +990,36 @@
RESUMING
+%0ARUNNING = 'RUNNING'
%0A%0A# Task
|
e937d40428601868b73b3753980d1f929c5a7e87 | check for variable content instead of type | utils/src/gosa/utils/gosa_ldap_monitor.py | utils/src/gosa/utils/gosa_ldap_monitor.py | #!/usr/bin/env python3
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
import hmac
import os
from time import sleep
from datetime import datetime
im... | Python | 0 | @@ -2937,22 +2937,54 @@
if
-ct == %22modrdn%22
+newrdn is not None and newsuperior is not None
:%0A
|
c16cafcc71d1552d1bdfe9a8bf10103d9e1a3c40 | Remove useless duplicate model | sequere/backends/database/__init__.py | sequere/backends/database/__init__.py | from collections import defaultdict
from operator import itemgetter
from django.core.exceptions import ImproperlyConfigured
from sequere.backends.base import BaseBackend
from sequere.registry import registry
from .models import Follow
class DatabaseBackend(BaseBackend):
model = Follow
chunks_length = 20
... | Python | 0.000005 | @@ -337,76 +337,27 @@
self
-):%0A from .models import Follow%0A%0A self._model = Follow%0A
+, *args, **kwargs):
%0A
@@ -373,17 +373,16 @@
ot self.
-_
model._m
|
627cb8d2cba533c8aedc8682202257a609685c52 | Update handle_batch to use the new detail model. | fmn/consumer/producer.py | fmn/consumer/producer.py | # An example fedmsg koji consumer
import moksha.hub.api
import fmn.lib
import datetime
import logging
log = logging.getLogger("fmn")
def total_seconds(dt):
""" Take a datetime.timedelta object and return the total seconds.
dt.total_seconds() exists in the python 2.7 stdlib, but not in python 2.6.
"""
... | Python | 0 | @@ -3409,21 +3409,15 @@
-recipient
+name
=
-%7B
pref
@@ -3436,17 +3436,71 @@
ail_name
-:
+%0A recipients = %5B%7Bname: value.value%7D for value in
pref.de
@@ -3509,17 +3509,18 @@
il_value
-%7D
+s%5D
%0A
@@ -3620,32 +3620,74 @@
, pref.context)%0A
+%0A for recipient in recipients:%0A ... |
5cf39c69994245c0a6d743f06d4d81a05f88b0e5 | Fix flake8 | utils/tests/test_templatetags_markdown.py | utils/tests/test_templatetags_markdown.py | from django.template import Context, Template
from django.test import TestCase
template = '''
{% load md %}
{% markdown %}
# Foo
## Bar
Baz
{% endmarkdown %}
'''
template_html = '''
<h1>Foo</h1>
<h2>Bar</h2>
<p>Baz</p>
'''
class MarkdownTestCase(TestCase):
def test_markdown(self):
html = Template(templa... | Python | 0 | @@ -220,16 +220,17 @@
p%3E%0A'''%0A%0A
+%0A
class Ma
|
545a9a0c5f7a7fac5eb4a1552969301f553d150e | Add some comments. | clean_ipynb.py | clean_ipynb.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | Python | 0 | @@ -1155,16 +1155,292 @@
TWARE.%0A%0A
+%22%22%22%0AThis script strips the output of an Jupyter notebook.%0A%0AIt can be used as a preprocessing before commiting notebooks on Version Systems%0Alike Git.%0A%0AHere is a different way to do this: http://stackoverflow.com/questions/25178118/opening-ipython-notebook-without... |
d28194157f84471286ed8f1f8b838e068c14bb08 | Remove bazel deps on images no longer used | containers.bzl | containers.bzl | # Copyright 2019 The Kubernetes 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 applicable law or agreed to ... | Python | 0 | @@ -1514,315 +1514,8 @@
)%0A%0A
- container_pull(%0A name = %22boskosctl-base%22,%0A digest = %22sha256:a23c19a87857140926184d19e8e54812ba4a8acec4097386ca0993a248e83f8b%22, # 2019/08/05%0A registry = %22gcr.io%22,%0A repository = %22k8s-testimages/boskosctl-base%22,%0A tag = %22... |
f0dc32b9b7429ea31b63337c6646e3d42d021efe | Add missing mixin to Search | folium/plugins/search.py | folium/plugins/search.py | # -*- coding: utf-8 -*-
from branca.element import MacroElement
from folium import Map
from folium.features import FeatureGroup, GeoJson, TopoJson
from folium.plugins import MarkerCluster
from folium.utilities import parse_options
from jinja2 import Template
class Search(MacroElement):
"""
Adds a search to... | Python | 0 | @@ -82,16 +82,55 @@
ort Map%0A
+from folium.elements import JSCSSMixin%0A
from fol
@@ -309,16 +309,28 @@
Search(
+JSCSSMixin,
MacroEle
|
cfeca089dd10a6853d2b969d2d248a0f7d506d1a | Handle the weird field names from the new version of the API | emission/net/usercache/formatters/android/motion_activity.py | emission/net/usercache/formatters/android/motion_activity.py | import logging
import emission.core.wrapper.motionactivity as ecwa
import emission.net.usercache.formatters.common as fc
import attrdict as ad
def format(entry):
formatted_entry = ad.AttrDict()
formatted_entry["_id"] = entry["_id"]
formatted_entry.user_id = entry.user_id
metadata = entry.metadata
... | Python | 0 | @@ -499,24 +499,56 @@
.AttrDict()%0A
+ if 'agb' in entry.data:%0A
data.typ
@@ -598,40 +598,198 @@
-data.confidence = entry.data.agc
+else:%0A data.type = ecwa.MotionTypes(entry.data.zzaEg).value%0A%0A if 'agc' in entry.data:%0A data.confidence = entry.data.agc%0A else:%0A d... |
4a2cb70e08d3762955ca0933f239114481a553b5 | add a python script for checking results | examples/Mechanics/Mechanisms/SliderCrank/check_reference.py | examples/Mechanics/Mechanisms/SliderCrank/check_reference.py | import numpy
#results = numpy.loadtxt('simulation_results.dat')
results = []
results_ref = []
with open ("simulation_results.dat", "r") as myfile:
data=myfile.readlines()
#print data[1:]
for i in data[1:]:
data_l_i = i.split('\t')
data_l_i_f = []
#for val in i:
# pr... | Python | 0 | @@ -162,37 +162,33 @@
file.readlines()
-
%0A
+
#print data%5B
@@ -588,25 +588,17 @@
int ' '%0A
-
%0A
+
with ope
@@ -669,20 +669,16 @@
dlines()
-
%0A #pr
@@ -1185,24 +1185,16 @@
error_%0A
-
%0Aassert
|
0631f56ab4e1abfd69aad0a34300c3050d88d112 | Add a pre_save for Hadith to set simple text field | HadithHouseWebsite/hadiths/models.py | HadithHouseWebsite/hadiths/models.py | from django.contrib.auth.models import User
from django.db import models
# NOTE: Django automatically index foreign keys, but we still add db_index=True
# to make it clear to the reader.
# NOTE: We don't use DateField in birth and death information of the Person
# model because it doesn't allow us to set as null som... | Python | 0 | @@ -1,20 +1,30 @@
+import re%0A
from django.contrib.
@@ -76,16 +76,99 @@
models%0A
+from django.db.models.signals import pre_save%0Afrom django.dispatch import receiver%0A
%0A%0A# NOTE
@@ -648,16 +648,17 @@
ed_on?%0A%0A
+%0A
class Pe
@@ -5623,8 +5623,276 @@
_user')%0A
+%0A%0Adef remove_arabic_diactrictics(input)... |
f716e8bbf1f20e280d5f973664fd3b4fc91686de | Fix concatentation error on no args to `./mach rustc` | python/servo/devenv_commands.py | python/servo/devenv_commands.py | from __future__ import print_function, unicode_literals
from os import path
import subprocess
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from servo.command_base import CommandBase, cd
@CommandProvider
class MachCommands(CommandBase):
@Command('cargo',
de... | Python | 0.000001 | @@ -1572,32 +1572,83 @@
(self, params):%0A
+ if params is None:%0A params = %5B%5D%0A
return s
|
7efbcf77e476900a4275ecc4037343a90a37ca00 | Reset redirect login urls from settings.py | football_ech/settings.py | football_ech/settings.py | """
Django settings for football_ech project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import ... | Python | 0 | @@ -4028,17 +4028,16 @@
nd',%0A%5D%0A%0A
-#
SOCIAL_A
@@ -4065,17 +4065,16 @@
L = '/'%0A
-#
SOCIAL_A
|
c49f3eef0f2de2abe55a35940fd10888480b6665 | Fix variable name for task email | bluebottle/bb_tasks/taskmail.py | bluebottle/bb_tasks/taskmail.py | from django.dispatch import receiver
from django.db.models.signals import post_save, pre_delete
from django.contrib.sites.models import Site
from django.utils.translation import ugettext as _
from django.utils import translation
from django.template.loader import get_template, render_to_string
from django.template impo... | Python | 0.999999 | @@ -3478,38 +3478,34 @@
ask!')%0A c
-ontex
t
+x
= Context(%7B'tas
|
e2548c5e7747d1574901f92688aca8c792297aca | Fix flake8 warning. | pyramid_rawes/tests.py | pyramid_rawes/tests.py | # -*- coding: utf8 -*-
from pyramid import testing
from pyramid_rawes import (
IRawes,
get_rawes,
_build_rawes,
includeme,
_parse_settings
)
import rawes
try:
import unittest2 as unittest
except ImportError:
import unittest # noqa
class TestRegistry(object):
def __init__(self, se... | Python | 0 | @@ -2664,36 +2664,32 @@
= %7B%0A
-
'rawes.url': 'ht
|
e23572ae198fcd9de80a360a669070bd6a206889 | Set task files/memebers readonly on task serializer | bluebottle/tasks/serializers.py | bluebottle/tasks/serializers.py | from rest_framework import serializers
from bluebottle.bluebottle_drf2.serializers import PrimaryKeyGenericRelatedField, TagSerializer, FileSerializer, TaggableSerializerMixin
from bluebottle.accounts.serializers import UserPreviewSerializer
from bluebottle.utils.serializers import MetaField
from bluebottle.projects.s... | Python | 0 | @@ -1727,35 +1727,35 @@
ber_set', re
-quired=Fals
+ad_only=Tru
e)%0A files
@@ -1812,27 +1812,27 @@
set', re
-quired=Fals
+ad_only=Tru
e)%0A p
|
0d4169f51beb273594eec920faaea379727b94bf | make script compatible with Python 2.6 | python_examples/unicode_norm.py | python_examples/unicode_norm.py | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
# Copyright (c) 2013 Nicolas Iooss
#
# 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
... | Python | 0.003168 | @@ -1812,15 +1812,8 @@
i',
-errors=
'ign
|
1917aad4597989aedcd7f35f05d146469f67eef2 | return not continue | napalm_logs/auth.py | napalm_logs/auth.py | # -*- coding: utf-8 -*-
'''
Authenticator worker process
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import pythond stdlib
import os
import select
import logging
import hashlib
import threading
# Import napalm-logs pkgs
from napalm_logs.config import MAGIC_REQ
from napalm_logs... | Python | 0.002074 | @@ -1893,32 +1893,30 @@
-continue
+return
%0A log
@@ -2147,16 +2147,14 @@
-continue
+return
%0A
|
8570b375755451f70e5762765ab092964dbccae6 | add safe False | temba/ivr/views.py | temba/ivr/views.py | from __future__ import unicode_literals
import json
from django.core.cache import cache
from django.core.exceptions import ValidationError
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from temba.channels.models import Cha... | Python | 0.999997 | @@ -5685,16 +5685,28 @@
sponse))
+, safe=False
)%0A%0A
|
cfb2a31e2c2f943921c91afe2ea7c61f90eeb870 | Print example outputs. | cmdoysters.py | cmdoysters.py | #! /usr/bin/env python3
from __future__ import print_function
import json
import os
import glob
import sys
import argparse
import string
class QueryInfo:
pass
def tokenize(text):
"""Strip punctuation from free text sentences and split into tokens."""
table = {ord(punc): None for punc in string.punctuati... | Python | 0.000003 | @@ -797,16 +797,291 @@
string%22%5D
+%0A try :%0A example_outputs = invocation%5B%22example-outputs%22%5D%0A for i, output in enumerate(example_outputs):%0A yield %22# Example output:%22.format(i+1)%0A for line in output.splitlines():%0A yield line%0A except Key... |
23febe89d3868d91f9869517256b4422fde82dcf | update Merthyr import script for 2017 | polling_stations/apps/data_collection/management/commands/import_merthyr.py | polling_stations/apps/data_collection/management/commands/import_merthyr.py | """
Import Merthyr Tydfil
note: this script takes quite a long time to run
"""
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseCsvStationsCsvAddressesImporter
from data_finder.helpers import geocode_point_only, PostcodeError
from data_collection.google_geocoding_api_wrappe... | Python | 0 | @@ -1,2618 +1,377 @@
-%22%22%22%0AImport Merthyr Tydfil%0A%0Anote: this script takes quite a long time to run%0A%22%22%22%0Afrom django.contrib.gis.geos import Point%0Afrom data_collection.management.commands import BaseCsvStationsCsvAddressesImporter%0Afrom data_finder.helpers import geocode_point_only, PostcodeError%... |
08f948dc4ef8f17821919edb0274d9f785f42c5f | Fix typo | pyrsistent/_helpers.py | pyrsistent/_helpers.py | from functools import wraps
from pyrsistent._pmap import PMap, pmap
from pyrsistent._pset import PSet, pset
from pyrsistent._pvector import PVector, pvector
def freeze(o, strict=True):
"""
Recursively convert simple Python containers into pyrsistent versions
of those containers.
- list is converted to... | Python | 0.999999 | @@ -2593,22 +2593,9 @@
set(
-%5Bx for x in o%5D
+o
)%0A
|
7628b46141efee1f0a267862d4da04fe020a48d4 | update for Telford & Wrekin | polling_stations/apps/data_collection/management/commands/import_telford.py | polling_stations/apps/data_collection/management/commands/import_telford.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E06000020"
addresses_name = "local.2019-05-02/Version 1/Democracy_Club__02May2019Telford.tsv"
stations_name = "local.2019-05-02/Version 1/Democracy_Club__02Ma... | Python | 0 | @@ -170,32 +170,42 @@
addresses_name =
+ (%0A
%22local.2019-05-
@@ -207,33 +207,33 @@
9-05-02/Version
-1
+2
/Democracy_Club_
@@ -238,36 +238,48 @@
b__02May2019
-Telford.tsv%22
+ revised data.tsv%22%0A )
%0A station
@@ -286,16 +286,26 @@
s_name =
+ (%0A
%22local.
@@ -323,17 +323,17 @@
Ver... |
18beb88e495f53673f6256266c273c6db27cb03a | Remove uneeded check | framework/render/core.py | framework/render/core.py | # -*- coding: utf-8 -*-
import os
import time
import mfr
from mfr.ext import ALL_HANDLERS
import requests
from website import settings
from framework.render.exceptions import error_message_or_exception
def init_mfr(app):
"""Register all available FileHandlers and collect each
plugin's static assets to the... | Python | 0 | @@ -1631,64 +1631,8 @@
1kb%0A
- if not block:%0A break%0A
|
cce14b91b4bc96317704e44cf1c7ddb2d70d37fd | Update savefile.py | python-cgi/savefile.py | python-cgi/savefile.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import cgi, os,sys, urllib
import cgitb; cgitb.enable()
import xml.etree.ElementTree as ET
import json
import string
########################################################################
def is_dictionary_word(word):
word_without_punctuation = word.encode('utf-8').transla... | Python | 0.000001 | @@ -1757,23 +1757,16 @@
T.parse(
-file =
xml_file
|
7c78a9326c6834da45d3b23a5e53c95bcb1e87cd | Comment out test, since it hangs on HPUX, still investigating | Lib/test/test_pty.py | Lib/test/test_pty.py | import pty, os, sys
from test.test_support import verbose, TestFailed, TestSkipped
TEST_STRING_1 = "I wish to buy a fish license.\n"
TEST_STRING_2 = "For my pet fish, Eric.\n"
if verbose:
def debug(msg):
print msg
else:
def debug(msg):
pass
# Marginal testing of pty suite. Cannot do extensive... | Python | 0 | @@ -811,16 +811,92 @@
onal.%22%0A%0A
+# this hangs on HPUX 11, comment out for now until we can determine cause%0A##
if not o
@@ -915,16 +915,18 @@
ve_fd):%0A
+##
rais
|
b1a06b069232d9347ecf2d74fbe010948e019e4f | Add AD to secrets. | python/auth/secrets.py | python/auth/secrets.py | '''
This class lets us keep the user ids and passwords outside of the git repo.
This is basically a port of the equivalent I added to Bruno's old stats code.
Owain Kenway
'''
class Secrets:
def __init__(self):
import configparser
import os.path
self.filename = os.path.join(os.path.exp... | Python | 0 | @@ -591,8 +591,1249 @@
trip(%22%22)
+%0A%0A # See if we have an AD password available to us anywhere:%0A self.ad = False%0A%0A # First check our config file for %22ad%22 or %22ldap%22 sections.%0A if secretconfig.has_section(%22ad%22):%0A self.aduser = secretconfig.get(%22ad%22, ... |
1c20dd8109e314825b30b8a402401d197961c41a | Use the generic one to skip these logs as well | readthedocs/settings/docker_compose.py | readthedocs/settings/docker_compose.py | import os
from .dev import CommunityDevSettings
class DockerBaseSettings(CommunityDevSettings):
"""Settings for local development with Docker"""
DOCKER_ENABLE = True
RTD_DOCKER_COMPOSE = True
RTD_DOCKER_COMPOSE_VOLUME = 'community_build-user-builds'
RTD_DOCKER_USER = f'{os.geteuid()}:{os.getegid... | Python | 0 | @@ -1830,149 +1830,8 @@
ing%0A
- 'azure.storage.common.storageclient': %7B%0A 'handlers': %5B'null'%5D,%0A 'propagate': False,%0A %7D,%0A
|
57e41ddf095743be5e2dbd5e4318d775db9bfefd | Scale down number solution's value if offsets are used. | src/puzzle/problems/number_problem.py | src/puzzle/problems/number_problem.py | import sys
from data import warehouse
from puzzle.heuristics import analyze_number
from puzzle.problems import problem
_OFFSETS = None
class NumberProblem(problem.Problem):
def __init__(self, name, lines):
super(NumberProblem, self).__init__(name, lines)
if len(lines) > 1:
raise NotImplementedError(... | Python | 0 | @@ -386,32 +386,67 @@
(lines):%0A if
+not lines:%0A return 0%0A elif
len(lines) %3E 1:%0A
@@ -441,24 +441,24 @@
lines) %3E 1:%0A
-
return
@@ -879,23 +879,55 @@
t = 0.0%0A
+ offsets = _get_offsets()%0A
for
+ i,
offset
@@ -929,31 +929,77 @@
fset in
-_get_offsets():
+enumerate(offsets)... |
5aa3dbf8f520f9ffaaed51ed397eb9f4c722882a | Fix pep8 order import issue | sample_app/__init__.py | sample_app/__init__.py | # 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, software
# distributed under t... | Python | 0 | @@ -550,20 +550,8 @@
ort
-json%0Aimport
Conf
@@ -558,16 +558,28 @@
igParser
+%0Aimport json
%0A%0Aimport
|
f6aecb1682c3f4b2609874b7fd7d2c028a12b2a6 | Add standalone capability for calibration. | position_fetcher.py | position_fetcher.py | import logging
import re
import serial
import threading
# Serial communication with Arduino
SERIAL_NAME = '/dev/ttyUSB0'
# Regex for a message
REGEX_MSG = '^#[0-9]+ [0-9]$'
MSG_TRUE = '1'
class PositionFetcher(object):
def __init__(self):
self.log = logging.getLogger("positionFetcher")
self.seria... | Python | 0 | @@ -8,16 +8,38 @@
logging%0A
+import logging.config%0A
import r
@@ -2333,8 +2333,208 @@
.is_end%0A
+%0Aif __name__ == %22__main__%22:%0A logging.config.fileConfig('log.ini')%0A tester = PositionFetcher()%0A tester.start()%0A try:%0A while True:%0A pass%0A finally:%0A tester.st... |
dfda1b07110d9f99f949172524f4580a863dc1fb | Fix of typo | infocache/factory.py | infocache/factory.py | """
Factory to instatiate the daemons that
shall run in the background.
"""
__author__ = "Placi Flury grid@switch.ch"
__copyright__ = "Copyright 2008-2011, SMSCG an AAA/SWITCH project"
__date__ = "11.04.2011"
__version__ = "0.3.0"
import sys
import logging
from sqlalchemy import engine_from_config
from db import in... | Python | 0.000131 | @@ -4107,32 +4107,39 @@
object to local
+/remote
database create
@@ -4223,16 +4223,23 @@
to local
+/remote
databas
|
d2beae040b49babda3cea140c6a1fcefb71668a7 | fix missing key in ci_helper | src/pyquickhelper/pycode/ci_helper.py | src/pyquickhelper/pycode/ci_helper.py | """
@file
@brief Helpers for CI
.. versionadded:: 1.3
"""
def is_travis_or_appveyor():
"""
tells if is a travis environment or appveyor
@return ``'travis'``, ``'appveyor'`` or ``None``
The function should rely more on environement variables
``CI``, ``TRAVIS``, ``APPVEYOR``.
.. versi... | Python | 0.999281 | @@ -471,16 +471,26 @@
iron
-%5B
+.get(
%22USER%22
-%5D
+, None)
) ==
|
efe65f1e89ad8f5c1305084b1526a62595f9e732 | Fix monitoring test | monitoring/api/v3/list_resources_test.py | monitoring/api/v3/list_resources_test.py | #!/usr/bin/env python
# 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, software
# di... | Python | 0.000009 | @@ -1339,18 +1339,24 @@
running'
+, re.I
)%0A
-
asse
@@ -1721,20 +1721,15 @@
CPU
- usage time'
+', re.I
)%0A
@@ -2040,32 +2040,32 @@
ys.readouterr()%0A
-
regex = re.c
@@ -2101,16 +2101,22 @@
onse:%5Cn'
+, re.I
)%0A as
|
449e79a8e00585c2a1ed595fc2c240151d77a4c0 | Update default-template.py | src/config/default-template.py | src/config/default-template.py | from const import basedir
import os
import socket
import re
ATTRIBUTE_AUTHORITY_URL = 'http://localhost:8095'
KEY_EXCHANGE_URL = 'http://localhost:20001'
CONTAINER_EXTENSION = '.media'
ALL_ATTRIBUTE = 'All'
# already registered at the KEX
# used to authenticate UM/CM against KEX
UMCM_CLIENT_ID = 'QlWDSSGCCUFdD9Nupq3... | Python | 0.000001 | @@ -1208,17 +1208,22 @@
=
-SSP_IP +'
+'134.158.74.59
:200
|
a4de7af5d4b177ac213f315ca45d99fa840fee9a | Handle connection more gracefully | motobot/core_plugins/network_handlers.py | motobot/core_plugins/network_handlers.py | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_wait(bot, message):
bot.identified = False
sleep(1)
@hook('NOTICE')
def handle_identification(bot, message... | Python | 0 | @@ -213,24 +213,92 @@
, message):%0A
+ %22%22%22 Handles too fast for server message and waits 1 second. %22%22%22%0A
bot.iden
@@ -596,22 +596,177 @@
-sleep(2)%0A%0A
+bot.identified = True%0A%0A%0A@hook('004')%0Adef handle_nickserv_identification(bot, message):%0A %22%22%22 At server welcome messa... |
25c6c3201ff7236d6c7294376bda69937aa056bd | Repair incorrect var reference in butterkvm | salt/modules/butterkvm.py | salt/modules/butterkvm.py | '''
Specilized routines used by the butter cloud component
'''
# Import salt modules
import virt
# Import python modules
import os
import shutil
import subprocess
import copy
import tempfile
def _place_image(image, vda):
'''
Moves the image file from the image pool into the final destination.
'''
imag... | Python | 0 | @@ -1125,33 +1125,34 @@
subprocess.call(
-f
+ch
_cmd, shell=True
|
93fdcbf3358b062c8dbb03508507b49e9a7e9bf5 | fix tests | tests/examples/data_solutions/dp-foundation/test_plan.py | tests/examples/data_solutions/dp-foundation/test_plan.py | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0.000001 | @@ -884,7 +884,7 @@
== 2
-65
+80
%0A
|
2b45444045982ef8a643fd58ed7f2730a777f455 | fix bug with time zone check | cogs/events.py | cogs/events.py | from datetime import datetime
import asyncio
import re
from discord.ext import commands
from db.dbase import DBase
import discord
from cogs.utils.messages import delete_all, MessageManager
from cogs.utils.checks import is_event
from cogs.utils import constants
class Events:
def __init__(self, bot):
sel... | Python | 0 | @@ -2143,16 +2143,24 @@
.content
+.upper()
not in
|
4da09270f959e65f6c500d21bf630ffd307a2686 | add Comment model | chords/models.py | chords/models.py | from django.db import models
from django.db.models import Count
from django.utils import timezone
from django.contrib.auth.models import User
from .utils import generate_unique_slug, strip_whitespace_lines
class Artist(models.Model):
# names are stored in the "Surname Name" format
name = models.CharField(max... | Python | 0 | @@ -5017,12 +5017,560 @@
opularity')%0A
+%0A%0Aclass Comment(models.Model):%0A pub_date = models.DateTimeField('date published', auto_now_add=True)%0A content = models.TextField()%0A user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True,%0A related_name='comments')%0A... |
7be85339a1487697dab56dade362e92d16d0093f | Handle initial connection better | motobot/core_plugins/network_handlers.py | motobot/core_plugins/network_handlers.py | from motobot import hook
from time import sleep
@hook('PING')
def handle_ping(bot, message):
""" Handle the server's pings. """
bot.send('PONG :' + message.params[-1])
@hook('439')
def handle_notice(bot, message):
""" Use the notice message to identify and register to the server. """
if not bot.iden... | Python | 0 | @@ -197,22 +197,119 @@
handle_
-notice
+wait(bot, message):%0A bot.identified = False%0A sleep(1)%0A%0A%0A@hook('NOTICE')%0Adef handle_identification
(bot, me
|
c7d0545f3656eaf40c8e94a515e76426f12ccb51 | Fix vote sans nom | cmask/views.py | cmask/views.py | from cmask.form import VoteForm
from app import db, redis, app
from flask import Blueprint, request, redirect, url_for, flash
from flask.ext.login import current_user, current_app
from flask.templating import render_template
from cmask.models import Vote, VoteOption
from settings import REDIS_CHAN
mod = Blueprint('vie... | Python | 0.000002 | @@ -785,24 +785,182 @@
validate():%0A
+ if request.form%5B'name'%5D =='':%0A flash('Vous devez indiquer le nom ', 'error')%0A return render_template('create.html', **locals())%0A
vote
@@ -1210,39 +1210,8 @@
ue%0A%0A
- vote.personalized = pe%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.