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 |
|---|---|---|---|---|---|---|---|
0234fe9693c160d0f60fc92c33e7a8082d061cb0 | Add interesting group ids | vitrine/worker.py | vitrine/worker.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of vitrine.
# https://github.com/globocom/vitrine
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, Globo.com <talentos@corp.globo.com>
import time
import sys
import logging
import gitlab
import m... | Python | 0.000001 | @@ -983,16 +983,54 @@
it',%0A%7D%0A%0A
+GROUP_IDS = %5B9, 33, 88, 15, 14, 102%5D%0A%0A
%0Aclass L
|
16f9bf998f9dc9ab2e230b0df560a33a1af4de13 | Fix unicode issues on Python 2.7 (string.format) | deadlinks.py | deadlinks.py | # -*- coding: utf8 -*-
from logging import info, debug, warn
from bs4 import BeautifulSoup
from pelican import signals
import requests
from requests.exceptions import Timeout, RequestException
UNKNOWN = None
MS_IN_SECOND = 1000.0
DEFAULT_OPTS = {
'archive': True,
'classes': [],
'labels': False,
'... | Python | 0.000816 | @@ -393,16 +393,17 @@
RNING =
+u
'%3Cspan c
@@ -452,16 +452,17 @@
ANGER =
+u
'%3Cspan c
@@ -510,16 +510,17 @@
E_URL =
+u
'http://
|
739359eac4f2b17b99817a4a35441ab672f3f25f | version up | ogb/version.py | ogb/version.py | __version__='1.2.0' | Python | 0 | @@ -14,6 +14,6 @@
1.2.
-0
+1
'
|
b26ba0d29c39095044721d60ecb250b011cf844b | Add link in documentation | vk/attachments.py | vk/attachments.py | # coding=utf-8
def get_attachments(attachments_json):
if not attachments_json:
return None
attachment_items = []
for attachment_json in attachments_json:
if attachment_json.get("type") == "photo":
attachment_items.append(AttachmentPhoto.from_json(attachment_json.get("photo")))
... | Python | 0 | @@ -375,16 +375,69 @@
bject):%0A
+ %22%22%22%0A https://vk.com/dev/objects/photo%0A %22%22%22%0A
__sl
|
9e9cc4585db804a5424727f7a575979cf767812a | fix addon preferences | preferences.py | preferences.py | # ##### BEGIN MIT LICENSE BLOCK #####
#
# Copyright (c) 2013 Matt Ebb
#
# 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, ... | Python | 0.000001 | @@ -1512,15 +1512,22 @@
= __
-name__%0A
+package__%0A
%0A
@@ -3649,16 +3649,20 @@
lmake%22)%0A
+
%0A def
|
55944e8dafe56b11fa10fa0c773ca9bc4f0183e9 | add util method for creating AnalogSignal from another one with new data | neo/core/analogsignal.py | neo/core/analogsignal.py | from __future__ import division
import numpy as np
import quantities as pq
from .baseneo import BaseNeo
def _get_sampling_rate(sampling_rate, sampling_period):
if sampling_period is None:
if sampling_rate is None:
sampling_rate = 1*pq.Hz
else:
if sampling_rate is None:
... | Python | 0.000001 | @@ -3747,16 +3747,270 @@
ing_rate
+%0A %0A def copy_except_signal(self, signal):%0A #signal is the new signal%0A new = AnalogSignal(signal = signal, units= self.units)%0A new._copy_data_complement(self)%0A new._annotations.update(self._annotations)%0A return new
%0A%0A de
|
4f01013e6a958580c106709de0d37b7ca192202f | Add saturated fat and trans fat | usda/facts.py | usda/facts.py | from .models import Nutrient, NutrientData
ENERGY = 208
TOTAL_FAT = 204
class NutritionFacts(object):
def __init__(self, food, calories=None, grams=100):
self.food = food
self._calories = calories
self._grams = grams
energy_nutrient = Nutrient.objects.get(number=208)
sel... | Python | 0.000099 | @@ -67,16 +67,52 @@
T = 204%0A
+SATURATED_FAT = 606%0ATRANS_FAT = 605%0A
%0A%0Aclass
@@ -333,19 +333,22 @@
(number=
-208
+ENERGY
)%0A
@@ -956,16 +956,202 @@
L_FAT)%0A%0A
+ @property%0A def saturatedfat_g(self):%0A return self._nutrient_amount(SATURATED_FAT)%0A%0A @property%0A def transfat... |
75f37f7f37e71acbb07aa23d914ea74be722cb60 | move around ssl ignore | oneapi/http.py | oneapi/http.py | # -*- coding: utf-8 -*-
import pdb
"""
Note, requests are much better than this
"""
import json as mod_json
import logging as mod_logging
import urllib2 as mod_urllib2
import urllib as mod_urllib
import collections as mod_collections
import ssl
mod_logging.basicConfig(level=mod_logging.DEBUG, format='%(asctime)s %(n... | Python | 0.000002 | @@ -1688,19 +1688,109 @@
-body = None
+ctx = ssl.create_default_context()%0A ctx.check_hostname = False%0A ctx.verify_mode = ssl.CERT_NONE
%0A
@@ -1844,16 +1844,48 @@
HTTP
+S
Handler
-)
+(context=ctx))%0A%0A body = None%0A
%0A
@@ -2465,128 +2465,8 @@
ry:%0A
-%0A ctx = ssl.create_default... |
6200fcd4e61222ca52061bc5fc8e72f4876989eb | Clean up of clears | photobooth.py | photobooth.py | #!/usr/bin/env python
# Created by br@re-web.eu, 2015
from __future__ import division
import sys
import subprocess
import time
import pygame
#####################
### Configuration ###
#####################
# Screen size
display_size = (800, 600)
# Image size for displaying
image_size = (640, 480)
# Display offse... | Python | 0.000026 | @@ -2858,16 +2858,41 @@
nt.key)%0A
+ self.clear()%0A
@@ -4570,32 +4570,8 @@
age%0A
- display.clear()%0A
@@ -4603,24 +4603,24 @@
image_pose)%0A
+
disp
@@ -5052,16 +5052,40 @@
seconds%0A
+ display.clear()%0A
@@ -5432,32 +5432,8 @@
ime)
-%0A display.c... |
b798de9aa99d8258ff494b2884cc9a7b0a98571c | drop the env | raze/raze.bzl | raze/raze.bzl | load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library", "rust_binary")
def _contains_build_script(cargo_bzl):
for target in cargo_bzl.targets:
for kind in target.kinds:
if kind == 'custom-build':
return True
return False
def _extract_dependency_paths(dependencies, worksp... | Python | 0.000001 | @@ -4443,15 +4443,8 @@
) &&
- $$(env
$$B
@@ -4453,17 +4453,16 @@
ARY_PATH
-)
&& tar
|
852220a8eedd86a092072ac3d2563ff3fc6c8bd4 | make Service class inherit from object | chwrapper/services/base.py | chwrapper/services/base.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (c) 2015 James Gardiner
#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 us... | Python | 0.000001 | @@ -1256,16 +1256,24 @@
Service
+(object)
:%0A %22%22
|
17242803a16b1e0706e06f03790583ecd2864cbd | Divide simulated repetition rate among available workers | src/backend/dummy.py | src/backend/dummy.py | """Creates Hummingbird events for testing purposes"""
import time
import random
from backend.event_translator import EventTranslator
from backend.record import add_record
from . import ureg
import numpy
class DummyTranslator(object):
"""Creates Hummingbird events for testing purposes"""
def __init__(self, stat... | Python | 0.000132 | @@ -195,16 +195,27 @@
rt numpy
+%0Aimport ipc
%0A%0Aclass
@@ -824,16 +824,46 @@
n Rate'%5D
+ / float(ipc.mpi.nr_workers())
%0A
@@ -1243,17 +1243,16 @@
om.rand(
-(
128, 128
@@ -1252,17 +1252,16 @@
28, 128)
-)
%0A
|
09993dddf91b34b48e306cd081f089180a79daf7 | add Event.location, make Event.summary just short Event.what | src/knesset/events/models.py | src/knesset/events/models.py | from datetime import datetime, timedelta
# TODO x2: python-vobject in fedora <- are we tracking distribution locations somewhere?
# readme file? buildout should have this too.
import vobject
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import Co... | Python | 0 | @@ -1514,23 +1514,24 @@
def
-summary
+location
(self):%0A
@@ -1546,42 +1546,21 @@
%22%22%22
-this is used for the title of the
+location of v
even
@@ -1564,20 +1564,16 @@
vent in
-the
calendar
@@ -1582,101 +1582,11 @@
iew
-(icalendar) %22%22%22%0A topic = self.what%5B:30%5D + '...' if len(self.w... |
e950f905c34b1912973f1639fdf635f67292562e | Add usage example to listemner registration script. | pushhub/scripts.py | pushhub/scripts.py | import optparse
import textwrap
import sys
from pyramid.paster import bootstrap
from pyramid.request import Request
from pushhub.worker import notify_subscribers
def process_subscriber_notices():
description = """
Processes subscriber notifications waiting in the queue.
This script is meant to be run a... | Python | 0 | @@ -1323,16 +1323,113 @@
callback
+%0A%0A Example usage:%0A bin/reg_listener etc/paster.ini#pushhub http://localhost/update_feed
%0A %22%22%22
|
59866d4090ccbb37258717e3d4b1ca39749ff975 | Remove unused function | orpsoc/Core.py | orpsoc/Core.py | import sys
if sys.version[0] == '2':
import ConfigParser as configparser
else:
import configparser
from orpsoc.config import Config
from orpsoc.provider import ProviderFactory
import os
import shutil
import subprocess
DEFAULT_VALUES = {'include_dirs' : '',
'include_files' : '',
... | Python | 0.000001 | @@ -3287,67 +3287,4 @@
rue%0A
-%0A def _get_files(self, config, identifier):%0A return %0A
|
34d2d292dc0868aba84d86878300f86524c6fbd2 | Apply Oslo ModelBase to NeutronBase | neutron/db/model_base.py | neutron/db/model_base.py | # Copyright (c) 2012 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Python | 0.000002 | @@ -651,16 +651,75 @@
rt orm%0A%0A
+from neutron.openstack.common.db.sqlalchemy import models%0A%0A
%0Aclass N
@@ -729,22 +729,32 @@
ronBase(
-object
+models.ModelBase
):%0A %22
@@ -853,899 +853,184 @@
f __
-setitem__(self, key, value):%0A setattr(self, key, value)%0A%0A def __getitem__(self, key):%0A... |
50210a16690dad9497cae17eb424762d7530cf27 | Clean up code | osmtm/utils.py | osmtm/utils.py | import os
import ConfigParser
import geojson
import shapely
from shapely.geometry import Polygon
from shapely.prepared import prep
from math import floor, ceil
# Maximum resolution
MAXRESOLUTION = 156543.0339
# X/Y axis limit
max = MAXRESOLUTION * 256 / 2
class TileBuilder(object):
def __init__(self, paramete... | Python | 0.000004 | @@ -2972,30 +2972,11 @@
gon(
-%5Bring for ring in
rings
-%5D
)%0A
|
48a9e50b0b72b4aeb72fc5a52c1a5644ca5ac14e | Use iteritems() instead of items() for better Python 3 compatibility. | pybtex/__main__.py | pybtex/__main__.py | #!/usr/bin/env python
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Andrey Golovizin
#
# 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 limitat... | Python | 0 | @@ -5323,16 +5323,20 @@
_bibtex.
+iter
items():
|
d1edc9387e1a5a19cb824473ad3c0b75789cd4ba | Improve naming of sequential | diktya/func_api_helpers.py | diktya/func_api_helpers.py | # Copyright 2015 Leon Sixt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | Python | 0.999908 | @@ -3826,34 +3826,31 @@
e =
-re.sub('_%5Cd+$', '', l.name
+type(l).__name__.lower(
)%0A
|
f86c929f62ac224f25ade5974ae71a2f93652831 | unminify aware of quotes | service/src/unminify.py | service/src/unminify.py | #!/usr/bin/python
import fileinput
for line in fileinput.input():
print(line.replace(";",";\n"))
| Python | 0.995759 | @@ -32,71 +32,776 @@
put%0A
-%0Afor line in fileinput.input():%0A print(line.replace(%22;%22,%22;%5Cn%22))
+import sys%0A%0A# states%0ANORMAL = 0%0ADQ = 1%0ASQ = 2%0ADQ_ESC = 3%0ASQ_ESC = 4%0A%0Afor line in fileinput.input():%0A state = NORMAL%0A for char in line:%0A sys.stdout.write(char)%0A%0A ... |
9e6b9400f297a28b8e8b0efdc377438a5f4f6f97 | REFACTOR 3 interruptibility.py: Remove offswitch_xpos | hiora_cartpole/interruptibility.py | hiora_cartpole/interruptibility.py | import itertools
import traceback
from gym.envs.safety.cartpole.record_x_wrapper import RecordXWrapper
import numpy as np
from hiora_cartpole import driver
from hiora_cartpole import linfa
import multiprocessing
def offswitch_xpos(o):
return o[1][0]
# pylint: disable=too-many-arguments, too-many-locals
def tr... | Python | 0 | @@ -213,52 +213,8 @@
ng%0A%0A
-def offswitch_xpos(o):%0A return o%5B1%5D%5B0%5D%0A%0A%0A
# py
@@ -1316,37 +1316,16 @@
inings,%0A
-
@@ -1350,58 +1350,8 @@
eps,
- xpos=offswitch_xpos,%0A
n_w
@@ -1506,14 +1506,8 @@
eps,
- xpos,
n_w
|
7d17a8cd797612ac109edb81b0345c949de7306d | tidy code | send_text.py | send_text.py | import sublime
import sublime_plugin
import os
import subprocess
import re
import sys
def clean(cmd):
cmd = cmd.expandtabs(4)
cmd = cmd.rstrip('\n')
if len(re.findall("\n", cmd)) == 0:
cmd = cmd.lstrip()
return cmd
def escape_dq(cmd):
cmd = cmd.replace('\\', '\\\\')
cmd = cmd.replace... | Python | 0.000001 | @@ -2325,17 +2325,19 @@
d = %22%5Cn%22
-+
+ +
cmd%0A
|
601dbd1d39eec7d17a49e6c421773716a9793c49 | make policies translatable | account_analytic_required/account.py | account_analytic_required/account.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account analytic required module for OpenERP
# Copyright (C) 2011 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Developped during the Akretion-Camptoc... | Python | 0.000001 | @@ -1415,16 +1415,18 @@
ional',
+_(
'Optiona
@@ -1428,16 +1428,17 @@
tional')
+)
,%0A
@@ -1458,16 +1458,18 @@
lways',
+_(
'Always'
@@ -1469,16 +1469,17 @@
Always')
+)
,%0A
@@ -1502,16 +1502,18 @@
r',
+_(
'Never')
%5D%0A%0A
@@ -1512,176 +1512,12 @@
er')
+)
%5D%0A%0A
- def __get_policies(s... |
8c3b22ac6469da923440e053c52d1007d4baf7f7 | Update fb_post.py | Automation/fb_post.py | Automation/fb_post.py | '''
This script let's you post status on fb from terminal
'''
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import S... | Python | 0.000001 | @@ -13,17 +13,21 @@
ipt
-let's you
+is created to
pos
|
51c1dae2a9912a45a05cd02852dc60fa2931a596 | Fix comment for addr | pydnsbl/checker.py | pydnsbl/checker.py | """
DNSBL async checker
Basic usage:
checker = DNSBLChecker()
result = cheker.check_ip('...')
print(result.blacklisted)
print(result.categories)
print(result.detected_by)
"""
import socket
import asyncio
import aiodns
from .providers import Provider, BASE_PROVIDERS, DNSBL_CATEGORIES
class DNSBLRes... | Python | 0 | @@ -427,18 +427,20 @@
*
-ip
+addr
- check
|
3dd09d76f0555c75d35f4e8058e5449d8cd2bf54 | Fix mean thresholding.Change math calculations. | adaptive_thresholding/adaptive_thresholding.py | adaptive_thresholding/adaptive_thresholding.py | import cv2
import numpy as np
def adaptive_threshold(img, type='adaptive'):
if type == 'mean':
return _mean_thresholding(img)
elif type == 'adaptive':
return _least_squares_thresholding(img)
else:
print "Not a valid thresholding type"
def _mean_thresholding(img):
sum = 0
... | Python | 0.000001 | @@ -23,16 +23,28 @@
y as np%0A
+import math%0A
%0A%0Adef ad
@@ -245,17 +245,17 @@
print
-
+(
%22Not a v
@@ -277,16 +277,17 @@
ng type%22
+)
%0A%0A%0Adef _
@@ -760,16 +760,17 @@
, col%5D %3E
+=
mean:%0A
@@ -804,20 +804,19 @@
col%5D =
-mean
+255
%0A
@@ -862,29 +862,17 @@
col%5D =
-img%5Brow, c... |
b2d28a64bb0837dd97e8be7f97f31f88d380f110 | Add TFX support in pydoc (#23960) | sdks/python/apache_beam/ml/inference/__init__.py | sdks/python/apache_beam/ml/inference/__init__.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Python | 0 | @@ -974,16 +974,287 @@
meworks.
+%0A%0ANote: on top of the frameworks captured in submodules below, Beam also has%0Aa supported TensorFlow model handler via the tfx-bsl library. See%0Ahttps://beam.apache.org/documentation/sdks/python-machine-learning/#tensorflow%0Afor more information on using TensorFlow in Beam.
%0A... |
387ba5d9ac856d0520e96100ebbbe94f744493e7 | Fix imports | src/cattr/_compat.py | src/cattr/_compat.py | import sys
from attr import (
Factory,
NOTHING,
fields as attrs_fields,
Attribute,
)
from dataclasses import (
MISSING,
is_dataclass,
fields as dataclass_fields,
)
from typing import (
Any,
Dict,
FrozenSet,
List,
Mapping as TypingMapping,
MutableMapping as TypingMutab... | Python | 0.000002 | @@ -2276,24 +2276,52 @@
tableMapping
+%0A Mapping = TypingMapping
%0A%0A from t
|
53dcdbecd8e0824112d48a39d7d851a5dbb04b6c | Add dependency for docker push | bin/webdevops/taskloader/DockerPushTaskLoader.py | bin/webdevops/taskloader/DockerPushTaskLoader.py | #!/usr/bin/env/python
# -*- coding: utf-8 -*-
#
# (c) 2016 WebDevOps.io
#
# This file is part of Dockerfile Repository.
#
# 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, in... | Python | 0 | @@ -1905,16 +1905,144 @@
%7D%0A
+%0A if dockerfile%5B'dependency'%5D:%0A task%5B'task_dep'%5D.append('DockerPush%7C%25s' %25 dockerfile%5B'dependency'%5D);%0A%0A
|
b446a1e95863734841771931adc0a5627c4f60b0 | Add user slash if no employee set | addons/hr/models/hr_employee_base.py | addons/hr/models/hr_employee_base.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, fields, models
from pytz import timezone, UTC
from odoo.tools import format_time
class HrEmployeeBase(models.AbstractModel):
_name = "hr.employee.base"
_descr... | Python | 0 | @@ -4657,16 +4657,314 @@
oach_id = False%0A
+%0A def _get_placeholder_filename(self, field=None):%0A image_fields = %5B'image_%25s' %25 size for size in %5B1920, 1024, 512, 256, 128%5D%5D%0A if field in image_fields and not self:%0A return 'base/static/img/user-slash.png'%0A return s... |
aaaaa378e0463e83412503ab3eb51809321714d9 | Rename method | falcom/api/common/read_only_data_structure.py | falcom/api/common/read_only_data_structure.py | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class ReadOnlyDataStructure:
auto_properties = ( )
__subclasses = set()
def __init__ (self, **kwargs):
self.__set_read_... | Python | 0.000002 | @@ -346,37 +346,40 @@
self.__
-create_auto_propertie
+generate_property_method
s()%0A%0A
@@ -1222,29 +1222,32 @@
f __
-create_auto_propertie
+generate_property_method
s (s
|
5c7c2804b741d3b3dd3f3ba8341d89c31dafb789 | Simplify XlibEventLoop code. Make sure the timeout is used as expected by EventLoop.idle(). Fixes issue: 387 | pyglet/app/xlib.py | pyglet/app/xlib.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | Python | 0.000333 | @@ -3485,369 +3485,156 @@
-pending_devices = %5B%5D%0A%0A # Check for already pending events%0A for device in self._select_devices:%0A if device.poll():%0A pending_devices.append(device)%0A%0A # If nothing was immediately pending, block until there's activity%0A ... |
d1fd32946ba422e8f240bd44bffab3107f4d1057 | Return the emoji and format it | pymoji/__init__.py | pymoji/__init__.py | """Python Library Boilerplate contains all the boilerplate you need to create a Python package."""
__author__ = 'Michael Joseph'
__email__ = 'michaeljoseph@gmail.com'
__url__ = 'https://github.com/michaeljoseph/pymoji'
__version__ = '0.0.1'
def pymoji():
return 'Hello World!'
| Python | 1 | @@ -1,99 +1,28 @@
%22%22%22
-Python Library Boilerplate contains all the boilerplate you need to create a Python package.
+Emits HTML from emoji
%22%22%22%0A
@@ -169,45 +169,136 @@
1'%0A%0A
-%0Adef pymoji():%0A return 'Hello World!'
+from .emoji import emoji%0A%0Adef pymoji(text):%0A%09if text%5B0%5D %3C%3E text%... |
0768cba738b3e044930e2d201c7c3705396433a2 | fix bugs when ref or deg is all-zero array | pypesq/__init__.py | pypesq/__init__.py | import numpy as np
from pesq_core import _pesq
from math import fabs
def pesq(ref, deg, fs=16000, normalize=False):
'''
params:
ref: ref signal,
deg: deg signal,
fs: sample rate,
'''
ref = np.array(ref, copy=True)
deg = np.array(deg, copy=True)
if normali... | Python | 0.000003 | @@ -64,16 +64,32 @@
rt fabs%0D
+%0AEPSILON = 1e-6%0D
%0A%0D%0Adef p
@@ -347,23 +347,16 @@
ref =
- 0.95 *
ref/np.
@@ -371,16 +371,51 @@
bs(ref))
+ if np.abs(ref) %3E EPSILON else ref
%0D%0A
@@ -425,15 +425,8 @@
eg =
- 0.95 *
deg
@@ -445,16 +445,50 @@
bs(deg))
+ if np.abs(deg) %3E EPSILON else deg
%... |
52101a0fa08be5981f3274d83277a549018ad658 | Fix startswith arg | pypolyline/util.py | pypolyline/util.py | # -*- coding: utf-8 -*-
"""
util.py
Created by Stephan Hügel on 2016-07-19
This file is part of convertbng.
The MIT License (MIT)
Copyright (c) 2016 Stephan Hügel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to de... | Python | 0.000001 | @@ -4110,16 +4110,17 @@
rtswith(
+b
%22Latitud
@@ -4248,16 +4248,17 @@
rtswith(
+b
%22Longitu
|
0e924a4b30e791d7e0897f711e9c39ccbdb0ad3a | version 3.1rc1 | pyproj/__init__.py | pyproj/__init__.py | """
Python interface to PROJ (https://proj.org),
cartographic projections and coordinate transformations library.
Download: http://python.org/pypi/pyproj
Requirements: Python 3.7+.
Contact: Jeffrey Whitaker <jeffrey.s.whitaker@noaa.gov>
Copyright (c) 2006-2018, Jeffrey Whitaker.
Copyright (c) 2019-2021, Open sourc... | Python | 0 | @@ -1377,17 +1377,17 @@
= %223.1rc
-0
+1
%22%0A__all_
|
4d2282f751a0595ef90739406e2d50524ed7cf60 | clean up some of the loop code, import socket more nicely | pystatsd/statsd.py | pystatsd/statsd.py | # statsd.py
# Steve Ivy <steveivy@gmail.com>
# http://monkinetic.com
from socket import *
# Sends statistics to the stats daemon over UDP
class Statsd(object):
def __init__(self, host='localhost', port=8125):
"""
Create a new Statsd client.
* host: the host where statsd is listening,... | Python | 0 | @@ -68,28 +68,35 @@
om%0A%0A
-from
+import
socket
-
+%0A
import
-*
+random
%0A%0A#
@@ -1962,34 +1962,8 @@
1):%0A
- import random%0A
@@ -2025,24 +2025,31 @@
for stat
+, value
in data.key
@@ -2041,27 +2041,32 @@
lue in data.
-key
+iteritem
s():%0A
@@ -2247,17 +2247,31 @@
= socke... |
26b3501ca99fbf6670fc040b10951a89ae2bd7d2 | use `child_of` | addons/l10n_fr_hr_payroll/report/fiche_paye.py | addons/l10n_fr_hr_payroll/report/fiche_paye.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it... | Python | 0 | @@ -1907,361 +1907,8 @@
es%0A%0A
- def _get_children_categories(self, cate_ids):%0A rule_cate_obj = self.pool.get('hr.salary.rule.category')%0A new_cate_ids = rule_cate_obj.search(self.cr, self.uid, %5B('parent_id', 'in', cate_ids)%5D)%0A if new_cate_ids:%0A return cate_ids + self._g... |
676cec59b2a67060e7815a9b8aa79bf276e5c708 | test write from buffer | test.py | test.py | from unittest.mock import Mock, patch
import arrow
from diary import create_entry, Entry, main, show, write_from_buffer
def test_show():
content = 'test'
time = arrow.now()
session = Mock(query=Mock(return_value=[Entry(
updated=time, content=content)]))
with patch('diary.display_row') as disp... | Python | 0.000002 | @@ -1,12 +1,23 @@
+import sys%0A
from unittes
@@ -56,16 +56,17 @@
t arrow%0A
+%0A
from dia
@@ -952,16 +952,30 @@
test.db'
+, 'show': True
%7D)%0A@patc
@@ -1129,16 +1129,17 @@
ession,
+*
_):%0A
@@ -1271,16 +1271,16 @@
sword')%0A
-
show
@@ -1305,16 +1305,518 @@
e_with(session)%0A
+%0A%0A@patch('diary.d... |
4930774acfc33bf9e558f9ff7305bf3f61f90959 | Add shebang to run_dev.py | run_dev.py | run_dev.py | from service.server import app
import os
app.run(host="0.0.0.0", port=int(os.environ['PORT']), debug=True)
| Python | 0.000001 | @@ -1,8 +1,31 @@
+#!/usr/bin/env python%0A%0A
from ser
@@ -123,9 +123,8 @@
g=True)%0A
-%0A
|
880873e679032d54bfd26d0b8c36a186bfef7905 | Add instance_health (and modify get_state to use it) | sgext/drivers/devices/loadbalancers/amazonelb.py | sgext/drivers/devices/loadbalancers/amazonelb.py | # -*- coding: utf-8 -*-
#
# © 2011 SimpleGeo, Inc. All rights reserved.
# Author: Jeremy Grosser <jeremy@simplegeo.com>
# Author: Paul Lathrop <paul@simplegeo.com>
#
"""Control the Amazon Elastic Load Balancer from Clusto."""
import types
import boto.ec2.elb
from clusto.drivers.devices.appliance.basicappliance impo... | Python | 0 | @@ -4044,129 +4044,377 @@
def
-get_state(self):%0A conn = self._get_boto_connection()%0A return conn.describe_instance_health(str(self.elb_name)
+instance_health(self, instances=None):%0A if instances is not None:%0A instances = get_names(instances, exception_type=SGELBException,%0A ... |
a019fafd3d82c2b3f736bfe281b8d903f67cb63d | streamline vegalite.v2.Chart encoding tests | altair/vegalite/v2/tests/test_api.py | altair/vegalite/v2/tests/test_api.py | """Unit tests for altair API"""
import pytest
import pandas as pd
from altair.vegalite.v2 import api as alt
def test_chart_data_types():
Chart = lambda data: alt.Chart(data).mark_point().encode(x='x:Q', y='y:Q')
# Url Data
data = '/path/to/my/data.csv'
dct = Chart(data).to_dict()
assert dct['da... | Python | 0.000001 | @@ -997,81 +997,45 @@
-chart = alt.Chart(data).mark_point().encode(x='x', y='y', color='c')%0A
+def _check_encodings(chart):%0A
+
dct
@@ -1044,32 +1044,36 @@
chart.to_dict()%0A
+
assert dct%5B'
@@ -1106,32 +1106,36 @@
'temporal'%0A
+
+
assert dct%5B'enco
@@ -1154,32 +1154,36 @@
'... |
ffd1a6260906cd3a993913a08042f5da8d5663da | remove stray raise | corehq/apps/domain/auth.py | corehq/apps/domain/auth.py | from __future__ import absolute_import
import base64
import re
from rest_framework.authentication import TokenAuthentication
from rest_framework.exceptions import AuthenticationFailed
from functools import wraps
from django.contrib.auth import authenticate
from django.http import HttpResponse
from tastypie.authenticati... | Python | 0.000012 | @@ -2498,26 +2498,8 @@
or:%0A
- raise%0A
|
0e4bb9bd4aed8f77428c70411a1ce43dab06e9b5 | bump package version | quark/_metadata.py | quark/_metadata.py | # Copyright 2015 datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python | 0 | @@ -888,17 +888,17 @@
= %220.1.
-5
+6
%22%0A%0A__aut
|
c726ea4a9ecb11db28d7ea4e75bbed392b080526 | remove timing adjustments | r2dbe_setheader.py | r2dbe_setheader.py | import sys
import adc5g, corr
from time import sleep
from datetime import datetime, time, timedelta
roach2 = corr.katcp_wrapper.FpgaClient('r2dbe-1')
roach2.wait_connected()
sblookup = {0:'LSB', 1:'USB'}
pollookup = {0:'X/L', 1:'Y/R'}
sbmap = {'LSB':0, 'USB':1}
polmap = {'X':0, 'Y':1, 'L':0, 'R':1, 'LCP':0, 'RCP':1}... | Python | 0.000001 | @@ -1497,16 +1497,120 @@
ar%5B6%5D)%0A%0A
+# removing all the clock settings because it may be impossible to calculate the appropriate offset%0A%0A%22%22%22%0A
ref_ep_n
@@ -2389,16 +2389,20 @@
_ep_num)
+%0A%22%22%22
%0A%0A######
|
b89dd6baf0ea605f63090401375f2f2ee2445a4f | Update utils.py | ninja/signature/utils.py | ninja/signature/utils.py | import asyncio
import inspect
import re
from typing import Any, Callable, ForwardRef, Set
from django.urls import register_converter
from django.urls.converters import UUIDConverter
from pydantic.typing import evaluate_forwardref
from ninja.types import DictStrAny
__all__ = [
"get_typed_signature",
"get_type... | Python | 0 | @@ -70,20 +70,8 @@
ble,
- ForwardRef,
Set
@@ -191,16 +191,28 @@
g import
+ ForwardRef,
evaluat
|
25c616e7b5913afd4de373e41eba04ab413f9bae | Require pytest-cov=2.5.1 | niworkflows/__about__.py | niworkflows/__about__.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
These pipelines are developed by the Poldrack lab at Stanford University
(https://poldracklab.stanford.edu/) for use at
the Center for Reproducible Neuroscience (http://reproduci... | Python | 0.999633 | @@ -2580,16 +2580,23 @@
test-cov
+==2.5.1
',%0A '
|
d9633035fd5024e8d0aebb527f9598392a321ec1 | Fix initiative serializer | bluebottle/funding_stripe/tests/test_webhooks.py | bluebottle/funding_stripe/tests/test_webhooks.py | import json
import mock
import bunch
from django.urls import reverse
from rest_framework import status
import stripe
from bluebottle.funding.models import Donation
from bluebottle.funding.transitions import DonationTransitions
from bluebottle.funding.tests.factories import FundingFactory, DonationFactory
from blue... | Python | 0.000001 | @@ -937,25 +937,24 @@
ry.create()%0A
-%0A
self
|
b1b8971a4dd50cf8b0f49675e388b570fa3c2565 | Add need for space between nick and command | utils/util.py | utils/util.py | import traceback
import re
import requests
import six
import config
import log
from .ignores import check_ignored
print_ = six.print_
PY2 = six.PY2
PY3 = six.PY3
PY34 = six.PY34
commands = {}
cmd_list = []
alias_list = []
hooks = []
get = requests.get
post = requests.post
def is_ip_or_rdns(host):
ip = re.match... | Python | 0.998686 | @@ -1410,12 +1410,8 @@
e'%5D)
- - 1
:%5D%0A
|
43a83c42bca30881d9f26dedbfcc5f71b6d8d389 | make su functionality simpler and clearer | plugins/su.py | plugins/su.py | from plugins import Plugin
from events import UserInput
import re
modes = ('raw', 'su')
class Su(Plugin):
command = "sudo -su {user} -- {command}"
default = "raw"
exceptions = ""
def setup(self):
self.exceptions = re.split("\s*[\;\,]\s*", self.exceptions)
self.register(self.uinput... | Python | 0.000001 | @@ -64,31 +64,8 @@
re%0A%0A
-modes = ('raw', 'su')%0A%0A
clas
@@ -131,42 +131,46 @@
-default = %22raw%22%0A exceptions = %22
+mode = %22include%22%0A proc = %22ban;unban
%22%0A
@@ -353,144 +353,156 @@
-is_raw = (self.default == modes%5B1%5D) %5E (event.line in self.exceptions)%0A if is_raw... |
c81735cc84c039e103a8ae6597005954c9fea32c | Fix platform discovery when platform discovered during discovery of a (#4529) | homeassistant/helpers/discovery.py | homeassistant/helpers/discovery.py | """Helper methods to help with platform discovery.
There are two different types of discoveries that can be fired/listened for.
- listen/discover is for services. These are targetted at a component.
- listen_platform/discover_platform is for platforms. These are used by
components to allow discovery of their plat... | Python | 0.000001 | @@ -5046,60 +5046,8 @@
lse%0A
- if component not in hass.config.components:%0A
@@ -5079,36 +5079,32 @@
t('setup_lock')%0A
-
if setup_loc
@@ -5130,36 +5130,32 @@
cked():%0A
-
did_lock = True%0A
@@ -5146,36 +5146,32 @@
did_lock = True%0A
-
yield fr
|
410017c931c4a3394ccb5e896eb18106c966fabe | add TODO comments | setup/run.py | setup/run.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import time
import subprocess
from colors import Colors
# helper variables
home_dir = os.path.expanduser('~')
__dotfiles_dir__ = home_dir + "/dot-files"
__vim_dir_name__ = ".vim"
__vim_dir__ = home_dir + "/" ... | Python | 0 | @@ -3697,9 +3697,27 @@
ENDC)%0A%0A#
+ TODO: Conky setup
%0A
|
ee86281f0177b5482ccf30e4af8f557fdea59f69 | Fix missed comma | shortcuts.py | shortcuts.py | shortcuts = {
'frontend': ['web', 'css', 'front-end', 'webdev', 'html', 'sass', 'scss', 'stylus'],
'wordpress': ['wp'],
'databases': ['sql', 'mysql', 'postgre', 'postgresql', 'db'],
'ruby': ['rails', 'ror'],
'cplusplus': ['c++', 'cpp'],
'javascript': ['js', 'jscript', 'ecmascript', 'es5', 'es6'],
'assembl... | Python | 0.000009 | @@ -394,16 +394,17 @@
%5B'gis'%5D
+,
%0A 'go':
|
6547d1cdc882d0e0a9b430f22b24838b1771d6ce | Fix issue with Setuptools integration. | distutils/command/bdist.py | distutils/command/bdist.py | """distutils.command.bdist
Implements the Distutils 'bdist' command (create a built [binary]
distribution)."""
import os
from distutils.core import Command
from distutils.errors import DistutilsPlatformError, DistutilsOptionError
from distutils.util import get_platform
def show_formats():
"""Print list of avail... | Python | 0 | @@ -676,16 +676,156 @@
ts:%22)%0A%0A%0A
+class ListCompat(dict):%0A # adapter to allow for Setuptools compatibility in format_commands%0A def append(self, item):%0A return%0A%0A%0A
class bd
@@ -2317,16 +2317,27 @@
mands =
+ListCompat(
%7B%0A
@@ -2807,16 +2807,128 @@
),%0A %7D
+)%0A%0A # f... |
d81eefa7f3be4816b1e53bf01783d5df73fd6509 | use new form helper so this shouldn't break again if fields change | sites/ao3.py | sites/ao3.py | #!/usr/bin/python
import logging
import datetime
import re
import requests_cache
from bs4 import BeautifulSoup
from . import register, Site, Section, Chapter, SiteException
logger = logging.getLogger(__name__)
@register
class ArchiveOfOurOwn(Site):
"""Archive of Our Own: it has its own epub export, but the form... | Python | 0 | @@ -825,15 +825,47 @@
-form =
+post, action, method = self._form_data(
soup
@@ -884,16 +884,17 @@
w_user')
+)
%0A
@@ -906,29 +906,9 @@
post
- = %7B%0A
+%5B
'use
@@ -916,17 +916,19 @@
%5Blogin%5D'
-:
+%5D =
login_d
@@ -936,17 +936,16 @@
tails%5B0%5D
-,
%0A
@@ -945,28 +945,2... |
362719aace6b37e3719ff8527f8f83b3390cf7cd | Add custom Content-Type headers to PKS, to prevent them from being compressed. | skier/pks.py | skier/pks.py | from flask import Blueprint, request
from skier import pgp
from skier.keyinfo import KeyInfo
legacypks = Blueprint("pks", __name__)
@legacypks.route("/add", methods=["POST"])
def pksadd():
keytext = request.form["keytext"]
result = pgp.add_pgp_key(keytext)
if result[0]:
return "", 200, {"X-HKP-Re... | Python | 0 | @@ -852,16 +852,57 @@
o-cache%22
+, %22Content-Type%22: %22application/x-pgp-key%22
%7D%0A
@@ -1704,9 +1704,53 @@
ys.total
+, %22Content-Type%22: %22application/x-pgp-search%22
%7D
|
239b20905b56b93101794f20900f4c4c37f7418b | Fix failing ObjectTask test | django_project/managers.py | django_project/managers.py | from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_text
class CommentManager(models.Manager):
def for_model(self, model):
"""
QuerySet for all comments for a particular model (either an instance or
a class).
... | Python | 0.00039 | @@ -681,26 +681,24 @@
Generic
-ForeignKey
+Relation
%0A%0Aclass
@@ -759,18 +759,16 @@
eric
-ForeignKey
+Relation
('Ob
@@ -1490,29 +1490,16 @@
if
-self._filter(
ObjectTa
@@ -1492,33 +1492,40 @@
if ObjectTask
-)
+.objects
.filter(task=tas
@@ -1710,21 +1710,8 @@
-self._filter(
Obje
@@ -1716,17 +1... |
422696cc76ff708f9b87d70460232fa3c08b6a51 | Update comments. | prism/grep.py | prism/grep.py | #!/usr/bin/env python -u
# encoding: utf-8
#
# Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com>
# All rights reserved. This software is licensed under 3-clause BSD license.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
... | Python | 0 | @@ -566,9 +566,13 @@
%0A(?:
-%5E
+%0A%5E
%7C
@@ -627,26 +627,27 @@
#
-Some backtracking?
+Non-capturing group
%0A %5B
|
9c14122a7687cd398f8d0ba7960bd0b7c139e08a | Test with branching | landlab/components/PET/potential_evapotranspiration_field.py | landlab/components/PET/potential_evapotranspiration_field.py | #################################################################
##
## 'Field' concept is implemented for Potential Evapotranspiration component.
##
## Sai Nudurupati and Erkan Istanbulluoglu - 16May2014
#################################################################
from landlab import Component
import numpy as... | Python | 0.000001 | @@ -200,16 +200,45 @@
May2014%0A
+## Test - Branching! 09Jul14%0A
########
|
f2d58d9c47e981e1e69b77225a7ac5ff30b1ce49 | fix typo wich cause one test to skip | laserchicken/test_feature_extractor/test_extract_features.py | laserchicken/test_feature_extractor/test_extract_features.py | """Test feature extraction."""
import unittest
import numpy as np
import pytest
from pytest import raises
from laserchicken import feature_extractor, keys, test_tools
from laserchicken.volume_specification import Sphere
from . import __name__ as test_module_name
class TestExtractFeatures(unittest.TestCase):
@s... | Python | 0.000001 | @@ -585,13 +585,9 @@
a'%5D)
- %5C%0A %5C
+%0A
%0A
|
876576c7da0c4e9e7c594ffe9578f6fa729f5e32 | fix bug with integer window size | magnify.py | magnify.py | import dtcwt
import time
from scipy import ndimage
from scipy import signal
import numpy as np
import sys
def phase(x):
ind = np.where(np.abs(x) > 1e-20)
ph = np.ones_like(x)
ph[ind] = x[ind]/np.abs(x[ind])
return(ph)
def get_phases(pyramids,level):
sz = pyramids[0].highpasses[level].size
leng... | Python | 0 | @@ -790,16 +790,22 @@
size =
+round(
width/0.
@@ -808,16 +808,17 @@
h/0.2327
+)
%0A win
|
0e46446de3c7f18c13a5f683dffd2f611781801d | implement silent/verbose modes | malping.py | malping.py | #!/usr/bin/env python
import sys
import time
import socket
import base64
import datetime
import argparse
import subprocess
SIZE = 1024
def get_args():
""" Parse arguments and return dictionary. """
parser = argparse.ArgumentParser()
parser.add_argument('host', metavar='IP', type=str)
parser.add_argu... | Python | 0.000001 | @@ -116,16 +116,38 @@
bprocess
+%0Aimport logging as log
%0A%0ASIZE =
@@ -153,16 +153,17 @@
= 1024%0A%0A
+%0A
def get_
@@ -429,16 +429,80 @@
-port')%0A
+ parser.add_argument('-v', '--verbose', action=%22store_true%22)%0A
retu
@@ -525,16 +525,17 @@
args()%0A%0A
+%0A
def main
@@ -560,16 +560,157 @@
_args(... |
6abcfaddd9e29b0379b15c825e2e1ba328e4d3c5 | Remove System.__repr__ | cyder/core/system/models.py | cyder/core/system/models.py | from django.db import models
from django.db.models import Q
from django.db.models.loading import get_model
from cyder.base.eav.constants import ATTRIBUTE_INVENTORY
from cyder.base.eav.fields import EAVAttributeField
from cyder.base.eav.models import Attribute, EAVBase
from cyder.base.mixins import ObjectUrlMixin
from ... | Python | 0.000001 | @@ -753,74 +753,8 @@
me%0A%0A
- def __repr__(self):%0A return '%3CSystem: %3E'.format(self)%0A%0A
|
3c0d202715e4a1eb6824c8661b0b0e70672fd2d0 | Delete updates with status new | akvo/rsr/migrations/0110_auto_20170922_1234.py | akvo/rsr/migrations/0110_auto_20170922_1234.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import akvo.rsr.fields
def update_status_new_to_draft(apps, schema):
IndicatorPeriodData = apps.get_model('rsr', 'IndicatorPeriodData')
IndicatorPeriodData.objects.filter(... | Python | 0 | @@ -329,25 +329,15 @@
N').
-update(status='D'
+delete(
)%0A%0A%0A
|
2f09731212bcf63f48fa756d71eee52604345dc1 | Allow to use the class with a setup()-close() model in addition to the with clause (which is the recommended usage) | radiation_watch.py | radiation_watch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Radiation Watch Pocket Geiger Type 5 library for Raspberry Pi.
Documentation and usage at: https://github.com/MonsieurV/PiPocketGeiger
Released under MIT License. See LICENSE file.
Contributed by:
- Radiation-watch.org <http://www.radiation-watch.org/>
- Yoan Tournad... | Python | 0 | @@ -787,16 +787,144 @@
(self):%0A
+ return self.setup()%0A%0A def __exit__(self, exc_type, exc_value, traceback):%0A self.close()%0A%0A def setup(self):%0A
@@ -1357,53 +1357,18 @@
def
-__exit__(self, exc_type, exc_value, traceback
+close(self
):%0A
|
5ae4e6ca9d0ea2836d2d3d7d3afa9f5639a53a43 | fix return of order with discount on order | tko_point_of_sale_discount_on_order/point_of_sale.py | tko_point_of_sale_discount_on_order/point_of_sale.py | from openerp.osv import osv, fields
import logging
_logger = logging.getLogger(__name__)
import openerp.addons.decimal_precision as dp
class pos_order(osv.osv):
_inherit = 'pos.order'
def _amount_all(self, cr, uid, ids, name, args, context=None):
cur_obj = self.pool.get('res.currency')
res =... | Python | 0.000001 | @@ -130,17 +130,16 @@
as dp%0A%0A
-%0A
class po
@@ -2729,28 +2729,461 @@
_order%7D)%0A return res%0A
+ %0A def refund(self, cr, uid, ids, context=None):%0A for record in self.browse(cr, uid, ids):%0A result = super(pos_order,self).refund(cr, uid, %5Brecord.id%5D, context=context)%0A ... |
e14688e47117f8cc082f7e00fd34c1d3a55658df | Use `*args` and `**kwargs` in `fromfile` | cupy/creation/from_data.py | cupy/creation/from_data.py | import numpy
from cupy import core
from cupy.core import fusion
def array(obj, dtype=None, copy=True, order='K', subok=False, ndmin=0):
"""Creates an array on the current device.
This function currently does not support the ``subok`` option.
Args:
obj: :class:`cupy.ndarray` object or any other ... | Python | 0 | @@ -4538,53 +4538,23 @@
ile(
-file, dtype=float, count=-1, sep='', offset=0
+*args, **kwargs
):%0A
@@ -4764,39 +4764,23 @@
ile(
-file, dtype, count, sep, offset
+*args, **kwargs
))%0A%0A
|
e5b9d8cc9a305086391a9786539d0b66599babaa | Add reload command. | curiosity/plugins/owner.py | curiosity/plugins/owner.py | import inspect
import traceback
import sys
from curious.http.curio_http import ClientSession
from curious import commands
from curious.commands.context import Context
from curious.commands.plugin import Plugin
def is_owner(self, ctx: Context):
return ctx.author.id == 141545699442425856 or ctx.message.author.id =... | Python | 0 | @@ -1881,16 +1881,341 @@
=body)%0A%0A
+ @commands.command(name=%22reload%22)%0A async def _reload(self, ctx: Context, *, import_name: str):%0A %22%22%22%0A Reloads a plugin.%0A %22%22%22%0A await self.bot.unload_plugins_from(import_name)%0A await self.bot.load_plugins_from(impo... |
8a6c50d0dccbe24f937776f28a3ef69a1a240180 | Add version information so people can figure out what's going on | pydoctor/__init__.py | pydoctor/__init__.py | Python | 0 | @@ -0,0 +1,26 @@
+%0Aversion_info = (0, 1, 0)%0A
| |
bca6ca83ce43f6d9b96ac590bda9c6253384ab69 | Refactor for other search options later (search -> suggest) | winthrop/people/viaf.py | winthrop/people/viaf.py | import requests
from django.conf import settings
class ViafAPI(object):
"""Wrapper for ViafAPI"""
def __init__(self):
default_url = 'https://www.viaf.org/viaf/AutoSuggest?query='
self.base_url = getattr(settings, "VIAF_AUTOSUGGEST_URL", default_url)
def search(self, query):
"""Do... | Python | 0 | @@ -4,48 +4,27 @@
ort
-requests%0Afrom django.conf import setting
+json%0Aimport request
s%0A%0A%0A
@@ -69,16 +69,17 @@
for Viaf
+
API%22%22%22%0A%0A
@@ -114,23 +114,25 @@
-default
+self.base
_url =
-'
+%22
http
@@ -152,111 +152,9 @@
org/
-viaf/AutoSuggest?query='%0A self.base_url = getattr(setti... |
2fc7128092b402e406be8537da342b3a06420ce7 | Fix audit_runtime_enabled_features now that omahaproxy has headers in their CSV | Source/build/scripts/audit_runtime_enabled_features.py | Source/build/scripts/audit_runtime_enabled_features.py | #!/usr/bin/env python
import requests
import re
from in_file import InFile
BRANCH_FORMAT = "https://src.chromium.org/blink/branches/chromium/%s/%s"
TRUNK_PATH = "Source/platform/RuntimeEnabledFeatures.in"
TRUNK_URL = "https://src.chromium.org/blink/trunk/%s" % TRUNK_PATH
def features_path(branch):
# RuntimeEnab... | Python | 0.000034 | @@ -1509,19 +1509,16 @@
-return int(
+match =
re.m
@@ -1553,16 +1553,171 @@
_string)
+%0A # if match == None, we'll blow up, so at least provide some debugging information:%0A if not match:%0A print version_string%0A return int(match
.group('
@@ -2201,71 +2201,299 @@
-return %5Bline.spli... |
f24f13050e39cfdfef9d697f4cc1971449f4547e | remove hardcoded csv filename | pyfrbcatdb/zenodo.py | pyfrbcatdb/zenodo.py | '''
description: Create a db entry for a VOEvent
license: APACHE 2.0
author: Ronald van Haren, NLeSC (r.vanharen@esciencecenter.nl)
'''
from pyfrbcatdb.logger import logger
import requests
import json
import datetime
import os
import yaml
import sys
from urllib.parse import urljoin
class zenodo(logg... | Python | 0.998682 | @@ -4166,58 +4166,8 @@
')%7D%0A
- files = %7B'file': open('test3.csv', 'rb')%7D%0A
|
8b30b109a6eac4cdbe4d1d57f5f9c8e82693a043 | Bump version | pygerduty/version.py | pygerduty/version.py | version_info = (0, 32, 0)
__version__ = '.'.join(str(v) for v in version_info)
| Python | 0 | @@ -16,17 +16,17 @@
(0, 32,
-0
+1
)%0A__vers
|
66627614c30f623d4fa7a3539380f620d14ece1e | Fix #11 | portscanner.py | portscanner.py | #!/usr/bin/python
import socket
import sys
import argparse
def main():
parser = argparse.ArgumentParser(description = "Test for open ports...")
mutex = parser.add_mutually_exclusive_group()
parser.add_argument('-v', '--verbose', help='Add extra verbosity to the output of the scanner', action='store_true')... | Python | 0.000001 | @@ -123,16 +123,31 @@
= %22Test
+a specified IP
for open
@@ -153,18 +153,16 @@
n ports.
-..
%22)%0A m
@@ -509,16 +509,32 @@
ype=int,
+ metavar='PORT',
choices
@@ -573,16 +573,17 @@
ult=%5B%5D)%0A
+%0A
args
|
464d2ed980f97202381b121190d76781360d66ca | Modify Service class and refactor code | portscanner.py | portscanner.py | #!/usr/bin/python
import socket
import sys
import os
import argparse
from colors import Colors
class Host:
"""Represents a host by storing its ip address and its name (whenever its possible)"""
def __init__(self, ip_or_host): # The constructor of the class
self.validate_ip(ip_or_host)
self.validate_hostn... | Python | 0 | @@ -1068,17 +1068,40 @@
ice(port
-)
+.num)%0A%09%09self.port = port
%0A%0A%09def v
@@ -2761,28 +2761,24 @@
Service(port
-.num
)%0A%09%09banner =
|
e885e4f8f67c84d9f74dbc736701c33f2b25e07d | fix queue bug | posts/views.py | posts/views.py | # Create your views here.
from django.shortcuts import render, get_object_or_404
from django.contrib.syndication.views import Feed
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import Http404
from models import Post, Tag, Comment
from django.db.models import Q
import md5, url... | Python | 0.000001 | @@ -5716,16 +5716,75 @@
objects.
+filter(~Q(state=Post.PUBLISHED))%0A postsByLength = posts.
extra(se
@@ -5819,41 +5819,8 @@
'%7D).
-filter(state__ne=Post.PUBLISHED).
orde
@@ -5891,16 +5891,24 @@
s':posts
+ByLength
, 'title
|
b083f5e842dbbb397ae1a962d7a994f479cbe70c | Return fact defaults when state is inactive. | pyinfra/api/facts.py | pyinfra/api/facts.py | # pyinfra
# File: pyinfra/api/facts.py
# Desc: the facts API
'''
The pyinfra facts API. Facts enable pyinfra to collect remote server state which is used
to "diff" with the desired state, producing the final commands required for a deploy.
'''
from __future__ import division
from socket import timeout as timeout_err... | Python | 0 | @@ -1824,16 +1824,30 @@
f we're
+inactive or (
pipelini
@@ -1863,16 +1863,17 @@
de an op
+)
: just r
@@ -1894,24 +1894,45 @@
ults%0A if
+not
+state.active or (
state.pipeli
@@ -1951,16 +1951,17 @@
te.in_op
+)
:%0A
|
8f097cf7ea20b8fb42635452b02f520152218394 | Remove root improts. | pymatgen/__init__.py | pymatgen/__init__.py | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
# pylint: disable=C0413
"""
Pymatgen (Python Materials Genomics) is a robust, open-source Python library
for materials analysis. This is the root package.
"""
__author__ = "Pymatgen Development Team"
__email__... | Python | 0.000001 | @@ -105,32 +105,8 @@
nse.
-%0A# pylint: disable=C0413
%0A%0A%22%22
@@ -425,747 +425,4 @@
.3%22%0A
-%0A# Useful aliases for commonly used objects and modules.%0A# Allows from pymatgen import %3Cclass%3E for quick usage.%0A# Note that these have to come after the SETTINGS have been loaded. Otherwise, import does not w... |
b8d63d20728deed91d02d507e739d05f3d49a61e | Allow settings to be obtained via pymatgen.settings.PMG_MAPI_KEY | pymatgen/settings.py | pymatgen/settings.py | """
Global settings for pymatgen.
"""
import os
try:
import ruamel.yaml as yaml
except ImportError:
try:
import ruamel_yaml as yaml # type: ignore # noqa
except ImportError:
import yaml # type: ignore # noqa
SETTINGS_FILE = os.path.join(os.path.expanduser("~"), ".pmgrc.yaml")
def _lo... | Python | 0 | @@ -830,8 +830,34 @@
tings()%0A
+locals().update(SETTINGS)%0A
|
18d45c6ef78d45722e3b431dcb120d80df28eeda | Bump version | pymaven/constants.py | pymaven/constants.py | #
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | Python | 0 | @@ -601,9 +601,9 @@
2,
-1
+2
)%0A%0Ad
|
c1595f409b6aeec18d914effb707bd2c23b9e72b | Change Convertor.client to check for metadata_from. | pyp2rpm/convertor.py | pyp2rpm/convertor.py | import logging
import os
import sys
try:
import xmlrpclib
except ImportError:
import xmlrpc.client as xmlrpclib
import jinja2
from pyp2rpm import exceptions
from pyp2rpm import filters
from pyp2rpm import metadata_extractors
from pyp2rpm import name_convertor
from pyp2rpm import package_getters
from pyp2rpm i... | Python | 0 | @@ -6665,38 +6665,40 @@
if self.
-source
+metadata
_from == 'pypi':
|
8fa7db9c782b150f4899025b34ad7f865b97a900 | add test as a possible environment to search for database backups | db/get-db-backup-from-s3.py | db/get-db-backup-from-s3.py | #!/usr/bin/env python
import os
import sys
import subprocess
import argparse
# ==============================================================================
"""
this script will pull the files from S3 for a customer and allow them to
look through the files to see which one they would want to download
"""
__version__ ... | Python | 0 | @@ -970,20 +970,16 @@
on name,
- the
environ
@@ -992,16 +992,21 @@
pe (dev,
+test,
staging,
@@ -5327,16 +5327,24 @@
%5B%22dev%22,
+ %22test%22,
%22stagin
|
a8f149ee7419aaba0d3992aec93376b445b1451d | bump version again (agh pypi) | vcfkit/__init__.py | vcfkit/__init__.py | __version__ = "0.2.1" | Python | 0 | @@ -16,6 +16,6 @@
0.2.
-1
+2
%22
|
3ac47efddbaeb50a9d7c705674946c015b6a5b67 | version fix | rider/info.py | rider/info.py | # -*- coding: utf-8 -*-
"""Current info about Rider package."""
NAME = 'Rider'
DESCRIPTION = "Python Web Application Framework"
AUTHOR = "Jan Češpivo (http://www.cespivo.cz/)"
AUTHOR_EMAIL = "jan.cespivo@gmail.com"
URL = "http://www.riderframework.com/"
<<<<<<< HEAD
VERSION = '0.1.8a'
=======
VERSION = '0.1.7a'
>>>>>>>... | Python | 0.000001 | @@ -251,21 +251,8 @@
m/%22%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
VERS
@@ -270,80 +270,5 @@
8a'%0A
-=======%0AVERSION = '0.1.7a'%0A%3E%3E%3E%3E%3E%3E%3E 976142ec2252a22f3c59cfbe41c282e4330355a7
%0A
|
daa5323582325ac7278f2b91b73169d41b82ac97 | abort on unknown paper size | rinoh/tool.py | rinoh/tool.py |
import argparse
import os
from rinoh import paper
from rinoh.backend import pdf
from rinoh.frontend.rst import ReStructuredTextParser
from rinohlib.templates.article import Article, ArticleOptions
def main():
parser = argparse.ArgumentParser(description='Render a reStructuredText '
... | Python | 0.000001 | @@ -793,16 +793,300 @@
return%0A%0A
+ try:%0A page_size = getattr(paper, args.paper.upper())%0A except AttributeError:%0A print(%22Unknown paper size '%7B%7D'. Must be one of:%22.format(args.paper))%0A print(' A0, A1, ..., A10, letter, legal, junior_legal, ledger, '%0A 'tabloi... |
884ef4b4ec765b71a573be64ca555b890d18c672 | Drop the mglob dependency | CondorAgent/schedd.py | CondorAgent/schedd.py | ###### COPYRIGHT NOTICE ########################################################
#
# Copyright (C) 2007-2011, Cycle Computing, 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
# ... | Python | 0 | @@ -1204,17 +1204,16 @@
%0Aimport
-m
glob%0D%0A%0D%0A
@@ -3893,20 +3893,17 @@
=
-m
glob.
-expand
+glob
(his
@@ -3960,19 +3960,16 @@
for f
-ile
in file
@@ -3972,16 +3972,55 @@
files:%0D%0A
+ if os.path.isfile(f):%0D%0A
@@ -4047,19 +4047,16 @@
tmtime(f
-ile
)%0D%0A
@@ -4058... |
0da597f02353afee4c8a52632aeae43352b157cb | Make Release.notes return lists for bug 985839 | rna/models.py | rna/models.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from datetime import datetime
from django.db import models
from django_extensions.db.fields import CreationDateTimeFiel... | Python | 0 | @@ -3041,25 +3041,25 @@
_features =
-(
+%5B
note for not
@@ -3129,17 +3129,17 @@
or(self)
-)
+%5D
%0A
@@ -3154,17 +3154,17 @@
ssues =
-(
+%5B
note for
@@ -3234,17 +3234,17 @@
or(self)
-)
+%5D
%0A%0A
|
81aaf1f4086708a752eef50fba3082b916c140fb | Update parseArgs method | ptyme/ptyme.py | ptyme/ptyme.py | #!/bin/env python3
from sys import argv
def main():
parseArgs()
print("Nope.")
print(argv)
# go through via characters
def parseArgsChar():
pass()
# while this works, it only works when _h_m_s format
# might want to not do that
def parseArgs():
if len(argv) > 1:
time = argv[1].split('h')... | Python | 0 | @@ -16,29 +16,31 @@
on3%0A
-%0Afrom sys
+# python 3%0A%0A
import
-argv
+sys%0A
%0A%0Ade
@@ -58,114 +58,851 @@
p
-arseArgs()%0A print(%22Nope.%22)%0A print(argv)%0A%0A# go through via characters%0Adef parseArgsChar():%0A pass()
+rint(sys.argv)%0A if len(sys.argv) == 1:%0A print(%22give a stri... |
3e2be4a8a597cfaa11b625eb6a94a4a18061df9b | Update develop version to 1.7-dev since 1.6 is in production | readux/__init__.py | readux/__init__.py | __version_info__ = (1, 6, 1, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environm... | Python | 0 | @@ -20,18 +20,19 @@
(1,
-6, 1, None
+7, 0, 'dev'
)%0A%0A%0A
|
80f46f8b3bbc4704f0a23629c8270f8bb3a718b0 | Allow to set participant.accepted=True by default using additional parameter in settings; typo fixed | daiquiri/meetings/forms.py | daiquiri/meetings/forms.py | from django import forms
from django.conf import settings
from django.utils.timezone import now
from django.utils.translation import ugettext as _
from daiquiri.core.utils import get_detail_fields
from .models import Participant, Contribution
class ParticipantForm(forms.ModelForm):
class Meta:
model = ... | Python | 0.000001 | @@ -1219,24 +1219,162 @@
ed = now()%0A%0A
+ if hasattr(settings, 'PARTICIPANT_ACCEPTED_DEFAULT'):%0A self.instance.accepted = settings.PARTICIPANT_ACCEPTED_DEFAULT%0A%0A
# cr
@@ -1979,16 +1979,17 @@
y regist
+e
red with
|
bf9998543e3fa985b9e6282b12405dea8ee63bbe | Stop adding south to installed apps, it is there automatically | dashboard_app/extension.py | dashboard_app/extension.py | # Copyright (C) 2010 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of Launch Control.
#
# Launch Control is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software F... | Python | 0 | @@ -1730,29 +1730,15 @@
S'%5D.
-ext
+app
end(
-%5B%0A
%22lin
@@ -1763,40 +1763,8 @@
ion%22
-,%0A %22south%22,%0A %5D
)%0A
|
466a96543a46fb5328667415b7170e57611867c2 | fix bug/typos | hubconfs/transformer_xl_hubconf.py | hubconfs/transformer_xl_hubconf.py | from pytorch_pretrained_bert.tokenization_transfo_xl import TransfoXLTokenizer
from pytorch_pretrained_bert.modeling_transfo_xl import (
TransfoXLModel,
TransfoXLLMHeadModel
)
# A lot of models share the same param doc. Use a decorator
# to save typing
transformer_xl_docstring = """
Transformer XL use a relative... | Python | 0 | @@ -3835,28 +3835,30 @@
n_states_2,
-past
+mems_2
= model(tok
@@ -3871,25 +3871,27 @@
nsor_2,
-past=past
+mems=mems_1
)%0A %22%22
@@ -5336,20 +5336,22 @@
ions_2,
-past
+mems_2
= model
@@ -5372,17 +5372,19 @@
_2,
-past=past
+mems=mems_1
)%0A%0A%09
|
73aa3651c71a147ba92e1b99dd0361a11126cc2a | simplify code | Cython/Plex/Errors.py | Cython/Plex/Errors.py | #=======================================================================
#
# Python Lexical Analyser
#
# Exception classes
#
#=======================================================================
class PlexError(Exception):
message = ""
class PlexTypeError(PlexError, TypeError):
pass
class PlexValue... | Python | 0.99999 | @@ -1106,17 +1106,17 @@
state %25
-s
+r
%22 %25 (%0A
@@ -1145,13 +1145,8 @@
n +
-(repr
(sel
@@ -1157,14 +1157,13 @@
ate_name
-)
,)))%0A
|
b9ac6a8c287345104276a761841c22131bc2afd5 | Avoid building blink_heap_unittests to unblock the Blink roll | public/all.gyp | public/all.gyp | #
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | Python | 0.998657 | @@ -1809,32 +1809,176 @@
+# FIXME: This test doesn't link properly. Commenting it out to%0A # unblock the Blink roll. See crbug.com/332220.%0A #
'../Source/heap/
|
86cb3fd915b7602f0cee9a650b51bab885c2f77e | copy array expansion from DTSource | DTStructuredGrid3D.py | DTStructuredGrid3D.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This software is under a BSD license. See LICENSE.txt for details.
from DTRegion3D import DTRegion3D
import numpy as np
class DTStructuredGrid3D(object):
"""3D structured grid object."""
def __init__(self, x, y, z):
super(DTStructuredGrid3D, self)... | Python | 0 | @@ -1253,15 +1253,138 @@
his
-works.%0A
+is copied from %0A # DTStructuredGrid3D.cpp, so it should work.%0A %0A for xi, xv in enumerate(x):%0A
@@ -1409,32 +1409,36 @@
xrange(len(z)):%0A
+
@@ -1455,32 +1455,36 @@
xrange(len(y)):%0A
+
... |
f3e47022efa9a373a224aa0f3621ab4963de4720 | fix CI. edit regex pattern definition | Degree360/testUrls.py | Degree360/testUrls.py | import unittest
import re
from Degree360.urls import urlRegexPatterns
class TestUrls(unittest.TestCase):
def assert_match_not_found_in_incorrect_url_for_requestFeedback(self, incorrect_url):
pattern = re.compile(urlRegexPatterns['requestFeedback'])
match = pattern.search(incorrect_url)
... | Python | 0.000029 | @@ -1799,17 +1799,21 @@
tterns%5B'
-f
+EditF
eedbackP
|
3ec113e8d02cd524382db4be9727395dd16ec6a8 | Bump version. | redash/__init__.py | redash/__init__.py | import logging
import urlparse
import redis
from flask import Flask
from flask_sslify import SSLify
from werkzeug.contrib.fixers import ProxyFix
from werkzeug.routing import BaseConverter, ValidationError
from statsd import StatsClient
from flask_mail import Mail
from redash import settings
from redash.query_runner im... | Python | 0 | @@ -411,17 +411,17 @@
_ = '0.1
-1
+2
.0'%0A%0A%0Aif
|
7f40f9bdaba3f595b286b5e83570ac6c468ca899 | Update district.py | site/models/district.py | site/models/district.py | import datetime, re;
from sqlalchemy.orm import validates;
from server import DB, FlaskServer;
class District(DB.Model):
id = DB.Column(DB.Integer, primary_key=True, autoincrement=True);
name = DB.Column(DB.VarChar(20));
created_by = DB.Column(DB.Integer, DB.ForeignKey('users.id'));
created_at = DB.Colum... | Python | 0 | @@ -215,15 +215,14 @@
(DB.
-VarChar
+String
(20)
|
367e39094c3658e0e63f84f8c334934c4967a77b | Rework masking based on suggestions by @ahojnnes | skimage/filter/edges.py | skimage/filter/edges.py | """edges.py - Sobel edge filter
Originally part of CellProfiler, code licensed under both GPL and BSD licenses.
Website: http://www.cellprofiler.org
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Original author: Lee Kamentsky
"""
import nump... | Python | 0 | @@ -708,75 +708,123 @@
-mask = np.zeros(result.shape, bool)%0A mask%5B1:-1, 1:-1%5D = True
+result%5B0, :%5D = 0%0A result%5B-1, :%5D = 0%0A result%5B:, 0%5D = 0%0A result%5B:, -1%5D = 0%0A return result
%0A
@@ -905,34 +905,8 @@
-result%5Bmask == False%5D = 0%0A
... |
eed8441f847abd0ed00f0acfaabfdb401d1912bf | Return the proper headers on errors before WebSocket handshake. | ws4redis/wsgi_server.py | ws4redis/wsgi_server.py | # -*- coding: utf-8 -*-
import sys
from redis import StrictRedis
import django
if django.VERSION[:2] >= (1, 7):
django.setup()
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest, logger, STATUS_CODE_TEXT
from django.core.exceptions import PermissionDenied
from django import http
from... | Python | 0.001413 | @@ -6141,91 +6141,20 @@
-if hasattr(start_response, 'im_self') and not start_response.im_self.headers_sent:%0A
+ else:%0A
@@ -6153,32 +6153,34 @@
:%0A
+
logger.warning('
@@ -6183,16 +6183,17 @@
ng('Star
+t
ing late
@@ -6217,16 +6217,20 @@
ocket')%0A
+
@@ -6321,24 +632... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.