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 |
|---|---|---|---|---|---|---|---|
c3f6b4ddf56b8844f2ddf91c566e233270c42f74 | Add `SampleArtifactCache` and `SampleReadsFileCache` SQL models | virtool/samples/models.py | virtool/samples/models.py | from sqlalchemy import Column, DateTime, Enum, Integer, String
from virtool.pg.utils import Base, SQLEnum
class ArtifactType(str, SQLEnum):
"""
Enumerated type for possible artifact types
"""
sam = "sam"
bam = "bam"
fasta = "fasta"
fastq = "fastq"
csv = "csv"
tsv = "tsv"
jso... | Python | 0 | @@ -385,16 +385,18 @@
o store
+a
sample a
@@ -402,17 +402,16 @@
artifact
-s
%0A%0A %22%22
@@ -448,17 +448,16 @@
artifact
-s
%22%0A%0A i
@@ -731,16 +731,272 @@
eTime)%0A%0A
+ def __repr__(self):%0A return f%22%3CSampleArtifact(id=%7Bself.id%7D, sample=%7Bself.sample%7D, name=%7Bself.name%7D, %22... |
797e0429aac49f47e737d8a7ba9b0cde7b7d302d | methods are sorted according to these rules: 1. constructor: __init__ 2. overrid methods in alphabetical order: __[method name]__ 3. other methods in alphabetical order: [method name] | geopar/tfvalidator.py | geopar/tfvalidator.py | from collections import Counter
__author__ = 'satbek'
class TFValidator(object):
"""
Triangulated Figure Validator: a triangulated figure is valid when it passes
all of the following three rules (see the paper):
1 - Rule of 180 degrees
2 - Rule of 360 degrees
3 - Rule of pairing
"""
... | Python | 0.99989 | @@ -305,24 +305,176 @@
ng%0A %22%22%22%0A%0A
+ @staticmethod%0A def all_rules(a_tf):%0A return TFValidator.rule_180(a_tf) and TFValidator.rule_360(a_tf) and TFValidator.rule_pairing(a_tf)%0A%0A
@staticm
@@ -4861,155 +4861,4 @@
ue%0A%0A
- @staticmethod%0A def all_rules(a_tf):%0A retur... |
071aa92d01a8564f98b80851cf7cf522bb22c10f | make redis module optional | biothings/utils/redis.py | biothings/utils/redis.py | import redis
import random
import logging
class RedisClientError(Exception): pass
class RedisClient(object):
client = None
@classmethod
def get_client(klass,params):
if klass.client is None:
klass.client = klass(params)
return klass.client
def __init__(self,connection_p... | Python | 0 | @@ -5,21 +5,8 @@
rt r
-edis%0Aimport r
ando
@@ -21,16 +21,131 @@
logging
+%0A%0Atry:%0A import redis%0Aexcept ImportError:%0A logging.error('%22redis%22 module is required to access Redis server.')
%0A%0A%0Aclass
@@ -2611,17 +2611,16 @@
cated to
-
%0A
|
97faea1f3404e4db023bec6b569e127395fec6d6 | Add missing method on BaseExtractor | caso/extract/base.py | caso/extract/base.py | # -*- coding: utf-8 -*-
# Copyright 2014 Spanish National Research Council (CSIC)
#
# 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
#
# Unle... | Python | 0 | @@ -3224,8 +3224,465 @@
known')%0A
+%0A @abc.abstractmethod%0A def extract_for_tenant(self, tenant, extract_from):%0A %22%22%22Extract records for a tenant from given date.%0A%0A :param tenant: Tenant to extract records for.%0A :param extract_from: datetime.datetime object indicating the dat... |
474e79bfd64aeeb4e0ef0f24b614f3d19a72120e | Fix doctests | trees/heap.py | trees/heap.py | """
Convenience wrapper for the functional heapq library.
"""
import heapq
# TODO: add a __contains__ method
class heap(object):
'''A tree-based data structure that satisfies the heap property.
A heap can be used as priority queue by pushing tuples onto the heap.
>>> import trees
>>> h = trees.heap(... | Python | 0.000004 | @@ -312,16 +312,21 @@
ees.heap
+.heap
()%0A %3E
|
b0c23d45223bf3745af63cdce341a65c9096614b | add thumbnail path to image | app/models.py | app/models.py | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import db, login_manager
class Employees(UserMixin, db.Model):
"""
Create an Employee table
"""
# Ensures table will be named in plural and not in singular
# as is the name of the... | Python | 0.000001 | @@ -3730,24 +3730,68 @@
ring(2048))%0A
+ thumb_path = db.Column(db.String(2048))%0A
item = d
|
5a01b1ff2ea0d2c33f65700e0018548373c163d8 | fix merge error. | src/currency_rates.py | src/currency_rates.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json, re, urllib2, utils, logging
import webapp2
from google.appengine.api import memcache, urlfetch
NOT_SUPPORTED_RATE = -1
class GoogleCurrencyRateRequest():
def get_rate(self, from_currency, to_currency):
rate = None
url = u'https://www.goog... | Python | 0 | @@ -1123,16 +1123,91 @@
gnore')%0A
+ response_str = response_str.replace(r'%5Cx22', r'%5C%5C%22') # fix issue 9%0A
|
00d9483d405972352786b164881031a2b11cb5e4 | Fix previous commit. | get-long-functions.py | get-long-functions.py | #!/usr/bin/env python
import os.path
import json
import glob
def get_long(json_files):
threshold = 100
longfun = {}
for path in json_files:
print "Reading {}".format(path)
with open(path) as f:
doc = json.load(f)
for func in doc:
length = func['line_end'] - f... | Python | 0 | @@ -852,40 +852,142 @@
-if line_start %3E 0:
+# NOTE: line numbers start at 1, so line 2 is actually 1, prev being 0.
%0A
- prev_
+line_prev = line_start - 2%0A if line_prev %3E= 0:%0A
line
@@ -1004,17 +1004,12 @@
ine_
-start - 1
+prev
%5D%0A
@@ -1065,13 +1065,8 @@
in
-prev_
line
|
96aa7f039511173f89ac90102cbfffda011fecf1 | remove import of obsolete modules | gffutils/gffwriter.py | gffutils/gffwriter.py | ##
## GFF Writer (writer): serializing gffutils records as GFF text files.
##
## Dear Sir or Madam, will you read my code?
## It took me years to write, will you take a look?
## It's based on code by a man named Daler
## And I need a job, so I want to be a GFF Writer, GFF Writer.
##
import os
import sys
import ... | Python | 0.000001 | @@ -389,48 +389,8 @@
ime%0A
-from gfffeature import GFFFile, Feature%0A
%0A%0Acl
|
ba75e76df78b2b09f8b94584360187b719a39b19 | Fix init value | project_euler/021.amicable_numbers.py | project_euler/021.amicable_numbers.py | '''
Problem 021
Let d(n) be defined as the sum of proper divisors of n (numbers less than n
which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, ... | Python | 0.000044 | @@ -672,14 +672,16 @@
def
+_
_init_
+_
(sel
|
d89bfe29cec647b48adffdafc7237aee53803367 | Delete extra whitespace | caterblu/settings.py | caterblu/settings.py | """
Django settings for gettingstarted project, on Heroku. Fore more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/s... | Python | 0.999664 | @@ -3849,17 +3849,16 @@
S_ONLY =
-
%5B('US',
|
8ba35ff373fea95278034a3d50d0dc95db5c6e20 | test properties app name modified | buildbuild/properties/tests/test_available_language.py | buildbuild/properties/tests/test_available_language.py | from properties.models import Language
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
class TestLanguage(TestCase):
fixtures = ['properties_data.yaml']
def setUp(self):
pass
def test_get_all_available_language(self):
self.assertIsNotNone(Language.obj... | Python | 0.000001 | @@ -23,16 +23,25 @@
import
+Available
Language
|
d1ee62cb55af8b157a6a31d9be9967196062254b | clean gpaths | ibeis/algo/preproc/preproc_image.py | ibeis/algo/preproc/preproc_image.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from os.path import splitext, basename
import warnings # NOQA
import vtool.exif as vtexif
import utool as ut
#import numpy as np # NOQA
#import hashlib
#import uuid
(print, rrr, profile) = ut.inject2(_... | Python | 0 | @@ -2784,35 +2784,8 @@
s):%0A
- ut.embed()%0A
|
5717e7300c1cc4a17f0fb0659dcf591fbd0a6e40 | Make it possible to pass custom environment variables into wsgi apps. | netlib/wsgi.py | netlib/wsgi.py | import cStringIO, urllib, time, traceback
import odict
class ClientConn:
def __init__(self, address):
self.address = address
class Request:
def __init__(self, client_conn, scheme, method, path, headers, content):
self.scheme, self.method, self.path = scheme, method, path
self.headers... | Python | 0 | @@ -1122,19 +1122,28 @@
, errsoc
+, **extra
):%0A
-
@@ -2309,16 +2309,46 @@
%7D%0A
+ environ.update(extra)%0A
@@ -3357,16 +3357,23 @@
est, soc
+, **env
):%0A
@@ -4602,32 +4602,32 @@
()%0A try:%0A
-
data
@@ -4673,16 +4673,23 @@
st, errs
+, **env
), start
|
f297d221492321ba3719e8f2244f6379f3743183 | Support mengzi PLMs | hanlp/layers/transformers/pt_imports.py | hanlp/layers/transformers/pt_imports.py | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-05-09 11:25
import os
import warnings
from hanlp.layers.transformers.resource import get_tokenizer_mirror, get_model_mirror
if os.environ.get('USE_TF', None) is None:
os.environ["USE_TF"] = 'NO' # saves time loading transformers
if os.environ.get('TOKENIZERS_P... | Python | 0 | @@ -2905,16 +2905,140 @@
'basic'%0A
+ elif transformer == %22Langboat/mengzi-bert-base%22:%0A cls = BertTokenizerFast if use_fast else BertTokenizer%0A
|
9f3cdd657a6fb1916cb82a0423f3da7d2738bf49 | change api name | googlefinance/__init__.py | googlefinance/__init__.py | '''
MIT License
'''
from urllib2 import Request, urlopen
import json
import sys
__author__ = 'hongtaocai@gmail.com'
googleFinanceKeyToFullName = {
u'id' : u'ID',
u't' : u'StockSymbol',
u'e' : u'Index',
u'l' : u'LastTradePrice',
u'l_cur' : u'LastTradeWithCurrency',
u'ltt' ... | Python | 0.000001 | @@ -1248,24 +1248,16 @@
%0Adef get
-Realtime
Quotes(s
@@ -1617,16 +1617,17 @@
me quote
+s
%0A '''
@@ -1888,16 +1888,8 @@
(get
-Realtime
Quot
|
0789b9afc84757b7cef1d4cf6d433e90c7cb78d3 | Make stream return headers immediately | st2api/st2api/controllers/v1/stream.py | st2api/st2api/controllers/v1/stream.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 | @@ -1075,16 +1075,131 @@
t(gen):%0A
+ # Yield initial state so client would receive the headers the moment it connects to the stream%0A yield '%5Cn'%0A%0A
mess
|
4f3b3a9e3469f18902ec1f1ed93020869b1bfcdb | Use the logger the same way as other platforms | homeassistant/components/switch/wemo.py | homeassistant/components/switch/wemo.py | """
homeassistant.components.switch.wemo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for WeMo switches.
"""
import logging
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import STATE_ON, STATE_OFF, STATE_STANDBY
REQUIREMENTS = ['pywemo==0.3.1']
# pylint: disable=unused-argument
... | Python | 0.000005 | @@ -71,17 +71,16 @@
~~~~~~~%0A
-%0A
Support
@@ -97,16 +97,147 @@
witches.
+%0A%0AFor more details about this component, please refer to the documentation at%0Ahttps://home-assistant.io/components/switch.wemo.html
%0A%22%22%22%0Aimp
@@ -374,16 +374,16 @@
TANDBY%0A%0A
-
REQUIREM
@@ -407,16 +407,54 @@
0.3.1'%5D%0A... |
16cf2252e8d2d723cab6dabc5f6338a17be61572 | Fix merge conflict | botbot/report.py | botbot/report.py | """Generate a report about file errors"""
import os
import sys
import math
from pkg_resources import resource_exists, resource_filename
from jinja2 import Environment, FileSystemLoader
from . import problems
_DEFAULT_RES_PATH = os.path.join('resources', 'templates')
_GENERIC_REPORT_NAME = 'generic.txt'
_ENV_REPORT_... | Python | 0.000013 | @@ -1946,23 +1946,14 @@
if
-len(
values
-) %3E 0
:%0A
@@ -2749,24 +2749,42 @@
anspired.%22%22%22
+%0A%0A # Remove
%0A pri
|
4f25b2ca08dbdc7a28ef6cba74a654d37b337366 | Support device and state classes for WAQI sensor (#57762) | homeassistant/components/waqi/sensor.py | homeassistant/components/waqi/sensor.py | """Support for the World Air Quality Index service."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
import voluptuous as vol
from waqiasync import WaqiClient
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_TEMPERA... | Python | 0 | @@ -227,16 +227,41 @@
r import
+ STATE_CLASS_MEASUREMENT,
SensorE
@@ -266,16 +266,16 @@
rEntity%0A
-
from hom
@@ -375,16 +375,38 @@
_TOKEN,%0A
+ DEVICE_CLASS_AQI,%0A
)%0Afrom h
@@ -1219,16 +1219,59 @@
oject%22%0A%0A
+ATTR_ICON = %22mdi:cloud%22%0AATTR_UNIT = %22AQI%22%0A%0A
CONF_LOC
@@ -2903,24 +2903,191 @@... |
db20fc6b7a21efbd7de0f5b0d1aa754c19c1a21f | Remove all scores before populating the sorted set. | race/management/commands/update_leaderboard.py | race/management/commands/update_leaderboard.py | from django.core.management.base import BaseCommand
from django.conf import settings
from ...models import OverallDriverPrediction, OverallConstructorPrediction
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **kwargs):
conn = settings.REDIS_CONN
num_ranks = con... | Python | 0 | @@ -381,16 +381,20 @@
um_ranks
+ + 1
)%0A
|
64a0ea1f8546cc9de691f6b80ba3f61c59c59245 | logger is global | brewery/utils.py | brewery/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Brewery handy utilities"""
import re
import logging
logger_name = 'brewery'
logger = None
def get_logger():
"""Get brewery default logger"""
if logger:
return logger
else:
return create_logger()
def create_logger():
"""Create ... | Python | 0.999759 | @@ -187,24 +187,47 @@
t logger%22%22%22%0A
+ global logger%0A %0A
if logge
@@ -352,24 +352,42 @@
t logger%22%22%22%0A
+ global logger%0A
logger =
|
a3dd14cb588f9d51de9caf930fce49438a2bab90 | improve file handling | hcinsights/commandline.py | hcinsights/commandline.py | # -*- coding: utf-8 -*-
import json
import optparse
import os.path
import sys
import unicodecsv
from hcinsights.uploader import InsightsUploader
from importers import db
def get_credentials(optionparser):
username = os.environ.get('SFDC_USERNAME')
if not username:
optionparser.error('SFDC_USERNAME,... | Python | 0.000002 | @@ -18,16 +18,30 @@
-8 -*-%0A%0A
+import codecs%0A
import j
@@ -986,40 +986,246 @@
ge)%0A
-%0A opts, args = op.parse_args(
+ op.add_option('-o', '--output', metavar='FILENAME',%0A help='output data to FILENAME', default=sys.stdout)%0A%0A opts, args = op.parse_args()%0A%0A if opts.output ... |
ed21d3366304809e427355b7a25aef590d200f31 | Add compliance with rule E261 to summarize_stream.py. | bots/summarize_stream.py | bots/summarize_stream.py | from __future__ import print_function
from typing import Any, Dict, List
# This is hacky code to analyze data on our support stream. The main
# reusable bits are get_recent_messages and get_words.
import zulip
import re
import collections
def get_recent_messages(client, narrow_str, count=100):
# type: (zulip.Cli... | Python | 0 | @@ -1967,16 +1967,17 @@
ct(list)
+
# type:
@@ -2140,32 +2140,33 @@
defaultdict(int)
+
# type: Dict%5Bst
@@ -2219,16 +2219,17 @@
ict(int)
+
# type:
|
0f0e0e91db679f18ad9dc7568047b76e447ac589 | Change of the module version | stock_inventory_chatter/__openerp__.py | stock_inventory_chatter/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Stock Inventory Chatter',
'version': '9.0.1.0.0',
'author': "Eficent, "
"Odoo Community Assoc... | Python | 0 | @@ -83,16 +83,45 @@
es S.L.%0A
+# Copyright 2018 initOS GmbH%0A
# (htt
@@ -273,9 +273,9 @@
': '
-9
+8
.0.1
@@ -307,16 +307,46 @@
cent, %22%0A
+ %22initOS GmbH, %22%0A
|
f1dedaab47739cff61bc56e934c2a3be9dfbac5c | Version bump | bottle_utils/__init__.py | bottle_utils/__init__.py | __version__ = '0.2'
__author__ = 'Outernet Inc <hello@outernet.is>'
| Python | 0.000001 | @@ -14,9 +14,9 @@
'0.
-2
+3
'%0A__
|
011893804a43a298d74aa1c8b21e3c8070a21292 | Improve cli help | storage_s3/indico_storage_s3/plugin.py | storage_s3/indico_storage_s3/plugin.py | # This file is part of Indico.
# Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | Python | 0 | @@ -1845,16 +1845,32 @@
lt=None,
+ metavar='NAME',
help='S
@@ -1876,16 +1876,24 @@
Storage
+backend
to creat
@@ -1971,22 +1971,31 @@
eate s3
+storage
bucket
+.
%22%22%22%0A
|
8870d8f03be402e62d6e708bc00c2ffffcf8fe7e | early abort if unauthorized | boxoffice/views/utils.py | boxoffice/views/utils.py | from pytz import utc, timezone
from flask import request, abort
from functools import wraps
from boxoffice import app
from urlparse import urlparse, urlunsplit
def xhr_only(f):
"""
Aborts if a request does not have the XMLHttpRequest header set
"""
@wraps(f)
def wrapper(*args, **kwargs):
i... | Python | 0.998573 | @@ -948,289 +948,27 @@
resp
-):%0A if not request.referrer:%0A abort(401)%0A parsed_result = urlparse(request.referrer)%0A referrer_base_url = urlunsplit((parsed_result.scheme, parsed_result.netloc, '', '', ''))%0A%0A if referrer_base_url in app.config%5B'ALLOWED_ORIGINS'%5D:%0A ... |
31f2a200a69ecb7e602b37b353fce86805d0ecea | add missing field | immo/models/models/advertisement.py | immo/models/models/advertisement.py | # -*- coding: utf-8 -*-
"""
"""
import json
from datetime import date
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Float, Date, ForeignKey
from .utils import get_int, get_float, get_date
from sqlalchemy.orm import relationship
from . import Municipality, Object... | Python | 0.000004 | @@ -2112,16 +2112,51 @@
(String)
+%0A quality_label = Column(String)
%0A%0A #
@@ -3106,16 +3106,77 @@
', None)
+%0A self.quality_label = data.get('quality_label', None)
%0A%0A
|
137904809733720d24f8715545652820c0a93cd6 | change tag to type for all records | scripts/csv_to_json_file_tag.py | scripts/csv_to_json_file_tag.py | #!/usr/bin/env python
import sys
import csv
import json
import re
if len(sys.argv) != 3:
print 'Incorrect number of arguments.'
print 'Usage: csv_to_json.py path_to_csv path_to_json'
exit()
print 'Argument List:', str(sys.argv)
csvFileName = sys.argv[1]
jsonFileArray = sys.argv[2].split(".")
csvFile = open (cs... | Python | 0 | @@ -920,18 +920,19 @@
row%5B't
-ag
+ype
'%5D = fil
@@ -1282,17 +1282,17 @@
ge(0,179
-0
+2
):%0A jso
|
9573f90c2ae0e3b83d093b41980e000c7db6c829 | Fix code quality | sympy/benchmarks/bench_discrete_log.py | sympy/benchmarks/bench_discrete_log.py | from __future__ import print_function, division
import sys
from time import time
from sympy.ntheory.residue_ntheory import (discrete_log,
_discrete_log_trial_mul, _discrete_log_shanks_steps,
_discrete_log_pollard_rho, _discrete_log_pohlig_hellman)
# Cyclic group (Z/pZ)* with p prime, order p - 1 and... | Python | 0.000066 | @@ -2516,9 +2516,8 @@
, algo)%0A
-%0A
|
fb4eb90b0e9dd7f04e36c44e4169be9d2cd4fcbb | print when pattern not found | lights/lights.py | lights/lights.py | """
Lights Client
Responsible for setting the pattern of lights from the data file
"""
import neopixel
import board
import time
import threading
import sys
import inspect
import importlib
from patterns.pattern import Pattern
from config import Config
from state import State
patterns = [
'patterns.blink',
'pa... | Python | 0.000015 | @@ -924,16 +924,81 @@
, state)
+%0A else:%0A print('Could not find pattern', state.pattern)
%0A%0Aif __n
|
594992886182fc99389e19e6bba7efaeac54387b | Make updating sorted keys less redundant | ginga/misc/Datasrc.py | ginga/misc/Datasrc.py | #
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import threading
class TimeoutError(Exception):
pass
class Datasrc(object):
def __init__(self, length=0):
... | Python | 0.000077 | @@ -211,16 +211,17 @@
eading%0A%0A
+%0A
class Ti
@@ -253,16 +253,17 @@
pass%0A%0A
+%0A
class Da
@@ -277,16 +277,62 @@
bject):%0A
+ %22%22%22Class to handle internal data cache.%22%22%22
%0A def
@@ -1313,99 +1313,8 @@
()%0A%0A
- self.sortedkeys = list(self.datums.keys())%0A self.sort... |
efa61b14d54ea740f5b64c37ce3ef841656175b3 | Remove print statments | git_gutter_handler.py | git_gutter_handler.py | import git_helper
import sublime
import subprocess
import tempfile
import re
class GitGutterHandler:
def __init__(self, view):
self.view = view
self.git_temp_file = tempfile.NamedTemporaryFile()
self.buf_temp_file = tempfile.NamedTemporaryFile()
if self.on_disk():
self.git_tree = git_helper.git... | Python | 0.00022 | @@ -1247,28 +1247,8 @@
r):%0A
- print diff_str%0A%0A
@@ -1793,35 +1793,8 @@
rt%0A%0A
- print 'kind: '+kind%0A%0A
@@ -1999,65 +1999,8 @@
1)%0A%0A
- print inserted%0A print modified%0A print deleted%0A%0A
|
b6b73a0bcf32be524170c4bbe1bf3916312d1173 | Fix receiving events from federation via a worker | synapse/replication/http/federation.py | synapse/replication/http/federation.py | # -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# 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 la... | Python | 0 | @@ -3309,23 +3309,29 @@
t_ver =
-content
+event_payload
%5B%22event_
|
51cc1df39a53ef26d36ff8d65aa690f08b57dd99 | Add tests for SentryLogObserver. | vumi/tests/test_sentry.py | vumi/tests/test_sentry.py | """Tests for vumi.sentry."""
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from twisted.web import http
from vumi.tests.utils import MockHttpServer, LogCatcher
from vumi.sentry import quiet_get_page
class TestQuietGetPage(TestCase):
@inlineCallbacks
def setU... | Python | 0 | @@ -23,16 +23,32 @@
ry.%22%22%22%0A%0A
+import logging%0A%0A
from twi
@@ -162,16 +162,59 @@
ort http
+%0Afrom twisted.python.failure import Failure
%0A%0Afrom v
@@ -301,16 +301,35 @@
get_page
+, SentryLogObserver
%0A%0A%0Aclass
@@ -961,49 +961,1511 @@
ass
-TestSentryLogObserver(TestCase):%0A pass
+DummySentr... |
4ee1d142831d379fadba6b0eea9cb622fbcb1a19 | Verify reading the done flag | cosmic-core/scripts/src/main/resources/scripts/vm/hypervisor/kvm/send_config_properties_to_systemvm.py | cosmic-core/scripts/src/main/resources/scripts/vm/hypervisor/kvm/send_config_properties_to_systemvm.py | #!/usr/bin/python
# This script connects to the system vm Qemu Guest Agent and writes the
# authorized_keys and cmdline data to /var/cache/cloud. The system VM then
# reads processes these files in cloud_early_config
#
import argparse
import os
import json
import base64
import sys
SOCK_FILE = "/var/lib/libvirt/qemu/... | Python | 0.000001 | @@ -4683,24 +4683,38 @@
hen done%0A
+ write_count =
write_file(
@@ -4739,8 +4739,138 @@
%22DONE%22)%0A
+ read_count = read_guest_file(CMDLINE_INCOMING, write_count)%0A compare_write_read(CMDLINE_INCOMING, write_count, read_count)%0A
|
0599acdaa610324de36805503aff133f5d6aff08 | set notification logger to warning instead of error | delphin_6_automation/logging/ribuild_logger.py | delphin_6_automation/logging/ribuild_logger.py | __author__ = 'Christian Kongsgaard'
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import logging
import os
from notifiers.logging import NotificationHandler
import platform
# RiBuild Modules:
try:
... | Python | 0 | @@ -1570,13 +1570,15 @@
ing.
-ERROR
+WARNING
)%0A
|
517cc83aff398b62073abbcd2d23bbaae556d3ae | fix Python 3 check | waftools/checks/custom.py | waftools/checks/custom.py | from waftools.inflectors import DependencyInflector
from waftools.checks.generic import *
from waflib import Utils
import os
__all__ = ["check_python", "check_cpu_x86", "check_cpu_x86_64"]
def check_python(ctx, dependency_identifier):
ctx.find_program(['python3', 'python'], var = 'PYTHON')
ctx.load('python')
... | Python | 0.000007 | @@ -107,16 +107,24 @@
rt Utils
+, Errors
%0Aimport
@@ -322,16 +322,29 @@
thon')%0A%0A
+ try:%0A
ctx.
@@ -368,81 +368,18 @@
ion(
-)%0A%0A ver = int(ctx.env.PYTHON_VERSION.split('.')%5B0%5D)%0A if (ver == 3):
+(3, 0, 0))
%0A
@@ -430,17 +430,48 @@
rn True%0A
-%0A
+ except Errors.WafError:%0A... |
8a9720d0861f766b17549765725d8eef6d151e29 | fix diff for unitless nomials | gpkit/nomials/data.py | gpkit/nomials/data.py | """Machinery for exps, cs, varlocs data -- common to nomials and programs"""
from collections import defaultdict
from functools import reduce as functools_reduce
from operator import add
import numpy as np
from ..small_classes import HashVector, Quantity
from ..keydict import KeySet, KeyDict
from ..small_scripts import... | Python | 0.000059 | @@ -3517,59 +3517,97 @@
-units = (Quantity(1, self.cs.units)/var.
+if not var.units and not isinstance(var.units, str):%0A
units
+ = 1
%0A
+ else:%0A
@@ -3621,60 +3621,174 @@
if
-var.units and not isinstance(var.units, str) else 1)
+hasattr(self.cs, %22units%22):%0A cs... |
46eb7ec0d6c802256fd5d0e8878457ba7f784b16 | Add activity hierarchy to HierarchyManager | indra/preassembler/hierarchy_manager.py | indra/preassembler/hierarchy_manager.py | import os
import rdflib
import functools32
class HierarchyManager(object):
prefixes = """
PREFIX rn: <http://sorger.med.harvard.edu/indra/relations/>
PREFIX en: <http://sorger.med.harvard.edu/indra/entities/>
"""
def __init__(self, rdf_file):
"""Initialize with the path to an R... | Python | 0.000001 | @@ -1860,16 +1860,131 @@
y.rdf')%0A
+act_file_path = os.path.join(os.path.dirname(__file__),%0A '../resources/activity_hierarchy.rdf')%0A
entity_h
@@ -2086,9 +2086,61 @@
e_path)%0A
+activity_hierarchy = HierarchyManager(act_file_path)
%0A
|
0eedc16f958828f10c828c789bb84e35f9eab7ff | Add format conversions. | loldb/convert.py | loldb/convert.py | def format_item(item):
"""
:type item: item.Item
"""
return {
'id': item.id,
'name': item.name,
'alias': item.alias,
'icon_path': item.icon_path,
'cost': item.cost,
'tooltip': item.tooltip,
'tier': item.tier,
'stats': format_item_stats(ite... | Python | 0 | @@ -1,20 +1,33 @@
+import json%0A%0A
def format_item(item
@@ -3317,16 +3317,525 @@
kin.rank,%0A %7D%0A
+%0A%0Aclass Encoder(json.JSONEncoder):%0A def default(self, o):%0A if isinstance(o, set):%0A return list(o)%0A return super(Encoder, self).default(o)%0A%0A%0Adef to_json(champions, it... |
87010af869f58e23f89c7d47e5aa173127114a54 | Update eidos_reader.py for new Eidos version | indra/sources/eidos/eidos_reader.py | indra/sources/eidos/eidos_reader.py | import json
from indra.java_vm import autoclass, JavaException
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings are done with the same
in... | Python | 0 | @@ -428,12 +428,13 @@
.wm.
-Agro
+Eidos
Syst
@@ -1157,16 +1157,34 @@
rom(text
+, False).mentions(
)%0A
|
65eaf244ab697acf4ea1f300d03af2a1a973e7e1 | Add the ability to do an exact search | microcosm_postgres/store.py | microcosm_postgres/store.py | """
Abstraction layer for persistence operations.
As much as `SQLAlchemy` provides a great deal of power, overuse of its features
creates dangerous coupling within applications. The two worst violations are:
a. Using models directly to perform persistence operations causes persistence code
to permeate all layers... | Python | 0.000004 | @@ -5257,24 +5257,425 @@
uery.all()%0A%0A
+ def search_exact(self, *criterion, **kwargs):%0A %22%22%22%0A Returns the first exact match based on criteria or None.%0A%0A :param offset: pagination offset, if any%0A :param limit: pagination limit, if any%0A%0A %22%22%22%0A que... |
fe633ce938708a501cf4411b60e5dc8ef5ed3ce1 | Fix broken migration during dry run | pylinks/links/migrations/0007_auto.py | pylinks/links/migrations/0007_auto.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field categories on 'Link'
m2m_table_name = db.sho... | Python | 0.00002 | @@ -719,16 +719,47 @@
_id'%5D)%0A%0A
+ if not db.dry_run:%0A
@@ -793,16 +793,20 @@
+
+
for link
@@ -841,24 +841,28 @@
+
link.categor
@@ -884,16 +884,20 @@
tegory)%0A
+
|
2366b4fa6ca940c4c774a2f3b3c5e5be14edb0af | Refactor dice rolling algorithm in DiceRollerSuite | src/DiceRollerSuite.py | src/DiceRollerSuite.py | import random
import re
from src.CommandSuite import CommandSuite
class DiceRollerSuite(CommandSuite):
"""Suite for rolling dice"""
def __init__(self, name):
"""Initialize some variables"""
CommandSuite.__init__(self, name)
self.config = self.config_manager.parse_file('config/defaultLo... | Python | 0 | @@ -360,36 +360,33 @@
self.
-invoke_match
+dice_roll
_string = '%5C
@@ -407,70 +407,8 @@
9%5D+)
-'%0A self.invoke_modified_match_string = '%5C!%5B0-9%5D+d%5B0-9%5D+
(%5B+%5D
@@ -412,23 +412,24 @@
%5B+%5D%7C%5B-%5D)
+?
(%5B0-9%5D
-+
+*
)'%0A
@@ -656,79 +656,17 @@
-base_match = re.search(s... |
99525264d95fd4baba359d4b701dde4e9dda704e | Add notes about runtime of nekbone | integration/apps/nekbone/nekbone.py | integration/apps/nekbone/nekbone.py | # Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this... | Python | 0 | @@ -1611,16 +1611,198 @@
AGE.%0A#%0A%0A
+%0A'''%0ADescribes the best known configuration for Nekbone.%0A%0AOn one node of mcfly, one iteration with the monitor agent takes about%0A300sec and produces a trace file of about 13MB.%0A'''%0A%0A
import o
@@ -2201,131 +2201,35 @@
-# TODO: needed? is size in setup() re... |
29be986010b8ef6bce14ae1aa92f5d51c4b223ca | Add many TODO for app | appalignak.py | appalignak.py | import signal, os, webbrowser, gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as appindicator
gi.require_version('Notify', '0.7')
from gi.repository import Notify as notify
from gi.repository import GLib as glib... | Python | 0.000001 | @@ -1591,16 +1591,59 @@
ignak'%0A%0A
+ # TODO : change icon if hosts are down%0A
indi
@@ -2238,16 +2238,76 @@
OK :)%22%0A
+ # TODO : let notifications optional with configuration.%0A
noti
|
15594ab16ea2540ac7a9a6a6bd4df39c2cea51ee | Add a getListRedirect and getListPublicRedirect function | app/soc/views/helper/redirects.py | app/soc/views/helper/redirects.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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... | Python | 0 | @@ -1741,24 +1741,395 @@
).name())%0A%0A%0A
+def getListRedirect(entity, params):%0A %22%22%22Returns the public redirect for the specified entity.%0A %22%22%22%0A%0A return '/%25s/list/%25s' %25 (%0A params%5B'url_name'%5D, entity.key().name())%0A%0A%0Adef getPublicListRedirect(entity, params):%0A %22%22%22R... |
2228084849ce3e2e17e91402b6ae6e7e3a5cb7a4 | Use key().name() instead of link_id | app/soc/views/helper/redirects.py | app/soc/views/helper/redirects.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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... | Python | 0.000038 | @@ -917,23 +917,26 @@
entity.
-link_id
+key.name()
)%0A %0A r
@@ -1113,39 +1113,44 @@
_name'%5D, entity.
-link_id
+key().name()
)%0A%0A return resu
@@ -1329,23 +1329,28 @@
entity.
-link_id
+key().name()
)%0A%0A ret
@@ -1467,56 +1467,8 @@
%22%22%0A%0A
- suffix = params%5B'logic'%5D.getKeySuffix(entity)%0A
... |
4593bedda981bff49a3ddb54f20e2f17b55f4c0b | Fix for web interface CLI backup. | python/manus_webshell/cli/__main__.py | python/manus_webshell/cli/__main__.py | import sys
import os
import json
import errno
import glob
import urllib2
import argparse
import mimetypes
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def d... | Python | 0 | @@ -700,17 +700,16 @@
age, %22%25s
-.
%25s%22 %25 (k
|
020564bdcbcb6586e8d9ed622624db47e0a122d8 | fix incorrect type for empty tags | irctest/irc_utils/message_parser.py | irctest/irc_utils/message_parser.py | import re
import collections
import supybot.utils
# http://ircv3.net/specs/core/message-tags-3.2.html#escaping-values
TAG_ESCAPE = [
('\\', '\\\\'), # \ -> \\
(' ', r'\s'),
(';', r'\:'),
('\r', r'\r'),
('\n', r'\n'),
]
unescape_tag_value = supybot.utils.str.MultipleReplacer(
dict(map(la... | Python | 0.000025 | @@ -1262,10 +1262,10 @@
s =
-%5B%5D
+%7B%7D
%0A
|
0b3c0bb1c00f9af8ebad7f5a36a9fd71097468b1 | Fix bug in fetchProfiles.py | app/utils/insert/fetchProfiles.py | app/utils/insert/fetchProfiles.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Fetch Profiles utility.
Get profile data from the Twitter API and add to the database. If a Category
is provided as argument, assign the Category to the Profile records.
"""
import argparse
import os
import sys
# Allow imports to be done when executing this file dire... | Python | 0 | @@ -5495,18 +5495,18 @@
%7B0%7D%22.for
-a
m
+a
t(len(fa
|
d4909d5693822f5159271610c53162506be10efc | Allow filename completion after \s | pythonx/completers/common/filename.py | pythonx/completers/common/filename.py | # -*- coding: utf-8 -*-
import os
import re
import logging
import glob
import itertools
from completor import Completor
from .utils import test_subseq, LIMIT
logger = logging.getLogger('completor')
PAT = re.compile('(\w{2,}:(//?[^\s]*)?)|(</[^\s>]*>?)|(//)')
START_NO_DIRNAME = re.compile("^(\.{0,2}/|~/|[a-zA-Z]:/|\... | Python | 0.000005 | @@ -2359,70 +2359,8 @@
%22%22%22%0A
- # Ignore white space.%0A base = base.split()%5B-1%5D%0A
@@ -2727,32 +2727,93 @@
return %5B%5D%0A
+%0A if match.group()%5B-1%5D == ' ':%0A return %5B%5D%0A%0A
try:%0A
|
d4e01347495ca55807f221d89b5f2d80ca303a0b | Include the locale of the document in build errors. | grow/pods/rendered.py | grow/pods/rendered.py | from . import controllers
from . import messages
from grow.common import utils
from grow.pods import env
from grow.pods import errors
from grow.pods import ui
import mimetypes
import sys
class RenderedController(controllers.BaseController):
KIND = messages.Kind.RENDERED
def __init__(self, view=None, doc=None... | Python | 0 | @@ -584,16 +584,192 @@
f.view)%0A
+ if self.doc.locale:%0A return '%3CRendered(view=%5C'%7B%7D%5C', doc=%5C'%7B%7D%5C'), locale=%5C'%7B%7D%5C'%3E'.format(%0A self.view, self.doc.pod_path, str(self.doc.locale))%0A
|
7381f2367bc155434c155e2116cd0d046b3d66ae | add alarm message | apps/alarm.py | apps/alarm.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from apps.decorators import on_command
from apps.slackutils import cat_token, get_nickname
import time
@on_command(['!알람', '!ㅇㄹ'])
def run(robot, channel, tokens, user, command):
'''일정시간 이후에 알람 울려줌'''
msg = '사용법 오류'
if len(tokens) ... | Python | 0.000017 | @@ -150,16 +150,26 @@
nickname
+, send_msg
%0D%0Aimport
@@ -381,33 +381,172 @@
-time.sleep(int(tokens%5B0%5D)
+sec = eval(cat_token(tokens, 1))%0D%0A noti_msg = user_name + ', ' + str(sec) + '%EC%B4%88 %ED%9B%84%EC%97%90 %EC%95%8C%EB%A0%A4%EC%A3%BC%EA%B2%A0%EC%9D%8C.'%0D%0A send_msg(robot, channel... |
91dc767e3d5fa50cfc552fa0bc9196886a32a718 | Update model | variantstore.py | variantstore.py | from cassandra.cqlengine import columns
from cassandra.cqlengine.models import Model
class Variant(Model):
reference_genome = columns.Text(primary_key=True, partition_key=True)
chr = columns.Text(primary_key=True, partition_key=True)
pos = columns.Integer(primary_key=True, partition_key=True)
# Clust... | Python | 0.000001 | @@ -486,24 +486,42 @@
t(index=True
+, primary_key=True
)%0A librar
@@ -548,24 +548,110 @@
t(index=True
+, primary_key=True)%0A date_annotated = columns.DateTime(index=True, primary_key=True
)%0A target
@@ -721,24 +721,24 @@
index=True)%0A
+
extracti
@@ -770,58 +770,8 @@
rue)
-%0A date_annotated =... |
0eb0608eeecd287ce5d286fc244013781c29214f | Split admin.globalConfig into two endpoints | appengine/config_service/admin.py | appengine/config_service/admin.py | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Administration API accessible only by service admins.
Defined as Endpoints API mostly to abuse API Explorer UI and not to write our
own admin ... | Python | 0.000527 | @@ -587,16 +587,51 @@
msgprop%0A
+from protorpc import message_types%0A
from pro
@@ -1809,16 +1809,477 @@
ns.%22%22%22%0A%0A
+ @auth.endpoints_method(%0A message_types.VoidMessage, GlobalConfigMessage, name='readGlobalConfig')%0A @auth.require(acl.is_admin)%0A def read_global_config(self, request):%0A %22... |
da10771e21c2dee4eee0f4fb046b3135d51aa3a9 | Fix file path issue while trying to save the file on Windows. | AdvancedNewFile.py | AdvancedNewFile.py | import os
import sublime, sublime_plugin
class AdvancedNewFileCommand(sublime_plugin.TextCommand):
def run(self, edit, is_python=False):
self.count = 0
self.window = self.view.window()
self.root = self.get_root()
self.is_python = is_python
self.show_filename_input()
d... | Python | 0 | @@ -1147,42 +1147,18 @@
dow.
-run_command('open_file', %7B%22file%22:
+open_file(
file
@@ -1166,9 +1166,8 @@
path
-%7D
)%0A
|
26e1f6c3cd87b71f3f98146774808b94e920910d | test base64 content type response | test_awsgi.py | test_awsgi.py | # -*- coding: utf-8 -*-
from io import StringIO
import sys
import unittest
try:
# Python 3
from urllib.parse import urlencode
# Convert bytes to str, if required
def convert_str(s):
return s.decode('utf-8') if isinstance(s, bytes) else s
except:
# Python 2
from urllib import urlencode
... | Python | 0 | @@ -40,16 +40,25 @@
StringIO
+, BytesIO
%0Aimport
@@ -2869,8 +2869,820 @@
ted%5Bk%5D)%0A
+%0A def test_response_base64_content_type(self):%0A event = %7B%0A %22path%22: %22/image.png%22,%0A %22httpMethod%22: %22GET%22,%0A %22headers%22: %7B%0A %22Accept%22: ... |
07e24c3d878e0bd62fbd6c73af13e901bc8cf975 | fix inverse funtion for the discounts (#222) | sale_three_discounts/models/sale_order_line.py | sale_three_discounts/models/sale_order_line.py | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import fields, models, api, _
from odoo.exceptions import Valid... | Python | 0.000001 | @@ -2664,16 +2664,93 @@
count1')
+%5C%0A and not vals.get('discount2') and not vals.get('discount3')
:%0A
|
88bdc56cad7c0dba165de26940fd19997e4d9862 | Complete solution | atbash-cipher/atbash_cipher.py | atbash-cipher/atbash_cipher.py | from string import ascii_lowercase, digits
ATBASH = {k: v for k, v in zip(ascii_lowercase + digits,
ascii_lowercase[::-1] + digits)}
def encode(s):
encoded = atbash(s)
def decode(s):
return atbash(s)
def atbash(s):
return "".join(ATBASH.get(ch, "") for ch in s.lower())... | Python | 0.000001 | @@ -1,8 +1,18 @@
+import re%0A
from str
@@ -194,17 +194,45 @@
-encoded =
+return %22 %22.join(re.findall(r'.%7B1,5%7D',
atb
@@ -233,24 +233,26 @@
', atbash(s)
+))
%0A%0A%0Adef decod
|
ae38a3d2cef0925dea4c1a4614d4c999f87b1458 | FIX report extended stock | report_extended_stock/models/stock.py | report_extended_stock/models/stock.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api
class stock_pick... | Python | 0 | @@ -519,32 +519,336 @@
rinted': True%7D)%0A
+ # no sure why but sometimes it cames other models as activemodel%0A # and it gives an error, for eg if you came from picking from sale%0A # order and print is enable on picking confirmation%0A self = self.with_context(%0A active_model... |
205ce762e61c19e43cb472af3f7b3c7fdd72e43d | Improve render formatting of all DRF's internal exceptions | rest_framework_json_api/exceptions.py | rest_framework_json_api/exceptions.py | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... | Python | 0 | @@ -1,24 +1,39 @@
+import inspect%0A
from django.utils import
@@ -32,16 +32,21 @@
s import
+ six,
encodin
@@ -140,59 +140,20 @@
atus
-%0Afrom rest_framework.exceptions import APIException
+, exceptions
%0Afro
@@ -1195,52 +1195,197 @@
-# or a string in case of AuthenticationError
+elif isinstance(error, six.... |
e0f92f43200d290d657dbbb09dd1d66451393f3d | Fix appcast script | bin/set_appcast.py | bin/set_appcast.py | #!/usr/bin/env python
# pip install requests
# pip install Markdown
import os
import sys
import subprocess
import requests
import json
import markdown
from datetime import datetime
from string import Template
SIGN_UPDATE = './bin/sign_update'
PRIVATE_KEY_PATH = os.path.expanduser('~/Projects/sparkle_priv.pem')
GITHU... | Python | 0.000001 | @@ -73,16 +73,26 @@
port os%0A
+import io%0A
import s
@@ -1797,23 +1797,16 @@
l'%0A%0A
-appcast_file =
+with io.
open
@@ -1858,17 +1858,20 @@
), 'w+')
-%0A
+ as
appcast_
@@ -1878,43 +1878,40 @@
file
-.write(appcast)%0Aappcast_file.close(
+:%0A appcast_file.write(appcast
)%0A%0Ap
|
0c506e9e29096c4feb118694b00020d631d67082 | add two drawNetworkGraph functions | src/PTTpushAnalyser.py | src/PTTpushAnalyser.py | import collections
import networkx as nx
from src.DBmanage import DBmanage
class PTTpushAnalyser:
def __init__(self):
db = DBmanage()
def analyse(self):
pass
def getAllAuthorPusherPairs(self, crawlArticles):
allAuthorPusherPairs = []
for artical in crawlArticles:
... | Python | 0.000001 | @@ -34,16 +34,49 @@
x as nx%0A
+import matplotlib.pyplot as plt%0A%0A
from src
@@ -1131,57 +1131,294 @@
-nx.draw(graph, with_labels=True, font_color='green
+return graph%0A%0A def drawNetworkGraphThenShow(self, graph):%0A nx.draw(graph, with_labels=True, font_color='green')%0A plt.show()%0A%0A ... |
794113ebfd3ea480ac745640b592b893359a62e0 | Use existing service function to look up sessio token for tests | tests/base.py | tests/base.py | """
tests.base
~~~~~~~~~~
Base classes for test cases
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from contextlib import contextmanager
import os
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
from byceps.application import ... | Python | 0 | @@ -403,28 +403,15 @@
ion.
-models.session_token
+service
%5C%0A
@@ -420,28 +420,43 @@
import
-S
+find_s
ession
-T
+_t
oken
+_for_user
%0A%0Afrom t
@@ -1709,66 +1709,43 @@
n =
-S
+find_s
ession
-T
+_t
oken
-.query.filter_by(user_id=user_id).one_or_none(
+_for_user(user_id
)%0A%0A
|
8ef3a5841f35af7348581cdd49224c007c9e8729 | Add open assets testcase | tests/main.py | tests/main.py |
from importlib import import_module
import sys
def try_import(module_name):
try:
sys.stdout.write("Import %s ... " % module_name)
sys.stdout.flush()
m = import_module(module_name)
sys.stdout.write("OK\n")
sys.stdout.flush()
except ImportError as e:
sys.stdou... | Python | 0.000001 | @@ -178,12 +178,8 @@
- m =
imp
@@ -935,12 +935,360 @@
ent.upnp%22)%0A%0A
+ sys.stdout.write(%22Open resource fluxclient::assets/flux3dp-icon.png ... %22)%0A sys.stdout.flush()%0A try:%0A import pkg_resources%0A pkg_resources.resource_stream(%22fluxclient%22, %22assets/flux3dp-icon.png%22... |
8ecc41e3c2ee39d59faa5b5f982e0d57eec5963f | Add support for disconnecting nodes | tests/mesh.py | tests/mesh.py | #!/usr/bin/env python
from twisted.internet import reactor, protocol
from base64 import b64encode, b64decode
import random
class BaseMeshNode(protocol.ProcessProtocol):
delimiter = '\n'
__buffer = ''
peers = []
def __init__(self, name):
self.name = name
self.process = reactor.spawnProcess(self,
... | Python | 0.000001 | @@ -616,25 +616,24 @@
ode(data))%0A%0A
-%0A
def gotOut
@@ -803,47 +803,197 @@
def
-__connected(self, data):%0A self.node_
+node_disconnected(self):%0A %22Should be overridden%22%0A print %22Disconnected!!%22%0A%0A def __connected(self, data):%0A self.node_connected()%0A%0A def __disconnected(self, d... |
e20fe368c7fd5f47d58b83de2d2f47a9cd22d628 | Update wab address | bot-master/main.py | bot-master/main.py | import os
import time
import json
import uuid
import threading
from subprocess import call
from flask import Flask, jsonify, abort, request, send_from_directory
import rethinkdb as r
from helpers import crossdomain
conn = r.connect('localhost', 28015)
repos = r.db('bot_master').table('repos')
tasks_todo = {} # bund... | Python | 0 | @@ -554,22 +554,44 @@
p://
-localhost:5001
+http://aslo-bot-master.sugarlabs.org
'%0A%0Ad
|
021dc3e1fa90bad39ce92ea08f3233dd87236d8e | Bump version | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.8.0'
| Python | 0 | @@ -14,9 +14,9 @@
'2.
-8
+9
.0'%0A
|
14208e9213a58f0d91554e4479f23c1bd6636e10 | Fix error to send image file on Python 3.x | livereload/handlers.py | livereload/handlers.py | # -*- coding: utf-8 -*-
"""
livereload.handlers
~~~~~~~~~~~~~~~~~~~
HTTP and WebSocket handlers for livereload.
:copyright: (c) 2013 by Hsiaoming Yang
"""
import os
import time
import hashlib
import logging
import mimetypes
from tornado import ioloop
from tornado import escape
from tornado.websocket ... | Python | 0.000001 | @@ -5659,39 +5659,178 @@
-with open(filepath, 'r') as f:%0A
+if mime_type.startswith('text'):%0A with open(filepath, 'r') as f:%0A data = f.read()%0A else:%0A with open(filepath, 'rb') as f:%0A
|
eba09997f1208b729eac4a3c8cf37a92dbc1e6ed | fix raising Exception | lib/util/net.py | lib/util/net.py | # -*- coding: utf-8 -*-
#
import urllib
portal_ptrn_list = {
'feedsportal': "\.feedsportal\.com",
}
def get_portal(url):
import re
for portal in portal_ptrn_list:
ptrn = re.compile(portal_ptrn_list[portal])
if (ptrn.search(url)): return portal
return False
def break_portal(portal, payload, uo):
... | Python | 0.000001 | @@ -465,27 +465,30 @@
**%5Cn
-Break Portal Failed
+Failed breaking portal
(%25s
@@ -1258,16 +1258,24 @@
raise
+ IOError
(%22HTTP r
|
7d638b543e066dd132933d88274fa518706f30a3 | Add distance flights and quick stats to JSON for "extended" query | skylines/frontend/views/user.py | skylines/frontend/views/user.py | from datetime import date, timedelta
from flask import Blueprint, render_template, redirect, url_for, g, request, jsonify
from flask.ext.login import login_required
from sqlalchemy import func, and_
from sqlalchemy.orm import contains_eager, subqueryload
from skylines.database import db
from skylines.lib.dbutil impo... | Python | 0 | @@ -3379,24 +3379,171 @@
cept', ''):%0A
+ if 'extended' in request.args:%0A user%5B'distanceFlights'%5D = _distance_flights(g.user)%0A user%5B'stats'%5D = _quick_stats()%0A%0A
retu
|
51e5ed7e8726a4192f2d08f34d8d923cef06ec54 | fix precision_series | metrics.py | metrics.py | import numpy as np
import pandas as pd
import sklearn.metrics
from drain import util
def to_float(*args):
return [np.array(a, dtype=np.float32) for a in args]
def baseline(run, masks=[], test=True, outcome='true'):
y_true,y_score = _mask(run, masks, test, outcome)
y_true,y_score = to_float(y_true, y_score... | Python | 0.000001 | @@ -2478,16 +2478,40 @@
turn p%0A%0A
+# TODO extrapolate here%0A
def prec
@@ -2544,16 +2544,64 @@
re, k):%0A
+ y_true, y_score = to_float(y_true, y_score)%0A
rank
|
665eb8182e57e729790e83d2bf925e67ab864e6e | Update discord backend | social_core/backends/discord.py | social_core/backends/discord.py | """
Discord Auth OAuth2 backend, docs at:
https://discordapp.com/developers/docs/topics/oauth2
"""
from social_core.backends.oauth import BaseOAuth2
class DiscordOAuth2(BaseOAuth2):
name = 'discord'
AUTHORIZATION_URL = 'https://discordapp.com/api/oauth2/authorize'
ACCESS_TOKEN_URL = 'https:/... | Python | 0 | @@ -382,16 +382,122 @@
'POST'%0D%0A
+ REVOKE_TOKEN_URL = 'https://discordapp.com/api/oauth2/token/revoke'%0D%0A REVOKE_TOKEN_METHOD = 'GET'%0D%0A
DEFA
@@ -678,14 +678,8 @@
ken'
-, True
)%0D%0A
|
83e42c212b832d48830605196f00ae60d6bf1240 | Add more logging and minor refactors | scripts/migrate_duplicate_external_accounts.py | scripts/migrate_duplicate_external_accounts.py | from __future__ import absolute_import
import logging
import sys
from dropbox.rest import ErrorResponse
from dropbox.client import DropboxClient
from framework.mongo import database as db
from framework.transactions.context import TokuTransaction
from website.app import init_app
from website.addons.github.api import... | Python | 0 | @@ -543,16 +543,95 @@
ea_id):%0A
+ logger.warn('Validating credentials for externalaccount %7B%7D'.format(ea_id))%0A
ea =
@@ -1741,16 +1741,24 @@
for usid
+, ealist
in us_m
@@ -1764,45 +1764,16 @@
map.
-keys():%0A ealist = us_map%5Busid%5D
+items():
%0A
@@ -2128,16 +2128,24 @@
for uid
+, ealis... |
e140d150a88b7c82e0f1e427c313122395993534 | Fix when use from qt designer (no completion server started) | pyqode/python/modes/document_analyser.py | pyqode/python/modes/document_analyser.py | import pyqode.core
from pyqode.core import logger
from pyqode.python.modes.code_completion import iconFromType
from pyqode.qt import QtCore
class Definition(object):
"""
A definition object defines a symbol definition in a python source code:
- import
- variable
- class
- metho... | Python | 0 | @@ -5440,32 +5440,33 @@
except
+(
TypeError:%0A
@@ -5450,32 +5450,49 @@
xcept (TypeError
+, AttributeError)
:%0A
@@ -5828,16 +5828,17 @@
except
+(
TypeErro
@@ -5834,24 +5834,41 @@
t (TypeError
+, AttributeError)
:%0A
|
d3227e87b658b4ee634dd273a97d1a8fba4c96c9 | Revise docstring and add space line | lc461_hamming_distance.py | lc461_hamming_distance.py | """Leetcode 461. Hamming Distance
Medium
URL: https://leetcode.com/problems/hamming-distance/description/
The Hamming distance between two integers is the number of positions at which
the corresponding bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 ≤ x, y < 231.
Example:
... | Python | 0.000005 | @@ -457,32 +457,33 @@
responding bits
+%0A
are different.%0A%22
@@ -792,16 +792,17 @@
(1, 4)%0A%0A
+%0A
if __nam
|
731534984484c992e61d4b05eb9e268b38eaebd5 | add --verbose flag, be quiet by default | web/scripts/sources2db.py | web/scripts/sources2db.py | import argparse
import sys, os
import time
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import exists
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
from models import Base, Package, Version
def get_engine_se... | Python | 0 | @@ -322,16 +322,30 @@
sion(url
+, verbose=True
):%0A e
@@ -376,19 +376,22 @@
l, echo=
-Tru
+verbos
e)%0A S
@@ -520,16 +520,30 @@
op=False
+, verbose=True
):%0A e
@@ -581,16 +581,25 @@
sion(url
+, verbose
)%0A %0A
@@ -2175,24 +2175,150 @@
tore_true%22)%0A
+ parser.add_argument(%22--verbose%22, a... |
5d33de3868df4549621763db07267ef59fb94eb8 | Fix ohe type in ce | dataset/models/tf/losses/core.py | dataset/models/tf/losses/core.py | """ Contains base tf losses """
import tensorflow as tf
def softmax_cross_entropy(labels, logits, *args, **kwargs):
""" Multi-class CE which takes plain or one-hot labels
Parameters
----------
labels : tf.Tensor
logits : tf.Tensor
args
other positional parameters from `tf.losses.sof... | Python | 0.000608 | @@ -774,22 +774,41 @@
one_hot(
-labels
+tf.cast(labels, tf.int32)
, logits
|
2d678af10a6bf91b56868c154128c75190ba5156 | Remove a TODO we'll never get around to; improve a --help string | browsernode/tap.py | browsernode/tap.py | from __future__ import with_statement
import os
from twisted.python import usage, log
from twisted.python.filepath import FilePath
from twisted.application import service, strports
from webmagic.filecache import FileCache
from browsernode import browsernode_site
_defaultClosureLibrary = FilePath(__file__).parent(... | Python | 0.000002 | @@ -781,152 +781,8 @@
%5D,%0A%0A
-%09%09# TODO: Combine %22HTTP server%22 and %22Minerva server%22. One server serves both. But SSL and non-SSL are different,%0A%09%09# so we'll still serve two.%0A%0A
%09%09%5B%22
@@ -831,20 +831,16 @@
ion for
-the
Minerva
@@ -841,24 +841,42 @@
nerva server
+'s socket listener
... |
33e581931859eb23d541332f9f31ca2fe8be6630 | Update device_credentials to work with new RestClient | auth0/v2/device_credentials.py | auth0/v2/device_credentials.py | from .rest import RestClient
class DeviceCredentials(object):
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/device-credentials' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def get(self, user_id=None, client_id=None, type=None,
fields=[], incl... | Python | 0 | @@ -101,16 +101,123 @@
token):%0A
+ self.domain = domain%0A self.client = RestClient(jwt=jwt_token)%0A%0A def _url(self, id=None):%0A
@@ -267,24 +267,28 @@
' %25
+self.
domain%0A
-%0A
self
@@ -287,61 +287,79 @@
-self.client = RestClient(endpoint=url, jwt=jwt_token)
+if id... |
ef4d1de9c30df4c2d75f09e1d23ab306a9762f71 | call super init in IncludeHandler | misc/scripts/check-qhelp.py | misc/scripts/check-qhelp.py | #!/bin/env python3
"""cross platform wrapper around codeql generate query-help to check .qhelp files
This takes care of:
* providing a temporary directory to --output
* finding usages of .inc.qhelp arguments
"""
import pathlib
import tempfile
import sys
import subprocess
import xml.sax
include_cache = {}
class In... | Python | 0 | @@ -230,24 +230,26 @@
%0Aimport
-tempfile
+subprocess
%0Aimport
@@ -255,34 +255,32 @@
sys%0Aimport
-subprocess
+tempfile
%0Aimport xml.
@@ -284,17 +284,16 @@
ml.sax%0A%0A
-%0A
include_
@@ -304,16 +304,17 @@
e = %7B%7D%0A%0A
+%0A
class In
@@ -380,16 +380,43 @@
, xml):%0A
+ super().__init__()%0A
... |
97d0263e33ee0eb7aa21b5a11cef047bfbab8fef | version 0.12.1 | rest_framework_friendly_errors/__init__.py | rest_framework_friendly_errors/__init__.py | # -*- coding: utf-8 -*-
__title__ = 'drf-friendly-errors'
__version__ = '0.12'
__author__ = 'Tomasz Łaszczuk'
__contact__ = 't.laszczuk@futuremind.com'
__license__ = 'MIT'
# Version synonym
VERSION = __version__
| Python | 0.000001 | @@ -71,16 +71,18 @@
= '0.12
+.1
'%0A__auth
|
cd45585233acfe7db1f757b244e2edba8dbb6f6b | Use environment variable REDIS_SERVER. | cloudly/cache.py | cloudly/cache.py | import os
import redis as pyredis
from cloudly.aws import ec2
from cloudly.memoized import Memoized
@Memoized
def get_conn():
ip_addresses = ec2.find_service_ip('redis-server') or ["127.0.0.1"]
redis_url = os.getenv('REDISTOGO_URL', # Set when on Heroku.
'redis://{}:6379'.format(ip... | Python | 0 | @@ -140,16 +140,71 @@
resses =
+ (os.environ.get(%22REDIS_SERVER%22) or%0A
ec2.fin
@@ -235,16 +235,37 @@
er') or
+%0A
%5B%22127.0.
@@ -269,16 +269,18 @@
.0.0.1%22%5D
+)%0A
%0A red
|
15aeb761e07ce3a1f6aef696abf3c2a0b6c6e394 | change status codes | bson_rpc/status.py | bson_rpc/status.py | # MIT License
#
# Copyright (c) 2017 Evan Liu (hmisty)
#
# 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, m... | Python | 0.000001 | @@ -1180,17 +1180,18 @@
_code':
--
+40
1, 'erro
@@ -1247,17 +1247,18 @@
_code':
--
+40
2, 'erro
@@ -1332,10 +1332,11 @@
e':
--3
+404
, 'e
@@ -1411,10 +1411,11 @@
e':
--
4
+05
, 'e
@@ -1451,8 +1451,96 @@
able'%7D%0A%0A
+#network error%0Aconnection_error: %7B'error_code': 501, 'error_msg': 'connection error... |
781457bcadce099c19b9e55816b5090687af4534 | Update brass eneg test | tests/test.py | tests/test.py | #!/usr/bin/env python
import unittest
from smact.properties import compound_electroneg
from smact.builder import wurtzite
import smact.lattice
import smact
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
pass
################ TOP-LEVEL ################
def test_Element_clas... | Python | 0 | @@ -2841,17 +2841,19 @@
-4.9865803
+5.063896325
9)%0A%0A
|
31ffc3022d08fa9d304565214e6d1e976a385a4c | Make main window larger | vtk_renderer.py | vtk_renderer.py | import sys
import vtk
import numpy as np
from astropy.io import fits
from PyQt4 import QtGui
from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
class VTKRenderer(object):
def __init__(self, filename):
data_matrix = fits.getdata(filename)
data_matrix = data_matrix[145:245, ... | Python | 0.000012 | @@ -1935,16 +1935,50 @@
renWin)%0A
+ self.vtkw.resize(800, 800)
%0A
|
70ed2a64b203d91557eb3ff8ba9992e1c645faa6 | Change compression | h5io/tests/test_io.py | h5io/tests/test_io.py | # -*- coding: utf-8 -*-
from os import path as op
from nose.tools import assert_raises, assert_true, assert_equal
import numpy as np
try:
from scipy import sparse
except ImportError:
sparse = None
from h5io import write_hdf5, read_hdf5, _TempDir, object_diff
def test_hdf5():
"""Test HDF5 IO
"""
... | Python | 0.000008 | @@ -1831,33 +1831,33 @@
hdf5(test_file,
-3
+5
, title='second'
@@ -1892,16 +1892,74 @@
sion=5)%0A
+ assert_equal(read_hdf5(test_file, title='second'), 5)%0A
%0A%0Adef te
|
aef238386c71d52def424c8f47a103bd25f12e26 | Make fix_updated migration (sort of) reversible | server/proposal/migrations/0034_fix_updated.py | server/proposal/migrations/0034_fix_updated.py | import django.contrib.gis.db.models.fields
from django.db import migrations
from django.contrib.gis.db.models import Max
def fix_updated(apps, _):
Proposal = apps.get_model("proposal", "Proposal")
proposals = Proposal.objects.annotate(published=Max("documents__published"))
for proposal in proposals:
... | Python | 0.000003 | @@ -419,16 +419,52 @@
ave()%0A%0A%0A
+def do_nothing(apps, _):%0A pass%0A%0A%0A
class Mi
@@ -628,16 +628,28 @@
_updated
+, do_nothing
),%0A %5D
|
cb6648c75f1c4436296407109e40df2da82a46f6 | fix function definition | models/ConsoleController.py | models/ConsoleController.py | import sys
import glob
import serial
import time
import random
usleep = lambda x: time.sleep(x/1000000.0)
# Number of µsecs that we need to wait between commands from controller
usecs_between_data = 1
class ConsoleController:
serialConnection = False;
def __init__(self, stateController):
self.stateControl... | Python | 0.000043 | @@ -552,16 +552,20 @@
alPorts(
+self
):%0A%0A
|
8ca32b33db506ba9083b98dd3ecf740cbee89ab1 | Update authentication.JWTAuthentication | rest_framework_simplejwt/authentication.py | rest_framework_simplejwt/authentication.py | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from jose import jwt
from rest_framework.authentication import BaseAuthentication, get_authorization_header
from rest_framework.exceptions import AuthenticationFailed
AUTH_HEA... | Python | 0.000001 | @@ -146,23 +146,110 @@
rom
-jose import jwt
+django.utils.six import text_type%0Afrom jose import jwt%0Afrom rest_framework import HTTP_HEADER_ENCODING
%0Afro
@@ -309,34 +309,8 @@
tion
-, get_authorization_header
%0Afro
@@ -722,38 +722,141 @@
-token = self.get_token(header)
+if header is None:%0A ... |
9845bed06378ff0e941543e473e4ce9085a3d6d7 | Remove debug points in combinators.py | makehex/combinators.py | makehex/combinators.py | import logging
from makehex.tools import debug_point
class Result:
def __init__(self, value, pos: int):
self.value = value
self.pos = pos
class Parser:
def __call__(self, tokens: list, pos: int) -> Result:
return None
def __add__(self, other):
return Concat(self, other)... | Python | 0.000012 | @@ -13,47 +13,8 @@
ng%0A%0A
-from makehex.tools import debug_point%0A%0A
%0Acla
@@ -641,37 +641,8 @@
ag%0A%0A
- @debug_point('Reserved')%0A
@@ -966,32 +966,8 @@
ag%0A%0A
- @debug_point('Tag')%0A
@@ -1307,35 +1307,8 @@
ht%0A%0A
- @debug_point('Concat')%0A
@@ -1816,38 +1816,8 @@
ht%0A%0A
... |
570fe34d591cfa6fd714668d03a581810e7db8f1 | Improve error message when stack config file is not found. | awscfncli/cli/utils/context.py | awscfncli/cli/utils/context.py | # -*- encoding: utf-8 -*-
import logging
import copy
import os.path
from collections import OrderedDict
import boto3
from ...config import load_config, ConfigError
class ContextObject(object):
"""Click context object"""
def __init__(self,
config_file,
stack_selector,
... | Python | 0 | @@ -56,21 +56,16 @@
mport os
-.path
%0Afrom co
@@ -2133,15 +2133,8 @@
nfig
-uration
fil
@@ -2162,16 +2162,26 @@
ecify a
+valid one
'%0A
@@ -2195,37 +2195,25 @@
'
-non-default filename
using
+%22
-f
+%22 option
.'.f
@@ -2237,16 +2237,17 @@
_file))%0A
+%0A
|
f29e177ff039990463ce4af3e08b9df014d4542c | put output files in a separate dir and tar from there | jobslave/generators/raw_fs_image.py | jobslave/generators/raw_fs_image.py | #
# Copyright (c) 2004-2007 rPath, Inc.
#
# All Rights Reserved
#
import os
import tempfile
from jobslave.generators import bootable_image, constants
from jobslave.filesystems import sortMountPoints
from conary.lib import util, log
class RawFsImage(bootable_image.BootableImage):
def makeBlankFS(self, image, fsT... | Python | 0 | @@ -1285,25 +1285,33 @@
in(self.
+workDir, %22
output
-Dir
+%22
, %22%25s-%25s
@@ -1997,12 +1997,12 @@
+ '.
-tar.
+fs.t
gz')
@@ -2062,30 +2062,52 @@
lf.gzip(
-self.
+os.path.join(self.workDir, %22
output
-Dir
+%22)
, finalI
|
ba824a3fb636d4ad04390c310a6b6fe15655f5ec | Move orphaned comment | aspy/refactor_imports/classify.py | aspy/refactor_imports/classify.py | from __future__ import unicode_literals
import imp
import os.path
class ImportType(object):
__slots__ = ()
FUTURE = 'FUTURE'
BUILTIN = 'BUILTIN'
THIRD_PARTY = 'THIRD_PARTY'
APPLICATION = 'APPLICATION'
__all__ = (FUTURE, BUILTIN, THIRD_PARTY, APPLICATION)
def _pythonpath_dirs():
if 'PY... | Python | 0 | @@ -4133,55 +4133,8 @@
)%0A
- # Relative imports: %60from .foo import bar%60%0A
@@ -4203,16 +4203,63 @@
.FUTURE%0A
+ # Relative imports: %60from .foo import bar%60%0A
elif
|
8e20d2e6fde371fcc85979f0ee0b10a38a19d00b | Remove unused environment variable | tests/util.py | tests/util.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
# self.user = os.getenv('AWS_ACCESS_KEY_ID', None)
# assert self.user, \
# 'Required... | Python | 0.000002 | @@ -205,356 +205,8 @@
f):%0A
- # self.user = os.getenv('AWS_ACCESS_KEY_ID', None)%0A # assert self.user, %5C%0A # 'Required environment variable %60AWS_ACCESS_KEY_ID%60 not found.'%0A # self.password = os.getenv('AWS_SECRET_ACCESS_KEY', None)%0A # assert self.password, %5C%0A ... |
b468faf2bc291b668ea3f32eeabdfa8933cfacac | use rffi.sizeof(rffi.INTPTR_T) instead of checking r_uint.BITS | rupypy/utils/packing/stringpacking.py | rupypy/utils/packing/stringpacking.py | from pypy.rlib.rarithmetic import r_uint
pointerlen = 8 if r_uint.BITS > 32 else 4
def make_string_packer(padding=" ", nullterminated=False):
def pack_string(packer, width):
space = packer.space
try:
string = space.str_w(
space.convert_type(packer.args_w[packer.args_i... | Python | 0.000004 | @@ -8,23 +8,27 @@
py.r
-lib.rarithmetic
+python.lltypesystem
imp
@@ -32,21 +32,19 @@
import r
-_uint
+ffi
%0A%0A%0Apoint
@@ -55,36 +55,34 @@
n =
-8 if r_uint.BITS %3E 32 else 4
+rffi.sizeof(rffi.INTPTR_T)
%0A%0A%0Ad
|
edb6964f456f8168d7ce283514853fa84e95ff7e | Update cycle_gan.py | tensorflow_datasets/image/cycle_gan.py | tensorflow_datasets/image/cycle_gan.py | # coding=utf-8
# Copyright 2019 The TensorFlow Datasets 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 appl... | Python | 0.000003 | @@ -1678,16 +1678,81 @@
sets/%22%0A%0A
+# %22ae_photos%22 : Not added because trainA and trainB are missing.%0A
_DATA_OP
@@ -1764,21 +1764,8 @@
= %5B
-%22ae_photos%22,
%22app
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.