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 |
|---|---|---|---|---|---|---|---|
c93b2ba0ed45aeeb8d82c8e04f6a2f5197ba732b | refactor rabbitmq consumer | spider/rpc.py | spider/rpc.py | # -*- coding: utf-8 -*-
import logging
import sys
import time
import json
from multiprocessing import Process
import pika
from scrapy.utils.project import get_project_settings
from task import crawl, gen_lxmlspider, gen_blogspider
settings = get_project_settings()
def cron(ch, method, properties, body):
lo... | Python | 0.999999 | @@ -49,19 +49,30 @@
sys%0A
+from time
import
-time
+sleep
%0Aimp
@@ -80,16 +80,63 @@
rt json%0A
+from functools import partial%0Aimport threading%0A
from mul
@@ -334,12 +334,31 @@
ef c
-r
on
-(
+sume(callback, jobs,
ch,
@@ -477,20 +477,23 @@
target=c
-rawl
+allback
,%0A
@@ -537,17 +537,14 @@
fo('
-... |
d4a2632a0dcdd6731a5930f321135ec7f9864460 | Use new API, which requires being explicit about tracking ODF model. | AFQ/tests/test_tractography.py | AFQ/tests/test_tractography.py | import os.path as op
import numpy as np
import numpy.testing as npt
import nibabel.tmpdirs as nbtmp
from AFQ.csd import fit_csd
from AFQ.dti import fit_dti
from AFQ.tractography import track
from AFQ.utils.testing import make_tracking_data
seeds = np.array([[-80., -120., -60.],
[-81, -121, -61],
... | Python | 0 | @@ -946,32 +946,72 @@
me, directions,%0A
+ odf_model=%22CSD%22,%0A
|
e1ed03b278c699f0a55319ad8baf69989e5a62d6 | Check timestamps from session_client | lastuser_ui/views/dashboard.py | lastuser_ui/views/dashboard.py | # -*- coding: utf-8 -*-
from functools import wraps
from collections import defaultdict
from cStringIO import StringIO
import unicodecsv
from flask import g, current_app, abort, render_template
from lastuser_core.models import db, User, USER_STATUS
from .. import lastuser_ui
def requires_dashboard(f):
"""
D... | Python | 0.000001 | @@ -2852,35 +2852,36 @@
tus AND
-user_
session
-.access
+_client.updat
ed_at %3E=
|
705cb5cf3eec171baf3a8b91b8cc77d9987a1414 | Fix ImproperlyConfigured exception | precision/accounts/views.py | precision/accounts/views.py | from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.views.generic.base import TemplateResponseMixin, View
from .forms import LoginForm
class SignInView(TemplateResponseMixin, View):
def get(self, request):
tem... | Python | 0.000003 | @@ -277,41 +277,8 @@
w):%0A
-%0A def get(self, request):%0A
@@ -316,16 +316,45 @@
in.html'
+%0A%0A def get(self, request):
%0A
|
32f33a9b2f16edb6fe080f850e06b2384af06a5a | change string type | privacyidea/api/resolver.py | privacyidea/api/resolver.py | # -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# (c) cornelius kölbel, privacyidea.org
#
# 2016-04-10 Cornelius Kölbel <cornelius@privacyidea.org>
# Make route the outermost decorator
# 2014-12-08 Cornelius Kölbel, <cornelius@privacyidea.org>
# Complete rewrite during flask migration
# ... | Python | 0.000153 | @@ -2530,34 +2530,27 @@
e resolver:
-basestring
+str
%0A :param
@@ -2625,26 +2625,19 @@
e type:
-basestring
+str
%0A :pa
@@ -2728,26 +2728,19 @@
itable:
-basestring
+str
%0A :re
@@ -3987,18 +3987,11 @@
er:
-basestring
+str
%0A
@@ -4125,19 +4125,16 @@
ype: str
-ing
%0A :re
|
2e4eb5a54a02698b69b02c550980b86b25cd13f9 | Add `__repr__` to the `MALAffinity` class | malaffinity/malaffinity.py | malaffinity/malaffinity.py | """
malaffinity class
"""
import copy
import bs4
import requests
import statistics
from . import calcs
# Lines are getting too long, best to import the exceptions
# manually, instead of just importing `exceptions`
from .exceptions import (
InvalidUsernameError, NoAffinityError,
MALRateLimitExceededError
)
... | Python | 0.000017 | @@ -1197,24 +1197,279 @@
base_user)%0A%0A
+ def __repr__(self):%0A # TODO: Surely there has to be a better way of doing this...%0A # TODO: Make this look less ugly%0A return 'MALAffinity(base_user=%7B%7D, round=%7B%7D)' %5C%0A .format(repr(self._base_user), repr(self._round))%0A%0... |
5b7bb415b03e9bb3b432fd8e6dc40a9b5ecd4539 | as_user or None | corehq/apps/formplayer_api/management/commands/prime_formplayer_restores.py | corehq/apps/formplayer_api/management/commands/prime_formplayer_restores.py | import csv
import sys
from concurrent import futures
from django.core.management.base import BaseCommand
from corehq.apps.formplayer_api.sync_db import sync_db
from corehq.apps.users.models import CouchUser
from corehq.apps.users.util import format_username
class Command(BaseCommand):
help = "Call the Formplaye... | Python | 0.999902 | @@ -1362,35 +1362,8 @@
rn%0A%0A
- restore_as_user = None%0A
@@ -1838,16 +1838,24 @@
as_user
+ or None
)%0A ex
|
15f1afc9292f55850f7bade4b468fafc971c752a | Exclude past contest rounds. HACK | project/convention/views.py | project/convention/views.py | from __future__ import division
from haystack.views import basic_search
from django.shortcuts import (
get_list_or_404,
get_object_or_404,
render,
redirect,
)
from django.contrib import messages
from django.contrib.auth.decorators import login_required
# from django.core.exceptions import (
# Doe... | Python | 0.999955 | @@ -1937,16 +1937,29 @@
related(
+%0A
'contest
@@ -1977,27 +1977,125 @@
ant'
-).filter(place=None
+%0A ).filter(%0A place=None%0A ).exclude(%0A contest_round=Performance.QUARTERS,%0A
).or
|
c0684358b217318327d71470ee86074b3556148a | Use double quotes consistently | bc125csv/__main__.py | bc125csv/__main__.py | from bc125csv.handler import main
if __name__ == '__main__':
main() | Python | 0 | @@ -47,17 +47,17 @@
==
-'
+%22
__main__
':%0A%09
@@ -56,9 +56,9 @@
in__
-'
+%22
:%0A%09m
@@ -62,8 +62,9 @@
%0A%09main()
+%0A
|
acd620c930a92511c2e2099a4fc82d41825fdf93 | improve _VALID_URL regex(#16484) | youtube_dl/extractor/teamcoco.py | youtube_dl/extractor/teamcoco.py | # coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
mimetype2ext,
parse_duration,
parse_iso8601,
qualities,
)
class TeamcocoIE(InfoExtractor):
_VALID_URL = r'https?://t... | Python | 0.001603 | @@ -339,16 +339,25 @@
/(?P%3Cid%3E
+(%5B%5E/%5D+/)*
%5B%5E/?#%5D+)
@@ -2655,24 +2655,160 @@
vailable.',%0A
+ %7D, %7B%0A 'url': 'http://teamcoco.com/video/the-conan-audiencey-awards-for-04/25/18',%0A 'only_matching': True,%0A
%7D%0A
|
32537dafa3c13761b910ab8449ff80d60df6f02b | Bump version to 2.3.4-dev | indico/__init__.py | indico/__init__.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import warnings
from indico.util.mimetypes import register_custom_mimetypes
__version__ = '2.3.3'
regi... | Python | 0 | @@ -305,17 +305,21 @@
= '2.3.
-3
+4-dev
'%0A%0Aregis
|
41acddb1e2edcac54cd3ae5287a7c2977b02f305 | Change `ugettext` to `ugettext_lazy` | cmsplugin_bootstrap_carousel/models_default.py | cmsplugin_bootstrap_carousel/models_default.py | # coding: utf-8
import os
from django.db import models
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils.translation import ugettext as _
from cms.models.pluginmodel import CMSPlugin
from PIL import Image
from cStringIO import StringIO
from . import config
class Carousel(CMSPlugin):
... | Python | 0.000052 | @@ -155,16 +155,21 @@
ugettext
+_lazy
as _%0A%0Af
|
862f81d54624ea198d6351f5ea7c88b66bc02019 | Make the Nick an argument to Client.py | src/Client.py | src/Client.py | #!python
__author__ = 'JacobAMason'
import sys
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
import StringIO
class Bot(irc.IRCClient):
def _get_nickname(self):
return self.factory.nickname
nickname = property(_get_nickname)
def signedOn(self):
se... | Python | 0.001602 | @@ -2129,16 +2129,43 @@
argv%5B1%5D%0A
+ nickname = sys.argv%5B2%5D%0A
reac
@@ -2208,16 +2208,39 @@
%22, 6667,
+%0A
BotFact
@@ -2256,16 +2256,26 @@
channel
+, nickname
))%0A r
|
ecf71bd004d99b679936e07453f5a938e19f71dc | Add aiohttp as a execution requirement | megalist_dataflow/setup.py | megalist_dataflow/setup.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0 | @@ -11,10 +11,10 @@
t 20
-19
+20
Goo
@@ -980,16 +980,32 @@
e==1.9.0
+, aiohttp==3.6.2
'%5D,%0A
|
8ffb2beea77897e3fa40691f35f2e089dbc5df9a | Add more documentation | coalib/bearlib/languages/LanguageDefinition.py | coalib/bearlib/languages/LanguageDefinition.py | import os
from coalib.bearlib.abstractions.SectionCreatable import SectionCreatable
from coalib.misc.StringConstants import StringConstants
from coalib.parsing.ConfParser import ConfParser
class LanguageDefinition(SectionCreatable):
def __init__(self, language_family: str, language: str):
"""
Cre... | Python | 0 | @@ -362,16 +362,263 @@
file.%0A%0A
+ A Language Definition holds constants which may help parsing the%0A language. If you want to write a bear you'll probably want to use those%0A definitions to keep your bear independent of the semantics of each%0A language.%0A%0A
|
fd3e9c09f14b554883e47102b4750faef5c10ecc | Print body in case of HTTPError | unit-healthcheck.py | unit-healthcheck.py | #!/usr/bin/env python
import logging
import argparse
import os
import json
import sys
try:
from urllib2 import Request, urlopen
except ImportError:
from urllib.request import Request, urlopen
TSURU_TARGET = os.environ['TSURU_TARGET']
TSURU_TOKEN = os.environ['TSURU_TOKEN']
def main():
logging.basicCon... | Python | 0 | @@ -126,16 +126,27 @@
urlopen
+, HTTPError
%0Aexcept
@@ -205,16 +205,27 @@
urlopen
+, HTTPError
%0A%0A%0ATSURU
@@ -1818,34 +1818,302 @@
en(url, timeout=
-3)
+5)%0A except HTTPError as err:%0A logging.error('%5B%25s%5D Failed to healthcheck unit: %25s', url, err)%0A%0A if hasattr(err, 'file'):%0... |
74272b9916c29bb9e97d4761801ee3730b053b87 | comment fix | athenet/sparsifying/utils/numlike.py | athenet/sparsifying/utils/numlike.py | """Template class with arithmetic operations that can be passed through neural
network.
All classes that are being used for derest should inherit from this class."""
class Numlike(object):
"""Template class with arithmetic operations that can be passed through
neural network.
All classes that are being ... | Python | 0 | @@ -513,16 +513,17 @@
numlike
+.
%0A%0A
@@ -516,32 +516,33 @@
mlike.%0A%0A
+:
at: Coordinates
@@ -561,16 +561,25 @@
e taken.
+%0A
%22%22%22%0A
@@ -727,16 +727,17 @@
+:
at: Coor
@@ -767,24 +767,25 @@
et.%0A
+:
other: Data
@@ -801,16 +801,26 @@
at 'at'
+.%0A ... |
9ba255886ca5315be1b95ccac28d496e3941f155 | Bump alpha version | uplink/__about__.py | uplink/__about__.py | """
This module is the single source of truth for any package metadata
that is used both in distribution (i.e., setup.py) and within the
codebase.
"""
__version__ = "0.8.0a0"
| Python | 0 | @@ -165,11 +165,11 @@
%220.8.0a
-0
+1
%22%0A
|
ec665be1811b458f849cbed09ef3d3c61f9e4533 | Change order of environment setup | metatlas/tools/notebook.py | metatlas/tools/notebook.py | """Jupyter notebook helper functions"""
import logging
import os
import shutil
import sys
from pathlib import Path
import pandas as pd
from IPython.core.display import display, HTML
from metatlas.tools.logging import activate_logging
logger = logging.getLogger(__name__)
def configure_environment(log_level):
""... | Python | 0.000001 | @@ -2659,30 +2659,8 @@
%22%22%22%0A
- validate_kernel()%0A
@@ -2688,24 +2688,46 @@
(log_level)%0A
+ validate_kernel()%0A
configur
|
646416efa7378b645af56031c06e7544cb72627f | Delete comment | user_recommender.py | user_recommender.py | from tumblr_manager import TumblrManager, TumblrScraper
class UserRecommender(object):
user_counter = {}
def __init__(self, consumer_key=None, consumer_secret=None, oauth_token=None, oauth_token_secret=None):
self.tm = TumblrManager(consumer_key, consumer_secret, oauth_token, oauth_token_secret)
... | Python | 0 | @@ -842,102 +842,8 @@
st)%0A
- # non_followed_users = list(filter(lambda x: not self.tm.is_following(x), all_users))%0A
|
f261ae4489fe72768973c3eb0cf0f82cd6f0a8a5 | Refactor IsObjectOwner component | backend/shmitter/base/permissions.py | backend/shmitter/base/permissions.py | import abc
import functools
import operator
from rest_framework.compat import is_authenticated
##############################
# Base
##############################
class BasePermission(metaclass=abc.ABCMeta):
"""
A base class from which all permission classes should inherit.
"""
@abc.abstractmetho... | Python | 0.000107 | @@ -4209,63 +4209,8 @@
j):%0A
- if obj.owner is None:%0A return False%0A
|
e73372c8a5428547d1544ae44d57119c8b5aa29c | make a Iowa WFO outline | util/make_shapes.py | util/make_shapes.py | """Serialization of geometries for use in pyIEM.plot mapping
We use a pickled protocol=2, which is compat binary.
"""
import psycopg2
import cPickle
from shapely.wkb import loads
import datetime
# Be annoying
print("Be sure to run this against Mesonet database and not laptop!")
def dump_states(fn):
pgconn = psy... | Python | 0.003036 | @@ -1967,98 +1967,633 @@
- # for polygon in geom:%0A # data%5Brow%5B0%5D%5D.append(np.asarray(polygon.exterior))%0A
+f = open('../pyiem/data/%25s' %25 (fn, ), 'wb')%0A cPickle.dump(data, f, 2)%0A f.close()%0A%0A%0Adef dump_iowawfo(fn):%0A %22%22%22 A region with the Iowa WFOs%22%22%22%0A ... |
906d765e387367654a02a36e9b5ba7aca4480ed6 | Check if zip only contains one file | util/zipwrangler.py | util/zipwrangler.py | from pathlib import Path
from zipfile import ZipFile
from tempfile import TemporaryDirectory
import shutil
ignore = ['__MACOSX', '.DS_Store']
def get_cleaned_contents(zipfile, ignore_list=ignore, verbose=False):
contents = []
for info in zipfile.infolist():
if not any(ignored in info.filename for ign... | Python | 0 | @@ -1272,42 +1272,156 @@
-contents = list(content.iterdir())
+if content.is_dir():%0A contents = list(content.iterdir())%0A else:%0A contents = %5Bcontent%5D%0A break
%0A%0A
|
9785c4f887353ed4835b3ecee602f07f78cd0eab | remove some chatter from make_examples.py | doc/make_examples_rst.py | doc/make_examples_rst.py | #!/usr/bin/env python
"""
generate the rst files for the examples by iterating over the pylab examples
"""
# This code was developed from the Matplotlib gen_rst.py module
# and is distributed with the same license as Matplotlib
import os, glob
import os
import re
import sys
#fileList = []
#rootdir = '../../examples'
... | Python | 0.000022 | @@ -4227,62 +4227,8 @@
me)%0A
- print os.getcwd(),png,os.path.exists(png)%0A
@@ -4333,75 +4333,8 @@
g):%0A
- print %22adding link%22,os.path.join(linkname,pngname)%0A
|
2d09314ab58bb766372dc6e263fb17428b1fd3cd | Fix check for existing pools. | doc/pool_scripts/cats.py | doc/pool_scripts/cats.py | import os
import photomosaic.flickr
import photomosaic as pm
if not os.path.isfile('~/pools/cats/pool.json'):
FLICKR_API_KEY = os.environ['FLICKR_API_KEY']
pm.set_options(flickr_api_key=FLICKR_API_KEY)
photomosaic.flickr.from_search('cats', '~/pools/cats/')
pool = pm.make_pool('~/pools/cats/*.jpg')
... | Python | 0 | @@ -78,16 +78,35 @@
.isfile(
+os.path.expanduser(
'~/pools
@@ -122,16 +122,17 @@
l.json')
+)
:%0A FL
|
89e2c825481ebd62e467ba60b4cd73ddb09149e8 | Fix deprecation warning. | jazzband/config.py | jazzband/config.py | import os
from datetime import timedelta
from decouple import Csv, config
from markdown.extensions.toc import TocExtension
from markdown.extensions.wikilinks import WikiLinkExtension
from .renderer import smart_pygmented_markdown
IS_PRODUCTION = "PRODUCTION" in os.environ
ROOT_DIR = os.path.dirname(__file__)
SECRE... | Python | 0.000001 | @@ -692,21 +692,49 @@
TYPE = %22
-redis
+flask_caching.backends.RedisCache
%22%0ACACHE_
|
a8e773e1ff7e0caf67d34d3b00719a57ee81da32 | Use the server hostname to get the prefix. | uwhoisd/__init__.py | uwhoisd/__init__.py | """
A 'universal' WHOIS proxy server.
"""
import logging
import logging.config
import os.path
import re
import socket
import sys
from uwhoisd import net, utils
USAGE = "Usage: %s <config>"
PORT = socket.getservbyname('whois', 'tcp')
CONFIG = """
[uwhoisd]
iface=0.0.0.0
port=4343
registry_whois=false
suffix=whois-... | Python | 0 | @@ -2768,28 +2768,30 @@
refix(self,
-zone
+server
):%0A %22
@@ -2916,47 +2916,20 @@
ixes
-%5Bzone%5D if zone in self.prefixes else ''
+.get(server)
%0A%0A
|
be3caa1af2a1c6c51cd1b8a9300949e4604d0c0f | exclude some symbols from the documentation list using `__no_apidoc__` | doc/utils/checkapidoc.py | doc/utils/checkapidoc.py | # -*- coding: utf-8 -*-
"""Trac API doc checker
Verify that all symbols belonging to modules already documented in the doc/api
Sphinx sources are referenced.
See http://trac.edgewall.org/wiki/TracDev/ApiDocs
"""
import fnmatch
import os
import re
import sys
excluded_docs = ['index.rst']
api_doc = 'doc/api'
def u... | Python | 0.000205 | @@ -2040,16 +2040,244 @@
mented)%0A
+ no_apidoc = getattr(module, '__no_apidoc__', None)%0A if no_apidoc:%0A if isinstance(no_apidoc, basestring):%0A no_apidoc = %5Bs.strip() for s in no_apidoc.split()%5D%0A all = list(set(all) - set(no_apidoc))%0A
symb
|
fba155006299572eea76d7d478b13f8d269e612e | update city getter | emonitor/modules/streets/city.py | emonitor/modules/streets/city.py | from sqlalchemy.orm.collections import attribute_mapped_collection
from emonitor.extensions import db, cache
class City(db.Model):
"""City class"""
__tablename__ = 'cities'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(30))
... | Python | 0.000001 | @@ -2568,19 +2568,23 @@
tCities(
+id=0
):%0A
-
@@ -2696,32 +2696,56 @@
ty%60%0A %22%22%22%0A
+ if id == 0:%0A
return d
@@ -2813,16 +2813,103 @@
).all()%0A
+ else:%0A return db.session.query(City).filter_by(id=id).one() or None%0A
|
3f190e10707895a357a9167add44fa8ae0a3cc31 | Tidy up ebay messaging call | erpnext_ebay/ebay_do_requests.py | erpnext_ebay/ebay_do_requests.py | # -*- coding: utf-8 -*-
"""eBay requests which are not read-only, and can affect live eBay data.
Excludes item revision calls.
"""
from ebaysdk.exception import ConnectionError
from erpnext_ebay.ebay_constants import HOME_SITE_ID
from erpnext_ebay.ebay_get_requests import (
ebay_logger, get_trading_api, handle_eb... | Python | 0.00001 | @@ -1062,38 +1062,33 @@
)%0A%0A%0Adef
-AddMemberMessageAAQToP
+ebay_message_to_p
artner(u
@@ -1115,29 +1115,24 @@
y, subject,%0A
-
@@ -1212,17 +1212,134 @@
r seller
-.
+ using%0A the AddMemberMessageAAQToPartner call.%0A%0A Note that HTML cannot be used in the body of this message.%0A
... |
e83be594507c994069d20d5f2cd86c52905a52a6 | Fix personal brain damage. | lib/plugin/disk_utilization.py | lib/plugin/disk_utilization.py | import datetime
import logging
import os
import snmpy.plugin
import subprocess
class disk_utilization(snmpy.plugin.TablePlugin):
def __init__(self, conf):
conf['table'] = [
{'dev': 'string'},
{'wait': 'integer'},
{'util': 'integer'},
]
snmpy.plugin.Tabl... | Python | 0.000001 | @@ -345,9 +345,8 @@
onf)
-;
%0A%0A
|
65981662c7c0500a8428b5c332465cea32c813da | Use admin_authenticate for a non-SRP flow | lizard_auth_server/backends.py | lizard_auth_server/backends.py | """Custom Django authentication backend
Copyright note: copied almost verbatim from backend.py in
https://github.com/metametricsinc/django-warrant
(BSD licensed)
"""
from boto3.exceptions import Boto3Error
from botocore.exceptions import ClientError
from django.conf import settings
from django.contrib.auth import get... | Python | 0 | @@ -2962,16 +2962,22 @@
to_user.
+admin_
authenti
@@ -2991,16 +2991,188 @@
ssword)%0A
+ # %5E%5E%5E This uses ADMIN_NO_SRP_AUTH, but that's the old name for%0A # ADMIN_USER_PASSWORD_AUTH (which we need), so it will probably be%0A # OK.%0A
|
4ceeed0eceff9d75b0bc3047c9a8e2fcb6877e31 | Fix tasks reading of different course_id | lms/djangoapps/ecoapi/tasks.py | lms/djangoapps/ecoapi/tasks.py |
from celery.task import task
from instructor.offline_gradecalc import student_grades , offline_grade_calculation
#TODO: add a better task management to prevent concurrent task execution with some course_id
@task()
def offline_calc(course_id):
offline_grade_calculation(course_id)
| Python | 0.999881 | @@ -1,13 +1,12 @@
-%0A
from celery.
@@ -111,139 +111,451 @@
on %0A
-%0A#TODO: add a better task management to prevent concurrent task execution with some course_id%0A%0A@task()%0Adef offline_calc(course_id):
+from opaque_keys.edx.keys import CourseKey%0Afrom opaque_keys import InvalidKeyError%0Afrom opaque_keys.edx.l... |
3511f1627ff7ff1bfe5db75d83b661b990eda6d2 | Update transformation.py | transformations/add_hashtags/transformation.py | transformations/add_hashtags/transformation.py | from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
import random
from spacy import load
def extract_dep_nodes(dep_parse, be_class_verb):
"""method for extracting VERB, NSUBJ phrase and DOBJ phrase dependency nodes"""
verb = ""
nsubj_phrase = []
dobj_phrase ... | Python | 0.000001 | @@ -3387,19 +3387,18 @@
high
-ly-accurate
+-precision
%22%5D%0A%0A
|
58e58ffcb58fc077c755c612a07a5634bbccbe4e | Annotate chemdner chemical entities | src/client.py | src/client.py | # coding=utf-8
from __future__ import division, unicode_literals
import sys
import requests
def main():
if sys.argv[1] == '0':
text = "Administration of a higher dose of indinavir should be considered when coadministering with megestrol acetate."
elif sys.argv[1] == "1":
... | Python | 0.00003 | @@ -3131,18 +3131,23 @@
-#
+print %22
Submit n
@@ -3149,32 +3149,33 @@
mit new document
+%22
%0D%0A r = re
@@ -3314,18 +3314,23 @@
-#
+print %22
Fetch do
@@ -3335,16 +3335,17 @@
document
+%22
%0D%0A
@@ -3464,32 +3464,64 @@
print r.text%0D%0A%0D%0A
+ print %22Annotate miR... |
c9ef1c40bb8b0179f19991d27309008c1805d6a6 | add a skeletal twisted client (-t) | src/client.py | src/client.py | import sys
import time
import select
import socket
# local imports
import event
import message
import mars_math
RECV_SIZE = 4096 # should be way more than enough
class Client(object):
def __init__(self, host, port):
self.host = host
self.port = port
self.event_queue = event.EventQueue()
self.mtime = 0 # ma... | Python | 0 | @@ -158,16 +158,116 @@
enough%0A%0A
+from twisted.internet import reactor%0Afrom twisted.internet.protocol import Protocol, ClientFactory%0A%0A
class Cl
@@ -2715,36 +2715,631 @@
0)%0A%0A
-if __name__ == '__main__':%0A%09
+class TwistedClient(Protocol): %0A def connectionMade(self): %0A print %22connection ... |
6d84f7eb25352c50e40950d0585c33bd1193649e | fix bug in init | sfa/util/osxrn.py | sfa/util/osxrn.py | import re
from sfa.util.xrn import Xrn
from sfa.util.config import Config
class OSXrn(Xrn):
def __init__(self, name=None, type=None, *args, **kwds):
config = Config()
if name is not None:
self.type = type
self.hrn = config.SFA_INTERFACE_HRN + "." + name
self.hrn... | Python | 0 | @@ -137,22 +137,24 @@
e, *
-args, *
*kwds):
+%0A
%0A
@@ -325,16 +325,71 @@
o_urn()%0A
+ else:%0A Xrn.__init__(self, **kwds)
%0A
|
927adddca399fdfdb358f4b6128595816930ef7c | add stageClassifierQueue to stage.py | shablona/stage.py | shablona/stage.py | from datetime import datetime
from . import config
class Stage:
""""""
def __init__(self, target_space):
self.target_space = target_space
self.data_queues = {}
for stream in config.data_streams:
self.data_queues[stream] = []
if stream == 'nims-simulator':
... | Python | 0.000001 | @@ -3168,20 +3168,22 @@
def
-streamDataTo
+createOrUpdate
Targ
@@ -3191,36 +3191,35 @@
t(self, stream,
-data
+key
):%0A %22%22%22Ap
@@ -3462,20 +3462,40 @@
-pass
+self.data_queues%5Bstream%5D
%0A%0A de
@@ -3976,16 +3976,34 @@
put_data
+%5B'nims-simulator'%5D
%0A
@@ -4089,32 +4089,32 ... |
4067b94c212d1a41624b729a1aa114e6dca64d05 | Remove redundant cmp=compare() | sipa/flatpages.py | sipa/flatpages.py | # -*- coding: utf-8 -*-
from flask import abort
from babel.core import UnknownLocaleError, Locale
from flask.ext.flatpages import FlatPages
from .babel import babel, locale_preferences
def compare(x, y):
if x.rank is None:
return -1
if y.rank is None:
return 1
if x.rank < y.rank:
... | Python | 0.002022 | @@ -1815,21 +1815,8 @@
s())
-, cmp=compare
))%0A%0A
@@ -3365,41 +3365,8 @@
s())
-,%0A cmp=compare
))%0A%0A
|
3aba768c7a3c11f2941db36d0292cd5810433596 | fix python2.7.9 | src/api/util/timeutils.py | src/api/util/timeutils.py | from datetime import datetime
def total_seconds(td):
# Keep backward compatibility with Python 2.6 which doesn't have
# this method
if hasattr(td, 'total_seconds'):
return td.total_seconds()
else:
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
def convert... | Python | 0.998339 | @@ -1,18 +1,4 @@
-from datetime
impo
@@ -9,17 +9,16 @@
atetime%0A
-%0A
def tota
@@ -320,16 +320,191 @@
stamp):%0A
+ if (type(timestamp) is datetime.date):%0A timestamp = datetime.datetime.fromordinal(timestamp.toordinal())%0A timestamp = timestamp.replace(tzinfo=None)%0A
%09diff =
@@ -51... |
f98b30583fb9fca4674ad93afd242ffae7ac9f36 | Fix tests | spacy/tests/conftest.py | spacy/tests/conftest.py | # coding: utf-8
from __future__ import unicode_literals
from ..en import English
from ..de import German
from ..es import Spanish
from ..it import Italian
from ..fr import French
from ..pt import Portuguese
from ..nl import Dutch
from ..sv import Swedish
from ..hu import Hungarian
from ..fi import Finnish
from ..bn im... | Python | 0.000003 | @@ -1754,20 +1754,16 @@
matizer(
-path
):%0A r
|
d6b69f7d5868597426f7718165d4933af72e154d | Fix typo in command-line | spreadsplug/pdfbeads.py | spreadsplug/pdfbeads.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Johannes Baiter <johannes.baiter@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... | Python | 0.000006 | @@ -1519,17 +1519,16 @@
ata' / '
-
out' / %22
|
7d6e7133fec83e4828053e3e273811dfbcd22572 | Rename a member variable | sqliteschema/_schema.py | sqliteschema/_schema.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import, unicode_literals
import six
from tabledata import TableData
from ._const import MAX_VERBOSITY_LEVEL, SQLITE_SYSTEM_TABLE_LIST, SchemaHeader
from ._logger import logger
class SQLiteTabl... | Python | 0.000056 | @@ -515,20 +515,19 @@
_schema_
-data
+map
= schem
@@ -1053,28 +1053,27 @@
lf.__schema_
-data
+map
%5Bself.table_
@@ -1192,20 +1192,19 @@
_schema_
-data
+map
%5Bself.__
|
20cf0f2b6647b7a03fb5a9808f9d854975feb651 | add shebang line to demo.py | demo.py | demo.py | from prettytask import Task, TaskGroup, Error, prompt
def main():
with Task("A quick task"):
pass
with Task("A task with a custom success message") as task:
task.ok("that went well!")
with Task("A task that fails") as task:
raise Error
with Task("A task that fails with a cus... | Python | 0.000001 | @@ -1,8 +1,31 @@
+#!/usr/bin/env python3%0A
from pre
|
6684f08beaaf297eb6a0249ee17a6d90770b93e8 | Update 1.0 protocol version spec in test_versions.py | bokeh/server/protocol/tests/test_versions.py | bokeh/server/protocol/tests/test_versions.py | ###############################################################################
# #
# #
# #
... | Python | 0 | @@ -1660,9 +1660,120 @@
1),%0A
-)
+ ('PULL-DOC-REQ', 1),%0A ('PULL-DOC-REPLY', 1),%0A ('PUSH-DOC', 1),%0A ('PATCH-DOC', 1)%0A )%0A
|
f2ba354f862db5ee054bd09044a06a037c836b59 | Add for_object argument and implementation to update_schedule | localized_recurrence/models.py | localized_recurrence/models.py | from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from timezone_field import TimeZoneField
import fleming
import pytz
from .f... | Python | 0 | @@ -116,31 +116,24 @@
enttypes
-.fields
import
GenericF
@@ -124,33 +124,23 @@
import
-G
+g
eneric
-ForeignKey
%0Afrom dj
@@ -512,16 +512,33 @@
ime=None
+, for_object=None
):%0A
@@ -610,16 +610,685 @@
eryset.%0A
+%0A Args:%0A time - The time the schedule was checked. If None, defaults%0... |
7b87b9c3abcd7833c83e9e1eab073fcc358af2ff | remove debug print | awslimitchecker/services/directoryservice.py | awslimitchecker/services/directoryservice.py | """
awslimitchecker/services/directoryservice.py
The latest version of this package is available at:
<https://github.com/jantman/awslimitchecker>
################################################################################
Copyright 2015-2017 Jason Antman <jason@jasonantman.com>
This file is part of awslimit... | Python | 0.000008 | @@ -2613,35 +2613,8 @@
s'%5D%0A
- print(self.limits)%0A
|
a6aec17cff730914c0901db9e9ab9bb4da660306 | Switch elm-formato to post save | elm_format.py | elm_format.py | from __future__ import print_function
import subprocess
import os, os.path
import re
import sublime, sublime_plugin
class ElmFormatCommand(sublime_plugin.TextCommand):
def run(self, edit):
settings = sublime.load_settings('Elm Language Support.sublime-settings')
path = settings.get('elm_paths', '')
if path:
... | Python | 0 | @@ -1038,18 +1038,19 @@
def on_p
-re
+ost
_save(se
|
d679f7dbedd3decc7cd4abc782d4c0fae0b872ea | Enable the ability to import H264 SubMe, MotionEstimationMethod and Trellis | bitmovin/resources/enums/__init__.py | bitmovin/resources/enums/__init__.py | from .status import Status
from .aac_channel_layout import AACChannelLayout
from .ac3_channel_layout import AC3ChannelLayout
from .aws_cloud_region import AWSCloudRegion
from .badapt import BAdapt
from .cloud_region import CloudRegion
from .crop_filter_unit import CropFilterUnit
from .google_cloud_region import GoogleC... | Python | 0 | @@ -2516,8 +2516,151 @@
yMethod%0A
+from .h264_trellis import H264Trellis%0Afrom .h264_sub_me import H264SubMe%0Afrom .h264_motion_estimation_method import H264MotionEstimationMethod%0A
|
eec2d410ad39ff12e6b60fcff9f51540719b6063 | fix crash when scan is not made and force + scan is no | modules/processing/irma.py | modules/processing/irma.py | # Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import logging
import time
import urlparse
try:
import requests
HAVE_REQUESTS = True
# Disable requests/urllib3 debug & info messages.
... | Python | 0.000039 | @@ -4244,24 +4244,109 @@
%0A if
+not self.force and not self.scan and not results:%0A return %7B%7D%0A elif
self.force o
|
27f11ce9b11d1f2dbaa2188e9df6d038710e6619 | Fix broken import from refactored code | jreport/jreport.py | jreport/jreport.py | import datetime
import functools
import pprint
import string
import colors
import dateutil.parser
import requests
from urlobject import URLObject
import yaml
from .util import paginated_get
class JObj(object):
def __init__(self, obj):
self.obj = obj
def __repr__(self):
return u"jreport.{cls}... | Python | 0.000006 | @@ -161,13 +161,15 @@
rom
-.util
+helpers
imp
|
2e3e7e1bf92e342e0ed14c672b7c5a600f0ba3a2 | Fix ros__parameters in game settings script | bitbots_utils/bitbots_utils/game_settings.py | bitbots_utils/bitbots_utils/game_settings.py | #!/usr/bin/env python3
import sys
import yaml
import os
# path to the game settings yaml and to the game setting options
SETTING_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
"bitbots_utils", "config", "game_settings.yaml")
OPTIONS_PATH ... | Python | 0.000086 | @@ -3136,32 +3136,33 @@
ackboard'%5D%5B'ros_
+_
parameters'%5D%0A
@@ -3253,32 +3253,33 @@
ackboard'%5D%5B'ros_
+_
parameters'%5D = r
|
1d6d97a0f03723d4f2872f1c7912fb3c1b6ff5dd | Revert "[ADD] account_financial_report to mozaik requirements" | mozaik_all/__manifest__.py | mozaik_all/__manifest__.py | # Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mozaik: All Modules Loader",
"summary": """
Loads all Mozaik modules""",
"version": "14.0.1.1.9",
"license": "AGPL-3",
"author": "ACSONE SA/NV",
"website": "https://github.com/OCA/moz... | Python | 0 | @@ -4251,86 +4251,8 @@
b%22,%0A
- # OCA/account-financial-reporting%0A %22account_financial_report%22,%0A
|
b4a2bf0ee660aab40a885cd8b84c18c8b4a8580b | make host, ip and type dynamic | mpf/core/bcp/bcp_server.py | mpf/core/bcp/bcp_server.py | """Bcp server for clients which connect and disconnect randomly."""
import asyncio
from mpf.core.bcp.bcp_socket_client import BCPClientSocket
class BcpServer():
"""Server socket which listens for incoming BCP clients."""
def __init__(self, machine):
self.machine = machine
self._server = Non... | Python | 0 | @@ -80,67 +80,67 @@
cio%0A
-%0Afrom mpf.core.bcp.bcp_socket_client import BCPClientSocket
+import logging%0A%0Afrom mpf.core.utility_functions import Util
%0A%0A%0Ac
@@ -253,16 +253,32 @@
machine
+, ip, port, type
):%0A
@@ -320,21 +320,145 @@
elf.
-_server = Non
+log = logging.getLogger('BCPServer')%0A ... |
35f9db005fc95f6d95d1559f81137381fa43e7ad | Add new locale. | mrburns/settings/server.py | mrburns/settings/server.py | import os
import socket
from django.utils.translation import ugettext_lazy as _
from .base import * # noqa
SERVER_ENV = os.getenv('DJANGO_SERVER_ENV')
SECRET_KEY = os.getenv('SECRET_KEY')
DEBUG = TEMPLATE_DEBUG = False
ALLOWED_HOSTS = [
# the server's IP (for monitors)
socket.gethostbyname(socket.gethostna... | Python | 0.000001 | @@ -1295,24 +1295,50 @@
Chinese')),%0A
+ ('xx', 'Pirate'),%0A
)%0Aelif S
|
a59dcbe8df5b933006dcc554962bdeef674c4383 | Remove print statements and re-raise errors | mstranslator/translator.py | mstranslator/translator.py | import requests
import urllib
import sys
class Config:
"""Config to be given to an instance of translator to do the Authorization."""
def __init__(self, translator_client_id, translator_client_secret):
assert translator_client_id is not None
assert type(translator_client_id) is str
ass... | Python | 0.000007 | @@ -1211,50 +1211,8 @@
n()%0A
- print %22Using token%22, access_token%0A
@@ -1252,16 +1252,16 @@
s_token%0A
+
%0A def
@@ -1330,58 +1330,8 @@
8')%0A
- print %22Detecting language for text%22, text%0A
@@ -1833,72 +1833,8 @@
%5B0%5D%0A
- print %22Language detected: %22, detecte... |
61d8ced0d46bb0e351b8c488814b75b1de2ddab3 | Update Ejemplos.py | Ago-Dic-2018/Ejemplos/Ejemplos.py | Ago-Dic-2018/Ejemplos/Ejemplos.py | import collections
potenciaPares = 2
potenciaImpares = 3
# print(2 / 3)
#for i in range(0, 10):
#if i % 2:
# Estilo de formateo 1:
# print("Impar: %d" % (i))
# Estilo de formateo 2:
# print("El impar #{} ^ {} es = {}".format(i, potenciaImpares, i ** potenciaImpares))
#else:
... | Python | 0 | @@ -1165,16 +1165,37 @@
, 2, 3)%0A
+# Aqu%C3%AD falla ehhh -%3E
miTupla%5B
@@ -1213,12 +1213,1506 @@
nt(miTupla)%0A
+%0A# Sumatoria de Gauss y N%C3%BAmeros triangulares%0A# (N * (N + 1)) / 2%0A# print(int((3 * (3 + 1)) / 2))%0A%0A# Listas comprimidas%0Aprint(%5B2 ** i for i in range(0, 10)%5D)%0A%0Afrase = %22Hola ... |
4b545d2e72080537672bb4ebb990708cad678344 | Debug Google Cloud Run support | entrypoint.py | entrypoint.py | #!/usr/bin/python3
#
# Define containerized environment for running Diosix on Qemu
#
# On Google Cloud Run: Creates HTTP server on port 8080
# or whatever was specified using the PORT system variable.
# Outputs via the HTTP port. This requires K_SERVICE to be set.
#
# On all other environments: Log to stdout
#
# syntax... | Python | 0 | @@ -571,25 +571,17 @@
-stream = os.popen
+os.system
('.
@@ -660,54 +660,8 @@
)))%0A
- output = stream.read()%0A output%0A
|
5cd3bd342b3259b0b10a5e4ff56f4e85e4bb209d | Fix patch_middleware_config context manager error handling: | Allura/allura/tests/decorators.py | Allura/allura/tests/decorators.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 (t... | Python | 0 | @@ -5227,36 +5227,16 @@
ake_app%0A
- return self%0A
%0A%0A@conte
|
63e0596561e3c9ed7c87ab24ffa6b29366ce2a8f | fix pep8 | myuw/dao/notice_mapping.py | myuw/dao/notice_mapping.py | """
This module provides utility the following functions:
1. categorize notices based on the dictionary defined
in notice_categorization.py;
2. apply show/hide on notices besed on their category and timing;
3. convert notice object into json format
"""
import logging
from datetime import datetime, timedelta
from myu... | Python | 0.000001 | @@ -3551,17 +3551,16 @@
ret = %7B
-
%22is_my_1
@@ -3590,17 +3590,16 @@
-
%22my_reg_
@@ -3616,28 +3616,16 @@
%22: False
-%0A
%7D%0A no
|
73143ebf17e7af6503da0136fdd8c3bdf0674f06 | fix address indexing of qld data | eheritage/injest/qld.py | eheritage/injest/qld.py | from lxml import etree
def parse_ahpi_xml(path):
"""
Parses the AHPI XML export format of the queensland heritage register
and calls a function with each heritage place.
:param path: The location of a heritage_places xml file.
"""
ns = {'hp': 'http://www.heritage.gov.au/ahpi/heritage_places'}
... | Python | 0 | @@ -716,16 +716,17 @@
esses%22:
+%5B
%7B%0A
@@ -1131,16 +1131,17 @@
%7D
+%5D
,%0A
|
6c3929806a19fbaac0c17887e697bba7ddeaa92d | create cache dir if it does not exist | micronota/commands/database.py | micronota/commands/database.py | # ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------------------------------... | Python | 0.000001 | @@ -1374,16 +1374,54 @@
are_db'%0A
+ makedirs(cache_dir, exist_ok=True)
%0A for
|
b31a13c457b045fa8f1e6a2f99f862fe1675926c | Fix broken tests | nodes/tests/test_models.py | nodes/tests/test_models.py | import sure
from mock import MagicMock
from django.test import TestCase
from django.contrib.auth.models import User
from projects.tests.factories import ProjectFactory
from ..exceptions import TaskAlreadyPerformed
from .. import models
from . import factories
from .base import WithKeysMixin
class ProjectKeysCase(With... | Python | 0.000555 | @@ -666,37 +666,23 @@
-factories.
Project
-Keys
Factory(
)%0A
@@ -669,32 +669,45 @@
ProjectFactory(
+run_here=True
)%0A models
@@ -2536,43 +2536,94 @@
-task = factories.NodeTaskFactory(**
+defaults = %7B%0A 'project__run_here': True,%0A %7D%0A defaults.update(
kwar
@... |
76f07a6e070959e137c1f9df2717da38d91abe15 | include font name in drops dir name | nototools/grab_download.py | nototools/grab_download.py | #!/usr/bin/python
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python | 0.000001 | @@ -1949,16 +1949,29 @@
'drops',
+ name + '_' +
date)%0A%0A
|
f4f5f91fac676b05f552f1a3d13e58dab63ec619 | Refresh an instance's maintenance mode status after en/dis-abling it | stackdriver/instance.py | stackdriver/instance.py | import datetime
class Maintenance(object):
__source = None
__instance = None
def __init__(self, source, instance):
self.__source = source
self.__instance = instance
@property
def is_enabled(self):
return self.__source['maintenance']
@property
def reason(self):
... | Python | 0 | @@ -673,24 +673,257 @@
eturn None%0A%0A
+ def _refresh(self):%0A endpoint = 'instances/%7Bid%7D/maintenance/'.format(id=self.__instance.id)%0A response = self.__instance._Instance__client.request(endpoint=endpoint)%0A%0A self.__source = response.json()%5B'data'%5D%0A%0A
def enab
@@ -946,32... |
bb531100350045ab9c9e0397d17dfb90a953261c | version bump | dynamic_rest/__init__.py | dynamic_rest/__init__.py | __version__ = "1.3.0"
| Python | 0.000001 | @@ -16,7 +16,7 @@
1.3.
-0
+1
%22%0A
|
07874ee51375b7597d79288e85acc68294d4b007 | customize the JSON dump for Event objects | oabutton/apps/web/views.py | oabutton/apps/web/views.py | from django.shortcuts import render_to_response
from django.conf import settings
from django.core.context_processors import csrf
from oabutton.common import SigninForm
def homepage(req):
# Need to lazy import the Event model so that tests work with
# mocks
c = {}
c.update(csrf(req))
from oabutton... | Python | 0 | @@ -161,16 +161,28 @@
ninForm%0A
+import json%0A
%0A%0Adef ho
@@ -410,19 +410,33 @@
-json_
data =
+ %5B%5D%0A%0A for evt in
Eve
@@ -455,17 +455,357 @@
ll()
-.to_json(
+:%0A data.append(%7B'doi': evt.doi, %0A 'coords': dict(evt.coords),%0A 'accessed': evt.accessed.strftime(%22... |
3e332088c25ce0515b68d17c6f38bd02756cc4a3 | add state executive branches too | openstates/jurisdiction.py | openstates/jurisdiction.py | from pupa.scrape import Jurisdiction, Organization
from openstates.base import OpenstatesBaseScraper
from openstates.people import OpenstatesPersonScraper
from openstates.events import OpenstatesEventScraper
from openstates.bills import OpenstatesBillScraper
POSTS = {
'ak': {'lower': range(1, 41), 'upper': (chr(n)... | Python | 0.000002 | @@ -2686,16 +2686,158 @@
islature
+%0A executive = Organization(metadata%5B'name'%5D + ' Executive Branch',%0A classification='executive')
%0A%0A
|
629f20c21aa0bdd7d28e3c0884e5c4a1e5f07893 | Add doseq to WFS request qyery urlencode | owslib/feature/__init__.py | owslib/feature/__init__.py | # =============================================================================
# OWSLib. Copyright (C) 2012 Jachym Cepicky
#
# Contact email: jachym.cepicky@gmail.com
#
# =============================================================================
from __future__ import (absolute_import, division, print_function)
f... | Python | 0 | @@ -6058,16 +6058,28 @@
(request
+, doseq=True
)%0A%0A
|
371ddf2c4beb79b82b1154abfa1efdd6bc5e379a | Change version to 0.5.dev | elasticutils/_version.py | elasticutils/_version.py | # follow pep-386
# Examples:
# * 0.3 - released version
# * 0.3a1 - alpha version
# * 0.3.dev - version in developmentv
__version__ = '0.4'
__releasedate__ = '20120731'
| Python | 0.000001 | @@ -140,9 +140,13 @@
'0.
-4
+5.dev
'%0A__
@@ -166,14 +166,6 @@
= '
-20120731
'%0A
|
fb71dbaa34f51df1125c9d8d9e6e41cdc0260b29 | Change default iterations | fuzz.py | fuzz.py |
from __future__ import print_function
import argparse,binascii,os,pprint,traceback,sys
from random import randrange
from dnslib import DNSRecord,DNSQuestion,QTYPE,DNSError
def fuzz_delete(b):
""" Delete byte """
f = b[:]
del f[randrange(len(b))]
return f
def fuzz_add(b):
""" Add byte """
f =... | Python | 0 | @@ -1196,25 +1196,19 @@
ault=100
+0
,%0A
-
@@ -1237,16 +1237,31 @@
erations
+ (default:1000)
%22)%0A a
|
fda7fa04943575c01f3c5d3d19bb07b9efddbcc8 | remove MIDI | game.py | game.py | __author__ = 'Florian Tautz'
import pygame
import pygame.midi
class Game:
def __init__(self):
pygame.init()
pygame.midi.init()
midi_port = pygame.midi.get_default_output_id()
self._midi = pygame.midi.Output(midi_port)
self._midi.set_instrument(56)
size = self._wid... | Python | 0.000085 | @@ -41,27 +41,8 @@
ame%0A
-import pygame.midi%0A
%0A%0Acl
@@ -100,180 +100,8 @@
it()
-%0A pygame.midi.init()%0A midi_port = pygame.midi.get_default_output_id()%0A self._midi = pygame.midi.Output(midi_port)%0A self._midi.set_instrument(56)
%0A%0A
@@ -1690,1179 +1690,28 @@
p()%0A
- ... |
ba6b5c50e5ea1875e117d72675fb58092325b193 | add moves: left, right and down | game.py | game.py | #using python2
import Tkinter
from visual import Visual
from relief import Relief
from figure import Figure
from random import randint
class Game:
def __init__(self):
self.root= Tkinter.Tk()
self.vis= Visual(self.root)
self.relief= Relief()
self.figure= None
self.root.after_idle(self.tick)
self.root.bin... | Python | 0.999992 | @@ -264,16 +264,56 @@
= None%0A%0A
+%09%09self.relief.extend(%5B(0,0), (0,3)%5D)%0A%09%09%0A
%09%09self.r
@@ -446,17 +446,17 @@
t.after(
-2
+3
00, self
@@ -789,13 +789,53 @@
)%0A%09%09
-%09%0A%09%09%09
+%0A%09%09self.redraw()%09%0A%09%09%09%0A%09%09%0A%09%0A%09def redraw(self):
%0A%09%09s
@@ -894,19 +894,11 @@
)... |
4aa248330d8fee41601b606db09bfe6f33547a63 | Create a function to check which keys are being pressed and notify the server | game.py | game.py | import pygame
from PodSixNet.Connection import ConnectionListener, connection
from time import sleep
from pygame.locals import *
#Create a new class to hold our game object
#This extends the connection listener so that we can pump the server for messages
class OnlineGame(ConnectionListener):
#Constructor
d... | Python | 0.000001 | @@ -1596,16 +1596,777 @@
player))
+%0A %0A #Create a function to tell the server what keys are being pressed%0A def check_keys(self):%0A%09%09%0A%09%09#Get the keys that are being pressed%0A%09%09keys = pygamne.keys.get_pressed()%0A%09%09%0A%09%09#Check which keys were pressed%0A%09%09if keys%5BK_UP%5D:%0... |
df3b57394b387021984ee4ea5d2c3835144d5e39 | Improve readability of class functions. | gate.py | gate.py | #!/usr/bin/env python3
from collections import namedtuple
import re
import xml.etree.ElementTree as ET
import skll
from collections import Counter
from pprint import pprint
class InputError(Exception):
pass
class Annotation:
def __init__(self, filename):
self.filename = filename
self.tree = ... | Python | 0.000001 | @@ -646,24 +646,29 @@
annotations(
+self,
%0A sel
@@ -664,30 +664,27 @@
-self,%0A
+
*,%0A
@@ -671,27 +671,48 @@
+
*,%0A
+
anno
@@ -725,24 +725,40 @@
_type=None,%0A
+
anno
@@ -772,21 +772,16 @@
set=None
-%0A ... |
95eeefa9b8cf7decd51265eaf624ff4551ac6a15 | add feature to create a new app from command line, remove commands that are not implemented | glim.py | glim.py | from termcolor import colored
from glim.app import start as appify
# glim with use of click
import click
@click.group()
def glim():
pass
@click.command()
@click.option('--host', default = '127.0.0.1', help = 'enter ip')
@click.option('--port', default = '8080', help = 'enter port')
@click.option('--env', default ... | Python | 0 | @@ -97,16 +97,47 @@
rt click
+%0Aimport shutil, errno%0Aimport os
%0A%0A@click
@@ -566,40 +566,16 @@
d()%0A
-@click.argument('name')%0A
def new(
name
@@ -574,129 +574,198 @@
new(
-name
):%0A
-print colored('Created new app %25s' %25 name, 'blue')%0A%0A@click.command()%0A@click.argument('name')%0Adef model(na... |
c1f7a7a54c8dd6afd36bb9758cb6053aaf65674a | Fix missing `super` call | home.py | home.py | # coding: utf-8
import os
import sys
import zipfile
import gdata.alt.appengine
import gdata.service
from google.appengine.api import users
from google.appengine.ext import blobstore
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp imp... | Python | 0.998949 | @@ -1107,32 +1107,70 @@
__init__(self):%0A
+ super(Page, self).__init__()%0A%0A
self.use
@@ -1194,25 +1194,24 @@
rent_user()%0A
-%0A
if s
@@ -1414,17 +1414,16 @@
= False%0A
-%0A
|
1d925809bd4b0329e137974382272c14d8021d53 | make doctype continuous migration include attachments | corehq/doctypemigrations/continuous_migrate.py | corehq/doctypemigrations/continuous_migrate.py | import datetime
from corehq.util.couch import IterDB
from dimagi.utils.couch.database import iter_docs
from dimagi.utils.chunked import chunked
import logging
def filter_doc_ids_by_doc_type(db, doc_ids, doc_types):
for doc_ids_chunk in chunked(doc_ids, 100):
keys = [[doc_type, doc_id]
for ... | Python | 0 | @@ -9,16 +9,86 @@
atetime%0A
+from corehq.doctypemigrations.bulk_migrate import _insert_attachments%0A
from cor
@@ -863,24 +863,78 @@
ents=True):%0A
+ doc = _insert_attachments(source_db, doc)%0A
|
fc7d83eda95aa20f0782644cd4076a51e60cc46d | Remove unused properties from models.isolate.Isolate. | dashboard/dashboard/pinpoint/models/isolate.py | dashboard/dashboard/pinpoint/models/isolate.py | # Copyright 2016 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.
"""Model for storing information to look up isolates.
An isolate is a way to describe the dependencies of a specific build.
More about isolates:
https://gi... | Python | 0 | @@ -1437,89 +1437,8 @@
te(%0A
- builder_name=builder_name,%0A change=change,%0A target=target,%0A
@@ -1468,16 +1468,16 @@
e_hash,%0A
+
@@ -1601,149 +1601,8 @@
l):%0A
- builder_name = ndb.StringProperty(required=True)%0A change = ndb.PickleProperty(required=True)%0A target = nd... |
fa3ac19213664f7281bc7b84ddf8734f6c58c57c | Changing output to be scraper specific | dat/RecipesScraper/RecipesScraper/pipelines.py | dat/RecipesScraper/RecipesScraper/pipelines.py | # -*- coding: utf-8 -*-
from scrapy.exporters import JsonItemExporter
class JsonPipeline(object):
"""Save Pipeline output to JSON."""
def __init__(self):
self.file = open("recipes.json", 'wb')
self.exporter = JsonItemExporter(self.file, encoding='utf-8', ensure_ascii=False)
self.export... | Python | 0.999615 | @@ -46,24 +46,29 @@
import Json
+Lines
ItemExporter
@@ -68,16 +68,16 @@
xporter%0A
-
%0A%0Aclass
@@ -159,16 +159,29 @@
t__(self
+, spider_name
):%0A
@@ -201,16 +201,26 @@
= open(%22
+output/%7B%7D_
recipes.
@@ -224,16 +224,36 @@
es.json%22
+.format(spider_name)
, 'wb')%0A
@@ -280,16 +280,21 @@
r = Jso... |
85671daee9fb1ed1b9f096aa364d05da8fe55b8e | Add clipboard support | iotp.py | iotp.py | #!/usr/bin/env python
# Import system libraries
import base64
import json
import os
# Import PyPi libraries
from appdirs import AppDirs
import click
import pyotp
# Set app information
appname = 'iotp'
appauthor = 'Dan Mills'
appversion = '0.0.1'
# Setup appdirs
dirs = AppDirs(appname, appauthor)
keyFile = os.path.j... | Python | 0.000001 | @@ -156,16 +156,33 @@
rt pyotp
+%0Aimport pyperclip
%0A%0A# Set
@@ -1359,16 +1359,60 @@
se)%0A
+@click.option('--copy', '-c', is_flag=True)%0A
def get(
serv
@@ -1407,16 +1407,22 @@
def get(
+copy,
service=
@@ -1914,16 +1914,74 @@
totp))%0A
+ if copy:%0A pyperclip.copy(totp)%0A
... |
4a25286506cc8e50b5e1225b12015f4d0da3ccfc | Put api token auth endpoint under v1. | smbackend/urls.py | smbackend/urls.py | from django.conf.urls import patterns, include, url
from services.api import all_views as services_views
from services.api import AccessibilityRuleView
from observations.api import views as observations_views
from rest_framework import routers
from observations.views import obtain_auth_token
from munigeo.api import all... | Python | 0 | @@ -1159,16 +1159,19 @@
url(r'%5E
+v1/
api-toke
|
94764b8daed7ef6df8ac47462013b08d30de7e8f | refactor for less ugliness, resolves #7 | source/display.py | source/display.py | class Display():
def __init__(self):
self.start = "Welcome"
self.draw = "Draw"
self.computer = "Computer Wins"
self.human = "You Win"
self.next_move = "What is your next move?"
self.bad_move = "That is not a legal move."
def show(self, text):
print t... | Python | 0.000001 | @@ -864,93 +864,530 @@
-board_size = self.get_board_size(board)%0A rack = self.construct_rack(board_size
+rack = self.construct_rack(board)%0A rows = self.construct_rows(board)%0A constructed_board = '%5Cn' + rack.join(rows) + '%5Cn'%0A return constructed_board%0A%0A def construct_r... |
a89dee8f9b20479cc3d6e82ae730628440f335cc | Add fibt2 and qm stats | src/collectors/xfs/xfs.py | src/collectors/xfs/xfs.py | # coding=utf-8
"""
The XFSCollector collects XFS metrics using /proc/fs/xfs/stat.
#### Dependencies
* /proc/fs/xfs/stat
"""
import diamond.collector
import sys
class XFSCollector(diamond.collector.Collector):
PROC = '/proc/fs/xfs/stat'
def get_default_config_help(self):
config_help = super(XFS... | Python | 0.000001 | @@ -5841,32 +5841,566 @@
%0A ),%0A
+ 'fibt2': (%0A 'lookup',%0A 'compare',%0A 'insrec',%0A 'delrec',%0A 'newroot',%0A 'killroot',%0A 'increment',%0A 'decrement',%0A ... |
c0fc71d8197580e1c517c20f619de5f4c3185922 | move pointer generation to the exceptions & serializer | drfjsonapi/renderers.py | drfjsonapi/renderers.py | """
drfjsonapi.renderers
~~~~~~~~~~~~~~~~~~~~~
DRF renderer that is compliant with the JSON API spec
"""
from collections import OrderedDict
from rest_framework.renderers import JSONRenderer
class JsonApiRenderer(JSONRenderer):
""" JSON API compliant DRF renderer
Inherit from the DRF JSONRender... | Python | 0 | @@ -941,465 +941,8 @@
%22%22%0A%0A
- for error in data%5B'errors'%5D:%0A pointer = error%5B'source'%5D.get('pointer', None)%0A%0A if error%5B'code'%5D == 'FieldError':%0A error%5B'source'%5D%5B'pointer'%5D = '/data/attributes%25s' %25 pointer%0A elif error%5B'code... |
b6b99dff989fb6662f795a95895e070424f59822 | Add test for login button instead of edit buttons if not logged | candidates/tests/test_person_view.py | candidates/tests/test_person_view.py | # Smoke tests for viewing a candidate's page
from __future__ import unicode_literals
import re
from django.test.utils import override_settings
from django_webtest import WebTest
from .dates import processors_before, processors_after
from .factories import (
CandidacyExtraFactory, PersonExtraFactory
)
from .uk_e... | Python | 0 | @@ -1,50 +1,4 @@
-# Smoke tests for viewing a candidate's page%0A%0A
from
@@ -1999,8 +1999,330 @@
e, 404)%0A
+%0A def test_shows_no_edit_buttons_if_user_not_authenticated(self):%0A response = self.app.get('/person/2009/tessa-jowell')%0A edit_buttons = response.html.find_all('a', attrs=%7B'class': 'bu... |
33e15e1afae139c3b55dea8f648c1913ea7d89ad | Correct package level for ACEFTS | pyatmlab/datasets/acefts.py | pyatmlab/datasets/acefts.py |
import datetime
import itertools
import collections
import logging
import numpy
from . import dataset
from . import constants
class ACEFTS(dataset.SingleMeasurementPerFileDataset,
dataset.ProfileDataset):
"""SCISAT Atmospheric Chemistry Experiment FTS
"""
# basedir = "/home/gerrit/sshfs/gla... | Python | 0.000001 | @@ -78,24 +78,25 @@
umpy%0A%0Afrom .
+.
import data
@@ -105,16 +105,17 @@
t%0Afrom .
+.
import
|
45c17681bfdfc374e94b086f9cdda4f314be5045 | Add entries and preamble arguments to BibliographyData.__init__(). | pybtex/database/__init__.py | pybtex/database/__init__.py | # Copyright (C) 2006, 2007, 2008, 2009 Andrey Golovizin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This pr... | Python | 0 | @@ -836,24 +836,53 @@
_init__(self
+, entries=None, preamble=None
):%0A s
@@ -925,16 +925,141 @@
ble = %5B%5D
+%0A if entries:%0A self.entries.update(entries)%0A if preamble:%0A self.preamble.extend(preamble)
%0A%0A de
|
5ed01ff0ab0967e8c200e2f891a921cfe617d218 | Add option to allow rigid registration without scaling | pycpd/rigid_registration.py | pycpd/rigid_registration.py | from builtins import super
import numpy as np
import numbers
from .emregistration import EMRegistration
from .utility import is_positive_semi_definite
class RigidRegistration(EMRegistration):
"""
Rigid registration.
Attributes
----------
R: numpy array (semi-positive definite)
DxD rotatio... | Python | 0 | @@ -1079,16 +1079,28 @@
s=None,
+ scale=True,
*args,
@@ -1110,16 +1110,16 @@
wargs):%0A
-
@@ -2281,16 +2281,43 @@
e else s
+%0A self.scale = scale
%0A%0A de
@@ -3521,32 +3521,67 @@
/0905.2635.pdf.%0A
+ if self.scale is True:%0A
self.s =
@@ -3622,41 +3622,8 @@
.A),
-%0A ... |
296d3eff909377dcd1d4d334a843c03b00cb1bbe | add logdir to saver | examples/denoise_class/stages.py | examples/denoise_class/stages.py | import tensorflow as tf
import numpy as np
import os
from datetime import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from flowfairy.core.stage import register, Stage
from flowfairy.conf import settings
@register(500)
class SummaryStage(Stage):
def fig2rgb_array(self, expand=... | Python | 0 | @@ -236,16 +236,76 @@
ttings%0A%0A
+log_dir = os.path.join(settings.LOG_DIR, settings.LOGNAME)%0A%0A
@registe
|
581b49ad98616b7450c12be1d86960e8f38df9ac | Update lca_calculations.py | cea/optimization/lca_calculations.py | cea/optimization/lca_calculations.py | # -*- coding: utf-8 -*-
"""
This file imports the price details from the cost database as a class. This helps in preventing multiple importing
of the corresponding values in individual files.
"""
from __future__ import division
import warnings
import pandas as pd
warnings.filterwarnings("ignore")
__author__ = "Sree... | Python | 0.000001 | @@ -910,75 +910,8 @@
O2'%5D
-%0A self.NG_TO_OIL_EQ = resources_lca.loc%5B'NATURALGAS'%5D%5B'PEN'%5D
%0A%0A
@@ -1007,83 +1007,8 @@
O2'%5D
-%0A self.DRYBIOMASS_TO_OIL_EQ = resources_lca.loc%5B'DRYBIOMASS'%5D%5B'PEN'%5D
%0A%0A
@@ -1104,83 +1104,8 @@
O2'%5D
-%0A self.WETBIOMASS_TO_OIL_EQ = res... |
7d69bcc6474d954b311251bf077750e0418170cb | Fix typo and execute JS script found in local folder. | button.py | button.py | import RPi.GPIO as GPIO
import time
import os
from optparse import OptionParser
# Parse input arguments
parser = OptionParser()
parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.")
# The option --pin sets the Input Pin for your Button
# It default to G... | Python | 0 | @@ -1070,17 +1070,16 @@
uttonPin
-g
+ %22 wor
@@ -1180,40 +1180,8 @@
ode
-/home/pi/guest-password-printer/
inde
|
194c34f0ce3a2decff8401494e57b904032a52a8 | update local parser | log_parser/local_log_parser.py | log_parser/local_log_parser.py | #!/usr/bin/env python
######################################################
# -*- coding: utf-8 -*-
# File Name: local_log_parser.py
# Author: James Hong & Qian Li
# Created Date: 2017-10-28
# Description: Parse local logs
######################################################
import argparse
import json
import os
im... | Python | 0.000001 | @@ -854,16 +854,39 @@
das = 0%0A
+ self.totalLogs = 0%0A
self
@@ -1139,16 +1139,31 @@
bda
+logs out of %25d
logs' %25
self
@@ -1158,16 +1158,17 @@
logs' %25
+(
self.num
@@ -1174,16 +1174,86 @@
mLambdas
+, %0A self.totalLogs)
%0A for
@@ -2499,16 +... |
b4ea95dc2dc1591e96d22b5058cef440416477e0 | Bump version to 0.10.0b (#740) | stellargraph/version.py | stellargraph/version.py | # -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... | Python | 0 | @@ -650,9 +650,10 @@
%220.
-9
+10
.0b%22
|
f6e51b386fcbb608b5cc0d1c7a95df1494c8cc9b | fix for running unit tests in py versions < 3 | stomp/test/testutils.py | stomp/test/testutils.py | import os
import socket
import sys
import threading
import logging
log = logging.getLogger('testutils.py')
from configparser import ConfigParser
from stomp import ConnectionListener, StatsListener, WaitingListener
from stomp.backward import *
config = ConfigParser()
config.read(os.path.join(os.path.dirname(__file_... | Python | 0 | @@ -7,33 +7,8 @@
os%0A
-import socket%0Aimport sys%0A
impo
@@ -76,16 +76,25 @@
s.py')%0A%0A
+try:%0A
from con
@@ -127,47 +127,89 @@
ser%0A
-%0A%0Afrom stomp import ConnectionListener,
+except ImportError:%0A from ConfigParser import ConfigParser%0A%0A%0Afrom stomp import
Sta
|
221e45828b9cc33d9ae02d08d94dfaa89977d3e7 | update import_reading for Courtney | vehicles/management/commands/import_reading.py | vehicles/management/commands/import_reading.py | from ciso8601 import parse_datetime
from django.utils.timezone import make_aware
from django.contrib.gis.geos import Point
from busstops.models import Service
from ...models import VehicleLocation, VehicleJourney
from ..import_live_vehicles import ImportLiveVehiclesCommand
class Command(ImportLiveVehiclesCommand):
... | Python | 0 | @@ -489,16 +489,24 @@
, 'THVB'
+, 'CTNY'
), curre
@@ -743,16 +743,51 @@
f.source
+,%0A 'operator_id': 'RBUS'
%0A
@@ -959,15 +959,29 @@
r_id
-='RBUS'
+__in=('RBUS', 'CTNY')
,%0A
|
08b3c7fb0577ed38dea3f427ffcc8ebc1faf2ca0 | Update config.py | src/dogecoinrpc/config.py | src/dogecoinrpc/config.py | # Copyright (c) 2010 Witchspace <witchspace81@gmail.com>
#
# 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, copy, modify,... | Python | 0 | @@ -2341,11 +2341,12 @@
ort/
-Bit
+Doge
coin
|
63c8f8702e042d9cb3358ba96bf453e6971ad0b2 | update basemap for changes in error map from seqspace | epistasis/models/base.py | epistasis/models/base.py | __doc__ = """
Base class for epistasis models. This is meant to be called in a subclass.
"""
import numpy as np
import itertools as it
from collections import OrderedDict
# imports from seqspace dependency
from seqspace.utils import farthest_genotype, binary_mutations_map
# Local imports
from epistasis.utils import e... | Python | 0 | @@ -2367,16 +2367,20 @@
gpm.
+Raw.
phenotyp
@@ -2376,32 +2376,77 @@
aw.phenotypes, %0A
+ errors = gpm.Raw.errors,%0A
@@ -2515,146 +2515,26 @@
rm=
-False,%0A **kwargs)%0A %0A # Set errors outside init to handle log transform%0A model._... |
13489726a9b3f9ce9dcd2ff9c3086279db7704fe | increment build id | esp32/modules/version.py | esp32/modules/version.py | build = 7
name = "Maffe Maniak"
| Python | 0.000001 | @@ -5,9 +5,9 @@
d =
-7
+8
%0Anam
|
e4c4d78b5f6df13b5dc59114ce78db9725caaa1a | Use email.message.Message.get_content_charset (which I just discovered) instead of own implementation | mailshareapp/process_emails.py | mailshareapp/process_emails.py | # License: https://github.com/RobFisher/mailshare/blob/master/LICENSE
import email
import datetime
import warnings
import poll_imap_email
from mailshare.mailshareapp.models import Mail, Addressee
def get_charset(message):
"""
Gets the charset from the Content-Type header from the specified email.message.Messa... | Python | 0 | @@ -195,542 +195,8 @@
ee%0A%0A
-def get_charset(message):%0A %22%22%22%0A Gets the charset from the Content-Type header from the specified email.message.Message%0A object. This class has the method get_charset but this returns None.%0A %22%22%22%0A result = None%0A t = message.get('Content-Type')%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.