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 |
|---|---|---|---|---|---|---|---|
87dfd039319f0e2004dfc2376ee67269a6bf80ab | Send mail with ses | aclarknet/settings.py | aclarknet/settings.py | """
Django settings for project aclarknet.
Generated by 'django-admin startproject' using Django 1.8.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import dj_d... | Python | 0 | @@ -4150,16 +4150,58 @@
Backend'
+%0AEMAIL_FROM = os.environ.get('EMAIL_FROM')
%0A%0AGRAVAT
|
e265b1dd84576a9b0f5000d52e158528b07f088a | Revert "Update" | aclarknet/settings.py | aclarknet/settings.py | # encoding: utf-8
"""
Django settings for aclarknet project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/... | Python | 0 | @@ -868,18 +868,16 @@
uction!%0A
-#
DEBUG =
@@ -903,21 +903,8 @@
UG')
-%0ADEBUG = True
%0A%0AAL
|
43bcd715a6008151a8856ecc25a3382a8df54532 | fix type in id__in refrences | actions/lib/action.py | actions/lib/action.py |
from st2actions.runners.pythonrunner import Action
import requests
__all__ = [
'NetboxBaseAction'
]
class NetboxBaseAction(Action):
"""Base Action for all Netbox API based actions
"""
def __init__(self, config):
super(NetboxBaseAction, self).__init__(config)
def get(self, endpoint_uri... | Python | 0.000006 | @@ -843,21 +843,21 @@
s.get('i
-n__id
+d__in
'):%0A
@@ -873,21 +873,21 @@
wargs%5B'i
-n__id
+d__in
'%5D = ','
@@ -901,21 +901,21 @@
wargs%5B'i
-n__id
+d__in
'%5D)%0A
@@ -942,21 +942,21 @@
debug('i
-n__id
+d__in
fransfo
@@ -983,21 +983,21 @@
wargs%5B'i
-n__id
+d__in
'%5D))%0A%0A
|
b2b1cbebd26e82d7570e21f275fd279143125de7 | Fix version in docs conf. | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon'
]
if os.getenv('SPELLCHECK'):
exten... | Python | 0 | @@ -622,13 +622,13 @@
= u'
-0.1.0
+2.4.1
'%0Aim
|
28d0ed6b9c373a48789ae95605b436ff94493a95 | correct project creation date set for copyright | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | Python | 0.000012 | @@ -804,10 +804,10 @@
'20
-08
+13
- %7B
|
53da3677ecc16e30d9f4c9a44f28a08ba047bce2 | Update package name to 'spectral-cube' in template | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... | Python | 0 | @@ -4149,18 +4149,20 @@
': '
-packagenam
+spectral-cub
e',
|
a2d49d61718ac9c772ae620d26fdb2af13284f0b | update copyright year | docs/conf.py | docs/conf.py | try:
import sphinx_rtd_theme
except ImportError:
sphinx_rtd_theme = None
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- ... | Python | 0 | @@ -820,17 +820,17 @@
t = '202
-0
+1
, deSEC
|
17e51a03f42a74a08db64ba8402c98bd82a2fd5b | configure bibtex to make rtd happy (#554) | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmmtools documentation build configuration file, created by
# sphinx-quickstart on Sat May 13 13:35:37 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... | Python | 0 | @@ -6209,12 +6209,125 @@
aneous'),%0A%5D%0A
+%0A# -- Options for bibtex --------------------------------------------------%0Abibtex_bibfiles = %5B'references.bib'%5D%0A
|
bc335fb0caa13d5d44f3b732ac94422be7c8a35c | Goodness this dogfood is delicious | docs/conf.py | docs/conf.py | from datetime import datetime
from os import environ, getcwd
from os.path import abspath, join, dirname
import sys
# Core settings
extensions = ['releases', 'sphinx.ext.intersphinx', 'sphinx.ext.autodoc']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build']
default... | Python | 0.999993 | @@ -140,16 +140,21 @@
ions = %5B
+%0A
'release
@@ -156,16 +156,20 @@
leases',
+%0A
'sphinx
@@ -186,16 +186,20 @@
sphinx',
+%0A
'sphinx
@@ -211,16 +211,45 @@
autodoc'
+,%0A 'invocations.autodoc',%0A
%5D%0Atempla
|
eb4ac24816220cb9a17044087012f8f77068a0e3 | Fix Read-the-docs ccdproc version | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... | Python | 0.000001 | @@ -3157,180 +3157,58 @@
ts.%0A
-%0Afrom pkg_resources import get_distribution, DistributionNotFound%0Atry:%0A __version__ = get_distribution(__name__)%0Aexcept DistributionNotFound:%0A __version__ = 'unknown'
+__import__(project)%0Apackage = sys.modules%5Bproject%5D
%0A%0Ave
@@ -3215,16 +3215,24 @@
rsion =
+... |
ed450858f799f996b1f8c89da12d978085c19008 | Update conf.py | docs/conf.py | docs/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | Python | 0.000001 | @@ -625,16 +625,35 @@
h('.'))%0A
+import recommonmark
%0Afrom re
@@ -693,16 +693,65 @@
rkParser
+%0Afrom recommonmark.transform import AutoStructify
%0A%0A# -- G
@@ -1083,16 +1083,42 @@
ions = %5B
+%0A 'sphinx.ext.autodoc'%0A
%5D%0A%0A# Add
@@ -5381,12 +5381,271 @@
aneous'),%0A%5D%0A
+%0A# app setup hook%0Ade... |
dd85d7f9445f874b61b66b46be04208cacc2b821 | Fix redirect hook check | kolibri/core/views.py | kolibri/core/views.py | from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import is_valid_path
from django.urls import translate_url
from dja... | Python | 0 | @@ -3592,32 +3592,28 @@
ectHook.
-registered_hooks
+is_enabled()
:%0A
|
6ad588931dbf4988c043fb766090521b06775aaa | correct KUBECONFIG path | kvirt/k3s/__init__.py | kvirt/k3s/__init__.py | #!/usr/bin/env python
from distutils.spawn import find_executable
from kvirt.common import info, pprint, get_kubectl, scp
import os
import sys
import yaml
cloudplatforms = ['aws', 'gcp']
def scale(config, plandir, cluster, overrides):
plan = cluster
data = {'cluster': cluster, 'kube': cluster, 'kubetype': '... | Python | 0.00001 | @@ -5604,16 +5604,28 @@
ECONFIG=
+$HOME/.kcli/
clusters
|
dd551e37c39067f510e869c7c942ce98b52939ad | Change to Embed | revimage/revimage.py | revimage/revimage.py | from discord.ext import commands
import aiohttp
from bs4 import BeautifulSoup
class revimage:
"""Reverse image search commands"""
def __init__(self, bot):
self.bot = bot
self.tineye_session = aiohttp.ClientSession()
def __unload(self):
self.tineye_session.close()
def _tag_to_... | Python | 0 | @@ -1600,16 +1600,427 @@
eError:%0A
+ embed = discord.Embed(title=%22Reverse Image Details%22, color=0xffff00)%0A embed.add_field(name=%22Original Link%22, value=%22%3C%7B%7D%3E'.format(URL)%22, inline=False)%0A embed.add_field(name=%22Matches%22, value=%22**No ... |
617375ae572b85e3e1241b8b56815e7c9f94b8ab | Enable subtraction on Month class | month/models.py | month/models.py | from django.db import models
import datetime
from month import forms
from month import widgets
def days(days):
return datetime.timedelta(days=days)
class Month(object):
def __init__(self, year, month):
self.year = year
self.month = month
self._date = datetime.date(year=self.year, month... | Python | 0.000001 | @@ -759,16 +759,97 @@
months)%0A
+ def __sub__(self, months):%0A return Month.from_int(int(self) - months)%0A
def
|
3cd945aba394f1b094fa2e219a6f3db1704a770f | Change how we filter merges a bit. | Scraper.py | Scraper.py |
from github import Github, GithubException
from random import randint
class Scraper:
def __init__(self, db):
self.db = db
api_key = db.getConfigValue('api_key')
self.gh = Github(api_key)
self.gh.per_page = 10
def _filterCommit(self, message):
message = message.strip()
return \
len... | Python | 0 | @@ -41,35 +41,75 @@
ion%0A
-from random import randint
+import re%0A%0Atag_mutex = re.compile(r'%5E(%5B%5Cw%5C- %5D+):(.*)$', re.UNICODE)
%0A%0Acl
@@ -422,32 +422,36 @@
and %5C%0A
+not
message.
find('Merge
@@ -442,89 +442,67 @@
age.
-find('Merge pull request') %3C 0 and %5C%0A not message.startswith... |
99211d74415221be9cf4ad64296d8165b5c9dc0d | handle too many search results like quotes | lala/plugins/anime.py | lala/plugins/anime.py | import anidb
import logging
from lala.util import command, msg, initplz
from lala.config import get
@initplz
def setup():
anidb.set_client("pyanihttp", 1)
def get_anime(user, channel, text):
try:
aid = int(text.split()[1])
except ValueError:
msg(channel, "%s: %s can't be parsed into an an... | Python | 0.000001 | @@ -2876,43 +2876,138 @@
5))%0A
+%0A
-results = results%5B:max_results%5D
+if len(results) %3E max_results:%0A msg(channel, %22%25s: Too many results, please refine your search%22 %25 user)%0A return%0A
%0A
|
fe651b4ef790d9e2c3d180347aaf7be103325102 | update to 0.6.20 | aliyun/log/version.py | aliyun/log/version.py | __version__ = '0.6.19'
USER_AGENT = 'log-python-sdk-v-' + __version__
API_VERSION = '0.6.0'
| Python | 0 | @@ -16,10 +16,10 @@
0.6.
-19
+20
'%0AUS
|
7787db13cb5e130c52cc192664ffdd49c3c1cd09 | add output URL | multidc/main.py | multidc/main.py | import json
import opsCenterNode
import dseNodes
# This python script generates an ARM template that deploys DSE across multiple datacenters.
with open('clusterParameters.json') as inputFile:
clusterParameters = json.load(inputFile)
locations = clusterParameters['locations']
vmSize = clusterParameters['vmSize']
... | Python | 0.00015 | @@ -1529,43 +1529,286 @@
e)%0A%0A
-# Populate the opsCenterURL in outputs
+def opsCenterURL():%0A return %7B%0A %22opsCenterURL%22: %7B%0A %22type%22: %22string%22,%0A %22value%22: %22%5Bconcat('http://opsc', variables('uniqueString'), '.', %22 + locations%5B0%5D + %22, '.cloudapp.azure... |
2c2371d4b24665568e0edf30f91967891470c862 | Fix bug due to change in default settings in matplotlib | rnmu/test/test_2d.py | rnmu/test/test_2d.py | from __future__ import absolute_import, print_function
import matplotlib.pyplot as plt
import seaborn.apionly as sns
import numpy as np
import os
import scipy.io
import sys
import re
import timeit
import rnmu.test.utils as test_utils
import rnmu.pme.detection as detection
import rnmu.pme.multigs as multigs
import rnmu.... | Python | 0 | @@ -861,16 +861,32 @@
o', s=10
+, edgecolors='k'
)%0A%0A%0Adef
|
38d96f27f0c18eaecddc45f4408550fb0f4956dc | Make the darwin_specific sendall work in Python3. | rocket/connection.py | rocket/connection.py | # -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2009 Timothy Farrell
# Import System Modules
import sys
import time
import socket
try:
import ssl
has_ssl = True
except ImportError:
has_ssl = False
# Import Package Modules
from . import IS_JYTHON, SOCKET_TIMEOUT, BUF_SI... | Python | 0.000014 | @@ -2086,38 +2086,115 @@
rror
-, e:%0A if e
+:%0A import errno%0A info = sys.exc_info()%0A if info%5B1%5D.args
%5B0%5D
+
!=
+
errn
@@ -2228,17 +2228,38 @@
raise
-
+%0A return offset
%0A%0A# FIXM
@@ -2746,9 +2746,8 @@
close()%0A
-%0A
|
48749f16d2f51d0915614ad5c1c4033077d3cfa6 | make api require unique case number, not urn | api/v0/serializers.py | api/v0/serializers.py | from rest_framework import serializers
from apps.plea.models import Case, UsageStats, Offence
class OffenceSerializer(serializers.ModelSerializer):
class Meta:
model = Offence
exclude = ("case",)
class CaseSerializer(serializers.ModelSerializer):
urn = serializers.RegexField("^\d{2}/[a-zA-... | Python | 0.022324 | @@ -270,19 +270,27 @@
r):%0A
-urn
+case_number
= seria
@@ -300,82 +300,32 @@
ers.
-Regex
+Char
Field(
-%22%5E%5Cd%7B2%7D/%5Ba-zA-Z%5D%7B2%7D/%5Cd+/%5Cd%7B2%7D$%22, max_length=16, min_length=14)%5C
+required=True)
%0A%0A
@@ -914,79 +914,312 @@
date
-(self, attrs):%0A%0A if not Case.objects.can_use_ur... |
b475fa4c8c10520cb9f34e0d4fd98c0842d861c9 | refactor cli api calls | rptk/command_line.py | rptk/command_line.py | # Copyright (c) 2018 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are licensed under the Apache License version 2.0
# (the "License"); you may not use this file except in compliance with the
# License.
#
# Unless required by applicable law or agreed to in writing, software
# d... | Python | 0.00008 | @@ -1366,25 +1366,25 @@
nt('--config
-_
+-
file', '-f',
@@ -1667,16 +1667,65 @@
', '-Q',
+ dest='query_class_name',%0A
help=%22q
@@ -1846,16 +1846,66 @@
', '-F',
+ dest='format_class_name',%0A
help=%22f
@@ -2028,16 +2028,37 @@
', '-P',
+ dest='query_policy',
type... |
185d81c0eca65f5bbaf269a3a014b5e90943c700 | Fix busted short-circuit to return real webob biz | leafymiracle/views.py | leafymiracle/views.py | # Copyright (C) 2011 Luke Macken <lmacken@redhat.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This ... | Python | 0.000002 | @@ -1837,24 +1837,147 @@
re
-turn %7B'data':%5B%5D%7D
+sp = webob.Response(request=request, content_type=%22application/json%22)%0A resp.body = simplejson.dumps(%7B'data':%5B%5D%7D)%0A return resp
%0A%0A
|
f1048ee71cc5ffa6d38045e6931cb620216ead4d | Handle GET RESPONSE | ledgerblue/commTCP.py | ledgerblue/commTCP.py | """
*******************************************************************************
* Ledger Blue
* (c) 2019 Ledger
*
* 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.... | Python | 0.000015 | @@ -1238,16 +1238,41 @@
20000):%0A
+%0A%09%09def send_apdu(apdu):%0A%09
%09%09if sel
@@ -1272,32 +1272,33 @@
%09if self.debug:%0A
+%09
%09%09%09print(%22=%3E %25s%22
@@ -1318,12 +1318,11 @@
du))
+%0A
%09%09
-%0A%09
%09sel
@@ -1365,16 +1365,17 @@
apdu)))%0A
+%09
%09%09self.s
@@ -1391,16 +1391,36 @@
d(apdu)%0A
... |
8316a60ba2887a511579e8cedb90b3a02fc1889a | Drop dashes from download urls. | dope/util.py | dope/util.py | from uuid import UUID
from werkzeug.routing import BaseConverter
class UUIDConverter(BaseConverter):
to_python = UUID
to_url = str
| Python | 0 | @@ -122,21 +122,73 @@
UID%0A
+%0A
+def
to_url
- = str
+(self, obj):%0A return str(obj).replace('-', '')
%0A
|
d4d6d961d0fb7f4e9d95f8524de50fbc2a717d87 | update e2e test with retries (#7531) | run/jobs/e2e_test.py | run/jobs/e2e_test.py | # Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Python | 0.000002 | @@ -793,16 +793,28 @@
process%0A
+import time%0A
import u
@@ -2446,18 +2446,17 @@
mber of
-10
+5
times t
@@ -2477,19 +2477,21 @@
in
-stackdriver
+Cloud Logging
%0A
@@ -2505,16 +2505,43 @@
= False%0A
+ for x in range(5):%0A
iter
@@ -2580,16 +2580,20 @@
+
+
%7B%22resour
@@ -2642,1... |
bd6feb15d2b6547c3cf99d27b870fc58a6ff241e | Configure base logging | ds/config.py | ds/config.py | from __future__ import absolute_import
import flask
import os
import logging
from flask_heroku import Heroku
from flask_redis import Redis
from flask_sqlalchemy import SQLAlchemy
from raven.contrib.flask import Sentry
from ds.api.controller import ApiController
from ds.constants import PROJECT_ROOT
from ds.tasks.bas... | Python | 0.000001 | @@ -341,16 +341,57 @@
elery%0A%0A%0A
+logging.basicConfig(level=logging.WARN)%0A%0A
api = Ap
|
75af5ca68ba2238bc8efb2a5f9cf2aa24276fb41 | add bcrypt password encryption | application/models.py | application/models.py | from flask_sqlalchemy import SQLAlchemy
from application import app, db
from sqlalchemy.sql import func
class User(db.Model):
""" Creates users on the system """
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
email = db.Colum... | Python | 0.001738 | @@ -97,16 +97,30 @@
rt func%0A
+import bcrypt%0A
%0A%0Aclass
@@ -591,24 +591,66 @@
sword =
-password
+bcrypt.hashpw(password.encode(), bcrypt.gensalt())
%0A%0A de
|
da3fc71a2d28fe6ef549d592bbb49b7baa4fd5c9 | ensure name is str | salt/modules/ddns.py | salt/modules/ddns.py | # -*- coding: utf-8 -*-
'''
Support for RFC 2136 dynamic DNS updates.
Requires dnspython module.
'''
# Import python libs
import logging
log = logging.getLogger(__name__)
try:
import dns.query
import dns.update
dns_support = True
except ImportError as e:
dns_support = False
def __virtual__():
... | Python | 0.999617 | @@ -3898,32 +3898,53 @@
host1 A%0A '''%0A
+ name = str(name)%0A
fqdn = '%7B%7D.%7B
|
73f6a4d9d4506a9e69a118e95482a4e7c9849905 | improve readability for membership | apps/domain/models.py | apps/domain/models.py | from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db import models
from domain import Permissions
############################################################################################################... | Python | 0.000001 | @@ -3270,36 +3270,48 @@
urn
-str(self.member_type) + str(
+%22%25s (%25s, %25s) %25s%22 %25 (self.member_object,
self
@@ -3322,18 +3322,14 @@
ber_
-id) + str(
+type,
self
@@ -3336,22 +3336,31 @@
.member_
-object
+id, self.domain
)%0A%0A#####
|
01099fc95bbce7119e71fe65d608a809e819552e | update domain model | apps/domain/models.py | apps/domain/models.py | from __future__ import unicode_literals, absolute_import
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from apps.certificate.models import Certificate
# Create your models here.
class Domain(models.Model):
domain_name = models.CharField(max_length=200... | Python | 0 | @@ -382,19 +382,18 @@
n_regist
-ere
+ra
r = mode
@@ -1431,273 +1431,4 @@
rgs)
-%0A%0A# %7B%0A# domain_name: data.domain_name %7C%7C $localStorage.domain.host,%0A# domain_url: $localStorage.domain.host,,%0A# domain_registerer: data.register,%0A# support_email: (lambda emails: data.emails%5B0%5D if isi... |
31776b7461730f43ae17941e823161b7254818bd | Load to charity database | alchemy.py | alchemy.py | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 17:56:25 2017
@author: colmc
"""
import requests
from bs4 import BeautifulSoup
from datetime import datetime
import pandas as pd
from sqlalchemy import Table, MetaData, bindparam, create_engine
import json
import os
source_url = 'https://api.likecharity.com/charities... | Python | 0 | @@ -2181,24 +2181,31 @@
ad=True)%0A
+ stmt =
charity.del
@@ -2206,24 +2206,43 @@
ty.delete()%0A
+ stmt.execute()%0A
%0A # a
|
80710617b0dbfb862aa2e7367785c9be3e4cbd3d | Use external exceptions | salt/modules/node.py | salt/modules/node.py | # -*- coding: utf-8 -*-
#
# Copyright 2015 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python | 0 | @@ -701,16 +701,165 @@
mportlib
+%0Afrom salt.modules.inspectlib.exceptions import (InspectorQueryException,%0A InspectorSnapshotException)
%0A%0A# Impo
|
211b9b21a2f13e9c1215167baf551f0271a1e214 | Add full_info call to return a full set of virt information | salt/modules/virt.py | salt/modules/virt.py | '''
Work with vitual machines managed by libvirt
'''
# Special Thanks to Michael Dehann, many of the concepts, and a few structures
# of his in the virt func module have been used
# Import Python Libs
import os
# Import libvirt
import libvirt
VIRT_STATE_NAME_MAP = {
0 : "running",
1 : "running",
2 : "runni... | Python | 0 | @@ -2260,24 +2260,257 @@
eturn info%0A%0A
+def full_info():%0A '''%0A Return the node_info, vm_info and freemem%0A%0A CLI Example:%0A salt '*' virt.full_info%0A '''%0A return %7B'freemem': freemem(),%0A 'node_info': node_info(),%0A 'vm_info': vm_info()%7D%0A%0A%0A
def freemem(
|
13d2100fc5f8c8202e81e93a7648bb6f534f05cc | Fix linting | apps/payment/views.py | apps/payment/views.py | # -*- coding: utf-8 -*-
import json
from datetime import datetime
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts impor... | Python | 0.000004 | @@ -254,30 +254,8 @@
port
- HttpResponseRedirect,
Jso
@@ -895,17 +895,16 @@
ATE_KEY%0A
-%0A
tick
@@ -966,21 +966,15 @@
id)%0A
+%0A
i
-s_post =
+f
req
@@ -998,24 +998,8 @@
OST'
-%0A%0A if is_post
:%0A
|
38e349f04257d1d35d431a2754c6c249a7b4650c | Allow runner to update_ca_bundle | salt/runners/http.py | salt/runners/http.py | # -*- coding: utf-8 -*-
'''
Module for making various web calls. Primarily designed for webhooks and the
like, but also useful for basic http testing.
'''
from __future__ import absolute_import
# Import Python libs
import logging
# Import salt libs
import salt.utils.http
log = logging.getLogger(__name__)
def query(... | Python | 0.000001 | @@ -957,8 +957,1274 @@
urn ret%0A
+%0A%0Adef update_ca_bundle(target=None, source=None, merge_files=None):%0A '''%0A Update the local CA bundle file from a URL%0A%0A CLI Example:%0A%0A .. code-block:: bash%0A%0A salt-run http.update_ca_bundle%0A salt-run http.update_ca_bundle target=/path/to/... |
3ab2bd94d9359348f364a97c993778ce3837982a | Fix merge error | apps/payment/views.py | apps/payment/views.py | # -*- coding: utf-8 -*-
import json
from datetime import datetime
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts impor... | Python | 0.000006 | @@ -3826,36 +3826,32 @@
)%0A%0A
-
messages.success
@@ -3851,24 +3851,49 @@
success(
-request,
+%0A request,%0A
_(u'Pay
@@ -3971,16 +3971,25 @@
r.email)
+%0A
)%0A%0A
|
53b9a10ac2aa07f95726c37d866ec1551a3fcbff | Add reset function to virt runner | salt/runners/virt.py | salt/runners/virt.py | '''
Control virtual machines via Salt
'''
# Import Salt libs
import salt.client
import salt.output
def _determine_hyper(data):
'''
Determine what the most resource free hypervisor is based on the given
data
'''
# This is just checking for the hyper with the most free ram, this needs
# to be m... | Python | 0 | @@ -2465,24 +2465,545 @@
eturn ret%0A%0A%0A
+def reset(name):%0A '''%0A Force power down and restart an existing vm%0A '''%0A ret = %7B%7D%0A client = salt.client.LocalClient(__opts__%5B'conf_file'%5D)%0A data = vm_info(name, quiet=True)%0A if not data:%0A print('Failed to find vm %7B0%7D t... |
6515c303c4b56e37dcd81946e7b9f28efb85d144 | Update admin.py | apps/profile/admin.py | apps/profile/admin.py | from django.contrib import admin
from django.utils import html
from apps.user.models import User
from apps.user.admin import UserAdmin as apps_UserAdmin
from django.utils.encoding import force_text
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from .models import Profile,Profi... | Python | 0 | @@ -4105,12 +4105,8 @@
_image)%0A
-%0A%0A%0A%0A
|
eb3e7da51a1474fc97363ec644e2954bd7dc2e33 | max num | apps/profile/forms.py | apps/profile/forms.py | from django import forms
from . import models
from apps.user.models import User
class ProfileForm(forms.ModelForm):
class Meta:
model = models.Profile
fields = ['company', 'info', 'expert', 'visibility_mail',
'visibility_company', 'visibility_info',
'visibility_f... | Python | 0.999913 | @@ -734,32 +734,47 @@
m,%0A extra=1,%0A
+ max_num=1,%0A
fields=('pat
@@ -926,24 +926,39 @@
extra=1,%0A
+ max_num=1,%0A
fields=(
|
6c096bdd89b2e276eafe019b90c9088c49e1d6f2 | Update version number | saltcloud/version.py | saltcloud/version.py | import sys
__version_info__ = (0, 8, 5)
__version__ = '.'.join(map(str, __version_info__))
def versions_report():
libs = (
("Salt", "salt", "__version__"),
("Apache Libcloud", "libcloud", "__version__"),
("PyYAML", "yaml", "__version__"),
)
padding = len(max([lib[0] for lib in li... | Python | 0.000002 | @@ -35,9 +35,9 @@
8,
-5
+6
)%0A__
|
bc63165237297546aae65a87d1c0f82c9e4a26d0 | Allow only FieldName in Name. | satori/ars/naming.py | satori/ars/naming.py | # vim:ts=4:sts=4:sw=4:expandtab
"""Abstraction layer for various naming conventions.
"""
__all__ = (
'Name',
'ClassName', 'MethodName', 'ParameterName', 'FieldName', 'AccessorName',
'NamedObject',
'NamingStyle',
)
from satori.objects import Object, Argument, ArgumentError
class NameKind(Object):
... | Python | 0 | @@ -2344,24 +2344,51 @@
ClassName),%0A
+ (None, FieldName),%0A
(Cla
|
060f95623f5461692ae8a0c91d1aa5fcbffa0d17 | Modify the default domain for DTP. The NULL domain only contains one "\x00". See http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=DTP.pcapng for an example. | scapy/contrib/dtp.py | scapy/contrib/dtp.py | #!/usr/bin/env python
# scapy.contrib.description = DTP
# scapy.contrib.status = loads
"""
DTP Scapy Extension
~~~~~~~~~~~~~~~~~~~
:version: 2008-12-22
:author: Jochen Bartl <lobo@c3a.de>
:Thanks:
- TLV code derived from the CDP implementation of scapy. (Thanks to Nicolas Bareil and Arnaud ... | Python | 0 | @@ -1917,40 +1917,8 @@
%5Cx00
-%5Cx00%5Cx00%5Cx00%5Cx00%5Cx00%5Cx00%5Cx00%5Cx00
%22, l
|
e5d30636c29cde0c4fa9e81f213b1fc008237229 | Update libchromiumcontent for linking with msvcrt dll | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '07a73a610496e4a1b4f3abc3c2fb0516187ec460'
PLATFORM = {
'cygwin': 'win32',
'darwin': 'darwin',
'linux2': 'linux',
'win32': 'win32',... | Python | 0 | @@ -178,48 +178,48 @@
= '
-07a73a610496e4a1b4f3abc3c2fb0516187ec460
+90a5b9c3792645067ad9517e60cf5eb99730e0f9
'%0A%0AP
|
64c3a1df70907d857f2eff5cf6a010075eba797f | Update version to 20160713 | artifacts/__init__.py | artifacts/__init__.py | # -*- coding: utf-8 -*-
__version__ = '20160114'
| Python | 0 | @@ -42,9 +42,9 @@
0160
-114
+713
'%0A
|
720276a2658193256e3a77f600f8983b1fae517f | Clean up merge | aspc/configuration.py | aspc/configuration.py | import os, django
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all o... | Python | 0.000001 | @@ -3366,120 +3366,28 @@
g',%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A=======%0A 'forms_builder.forms',%0A 'debug_toolbar',%0A%3E%3E%3E%3E%3E%3E%3E 23cf6ec... Installing debug toolbar
+ 'debug_toolbar',
%0A)%0A%0A
|
ea053f36bc8693e4e1396336ebe3aa0aca675c14 | return more imgur data | Functions/URLFollow.py | Functions/URLFollow.py | from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import WebUtils
import re
import HTMLParser
import json
class Instantiate(Function):
Help = 'automatic function that follows urls and grabs information about the resultant webpage'
... | Python | 0.000778 | @@ -3265,41 +3265,408 @@
-title = response%5B'data'%5D%5B'title'%5D
+%0D%0A imageData = response%5B'data'%5D%0D%0A %0D%0A data = %5B%5D%0D%0A data.append(imageData%5B'title'%5D)%0D%0A data.append('%7B0%7Dx%7B1%7D'.format(imageData%5B'width'%5D, imageData%5B'height'%5D))%0D%0A ... |
e370cb8d3c7fe87c1e1b035c1563bbddba667e3c | Add note field to BomItem serializer | InvenTree/part/serializers.py | InvenTree/part/serializers.py | from rest_framework import serializers
from .models import Part, PartCategory, BomItem
from .models import SupplierPart
from company.serializers import CompanyBriefSerializer
class CategorySerializer(serializers.ModelSerializer):
url = serializers.CharField(source='get_absolute_url', read_only=True)
class... | Python | 0 | @@ -2025,16 +2025,37 @@
uantity'
+,%0A 'note',
%0A
|
fabe0a071ce6e0e3d92098669dac33c2c9bc9b62 | add folder docs | GrowYourIC/__init__.py | GrowYourIC/__init__.py | """
GrowYourIC
====
GrowYourIC is a tool to model seismic observation through inner core geodynamical modelisation.
"""
from __future__ import absolute_import
__version__ = "0.1.0"
from . import data
from . import geodyn
from . import intersection
from . import positions
from . import plot_data
from . import miner... | Python | 0.000001 | @@ -175,17 +175,17 @@
= %220.1.
-0
+1
%22%0A%0Afrom
|
9d46df1680e3d799971e73ec73043c2a6c0590ce | Fix building tar in deployment | scripts/build_tar.py | scripts/build_tar.py | #! /usr/bin/python
import os
import subprocess
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
tarfile = os.path.join(root_dir, "src_pkg.tar")
def _is_dir_newer(directory, filename):
file_mtime = os.stat(filename).st_mtime
for dirname, _, filenames in os.walk(directory):
for ... | Python | 0.000007 | @@ -301,16 +301,88 @@
ctory):%0A
+ if _is_file_newer(dirname, file_mtime):%0A return True%0A
@@ -649,16 +649,20 @@
return
+ed =
os.stat
@@ -693,16 +693,36 @@
le_mtime
+%0A return returned
%0A%0Adef _t
|
4ec9a3d72d2d552bc6037e10b0b5e4d3f58849c6 | Change version to 3.2.8 alpha | scripts/make_dist.py | scripts/make_dist.py | # -*- coding: utf-8 -*-
"""Script to compact all Brython scripts in a single one."""
import datetime
import os
import re
import sys
import tarfile
import zipfile
import javascript_minifier
if(sys.version_info[0]!=3):
raise ValueError("This script only works with Python 3")
# path of parent directory
pdir = o... | Python | 0.000024 | @@ -416,17 +416,17 @@
2,
-7, 'final
+8, 'alpha
', 0
|
0dc7eb5499f287c518ff274d07d9bb02b11eceb0 | simplify returning of parsed code | async2rewrite/main.py | async2rewrite/main.py | import collections
import re
import os
import astunparse_noparen as ast_unparse
from yapf import yapf_api
from .transformers import *
# Detects 17-19 digit integers within quotes (snowflake detection)
snowflake_regex = re.compile(r"['\"](\d{17,19})['\"]")
def get_result(code, **kwargs):
"""Perfor... | Python | 0.000125 | @@ -2313,24 +2313,59 @@
nparsed)%0D%0A%0D%0A
+ unparsed = unparsed.strip()%0D%0A%0D%0A
if inclu
@@ -2396,24 +2396,16 @@
unparsed
-.strip()
, final_
@@ -2424,32 +2424,24 @@
urn unparsed
-.strip()
%0D%0A%0D%0A%0D%0Adef pr
|
f51cefe50795979d7d718a564abbd4e5d133eb20 | Fix DataStore.keys | atria/core/storage.py | atria/core/storage.py | # -*- coding: utf-8 -*-
"""Storage and data management."""
# Part of Atria MUD Server (https://github.com/whutch/atria)
# :copyright: (c) 2008 - 2015 Will Hutcheson
# :license: MIT (https://github.com/whutch/atria/blob/master/LICENSE.txt)
from collections import OrderedDict
from .logs import get_logger
from .utils.ex... | Python | 0 | @@ -268,16 +268,44 @@
eredDict
+%0Afrom itertools import chain
%0A%0Afrom .
@@ -4392,26 +4392,281 @@
-return self._keys(
+# We also need to include keys that are only in the transaction and%0A # not yet saved to the store.%0A trans_keys = self._transaction.keys()%0A return chain(trans_keys,... |
6b0746b82d7a085655a0f594201a7efb471dc3c5 | Fix attachment representation | attachments/models.py | attachments/models.py | from django.db import models
class Attachment(models.Model):
file_name = models.FileField(upload_to='attachments')
def __unicode__(self):
return self.file_name
| Python | 0.000001 | @@ -23,16 +23,47 @@
models%0A%0A
+from datetime import datetime%0A%0A
%0Aclass A
@@ -188,16 +188,24 @@
return
+unicode(
self.fil
@@ -210,9 +210,10 @@
ile_name
+)
%0A
|
cba217fed96cd988eb3ab614e1bd45a4cf0c8297 | Replace fullVersionHistory() with revisions() | scripts/revertbot.py | scripts/revertbot.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script can be used for reverting certain edits.
The following command line parameters are supported:
¶ms;
-username Edits of which user need to be reverted.
-rollback Rollback edits instead of reverting them.
Note that in roll... | Python | 0.000001 | @@ -2495,23 +2495,20 @@
-history
+page
= pywik
@@ -2546,72 +2546,55 @@
e'%5D)
-.fullVersionHistory(%0A total=2, rollback=self.rollback
+%0A history = list(page.revisions(total=2)
)%0A
@@ -2736,32 +2736,25 @@
-pywikibot.S
+self.s
ite
-()
, 'rever
@@ -2796,30 +2796,61 @@
re... |
f3fb93bf1edea6c63b5db0140429fbec4b599047 | Change how we get the s3 url for the template. | util/vpc-tools/create_stack.py | util/vpc-tools/create_stack.py | import argparse
import boto
import yaml
from os.path import basename
from time import sleep
from pprint import pprint
FAILURE_STATES = [
'CREATE_FAILED',
'ROLLBACK_IN_PROGRESS',
'ROLLBACK_FAILED',
'ROLLBACK_COMPLETE',
'DELETE_IN_PROGRESS',
'DELETE_FAILED',
'DELETE_COMPLETE',
]
def upl... | Python | 0 | @@ -825,46 +825,103 @@
l =
-key.generate_url(300, query_auth=False
+%22https://s3.amazonaws.com/%7B%7D/%7B%7D%22.format(bucket.name, key.name)%0A print( %22URL: %7B%7D%22.format(url)
)%0A
|
73ea2ac9612e25307febf5ac7574e714027bd601 | split out the format parameter as it was throwing a KeyError | azure_storage/storage.py | azure_storage/storage.py | from azure.common import AzureMissingResourceHttpError
from azure.storage.blob import BlobService
from django.core.files.storage import Storage
from django.conf import settings
try:
from django.utils.deconstruct import deconstructible
except ImportError:
# Support for django 1.7 and below
def deconstructi... | Python | 0.000017 | @@ -2135,59 +2135,15 @@
-%0A self._container_url = base_url.format(
+data =
%7B%0A
@@ -2305,16 +2305,73 @@
%7D
+%0A self._container_url = base_url.format(**data
)%0A%0A
|
829f39b5a7dd7b1d8d3cf27c5d4de51d7a344f78 | Clarify days to maturity with help text | seedlibrary/forms.py | seedlibrary/forms.py | from django import forms
from seednetwork.forms import SeedNetworkBaseForm
from seedlibrary.models import Event
GRAIN_CHOICES = (
('-','-'),
('amaranth','Amaranth'),
('barley', 'Barley'),
# ('buckwheat', 'Buckwheat'),
# ('bulghur', 'Bulghur'),
('corn', 'Corn'),
('... | Python | 0.001099 | @@ -4015,32 +4015,102 @@
, required=False
+, help_text=%22Enter only a single number, even if that is an estimate.%22
)%0A lodgin
|
494f497b4aee2189bffd6f916fb3d9ec4090fc6a | Update task_9_21.py | IVTp/2014/task_9_21.py | IVTp/2014/task_9_21.py | #Задача 9. Вариант 21.
#Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать.
#Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, причем программа может отвечать только "Да" и "Нет".
#Вслед за тем игрок должен попробов... | Python | 0.000531 | @@ -1031,16 +1031,22 @@
+print(
%22%D0%92%D1%8B %D0%BE%D1%88%D0%B8%D0%B1
@@ -1049,19 +1049,21 @@
%D0%BE%D1%88%D0%B8%D0%B1%D0%BB%D0%B8%D1%81%D1%8C
+!
%5Cn%22
+)
%0D%0A %0D%0A%0D%0A
|
28483c4f2aa9f88527c89f143bcbe5d8c64d1631 | implement animation setting printing | settingMod/Preset.py | settingMod/Preset.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preset'''
import xml.etree.ElementTree as xmlMod
from settingMod.Quality import *
from settingMod.BounceSet import *
from settingMod.Engine import *
from settingMod.Options import *
import os
class Preset:
'''class to manage preset'''
def __init__(sel... | Python | 0 | @@ -294,16 +294,157 @@
et'''%0A%09%0A
+%09anim = %5B%0A%09%09%09'%5BOn Demand%5D',%0A%09%09%09'All Animation',%0A%09%09%09'Fix (First Frame)',%0A%09%09%09'Loop 1',%0A%09%09%09'Loop 2',%0A%09%09%09'Loop 3',%0A%09%09%09'Loop 4',%0A%09%09%09'Loop 5'%0A%09%09%09%5D%0A
%09%0A%09def _
@@ -2196,32 +2196,104 @@
log) or chan... |
bc5e9ab68cfc3ad4372a5dd37cff768f3008f6e8 | Test Change 2 | exercise1.py | exercise1.py | #!/usr/bin/env python
""" Assignment 1, Exercise 1, INF1340, Fall, 2014. Grade to gpa conversion
This module prints the amount of money that Lakshmi has remaining
after the stock transactions
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__ = "MIT License"
... | Python | 0 | @@ -322,17 +322,17 @@
money =
-2
+3
000.00%0Ap
|
e1b0c984fe7ef10151e1d6bef962e214bbf1bf8c | Test case for caching. | vistrails/core/console_mode.py | vistrails/core/console_mode.py | ############################################################################
##
## Copyright (C) 2006-2007 University of Utah. All rights reserved.
##
## This file is part of VisTrails.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Foundat... | Python | 0 | @@ -3324,16 +3324,30 @@
vistrail
+%0Aimport random
%0A%0Aclass
@@ -4903,1319 +4903,8 @@
e)%0A%0A
- def test_cache(self):%0A %22%22%22Test if basic caching is working.%22%22%22%0A parser = xml_parser.XMLParser()%0A parser.openVistrail(core.system.visTrailsRootDirectory() +%0A ... |
0cb8e1bc91c1ae2d620de2ab6dd42b9d78b69b1b | Move configure to build super class | orpsoc/build.py | orpsoc/build.py | import shutil
import subprocess
from orpsoc.config import Config
import logging
logger = logging.getLogger(__name__)
class Backend(object):
def __init__(self, system):
logger.debug('__init__() *Entered*')
config = Config()
self.system = system
self.build_root = os.path.join(config... | Python | 0 | @@ -1256,20 +1256,529 @@
-pass
+logger.debug('configure() *Entered*')%0A if os.path.exists(self.work_root): %0A shutil.rmtree(self.work_root)%0A os.makedirs(self.work_root)%0A%0A self.system.setup_cores()%0A%0A for name, core in self.system.get_cores().items():%0A ... |
dc59fd211e7881706ea2629dd34bcaeac4260d1a | Fix typo | orpsoc/utils.py | orpsoc/utils.py | import subprocess
class Launcher:
def __init__(self, cmd, args=[], shell=False, cwd=None, stderr=None, errormsg=None):
self.cmd = cmd
self.args = args
self.shell = shell
self.cwd = cwd
self.stderr = stderr
self.errormsg = errormsg
def run(self... | Python | 0.001227 | @@ -1025,32 +1025,37 @@
.cmd + ' '.join(
+self.
args) + %22 return
|
cfed5890badad7c4cb28d3284e5feacd625700e7 | Version bump | bankid/__version__.py | bankid/__version__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Version info
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
__version__ = "0.9.0"
version = __version__ # backwards compatibility name
| Python | 0.000001 | @@ -192,9 +192,10 @@
%220.
-9
+10
.0%22%0A
|
aa43737b06ccdff8fd4d60be67d09ba4a05bbc65 | Add Asciinema for GofmtBear | bears/go/GofmtBear.py | bears/go/GofmtBear.py | from coalib.bearlib.abstractions.Linter import linter
from coalib.bears.requirements.GoRequirement import GoRequirement
@linter(executable='gofmt',
use_stdin=True,
output_format='corrected',
result_message='Formatting can be improved.')
class GofmtBear:
"""
Suggest better formatting op... | Python | 0 | @@ -783,16 +783,68 @@
atting'%7D
+%0A ASCIINEMA_URL = 'https://asciinema.org/a/94812'
%0A%0A @s
|
d0c3cb5779b394d1907f84b6c0e1540d7da6010c | Fix for id3v23 to include config parameter to save | beetsplug/embedart.py | beetsplug/embedart.py | # This file is part of beets.
# Copyright 2013, Adrian Sampson.
#
# 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, ... | Python | 0 | @@ -2020,16 +2020,42 @@
f.save(
+config%5B'id3v23'%5D.get(bool)
)%0A%0Aclass
@@ -6350,16 +6350,42 @@
mf.save(
+config%5B'id3v23'%5D.get(bool)
)%0A%0A# Aut
|
301c9a157521ee39c9aa4c90c520a94fea0a18f3 | use relu in gru3d | lib/networks/gru3d.py | lib/networks/gru3d.py | import tensorflow as tf
import numpy as np
class GRU3DCell(tf.nn.rnn_cell.RNNCell):
"""Gated Recurrent Unit cell (cf. http://arxiv.org/abs/1406.1078)."""
def __init__(self, num_units, channels):
self._num_units = num_units
self._channels = channels
@property
def state_size(self):
... | Python | 0 | @@ -2556,16 +2556,27 @@
new_h =
+tf.nn.relu(
u * stat
@@ -2595,16 +2595,17 @@
* inputs
+)
%0A
|
21cb08666874a32a869a69df706e5eeef6509ea3 | add back in the __init__ method | fcm/utils.py | fcm/utils.py | import json
import requests
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_text
from django.conf import settings
from django.utils.module_loading import import_module
DEFAULT_FCM_DEVICE_MODEL = 'fcm.Device'
def get_device_model():
mode... | Python | 0.001706 | @@ -2168,24 +2168,775 @@
e(object):%0A%0A
+ def __init__(self):%0A %22%22%22%0A you will not reach to test self.api_key if it is not set in settings...%0A %22%22%22%0A try:%0A self.api_key = settings.FCM_APIKEY%0A except AttributeError:%0A raise ImproperlyCon... |
00d87e000c2abcc772c40e5c0d9faaf1e3cd5758 | Bump version | backslash/__version__.py | backslash/__version__.py | __version__ = '2.25.2'
| Python | 0 | @@ -13,11 +13,11 @@
= '2.25.
-2
+3
'%0A
|
46087df1ce122c3e0333994b465fc9208775338c | Version 0.0.2 | xournal_converters/__init__.py | xournal_converters/__init__.py | __version__ = '0.0.1'
| Python | 0.000001 | @@ -16,7 +16,7 @@
0.0.
-1
+2
'%0A
|
a1390619619a364b9fab13504fb5c2464491d449 | Refactor Largest Palindrome Product for range of n is [1,8] | Largest_Palindrome_Product.py | Largest_Palindrome_Product.py | # Find the largest palindrome made from the product of two n-digit numbers.
# Since the result could be very large, you should return the largest palindrome mod 1337.
# Example:
# Input: 2
# Output: 987
# Explanation: 99 x 91 = 9009, 9009 % 1337 = 987
# Note:
# The range of n is [1,8].
def largestPalindrome(n):
"... | Python | 0.000691 | @@ -284,16 +284,47 @@
%5B1,8%5D.%0A%0A
+from itertools import product%0A%0A
def larg
@@ -439,36 +439,8 @@
%229%22%0A
- minNum = int(number%5B:-1%5D)%0A
nu
@@ -504,14 +504,9 @@
er,
-minNum
+1
, -2
@@ -522,10 +522,9 @@
(x*
-*2
+x
) %3C
@@ -626,17 +626,16 @@
roduct %3C
-=
palindr
@@ -641,29 +641,8 @@
rom... |
de4af7935c1c8d6751c5a71ad90dd5f531f7a1b0 | Fix the script function args | bin/trigger_upload.py | bin/trigger_upload.py | #!/bin/env python
# -*- coding: utf8 -*-
""" Triggers an upload process with the specified raw.xz URL. """
import argparse
import logging
import logging.config
import multiprocessing.pool
import fedmsg.config
import fedimg.uploader
logging.config.dictConfig(fedmsg.config.load_config()['logging'])
log = logging.getLo... | Python | 0.000054 | @@ -349,16 +349,21 @@
_upload(
+url,
compose_
@@ -365,21 +365,16 @@
pose_id,
- url,
push_no
|
166bff52496bfb47c5a3a03585bd10fb449b8d77 | Add wrapper for initscr() to copy the ACS_ and LINES,COLS bindings | Lib/curses/__init__.py | Lib/curses/__init__.py | """curses
The main package for curses support for Python. Normally used by importing
the package, and perhaps a particular module inside it.
import curses
from curses import textpad
curses.initwin()
...
"""
__revision__ = "$Id$"
from _curses import *
from curses.wrapper import wrapper
| Python | 0 | @@ -301,9 +301,719 @@
rapper%0A%0A
+# Some constants, most notably the ACS_* ones, are only added to the C%0A# _curses module's dictionary after initscr() is called. (Some%0A# versions of SGI's curses don't define values for those constants%0A# until initscr() has been called.) This wrapper function calls the%0A# un... |
39331dd11b2700eb615a55b49d35a11a26c0c991 | Remove deprecated use of `Index._get_attributes_dict` (#60) | partd/pandas.py | partd/pandas.py | from functools import partial
import pickle
import numpy as np
import pandas as pd
from pandas.core.internals import create_block_manager_from_blocks, make_block
from . import numpy as pnp
from .core import Interface
from .encode import Encode
from .utils import extend, framesplit, frame
try:
# pandas >= 0.24.0
... | Python | 0 | @@ -3570,18 +3570,49 @@
nd),
+ %7Bk: getattr(ind, k, None) for k in
ind._
-get_
attr
@@ -3621,15 +3621,9 @@
utes
-_dict()
+%7D
, va
|
1e3e0ee1f2966a121027eda405325e9cf627c147 | use original 'path' when printing errors if os.path.relpath fails | Lib/fontmake/errors.py | Lib/fontmake/errors.py | import os
class FontmakeError(Exception):
"""Base class for all fontmake exceptions.
This exception is intended to be chained to the original exception. The
main purpose is to provide a source file trail that points to where the
explosion came from.
"""
def __init__(self, msg, source_file):
... | Python | 0.000003 | @@ -5,16 +5,384 @@
rt os%0A%0A%0A
+def _try_relative_path(path):%0A # Try to return 'path' relative to the current working directory, or%0A # return input 'path' if we can't make a relative path.%0A # E.g. on Windows, os.path.relpath fails when path and %22.%22 are on%0A # different mount points, C: or D: ... |
925a2c498e469780e1dc4285b108cf6f55bcc806 | make reverseDirection optional | Lib/ufo2ft/__init__.py | Lib/ufo2ft/__init__.py | from __future__ import print_function, division, absolute_import
import logging
from fontTools.misc.py23 import *
from ufo2ft.featureCompiler import FeatureCompiler
from ufo2ft.kernFeatureWriter import KernFeatureWriter
from ufo2ft.markFeatureWriter import MarkFeatureWriter
from ufo2ft.outlineCompiler import Outline... | Python | 0 | @@ -2240,24 +2240,47 @@
+ reverseDirection=True,
removeOverl
@@ -2705,16 +2705,59 @@
nError,%0A
+ reverseDirection=reverseDirection,%0A
|
75a1e254052b3a03e704ed3aedbad1f74a9417b7 | Include the link to unarchive channels | slack-autoarchive.py | slack-autoarchive.py | #!/usr/local/bin/python
from datetime import timedelta, datetime
import os
import requests
import re
#
# This will archive inactive channels. The inactive period is in days as 'DAYS_INACTIVE'
# You can put this in a cron job to run daily to do slack cleanup.
#
SLACK_TOKEN = os.environ.get('SLACK_TOKEN')
DAYS_IN... | Python | 0 | @@ -3398,19 +3398,57 @@
ake you
+c
an
+%3Chttps://slack.com/archives/archived%7C
unarchiv
@@ -3461,16 +3461,17 @@
channel
+%3E
to brin
|
aebf6dbeb6c87de708907626925a8eaf24d55d5a | version 3.5.0rc1 (#996) | slack_sdk/version.py | slack_sdk/version.py | """Check the latest version at https://pypi.org/project/slack-sdk/"""
__version__ = "3.4.2"
| Python | 0 | @@ -84,9 +84,12 @@
%223.
-4.2
+5.0rc1
%22%0A
|
727c266d123d7c6afdd4697e72d79a7e3659f9a1 | Update basic-calculator-ii.py | Python/basic-calculator-ii.py | Python/basic-calculator-ii.py | # Time: O(n)
# Space: O(n)
#
# Implement a basic calculator to evaluate a simple expression string.
#
# The expression string contains only non-negative integers, +, -, *, /
# operators and empty spaces . The integer division should truncate toward zero.
#
# You may assume that the given expression is always valid.
#... | Python | 0 | @@ -1096,33 +1096,32 @@
-
self.compute(ope
|
bbcaf3bc59450a67d15ced82cdf625ad1a351046 | Add try/except for students that don't have easygui | MAIN/solids_ISO_GUI.py | MAIN/solids_ISO_GUI.py | """
PROGRAM SOLIDS
--------------
Computes the displacement solution for a finite element assembly
of 2D solids under point loads using as input easy-to-create
text files containing element, nodal, materials and loads data.
Fortran subroutines mesher.for and contour.for are also available to
write the required input f... | Python | 0 | @@ -814,16 +814,26 @@
as plt%0A
+%0Atry:%0A
import e
@@ -839,18 +839,20 @@
easygui%0A
-%0A%0A
+
folder =
@@ -905,16 +905,20 @@
) + %22/%22%0A
+
name = e
@@ -955,16 +955,20 @@
name%22)%0A
+
echo = e
@@ -1039,16 +1039,20 @@
+
+
choices=
@@ -1067,19 +1067,196 @@
%22No%22%5D)
- ... |
dec61efc0259c94186d5f704ac272dbb646bd824 | Make the "monitor" a positional argument that is not automatically converted to a monitor object | pikos/runner.py | pikos/runner.py | import argparse
from pikos.monitors.api import (FunctionMonitor, LineMonitor, FunctionMemoryMonitor,
LineMemoryMonitor)
MONITORS = {'functions': FunctionMonitor,
'lines': LineMonitor,
'function_memory': FunctionMemoryMonitor,
'line_memory': LineMemory... | Python | 0.001 | @@ -9,16 +9,38 @@
rgparse%0A
+import os%0Aimport sys%0A%0A
from pik
@@ -92,16 +92,69 @@
Monitor,
+%0A
Functio
@@ -205,26 +205,98 @@
-LineMemoryMonitor)
+ LineMemoryMonitor)%0Afrom pikos.recorders.api import TextStreamRecorder
%0A%0AMO
@... |
a358a2d1bd46b5e4b446668f9b8a00ed0cb5d167 | add todo -> place appendix b4 signature | plaintextref.py | plaintextref.py | #! /usr/bin/env python3
# Convert in-text references (URLs) to sequentially numbered footnotes.
#
# Copyright (c) 2015 K Kollmann <code∆k.kollmann·moe>
# License: http://opensource.org/licenses/MIT The MIT License (MIT)
#
# You need to have Python 3.x installed to run this script.
# Run by opening the file containing ... | Python | 0 | @@ -777,16 +777,148 @@
nored.%0A%0A
+# TODO:%0A# check for existence of marker for e-mail signatures%0A# (two dashes followed by a newline)%0A# add appendix before signature%0A%0A
import s
|
99e5c31b350625b77cf4121b344a77ce60f25a79 | fix mutable default arguments to single_student | lib/single_student.py | lib/single_student.py | from os import path, listdir
import shutil
import re
from .find_unmerged_branches_in_cwd import find_unmerged_branches_in_cwd
from .markdownify import markdownify
from .specs import get_filenames
from .helpers import chdir
from .run import run
STOGIT = 'git@stogit.cs.stolaf.edu:sd-s16'
def remove(student):
shuti... | Python | 0.000001 | @@ -4126,22 +4126,110 @@
rgs=
-%7B%7D, specs=%7B%7D):
+None, specs=None):%0A args = %7B%7D if args is None else args%0A specs = %7B%7D if specs is None else specs%0A
%0A
|
cf1a611266c1f7097fa01a6f64c3c30a30457e1e | Generalize timeout | webapi_tests/certapp/certapp.py | webapi_tests/certapp/certapp.py | import os
import tornado
from tornado import gen
from marionette import MarionetteException
class CertAppMixin(object):
app_management = os.path.join(os.path.dirname(__file__), "app_management.js")
def __init__(self):
self.app = None
# App management is done in the system app, so switch to tha... | Python | 0.999978 | @@ -198,16 +198,41 @@
ent.js%22)
+%0A timeout = 5000 # ms
%0A%0A de
@@ -780,16 +780,17 @@
App');%22%0A
+%0A
@@ -858,16 +858,30 @@
doesn't
+%0A #
launch
@@ -905,30 +905,16 @@
l return
-%0A #
a refer
@@ -924,16 +924,30 @@
e to the
+%0A #
existin
@@ -1004,32 ... |
3d728dece31d84809fe2549bc940e2bb72b23176 | copy ctx before puting it in queue | wishful_agent/module_manager.py | wishful_agent/module_manager.py | import logging
import inspect
from .node import Node
from .node import Device
import wishful_upis as upis
from queue import Queue
__author__ = "Piotr Gawlowicz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "gawlowicz@tkn.tu-berlin.de"
class ModuleManager(objec... | Python | 0 | @@ -122,16 +122,28 @@
rt Queue
+%0Aimport copy
%0A%0A__auth
@@ -5542,16 +5542,49 @@
._upi))%0A
+ ctxCopy = copy.copy(ctx)%0A
@@ -5624,16 +5624,20 @@
(ctx=ctx
+Copy
)%0A
|
ad480bd4707771a416f474997225a55d92cf676a | Bump version number. | smarkets/__init__.py | smarkets/__init__.py | "Smarkets API package"
# Copyright (C) 2011 Smarkets Limited <support@smarkets.com>
#
# This module is released under the MIT License:
# http://www.opensource.org/licenses/mit-license.php
import inspect
import os
if 'READTHEDOCS' in os.environ:
from mock import Mock
import sys
eto = seto = \
sys.m... | Python | 0 | @@ -1145,17 +1145,17 @@
= '0.4.
-4
+5
'%0A%0A__all
|
f62627f5310a2f59d7366520799f223c0ad659d3 | make convert_os_errors handle EACCESS -> PermissionDeniedError | fs/errors.py | fs/errors.py | """
fs.errors: error class definitions for FS
"""
import sys
import errno
from fs.path import *
try:
from functools import wraps
except ImportError:
def wraps(func):
def decorator(wfunc):
wfunc.__name__ == func.__name__
wfunc.__doc__ == func.__doc__
wfunc.__mo... | Python | 0.000003 | @@ -6647,32 +6647,143 @@
ails=e),None,tb%0A
+ if e.errno == errno.EACCESS:%0A raise PermissionDeniedError(opname,details=e),None,tb%0A
# So
|
7c12b5fe6ee5a5cd9761482cc2d3e3363cab7cd3 | Save the figure | Paper/figures/joint.py | Paper/figures/joint.py | import numpy as np
import numpy.random as rng
from matplotlib import rc
import matplotlib.pyplot as plt
"""
Make a plot of \pi(L1, L2)
Based on a similar plot from ABCNS
"""
rng.seed(0)
rc("font", size=18, family="serif", serif="Computer Sans")
rc("text", usetex=True)
# Resolution
N = 256
[x, y] = np.meshgrid(np.lin... | Python | 0.000019 | @@ -982,21 +982,8 @@
.2)%0A
-plt.show()%0A%0A#
plt.
@@ -1021,24 +1021,36 @@
es='tight')%0A
+plt.show()%0A%0A
#plt.axhline
|
71f1a057535c8e2be294249f6ec2cb19fe32df18 | Clarify cli help | polymaze/cli.py | polymaze/cli.py | #! /usr/bin/python
import argparse
from datetime import datetime
import sys
import PIL.Image
from .polygrid import PolyGrid
from .shapes import supershapes_dict
from .maze import Maze
ss_dict = supershapes_dict()
def commandline():
parser = _parser()
kwargs = vars(parser.parse_args())
# setup the base... | Python | 0.000004 | @@ -3115,16 +3115,29 @@
'
+ For example:
0.5 is
@@ -3636,18 +3636,8 @@
ont
-file name/
path
|
6eca2a03b3ba273ec744d8658d6e041b16d9f85e | remove passing of update parameters based on keymaker function. add whitespace between function defs. | funcutils.py | funcutils.py | import logging
import inspect
from functools import wraps
logger = logging.getLogger('funcutils')
def memoize(key_maker):
"""Given a function which can generate hashable keys from another
functions arguments, memoize returns a decorator that will cache
the results of the decorated function"""
def deco... | Python | 0.000001 | @@ -93,16 +93,17 @@
tils')%0A%0A
+%0A
def memo
@@ -558,13 +558,8 @@
key
-, upd
= k
@@ -588,71 +588,8 @@
gs)%0A
- func_name, func_module = f.func_name, f.__module__%0A
@@ -670,153 +670,20 @@
che
-for %25s.%25s method with'%0A ' cache key: %25s' %25 (func_module, func... |
af1b840c17febd851785c95b872faa99ededd184 | Remove repeated argument | social_auth/views.py | social_auth/views.py | from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from social.utils import setting_name
from social.actio... | Python | 0.000353 | @@ -1165,48 +1165,8 @@
AME,
- request=request,%0A
*ar
|
bd528db6df38c01ab2f607d066d4e2441b53b43f | update variable value to default value 25 | mindbender/maya/tests/test_workflow.py | mindbender/maya/tests/test_workflow.py | """Integration tests
These tests include external libraries in order to test
the integration between them.
"""
import os
import sys
import shutil
import tempfile
from maya import cmds
import pyblish_maya
import pyblish.api
import pyblish.util
from mindbender import api, maya
from nose.tools import (
assert_e... | Python | 0.000003 | @@ -880,18 +880,18 @@
PS%22%5D = %22
-30
+25
%22%0A os
|
0cc745f6cbf14e38ce15862fce979bd292f9111f | Include stderr output in JUnit XML report | .gitlab-ci/meson-junit-report.py | .gitlab-ci/meson-junit-report.py | #!/usr/bin/env python3
# Turns a Meson testlog.json file into a JUnit XML report
#
# Copyright 2019 GNOME Foundation
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Emmanuele Bassi
import argparse
import datetime
import json
import os
import sys
import xml.etree.ElementTree as ET
aparser = argpa... | Python | 0 | @@ -1810,16 +1810,56 @@
stdout'%5D
+%0A log_stderr = data.get('stderr', '')
%0A%0A un
@@ -2009,16 +2009,46 @@
': log,%0A
+ 'stderr': log_stderr,%0A
%7D%0A%0A
@@ -3657,16 +3657,40 @@
stdout'%5D
+ + '%5Cn' + unit%5B'stderr'%5D
%0A%0Aoutput
|
76820b90ab727f34c164edbc90adb0a1e2a28478 | Version 4.6.2dev | socketio/__init__.py | socketio/__init__.py | import sys
from .client import Client
from .base_manager import BaseManager
from .pubsub_manager import PubSubManager
from .kombu_manager import KombuManager
from .redis_manager import RedisManager
from .kafka_manager import KafkaManager
from .zmq_manager import ZmqManager
from .server import Server
from .namespace im... | Python | 0 | @@ -1041,9 +1041,12 @@
4.6.
-1
+2dev
'%0A%0A_
|
62a77bf0f9f8543dd7cca903f1d3e94fe840f234 | Version 4.3.2dev | socketio/__init__.py | socketio/__init__.py | import sys
from .client import Client
from .base_manager import BaseManager
from .pubsub_manager import PubSubManager
from .kombu_manager import KombuManager
from .redis_manager import RedisManager
from .kafka_manager import KafkaManager
from .zmq_manager import ZmqManager
from .server import Server
from .namespace im... | Python | 0 | @@ -1041,9 +1041,12 @@
4.3.
-1
+2dev
'%0A%0A_
|
17faea99343e37036b7ee35e5d3273f98a52dba9 | Fix numpy related errors on Mavericks. | Python/tomviz/utils.py | Python/tomviz/utils.py | import numpy as np
import vtk.numpy_interface.dataset_adapter as dsa
def get_scalars(dataobject):
do = dsa.WrapDataObject(dataobject)
# get the first
rawarray = do.PointData.GetScalars()
vtkarray = dsa.vtkDataArrayToVTKArray(rawarray, do)
vtkarray.Association = dsa.ArrayAssociation.POINT
return... | Python | 0 | @@ -61,16 +61,54 @@
r as dsa
+%0Aimport vtk.util.numpy_support as np_s
%0A%0Adef ge
@@ -537,16 +537,308 @@
dscalars
+%0A%0A # handle the case if the newscalars array has a type that%0A # cannot be passed on to VTK. In which case, we convert to%0A # convert to float64%0A vtk_typecode = np_s.get_vtk_array_... |
8c718935f6ff22f5b5fef7fdef0a235dc67ed1b3 | add top-level login() helper function to load credentials in Python scripts | solvebio/__init__.py | solvebio/__init__.py | # -*- coding: utf-8 -*-
"""
SolveBio Python Client
~~~~~~~~~~~~~~~~~~~~~~
This is the Python client & library for the SolveBio API.
Have questions or comments? email us at: support@solvebio.com
"""
__docformat__ = 'restructuredtext'
import os as _os
import logging as _logging
from .help import open_help as _open_help... | Python | 0 | @@ -2202,24 +2202,31 @@
%0A%0Afrom .
+version
import
version%0A
@@ -2217,23 +2217,31 @@
import
-version
+VERSION # noqa
%0Afrom .e
@@ -2454,97 +2454,727 @@
ld)%0A
-from .cli.auth import get_credentials%0A%0A%0A__all__ = %5B%0A 'version',%0A 'get_credentials',
+%0A%0Adef login(**kwargs):%0A %22%22%22... |
bf793681003ecbacb3425592918d74fb1dad0d99 | Add CAN_DETECT | bears/general/CPDBear.py | bears/general/CPDBear.py | from shutil import which
import xml.etree.ElementTree as ET
from coalib.bears.GlobalBear import GlobalBear
from coalib.misc.Shell import run_shell_command
from coalib.results.Result import Result
from coalib.results.SourceRange import SourceRange
class CPDBear(GlobalBear):
language_dict = {"C#": "cs",
... | Python | 0.000062 | @@ -1256,16 +1256,49 @@
GPL-3.0'
+%0A CAN_DETECT = %7B'Duplication'%7D
%0A%0A @c
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.