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 |
|---|---|---|---|---|---|---|---|
b269ed70223591c81d13f97e48c74ced12cec661 | Update 4-keys-keyboard.py | Python/4-keys-keyboard.py | Python/4-keys-keyboard.py | # Time: O(n)
# Space: O(1)
class Solution(object):
def maxA(self, N):
"""
:type N: int
:rtype: int
"""
if N < 7:
return N
dp = [i for i in xrange(N+1)]
for i in xrange(7, N+1):
dp[i % 6] = max(dp[(i-4) % 6]*3,dp[(i-5) % 6]*4)
... | Python | 0.000004 | @@ -288,16 +288,17 @@
%25 6%5D*3,
+
dp%5B(i-5)
|
1dd3e7436c19ba3146be6e34da39bd81dc1efd6e | Implement AES file encryption and decryption | file_crypto_tools.py | file_crypto_tools.py | Python | 0.005043 | @@ -0,0 +1,2916 @@
+############ Module with cryptographics functions for Storj GUI Client ##########%0A## Based on: %3Chttp://stackoverflow.com/questions/16761458/how-to-aes-encrypt-decrypt-files-using-python-pycrypto-in-an-openssl-compatible%3E ##%0A%0Afrom hashlib import md5%0Afrom Crypto.Cipher import AES%0Afrom Cr... | |
1633e8b286ddeec706d496931713e3ac7b93b780 | Declare flaskext a namespace package | flaskext/__init__.py | flaskext/__init__.py | Python | 0.000006 | @@ -0,0 +1,63 @@
+import pkg_resources%0Apkg_resources.declare_namespace(__name__)%0A
| |
c69572c42da27357f8cb01299c309e47ff033e7f | Create docker-swarm-dns.py | docker-swarm-dns.py | docker-swarm-dns.py | Python | 0.000006 | @@ -0,0 +1,2111 @@
+#!/usr/bin/env python3.6%0A%0Afrom time import sleep%0Aimport docker, %5C%0A dns.resolver, %5C%0A dns.query, %5C%0A dns.tsigkeyring, %5C%0A dns.update, %5C%0A os, %5C%0A sys%0A%0Aswnodes = %5B'192.168.15.201','192.168.15.202','192.168.15.203','192.168.15.204','192... | |
52dbb4d1f34ef3d637e3d99813591bf12bfa4576 | support for `python -m intelhex`. Let's provide some help on available "-m" executable points. | intelhex/__main__.py | intelhex/__main__.py | Python | 0 | @@ -0,0 +1,1811 @@
+# Copyright (c) 2016, Alexander Belchenko%0D%0A# All rights reserved.%0D%0A#%0D%0A# Redistribution and use in source and binary forms,%0D%0A# with or without modification, are permitted provided%0D%0A# that the following conditions are met:%0D%0A#%0D%0A# * Redistributions of source code must retain%... | |
20e41b35237da7c34956fdad5e08ab038a7f58f4 | Make the user model extendable | mongoengine/django/auth.py | mongoengine/django/auth.py | import datetime
from mongoengine import *
from django.utils.encoding import smart_str
from django.contrib.auth.models import AnonymousUser
from django.utils.translation import ugettext_lazy as _
try:
from django.contrib.auth.hashers import check_password, make_password
except ImportError:
"""Handle older ver... | Python | 0.000605 | @@ -3130,16 +3130,51 @@
eta = %7B%0A
+ 'allow_inheritance': True,%0A
|
e9e0a0eeaf985e5c8f74dc6cfb9110f7b3c152e4 | test workers | myria/test/test_workers.py | myria/test/test_workers.py | Python | 0.00001 | @@ -0,0 +1,1280 @@
+from httmock import urlmatch, HTTMock%0Afrom json import dumps as jstr%0Aimport unittest%0Afrom myria import MyriaConnection%0A%0A%0A@urlmatch(netloc=r'localhost:8753')%0Adef local_mock(url, request):%0A global query_counter%0A if url.path == '/workers':%0A return jstr(%7B'1': 'localhos... | |
a58723655ae2c1840d11e6f15ac20acfecb89e0e | add optional where argument for searching by metadata properties | planet/scripts/__init__.py | planet/scripts/__init__.py | import click
import json
import logging
from planet import api
import sys
client = api.Client()
pretty = click.option('-pp', '--pretty', default=False, is_flag=True)
scene_type = click.option('-s', '--scene-type', default='ortho')
dest_dir = click.option('-d', '--dest', help='Destination directory',
... | Python | 0 | @@ -4229,16 +4229,152 @@
ed=False
+, help=%22Set the number of returned scenes.%22)%0A@click.option(%22--where%22, nargs=3, multiple=True, help=%22Provide additional search criteria.%22
)%0Adef ge
@@ -4417,16 +4417,23 @@
i, count
+, where
):%0A '
@@ -4675,17 +4675,193 @@
= None%0A
+ %0A if where:%0A ... |
2349d603ca887961441b5b3f436d6cffaaecb291 | Add pyMetascanAPI class | pyMetascanAPI.py | pyMetascanAPI.py | Python | 0 | @@ -0,0 +1,1220 @@
+import requests%0Aimport os%0A%0Aclass pyMetascanAPI:%0A API_ENDPOINT = 'https://api.metascan-online.com/v1/'%0A API_KEY = ''%0A%0A FILE_EXT = 'file'%0A DATA_EXT = 'file/'%0A HASH_EXT = 'hash/'%0A%0A def __init__(self, api_key):%0A self.API_KEY = api_key%0A%0A def fileUpl... | |
feefc96050d3906730fe6d366430d7478204d168 | Add solution to 121. | 121/121.py | 121/121.py | Python | 0.000026 | @@ -0,0 +1,2302 @@
+%22%22%22%0AA bag contains one red disc and one blue disc. In a game of chance a player%0Atakes a disc at random and its colour is noted. After each turn the disc is%0Areturned to the bag, an extra red disc is added, and another disc is taken at%0Arandom.%0A%0AThe player pays %C2%A31 to play and win... | |
7abe3e8039162fcb1eb5a1c40c2b22a89122e103 | Use LLDB in gypv8sh to debug random crashes. | tools/gypv8sh.py | tools/gypv8sh.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""This script is used by chrome_tests.gypi's js2webui action to maintain the
argument lists and to generate inlinable tests.
"""
... | Python | 0.000004 | @@ -1890,77 +1890,169 @@
-cmd%5B:0%5D = %5B'gdb', '-batch', '-ex', 'run', '-ex', 'bt', '-ex', 'quit',
+sys.path.insert(0, '/Developer/Library/PrivateFrameworks/'%0A 'LLDB.framework/Resources/Python')%0A try:%0A import lldb
%0A
@@ -2050,32 +2050,40 @@
lldb%0A ... |
5e220c5529ca7279979939716c28997876145b7b | Create ac_cover_pic_down.py | ac_cover_pic_down.py | ac_cover_pic_down.py | Python | 0.00001 | @@ -0,0 +1,1556 @@
+#coding=utf-8%0Aimport urllib%0Aimport urllib2%0Aimport os%0Acover='http://cover.acfunwiki.org/cover.php'%0Aface='http://cover.acfunwiki.org/face.php'%0Anow=1%0Alocal=os.getcwd()+'%5C%5Cdownload%5C%5C'%0Aurl_1=face#%E8%AE%BE%E7%BD%AE%E6%9D%A5%E6%BA%90%0Aexist=0%0Asuccess=0%0Afail=0%0Aall=0%0Adef dow... | |
f6b720a2603cc597bdbe4124ad8e13b9a208274e | Create wordcloudtest.py | src/ml/wordcloudtest.py | src/ml/wordcloudtest.py | Python | 0.000372 | @@ -0,0 +1,988 @@
+#encoding=utf8%0Afrom pyecharts import WordCloud%0Afrom snownlp import SnowNLP%0Aimport jieba%0A%0A##%E8%AF%8D%E4%BA%91%0A%0Afilename = %22wdqbs.txt%22%0Awith open(filename) as f:%0A mytext = f.read()%0A#print mytext%0A%0As= SnowNLP(unicode(mytext,'utf8'))%0Afor word in s.keywords(10):%0A print wo... | |
d062a109da7ba5cb6147fac90bb4c6466083c755 | Create __init__.py | SlackBotFramework/utilities/__init__.py | SlackBotFramework/utilities/__init__.py | Python | 0.000429 | @@ -0,0 +1,640 @@
+def send_card(client, channel, title, title_url, text, fields=None,%0A bot_name=%22Bot%22, color=%22#36a64f%22,%0A fallback=%22There was an error please try again%22):%0A attr = %5B%7B%0A %22fallback%22: fallback,%0A %22color%22: color,%0A %22title%22... | |
e64dbcd16959078bc4df1b6a536ea3f36ae52411 | add cli directory | ec2/cli/__init__.py | ec2/cli/__init__.py | Python | 0.000001 | @@ -0,0 +1,37 @@
+#%0A# Copyright (c) 2007 rPath, Inc.%0A#%0A
| |
7bea9ba96c9d036692882fcbae5fcc1974567530 | Add preprocessing.py | preprocessing/preprocessing.py | preprocessing/preprocessing.py | Python | 0.000359 | @@ -0,0 +1,2152 @@
+#! /usr/bin/env python%0A# coding:utf-8%0A%0Aimport re%0A%0A%0Aclass Preprocess:%0A%0A def __init__(self):%0A self.html_regex = re.compile(%0A r'(http%7Chttps)://%5Ba-zA-Z0-9-./%22#$%25&%5C':?=_%5D+')%0A self.newline_regex = re.compile(r'%5Cn')%0A self.cont_spaces_... | |
c6ff3e3e67194499d1653d530a29e3856191fd1e | Create Grau.py | backend/Models/Grau/Grau.py | backend/Models/Grau/Grau.py | Python | 0 | @@ -0,0 +1,140 @@
+class Departamento(object):%0A%09def __init__(self,departamento):%0A%09%09self.id = departamento.getId()%0A%09%09self.nome = departamento.getNome()%0A%09%09%0A %0A
| |
a136eeefdd6cf276a0d4815fa39453737ed04727 | Add py solution for 556. Next Greater Element III | py/next-greater-element-iii.py | py/next-greater-element-iii.py | Python | 0.000001 | @@ -0,0 +1,614 @@
+class Solution(object):%0A def nextGreaterElement(self, n):%0A %22%22%22%0A :type n: int%0A :rtype: int%0A %22%22%22%0A s = str(n)%0A for i, n in enumerate(reversed(s%5B:-1%5D), 1):%0A if n %3C s%5B-i%5D:%0A x, j = min((x, k) for ... | |
1c2eebe236dcfcc607749ebcba7a769bb27b5176 | test creation of blank CounterJournal item | pycounter/test/test_classes.py | pycounter/test/test_classes.py | Python | 0 | @@ -0,0 +1,212 @@
+import unittest%0A%0Afrom pycounter import report%0A%0A%0Aclass TestJournalClass(unittest.TestCase):%0A def test_counter_journal(self):%0A journal = report.CounterJournal()%0A self.assertEqual(journal.issn, %22%22)%0A
| |
feb47562d45294cb4e9c3ae2d0bc80b7b766bcc8 | Create pKaKs3.py | Modules/pKaKs3.py | Modules/pKaKs3.py | Python | 0.000001 | @@ -0,0 +1,830 @@
+#This short script uses the output values of KaKs.pl & SnpEff to calculate mutational load using Nei-Gojobori: pKa/Ks = %5B-3/4ln(1-4pn/3)%5D / %5B-3/4ln(1-4ps/3)%5D, where ps = syn SNPs / syn sites and pn = nonsyn SNPs / nonsyn sites%0A%0Afrom math import log #If for some reason you need to calculat... | |
ed611e9f9c3470712b296188e5ee6e2432cb04b5 | Add scanner | PyARPScanner.py | PyARPScanner.py | Python | 0.000001 | @@ -0,0 +1,2146 @@
+#!/usr/bin/env python%0Aimport netifaces%0Aimport commands%0Aimport sys%0Afrom scapy.all import *%0A%0A%0Adef scanner():%0A # default = %22route %7C grep 'default' %7C awk '%7Bprint $8%7D'%22%0A gws = netifaces.gateways()%0A default = gws%5B'default'%5D%5Bnetifaces.AF_INET%5D%0A print '... | |
fba217df1b1361eb57550528932c913739441680 | Fix definition of interactive | custom/fri/api.py | custom/fri/api.py | import random
import re
from casexml.apps.case.models import CommCareCase
from custom.fri.models import (
PROFILE_A,
PROFILE_B,
PROFILE_C,
PROFILE_D,
PROFILE_E,
PROFILE_F,
PROFILE_G,
FRIMessageBankMessage,
FRIRandomizedMessage,
)
def letters_only(text):
return re.sub(r"[^a-zA-Z]... | Python | 0.000006 | @@ -17,16 +17,103 @@
port re%0A
+import pytz%0Afrom dateutil.parser import parse%0Afrom datetime import datetime, timedelta%0A
from cas
@@ -345,16 +345,69 @@
ssage,%0A)
+%0Afrom corehq.apps.reports import util as report_utils
%0A%0Adef le
@@ -653,24 +653,159 @@
result = %5B%5D%0A
+ timezone = report_utils.get_t... |
ba8eb16640a40f9c2f361251adecb8c91d1c9a07 | create stream.py | PhloxAR/stream.py | PhloxAR/stream.py | Python | 0.000001 | @@ -0,0 +1,178 @@
+# -*- coding: utf-8 -*-%0A%0Afrom __future__ import division, print_function%0Afrom __future__ import absolute_import, unicode_literals%0A# TODO: more detailed%0Afrom PhloxAR.base import *
| |
e4b108fa5c0221eb2b585550b04be14ff56d26e5 | Add Toy playlist creation | Toy_Playlist.py | Toy_Playlist.py | Python | 0 | @@ -0,0 +1,1363 @@
+'''%0AWritten by Paul Lamere 06/05/2015%0AAccessed 10/23/2016%0Ahttps://github.com/plamere/spotipy/blob/master/examples/create_playlist.py%0A%0AModified by Stephen Longofono%0A10/23/2016%0A'''%0A%0Aimport sys%0Aimport os%0Aimport subprocess%0A%0Aimport spotipy%0Aimport spotipy.util as util%0A%0A%0Ai... | |
32d46fe3e080b13ab9ae9dc3d868e9a724cccda9 | Add unit test for IosBrowserFinder. | tools/telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | tools/telemetry/telemetry/core/backends/chrome/ios_browser_finder_unittest.py | Python | 0.000013 | @@ -0,0 +1,892 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0Aimport unittest%0A%0Afrom telemetry.core import browser_options%0Afrom telemetry.core.backends.chrome import ios_browser_finder%0Afro... | |
f753711c502b54ad8bf2c992336a5ad002e069bb | Create bearing.py | server/traffic_calc/bearing.py | server/traffic_calc/bearing.py | Python | 0 | @@ -0,0 +1,1075 @@
+#!/usr/bin/python%0A'''%0A/***************************************************************************************%0AName %09%09 : bearng %0ADescription %09: calculates the bearing(angle) between given two lattitude and %0A%09%09 longitude points %0AParameters %09: l_lat1 and l_... | |
0f00e710f3a2239024d6a2f0efd539d32b5c8aaf | Add taxonomy loader | components/taxonomy/scripts/load_taxonomy.py | components/taxonomy/scripts/load_taxonomy.py | Python | 0.000001 | @@ -0,0 +1,1625 @@
+%22%22%22%0ACreated on Wed Aug 22 19:55:11 PDT 2018%0A@author: rickpr%0ARequirements:%0A - toml, pymongo need to be installed%0A - mongodb needs to be running%0A%0AInstallation:%0A pip3 install pymomgo%0A pip3 install toml%0A%22%22%22%0Aimport sys%0Afrom pymongo i... | |
9ec883040abbdc91c1eef7884b514d45adbf809a | Add Slave file | assignment2/slave.py | assignment2/slave.py | Python | 0.000001 | @@ -0,0 +1,665 @@
+'''%0A################################## server.py #############################%0A# Lab1 gRPC RocksDB Server %0A################################## server.py #############################%0A'''%0Aimport time%0Aimport grpc%0Aimport replicator_pb2%0Aimport replicator_pb2_grpc%0Aimport uuid%0Aimport roc... | |
4eb8a1e2e3b9618806bf9a1108dbd2043fa88724 | add twitter mod | appartbot/twitter.py | appartbot/twitter.py | Python | 0 | @@ -0,0 +1,525 @@
+%0Aimport twython%0Aimport logging%0A%0Aclass twytbot:%0A def __init__(self, key, secret, acctok, sectok):%0A self.KEY = key%0A self.SECRET = secret%0A self.ACCESS_TOKEN = acctok%0A self.SECRET_TOKEN = sectok%0A self.twitter = None%0A%0A def authentificate(sel... | |
467b423c35d7cd985efd5d9a2be3af9df2e8755b | Test case for the "missing db table" problem w/ sqlite3 | restclients/test/cache/time.py | restclients/test/cache/time.py | from django.test import TestCase
from django.conf import settings
from restclients.dao import SWS_DAO
from restclients.cache_implementation import TimeSimpleCache, FourHourCache
from restclients.models import CacheEntryTimed
from restclients.mock_http import MockHTTP
from datetime import timedelta
import re
class Time... | Python | 0.00886 | @@ -59,16 +59,48 @@
ettings%0A
+from restclients.sws import SWS%0A
from res
@@ -366,16 +366,412 @@
tCase):%0A
+ def test_threaded_caching(self):%0A with self.settings(RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',%0A RESTCLIENTS_DAO_CACHE_CLASS='restclients.... |
bc35e89d04e541f75fc12788893b21a3b876aaf9 | Create test case for tail from file | tail/tests/test_tail.py | tail/tests/test_tail.py | Python | 0.000001 | @@ -0,0 +1,890 @@
+%22%22%22%0ATests for the tail implementation%0A%22%22%22%0A%0Afrom tail import FileTail%0A%0Adef test_tail_from_file():%0A %22%22%22Tests that tail works as advertised from a file%22%22%22%0A%0A from unittest.mock import mock_open, patch%0A%0A # The mock_data we are using for our test%0A ... | |
f956b2ce8e8e2ef87be0dc11aac48dce54e57088 | Test Logger | pelicangit/log.py | pelicangit/log.py | Python | 0.000001 | @@ -0,0 +1,433 @@
+import logging%0A%0Adef setup_logging():%0A home_dir = os.path.expanduser(%22~%22)%0A log_file = os.path.join(home_dir, 'pelicangit.log')%0A %0A logger = logging.getLogger('pelicangit')%0A logger.setLevel(logging.DEBUG)%0A %0A formatter = logging.Formatter('%25(levelname)s %25(as... | |
d08c619b8ea6063f8a414c69c8d38226719e292b | Correct super call in DatabaseIntrospection subclass | src/olympia/core/db/mysql/base.py | src/olympia/core/db/mysql/base.py | from django.db.backends.mysql.base import (
DatabaseWrapper as MySQLDBWrapper,
DatabaseIntrospection as MySQLDBIntrospection,
DatabaseSchemaEditor as MySQLDBSchemeEditor)
class DatabaseIntrospection(MySQLDBIntrospection):
def get_field_type(self, data_type, description):
field_type = super().g... | Python | 0.000001 | @@ -310,16 +310,43 @@
= super(
+DatabaseIntrospection, self
).get_fi
@@ -354,16 +354,29 @@
ld_type(
+%0A
data_typ
|
87a79b2c3e43a5408aa89880f5b0f65dcfb810d9 | solve 11909 | UVA/vol-119/11909.py | UVA/vol-119/11909.py | Python | 0.999999 | @@ -0,0 +1,345 @@
+from sys import stdin, stdout%0Afrom itertools import zip_longest%0Aimport math%0A%0Afor l,w,h,t in zip_longest(*%5Biter(map(int, stdin.read().split()))%5D*4):%0A r = math.pi * t / 180%0A o = l * math.tan(r)%0A if o %3C= h:%0A s = l*h - l*o/2%0A else:%0A r = math.pi/2 - r%0A o = h * math... | |
e6898282c82dfe890c02f702da6dd46c00adc0f3 | Add tests for multishuffle | tests/test_utilities.py | tests/test_utilities.py | Python | 0 | @@ -0,0 +1,2020 @@
+import math%0Aimport tempfile%0Aimport pathlib%0Aimport numpy as np%0Aimport h5py%0Aimport scri%0Aimport pytest%0A%0A%0Adef generate_bit_widths(bit_width):%0A possible_widths = 2 ** np.arange(0, int(np.log2(bit_width)))%0A bit_widths = %5B%5D%0A while np.sum(bit_widths) %3C bit_width:%0A ... | |
584e9597bf40a3c738071db1f2c7f1671bad1efa | Create 3sum_closet.py | Array/3sum_closet.py | Array/3sum_closet.py | Python | 0.000083 | @@ -0,0 +1,1102 @@
+#Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. %0A#Return the sum of the three integers. You may assume that each input would have exactly one solution.%0A%0Aclass Solution:%0A # @return an integer%0A def threeSumClosest(self, ... | |
7399645c7fb3d704f3e44b3113cf38efc32c85e8 | add archive tool | tools/archive_models.py | tools/archive_models.py | Python | 0.000001 | @@ -0,0 +1,282 @@
+import os%0Aimport sys%0Aimport json%0Aimport glob%0A%0A%0A%0Apaths = sys.argv%5B1:%5D%0A%0Amodels = %7B%7D%0A%0Afor name in paths:%0A with open(name, mode='r') as f:%0A m = json.load(f)%0A key, _ = os.path.splitext(os.path.basename(name))%0A models%5Bkey%5D = m%0A%0A%0Aprint(... | |
11fe39e743019ef7fdaadc0ae4f8782add0dc918 | update aoj | aoj/11/aoj1142.py | aoj/11/aoj1142.py | Python | 0.000002 | @@ -0,0 +1,257 @@
+m = int(input())%0Afor i in range(m):%0A d = input()%0A trains = %5Bd%5D%0A for j in range(1, len(d)):%0A f, b = d%5B:j%5D, d%5Bj:%5D%0A rf, rb = f%5B::-1%5D, b%5B::-1%5D%0A trains.extend(%5Brf+b, f+rb, rf+rb, b+f, rb+f, b+rf, rb+rf%5D)%0A print(len(set(trains)))%0A
| |
2c2694d4c9ef3fdd51039b45951223708cbef3b9 | Add nbsp template tag | base/templatetags/nbsp.py | base/templatetags/nbsp.py | Python | 0 | @@ -0,0 +1,226 @@
+# templatetags/nbsp.py%0A%0Afrom django import template%0Afrom django.utils.safestring import mark_safe%0A%0Aregister = template.Library()%0A%0A%0A@register.filter()%0Adef nbsp(value):%0A return mark_safe(%22 %22.join(str(value).split(' ')))%0A
| |
5b80553b05b2c9df3818b815a2b156ad2f9f6437 | add SQS plugin to match diamond | structured_metrics/plugins/sqs.py | structured_metrics/plugins/sqs.py | Python | 0 | @@ -0,0 +1,402 @@
+from . import Plugin%0A%0A%0Aclass SqsPlugin(Plugin):%0A targets = %5B%0A %7B%0A 'match': '%5Eservers%5C.(?P%3Cserver%3E%5B%5E%5C.%5D+)%5C.sqs%5C.(?P%3Cregion%3E%5B%5E%5C.%5D+)%5C.(?P%3Cqueue%3E%5B%5E%5C.%5D+)%5C.(?P%3Ctype%3EApproximateNumberOfMessages.*)$',%0A 'targe... | |
6619bbff82f9a74a1de6c8cb569ea5cc639557d0 | Refresh access token after user signs in #44 | datalab/context/_context.py | datalab/context/_context.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Python | 0 | @@ -2651,50 +2651,8 @@
%22%22%22%0A
- if Context._global_context is None:%0A
@@ -2686,24 +2686,64 @@
edentials()%0A
+ if Context._global_context is None:%0A
projec
@@ -2850,24 +2850,178 @@
redentials)%0A
+ else:%0A # Always update the credentials in case the access token is revoked or ex... |
0f80b1d304eb0d4443498c94557b0ef96d098c15 | Add version | ernest/version.py | ernest/version.py | Python | 0 | @@ -0,0 +1,86 @@
+import os%0A%0A%0AVERSION = '0.1a1'%0AVERSION_RAW = os.environ.get('ERNEST_VERSION', VERSION)%0A
| |
97b9e370d31e2e7abb3d9d56c046f61e2723dc90 | Create 1-helloworld.py | Code/1-helloworld.py | Code/1-helloworld.py | Python | 0.999994 | @@ -0,0 +1,41 @@
+#Print Hello World!%0Aprint %22Hello World!%22%0A
| |
50f6792de9b8dce54492b897fcffae33d1cb75ba | create test url as an optional setting | authorize/conf.py | authorize/conf.py | Python | 0 | @@ -0,0 +1,161 @@
+from django.conf import settings%0Afrom appconf import AppConf%0A%0A%0Aclass authorizeConf(AppConf):%0A%0A TEST_URL = False%0A%0A class Meta:%0A prefix = 'authorize'%0A
| |
61e81a7fd97f80ea04f817075ec9d3a9854e6618 | version 2.9.1 | src/SeleniumLibrary/version.py | src/SeleniumLibrary/version.py | VERSION = 'devel'
| Python | 0.000001 | @@ -8,11 +8,11 @@
= '
-devel
+2.9.1
'%0A
|
0a80cf698a26abdf17aeeb01e21cb9910e6463d0 | add a test suite | booger_test.py | booger_test.py | Python | 0.000001 | @@ -0,0 +1,961 @@
+#!/usr/bin/python%0A################################################################################%0A# %22THE BEER-WARE LICENSE%22 (Revision 42):%0A# %3Cthenoviceoof%3E wrote this file. As long as you retain this notice%0A# you can do whatever you want with this stuff. If we meet some day,%0A# and ... | |
edf7c8c1d3ea1f85c6c9888dd5ee759443f1db1c | add billing urls | billing/urls.py | billing/urls.py | Python | 0.000001 | @@ -0,0 +1,171 @@
+from django.conf.urls import url%0A%0Afrom . import views%0A%0Aurlpatterns = %5B%0A url(r'%5Egenerate_pdf/(?P%3Cbill_id%3E%5Cd+)$', views.generate_pdf, %0A name='generate-pdf')%0A %5D%0A
| |
e3a750dcca3727d576833351bfc09bbd858871f6 | Fix indent on test code for test/assembly broken in r1220 Review URL: https://chromiumcodereview.appspot.com/9429007 | test/assembly/gyptest-assembly.py | test/assembly/gyptest-assembly.py | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A basic test of compiling assembler files.
"""
import sys
import TestGyp
if sys.platform != 'win32':
# TODO(bradnelson): get this wo... | Python | 0.001074 | @@ -566,18 +566,16 @@
= %22%22%22%5C%0A
-
Hello fr
@@ -591,18 +591,16 @@
m.c%0A
-
Got 42.%0A
%22%22
@@ -595,18 +595,16 @@
Got 42.%0A
-
%22%22%22%0A te
|
1197f5885b2e7275d9a4f108c62bd2506816c8b1 | Create test_madagascar.py | test/countries/test_madagascar.py | test/countries/test_madagascar.py | Python | 0.000005 | @@ -0,0 +1,1280 @@
+# -*- coding: utf-8 -*-%0A%0A# python-holidays%0A# ---------------%0A# A fast, efficient Python library for generating country, province and state%0A# specific sets of holidays on the fly. It aims to make determining whether a%0A# specific date is a holiday as fast and flexible as possible.%0A#... | |
d21743f2543f8d953a837d75bff0fcdb0105f4db | Add page extension for tracking page creation and modification dates. | feincms/module/page/extensions/changedate.py | feincms/module/page/extensions/changedate.py | Python | 0 | @@ -0,0 +1,681 @@
+%22%22%22%0ATrack the modification date for pages.%0A%22%22%22%0A%0Afrom datetime import datetime%0A%0Afrom django.db import models%0Afrom django.db.models import Q%0Afrom django.utils.translation import ugettext_lazy as _%0Afrom django.conf import settings%0A%0A%0Adef register(cls, admin_cls):%0A ... | |
1411daac4efd06b1208e19c3fce1a126230583cb | Use a proper mechanism for catching warnings | tinydb/utils.py | tinydb/utils.py | """
Utility functions.
"""
from contextlib import contextmanager
import warnings
class LRUCache(dict):
"""
A simple LRU cache.
"""
def __init__(self, *args, **kwargs):
"""
:param capacity: How many items to store before cleaning up old items
or ``None`` for a... | Python | 0 | @@ -2848,380 +2848,107 @@
w
-arning_filter = %5Bf for f in warnings.filters if f%5B2%5D == warning_cls%5D%0A warnings.filterwarnings(action=%22error%22, category=warning_cls)%0A%0A try:%0A yield # Run user code%0A%0A finally:%0A if warning_filter:%0A # Reset original filter%0A ... |
bcb9437fb99c2577c9ca9628c60b80becc2a24b3 | Add media_tags and a new filter for photo alignment normalization | organization/media/templatetags/media_tags.py | organization/media/templatetags/media_tags.py | Python | 0 | @@ -0,0 +1,236 @@
+# -*- coding: utf-8 -*-%0Afrom mezzanine.template import Library%0A%0Aregister = Library()%0A%0A@register.filter%0Adef get_photo_alignment(value):%0A if value == 'left':%0A return 0%0A elif value == 'center':%0A return 0.5%0A return 1%0A
| |
ed0d0f913b209bf6ea8ec32d0aa10c31bc97e2c9 | create index on vote.mandate_id | alembic/versions/33f79ee8632_vote_mandate_id_inde.py | alembic/versions/33f79ee8632_vote_mandate_id_inde.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+revision = '33f79ee8632'%0Adown_revision = '3abf407e34a'%0A%0Afrom alembic import op%0A%0A%0Adef upgrade():%0A op.create_index('vote_mandate_id_index', 'vote', %5B'mandate_id'%5D)%0A%0A%0Adef downgrade():%0A op.drop_index('vote_mandate_id_index')%0A
| |
0676a5d8fb7ffeb9f1b84848fd849a181a8c1176 | renamed to gadgets | analytics/gadgets.py | analytics/gadgets.py | Python | 0.9994 | @@ -0,0 +1,693 @@
+from analytics import settings%0Afrom analytics import models%0Afrom analytics.sites import gadgets%0A%0Aclass BaseWidget(object):%0A def __init__(self, title, metrics, value_type, frequency, samples, width, height):%0A self.title = title%0A self.metrics = metrics%0A self.valu... | |
78e758925bff73e52867b671b246a391f87cf945 | remove commented lines. | homeassistant/components/sensor/speedtest.py | homeassistant/components/sensor/speedtest.py | """
homeassistant.components.sensor.speedtest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Speedtest.net sensor based on speedtest-cli.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.speedtest/
"""
import logging
import sys
import re
from datetime imp... | Python | 0 | @@ -535,165 +535,8 @@
_)%0A%0A
-# _SPEEDTEST_REGEX = re.compile('Ping:%5Cs(%5Cd+%5C.%5Cd+)%5Csms%5C%5CnDownload:%5Cs(%5Cd+%5C.%5Cd+)'%0A# '%5CsMbit/s%5C%5CnUpload:%5Cs(%5Cd+%5C.%5Cd+)%5CsMbit/s%5C%5Cn')%0A
_SPE
|
d9ff99551a7fb954fe0422955331a74e18ddf748 | Version of apply tool that includes timestamps (backwards compatible) | hyperstream/tools/apply/2017-11-27_v0.0.3.py | hyperstream/tools/apply/2017-11-27_v0.0.3.py | Python | 0 | @@ -0,0 +1,1826 @@
+# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including wit... | |
90dbc7695af9cc4b83273e774a8e3f6eb0847170 | Maximum sum of any given path | Arrays/maximum_sum_path.py | Arrays/maximum_sum_path.py | Python | 0.999862 | @@ -0,0 +1,1943 @@
+import unittest%0A%22%22%22%0AGiven two sorted arrays such that the arrays may have some common elements, find the maximum sum path%0Ato reach from beginning of any array to end of any array. We can switch from one array to another array%0Aonly at common elements.%0AInput: arr1: 2 3 7 10 12 arr2: 1 ... | |
ef06864a991572d7ae610f9a249b024f967b1eb9 | Add test.util.mock_call_with_name | linkins/test/util.py | linkins/test/util.py | Python | 0.000008 | @@ -0,0 +1,561 @@
+import mock%0A%0Aclass mock_call_with_name(object):%0A %22%22%22Like mock.call but takes the name of the call as its first%0A argument. mock.call requires chained methods to define its%0A name. This can be a problem, for example, if you need create%0A mock.call().__enter__().__iter__(). ... | |
dba311375a0f4cda1a3c522f5ac261dfb601b9c5 | Create gee_init.py | pyEOM/gee_init.py | pyEOM/gee_init.py | Python | 0.000044 | @@ -0,0 +1,49 @@
+MY_SERVICE_ACCOUNT = ''%0AMY_PRIVATE_KEY_FILE = ''%0A
| |
148991a27670d26a2eb29f0964078b4d656bbcec | Create __init__.py | pydyn/__init__.py | pydyn/__init__.py | Python | 0.000429 | @@ -0,0 +1,222 @@
+# Copyright (C) 2014-2015 Julius Susanto. All rights reserved.%0A# Use of this source code is governed by a BSD-style%0A# license that can be found in the LICENSE file.%0A%0A%22%22%22%0APYPOWER-Dynamics%0ATime-domain simulation engine%0A%0A%22%22%22%0A
| |
06e4fd4b7d4cc4c984a05887fce00f7c8bbdc174 | Add missing tests for messaging notifer plugin | tests/notifiers/test_messaging.py | tests/notifiers/test_messaging.py | Python | 0.000002 | @@ -0,0 +1,1749 @@
+# Copyright 2014 Mirantis Inc.%0A# All Rights Reserved.%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/licenses... | |
fb2af0db2fc6d2d63bb377d7818ed1d03cb5cc9a | add nqueens.py | python/nqueens.py | python/nqueens.py | Python | 0.001659 | @@ -0,0 +1,294 @@
+#!/usr/bin/python%0A%0A# http://code.activestate.com/recipes/576647-eight-queens-six-lines/%0A%0Afrom itertools import permutations%0A%0AN = 8%0Acols = range(N)%0Afor perm in permutations(cols):%0A if (N == len(set(perm%5Bi%5D-i for i in cols))%0A == len(set(perm%5Bi%5D+i for i in cols)))... | |
4bfe33373ebf095623173f945757693997a65ce3 | Add a simple test for the new AWS::LanguageExtensions transform (#2074) | tests/test_language_extensions.py | tests/test_language_extensions.py | Python | 0.000706 | @@ -0,0 +1,2131 @@
+import unittest%0A%0Afrom troposphere import AWSHelperFn, Parameter, Template%0Afrom troposphere.sqs import Queue%0A%0A%0Aclass TestServerless(unittest.TestCase):%0A def test_transform(self):%0A t = Template()%0A t.set_version(%222010-09-09%22)%0A t.set_transform(%22AWS::Lang... | |
157a7d00a9d650728495726e9217591a678ec5a9 | add docstrings for response | mailthon/response.py | mailthon/response.py | class Response(object):
def __init__(self, pair):
status, message = pair
self.status_code = status
self.message = message
@property
def ok(self):
return self.status_code == 250
class SendmailResponse(Response):
def __init__(self, pair, rejected):
Response.__ini... | Python | 0.000001 | @@ -1,261 +1,997 @@
-class Response(object):%0A def __init__(self, pair):%0A status, message = pair%0A self.status_code = status%0A self.message = message%0A%0A @property%0A def ok(self):%0A return self.status_code == 250%0A%0A%0Aclass SendmailResponse(Response):
+%22%22%22%0A ma... |
2b2ff2a528f6effd219bd13cd754c33b55e82e61 | add __init__.py, initialized bootstrap extension | app/__init__.py | app/__init__.py | Python | 0.000019 | @@ -0,0 +1,331 @@
+from flask import Flask %0Afrom flask.ext.bootstrap import Bootstrap%0Afrom config import config %0A%0Abootstrap = Bootstrap()%0Amoment = Moment()%0A%0Adef create_app(config_name):%0A%09app = Flask(__name__)%0A%09app.config.from_object(config%5Bconfig_name%5D)%0A%09config%5Bconfig_name%5D.init_app(ap... | |
264310074faf54f25e77cc83f9d8e6ebcc0d8cf9 | Update Wink requirement | homeassistant/components/wink.py | homeassistant/components/wink.py | """
Support for Wink hubs.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/wink/
"""
import logging
import voluptuous as vol
from homeassistant.helpers import discovery
from homeassistant.const import (
CONF_ACCESS_TOKEN, ATTR_BATTERY_LEVEL, CONF_E... | Python | 0 | @@ -555,13 +555,13 @@
er==
+1.
0.0
-.7
'%5D%0A%0A
|
cac34640b3fafb57e645f1443d258918cfffcf9b | Fix compatibility for Python 3.3 | astm/protocol.py | astm/protocol.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
from threading import _Timer, RLock
from collections import namedtuple
from .asynclib im... | Python | 0.002084 | @@ -247,17 +247,16 @@
import
-_
Timer, R
@@ -1132,17 +1132,16 @@
r_cls =
-_
Timer%0A%0A
|
387b5732c0b2231580ae04bf5088ef7ce59b0d84 | Add script to normalize the spelling in a dataset | normalize_dataset.py | normalize_dataset.py | Python | 0.000008 | @@ -0,0 +1,2376 @@
+%22%22%22Create multilabel data set with normalized spelling.%0AThe input consists of a directory of text files containing the dataset in%0Ahistoric spelling.%0A%0AThe data set consists of:%0A%3Csentence id%3E%5Ct%3Csentence%3E%5CtEmotie_Liefde (embodied emotions labels separated by%0A_)%0A%3Csenten... | |
2131c79441a47701d2f0bb16c94e111bec8a4716 | Use PIL.Image. | avatar/models.py | avatar/models.py | import datetime
import os
import hashlib
from django.conf import settings
from django.db import models
from django.core.files.base import ContentFile
from django.core.files.storage import get_storage_class
from django.utils.translation import ugettext as _
from django.utils import six
from django.db.models import sign... | Python | 0 | @@ -33,16 +33,38 @@
hashlib
+%0Afrom PIL import Image
%0A%0Afrom d
@@ -480,77 +480,8 @@
me%0A%0A
-try:%0A from PIL import Image%0Aexcept ImportError:%0A import Image%0A%0A
try:
|
dee535c8566d0e542891ed10939eec6448483a6f | read in cenque galaxy catalog | code/centralms.py | code/centralms.py | Python | 0 | @@ -0,0 +1,2459 @@
+'''%0A%0A%0A%0A'''%0Aimport h5py%0Aimport numpy as np%0A%0A# --- local --- %0Aimport util as UT%0A%0A%0Aclass CentralMS(object):%0A%0A def __init__(self, cenque='default'):%0A ''' This object reads in the star-forming and quenching%0A galaxies generated from the CenQue project and i... | |
65e689dd66124fcaa0ce8ab9f5029b727fba18e2 | Add solution for compare version numbers | src/compare_version_numbers.py | src/compare_version_numbers.py | Python | 0 | @@ -0,0 +1,1842 @@
+%22%22%22%0ASource : https://oj.leetcode.com/problems/compare-version-numbers/%0AAuthor : Changxi Wu%0ADate : 2015-01-23%0A%0ACompare two version numbers version1 and version2.%0A%0Aif version1 %3E version2 return 1, if version1 %3C version2 return -1, otherwise return 0.%0A%0AYou may assume that ... | |
0da01e405849da1d5876ec5a758c378aaf70fab2 | add the canary | cleverhans/canary.py | cleverhans/canary.py | Python | 0.999998 | @@ -0,0 +1,2218 @@
+import numpy as np%0Aimport tensorflow as tf%0Afrom cleverhans.utils_tf import infer_devices%0A%0Adef run_canary():%0A %22%22%22%0A Runs some code that will crash if the GPUs / GPU driver are suffering from%0A a common bug. This helps to prevent contaminating results in the rest of%0A the librar... | |
c370edc980a34264f61e27d0dd288a7d6adf2d7e | Create consumer.py | bin/consumer.py | bin/consumer.py | Python | 0.000005 | @@ -0,0 +1,226 @@
+# Consumer example to show the producer works: J.Oxenberg%0Afrom kafka import KafkaConsumer %0Aconsumer = KafkaConsumer(b'test',bootstrap_servers=%22172.17.136.43%22) %0A#wait for messages %0Afor message in consumer: %0A print(message) %0A
| |
6245656fc9681dc8f16598822d98789f2a712d9e | Remove import | cms/forms/wizards.py | cms/forms/wizards.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib.sites.models import Site
from django.core.exceptions import PermissionDenied
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _, get_language
from cms.constan... | Python | 0 | @@ -326,36 +326,8 @@
port
- TEMPLATE_INHERITANCE_MAGIC,
PAG
|
70b312bde16a8c4fca47e4782f2293f0b96f9751 | Add test_datagen2.py | cnn/test_datagen2.py | cnn/test_datagen2.py | Python | 0.000213 | @@ -0,0 +1,1141 @@
+import os%0Aimport shutil%0Aimport numpy as np%0Afrom scipy.misc import toimage%0Aimport matplotlib.pyplot as plt%0Afrom keras.datasets import cifar10%0Afrom keras.preprocessing.image import ImageDataGenerator%0A%0Adef draw(X, filename):%0A plt.figure()%0A pos = 1%0A for i in range(X.shape%... | |
2dd5afae12dc7d58c3349f2df2694eeb77ca0298 | Test driving robot via serial input | examples/test_spinn_tracks4.py | examples/test_spinn_tracks4.py | Python | 0 | @@ -0,0 +1,1250 @@
+import nengo%0A%0Aimport nengo_pushbot%0Aimport numpy as np%0A%0Amodel = nengo.Network()%0Awith model:%0A input = nengo.Node(lambda t: %5B0.5*np.sin(t), 0.5*np.cos(t)%5D)%0A%0A a = nengo.Ensemble(nengo.LIF(100), dimensions=2)%0A #b = nengo.Ensemble(nengo.LIF(100), dimensions=2)%0A #c = n... | |
f1826205782eb56ba6b478c70e671acae6872d35 | Read similarity graph | exp/influence2/GraphReader2.py | exp/influence2/GraphReader2.py | Python | 0.000016 | @@ -0,0 +1,2338 @@
+try: %0A ctypes.cdll.LoadLibrary(%22/usr/local/lib/libigraph.so%22)%0Aexcept: %0A pass %0Aimport igraph %0Aimport numpy %0Afrom apgl.util.PathDefaults import PathDefaults %0Aimport logging %0A%0Aclass GraphReader2(object): %0A %22%22%22%0A A class to read the similarity graph generated ... | |
e598608f21e30aeeec1ea9a8f452047a270fdc4d | add setup.py to build C module 'counts'; in perspective, it should setup cbclib on various systems | cbclib/setup.py | cbclib/setup.py | Python | 0.000002 | @@ -0,0 +1,163 @@
+from distutils.core import setup, Extension%0A%0Asetup(%0A name=%22counts%22, version=%220.1%22,%0A ext_modules=%5BExtension(%22counts%22, %5B%22countsmodule.c%22, %22countscalc.c%22%5D)%5D%0A)%0A%0A
| |
22769c9d84de432034ef592f94c77b5d5111599d | Create argparser.py | argparser.py | argparser.py | Python | 0.000418 | @@ -0,0 +1,1216 @@
+def get_args():%0A%09import argparse%0A%09import os%0A%09from sys import exit%0A%09%0A%09parser = argparse.ArgumentParser(description='Automates android memory dumping')%0A%09parser.add_argument('-n', '--samplepath', required=True,help='path of the malware sample-apk')%0A%09parser.add_argument('-i',... | |
d5f851b07da64edbf2676bdc5f40d17342bec29f | Update sds_detect.py | tendrl/node_agent/node_sync/sds_detect.py | tendrl/node_agent/node_sync/sds_detect.py | import uuid
import etcd
import gevent
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.message import Message
from tendrl.node_agent.discovery.sds import manager as sds_manager
def sync():
try:
Event(
Message(
pri... | Python | 0.000001 | @@ -2056,32 +2056,175 @@
.integration_id%0A
+ NS._int.wclient.write(integration_index_key,%0A integration_id)%0A
@@ -2308,16 +2308,20 @@
uid4())%0A
+
|
dbe76ab17e795540de6a53b22f90c8af0cb15dbe | Add constants example | constants.example.py | constants.example.py | Python | 0.000011 | @@ -0,0 +1,756 @@
+# coding: utf-8%0Afrom __future__ import unicode_literals%0A%0Atoken = '123456789:dfghdfghdflugdfhg-77fwftfeyfgftre' # bot access_token%0Asn_stickers = ('CADAgADDwAu0BX', 'CAADA',%0A 'CDAgADEQADfvu0Bh0Xd-rAg', 'CAADAgAADfvu0Bee9LyXSj1_fAg',) # ids%0Asome2_stickers = ('CAADAKwADd_JnDFP... | |
d777a19bb804ae1a4268702da00d3138b028b386 | Add a python script to start sysmobts-remote and dump docs | contrib/dump_docs.py | contrib/dump_docs.py | Python | 0.000001 | @@ -0,0 +1,841 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AStart the process and dump the documentation to the doc dir%0A%22%22%22%0A%0Aimport socket, subprocess, time,os%0A%0Aenv = os.environ%0Aenv%5B'L1FWD_BTS_HOST'%5D = '127.0.0.1'%0A%0Abts_proc = subprocess.Popen(%5B%22./src/osmo-bts-sysmo/sysmobts-remote%22,%0A%09%... | |
436119b2ef8ea12f12b69e0d22dd3441b7e187cd | add ratelimit plugin | plugins/ratelimit.py | plugins/ratelimit.py | Python | 0 | @@ -0,0 +1,764 @@
+import time%0A%0Abuckets = %7B%7D%0Alast_tick = time.time()%0Atimeframe = float(yui.config_val('ratelimit', 'timeframe', default=60.0))%0Amax_msg = float(yui.config_val('ratelimit', 'messages', default=6.0))%0Aignore_for = 60.0 * float(yui.config_val('ratelimit', 'ignoreMinutes', default=3.0))%0A%0A%... | |
83579a7e10d66e29fc65c43ba317c6681a393d3e | Add simple hub datapath | pox/datapaths/hub.py | pox/datapaths/hub.py | Python | 0 | @@ -0,0 +1,1543 @@
+# Copyright 2017 James McCauley%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/LICENSE-2.0%0A#%0A# Unless required... | |
d753fe46507d2e829c0b6ffc3120ec8f9472c4f1 | Add Problem 59 solution. | project-euler/059.py | project-euler/059.py | Python | 0.000007 | @@ -0,0 +1,2392 @@
+'''%0AProblem 59%0A19 December 2003%0A%0AEach character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.%0A%0AA modern encryption method is to tak... | |
d1fcf47d62671abbb2ec8a278460dd64a4de03c2 | Create cryptoseven.py | cryptoseven.py | cryptoseven.py | Python | 0.000001 | @@ -0,0 +1,614 @@
+import sys%0A%0A %0Adef strxor(a, b): # xor two strings of different lengths%0A if len(a) %3E len(b):%0A return %22%22.join(%5Bchr(ord(x) %5E ord(y)) for (x, y) in zip(a%5B:len(b)%5D, b)%5D)%0A else:%0A return %22%22.join(%5Bchr(ord(x) %5E ord(y)) for (x, y) in zip(a, b%5B:len... | |
baeecbd66e1acd48aa11fdff4c65567c72d88186 | Create client.py | ohesteebee/client.py | ohesteebee/client.py | Python | 0.000001 | @@ -0,0 +1,1093 @@
+%22%22%22Ohessteebee client.%22%22%22%0Aimport requests%0Afrom typing import Dict%0A%0APutDict = Dict%5Bstr, str%5D%0A%0Aclass Ohessteebee:%0A%0A def __init__(self, endpoint, port=4242):%0A self.session = requests.Session()%0A self.req_path = %22http://%7Bendpoint%7D:%7Bport%7D%22.f... | |
22494a45d2bce6774bdc50409a71f259841287f5 | add initial GlimError | glim/exception.py | glim/exception.py | Python | 0.01808 | @@ -0,0 +1,34 @@
+%0Aclass GlimError(Exception):%0A%09pass
| |
8d5059fcd672fb4f0fcd7a2b57bf41f57b6269e5 | add mongo handler | src/orchestrator/core/mongo.py | src/orchestrator/core/mongo.py | Python | 0.000001 | @@ -0,0 +1,2255 @@
+#%0A# Copyright 2018 Telefonica Espana%0A#%0A# This file is part of IoT orchestrator%0A#%0A# IoT orchestrator is free software: you can redistribute it and/or%0A# modify it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of ... | |
90ec9def45bcc50047d3511943c463f57f771f00 | Bump to 3.2.0 | dbbackup/__init__.py | dbbackup/__init__.py | "Management commands to help backup and restore a project database and media"
VERSION = (3, 1, 3)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Michael Shepanski'
__email__ = 'mjs7231@gmail.com'
__url__ = 'https://github.com/django-dbbackup/django-dbbackup'
default_app_config = 'dbbackup.apps.Dbbackup... | Python | 0.00008 | @@ -89,12 +89,12 @@
(3,
-1, 3
+2, 0
)%0A__
|
2c29829bb6e0483a3dc7d98bc887ae86a3a233b7 | Fix dir name of preprocess | pyPanair/preprocess/__init__.py | pyPanair/preprocess/__init__.py | Python | 0.998086 | @@ -0,0 +1 @@
+
| |
3e7f8c5b87a85958bd45636788215db1ba4f2fd8 | Create __init__.py | src/site/app/model/__init__.py | src/site/app/model/__init__.py | Python | 0.000429 | @@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-%0A
| |
b14545460da0b481ff604a1770441cc963c21b15 | Clean up JS extraction | cfscrape/__init__.py | cfscrape/__init__.py | from time import sleep
import logging
import random
import re
import os
from requests.sessions import Session
import js2py
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
DEFAULT_USER_AGENTS = [
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) C... | Python | 0.000002 | @@ -59,18 +59,8 @@
re%0A
-import os%0A
from
@@ -3034,46 +3034,8 @@
ion%0A
- js = js.replace('return', '')%0A
@@ -3691,47 +3691,8 @@
n js
-.replace(%22parseInt%22, %22return parseInt%22)
%0A%0A
|
38c2291ab23d86d220446e594d52cce80ea4ec2a | Create Count_Inversions_Array.py | Experience/Count_Inversions_Array.py | Experience/Count_Inversions_Array.py | Python | 0.000003 | @@ -0,0 +1,1827 @@
+'''%0AInversion Count for an array indicates %E2%80%93 how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum. %0AFormally speaking, two elements a%5Bi%5D and a%5Bj%5D form an in... | |
0250d46aec1bb060de3cc9a0e619670a7b0d1d03 | append log | delugePostProcess.py | delugePostProcess.py | #!/usr/bin/env python
import os
import sys
from autoprocess import autoProcessTV, autoProcessMovie, autoProcessTVSR
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from deluge import DelugeClient
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)... | Python | 0.002123 | @@ -506,17 +506,17 @@
lemode='
-w
+a
')%0Alog =
|
59b531e11266b2ff8184c04cda92bcc2fad71fa0 | Create core.py | crispy/actions/core.py | crispy/actions/core.py | Python | 0.000001 | @@ -0,0 +1,71 @@
+from crispy.actions.attacks import Attack, Melee, Ranged, Throw, Shoot%0A
| |
d6dc45756cbb30a8f707d683943ccd4ee0391e6b | Add an aws settings for the cms | cms/envs/aws.py | cms/envs/aws.py | Python | 0 | @@ -0,0 +1,1389 @@
+%22%22%22%0AThis is the default template for our main set of AWS servers.%0A%22%22%22%0Aimport json%0A%0Afrom .logsettings import get_logger_config%0Afrom .common import *%0A%0A############################### ALWAYS THE SAME ################################%0ADEBUG = False%0ATEMPLATE_DEBUG = False%0... | |
b32d659b85901a8e04c6c921928483fda3b3e6e0 | Add the storage utility for parsing the config file structure in a more readable fashion. | src/leap/mx/util/storage.py | src/leap/mx/util/storage.py | Python | 0 | @@ -0,0 +1,885 @@
+%0Aclass Storage(dict):%0A %22%22%22%0A A Storage object is like a dictionary except %60obj.foo%60 can be used%0A in addition to %60obj%5B'foo'%5D%60.%0A%0A %3E%3E%3E o = Storage(a=1)%0A %3E%3E%3E o.a%0A 1%0A %3E%3E%3E o%5B'a'%5D%0A 1%0A %3E%3E%3E o.... | |
7c8f2464b303b2a40f7434a0c26b7f88c93b6ddf | add migration | corehq/apps/accounting/migrations/0036_subscription_skip_invoicing_if_no_feature_charges.py | corehq/apps/accounting/migrations/0036_subscription_skip_invoicing_if_no_feature_charges.py | Python | 0.000001 | @@ -0,0 +1,477 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('accounting', '0035_kill_date_received'),%0A %5D%0A%0A operations = %5B%0A migrations.AddF... | |
5e765ecf387d52c22371a69df82beacddcd12e38 | Test COREID is read-only. | revelation/test/test_storage.py | revelation/test/test_storage.py | Python | 0 | @@ -0,0 +1,564 @@
+from revelation.test.machine import StateChecker, new_state%0A%0A%0Adef test_coreid_read_only():%0A state = new_state(rfCOREID=0x808)%0A # Change by writing to register.%0A state.rf%5B0x65%5D = 0x100%0A expected_state = StateChecker(rfCOREID=0x808)%0A expected_state.check(state)%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.