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 |
|---|---|---|---|---|---|---|---|
5e9224d9f51b8c208f73b7493645fd6aa6b6ef48 | Removes a typo in a comment: 'not' to 'no' | revscoring/features/tests/test_previous_user_revision.py | revscoring/features/tests/test_previous_user_revision.py | from collections import namedtuple
from mw import Timestamp
from nose.tools import eq_
from ...datasources import previous_user_revision, revision
from ...dependencies import solve
from ..previous_user_revision import seconds_since
def test_seconds_since():
FakeRevisionMetadata = namedtuple("FakeRevisionMetadat... | Python | 0.999674 | @@ -627,17 +627,16 @@
e was no
-t
previou
|
ae1839cbb521be5cb7e76d87bdd65f1e736ccf8d | Add python version of register-result with more robust json serialisation | register-result.py | register-result.py | Python | 0.000001 | @@ -0,0 +1,742 @@
+#!/usr/bin/env python%0A%0Aimport json%0Aimport socket%0Aimport sys%0A%0Aif len(sys.argv) %3C 4:%0A print(%22Error: Usage %3Cregister-result%3E %3Cclient%3E %3Cname%3E %3Coutput%3E %3Cstatus%3E %3Cttl%3E%22)%0A sys.exit(128)%0A%0Acheck_client = sys.argv%5B1%5D%0Acheck_name = sys.argv%5B2%5D%0Ac... | |
1b36f7e837f6c15cab838edfaf6464bef0c88c6d | Add migration for request notification types | src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py | src/ggrc/migrations/versions/20160304124523_50c374901d42_add_request_notification_types.py | Python | 0 | @@ -0,0 +1,1834 @@
+%0A%22%22%22Add request notification types%0A%0ARevision ID: 50c374901d42%0ARevises: 4e989ef86619%0ACreate Date: 2016-03-04 12:45:23.024224%0A%0A%22%22%22%0A%0Aimport sqlalchemy as sa%0Afrom alembic import op%0Afrom sqlalchemy.sql import column%0Afrom sqlalchemy.sql import table%0A%0A# revision iden... | |
9665113ef9a6f7fae89b8a0b7b15289ac41996f4 | Create mySolution.py | Puzzles/checkio/Home/Min-and-Max/mySolution.py | Puzzles/checkio/Home/Min-and-Max/mySolution.py | Python | 0.000001 | @@ -0,0 +1,1513 @@
+def minMaxArgs(key, operator, *args): %0A if key == None:%0A key = lambda x : x %0A minMaxVal = args%5B0%5D%0A for arg in args:%0A cmpKey = key(arg)%0A if operator(cmpKey, key(minMaxVal)):%0A minMaxVal = arg%0A return minMaxVal%0A%0Adef minMaxIter(ite... | |
770f7759ffa8fee19f27f0ec365a86d11dd1454c | Version bump. | paypal/settings.py | paypal/settings.py | # coding=utf-8
"""
This module contains config objects needed by paypal.interface.PayPalInterface.
Most of this is transparent to the end developer, as the PayPalConfig object
is instantiated by the PayPalInterface object.
"""
import logging
import os
from pprint import pformat
from paypal.compat import basestring
fro... | Python | 0 | @@ -1464,10 +1464,10 @@
= '
-72
+98
.0'%0A
|
2a21ee4b263692872f11ebae18663119c5041d5e | Add test for requirements | fuel_agent/tests/test_requirements.py | fuel_agent/tests/test_requirements.py | Python | 0.000003 | @@ -0,0 +1,738 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright 2015 Mirantis, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/l... | |
1bd9013c925cfbbebcff33bf7796fde729d26b34 | add cardify script | cardify.py | cardify.py | Python | 0.000001 | @@ -0,0 +1,1590 @@
+import os%0Aimport re%0Aimport sys%0Aimport glob%0Aimport errno%0Aimport shutil%0Afrom typing import Dict, Tuple, Union, Any, List, Optional%0Afrom pprint import pprint%0A%0A%0Adef mkdir_p(path: str):%0A try:%0A path = os.path.abspath(path)%0A os.makedirs(path)%0A except OSError ... | |
fddbbc536ad5097769d924d49420e7d5d2e5999f | Update app/extensions/minify/__init__.py | app/extensions/minify/__init__.py | app/extensions/minify/__init__.py | Python | 0 | @@ -0,0 +1,1068 @@
+from htmlmin import Minifier%0A%0A%0Aclass HTMLMIN(object):%0A def __init__(self, app=None, **kwargs):%0A self.app = app%0A if app is not None:%0A self.init_app(app)%0A%0A default_options = %7B%0A 'remove_comments': True,%0A 'reduce_empty_attr... | |
118a4af7fbc2455d1dcde54e7041a3919f760d69 | Create switch_controls_snmp.py | python-mocutils/mocutils/switch_controls_snmp.py | python-mocutils/mocutils/switch_controls_snmp.py | Python | 0.000002 | @@ -0,0 +1,1297 @@
+#! /usr/bin/python%0Aimport os%0A%0Adef make_remove_vlans(vlan_ids,add,switch_ip='192.168.0.1',community='admin'):%0A%09# Expects that you send a string which is a comma separated list of vlan_ids and a bool for adding or removing%0A%09OID_portVlanId='1.3.6.1.4.1.11863.1.1.4.3.1.1.2.1.1'%0A%09OID_po... | |
f009f42c168e396e437e08914dc28eb1e08fb7fe | test of c++ wavefront code on big donut | test/test-bigdonut-cpp.py | test/test-bigdonut-cpp.py | Python | 0 | @@ -0,0 +1,1043 @@
+###%0A### Script for fitting a BIG donut%0A###%0A%0Aimport numpy as np%0A%0Afrom donutlib.donutfit import donutfit%0A%0AfitinitDict = %7B%22nZernikeTerms%22:15,%22fixedParamArray1%22:%5B0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1%5D,%22fixedParamArray2%22:%5B0,1,0,0... | |
2f2e7605d87ef06c547df660805abb99835dee18 | Add a snippet. | python/pyqt/pyqt5/widget_QAction.py | python/pyqt/pyqt5/widget_QAction.py | Python | 0.000002 | @@ -0,0 +1,1242 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Afrom PyQt5.QtCore import Qt%0Afrom PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QAction, QSizePolicy%0A%0Aapp = QApplication(sys.argv)%0A%0A# The default constructor has no parent.%0A# A widget with no parent is a window... | |
75a9584cc859d60c598582b382f41bd685579072 | add a new config file at the project root | config.py | config.py | Python | 0 | @@ -0,0 +1,217 @@
+import os%0A%0APYMICRO_ROOT_DIR = os.path.abspath(os.curdir)%0APYMICRO_EXAMPLES_DATA_DIR = os.path.join(PYMICRO_ROOT_DIR, 'examples', 'data')%0APYMICRO_XRAY_DATA_DIR = os.path.join(PYMICRO_ROOT_DIR, 'pymicro', 'xray', 'data')
| |
8212faa90328daabb85c7e877942a667aa200119 | add config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,1982 @@
+import configparser%0D%0Aimport datetime%0D%0A%0D%0A__all__ = %5B'blog_name', 'categories', 'dates', 'article_num'%5D%0D%0A%0D%0Aconfig = configparser.ConfigParser()%0D%0Aconfig.read('blog.ini', encoding='utf-8')%0D%0A%0D%0ADEFAULT = config%5B'DEFAULT'%5D%0D%0Ablog_name = DEFAULT.get('blog_name', %2... | |
5259453165cca4767743469b5e77c6eabe444839 | add config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,382 @@
+class Config(object):%0A DEBUG = False%0A TESTING = False%0A CSRF_ENABLED = True%0A SECRET_KEY = 'this-really-needs-to-be-changed'%0A%0A%0Aclass ProductionConfig(Config):%0A DEBUG = False%0A%0A%0Aclass StagingConfig(Config):%0A DEVELOPMENT = True%0A DEBUG = True%0A%0A%0Aclass Dev... | |
979d0906ba1bc7f3ec3e77a6e09ec8a1a2449323 | add clean config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,882 @@
+import os%0A%0Aworkspace = os.getcwd()%0A%0Agnu_CC = 'gcc'%0Agnu_CXX = 'g++'%0A%0Aclang_CC = 'clang'%0Aclang_CXX = 'clang++'%0A%0Aintel_CC = 'icc'%0Aintel_CXX = 'icpc'%0A%0Ampi_CC = 'mpicc'%0Ampi_CXX = 'mpic++'%0A%0A# keywords are: $mpi_nprocs, $ncores%0Ampi_RUN = 'mpirun -hostfile hostfile -np $mpi_... | |
47b88e59781cf2aeb1a4bb3b6b97ceaf6b883820 | Add prime count | cpp_10.py | cpp_10.py | Python | 0.99981 | @@ -0,0 +1,657 @@
+first_number = int(input())%0A%0Aif 0 == int(first_number):%0A print('none')%0A exit()%0A%0Aprime_count = '' %0A%0Awhile True:%0A%0A if 2 == first_number:%0A prime_count = '2'%0A break%0A%0A running_number = first_number%0A divider = first_number // 2 if ( 0 == first_numb... | |
ccac9cddfad2b883fc8e2c7c8ab27607ba8c4c63 | Create config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,958 @@
+token = '252128496:AAHUDCZJlHpd21b722S4B_n6prn8RUjy4'%0Ais_sudo = '223404066' #@This_Is_Amir%0Arelam = '-133494595'%0A# ___ __ __ _ _ _ _____ %0A# / _ %5C / _%7C/ _%7C %... | |
9fae2d4c7ecc35bde8079f5a71a2b369690cd9a3 | add config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,426 @@
+import os%0Aimport stripe%0A%0Astripe_keys = %7B%0A 'secret_key': os.environ%5B'SECRET_KEY'%5D,%0A 'publishable_key': os.environ%5B'PUBLISHABLE_KEY'%5D%0A%7D%0A%0ASALESFORCE = %7B%0A %22CLIENT_ID%22: os.environ%5B 'SALESFORCE_CLIENT_ID' %5D,%0A %22CLIENT_SECRET%22: os.environ%5B 'SALESFOR... | |
298f7d65ba29a0524ff2a3f8eb4b564ed91ad057 | Document find_by_name so I remember what to do with it. | rightscale/util.py | rightscale/util.py | import os.path
import ConfigParser
CFG_USER_RC = '.rightscalerc'
CFG_SECTION_OAUTH = 'OAuth'
CFG_OPTION_ENDPOINT = 'api_endpoint'
CFG_OPTION_REF_TOKEN = 'refresh_token'
_config = None
class HookList(list):
pass
class HookDict(dict):
pass
def get_config():
global _config
if not _config:
_... | Python | 0 | @@ -1378,19 +1378,211 @@
ame(
-res, name):
+collection, name):%0A %22%22%22%0A :param rightscale.ResourceCollection collection: The collection in which to%0A look for :attr:%60name%60.%0A%0A :param str name: The name to look for in collection.%0A %22%22%22
%0A
@@ -1637,19 +1637,26 @@
found =
-... |
fc7da8e039c38140f3855e8c58d1db9a4e8ed133 | add demo about using ftplib.FTP | reading-notes/CorePython/src/ftp.py | reading-notes/CorePython/src/ftp.py | Python | 0 | @@ -0,0 +1,2318 @@
+# Copyright (c) 2014 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of source code must retain the above copyright%0A# notice, ... | |
d059fa531f46fe063e7811a17478fab6c913acb4 | add migration file | sigmapiweb/apps/Scholarship/migrations/0006_course_coursesection_review.py | sigmapiweb/apps/Scholarship/migrations/0006_course_coursesection_review.py | Python | 0.000001 | @@ -0,0 +1,2381 @@
+# Generated by Django 3.1.6 on 2021-11-18 13:53%0A%0Aimport apps.Scholarship.models%0Aimport common.mixins%0Afrom django.conf import settings%0Aimport django.core.validators%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0... | |
2085083fc842c03efae72bbf288804ddd67605b1 | add list_comprehension | misc/list_comprehension.py | misc/list_comprehension.py | Python | 0.000002 | @@ -0,0 +1,76 @@
+#!/usr/bin/env python%0A%0As = %5B2*x for x in range(101) if x ** 2 %3E 3%5D%0A%0Aprint s%0A
| |
9e60fd94ef801bab0e8e9a5956b5c00c911bd6ca | Create tesseract_example.py | home/kyleclinton/tesseract_example.py | home/kyleclinton/tesseract_example.py | Python | 0.000006 | @@ -0,0 +1,1882 @@
+################################################################%0A#%0A# tesseract_example.py%0A# Kyle J Clinton%0A#%0A# This is an example of the use of TesseractOcr to read text from an image%0A# it is using many of the services that are common to the InMoov project or %0A# MRL in general%0A#... | |
058de6743532340611ac304c99bc7dd4ea474350 | Create NSEPA-Bypass.py | NSEPA-Bypass.py | NSEPA-Bypass.py | Python | 0 | @@ -0,0 +1,2202 @@
+import sys%0Aimport base64%0Aimport hashlib%0A## Requires pyCrypto --%3E run 'pip install pycrypto'%0Afrom Crypto.Cipher import AES%0A%0A## Check that theres is enough info%0Aif (len(sys.argv) %3C 5):%0A print(%22You're not giving me enough to work with here:%5Cn%5Cn%22);%0A print(%22Usage:%5C... | |
f7463e81817783cdb3fef3af1b1f2ec68a09cfe8 | Fix typo. | modularodm/fields/field.py | modularodm/fields/field.py | import weakref
import warnings
import copy
from modularodm import exceptions
from modularodm.query.querydialect import DefaultQueryDialect as Q
from .lists import List
def print_arg(arg):
if isinstance(arg, basestring):
return '"' + arg + '"'
return arg
class Field(object):
default = None
... | Python | 0.001604 | @@ -5934,20 +5934,21 @@
-data
+value
= copy.
|
665476df5f23bdd781054c1accd8c2e700087039 | update routing number to pass checksum | tests/test_bankaccount.py | tests/test_bankaccount.py | import unittest
import lob
# Setting the API key
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
class BankAccountFunctions(unittest.TestCase):
def setUp(self):
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
self.addr = lob.Address.list(count=1).data[0]
def test_list_bankAcc... | Python | 0 | @@ -1095,39 +1095,39 @@
uting_number='12
-3456789
+2100024
',%0A a
@@ -1493,39 +1493,39 @@
uting_number='12
-3456789
+2100024
',%0A a
@@ -1884,39 +1884,39 @@
uting_number='12
-3456789
+2100024
',%0A a
|
b3a1f84fb6f28598595f00bdb01d789051999cb9 | Update 2016-09-19 11h20 | GUI_Tkinter_Demo.py | GUI_Tkinter_Demo.py | Python | 0 | @@ -0,0 +1,242 @@
+#!/usr/bin/python%0A%0Aimport Tkinter%0Aimport tkMessageBox%0A%0Atop = Tkinter.Tk()%0A%0Adef helloCallBack():%0A tkMessageBox.showinfo(%22Hello Python%22, %22Hello World%22)%0A%0AB = Tkinter.Button(top, text=%22Hello%22, command = helloCallBack)%0A%0AB.pack()%0Atop.mainloop()
| |
e397d400a81466b22ae735f60f5a239ca4b7d653 | create domain lookup module | domain.py | domain.py | Python | 0 | @@ -0,0 +1,2175 @@
+# domain.py%0A# Look up a domain's availability%0A%0A# Copyright 2015 Jason Owen %3Cjason.a.owen@gmail.com%3E%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation,... | |
dda3ce9c56967dc6069b61f16feed2932e24ea14 | test = input ("CPF: ") cpf = test[:3] + "." + test[3:6] + "." + test[6:9] + "-" + test[9:] print(cpf) | Python/FormatCpf.py | Python/FormatCpf.py | Python | 0.999999 | @@ -0,0 +1,147 @@
+test = input (%22CPF: %22) %0Acpf = test%5B:3%5D + %22.%22 + test%5B3:6%5D + %22.%22 + test%5B6:9%5D + %22-%22 + test%5B9:%5D%0Aprint(cpf)%0A%0A#https://pt.stackoverflow.com/q/237371/101%0A
| |
f27241b5409ec00568efa1752d5eeb71516b16bd | Add cellular.py | cellular.py | cellular.py | Python | 0.00017 | @@ -0,0 +1,941 @@
+import random%0A%0Aclass TotalisticCellularAutomaton:%0A def __init__(self):%0A self.n_cells = 200%0A self.n_states = 5%0A self.symbols = ' .oO0'%0A self.radius = 1%0A self.cells = %5Brandom.randrange(0, self.n_states) for _ in range(self.n_cells)%5D%0A%0A ... | |
7a1a59e5bb5a64dbeb91abdcac31dd0c8803c27d | Functional tests for security group rule | functional/tests/compute/v2/test_security_group_rule.py | functional/tests/compute/v2/test_security_group_rule.py | Python | 0.998997 | @@ -0,0 +1,2375 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or a... | |
03d5fb46c877d176ed710a8d27b5ad7af699dc52 | add Lubebbers example | pylayers/antprop/tests/Diffraction-Luebbers.py | pylayers/antprop/tests/Diffraction-Luebbers.py | Python | 0 | @@ -0,0 +1,391 @@
+%0A# coding: utf-8%0A%0A# In%5B1%5D:%0A%0Afrom pylayers.simul.link import *%0A%0A%0A# In%5B2%5D:%0A%0ADL=DLink(L=Layout('Luebbers.ini'),graph='tvi')%0A%0A%0A# In%5B3%5D:%0A%0A# get_ipython().magic(u'matplotlib inline')%0A# DL.L.showG('i')%0A%0A%0A# In%5B7%5D:%0A%0ADL.a = np.array((%5B37.5,6.2,2.%5D))... | |
8fb25066deee46a22562be8e416556749678eb0b | remove printout | bihar/utils.py | bihar/utils.py | from operator import attrgetter
from django.utils.translation import ugettext_noop
from corehq.apps.groups.models import Group
ASHA_ROLE = ugettext_noop('ASHA')
AWW_ROLE = ugettext_noop('AWW')
def get_team_members(group):
"""
Get any commcare users that are either "asha" or "aww".
"""
... | Python | 0.000006 | @@ -1783,41 +1783,8 @@
ts:%0A
- print indicator_set.name%0A
|
1873d42095b6d56f9fa0019a9658b250c39a3a23 | Reverse the logic | mongodb_consistent_backup/State.py | mongodb_consistent_backup/State.py | import logging
import os
import platform
from bson import BSON, decode_all
from time import time
from mongodb_consistent_backup.Common import Lock
from mongodb_consistent_backup.Errors import OperationError
class StateBase(object):
def __init__(self, base_dir, config, filename="meta.bson", state_version=1, meta... | Python | 0.999999 | @@ -879,17 +879,20 @@
try
-recursive
+normal mkdir
fir
@@ -913,19 +913,46 @@
o re
-gular mkdir
+cursive mkdir if there is an exception
%0A
@@ -989,15 +989,12 @@
os.m
-ake
+k
dir
-s
(sel
@@ -1063,36 +1063,39 @@
os.m
-k
+ake
dir
+s
(self.state_dir)
|
471d1d4ae197c7643eeac374a0353adbce54fd44 | add scheme to grabber api url if not present | src/streamlink/plugins/nineanime.py | src/streamlink/plugins/nineanime.py | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.stream import HTTPStream
class NineAnime(Plugin):
_episode_info_url = "http://9anime.to/ajax/episode/info"
_info_schema = validate.Schema({
"grabber": valid... | Python | 0 | @@ -79,16 +79,61 @@
rt http%0A
+from streamlink.plugin.api import useragents%0A
from str
@@ -208,16 +208,55 @@
PStream%0A
+from streamlink.compat import urlparse%0A
%0A%0Aclass
@@ -303,13 +303,8 @@
= %22
-http:
//9a
@@ -783,154 +783,8 @@
%7D)%0A%0A
- _user_agent = %22Mozilla/5.0 (X11; Linux x86_64) AppleWeb... |
d965740b6e0021686b284d164a1eddd17519244a | set version to 4.2.0 for release | rdflib/__init__.py | rdflib/__init__.py | """\
A pure Python package providing the core RDF constructs.
The packages is intended to provide the core RDF types and interfaces
for working with RDF. The package defines a plugin interface for
parsers, stores, and serializers that other packages can use to
implement parsers, stores, and serializers that will plug ... | Python | 0 | @@ -941,12 +941,8 @@
.2.0
--dev
%22%0A__
@@ -961,12 +961,12 @@
15/0
-1/07
+2/19
%22%0A%0A_
|
bbbddd3d505f18759b509442238cd492f420a142 | Fix ordered_dict_merge rename error | fwgen/fwgen_cmd.py | fwgen/fwgen_cmd.py | import argparse
import signal
import sys
import subprocess
from collections import OrderedDict
from pkg_resources import resource_filename
import yaml
import fwgen
# Python 2.7 compatibility
try:
input = raw_input
except NameError:
pass
class TimeoutExpired(Exception):
pass
def alarm_handler(signum, f... | Python | 0.000001 | @@ -764,16 +764,24 @@
+ordered_
dict_mer
|
566e3e9140ef96d58aaa4bfc0f89d9429a978485 | add a script to get connections between the minima | get_connections.py | get_connections.py | Python | 0 | @@ -0,0 +1,626 @@
+from lj_run import LJClusterNew%0Aimport sys%0Afrom pygmin.landscape import Graph%0A%0Anatoms = int(sys.argv%5B1%5D)%0Adbname = sys.argv%5B2%5D%0A%0Asystem = LJClusterNew(natoms)%0Adb = system.create_database(dbname)%0A%0Awhile True:%0A min1 = db.minima()%5B0%5D%0A%0A graph = Graph(db)%0A%0A ... | |
72b701652271178e08d9cccd088d24177d4a2fc6 | Add functions for storing/getting blogs and posts | pyblogit/database_handler.py | pyblogit/database_handler.py | Python | 0 | @@ -0,0 +1,2237 @@
+%22%22%22%0Apyblogit.database_handler%0A~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0AThis module handles the connection and manipulation of the local database.%0A%22%22%22%0Aimport sqlite3%0A%0A%0Adef get_cursor(blog_id):%0A %22%22%22Connects to a local sqlite database%22%22%22%0A conn = sqlite3.connect(blo... | |
726316b50209dfc5f6a8f6373cd7e3f53e267bb3 | Implement a genre string parser | geodj/genre_parser.py | geodj/genre_parser.py | Python | 0.999999 | @@ -0,0 +1,1102 @@
+import re%0Afrom django.utils.encoding import smart_str%0A%0Aclass GenreParser:%0A @staticmethod%0A def parse(genre):%0A genre = smart_str(genre).lower()%0A if re.search(r%22%5Cb(jazz%7Cblues)%5Cb%22, genre):%0A return %22jazz%22%0A if re.search(r%22%5Cb(ska%7Cr... | |
23402487a2b12aca391bb5958b4ba3e9424a6801 | Add a new management command 'olccperiodic' to update the 'on_sale' property for all products. | django_olcc/olcc/management/commands/olccperiodic.py | django_olcc/olcc/management/commands/olccperiodic.py | Python | 0 | @@ -0,0 +1,2127 @@
+import datetime%0A%0Afrom django.core.management.base import BaseCommand%0Afrom django.db import IntegrityError, transaction%0Afrom olcc.models import Product, ProductPrice%0Afrom optparse import make_option%0A%0Aclass Command(BaseCommand):%0A help = %22%22%22%5C%0A A command to be run periodi... | |
860d81ec5f0b9ae4c28a1996773c06240c31b67a | Update names | canvas.py | canvas.py | Python | 0.000001 | @@ -0,0 +1,1476 @@
+#!/usr/bin/env python3%0Afrom tkinter import *%0Afrom tkinter import ttk%0Aimport math%0A%0Aclass App:%0A def __init__(self):%0A self.lastx = 0%0A self.lasty = 0%0A self.fill = 'red'%0A self.width = 2%0A%0A root = Tk()%0A root.columnconfigure(0, weight=1... | |
d5c7d429be93a2b2de4a1c09bd73f72c02664499 | Move win32 audio experiment to trunk. | experimental/directshow.py | experimental/directshow.py | Python | 0 | @@ -0,0 +1,1524 @@
+#!/usr/bin/python%0D%0A# $Id:$%0D%0A%0D%0A# Play an audio file with DirectShow. Tested ok with MP3, WMA, MID, WAV, AU.%0D%0A# Caveats:%0D%0A# - Requires a filename (not from memory or stream yet). Looks like we need%0D%0A# to manually implement a filter which provides an output IPin. Lot of%0D%... | |
285c852bb246042a4f882ab9ca2948e4f0241dac | add GTC.meshgrid Core | src/processors/GTC/meshgrid.py | src/processors/GTC/meshgrid.py | Python | 0.000001 | @@ -0,0 +1,1838 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2018 shmilee%0A%0A'''%0ASource fortran code:%0A%0Av110922%0A-------%0A%0Adiagnosis.F90, subroutine diagnosis:37-50%0A !!diagnosis xy%0A if(mype==1)then%0A open(341,file='meshgrid.out',status='replace')%0A do i=0,mpsi%0A write(341,*)ps... | |
e731bfdabbf42b636b02e93ccd3b67c55a28d213 | add unit test | axelrod/tests/test_appeaser.py | axelrod/tests/test_appeaser.py | Python | 0.000001 | @@ -0,0 +1,579 @@
+%22%22%22%0ATest for the appeaser strategy%0A%22%22%22%0Aimport unittest%0Aimport axelrod%0A%0Aclass TestAppeaser(unittest.TestCase):%0A%0A def test_strategy(self):%0A P1 = axelrod.Appeaser()%0A P2 = axelrod.Player()%0A%09P1.str = 'C';%0A self.assertEqual(P1.strategy(P2), 'C')... | |
0a0d31077746e69bf5acc7d90fa388e121544339 | Add skeleton for new python scripts. | script_skeleton.py | script_skeleton.py | Python | 0 | @@ -0,0 +1,982 @@
+#!/usr/bin/python%0A%0A%22%22%22Usage:%0A %3CSCRIPT_NAME%3E %5B--log-level=%3Clog-level%3E%5D%0A%0A-h --help%0A Show this message.%0A-v --version%0A Show version.%0A--log-level=%3Clog-level%3E%0A Set logging level (one of %7Blog_level_vals%7D) %5Bdefault: info%5D.%0A%22%22%22%0A%0Aimport ... | |
63b954c952dda9d123e6fa1e348babae97523e21 | Create securitygroup.py | azurecloudify/securitygroup.py | azurecloudify/securitygroup.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
ac78f3f774dbfda4e2c96786ddebf74066a56f54 | add mtbf_job_runner | mtbf_job_runner.py | mtbf_job_runner.py | Python | 0.000004 | @@ -0,0 +1,573 @@
+#!/usr/bin/env python%0Aimport combo_runner.action_decorator%0Afrom combo_runner.base_action_runner import BaseActionRunner%0Afrom utils.zip_utils import modify_zipfile%0Aimport os%0A%0A%0Aclass MtbfJobRunner(BaseActionRunner):%0A%0A action = combo_runner.action_decorator.action%0A%0A def pre_f... | |
f5bb497960f9f9256cc9794baf0c53c4ba5d734f | Add Spider class for web crawling. | Spider.py | Spider.py | Python | 0 | @@ -0,0 +1,112 @@
+'''%0D%0ACreated on 7/07/2016%0D%0A%0D%0A@author: garet%0D%0A'''%0D%0A%0D%0Aclass Spider():%0D%0A %0D%0A def __init__(self):%0D%0A pass
| |
8c8d28e95cf99f8aff4ba45819b08995ef63ea44 | add hubble | hubble.py | hubble.py | Python | 0.998455 | @@ -0,0 +1,977 @@
+import urllib%0Aimport os%0A%0Adef fetchImages(start, stop):%0A counter = 0%0A imgIndex = start%0A for i in range(start, start+stop+1):%0A urllib.urlretrieve(%22%22+str(imgIndex)+%22.jpg%22, str(imgIndex)+%22.jpg%22)%0A print(%22Image# %22+str(counter)+%22 of %22+str(stop)+%22 ... | |
62296474a389f684dbc1b66fb5256d494111b7c9 | Add a script to reproduce ezio issue #4 | SocketABC/ezio_issue4_reproduce.py | SocketABC/ezio_issue4_reproduce.py | Python | 0 | @@ -0,0 +1,675 @@
+# -*- coding: utf-8 -*-%0A%0Aimport hashlib%0Aimport socket%0Aimport struct%0A%0ASERVER_NAME = 'localhost'%0ASERVER_PORT = 9876%0A%0Adef main():%0A client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)%0A client_socket.connect((SERVER_NAME, SERVER_PORT))%0A%0A msg_len = 1600%0A ... | |
6d93e603cd45544e296b8cd90853377688af6376 | Add median/LoG filter fcn | imgphon/ultrasound.py | imgphon/ultrasound.py | Python | 0.000001 | @@ -0,0 +1,778 @@
+import numpy as np%0Afrom scipy.ndimage import median_filter%0Afrom scipy.ndimage.filters import gaussian_laplace%0A%0Adef clean_frame(frame, median_radius=5, log_sigma=4):%0A %22%22%22%0A Input: ndarray image, filter kernel settings%0A Output: cleaned ndarray image%0A A median filt... | |
ca3add180e8dc124e9ebec35682215a6de0ae9b1 | Add test_poly_divide script. | research/test_poly_divide.py | research/test_poly_divide.py | Python | 0 | @@ -0,0 +1,913 @@
+%0A# use time() instead on unix%0Aimport sys%0Aif sys.platform=='win32':%0A from time import clock%0Aelse:%0A from time import time as clock%0A%0Afrom sympycore import profile_expr%0A%0Adef time1(n=500):%0A import sympycore as sympy%0A w = sympy.Fraction(3,4)%0A x = sympy.polynomials.p... | |
8adbbc365042d49c1304610b3425e0974b1c6451 | Switch a little of the html generation to jinja2 | blaze/server/datashape_html.py | blaze/server/datashape_html.py | from ..datashape import DataShape, Record, Fixed, Var, CType, String, JSON
#from blaze_server_config import jinja_env
#from jinja2 import Template
def json_comment(array_url):
return '<font style="font-size:x-small"> # <a href="' + \
array_url + '?r=data.json">JSON</a></font>\n'
def render_datashape_recur... | Python | 0.000001 | @@ -111,17 +111,16 @@
nja_env%0A
-#
from jin
@@ -140,20 +140,16 @@
mplate%0A%0A
-def
json_com
@@ -156,33 +156,29 @@
ment
-(array_url):%0A return '
+_templ = Template(%22%22%22
%3Cfon
@@ -221,35 +221,20 @@
ef=%22
-' + %5C%0A array_url + '
+%7B%7Bbase_url%7D%7D
?r=d
@@ -258,19 +258,151 @@
%3E%3C/font%... |
ce1921e079b68c250b6bc979e67c478b94747688 | Change the order of metric name components | src/collectors/postgres/postgres.py | src/collectors/postgres/postgres.py | # coding=utf-8
"""
Collect metrics from postgresql
#### Dependencies
* psycopg2
"""
import diamond.collector
try:
import psycopg2
psycopg2 # workaround for pyflakes issue #13
except ImportError:
psycopg2 = None
class PostgresqlCollector(diamond.collector.Collector):
def get_default_config_hel... | Python | 0.99894 | @@ -2990,35 +2990,32 @@
self.publish(%22
-%25s.
database.%25s%22 %25 (
@@ -3009,16 +3009,19 @@
abase.%25s
+.%25s
%22 %25 (%0A
@@ -3146,19 +3146,16 @@
ublish(%22
-%25s.
database
@@ -3155,16 +3155,19 @@
atabase.
+%25s.
connecti
|
711de8a04598fb531b5f70f334633b713dfa76c7 | Create TypeIt.py | TypeIt.py | TypeIt.py | Python | 0.000001 | @@ -0,0 +1,22 @@
+print(%22Hello Daniel%22)%0A
| |
94151b40c3b862c5ddf57c11228f6c99a8c38a7e | Define manage.py to launch app and app-related tasks | edx_data_research/web_app/manage.py | edx_data_research/web_app/manage.py | Python | 0.000001 | @@ -0,0 +1,526 @@
+#!/usr/bin/python%0Afrom flask.ext.script import Manager, Server, Shell%0A%0Afrom edx_data_research.web_app import app%0Afrom edx_data_research.web_app.models import User, Role%0A%0Amanager = Manager(app)%0A%0Amanager.add_command('run-server', Server(use_debugger=True, use_reloader=True,%0A ... | |
ec919af7fba21e98e73e6c435dda4f10e90b82ba | Create Vector.py | Vector.py | Vector.py | Python | 0 | @@ -0,0 +1,2795 @@
+# The Vector class%0Aclass Vector:%0A%0A # Initialiser%0A def __init__(self, p=(0,0)):%0A self.x = p%5B0%5D%0A self.y = p%5B1%5D%0A%0A # Returns a string representation of the vector%0A def __str__(self):%0A return %22(%22+ str(self.x) + %22,%22 + str(self.y) + %22)%... | |
a70abcdd95612fe3df4fc3dd9c4ae8151add5a28 | add an example file | example.py | example.py | Python | 0.000001 | @@ -0,0 +1,1713 @@
+import numpy as np%0Afrom pyscatter3d import pyscatter3d%0A%0AX0,Y0 = np.meshgrid(np.linspace(-3,3,50), np.linspace(-3,3,50))%0AD = np.sqrt(X0**2+Y0**2) # radial distance%0AZ0 = np.sinc(D)%0A%0A_ = np.random.randn(3, 1e3)%0AX1,Y1,Z1 = _/np.linalg.norm(_, axis=0)%0A%0Anp.savetxt('sinc.csv', np.array(... | |
28e6c21e2a8bc78a6f4292eef2daec4b70d0b887 | Add support for Pocket | services/pocket.py | services/pocket.py | Python | 0 | @@ -0,0 +1,1725 @@
+from werkzeug.urls import url_decode%0Aimport requests%0Aimport foauth.providers%0A%0A%0Aclass Pocket(foauth.providers.OAuth2):%0A # General info about the provider%0A provider_url = 'http://getpocket.com/'%0A docs_url = 'http://getpocket.com/developer/docs/overview'%0A category = 'News'... | |
e42b22dc0a71fb5c7572ca69c63ab6a7b0ba8479 | add error handling for celery tasks | src/helfertool/tasks.py | src/helfertool/tasks.py | Python | 0.000001 | @@ -0,0 +1,626 @@
+from __future__ import absolute_import%0A%0Afrom celery.signals import task_failure%0A%0Afrom django.conf import settings%0Afrom django.core.mail import mail_admins%0Afrom django.views.debug import ExceptionReporter%0A%0A%0A@task_failure.connect%0Adef celery_error_handler(task_id, exception, tracebac... | |
73f75483156056b61f3b6bec4fe2f09522c2c34a | Add tests for mixin order | test/integration/ggrc/models/test_eager_query.py | test/integration/ggrc/models/test_eager_query.py | Python | 0 | @@ -0,0 +1,1394 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: miha@reciprocitylabs.com%0A# Maintained By: miha@reciprocitylabs.com%0A%0A%22%22%22Tests for making sure eager queri... | |
6ed99163b10209566a0575a9a67d1ab2ad552fd9 | Add test for committee subscriptions page | tests/views/test_committee_subscriptions_page.py | tests/views/test_committee_subscriptions_page.py | Python | 0 | @@ -0,0 +1,666 @@
+import datetime%0Afrom tests import PMGLiveServerTestCase%0Afrom tests.fixtures import dbfixture, HouseData, CommitteeData%0A%0ATHIS_YEAR = datetime.datetime.today().year%0A%0A%0Aclass TestCommitteeSubscriptionsPage(PMGLiveServerTestCase):%0A def test_committee_subscriptions_page(self):%0A ... | |
5e9b6bc60f0f81db3ed451eb89c23b77888e1167 | Update a comment | djangae/db/backends/appengine/expressions.py | djangae/db/backends/appengine/expressions.py | from django.db.models.expressions import F
from djangae.db.utils import get_prepared_db_value
CONNECTORS = {
F.ADD: lambda l, r: l + r,
F.SUB: lambda l, r: l - r,
F.MUL: lambda l, r: l * r,
F.DIV: lambda l, r: l / r,
}
def evaluate_expression(expression, instance, connection):
""" A limited eval... | Python | 0 | @@ -351,22 +351,14 @@
ns.
-Although they'
+This a
re e
@@ -365,16 +365,23 @@
valuated
+ within
%0A
@@ -385,175 +385,81 @@
-before the database call, so they don't provide the race condition protection,%0A but neither does our update() implementation so we provide this for convenience.
+the get/... |
e53f0f4b0f541adf6b8a9df3c2a2af2c8b306720 | Fix lint. | packs/email/sensors/imap_sensor.py | packs/email/sensors/imap_sensor.py | import hashlib
import base64
import eventlet
import easyimap
from flanker import mime
from st2reactor.sensor.base import PollingSensor
__all__ = [
'IMAPSensor'
]
eventlet.monkey_patch(
os=True,
select=True,
socket=True,
thread=True,
time=True)
DEFAULT_DOWNLOAD_ATTACHMENTS = False
DEFAULT_MA... | Python | 0.000001 | @@ -915,33 +915,32 @@
-
DEFAULT_MAX_ATTA
@@ -5746,16 +5746,92 @@
le_name,
+%0A
attachm
|
37e59cbd7e8b4901644adcb73a7f491247fdea69 | Add py-pyperclip package (#12375) | var/spack/repos/builtin/packages/py-pyperclip/package.py | var/spack/repos/builtin/packages/py-pyperclip/package.py | Python | 0 | @@ -0,0 +1,595 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyPyperclip(PythonPackage):%0A %22%22%22A cross-platform... | |
6427c55bbd51abaef6847e4f2af239d5977d0048 | Create client.py | client.py | client.py | Python | 0 | @@ -0,0 +1,555 @@
+import socket%0A%0Atarget_host = %220.0.0.0%22%0Atarget_port = 9999%0A%0Aif(len(sys.argv) %3E 1):%0A try:%0A target_ip = sys.argv%5B1%5D%0A target_port = int(sys.argv%5B2%5D)%0A except Exception:%0A pass #lazy%0A%0A%0Aclient = socket.socket(socket.AF_INET, socket.SO... | |
04d6765c14de3d6d5eb36d9ad268012f9e7625bc | add test for search items #30 | vagrant/tradyfit/tests/functional/test_search.py | vagrant/tradyfit/tests/functional/test_search.py | Python | 0 | @@ -0,0 +1,2680 @@
+# -*- coding: utf-8 -*-%0Aimport re%0Afrom bs4 import BeautifulSoup%0Afrom helper import SeleniumTestCase%0Aimport page%0A%0A%0Aclass SearchTestCase(SeleniumTestCase):%0A%0A @classmethod%0A def setUpClass(cls):%0A # connect to webdriver, create app, launch server in thread%0A super(SearchTes... | |
ad3744acef6d855fcc074c7412c3e224d5a8f205 | add missing file | saga/utils/pty_exceptions.py | saga/utils/pty_exceptions.py | Python | 0.000003 | @@ -0,0 +1,1687 @@
+%0A%0Aimport saga.exceptions as se%0A%0A# ----------------------------------------------------------------%0A#%0Adef translate_exception (e, msg=None) :%0A %22%22%22%0A In many cases, we should be able to roughly infer the exception cause%0A from the error message -- this is centrally done ... | |
df7a5c4aa4f5898de3c70cef17c3c5031f7e05a6 | Add support for executing scrapy using -m option of python | scrapy/__main__.py | scrapy/__main__.py | Python | 0.000007 | @@ -0,0 +1,77 @@
+from scrapy.cmdline import execute%0A%0Aif __name__ == '__main__':%0A execute()%0A
| |
3c9d90f2f3177c611b848b136f8bfe9f4a676dd5 | Fix logic in claimit.py | scripts/claimit.py | scripts/claimit.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A script that adds claims to Wikidata items based on a list of pages.
------------------------------------------------------------------------------
Usage:
python pwb.py claimit [pagegenerators] P1 Q2 P123 Q456
You can use any typical pagegenerator (like categories)... | Python | 0 | @@ -3881,32 +3881,127 @@
break%0A
+ if not existing.target_equals(claim.getTarget()):%0A continue%0A
@@ -4247,79 +4247,8 @@
if
-(existing.target_equals(claim.getTarget()) and%0A
't'
@@ -4269,17 +4269,16 @@
ists_arg
-)
:%0A ... |
d94123ba898032e7837aa8a2fd0fe585ed81e2d5 | Add back a filesystem backend for testing and development | scrapi/processing/storage.py | scrapi/processing/storage.py | Python | 0 | @@ -0,0 +1,839 @@
+import os%0Aimport json%0A%0Afrom scrapi.processing.base import BaseProcessor%0A%0A%0Aclass StorageProcessor(BaseProcessor):%0A NAME = 'storage'%0A%0A def process_raw(self, raw):%0A filename = 'archive/%7B%7D/%7B%7D/raw.%7B%7D'.format(raw%5B'source'%5D, raw%5B'docID'%5D, raw%5B'filetype'... | |
e6699947ebde4d51b1bd8b6016879d4917d7a648 | implement initial base exception class and httperror exception class | scup/exceptions.py | scup/exceptions.py | Python | 0 | @@ -0,0 +1,493 @@
+class ScupPythonError(Exception):%0A%09%22%22%22 Base class for exceptions raised by scup-python. %22%22%22%0A%0A%0Aclass ScupError(ScupPythonError):%0A%09%22%22%22 Exception for Scup errors. %22%22%22%0A%09def __init__(self, message=None, code=None, error_data=None):%0A%09%09self.message = message%0... | |
ded34849d9eb2feb51b9ad7f31e210db3a28c7e1 | change case | aleph/assets.py | aleph/assets.py | import os
from flask.ext.assets import Bundle
from aleph.core import assets, app
deps_assets = Bundle(
'vendor/jquery/dist/jquery.js',
'vendor/angular/angular.js',
'vendor/ng-debounce/angular-debounce.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-animate/angular-animate.js',
'v... | Python | 0.00005 | @@ -480,17 +480,17 @@
r/ng
-i
+I
nfinite
-s
+S
crol
|
b2d60408688cc1bf27842d8744d1048a64b00e94 | Add script to get public registrations for staff members | scripts/staff_public_regs.py | scripts/staff_public_regs.py | Python | 0 | @@ -0,0 +1,1366 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Get public registrations for staff members.%0A%0A python -m scripts.staff_public_regs%0A%22%22%22%0Afrom collections import defaultdict%0Aimport logging%0A%0Afrom modularodm import Q%0A%0Afrom website.models import Node, User%0Afrom website.app import init_app%0... | |
b77f90c4372161243fcabb3eddbe4d35b4792bfc | Create jupyter_notebook_config.py | jupyter_notebook_config.py | jupyter_notebook_config.py | Python | 0.000002 | @@ -0,0 +1,1045 @@
+# Copyright 2015 The TensorFlow Authors. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENS... | |
d4a8c33d50a7c130d6203ef6332a241392516ba2 | Create database.py | database.py | database.py | Python | 0.000001 | @@ -0,0 +1,807 @@
+#!/usr/bin/python%0Aimport MySQLdb%0A%0Adef getemail():%0A alist=%5B%5D%0A # Open database connection Replace username, password with your username password and dbname with the name of database%0A db = MySQLdb.connect(%22localhost%22,%22username%22,%22password%22,%22dbname%22 )%0A # prepa... | |
5bb77cb83ea443e5e3ae4b4000763e4289f8e87a | add timeout and retry for ssh | smoketests/base.py | smoketests/base.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | Python | 0 | @@ -1094,16 +1094,82 @@
_NAMES)%0A
+flags.DEFINE_integer('ssh_tries', 3, 'Numer of times to try ssh')%0A
boto_v6
@@ -1262,81 +1262,8 @@
e):%0A
- # TODO(devcamcar): set a more reasonable connection timeout time%0A
@@ -1328,32 +1328,96 @@
em' %25 key_name)%0A
+ tries = 0%0A while(True):%0A... |
cb73106d4a47a21f82021794234672600cceb2c6 | Add fix_genre_counts | populate_database/fix_genre_counts.py | populate_database/fix_genre_counts.py | Python | 0.000018 | @@ -0,0 +1,924 @@
+#!/usr/bin/python%0A%0A# we've been outputting stuff to text so now I get to wedge it into a database%0A# funtimes%0A%0A# set up the database with %60sqlite3 netflix_genres.sqlite %3C create_tables.sql%60%0A%0Aimport codecs%0Aimport sqlite3%0Aimport sys%0A%0Aconn = sqlite3.connect('netflix.sqlite')%0... | |
d74f0d174f509b0a65e5643356af8eff1f5a4ca8 | Add a snippet. | python/scipy/write_stereo_wav_file.py | python/scipy/write_stereo_wav_file.py | Python | 0.000002 | @@ -0,0 +1,716 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Read the content of an audio wave file (.wav)%0A# See: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.wavfile.write.html%0A%0Aimport numpy as np%0Afrom scipy.io import wavfile%0A%0Adef sin_wave(freq1, freq2, num_frames, rate... | |
181832a67d3fa3a4993d495dc9db12fdae7329f7 | add context processor tests | clastic/tests/test_context_proc.py | clastic/tests/test_context_proc.py | Python | 0.000001 | @@ -0,0 +1,2865 @@
+from __future__ import unicode_literals%0Afrom nose.tools import eq_, raises%0A%0Aimport json%0A%0Afrom werkzeug.test import Client%0Afrom werkzeug.wrappers import BaseResponse%0A%0Afrom clastic import Application, json_response%0Afrom clastic.middleware import SimpleContextProcessor, ContextProcess... | |
f9bdf777a13404ba25e0e8cdf99a3554320529c9 | Add warnings to inspector DOM count unittest baselines. | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | tools/telemetry/telemetry/core/backends/chrome/inspector_memory_unittest.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from telemetry.unittest import tab_test_case
class InspectorMemoryTest(tab_test_case.TabTestCase):
@benchmark.Enabled('h... | Python | 0.000003 | @@ -599,85 +599,439 @@
-counts = self._tab.dom_stats%0A self.assertEqual(counts%5B'document_count'%5D, 1
+# Document_count %3E 1 indicates that WebCore::Document loaded in Chrome%0A # is leaking! The baseline should exactly match the numbers on:%0A # unittest_data/dom_counter_sample.html%0A # Please c... |
3119222d27bd63b9f4e9a57ff8e9d88e53d9735a | Modify island.py | island.py | island.py | Python | 0.000007 | @@ -0,0 +1,271 @@
+from noise import generate_noise%0Afrom PIL import Image%0Aimport numpy as np%0A%0AWIDTH = 128%0AHEIGHT = 128%0A%0Aif __name__ == '__main__':%0A data = np.array(generate_noise(WIDTH, HEIGHT, triple=True), dtype=np.uint8)%0A img = Image.fromarray(data, 'RGB')%0A img.save('out.png')%0A
| |
2d55503216d7020a71017fbcb2c1b48661c345cb | Add manage | manage.py | manage.py | Python | 0.000001 | @@ -0,0 +1,249 @@
+#!/usr/bin/env python%0Aimport os%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22mysite.settings%22)%0A%0A from django.core.management import execute_from_command_line%0A%0A execute_from_command_line(sys.argv)%0A
| |
77738a8b7e895b5f71418d5417db04f34b08f918 | add manage.py | manage.py | manage.py | Python | 0.000001 | @@ -0,0 +1,242 @@
+#!/usr/bin/env python%0Aimport os%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22settings%22)%0A%0A from django.core.management import execute_from_command_line%0A%0A execute_from_command_line(sys.argv)%0A
| |
10ef7955b21e3f9d3f3ac9eb43995e7cf0e91201 | Add meta/import_all.py for testing | meta/import_all.py | meta/import_all.py | Python | 0 | @@ -0,0 +1,1370 @@
+#! /usr/bin/env python%0A# encoding: utf-8%0A%22%22%22Imports all the modules under the specified path.%0A%0AThis can be useful as a basic static analysis test, assuming that the imports%0Ado not have side-effects.%0A%0A%22%22%22%0A%0Afrom __future__ import print_function%0A%0Aimport argparse%0Aimpo... | |
efd125ef973a680b6413e820e1308070a79554b4 | Encrypt with vigenere cipher | practic_stage/hmw8/main.py | practic_stage/hmw8/main.py | Python | 0.007626 | @@ -0,0 +1,462 @@
+import string%0A%0Aletters = string.ascii_uppercase%0A%0Avigenere_table = %7Bletter: %7Bletters%5Bj%5D: letters%5B(i + j) %25 26%5D%0A for j, l in enumerate(letters)%7D%0A for i, letter in enumerate(letters)%7D%0A%0A%0Adef encrypt(text, key):%0A encrypted =... | |
5f63a5ebfe3210fe68df036eef27a51bf431f6a3 | Initialize transpositionFileCipher | books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py | books/CrackingCodesWithPython/Chapter10/transpositionFileCipher.py | Python | 0.00001 | @@ -0,0 +1,2009 @@
+# Transposition Cipher Encrypt/Decrypt File%0A# https://www.nostarch.com/crackingcodes/ (BSD Licensed)%0A%0Aimport time, os, sys, transpositionEncrypt, transpositionDecrypt%0A%0Adef main():%0A inputFilename = 'frankenstein.txt'%0A # BE CAREFUL! If a file with the outputFilename name already ex... | |
fc8a37b63ddc2455afbeeae0a6c2ac911c113337 | add new | maya/python/animation/grapheditor/fit_key_tangent.py | maya/python/animation/grapheditor/fit_key_tangent.py | Python | 0.000002 | @@ -0,0 +1,1156 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# %0A# Author : Masahiro Ohmomo%0A# DCC : Maya%0A# Version : 2013 - Latest%0A# Recommend: 2013%0A# %0A# Description.%0A# In this script, do the fitting.%0A# The target is keyframe's tangent.%0A# You should be selected keyframe's of least two ... | |
73fce6afc07496dcc79c2e2763523207c257185b | Update the docstring | rhea/vendor/device_clock_mgmt_prim.py | rhea/vendor/device_clock_mgmt_prim.py |
from __future__ import absolute_import
import myhdl
from myhdl import instance, delay, always_comb
from rhea.system import timespec
@myhdl.block
def _clock_generate(clock, enable, ticks):
assert len(ticks) == 2
totticks = sum(ticks)
@instance
def mdlclk():
clock.next = False
while ... | Python | 0.000061 | @@ -656,19 +656,18 @@
PLL mod
-ul
e
+l
%0A The
@@ -872,14 +872,13 @@
-module
+block
als
@@ -967,16 +967,59 @@
vailable
+.%0A %0A not convetible, simulation only.
%0A %22%22%22
|
ea7c05a74a7d2b652bff7f3501be8e4a87e9fdef | Test suite setting and running all tests | proto/parallel/Parallel.py | proto/parallel/Parallel.py | import subprocess
from time import time
from random import randint
import os
import re
import sys
from robot.libraries import BuiltIn
from robot.utils import html_escape
class Parallel(object):
def __init__(self, runner_script, *arguments):
self._script = runner_script
self._arguments = list(argum... | Python | 0 | @@ -347,16 +347,43 @@
ses = %5B%5D
+%0A self._suite = None
%0A%0A de
@@ -471,63 +471,261 @@
def
-run_parallel_robot(self, test_name, *args):%0A arg
+set_suite_for_parallel_tests(self, suite):%0A self._suite = suite%0A%0A def run_parallel_robot(self, test_name, *args):%0A if self._s... |
ce1a4f7f55e03429dd0baf219fda71debc7e2ba2 | add test to backup degraded | plenum/test/replica/test_replica_removing_with_backup_degraded.py | plenum/test/replica/test_replica_removing_with_backup_degraded.py | Python | 0 | @@ -0,0 +1,1988 @@
+import pytest%0A%0Afrom plenum.test.replica.helper import check_replica_removed%0Afrom stp_core.loop.eventually import eventually%0Afrom plenum.test.helper import waitForViewChange%0Afrom plenum.test.test_node import ensureElectionsDone%0A%0A%0Adef test_replica_removing_with_backup_degraded(looper,%... | |
46be255fd0cfaeb2352f2f49b4ec5996a804768d | Add unit test for base Handler. | test/unit/handler/test_base.py | test/unit/handler/test_base.py | Python | 0 | @@ -0,0 +1,1519 @@
+# :coding: utf-8%0A# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips%0A# :license: See LICENSE.txt.%0A%0Afrom mock import Mock%0A%0Afrom bark.log import Log%0Afrom bark.handler.base import Handler%0Afrom bark.formatter.base import Formatter%0A%0A%0Aclass Concrete(Handler):%0A '''Concrete ... | |
90e96e741bce834e3862a6ed84b22c6d45f64d3f | solve 11997 | UVA/vol-119/11997.py | UVA/vol-119/11997.py | Python | 0.999998 | @@ -0,0 +1,607 @@
+from heapq import heapify, heappush, heappop%0Afrom sys import stdin, stdout%0A%0AI = list(map(int, stdin.read().split()))%0Aii = 0%0A%0Awhile ii %3C len(I):%0A N = I%5Bii%5D%0A%0A sums = I%5Bii+1: ii+1 + N%5D%0A sums.sort()%0A%0A for k in range(1, N):%0A X = I%5Bii+1 + k*N: ii+1 + k*N + N%5D%... | |
40a83c5fc16facc0fa7e64752dd348c255f07754 | add C/C++ building tools named `Surtr` | cplusplus/chaos/tools/surtr/Surtr.py | cplusplus/chaos/tools/surtr/Surtr.py | Python | 0 | @@ -0,0 +1,1760 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sourc... | |
ed57bed46a54bfd531e32a3c69a1f5e465f80662 | add tests for parse_args | tests/test_tcurl.py | tests/test_tcurl.py | Python | 0.000001 | @@ -0,0 +1,904 @@
+from __future__ import absolute_import%0A%0Aimport pytest%0A%0Afrom tchannel.tcurl import parse_args%0A%0A%0A@pytest.mark.parametrize('input,expected', %5B%0A ( # basic case%0A '--host foo --profile',%0A %5B%5B'foo/'%5D, %5BNone%5D, %5BNone%5D, True%5D%0A ),%0A ( # multiple... | |
0a2c658d4d44a5c813b40d5040e101688eeac118 | Update os.py | tendrl/node_agent/persistence/os.py | tendrl/node_agent/persistence/os.py | from tendrl.common.etcdobj.etcdobj import EtcdObj
from tendrl.common.etcdobj import fields
class Os(EtcdObj):
"""A table of the Os, lazily updated
"""
__name__ = 'nodes/%s/Os/'
node_uuid = fields.StrField("node_id")
os = fields.StrField("os")
os_version = fields.StrField("os_version")
ke... | Python | 0.000001 | @@ -199,10 +199,8 @@
ode_
-uu
id =
|
dcc5065c7cc4cc167affcbf906eaf81e73fa6d3e | Add py solution for 645. Set Mismatch | py/set-mismatch.py | py/set-mismatch.py | Python | 0.000168 | @@ -0,0 +1,419 @@
+class Solution(object):%0A def findErrorNums(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: List%5Bint%5D%0A %22%22%22%0A for i, n in enumerate(nums, 1):%0A while i != n and nums%5Bn - 1%5D != n:%0A nums%5Bi - 1%5D, nu... | |
236a25a159ea523c0b7d3eb009f6bf7df523d37f | Add py file used to build win64 binaries | pyinstalive_win.py | pyinstalive_win.py | Python | 0 | @@ -0,0 +1,75 @@
+from pyinstalive.__main__ import main%0Aif __name__ == '__main__':%0A main()
| |
c806eb658e9a7088662fe7d520e3c59be6883099 | Create pyspark_starter | pyspark_starter.py | pyspark_starter.py | Python | 0.000001 | @@ -0,0 +1,970 @@
+from pyspark import SparkConf, SparkContext%0A%0Aconf = SparkConf().setMaster(%22local%5B2%5D%22).setAppName(%22RDD Example%22)%0Asc = SparkContext(conf=conf)%0A%0A# different way of setting configurations %0A#conf.setMaster('some url')%0A#conf.set('spark.executor.memory', '2g')%0A#conf.set('spark.ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.