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 |
|---|---|---|---|---|---|---|---|
07a122374abb60140e05b09f49ef942bd14c05f6 | add missed migration | measure_mate/migrations/0026_auto_20160531_0716.py | measure_mate/migrations/0026_auto_20160531_0716.py | Python | 0 | @@ -0,0 +1,696 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-05-31 07:16%0Afrom __future__ import unicode_literals%0A%0Aimport django.core.validators%0Afrom django.db import migrations, models%0Aimport re%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('measure_... | |
d3b4053c2ef39eda9246af2000bdf9460730b33b | convert json to git-versionable versions which current TinyDB user can live with. | prettifyjson.py | prettifyjson.py | Python | 0 | @@ -0,0 +1,279 @@
+#!/usr/bin/env python%0Afrom os import path%0Aimport sys%0A%0Aimport json%0A%0Aif len(sys.argv) %3E 1:%0A print(%22usage:%5Cn%5Ct%7B%7D %3C your_json_file %3E your_prettified_json_file%22.format(%0A path.basename(sys.argv%5B0%5D)))%0A sys.exit(1)%0A%0Ajson.dump(json.load(sys.stdin), ... | |
caf0b00bc21208515d0ddded3cbb934735d45939 | add migration to create new model fields | coupons/migrations/0004_auto_20151105_1456.py | coupons/migrations/0004_auto_20151105_1456.py | Python | 0 | @@ -0,0 +1,1564 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Afrom django.conf import settings%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A migrations.swappable_dependency(settings.AUTH_USER_MODEL),%0A ... | |
b181f2a57d57caaa6e53e193e88002a15e284fd0 | add the missing file. i are senior dvlpr | cryptography/hazmat/backends/openssl/utils.py | cryptography/hazmat/backends/openssl/utils.py | Python | 0.000523 | @@ -0,0 +1,1113 @@
+# 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 by applicable law or agreed to in writi... | |
4a0e00574fc551dde74db1a817229eeb23c4e0a8 | Create prueba.py | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
def... | Python | 0.000008 | @@ -238,24 +238,90 @@
print xml%0A
+ email_lib.email_alert(customer_email,iccid, admin_details%5B1%5D)%0A
return N
|
7e4fd6b92040788bda1760cb261730f627ca6a10 | Add example from listing 7.6 | ch7/profile_read.py | ch7/profile_read.py | Python | 0 | @@ -0,0 +1,3006 @@
+'''%0AListing 7.6: Profiling data transfer%0A'''%0A%0Aimport numpy as np%0Aimport pyopencl as cl%0Aimport pyopencl.array%0A%0Aimport utility%0Afrom time import sleep%0A%0ANUM_VECTORS = 8192%0ANUM_ITERATIONS = 2000%0A%0Akernel_src = '''%0A__kernel void profile_read(__global char16 *c, int num) %7B%0A... | |
8ecac8170a3f9323f76aa9252a9d3b2f57f7660c | Include duration in analysis output | ceam/analysis.py | ceam/analysis.py | # ~/ceam/ceam/analysis.py
import argparse
import pandas as pd
import numpy as np
def confidence(seq):
mean = np.mean(seq)
std = np.std(seq)
runs = len(seq)
interval = (1.96*std)/np.sqrt(runs)
return mean, mean-interval, mean+interval
def difference_with_confidence(a, b):
mean_diff = np.mean(... | Python | 0.000012 | @@ -777,16 +777,68 @@
ntion))%0A
+ print('Mean duration', results.duration.mean())%0A
prin
|
0ee4afce4ba81cff6d13152ab082157afc4718f1 | Create pyspark.py | pyspark.py | pyspark.py | Python | 0.000009 | @@ -0,0 +1,232 @@
+from pyspark import SparkConf, SparkContext%0A%0Aconf = SparkConf().setMaster(%22local%22).setAppName(%22MinTemperatures%22)%0Asc = SparkContext(conf = conf)%0A%0Alines = sc.textFile(%22file:///Users/Spark/1800.csv%22)%0AparsedLines = lines.map(parseLine)%0A
| |
af495c7a69611f2c1fa744dce000c49033eb2dd7 | Add test for sys.intern(). | tests/basics/sys_intern.py | tests/basics/sys_intern.py | Python | 0 | @@ -0,0 +1,407 @@
+# test sys.intern() function%0A%0Aimport sys%0Atry:%0A sys.intern%0Aexcept AttributeError:%0A print('SKIP')%0A raise SystemExit%0A%0As1 = %22long long long long long long%22%0As2 = %22long long long%22 + %22 long long long%22%0A%0Aprint(id(s1) == id(s2))%0A%0Ai1 = sys.intern(s1)%0Ai2 = sys.i... | |
7323565bdc2a290e97617857da475e8f41d5a43f | Add tee plugin | plugins/tee.py | plugins/tee.py | Python | 0 | @@ -0,0 +1,262 @@
+class Plugin:%0A def on_command(self, bot, msg, stdin, stdout, reply):%0A text = stdin.read().strip()%0A%0A reply(text)%0A print(text, file=stdout)%0A%0A def on_help(self):%0A return %22Copy standard input to reply, and also to standard output.%22%0A
| |
b8ea356af5121ffd612ccf708fe2372fbae3cc3d | add custom hasher for crypt_sha512 | daiquiri/core/hashers.py | daiquiri/core/hashers.py | Python | 0.000001 | @@ -0,0 +1,1347 @@
+# inspired by https://djangosnippets.org/snippets/10572/%0A%0Afrom collections import OrderedDict%0Afrom django.contrib.auth.hashers import CryptPasswordHasher, mask_hash%0Afrom django.utils.encoding import force_str%0Afrom django.utils.crypto import get_random_string, constant_time_compare%0Afrom d... | |
ede8d4db9f0a8b3331b299019ec67c92261b2a56 | Make sure we don't blow up if BROKER_URL is None | src/sentry/monitoring/queues.py | src/sentry/monitoring/queues.py | """
sentry.monitoring.queues
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from urlparse import urlparse
from django.conf import settings
from django.utils.function... | Python | 0.999414 | @@ -2559,24 +2559,74 @@
roker_url):%0A
+ if broker_url is None:%0A raise KeyError%0A
return b
|
042d0d899896342e9f2e7b083f8543e8077bf19a | Add tests.py to app skeleton. | lib/rapidsms/skeleton/app/tests.py | lib/rapidsms/skeleton/app/tests.py | Python | 0 | @@ -0,0 +1,543 @@
+from rapidsms.tests.scripted import TestScript%0Afrom app import App%0A%0Aclass TestApp (TestScript):%0A apps = (App,)%0A%0A # define your test scripts here.%0A # e.g.:%0A #%0A # testRegister = %22%22%22%0A # 8005551212 %3E register as someuser%0A # 8005551212 %3C Registered ... | |
27a7079f9edf01abce7912eb52c5091279bc85a1 | ADD | 添加pygal path的变量设定源码 | src/lib/PygalPath.py | src/lib/PygalPath.py | Python | 0 | @@ -0,0 +1,683 @@
+#-*- coding:UTF-8 -*-%0Aimport socket%0Aimport os%0A%0A__all__ = %5B'PYGAL_TOOLTIPS_PATH', 'SVG_JQUERY_PATH'%5D%0A%0ASERVER_WUHAN = '192.168.60.60'%0ASERVER_WUHAN_PRE = '192.168.6'%0ASERVER_BEIJING = '192.168.50.193'%0ASERVER_BEIJING_PRE = '192.168.5'%0ASERVER = '10.1.145.70'%0A%0A#%E6%A0%B9%E6%8D%AE... | |
a3db0306133bc3da1cc00d3c745396539a152839 | Add release script | release.py | release.py | Python | 0.000001 | @@ -0,0 +1,2092 @@
+#!/usr/bin/env python%0A%0Afrom collections import OrderedDict%0Afrom itertools import zip_longest%0Aimport json%0Aimport os%0Aimport re%0Afrom subprocess import check_output, CalledProcessError%0Aimport sys%0Afrom zipfile import ZipFile%0A%0A%0Adef sh(command, v=False):%0A if v:%0A print(... | |
9ad9808b9bf7c202bc6dbbe8abd74e1c642982ae | structure migration | structure/migrations/0002_structure_refined.py | structure/migrations/0002_structure_refined.py | Python | 0.000002 | @@ -0,0 +1,445 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-09-20 07:35%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('structure', '0001_initial'),%0A %5D%0A%0A opera... | |
ca1cb845f312ba295718084fa6c8a0d4e68d49e3 | fix boolean parameter in config file | core/config.py | core/config.py | import argparse
import appdirs
import logging
import os
import configparser
def defaultBackendRpcPort(config):
if config.TESTNET:
return 14000
else:
return 4000
def defaultBackendRpc(config):
protocol = 'https' if config.BACKEND_RPC_SSL else 'http'
return '{}://{}:{}@{}:{}'.format(prot... | Python | 0.000002 | @@ -68,16 +68,27 @@
igparser
+%0Aimport sys
%0A%0Adef de
@@ -3657,16 +3657,151 @@
is None
+ or (isinstance(self.args%5BargName%5D, bool) and '--%7B%7D'.format(arg%5B'name'%5D) not in sys.argv and '-%7B%7D'.format(arg%5B'name'%5D) not in sys.argv)
:%0A
|
be01980afe4b1dbd5a1d5b07651cd7a54c771d01 | Add unit tests for disk module | tests/modules/test_disk.py | tests/modules/test_disk.py | Python | 0 | @@ -0,0 +1,1579 @@
+# pylint: disable=C0103,C0111%0A%0Aimport mock%0Aimport unittest%0A%0Aimport tests.mocks as mocks%0A%0Afrom bumblebee.input import LEFT_MOUSE%0Afrom bumblebee.modules.disk import Module%0A%0Aclass MockVFS(object):%0A def __init__(self, perc):%0A self.f_blocks = 1024*1024%0A self.f_f... | |
da52f7c8c9280fe644a01a324eaad5512870dccb | add models.py | core/models.py | core/models.py | Python | 0.000001 | @@ -0,0 +1,2426 @@
+#!/usr/bin/env python%0A# coding = utf-8%0A%0A%22%22%22%0Acore.models%0A%22%22%22%0A%0A__author__ = 'Rnd495'%0A%0Aimport datetime%0A%0Aimport hashlib%0Afrom sqlalchemy import create_engine%0Afrom sqlalchemy import Column, Integer, Float, String, DateTime, Text, Index%0Afrom sqlalchemy.ext.declarativ... | |
2b3d9a7278220af765934cccf83bb1d470d6bfab | #tf-data-service Fix a typo. | tensorflow/python/data/experimental/kernel_tests/service/coordinated_read_ft_test.py | tensorflow/python/data/experimental/kernel_tests/service/coordinated_read_ft_test.py | # Copyright 2021 The TensorFlow Authors. 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 applica... | Python | 0.999999 | @@ -706,17 +706,16 @@
ce tests
-t
for tf.
|
4bf1a14f6b6d3b30f30732bb45f4e8a501dfcbf6 | test github backup | tests/pkcli/github_test.py | tests/pkcli/github_test.py | Python | 0.000003 | @@ -0,0 +1,633 @@
+# -*- coding: utf-8 -*-%0Au%22%22%22test github%0A%0A:copyright: Copyright (c) 2019 Bivio Software, Inc. All Rights Reserved.%0A:license: http://www.apache.org/licenses/LICENSE-2.0.html%0A%22%22%22%0Afrom __future__ import absolute_import, division, print_function%0Aimport pytest%0A%0Adef test_backu... | |
8fdaeea43e31a1c429703cd4f441a748bcfa8197 | Create create_mask.py | create_mask.py | create_mask.py | Python | 0.000017 | @@ -0,0 +1,1380 @@
+%0Afrom __future__ import print_function%0A%0Aimport argparse%0Afrom PIL import ImageFont, ImageDraw, Image%0A%0A%0Adef create_mask(text, font_type, font_size=84):%0A '''%0A Creates an image with the given text in it.%0A '''%0A # initialize fond with given size%0A font = ImageFont.tru... | |
79e55030736572608841bbdd3a6022fc2420be45 | implement recursive permutation generation algorithm with switch | switch.py | switch.py | Python | 0.000002 | @@ -0,0 +1,943 @@
+###%0A# A permutation generation algorithm.%0A# this algorithm is implemented by switching neighboring number.%0A#%0A# Under here is two implementation recursive and iterative%0A###%0A%0A%0Adef recursive_PGA_with_switch(width):%0A '''%0A Recursive permutation generation algorithm with switch%0A... | |
dfab68c27b3f25f448c0a2a6d0cee347bae2b08f | Add tests for canonicalize | tests/test_canonicalize.py | tests/test_canonicalize.py | Python | 0 | @@ -0,0 +1,360 @@
+from intervals import Interval, canonicalize%0A%0A%0Adef test_canonicalize():%0A assert canonicalize(Interval(%5B1, 4%5D)).normalized == '%5B1, 5)'%0A assert canonicalize(%0A Interval((1, 7)), lower_inc=True, upper_inc=True%0A ).normalized == '%5B2, 6%5D'%0A assert canonicalize(%0A... | |
76468926c1efe4d18477a70d767f91d4c6e38768 | Add test for dotted circles in sample text | tests/test_dottedcircle.py | tests/test_dottedcircle.py | Python | 0 | @@ -0,0 +1,880 @@
+import uharfbuzz as hb%0Aimport gflanguages%0Aimport pytest%0A%0Alangs = gflanguages.LoadLanguages()%0A%0A%0A@pytest.fixture%0Adef hb_font():%0A # Persuade Harfbuzz we have a font that supports%0A # every codepoint.%0A face = hb.Face(b%22%22)%0A font = hb.Font(face)%0A funcs = hb.FontF... | |
7c69ec08967dc38463cfc5e1323d69fd5f261333 | Create config.py | config.py | config.py | Python | 0 | @@ -0,0 +1,738 @@
+#!/usr/bin/env python%0A%0Aimport pyvty%0A%0Auser = 'admin'%0Apassword = 'password'%0A%0Ahost = '10.36.65.227'%0Aconfig_file = 'config.txt' # name of text file containing config commands.%0Alogfile = 'config_' + host + '.log' # terminal output will be saved in this file.%0A%0A%0Atry:%0A input_fi... | |
7864c8e8591d1de14f18ecfaf880e79de6c7702e | add tests for placeholder class | tests/test_placeholders.py | tests/test_placeholders.py | Python | 0 | @@ -0,0 +1,1606 @@
+import re%0A%0Aimport pytest%0A%0Afrom notifications_utils.field import Placeholder%0A%0A%0A@pytest.mark.parametrize('body, expected', %5B%0A ('((with-brackets))', 'with-brackets'),%0A ('without-brackets', 'without-brackets'),%0A%5D)%0Adef test_placeholder_returns_name(body, expected):%0A a... | |
9b1f9e9abd2890bc3e4d9f38109f12de8b488b66 | Create config.py | config.py | config.py | Python | 0.000002 | @@ -0,0 +1,128 @@
+username = %22facility_ai%22%0Apassword = %22UncloakIsADick%22%0Aclient_id = %22GORfUXQGjNIveA%22%0Aclient_secret = %22SzPFXaqgVbRxm_V9-IfGL05npPE%22%0A
| |
17f71bfb81393241759e38fb9dce01561aeca3d5 | Add tests to product tags | tests/test_product_tags.py | tests/test_product_tags.py | Python | 0 | @@ -0,0 +1,1131 @@
+from mock import Mock%0Afrom saleor.product.templatetags.product_images import get_thumbnail, product_first_image%0A%0A%0Adef test_get_thumbnail():%0A instance = Mock()%0A cropped_value = Mock(url='crop.jpg')%0A thumbnail_value = Mock(url='thumb.jpg')%0A instance.crop = %7B'10x10': cropp... | |
27444dfefa70759694b755185c2eb6f25216d326 | Remove Node - migration. | devilry/apps/core/migrations/0037_auto_20170620_1515.py | devilry/apps/core/migrations/0037_auto_20170620_1515.py | Python | 0 | @@ -0,0 +1,781 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.9 on 2017-06-20 15:15%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0036_auto_20170523_1748'),%0A %5D%0A%0A operat... | |
f1cb5af4f42ccf437cdd6ef06a2056993e54b604 | Create sum13.py | Python/CodingBat/sum13.py | Python/CodingBat/sum13.py | Python | 0.000132 | @@ -0,0 +1,210 @@
+# http://codingbat.com/prob/p167025%0A%0Adef sum13(nums):%0A sum = 0%0A %0A i = 0%0A while i %3C len(nums):%0A if nums%5Bi%5D == 13:%0A i += 2%0A continue%0A else:%0A sum += nums%5Bi%5D%0A i += 1%0A %0A return sum%0A
| |
d408ae00d2e5c0a0e7c5e90e98088d52815c5e49 | Create WikiScrape.py | Python/WikiScrape.py | Python/WikiScrape.py | Python | 0 | @@ -0,0 +1,650 @@
+## This script was tested using Python 2.7.9%0A## The MWClient library was used to access the api. It can be found at:%0A## https://github.com/mwclient/mwclient%0A%0Aimport mwclient%0Asite = mwclient.Site(('https', 'en.wikipedia.org'))%0Asite.login('$user', '$pass') # credentials are sanitized from ... | |
e455d459590a4f2b16b9a9360b6e33640f5ec7bf | Add a script to check that __all__ in __init__.py is correct | python/allcheck.py | python/allcheck.py | Python | 0.003175 | @@ -0,0 +1,1414 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport re%0Aimport glob%0A%0Aimport phonenumbers%0A%0AINTERNAL_FILES = %5B'phonenumbers/util.py',%0A 'phonenumbers/re_util.py',%0A 'phonenumbers/unicode_util.py'%5D%0ACLASS_RE = re.compile(r%22%5Eclass +(%5BA-Za-z%5D%5B_A-Za-z0-9... | |
0deec6fecb527f12ff6851c47820b76db8196a34 | Add files via upload | rosette.py | rosette.py | Python | 0 | @@ -0,0 +1,760 @@
+# This is a basic program showing the functionality of the turtle module.%0D%0A# It generates a very pretty spiraling pattern.%0D%0A%0D%0Aimport turtle # import the turtle module so we can draw%0D%0Aimport math # import the math module, we need this for e and pi%0D%0A%0D%0At = turtle.Pen() #... | |
48c844e602eaa182c4efaaa0b977765f4248d0a0 | Add a data migration tool | tools/network_migration.py | tools/network_migration.py | Python | 0.000006 | @@ -0,0 +1,1368 @@
+import argparse, shelve%0A%0Adef renameDictKeys(storageDict):%0A for key in storageDict.iterkeys():%0A if isinstance(storageDict%5Bkey%5D, dict):%0A renameDictKeys(storageDict%5Bkey%5D)%0A if key == options.oldnetwork:%0A storageDict%5Boptions.newnetwork%5D = s... | |
20269212705bdfd8748be468a50567ba290ad4a1 | Bump PROVISION_VERSION for new APNS. | version.py | version.py | ZULIP_VERSION = "1.6.0+git"
PROVISION_VERSION = '9.3'
| Python | 0 | @@ -48,7 +48,7 @@
'9.
-3
+4
'%0A
|
9cd494537ee51e092a8e8080f0e59bfd5a75eda4 | Use cities1000 in test_project | test_project/test_project/settings.py | test_project/test_project/settings.py | # Django settings for test_project project.
import os.path
import posixpath
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
FIXTURE_DIRS = [
os.path.join(PROJECT_ROOT, 'fixtures'),
]
M... | Python | 0.000001 | @@ -150,16 +150,110 @@
'..'))%0A%0A
+CITIES_LIGHT_CITY_SOURCES = %5B%0A 'http://download.geonames.org/export/dump/cities1000.zip'%5D%0A%0A
DEBUG =
|
426f9c0b63adf7d7085a45bfe3520eb36a2ad6f7 | Fix indents. | evelink/parsing/assets.py | evelink/parsing/assets.py | from evelink import api
from evelink import constants
def parse_assets(api_result):
def handle_rowset(rowset, parent_location):
results = []
for row in rowset.findall('row'):
item = {'id': int(row.attrib['itemID']),
'item_type_id': int(row.attrib['typeID']),
'location_id': i... | Python | 0.000001 | @@ -238,26 +238,40 @@
'itemID'%5D),%0A
-%09%09
+
'item_ty
@@ -301,26 +301,40 @@
'typeID'%5D),%0A
-%09%09
+
'locatio
@@ -392,18 +392,32 @@
tion)),%0A
-%09%09
+
'loc
@@ -450,26 +450,40 @@
b%5B'flag'%5D),%0A
-%09%09
+
'quantit
@@ -519,... |
35076b373913381a90aa65e8052036eb51eece46 | add unicode_literals in utils | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import shutil
import errno
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033... | Python | 0.001148 | @@ -77,16 +77,34 @@
function
+, unicode_literals
%0A%0Aimport
|
d72d2e38d177476470b22ded061dd06b2be3ee88 | Add the quantity-safe allclose from spectral-cube | turbustat/tests/helpers.py | turbustat/tests/helpers.py | Python | 0.000261 | @@ -0,0 +1,2265 @@
+from __future__ import print_function, absolute_import, division%0A%0Afrom astropy import units as u%0A%0Afrom numpy.testing import assert_allclose as assert_allclose_numpy, assert_array_equal%0A%0A%0Adef assert_allclose(q1, q2, **kwargs):%0A %22%22%22%0A Quantity-safe version of Numpy's asser... | |
6c3d92a2d3eb043e466e3d6ab8e303c025cc7e0a | add ColorPrinter.py | ColorPrinter.py | ColorPrinter.py | Python | 0 | @@ -0,0 +1,1443 @@
+class ColorPrinter:%0A %22%22%22%0A print message to terminal with colored header%0A %22%22%22%0A def __init__(self, header=''):%0A self.__header = header%0A self.__levels = %7B%0A 'log': '%5C033%5B0m', # terminal color header%0A 'info': '%5C033%5B1;3... | |
b5972a5651ba1ace28ae54d5a1a4f31a07e97670 | add server_costs table | migrations/versions/1e27c434bb14_create_server_costs.py | migrations/versions/1e27c434bb14_create_server_costs.py | Python | 0.000001 | @@ -0,0 +1,758 @@
+%22%22%22create server_costs table%0A%0ARevision ID: 1e27c434bb14%0ARevises: fa0f07475596%0ACreate Date: 2016-03-14 15:57:19.945327%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '1e27c434bb14'%0Adown_revision = 'fa0f07475596'%0A%0Afrom alembic import op%0Aimport sqlalchemy... | |
7334b87e6d7a9ef495919a2b13cf926692619fcd | fix min/max typos | modularodm/tests/validators/test_iterable_validators.py | modularodm/tests/validators/test_iterable_validators.py | from modularodm import StoredObject
from modularodm.exceptions import ValidationValueError
from modularodm.fields import IntegerField, StringField
from modularodm.tests import ModularOdmTestCase
from modularodm.validators import MaxLengthValidator, MinLengthValidator
class StringValidatorTestCase(ModularOdmTestCase):... | Python | 0.999987 | @@ -430,32 +430,36 @@
test_field
+_max
= StringField(%0A
@@ -543,32 +543,167 @@
%5D%0A )%0A
+ test_field_min = StringField(%0A list=False,%0A validate=%5BMinLengthValidator(5), %5D%0A )%0A
self.tes
@@ -829,32 +829,36 @@
bject.test_field
... |
ff519b5145accbc10fcb7baa955bc1fe44774c27 | Add browser/websocket.py | src/Lib/browser/websocket.py | src/Lib/browser/websocket.py | Python | 0.000001 | @@ -0,0 +1,100 @@
+from browser import window%0Aimport javascript%0A%0AWebSocket = javascript.JSConstructor(window.WebSocket)
| |
126491288a532da08fb3923eae2635a84736798d | Add new package: libsamplerate (#16143) | var/spack/repos/builtin/packages/libsamplerate/package.py | var/spack/repos/builtin/packages/libsamplerate/package.py | Python | 0 | @@ -0,0 +1,899 @@
+# Copyright 2013-2020 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 Libsamplerate(AutotoolsPackage):%0A %22%22%22libsamplera... | |
4e6a6e4f2758bd616f0c2c2703160cbb9c539b63 | add new package (#23843) | var/spack/repos/builtin/packages/py-kubernetes/package.py | var/spack/repos/builtin/packages/py-kubernetes/package.py | Python | 0 | @@ -0,0 +1,1896 @@
+# Copyright 2013-2020 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%0A%0Afrom spack import *%0A%0A%0Aclass PyKubernetes(PythonPackage):%0A %22%22%22Official Py... | |
04d6fd6ceabf71f5f38fd7cf25cd4ac2bcb6b57f | Add simple web server to display measurements | server.py | server.py | Python | 0 | @@ -0,0 +1,1022 @@
+import sqlite3%0Afrom flask import Flask, g, render_template_string%0Aapp = Flask(__name__)%0A%0Adef get_db():%0A db = getattr(g, '_database', None)%0A if db is None:%0A db = g._database = sqlite3.connect('sensors.db')%0A return db%0A%0Aindex_tmpl = %22%22%22%0A%3C!doctype html%3E%0A... | |
acc23fe67231f8b556b2de7bd19f0050cbe379e6 | Add total calculation script | total_prices.py | total_prices.py | Python | 0.000001 | @@ -0,0 +1,376 @@
+prices = %7B%0A %22banana%22 : 4,%0A %22apple%22 : 2,%0A %22orange%22 : 1.5,%0A %22pear%22 : 3%0A%7D%0A%0Astock = %7B%0A %22banana%22 : 6,%0A %22apple%22 : 0,%0A %22orange%22 : 32,%0A %22pear%22 : 15,%0A%7D%0A%0A%0Atotal = 0%0A%0Afor key in prices:%0A print key%0A ... | |
31af4f92e97c83c42baff4e902cddf8184d84e4d | allow to run tox as 'python -m tox', which is handy on Windoze | tox/__main__.py | tox/__main__.py | Python | 0 | @@ -0,0 +1,38 @@
+from tox._cmdline import main%0A%0Amain()%0A
| |
f86d07998a2a80fcf9e69cca9d89c2ca4d982e02 | Fix windows dist script | src/etc/copy-runtime-deps.py | src/etc/copy-runtime-deps.py | #!/usr/bin/env python
# xfail-license
# Copies Rust runtime dependencies to the specified directory
import snapshot, sys, os, shutil
def copy_runtime_deps(dest_dir):
for path in snapshot.get_winnt_runtime_deps():
shutil.copy(path, dest_dir)
lic_dest = os.path.join(dest_dir, "third-party")
shutil... | Python | 0 | @@ -303,16 +303,53 @@
party%22)%0A
+ if os.path.exists(lic_dest):%0A
shut
|
d206b02e12cf7f5418cd02987313bd7ddd807901 | add geom_tile layer. | ggplot/geoms/geom_tile.py | ggplot/geoms/geom_tile.py | Python | 0 | @@ -0,0 +1,929 @@
+import matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport pandas as pd%0A%0Afrom geom import geom%0A%0A%0Aclass geom_tile(geom):%0A VALID_AES = %5B'x', 'y', 'fill'%5D%0A%0A def plot_layer(self, layer):%0A layer = %7Bk: v for k, v in layer.iteritems() if k in self.VALID_AES%7D%0A ... | |
d940ce7cbd92c0e886139eaec3faa75aabbce16a | add test models | singleactiveobject/tests/models.py | singleactiveobject/tests/models.py | Python | 0 | @@ -0,0 +1,125 @@
+from singleactiveobject.models import SingleActiveObjectMixin%0A%0A%0Aclass SingleActiveObject(SingleActiveObjectMixin):%0A pass%0A%0A
| |
71d3375c4ca1acb106f8825d2f39ca602fa47e94 | Test astroid trajectory implementation | src/test/trajectory/test_astroid_trajectory.py | src/test/trajectory/test_astroid_trajectory.py | Python | 0.000001 | @@ -0,0 +1,1117 @@
+#!/usr/bin/env python%0Aimport unittest%0A%0Afrom geometry_msgs.msg import Point%0A%0Afrom trajectory.astroid_trajectory import AstroidTrajectory%0A%0A%0Aclass AstroidTrajectoryTest(unittest.TestCase):%0A%0A def setUp(self):%0A self.delta = 0.000001%0A self.radius = 5%0A self... | |
835b5f20061033b6fcf2a8b86203a42c5d4835ee | Add initial unit tests for parameter.py (List) | spotpy/unittests/test_parameter.py | spotpy/unittests/test_parameter.py | Python | 0 | @@ -0,0 +1,1156 @@
+import unittest%0Atry:%0A import spotpy%0Aexcept ImportError:%0A import sys%0A sys.path.append(%22.%22)%0A import spotpy%0Afrom spotpy import parameter%0Aimport numpy as np%0A%0A#https://docs.python.org/3/library/unittest.html%0A%0Aclass TestListParameterDistribution(unittest.TestCase):%... | |
a759fee7b1cca1d3966100b480cac80ad4c9ece7 | Iterate the stackexchange corpuses term vectors | termVectors.py | termVectors.py | Python | 0.999848 | @@ -0,0 +1,1470 @@
+%0Afrom elasticsearch import Elasticsearch%0Aes = Elasticsearch('http://localhost:9200')%0A%0A%0Adef scoredFingerprint(terms):%0A fp = %7B%7D%0A for term, value in terms.items():%0A fp%5Bterm%5D = float(value%5B'term_freq'%5D) / float(value%5B'doc_freq'%5D)%0A return fp%0A%0A%0Adef a... | |
e9a5a0c22de92f3b5eb5df567475736b72c5067c | Add pa300_calc_coord.py | pa300_calc_coord.py | pa300_calc_coord.py | Python | 0.001616 | @@ -0,0 +1,1080 @@
+# Std libs%0Afrom itertools import product%0Aimport sqlite3%0A# My libs%0Aimport constants as c%0A%0Aconn_params = sqlite3.connect(c.sql_params_dropbox)%0Acur_params = conn_params.cursor()%0A%0Adats = cur_params.execute('''SELECT mask, mesa, xm_mesa, ym_mesa, xm_pad, ym_pad%0A ... | |
b3c89917895786bfab5d4fae9ce086767575a506 | Add a deployment script | deploy.py | deploy.py | Python | 0.000002 | @@ -0,0 +1,1389 @@
+%22%22%22 This is a script that deploys Dogbot. %22%22%22%0A%0Aimport os%0Afrom pathlib import Path%0A%0Afrom ruamel.yaml import YAML%0Aimport requests%0A%0A# load the webhook url from the configuration%0Awith open('config.yml') as f:%0A webhook_url = YAML(typ='safe').load(f)%5B'monitoring'%5D%5B... | |
10b3ae6ab5009fe0c43b744dc655bd6512cec041 | Include basic version of contract object | db/contract.py | db/contract.py | Python | 0 | @@ -0,0 +1,217 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom .common import Base, session_scope%0A%0A%0Aclass Contract(Base):%0A __tablename__ = 'contracts'%0A __autoload__ = True%0A%0A%0Adef __init__(self, player_id, contract_data):%0A%0A%0A
| |
aef7c25964883bae893913524bc9ff3dc0bdcde3 | Add a docker helper script (#18) | docker.py | docker.py | Python | 0.000022 | @@ -0,0 +1,1705 @@
+#!/usr/bin/env python3%0A%0Aimport argparse%0Aimport subprocess%0A%0AIMAGE_NAME = 'cargo-sphinx'%0A%0A%0Adef has_image(name):%0A cmd = %22docker images %7C awk '%7B%7Bprint $1%7D%7D' %7C grep '%5E%7Bname%7D$' %3E /dev/null%22.format(%0A name=name),%0A proc = subprocess.run(cmd, shel... | |
647fd44f829a308dc16eb86a663dc1a3719476ab | add solution for Search a 2D Matrix II | algorithms/searchA2DMatrixII/searchA2DMatrixII.py | algorithms/searchA2DMatrixII/searchA2DMatrixII.py | Python | 0.000005 | @@ -0,0 +1,452 @@
+class Solution:%0A # @param %7Binteger%5B%5D%5B%5D%7D matrix%0A # @param %7Binteger%7D target%0A # @return %7Bboolean%7D%0A%0A def searchMatrix(self, matrix, target):%0A n = len(matrix)%0A m = len(matrix%5B0%5D)%0A x = n-1%0A y = 0%0A while x %3E= 0 and ... | |
17183883d3b70c909aeacecb57669ca718fcfe41 | Replace return with exit, add ssh call | docker.py | docker.py | #!/usr/bin/env python2
from __future__ import print_function
import os
import os.path
import logging
from os.path import exists, join
from shlex import split
from sys import argv, exit
from subprocess import call, check_output
def symlink_force(source, link_name):
"""Equivalent to adding -f flag to bash invocat... | Python | 0.001123 | @@ -5116,23 +5116,21 @@
-return
+exit(
call(spl
@@ -5168,16 +5168,17 @@
er.py%22))
+)
%0A%0A%0Adef c
@@ -5378,15 +5378,13 @@
-return
+exit(
retu
@@ -5389,16 +5389,17 @@
turncode
+)
%0A%0A%0Aif __
|
ada6128817769886e2869944fac3a8cea0b5b109 | Add a missing module | pykmer/timer.py | pykmer/timer.py | Python | 0.000048 | @@ -0,0 +1,999 @@
+%22%22%22%0AThis module provides a simple timer class for instrumenting code.%0A%22%22%22%0A%0Aimport time%0A%0Aclass timer(object):%0A def __init__(self):%0A self.start = time.time()%0A self.sofar = 0.0%0A self.paused = False%0A self.events = 0%0A%0A def pause(self)... | |
6e767e8f5b219d9883fb1a16846830efabac7d5b | Add python | python/hello.py | python/hello.py | Python | 0.998925 | @@ -0,0 +1,23 @@
+print(%22Hello, World!%22)%0A
| |
01472504fc42137a05a85ae5ad6d4b7956865680 | Add autosolver for regex. | quiz/5-regex.py | quiz/5-regex.py | Python | 0 | @@ -0,0 +1,2486 @@
+#!/usr/bin/env python3%0A%0A%0Adef make_array(text):%0A import re%0A regex = re.compile('(%5Cd+)-%3E(%5Cd+)')%0A pairs = regex.findall(text)%0A ret = list()%0A for (src, dst) in pairs:%0A src = int(src)%0A dst = int(dst)%0A ret.append((src, dst))%0A return ret%... | |
2c1b5aedc5f4503a738ef7e9ffa0a7f969fecfef | add argparse example | Python/calculator_argp.py | Python/calculator_argp.py | Python | 0.000032 | @@ -0,0 +1,803 @@
+import argparse%0A%0A%0Adef main():%0A parser = argparse.ArgumentParser(description='Calculate two input numbers')%0A parser.add_argument(%0A 'first', metavar='int', type=int,%0A help='first number')%0A parser.add_argument(%0A 'oper', metavar='oper', type=str... | |
ed5f68211e93df983a5e15c7f1ce812b810b49c0 | Add ANTs package (#7717) | var/spack/repos/builtin/packages/ants/package.py | var/spack/repos/builtin/packages/ants/package.py | Python | 0 | @@ -0,0 +1,2207 @@
+##############################################################################%0A# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
744cedc7e999f96aa0646bb43c039882991228ae | Add Asio package (#24485) | var/spack/repos/builtin/packages/asio/package.py | var/spack/repos/builtin/packages/asio/package.py | Python | 0 | @@ -0,0 +1,2404 @@
+# Copyright 2013-2021 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 *%0Aimport os.path%0A%0A%0Aclass Asio(AutotoolsPackage):%0A %22%22%22C+... | |
b1feed0ced6d1328cc39bc9bba36331ec6da7803 | Add ban for pgp/gpg private key blocks | pre_commit_hooks/detect_private_key.py | pre_commit_hooks/detect_private_key.py | from __future__ import print_function
import argparse
import sys
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',
b'BEGIN DSA PRIVATE KEY',
b'BEGIN EC PRIVATE KEY',
b'BEGIN OPENSSH PRIVATE KEY',
b'BEGIN PRIVATE KEY',
b'PuTTY-User-Key-File-2',
b'BEGIN SSH2 ENCRYPTED PRIVATE KEY',
]
def detect_priv... | Python | 0 | @@ -294,16 +294,52 @@
E KEY',%0A
+ b'BEGIN PGP PRIVATE KEY BLOCK',%0A
%5D%0A%0A%0Adef
|
6b9b9642ca09f3b33bdf61bb5dacbaa7c29de8fc | Create __main__.py | src/__main__.py | src/__main__.py | Python | 0.000164 | @@ -0,0 +1 @@
+%0A
| |
a58a7f3206168ae98b952e804404c46b89e81640 | Add a snippet (Pillow). | python/pil/python3_pillow_fork/show.py | python/pil/python3_pillow_fork/show.py | Python | 0.000001 | @@ -0,0 +1,1394 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015 J%C3%A9r%C3%A9mie DECOCK (http://www.jdhp.org)%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 t... | |
21f789eb05788fcaf0be1960b3c1171437d8a299 | Replace Dict by Mapping. | zerver/lib/session_user.py | zerver/lib/session_user.py | from __future__ import absolute_import
from django.contrib.auth import SESSION_KEY, get_user_model
from django.contrib.sessions.models import Session
from typing import Dict, Optional
from six import text_type
def get_session_dict_user(session_dict):
# type: (Dict[text_type, int]) -> Optional[int]
# Compare... | Python | 0 | @@ -164,20 +164,23 @@
import
-Dict
+Mapping
, Option
@@ -268,12 +268,15 @@
e: (
-Dict
+Mapping
%5Btex
|
7037762247bd40455eb1944dc21684561c5f97ba | add a __init__ file | dataScraping/__init__.py | dataScraping/__init__.py | Python | 0.000342 | @@ -0,0 +1,22 @@
+#!/usr/bin/env python%0A
| |
2b4544820bf6549bc172f8d5b3532a9103190920 | add utility I used to generate random ph and temp readings | utils/generate_random_values.py | utils/generate_random_values.py | Python | 0 | @@ -0,0 +1,320 @@
+import random%0Aph = %5Brandom.uniform(0, 14) for x in range(30000)%5D%0Atemp = %5Brandom.uniform(55, 90) for x in range(30000)%5D%0Atemp_file = open('temp.csv', 'w+')%0Aph_file = open('ph.csv', 'w+')%0Afor x in range(len(temp)):%0A temp_file.write(%22%25.2f,%22 %25 temp%5Bx%5D)%0A ph_file.writ... | |
4883bd13c6e07a0568c29fd26a141888b52292b7 | Add retriever object for player draft information | utils/player_draft_retriever.py | utils/player_draft_retriever.py | Python | 0 | @@ -0,0 +1,1467 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport re%0A%0Aimport requests%0Afrom lxml import html%0A%0Afrom db.team import Team%0Afrom db.player_draft import PlayerDraft%0A%0Aclass PlayerDraftRetriever():%0A%0A NHL_PLAYER_DRAFT_PREFIX = %22https://www.nhl.com/player%22%0A DRAFT_INFO_... | |
a5e18330ac84a93b9a3ffe7d8493c401d3ade11e | Create version.py | nilmtk/version.py | nilmtk/version.py | Python | 0.000001 | @@ -0,0 +1,18 @@
+version = '0.1.0'%0A
| |
776350aaaed8a8e3f00a492c1a1735c24f595d89 | add config_dialog.py | dialogs/config_dialog.py | dialogs/config_dialog.py | Python | 0.000003 | @@ -0,0 +1,1994 @@
+#-*- coding: utf-8 -*-%0Afrom win32ui import IDD_SET_TABSTOPS%0Afrom win32ui import IDC_EDIT_TABS%0Afrom win32ui import IDC_PROMPT_TABS%0Afrom win32con import IDOK%0Afrom win32con import IDCANCEL%0A%0Aimport win32ui%0Aimport win32con%0A%0Afrom pywin.mfc import dialog%0A%0AIDC_EDIT_USERNAME = 2000%0A... | |
42faf76ffe421802e628dd2a79f518765d43284b | Create recordsCheck.py | recordsCheck.py | recordsCheck.py | Python | 0 | @@ -0,0 +1,2282 @@
+import tensorflow as tf%0Aimport glob as glob%0Aimport getopt%0Aimport sys%0Aimport cPickle as pkl%0Aimport numpy as np%0Aimport time%0A%0Aopts, _ = getopt.getopt(sys.argv%5B1:%5D,%22%22,%5B%22input_dir=%22, %22input_file=%22, %22output_file=%22%5D)%0Ainput_dir = %22/data/video_level_feat_v3/%22%0Ai... | |
f4bd76b7ebe376a2a0cea0ac1a44be4d741ce5c5 | Create LeetCode-541.py | LeetCode-541.py | LeetCode-541.py | Python | 0 | @@ -0,0 +1,490 @@
+import math%0A%0Aclass Solution(object):%0A def ReverseStr(self, str, k):%0A ans=''%0A n = int (math.ceil(len(str) / (2.0*k) ))%0A for i in range(n):%0A ans += str%5B2*i*k:(2*i+1)*k%5D%5B::-1%5D #reverse k str%0A print '1',ans%0A ans += str%5B(... | |
ed1dd068e41138f1f3b18b028e20e542965d2c7f | add word_dictionary.py task from week7 | Algo-1/week7/1-Word-Dictionary/word_dictionary.py | Algo-1/week7/1-Word-Dictionary/word_dictionary.py | Python | 0.999988 | @@ -0,0 +1,2362 @@
+class WordDictionary:%0A%0A class Node:%0A%0A def __init__(self, char):%0A # char is a substring of the phone number%0A self.char = char%0A # 10 digits%0A self.children_nodes = %5BNone for i in range(26)%5D%0A self.isTerminal = False%0... | |
a71b50f4b6a3bc1e760e3796f8c14f6c3e865a34 | replace identity translators with None | modularodm/translators/__init__.py | modularodm/translators/__init__.py | from dateutil import parser as dateparser
from bson import ObjectId
class DefaultTranslator(object):
null_value = None
def to_default(self, value):
return value
def from_default(self, value):
return value
def to_ObjectId(self, value):
return str(value)
def from_ObjectId... | Python | 0.999999 | @@ -119,28 +119,24 @@
= None%0A%0A
-def
to_default(s
@@ -137,100 +137,81 @@
ault
-(self, value):%0A return value%0A%0A def from_default(self, value):%0A return value
+ = None%0A from_default = None%0A%0Aclass JSONTranslator(DefaultTranslator):
%0A%0A
@@ -219,24 +219,24 @@
def to_
-Objec... |
bb785321cbb9d372f2009a4577404ae75fbd889a | exclude TestApp from cppcheck script | Scripts/cppcheck/cppcheck.py | Scripts/cppcheck/cppcheck.py | # run from root sources directory: python Scripts/cppcheck/cppcheck.py
import os
ignoredEndings = ["is never used", "It is safe to deallocate a NULL pointer", "Throwing exception in destructor"]
ignoredContent = ["MyGUI_UString"]
def isIgnoredWarning(warning):
for ignore in ignoredEndings:
if warning.endswith(igno... | Python | 0.000001 | @@ -1027,16 +1027,27 @@
nitTests
+/UnitTest_*
')%0Acheck
|
bc34d530f4a21b5f06228d626f446c617b9c8876 | Add example that mirrors defconfig and oldconfig. | examples/defconfig_oldconfig.py | examples/defconfig_oldconfig.py | Python | 0 | @@ -0,0 +1,838 @@
+# Produces exactly the same output as the following script:%0A#%0A# make defconfig%0A# echo CONFIG_ETHERNET=n %3E%3E .config%0A# make oldconfig%0A# echo CONFIG_ETHERNET=y %3E%3E .config%0A# yes n %7C make oldconfig%0A#%0A# This came up in https://github.com/ulfalizer/Kconfiglib/issues/15.%0A%0Aimport... | |
7c270e2fb5e3169f179e045cc58fdd4d58672859 | add fixCAs.py to master | fixCAs.py | fixCAs.py | Python | 0 | @@ -0,0 +1,405 @@
+import sys%0Afrom valuenetwork.valueaccounting.models import *%0A%0Aagents = EconomicAgent.objects.all()%0A%0A#import pdb; pdb.set_trace()%0A%0Acount = 0%0Afor agent in agents:%0A agent.is_context = agent.agent_type.is_context%0A try:%0A agent.save()%0A count = count + 1%0A exc... | |
38f90c31f6a0f4459a8ba2f96205d80588b384c5 | Add CollectDict (incomplete dicts) | calvin/actorstore/systemactors/json/CollectDict.py | calvin/actorstore/systemactors/json/CollectDict.py | Python | 0 | @@ -0,0 +1,1500 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2017 Ericsson AB%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... | |
625139f9d3e5c06f4e5b355eaa070389f9a81954 | Add utils module | website/addons/dropbox/utils.py | website/addons/dropbox/utils.py | Python | 0.000001 | @@ -0,0 +1,1041 @@
+# -*- coding: utf-8 -*-%0Aimport os%0Afrom website.project.utils import get_cache_content%0A%0Afrom website.addons.dropbox.client import get_node_addon_client%0A%0A%0Adef get_file_name(path):%0A return os.path.split(path.strip('/'))%5B1%5D%0A%0A%0A# TODO(sloria): TEST ME%0Adef render_dropbox_file... | |
821a3826110ecfc64ab431b7028af3aae8aa80db | Add 20150522 question. | LeetCode/house_robbers.py | LeetCode/house_robbers.py | Python | 0.000001 | @@ -0,0 +1,853 @@
+%22%22%22%0AYou are a professional robber planning to rob houses along a street. Each house%0Ahas a certain amount of money stashed, the only constraint stopping you from%0Arobbing each of them is that adjacent houses have security system connected and%0Ait will automatically contact the police if tw... | |
06cd9e8e5006d68d7656b7f147442e54aaf9d7a1 | Add female Public Health College and Club | clubs/migrations/0035_add_public_health_college.py | clubs/migrations/0035_add_public_health_college.py | Python | 0 | @@ -0,0 +1,1996 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0Adef add_college(apps, schema_editor):%0A Club = apps.get_model('clubs', 'Club')%0A College = apps.get_model('clubs', 'College')%0A StudentClubYear = apps.get_model('core', 'S... | |
f4357343df1d13f5828c233e84d14586a1f786d0 | add functools03.py | trypython/stdlib/functools03.py | trypython/stdlib/functools03.py | Python | 0.000009 | @@ -0,0 +1,1003 @@
+# coding: utf-8%0A%22%22%22%0Afunctools%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%0Asingledispatch%E9%96%A2%E6%95%B0%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99.%0A%22%22%22%0Aimport functools%0Aimport html... | |
17cdae7f50a7ed15c4e8a84cdb0000a32f824c5f | Add an oauth example script. | examples/outh/getaccesstoken.py | examples/outh/getaccesstoken.py | Python | 0 | @@ -0,0 +1,751 @@
+import webbrowser%0A%0Aimport tweepy%0A%0A%22%22%22%0A Query the user for their consumer key/secret%0A then attempt to fetch a valid access token.%0A%22%22%22%0A%0Aif __name__ == %22__main__%22:%0A%0A consumer_key = raw_input('Consumer key: ').strip()%0A consumer_secret = raw_input('Consu... | |
c4e8e6d73e70e568d4c4386d7c1bab07ade2b8f0 | use DFS instead of BFS to do checking, it's simpler and results in more obvious message ordering | tc/checker.py | tc/checker.py | import logging
from django.template import loader, base, loader_tags, defaulttags
class TemplateChecker(object):
registered_rules = []
def __init__(self):
self.warnings = []
self.errors = []
def check_template(self, path):
"""
Checks the given template for badness... | Python | 0 | @@ -606,21 +606,19 @@
#
-bread
+dep
th-first
@@ -748,35 +748,32 @@
emplate.nodelist
-%5B:%5D
%0A %0A
@@ -778,79 +778,109 @@
-# set parent
+self._recursive_check(
nodes,
-so
+%5B%5D,
rules
- can traverse up the hierarchy if they want
+)%0A %0A def _recursive_check(self, nodes, an... |
3898bec1a5470c79f93e7c69f6700a4af1801670 | Create love6.py | Python/CodingBat/love6.py | Python/CodingBat/love6.py | Python | 0 | @@ -0,0 +1,121 @@
+# http://codingbat.com/prob/p100958%0A%0Adef love6(a, b):%0A return ( (a == 6) or (b == 6) or (a+b == 6) or (abs(a-b) == 6) )%0A
| |
d27a9e09659a8d990b7b07963fb72fe2d25572c2 | test. nothing important | shutdowntimer.py | shutdowntimer.py | Python | 0.999986 | @@ -0,0 +1,704 @@
+#!/usr/bin/python3%0A%0A# use python 3.x%0A# simple shutdown timer script for windows%0A%0A%0Aimport os%0A%0Aprint(%22-----SHUTDOWN TIMER-----%22)%0A%0Awhile(True):%0A%09a = input(%22Press S to schedule shutdown.%5CnPress C to cancel shutdown.%5Cn%22)%0A%09if(a == 's' or a == 'S'):%0A%0A%09%09try:%0A... | |
be095fdb2163575803020cefcfa0d86cff1d990f | Create new package (#6453) | var/spack/repos/builtin/packages/r-lars/package.py | var/spack/repos/builtin/packages/r-lars/package.py | Python | 0 | @@ -0,0 +1,1814 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
4acf6d76bf7ec982573331835f7bcddd8487b18b | Add package for unison | var/spack/repos/builtin/packages/unison/package.py | var/spack/repos/builtin/packages/unison/package.py | Python | 0 | @@ -0,0 +1,2129 @@
+##############################################################################%0A# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
77d3756d27758276c084cf20693202cfa645df3e | Add fptool.py that will replace flash_fp_mcu | util/fptool.py | util/fptool.py | Python | 0.999999 | @@ -0,0 +1,1647 @@
+#!/usr/bin/env python3%0A# Copyright 2021 The Chromium OS 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.%0A%0A%22%22%22A tool to manage the fingerprint system on Chrome OS.%22%22%22%0A%0Aimport argparse%0Aimport... | |
bc32b2bccc82caecea0cf936e13c3ae70d0e9486 | Add script to remove broken images. | utils/check.py | utils/check.py | Python | 0 | @@ -0,0 +1,892 @@
+from pathlib import Path%0Afrom PIL import Image%0Afrom concurrent.futures import ProcessPoolExecutor%0Aimport os%0Aimport sys%0A%0Adef verify_or_delete(filename):%0A try:%0A Image.open(filename).load()%0A except OSError:%0A return False%0A return True%0A%0A%0Aif __name__ == '_... | |
388bbd915a5e40a2e096eb22ab294ffcbd3db936 | Add a gmm, currently wrapping sklearn | bananas/model.py | bananas/model.py | Python | 0 | @@ -0,0 +1,2188 @@
+import numpy%0A# FIXME: copy the functions here%0A%0Afrom sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp%0A%0Aclass GMM(object):%0A def __init__(self, weights, means, covs):%0A self.weights = numpy.array(weights)%0A self.means = numpy.array(means)%0A se... | |
b182e2334d3f5ffb38a0336f8c4fa91cbdfeea93 | fix prefix (#5749) | var/spack/repos/builtin/packages/gettext/package.py | var/spack/repos/builtin/packages/gettext/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0.000045 | @@ -3154,16 +3154,21 @@
text' %25
+self.
prefix.s
|
b1bea70df1f62e4c0447a406b77266b804eec5df | add new Package (#15894) | var/spack/repos/builtin/packages/nanomsg/package.py | var/spack/repos/builtin/packages/nanomsg/package.py | Python | 0 | @@ -0,0 +1,665 @@
+# Copyright 2013-2020 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 Nanomsg(CMakePackage):%0A %22%22%22The nanomsg library i... | |
f069a3feda43ebc436e404dad66dfaa06055e35a | Add h5sh python package (#14001) | var/spack/repos/builtin/packages/py-h5sh/package.py | var/spack/repos/builtin/packages/py-h5sh/package.py | Python | 0 | @@ -0,0 +1,900 @@
+# 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 PyH5sh(PythonPackage):%0A %22%22%22Shell-like environmen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.