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 |
|---|---|---|---|---|---|---|---|
a37007e03747395c12cc4bc34c761aa3253f7599 | Add tests folder | tests/__init__.py | tests/__init__.py | Python | 0.000001 | @@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-%0A
| |
c02a2ac7dc882b68f061f2caff1b4c1d91fce471 | Make Postgres the default test adapter (refs GH-2862) | src/sentry/utils/pytest.py | src/sentry/utils/pytest.py | from __future__ import absolute_import
import mock
import os
from django.conf import settings
def pytest_configure(config):
# HACK: Only needed for testing!
os.environ.setdefault('_SENTRY_SKIP_CONFIGURATION', '1')
os.environ.setdefault('RECAPTCHA_TESTING', 'True')
os.environ.setdefault('DJANGO_SETT... | Python | 0 | @@ -478,22 +478,24 @@
('DB', '
-sqlite
+postgres
')%0A
|
d046bc3be27c39ca70a45d92939a2aa2444f3195 | test examples | test/examples/test_examples.py | test/examples/test_examples.py | Python | 0 | @@ -0,0 +1,1750 @@
+%22%22%22%0ARuns all example scripts. Only tests whether examples can be executed.%0A%22%22%22%0Aimport pytest%0Aimport os%0Aimport subprocess%0Aimport glob%0Aimport sys%0A%0A# set environment flag%0A# can be used in examples to reduce cpu cost%0Aos.environ%5B'THETIS_REGRESSION_TEST'%5D = %221%22%0A... | |
b872aaa2837e7cd72c36f2b3fd7679106fda57b4 | Add test cli | tests/test_cli.py | tests/test_cli.py | Python | 0 | @@ -0,0 +1,645 @@
+import unittest%0Aimport sys, os%0Aimport cli%0Afrom io import StringIO%0Aio = StringIO()%0A%0A%0Aclass TestBuildInCommands(unittest.TestCase):%0A%0A def setUp(self):%0A pass%0A def tearDown(self):%0A pass%0A%0A def test_normal(self):%0A sys.stdout = io%0A # $ iro... | |
3d7bb0dfcbfda9c99ee2372394959667c76bb83f | Add first .py file to project | main.py | main.py | Python | 0 | @@ -0,0 +1,16 @@
+%0Aprint(%22Hello!%22)
| |
59a57a25ff925bd1ce6d467d316ec478847b58ad | Create combinations.py | combinations.py | combinations.py | Python | 0 | @@ -0,0 +1,595 @@
+#!/usr/bin/env python%0A%0Afrom string import uppercase, lowercase, maketrans%0Aimport math, sys%0A%0A%0Aclass combinations():%0A%0A def combs(self, total, choice):%0A return (math.factorial(total)/(math.factorial(choice)*math.factorial(total-choice)))%0A %0A%0Aif __name__ == '__main_... | |
2c63d77428b84c7d1be1c861079d39d641d51fcf | add script to scrap stock data and save them locally | stock_scraping/stock_price_scraping_to_local.py | stock_scraping/stock_price_scraping_to_local.py | Python | 0 | @@ -0,0 +1,2169 @@
+'''%0AThis script helps you scrap stock data avaliable on Bloomberg Finance%0Aand store them locally.%0A%0APlease obey applicable local and federal laws and applicable API term of use%0Awhen using this scripts. I, the creater of this script, will not be responsible%0Afor any legal issues resulting f... | |
ba06683866ce8e4e3bccd4acebd6ec2278acfeaa | Add Litecoin testnet, and Litecoin BIP32 prefixes. | pycoin/networks.py | pycoin/networks.py | from collections import namedtuple
from .serialize import h2b
NetworkValues = namedtuple('NetworkValues',
('network_name', 'subnet_name', 'code', 'wif', 'address',
'pay_to_script', 'prv32', 'pub32'))
NETWORKS = (
NetworkValues("Bitcoin", "mainnet", "BTC", b'... | Python | 0 | @@ -569,26 +569,155 @@
, None,
-None, None
+h2b('019d9cfe'), h2b('019da462')),%0A NetworkValues(%22Litecoin%22, %22testnet%22, %22XLT%22, b'%5Cxb1', b'%5Cx31', None, h2b('0436ef7d'), h2b('0436f6e1')
),%0A N
@@ -1025,16 +1025,17 @@
%22)),%0A)%0A%0A
+%0A
# Map fr
|
1de668219f618a0632fac80fd892a0a229b8fa05 | Solve Code Fights addition without carrying problem | CodeFights/additionWithoutCarrying.py | CodeFights/additionWithoutCarrying.py | Python | 0.000002 | @@ -0,0 +1,1013 @@
+#!/usr/local/bin/python%0A# Code Fights Addition Without Carrying Problem%0A%0A%0Adef additionWithoutCarrying(param1, param2):%0A s1, s2 = str(param1), str(param2)%0A shorter = s1 if len(s1) %3C len(s2) else s2%0A longer = s2 if shorter == s1 else s1%0A if len(shorter) %3C len(longer):%0... | |
2620ca08397258ec207a52fe186d28d4ce7e9bd4 | fix for Python2.6 | python/qisys/ui.py | python/qisys/ui.py | ## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
# Colorized output to console code inspired by
# pygments (http://pygments.org/) BSD License.
""" Tools for a nice user interface
"""
import sys
imp... | Python | 0 | @@ -4738,23 +4738,15 @@
ime.
-total_
seconds
-()
%0A
|
ed5c27623711a7f3b798aed9c0f7cdbdcebc0dcd | test python interpreter | test/test_interpreter_layer.py | test/test_interpreter_layer.py | Python | 0.00001 | @@ -0,0 +1,422 @@
+# This code is so you can run the samples without installing the package%0Aimport sys%0Aimport os%0Asys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))%0A#%0A%0A%0Aimport cocos%0Afrom cocos.director import director%0Aimport pyglet%0A %0A%0Aif __name__ == %22__main__%22:%0A dir... | |
7f4bd900d1e647fe017ce4c01e279dd41a71a349 | Add management command to set SoftwareSecure verification status. | lms/djangoapps/verify_student/management/commands/set_software_secure_status.py | lms/djangoapps/verify_student/management/commands/set_software_secure_status.py | Python | 0 | @@ -0,0 +1,2193 @@
+%22%22%22%0AManually set Software Secure verification status.%0A%22%22%22%0A%0Aimport sys%0A%0Afrom django.core.management.base import BaseCommand%0Afrom verify_student.models import (%0A SoftwareSecurePhotoVerification, VerificationCheckpoint, VerificationStatus%0A)%0A%0A%0Aclass Command(BaseCom... | |
4dd66150c922e1c700fad74727955ef72c045f37 | Add Find Command MCEdit filter | minecraft/FindCommand.py | minecraft/FindCommand.py | Python | 0 | @@ -0,0 +1,738 @@
+# MCEdit filter%0A%0Afrom albow import alert%0A%0AdisplayName = %22Find Command%22%0A%0Ainputs = (%0A (%22Command:%22, (%22string%22, %22value=%22)),%0A)%0A%0Adef perform(level, box, options):%0A command = options%5B%22Command:%22%5D%0A n = 0%0A result = %22%22%0A for (chunk, slices, p... | |
5e4ef4737c78b6154596ab8c76c4e60bd840453c | Add component.navbar | src/penn_chime_dash/app/components/navbar.py | src/penn_chime_dash/app/components/navbar.py | Python | 0 | @@ -0,0 +1,1274 @@
+# components/navbar.py%0Aimport dash_bootstrap_components as dbc%0Aimport dash_html_components as html%0Aimport dash_core_components as dcc%0Afrom ..config import Config%0A%0Acfg = Config()%0A%0Anavbar = dbc.NavbarSimple(%0A brand='Penn Med CHIME', # Browser window title%0A brand_href='/', ... | |
eea33e6207da7446e1713eb4d78b76d37ae5eaf2 | Add sample of scheduler using celery | with_celery.py | with_celery.py | Python | 0 | @@ -0,0 +1,285 @@
+from celery import Celery%0A%0A# The host in which RabbitMQ is running%0AHOST = 'amqp://guest@localhost'%0A%0Aapp = Celery('pages_celery', broker=HOST)%0A%0A@app.task%0Adef work(msg):%0A print msg%0A%0A# To execute the task:%0A#%0A# $ python%0A# %3E%3E%3E from with_celery import work%0A# %3E%3E%3E... | |
7ca1f6c5d51f5e2fc582603012c3ca5a053ee4eb | Add BLT package (#19410) | var/spack/repos/builtin/packages/blt/package.py | var/spack/repos/builtin/packages/blt/package.py | Python | 0 | @@ -0,0 +1,1262 @@
+# 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 Blt(Package):%0A %22%22%22BLT is a streamlined CMake-ba... | |
4537ab84bb87eeae6b6865b7b9140d5324384e4a | add test cases for address operations | test/test-rpc/TestCase/Account/test_address.py | test/test-rpc/TestCase/Account/test_address.py | Python | 0 | @@ -0,0 +1,1337 @@
+import random%0Afrom TestCase.MVSTestCase import *%0A%0Aclass TestAccount(MVSTestCaseBase):%0A roles = (Alice,)%0A need_mine = False%0A%0A def test_0_new_address(self):%0A #password error%0A ec, message = mvs_rpc.new_address(Alice.name, Alice.password+'1')%0A self.asser... | |
83cdd840979dc452f444914a0c40d077e6917c38 | Add DB connector class. | DBConnection.py | DBConnection.py | Python | 0 | @@ -0,0 +1,21 @@
+__author__ = 'David'%0A
| |
4ff0e6a4d190d8c1f60903d18dcdaac1edeace8a | Create test.py | test.py | test.py | Python | 0.000005 | @@ -0,0 +1,294 @@
+import unittest%0Afrom mock import patch%0Aimport RedDefineBot%0A%0Aclass TestBot(unittest.TestCase):%0A def test_auth_called(self,mock):%0A self.assertTrue(mock.called)%0A def test_auth_notcalled(self,mock):%0A self.assertFalse(mock.called)%0A%0Aif __name__ == '__main__':%0A u... | |
00b04f773b9e2018b08776c5d53ff3dad7ed00d1 | Create test.py | test.py | test.py | Python | 0.000005 | @@ -0,0 +1,36 @@
+%22%22%22test.py%0A%22%22%22%0A%0Aprint %22Hello world%22%0A
| |
b4b2b80cb1d0c0729e8e98085c2cfc3bc55ddda3 | Solve the Longest Lines challenge using Python3 | LongestLines.py | LongestLines.py | Python | 0.999972 | @@ -0,0 +1,579 @@
+# Longest Lines%0A#%0A# https://www.codeeval.com/open_challenges/2/%0A#%0A# Challenge Description: Write a program which reads a file and prints to %0A# stdout the specified number of the longest lines that are sorted based on %0A# their length in descending order.%0Aimport sys%0A%0A%0Ainput_file = s... | |
37e674f05547c7b6b93f447477443644865975d1 | Bring back the Root URL config | urls.py | urls.py | Python | 0 | @@ -0,0 +1,909 @@
+__author__ = 'ankesh'%0Afrom django.conf.urls import patterns, include, url%0Afrom django.http import HttpResponseRedirect%0A%0A# Uncomment the next two lines to enable the admin:%0Afrom django.contrib import admin%0Aadmin.autodiscover()%0A%0Aurlpatterns = patterns('',%0A # Examples:%0A # url(r... | |
b733f433d797b302c46cb71cf0230b986f630d26 | Create w3_1.py | w3_1.py | w3_1.py | Python | 0.000482 | @@ -0,0 +1,15 @@
+print(%22%E4%BD%A0%E6%95%99%E5%BE%97%E7%9C%9F%E5%A5%BD%22)%0A
| |
d23461fb7b81f70c919fb028eb22009deaae13da | Generate posterior information | main.py | main.py | import math
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def generate_sample(mean, cov_matrix):
'''generate_sample: Generate sample function output from a mean and covariance matrix.'''
cholesky_decomp = tf.cholesky(cov_matrix)
cov_shape = tf.shape(cov_matrix)
result_shape... | Python | 1 | @@ -529,16 +529,1238 @@
ution)%0A%0A
+def solve_posterior(x_data, y_data, cov_matrix, sigma, test_data):%0A '''solve_posterior: Generate the mean, variance and log marginal likelihood from%0A sample data.'''%0A cholesky_decomp = tf.cholesky(cov_matrix + math.pow(sigma, 2)*tf.eye(tf.shape(cov_matrix)%5B0%5D, d... |
73afce309f0e73b441c0ade49849397cba0fb0c2 | update spec runner to work with invoke's boolean flags to run specs untranslated | tasks/specs.py | tasks/specs.py | from invoke import task, run as run_
from .base import BaseTest
class Rubyspecs(BaseTest):
def __init__(self, files, options, translated=True):
super(Rubyspecs, self).__init__()
self.exe = "`pwd`/bin/%s" % ("topaz" if translated else "topaz_untranslated.py")
self.files = files
sel... | Python | 0 | @@ -118,32 +118,34 @@
files, options,
+un
translated=True)
@@ -131,35 +131,36 @@
s, untranslated=
-Tru
+Fals
e):%0A supe
@@ -236,13 +236,31 @@
opaz
+_untranslated.py
%22 if
+un
tran
@@ -277,32 +277,16 @@
e %22topaz
-_untranslated.py
%22)%0A
@@ -863,16 +863,18 @@
ons=%22%22,
+un
translat
@@ -88... |
90399f50a3f50d9193ae1e6b2042215fb388230f | Create Video Stream program for webcam | VideoStream.py | VideoStream.py | Python | 0 | @@ -0,0 +1,428 @@
+import cv2%0D%0Aimport numpy as np%0D%0A%0D%0Acap = cv2.VideoCapture(0)%0D%0A%0D%0Aprint('Beginning Capture Device opening...%5Cn')%0D%0Aprint('Capture device opened?', cap.isOpened())%0D%0A%0D%0Awhile True:%0D%0A%0D%0A ret, frame = cap.read()%0D%0A gray_image = cv2.cvtColor(frame, cv2.COLOR_BG... | |
1437bb868844731d3fdb13c6dd52dfd706df6f63 | Add a new script to clean up a habitica user given user email | bin/ext_service/clean_habitica_user.py | bin/ext_service/clean_habitica_user.py | Python | 0 | @@ -0,0 +1,942 @@
+import argparse%0Aimport sys%0Aimport logging%0A%0Aimport emission.core.get_database as edb%0Aimport emission.net.ext_service.habitica.proxy as proxy%0A%0Aif __name__ == '__main__':%0A logging.basicConfig(level=logging.DEBUG)%0A%0A parser = argparse.ArgumentParser()%0A parser.add_argument(%2... | |
a9dd25c825bacd03ae358cc153c94ce3960ec0cf | Add serializers | chipy_org/apps/meetings/serializers.py | chipy_org/apps/meetings/serializers.py | Python | 0.000005 | @@ -0,0 +1,814 @@
+from rest_framework import serializers%0A%0Afrom .models import Meeting, Topic, Presentor%0A%0A%0Aclass PresentorSerializer(serializers.ModelSerializer):%0A class Meta:%0A model = Presentor%0A fields = ('name', 'release')%0A%0A%0Aclass TopicSerializer(serializers.ModelSerializer):%0A... | |
55185a7a7402c9d0ce2677b00a329aa4197556c3 | add mediator | Mediator.py | Mediator.py | Python | 0.001741 | @@ -0,0 +1,1822 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0AMediator pattern%0A%22%22%22%0A%0A%0Aclass AbstractColleague(object):%0A %22%22%22%0A AbstractColleague%0A %22%22%22%0A%0A def __init__(self, mediator):%0A self.mediator = mediator%0A%0A%0Aclass ConcreteColleague(AbstractColleague):%0A %... | |
290f990e31a5f732fb054846caea9346946778df | enable import as module | __init__.py | __init__.py | Python | 0.000001 | @@ -0,0 +1,218 @@
+%22%22%22%0A.. module:: lmtscripts%0A :platform: Unix%0A :synopsis: useful scripts for EHT observations at LMT%0A%0A.. moduleauthor:: Lindy Blackburn %3Clindylam@gmail.com%3E%0A.. moduleauthor:: Katie Bouman %3Cklbouman@gmail.com%3E%0A%0A%22%22%22%0A
| |
19a4c4364d1629cd6bfd7ca27ae4e6441f13747e | Make mygmm a module | __init__.py | __init__.py | Python | 0.000018 | @@ -0,0 +1,26 @@
+from .mygmm.mygmm import *
| |
a7f4d96becfd1a58794a4dbedb9e9c8f6ac8c1a6 | Create acceptor.py | acceptor.py | acceptor.py | Python | 0.000001 | @@ -0,0 +1,818 @@
+#! /usr/bin/env python%0A%0Aimport message%0A%0Aimport logging%0A%0Aclass Acceptor(message.MessageListener):%0A def __init__(self, config, network):%0A message.MessageListener.__init__(self, %0A name = 'AcceptorListenser',%0A mapping = %7B %0A message.MS... | |
5bb387947ac13bcd3949c6b17839033231c05e2d | Add unittests for cupy.testing.array | tests/cupy_tests/testing_tests/test_array.py | tests/cupy_tests/testing_tests/test_array.py | Python | 0.000001 | @@ -0,0 +1,2670 @@
+import copy%0Aimport unittest%0A%0Aimport numpy%0Aimport six%0A%0Aimport cupy%0Afrom cupy import testing%0A%0A%0A@testing.parameterize(%0A *testing.product(%7B%0A 'assertion': %5B'assert_allclose', 'assert_array_almost_equal',%0A 'assert_array_almost_equal_nulp',%0A ... | |
dafa89d52bff2bef6768160af306ab40173e8a8e | Replace get_user_profile_by_email with example_user. | zerver/tests/test_outgoing_webhook_system.py | zerver/tests/test_outgoing_webhook_system.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import mock
from typing import Any, Union, Mapping, Callable
from zerver.lib.test_helpers import get_user_profile_by_email
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import (
get_realm_b... | Python | 0 | @@ -161,70 +161,8 @@
le%0A%0A
-from zerver.lib.test_helpers import get_user_profile_by_email%0A
from
@@ -4199,52 +4199,34 @@
e =
-get_user_profile_by_email(%22othello@zulip.com
+self.example_user(%22othello
%22)%0A
|
6891c9e635cbe9ba663ac7f72bdff653bb8c8220 | make sure we can call commit | netforce_general/netforce_general/controllers/root.py | netforce_general/netforce_general/controllers/root.py | # Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | Python | 0 | @@ -1992,16 +1992,39 @@
inally:%0A
+ if db:%0A
|
21d7e6f83f34e66167d7452998f2c7622a90e46c | Create test_parser.py | test_parser.py | test_parser.py | Python | 0.000008 | @@ -0,0 +1,1173 @@
+import os%0Aimport csv%0Aimport json%0Aimport collections%0Afrom collections import defaultdict%0A%0Afilename = %22C:/Users/zeffi/Documents/Export_482016.csv%22%0Asome_dict = defaultdict(list)%0A%0Adef sanedate(date):%0A MM, DD, YYYY = date.split('/')%0A return '/'.join(%5BDD, MM, YYYY%5D)%0A%... | |
0c49c3dcd168e01512deb72bfbeed1438430abe4 | remove duplicate error messages before displaying, issue 486 | src/robotide/context/logger.py | src/robotide/context/logger.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | Python | 0 | @@ -975,16 +975,180 @@
errors:%0A
+ # Warnings from robot.variables.Variables.set_from_variable_table%0A # are present multiple times, issue 486.%0A errors = set(errors)%0A
|
fabf4e8bd93155101d459716b35c10b32a3dfd16 | add tests/utils.py | tests/utils.py | tests/utils.py | Python | 0.000001 | @@ -0,0 +1,1613 @@
+import sys%0D%0Aimport yappi%0D%0Aimport unittest%0D%0A%0D%0Aclass YappiUnitTestCase(unittest.TestCase):%0D%0A def setUp(self):%0D%0A if yappi.is_running():%0D%0A yappi.stop()%0D%0A yappi.clear_stats()%0D%0A yappi.set_clock_type('cpu') # reset to default clock type... | |
21a9ca4487d0d3ef9f2aa2ba5909b37c735c18e6 | Fix linter errors in test_tftrt.py | tensorflow/contrib/tensorrt/test/test_tftrt.py | tensorflow/contrib/tensorrt/test/test_tftrt.py | # Copyright 2018 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.000027 | @@ -839,16 +839,35 @@
nction%0A%0A
+import numpy as np%0A
import t
@@ -924,35 +924,16 @@
as trt%0A
-import numpy as np%0A
%0A%0Adef ge
@@ -929,36 +929,39 @@
rt%0A%0A%0Adef get
-S
+_s
imple
-G
+_g
raph
-D
+_d
ef():%0A %22%22%22C
@@ -1053,17 +1053,17 @@
():%0A
-A
+a
= tf.pl
@@ -1309,17 +1309,17 @@
inp... |
8cd02f550634ea7ae5f75531a49986e099ddf957 | Fix Markdown syntax of bulleted list. | tensorflow/python/ops/distributions/uniform.py | tensorflow/python/ops/distributions/uniform.py | # Copyright 2016 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 | @@ -1623,13 +1623,13 @@
here
-:%0A *
+%0A%0A -
%60lo
@@ -1638,17 +1638,17 @@
= a%60,%0A
-*
+-
%60high =
@@ -1654,17 +1654,17 @@
= b%60,%0A
-*
+-
%60Z%60 is
@@ -1696,13 +1696,12 @@
and
-,
%0A
-*
+-
%60I%5B
|
a333a5c15ffd2b775ad4d854c7accd32b898d2fb | Add encryptor_python3.py compatible with Python 3 | encryptor_python3.py | encryptor_python3.py | Python | 0.000669 | @@ -0,0 +1,346 @@
+from __future__ import print_function%0A%0A__author__ = 'Samuel Gratzl'%0A%0Aif __name__ == '__main__':%0A import uuid%0A import hashlib%0A%0A password = input('enter password: ').encode('utf-8')%0A salt = uuid.uuid4().hex.encode('utf-8')%0A hashed_password = hashlib.sha512(password + salt).hexd... | |
a7b25e343623f41b0466c8cea852ecc07ffab359 | Create marsLanderLevelTwo.py | Codingame/Python/Medium/marsLanderLevelTwo.py | Codingame/Python/Medium/marsLanderLevelTwo.py | Python | 0.000045 | @@ -0,0 +1,1933 @@
+import sys%0Aimport math%0A%0A# Auto-generated code below aims at helping you parse%0A# the standard input according to the problem statement.%0A%0Asurface_n = int(input()) # the number of points used to draw the surface of Mars.%0Asurface = %5B%5D%0Afor i in range(surface_n):%0A # land_x: X coo... | |
ac2f517f15816277dd808ac473c4581212b8e841 | add migration for meta | Seeder/www/migrations/0004_auto_20170223_1457.py | Seeder/www/migrations/0004_auto_20170223_1457.py | Python | 0 | @@ -0,0 +1,493 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.4 on 2017-02-23 14:57%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('www', '0003_auto_20170216_2204'),%0A %5D%0A%0A operat... | |
0a8af4a4f5e9fa711e9e4b1b14cc639d5ff166a0 | Create beta_dog_recommendation_system.py | Solutions/beta/beta_dog_recommendation_system.py | Solutions/beta/beta_dog_recommendation_system.py | Python | 0.000007 | @@ -0,0 +1,428 @@
+from itertools import takewhile%0A%0Adef find_similar_dogs(breed):%0A compare = dogs%5Bbreed%5D%0A scores = sorted((%0A %5B%0A dog,%0A sum(1 if q in compare else 0 for q in dogs%5Bdog%5D)%0A %5D%0A for dog in dogs if dog != bre... | |
8a293ddc633730a6c2323392b1ac9083e5a45ad4 | Create lora_test_recv.py | device/src/test/lora_test_recv.py | device/src/test/lora_test_recv.py | Python | 0.000002 | @@ -0,0 +1,1156 @@
+# lora_test_recv.py%0A#Communication module: LoRa.%0A#Communication method with gateway via LoRa.%0A#Uart port drive LoRa module.%0A#Parse JSON between device and gateway via LoRa channel.%0A#LoRa module: E32-TTL-100%0A#Pin specification:%0A#Module MCU%0A#M0(IN) %3C--%3E GPIO(X3)(OUT) ... | |
d19a36fda0bfc9d221d65bde1612ff6181fca66d | add proposed setup.py file | setup.py | setup.py | Python | 0 | @@ -0,0 +1,299 @@
+from distutils.core import setup%0A%0Asetup(%0A name='vectortween',%0A version='0.0.1',%0A packages=%5B'vectortween'%5D,%0A url='',%0A license='MIT',%0A author='stefaan himpe',%0A author_email='stefaan.himpe@gmail.com',%0A description='some tweening for use with libraries like... | |
581c21af4248429dfbdd507ffe072d6620f3b115 | Version bump. | setup.py | setup.py |
from setuptools import setup, find_packages
setup(
name="filebrowser_safe",
version="0.1.2",
description="A snapshot of the filebrowser_3 branch of django-filebrowser, "
"packaged as a dependency for the Mezzanine CMS for Django.",
long_description=open("README.rst").read(),
autho... | Python | 0 | @@ -97,9 +97,9 @@
0.1.
-2
+3
%22,%0A
|
a57d39e7f63e6c034644a158aabb5ff6e6f04ae9 | add response test to testing module | oct/testing/response.py | oct/testing/response.py | Python | 0 | @@ -0,0 +1,499 @@
+# This file is fit for containing basic response status check%0A# All functions have to take a response object in param%0A%0A%0Adef check_response_status(resp, status):%0A %22%22%22%0A This will check is the response_code is equal to the status%0A%0A :param resp: a response object%0A :par... | |
f37bcfdae9bfc14bacccdcba325d2b8fb1284d32 | set keystone user name to user's email address | planetstack/observer/steps/sync_user_deployments.py | planetstack/observer/steps/sync_user_deployments.py | import os
import base64
import hashlib
from collections import defaultdict
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.site import SiteDeployments, Deployment
from core.models.user import User, UserDeployments
from uti... | Python | 0.000008 | @@ -2256,20 +2256,42 @@
'name':
-name
+user_deployment.user.email
,%0A
|
2f1b12a6f173c01f9631d0ad5a4d3c3f411983cb | add file notification platform | homeassistant/components/notify/file.py | homeassistant/components/notify/file.py | Python | 0 | @@ -0,0 +1,2841 @@
+%22%22%22%0Ahomeassistant.components.notify.file%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0AFile notification service.%0A%0AConfiguration:%0A%0ATo use the File notifier you will need to add something like the following%0Ato your config/configuration.yaml%0A%0Anotify:%0A platform: file%0A path: PA... | |
64b4c8f43a501f005f60a3bf3159d29722af3d94 | Fix deprecation warning (#19882) | homeassistant/helpers/aiohttp_client.py | homeassistant/helpers/aiohttp_client.py | """Helper for aiohttp webclient stuff."""
import asyncio
import sys
import aiohttp
from aiohttp.hdrs import USER_AGENT, CONTENT_TYPE
from aiohttp import web
from aiohttp.web_exceptions import HTTPGatewayTimeout, HTTPBadGateway
import async_timeout
from homeassistant.core import callback
from homeassistant.const impor... | Python | 0 | @@ -4468,37 +4468,29 @@
nector%0A%0A
-@callback%0A
+async
def _async_
@@ -4549,32 +4549,38 @@
ool.%22%22%22%0A
+await
connector.close(
|
a9893fc562c9131fdaebaa842f587f415b7fdfda | Add second test. | oommfmif/test_basics.py | oommfmif/test_basics.py | import oommfmif as o
def test_get_oommf_version():
assert isinstance(o.get_version(), str)
| Python | 0.000007 | @@ -42,16 +42,28 @@
_version
+_return_type
():%0A
@@ -102,8 +102,82 @@
), str)%0A
+%0A%0Adef test_get_oommf_version():%0A assert o.get_version()%5B0:4%5D == %221.2.%22%0A
|
99389c1f863592c8c56c8dca415155536abbd0fd | Create new.py | simple_mqtt/new.py | simple_mqtt/new.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
0ec30eb8bcf0e7688182f827bea24fd0ceb33501 | add models | models.py | models.py | Python | 0 | @@ -0,0 +1,323 @@
+from peewee import *%0Afrom config import db%0A%0Aclass BaseModel(Model):%0A class Meta:%0A database = db%0A%0Aclass HistoricalTrainPosition(BaseModel):%0A cars = IntegerField()%0A line_code = CharField()%0A next_station = CharField()%0A dest_station = CharField()%0A time = I... | |
929dd804dbbd5935910cc434f5646da3de8a3a94 | Fix LogCounter on py26 | tornado/test/runtests.py | tornado/test/runtests.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import gc
import locale # system locale module, not tornado.locale
import logging
import operator
import textwrap
import sys
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
from torn... | Python | 0 | @@ -2204,31 +2204,103 @@
-super(LogCounter, self)
+# Can't use super() because logging.Filter is an old-style class in py26%0A logging.Filter
.__i
@@ -2305,16 +2305,22 @@
_init__(
+self,
*args, *
|
5c02d902753327b3413e994d6edc089b8ca72749 | Add create_flipper step | dbaas/workflow/steps/create_flipper.py | dbaas/workflow/steps/create_flipper.py | Python | 0.000001 | @@ -0,0 +1,1522 @@
+# -*- coding: utf-8 -*-%0Aimport logging%0Afrom base import BaseStep%0Afrom dbaas_flipper.provider import FlipperProvider%0A%0A%0ALOG = logging.getLogger(__name__)%0A%0A%0Aclass CreateFlipper(BaseStep):%0A%0A def __unicode__(self):%0A return %22Creating Flipper%22%0A%0A def do(self, wor... | |
cf99929c923cb31782a192f108c735bfcc9cde2f | Add render module, this will be the interface to manage rendering state files into high state data | salt/render.py | salt/render.py | Python | 0 | @@ -0,0 +1,340 @@
+'''%0ARender is a module used to parse the render files into high salt state data%0Astructures.%0A%0AThe render system uses render modules which are plugable interfaces under the%0Arender directory.%0A'''%0A# Import salt modules%0Aimport salt.loader%0A%0Aclass Render(object):%0A '''%0A Render s... | |
c735935c983cc7ccd72b2c71733e6f785a8a3ae3 | Create urls.py | Assessment/urls.py | Assessment/urls.py | Python | 0.000017 | @@ -0,0 +1,252 @@
+from django.conf.urls import url%0A%0Afrom . import views%0A%0Aurlpatterns = %5B%0A url(r'%5EgetAssignmentByCode', views.getAssignmentByCode, name='getAssignmentByCode'),%0A url(r'%5EretrieveAssignments', views.retrieveAssignments, name='retrieveAssignments'),%0A%0A%5D%0A
| |
83d4ac6c3565044727c9b3fcbada9966d529a80e | Add forgotten font leader lib | lib/font_loader.py | lib/font_loader.py | Python | 0 | @@ -0,0 +1,2129 @@
+import os%0Aimport sys%0Aimport logging%0A%0AFONT_FILE_NAME_LIST = (%0A %22fontawesome-webfont.ttf%22,%0A )%0A%0AFONT_DIRECTORY = %22share%22%0AFONT_DIRECTORY_SYSTEM = %22/usr/share/fonts%22%0AFONT_DIRECTORY_USER = os.path.join(os.environ%5B'HOME'%5D, %22.local/share/fonts%22)%0A%0Acla... | |
d8f7cb58e7f760ccbb839aafeda4dbf7204d7d82 | Add r_latestagecapitalism | channels/r_latestagecapitalism/app.py | channels/r_latestagecapitalism/app.py | Python | 0.999492 | @@ -0,0 +1,157 @@
+#encoding:utf-8%0A%0Asubreddit = 'latestagecapitalism'%0At_channel = '@r_latestagecapitalism'%0A%0A%0Adef send_post(submission, r2t):%0Areturn r2t.send_simple(submission)%0A
| |
151e8fc71e5ef2e31db13730bff57bc8fd915c30 | Add test case for list invoice | paystackapi/tests/test_invoice.py | paystackapi/tests/test_invoice.py | Python | 0.000001 | @@ -0,0 +1,1331 @@
+import httpretty%0A%0Afrom paystackapi.tests.base_test_case import BaseTestCase%0Afrom paystackapi.invoice import Invoice%0A%0A%0Aclass TestInvoice(BaseTestCase):%0A%0A @httpretty.activate%0A def test_create_invoice(self):%0A %22%22%22Method defined to test create Invoice.%22%22%22%0A ... | |
dcd1d962feec4f3cd914677545f74924ad9e6351 | Add test for file creation of low level library | testing/test_direct_wrapper.py | testing/test_direct_wrapper.py | Python | 0 | @@ -0,0 +1,296 @@
+import os%0A%0Afrom cffitsio._cfitsio import ffi, lib%0A%0A%0Adef test_create_file(tmpdir):%0A filename = str(tmpdir.join('test.fits'))%0A f = ffi.new('fitsfile **')%0A status = ffi.new('int *')%0A lib.fits_create_file(f, filename, status)%0A assert status%5B0%5D == 0%0A assert os.p... | |
2ccd94f9fb6f4a64976124ca82ac4c5ef585d64b | add serializer field | djbitcoin/serializers.py | djbitcoin/serializers.py | Python | 0 | @@ -0,0 +1,466 @@
+from django.utils.translation import ugettext_lazy as _%0A%0Afrom rest_framework import serializers%0A%0Afrom .utils import is_bitcoin_address_valid%0A%0A%0Aclass BitcoinAddressField(serializers.CharField):%0A default_error_messages = %7B%0A 'invalid': _('Invalid bitcoin address.')%0A %7... | |
dddc76173a5150939535b2c506aa967fe17ee000 | Fix #12 : env implementation | elevator/env.py | elevator/env.py | Python | 0.000001 | @@ -0,0 +1,2872 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom ConfigParser import ConfigParser%0A%0Afrom utils.patterns import Singleton%0Afrom utils.decorators import lru_cache%0Afrom utils.snippets import items_to_dict%0A%0A%0Aclass Environment(object):%0A %22%22%22%0A Unix shells like environme... | |
01b42c531f7ab0ca81768b6e9833062f9e31ba95 | Update train_tagger script | examples/training/train_tagger.py | examples/training/train_tagger.py | Python | 0 | @@ -0,0 +1,2323 @@
+%22%22%22A quick example for training a part-of-speech tagger, without worrying%0Aabout the tokenization, or other language-specific customizations.%22%22%22%0A%0Afrom __future__ import unicode_literals%0Afrom __future__ import print_function%0A%0Aimport plac%0Afrom pathlib import Path%0A%0Afrom spa... | |
8fc4fdc96c07432f87b49676b4ba9ca92a0f3385 | Add tool.parser module | grab/tools/parser.py | grab/tools/parser.py | Python | 0.000001 | @@ -0,0 +1,94 @@
+def parse_int(val):%0A if val is None:%0A return None%0A else:%0A return int(val)%0A
| |
e426afbe9ccbc72a1aa0d00032144e8b9b2b8cdc | Implement utility for colored, tabular output using fabric's color controls. | gusset/colortable.py | gusset/colortable.py | Python | 0 | @@ -0,0 +1,2786 @@
+%22%22%22%0APretty table generation.%0A%22%22%22%0Afrom itertools import cycle%0Afrom string import capwords%0Afrom fabric.colors import red, green, blue, magenta, white, yellow%0A%0A%0Aclass ColorRow(dict):%0A %22%22%22%0A Ordered collection of column values.%0A %22%22%22%0A def __init_... | |
af61c9a44871b1da8a939470492c18a45ab373e1 | Create lineValueDisp.py | lineValueDisp.py | lineValueDisp.py | Python | 0.000009 | @@ -0,0 +1,337 @@
+%0Aimport TCP%0Aimport Motor%0Aimport Steering%0Aimport Status%0Aimport time%0Aimport Cameras%0Aimport Lights%0Aimport Modes%0Aimport os%0A%0Atry:%0A trip_meter = Motor.TripMeter()%0A motors = Motor.Motor(trip_meter)%0A follow_line = Steering.FollowLine(motors, start_speed = 0)%0A%0A while True:%... | |
3660c183ba1ddec8033ceae21b1b06fd0ab9a8b7 | Add Signal class | phasortoolbox/signal.py | phasortoolbox/signal.py | Python | 0 | @@ -0,0 +1,37 @@
+class Signal(object):%0A run = False
| |
23b40c583f3713d77f59e8a48f1499d702d29b32 | use pattern to exclude dirs | flexget/plugins/filter/exists_movie.py | flexget/plugins/filter/exists_movie.py | from __future__ import unicode_literals, division, absolute_import
import os
import re
import logging
from path import path
from flexget import plugin
from flexget.event import event
from flexget.config_schema import one_or_more
from flexget.plugin import get_plugin_by_name
from flexget.utils.tools import TimedDict
... | Python | 0 | @@ -1135,52 +1135,86 @@
-skip = %5B'cd1', 'cd2', 'subs', 'sample'%5D%0A
+dir_pattern = re.compile('%5Cb(cd.%5Cd%7Csubs?%7Csamples?)%5Cb',re.IGNORECASE)%0A file_
patt
@@ -3198,35 +3198,39 @@
if
-d.name.lower() in self.skip
+self.dir_pattern.search(d.name)
:%0A
@@ -3441,16 +3441,21 @@
ot self.
+file_... |
e0c05bb4af8ab1df2d91050863206d164df616e5 | Allow a few more built-ins to be used from if plugin. | flexget/plugins/filter/if_condition.py | flexget/plugins/filter/if_condition.py | import logging
from flexget.feed import Feed
from flexget.plugin import register_plugin, get_plugins_by_phase, get_plugin_by_name, priority
import re
log = logging.getLogger('if')
def safer_eval(statement, locals):
"""A safer eval function. Does not allow __ or try statements, does not include any globa... | Python | 0.000033 | @@ -291,57 +291,200 @@
ts,
-does not include any globals in the namespace.%22%22%22
+only includes certain 'safe' builtins.%22%22%22%0D%0A allowed_builtins = %5B'True', 'False', 'len', 'any'%5D%0D%0A for name in allowed_builtins:%0D%0A locals%5Bname%5D = globals()%5B'__builtins__'%5D.get(name)
%0D%0A
... |
913bb348938c2b54ab7a76c7e16ce9b3fb999dbe | Copy fail. | judge/management/commands/render_pdf.py | judge/management/commands/render_pdf.py | import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template import Context
from django.template.loader import get_template
from django.utils import translation
from judge.models import Problem, ProblemTranslation
from judge.pdf_problems import WebKitP... | Python | 0 | @@ -953,44 +953,8 @@
rn%0A%0A
- problem = self.get_object()%0A
|
b31e15d12dbff8eaab71ec523ec16d5f1afe908b | add sharpen pic tool | sharpen_pic.py | sharpen_pic.py | Python | 0 | @@ -0,0 +1,966 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A#function: %E9%94%90%E5%8C%96%E5%9B%BE%E5%83%8F%0Aimport os%0Aimport os.path%0Aimport sys, getopt, argparse%0Afrom PIL import Image, ImageEnhance%0A%0Adef sharpenPic(filein,fileout):%0A%0A%09im02 =Image.open(filein)%0A%09%0A%09im_30 =ImageEnhance.S... | |
338a23f907a82d821844639128d070385138af80 | Simple https server. requires key and cert files | server.py | server.py | Python | 0.999993 | @@ -0,0 +1,380 @@
+import SimpleHTTPServer%0Aimport SocketServer%0Aimport BaseHTTPServer, SimpleHTTPServer%0Aimport ssl%0A%0A%0Ahttpd = BaseHTTPServer.HTTPServer(('localhost', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)%0Ahttpd.socket = ssl.wrap_socket (httpd.socket, certfile='/Users/jtep/Code/own/audioviz/cert.p... | |
e9518383da031d03a3c70f1a670bcf522cfa4d57 | Fix gaiohttp tests for Python 2.5 | tests/test_009-gaiohttp.py | tests/test_009-gaiohttp.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import t
import os
import sys
import unittest
if sys.version_info[0] < 3:
raise unittest.SkipTest("gaiohttp requires Python 3.3+")
try:
import aiohttp
except ImportError:
raise un... | Python | 0.000019 | @@ -132,228 +132,62 @@
ort
-t%0Aimport os%0Aimport sys%0Aimport unittest%0Aif sys.version_info%5B0%5D %3C 3:%0A raise unittest.SkipTest(%22gaiohttp requires Python 3.3+%22)%0A%0Atry:%0A import aiohttp%0Aexcept ImportError:%0A raise unittest.SkipTest(%22gaiohttp requires
+unittest%0Aimport pytest%0Aaiohttp =... |
0882c8885b88618ea55b97ace256cdf833a1547d | Add tests for pylama isort | tests/test_pylama_isort.py | tests/test_pylama_isort.py | Python | 0 | @@ -0,0 +1,541 @@
+import os%0A%0Afrom isort.pylama_isort import Linter%0A%0A%0Aclass TestLinter:%0A instance = Linter()%0A%0A def test_allow(self):%0A assert not self.instance.allow(%22test_case.pyc%22)%0A assert not self.instance.allow(%22test_case.c%22)%0A assert self.instance.allow(%22tes... | |
8a7ea0e8d29d443676c8893790625cbeb9d973ad | Test addByUniqueID Survey model | tests/test_survey_model.py | tests/test_survey_model.py | Python | 0 | @@ -0,0 +1,1438 @@
+# Copyright (C) 2016 University of Zurich. All rights reserved.%0A#%0A# This file is part of MSRegistry Backend.%0A#%0A# MSRegistry Backend is free software: you can redistribute it and/or%0A# modify it under the terms of the version 3 of the GNU Affero General%0A# Public License as published by th... | |
280e72331d99a8c49783196951287627a933a659 | Add py solution for 459. Repeated Substring Pattern | py/repeated-substring-pattern.py | py/repeated-substring-pattern.py | Python | 0.00038 | @@ -0,0 +1,316 @@
+class Solution(object):%0A def repeatedSubstringPattern(self, s):%0A %22%22%22%0A :type s: str%0A :rtype: bool%0A %22%22%22%0A for i in xrange(1, len(s) / 2 + 1):%0A if len(s) %25 i == 0 and len(set(s%5Bj:j+i%5D for j in xrange(0, len(s), i))) == 1:%0A... | |
75dc32ef71fd32c7728269b01a74faf840690473 | Add a slow bot to test timeout feature | examples/too_slow_bot.py | examples/too_slow_bot.py | Python | 0 | @@ -0,0 +1,578 @@
+import random%0Aimport asyncio%0A%0Aimport sc2%0Afrom sc2 import Race, Difficulty%0Afrom sc2.constants import *%0Afrom sc2.player import Bot, Computer%0A%0Afrom proxy_rax import ProxyRaxBot%0A%0Aclass SlowBot(ProxyRaxBot):%0A async def on_step(self, state, iteration):%0A await asyncio.sleep... | |
7c865c63d5debcf7463ad1b81470d2f044ec4738 | Add lab result models | radar/patients/lab_results/models.py | radar/patients/lab_results/models.py | Python | 0 | @@ -0,0 +1,1884 @@
+from sqlalchemy import Column, Integer, String, ForeignKey, Numeric, Date, Boolean%0Afrom sqlalchemy.orm import relationship%0Afrom radar.database import db%0Afrom radar.models import PatientMixin, UnitMixin, CreatedModifiedMixin, DataSource%0A%0A%0Aclass LabOrderDefinition(db.Model):%0A __tablen... | |
36d8a0e091ec1dd4ff451031810c75cd0431ac44 | add admins.py file | aligot/admin.py | aligot/admin.py | Python | 0.000001 | @@ -0,0 +1,223 @@
+# coding: utf-8%0A%0Afrom django.contrib import admin%0A%0Afrom .models import Note, NoteBook, NoteRevision, User%0A%0Aadmin.site.register(User)%0Aadmin.site.register(NoteBook)%0Aadmin.site.register(Note)%0Aadmin.site.register(NoteRevision)%0A
| |
cf93f84dd794b63dd373cf59d802000799e32232 | Create main.py | example/main.py | example/main.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
4efc45499d1736933691b9de39090b86526ea4e1 | Create 217_contain_duplicates.py | 217_contain_duplicates.py | 217_contain_duplicates.py | Python | 0.000607 | @@ -0,0 +1,743 @@
+%22%22%22%0Ahttps://leetcode.com/problems/contains-duplicate/description/%0A%0AGiven an array of integers, find if the array contains any duplicates. %0AYour function should return true if any value appears at least twice in the array, and it should return false if every element%0Ais distinct.%0A%22%... | |
7ab2298f22de79cd14fae9f3add1417a76bcbcd0 | Add package file. | app/__init__.py | app/__init__.py | Python | 0 | @@ -0,0 +1,274 @@
+#!/usr/bin/env python%0Afrom pkgutil import extend_path%0A%0A__path__ = extend_path(__path__, __name__)%0A%0A__all__ = %5B%0A 'data_visualization',%0A 'knn_prediction',%0A 'load_dataset',%0A 'model_visualization',%0A 'select_model',%0A 'svm_prediction',%0A 'validate_dataset',%0A%... | |
f622255dc2c6695b785213c8d69cb57ae5d8a5e9 | Add pebble sdk version for detecting sdk features | waftools/pebble_sdk_version.py | waftools/pebble_sdk_version.py | Python | 0 | @@ -0,0 +1,600 @@
+from waflib.Configure import conf%0A%0A%0A@conf%0Adef compare_sdk_version(ctx, platform, version):%0A target_env = ctx.all_envs%5Bplatform%5D if platform in ctx.all_envs else ctx.env%0A target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff +%0A int(target_env.SD... | |
79fdfaceee84321bb802f9f99ee500f400f38780 | Add admin to credentials | dbaas/integrations/credentials/admin/__init__.py | dbaas/integrations/credentials/admin/__init__.py | Python | 0 | @@ -0,0 +1,177 @@
+# -*- coding:utf-8 -*-%0Afrom django.contrib import admin%0Afrom .. import models%0A%0Aadmin.site.register(models.IntegrationType, )%0Aadmin.site.register(models.IntegrationCredential, )%0A
| |
58627bd4cbe100a7cbd526be38cd69e8605984cd | Add json-encoder example | examples/json-encoder.py | examples/json-encoder.py | Python | 0.000082 | @@ -0,0 +1,866 @@
+#!/usr/bin/env python3%0Afrom pycnic.core import WSGI, Handler%0Aimport datetime%0Aimport json%0A%0Aclass DateTimeEncoder(json.JSONEncoder):%0A def default(self, o):%0A if isinstance(o, datetime.datetime):%0A return o.isoformat()%0A%0A return json.JSONEncoder.default(self,... | |
ebfe2faa5fcf66f3f1ece597922d4a72b59c3e43 | Create B_Averages_ocean.py | Cas_1/B_Averages_ocean.py | Cas_1/B_Averages_ocean.py | Python | 0.001485 | @@ -0,0 +1,1918 @@
+#Averages of U,V,W,T,S and ETA%0A%0Aimport numpy as np %0Aimport matplotlib.pyplot as plt%0A%0Afrom xmitgcm import open_mdsdataset%0A %0Adir0 = '/homedata/bderembl/runmit/test_southatlgyre' #Case 1 : 38 iterations%0A%0Ads0 = open_mdsdataset(dir0,p... | |
8ada83d3140b871d7699988996ff7427c0526c9b | Remove extraneous logging from benchmarks | tensorflow/python/data/benchmarks/benchmark_base.py | tensorflow/python/data/benchmarks/benchmark_base.py | # Copyright 2019 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.000001 | @@ -3344,58 +3344,8 @@
%7B%7D%0A
- extras%5B%22elements_per_second%22%5D = 1 / wall_time%0A
@@ -3466,40 +3466,8 @@
ts.%0A
- name = %22%25s_mode_cpp%22 %25 name%0A
|
9afe19676cbb87985939bd0099301a7003a38b7f | check for monitoring file and directory count | samples/folder_check.py | samples/folder_check.py | Python | 0 | @@ -0,0 +1,1738 @@
+#!/usr/bin/env python%0A%0Aimport json,os,time%0A%0APLUGIN_VERSION=%221%22%0A%0AHEARTBEAT=%22true%22%0A%0A#set this value to 1 if the file count needs to be recursive%0AINCLUDE_RECURSIVE_FILES=None%0A%0AFOLDER_NAME=%22/%22%0A%0ATHRESHOLD_COUNT=10%0A%0Adef get_data():%0A folder_checks_data = %7B%7... | |
d881ee2866bb422a266871c1b426d76c669025da | Test for CASSANDRA-8741 | nodetool_test.py | nodetool_test.py | Python | 0 | @@ -0,0 +1,1046 @@
+from ccmlib.node import NodetoolError%0Afrom dtest import Tester%0Afrom tools import require%0A%0A%0Aclass TestNodetool(Tester):%0A%0A @require(%228741%22)%0A def test_decommission_after_drain_is_invalid(self):%0A %22%22%22%0A @jira_ticket CASSANDRA-8741%0A%0A Running a de... | |
125b9ce4bc5b5966f3730f3d99dba122b1d295eb | use session.request instead of session.{method} | src/sentry/http.py | src/sentry/http.py | """
sentry.utils.http
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sentry
import six
import socket
import requests
import warnings
from django.conf import settings
from djan... | Python | 0 | @@ -3166,41 +3166,51 @@
e =
-getattr(session, method.lower())(
+session.request(%0A method=method,
%0A
@@ -3218,16 +3218,20 @@
+url=
url,%0A
|
72cbdd0c1cf804eecb8f503f86e6be237719bf99 | add echo client for testing | network/echo-server/echo-client/main.py | network/echo-server/echo-client/main.py | Python | 0.000003 | @@ -0,0 +1,1729 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sourc... | |
be96a2f7e3aeb59727ba88913cc6fda97bf8a423 | Add some unit tests | InvenTree/company/test_views.py | InvenTree/company/test_views.py | Python | 0.000001 | @@ -0,0 +1,1680 @@
+%22%22%22 Unit tests for Company views (see views.py) %22%22%22%0A%0A# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.test import TestCase%0Afrom django.urls import reverse%0Afrom django.contrib.auth import get_user_model%0A%0Afrom .models import SupplierPart%0A%0A%... | |
725832be85b7b0455cb735ce8a054007209d9645 | test scan scraper | src/hsimage.py | src/hsimage.py | Python | 0.000001 | @@ -0,0 +1,1247 @@
+import sys%0Afrom PIL import Image%0A%0Aimg = Image.open(sys.argv%5B1%5D)%0Awidth, height = img.size%0A%0Axblock = 5%0Ayblock = 5%0A%0Aw_width = width / xblock%0Aw_height = height / yblock%0A%0Ablockmap = %5B(xb*w_width, yb*w_height, (xb+1)*w_width, (yb+1)*w_height)%0A for xb in xrange(xblock... | |
dede46a2d5ad1504991b05b8edab4d1ffd781f46 | fix out of range error in tracker remover plugin | searx/plugins/tracker_url_remover.py | searx/plugins/tracker_url_remover.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | Python | 0 | @@ -1269,17 +1269,13 @@
ange
-d = False
+s = 0
%0A
@@ -1432,16 +1432,26 @@
ry.pop(i
+ - changes
)%0A
@@ -1470,60 +1470,19 @@
ange
-d = True
+s += 1
%0A
- break%0A%0A if changed:%0A
@@ -1577,32 +1577,36 @@
y))%0A
+
result%5B'url'%5D =
@@ -1637,16 +1637,38 @@
... |
a6fb8c86e14722527ff004ca1378458df252f8c0 | add doxygen module | modules/doxygen.py | modules/doxygen.py | Python | 0.000001 | @@ -0,0 +1,555 @@
+%22%22%22Doxygen module.%0A%0ACreate project's documentation.%0A%0AWebsite: http://www.doxygen.org%0A%22%22%22%0Aimport os%0Aimport shlex%0A%0Adef doxygen(loader, variant=None, *args):%0A if len(args) == 1:%0A args = shlex.split(args%5B0%5D)%0A%0A if variant is None:%0A variant = ... | |
7a74f85fc76af2df62bb92ff2997ab1b84caa3a0 | Test dummy IRC bot | tests/test_irc_bot_dummy.py | tests/test_irc_bot_dummy.py | Python | 0.000001 | @@ -0,0 +1,862 @@
+%22%22%22%0A:Copyright: 2007-2021 Jochen Kupperschmidt%0A:License: MIT, see LICENSE for details.%0A%22%22%22%0A%0Aimport pytest%0A%0Afrom syslog2irc.irc import create_bot, IrcChannel, IrcConfig%0Afrom syslog2irc.signals import irc_channel_joined%0A%0A%0A@pytest.fixture%0Adef config():%0A channels ... | |
2283c4851c628b24036edd029594c3bda115ae71 | Fix collisions with footer logo | generate_quote_images.py | generate_quote_images.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import json
import os
import textwrap
import HTMLParser
from typogrify.filters import smartypants
from PIL import Image, ImageDraw, ImageFont
OUT_DIR = 'www/quote-images'
CANVAS_WIDTH = 640
CANVAS_HEIGHT = 640
TEXT_MARGIN = (40, 40, 200, 40)
TEXT_MAX_WIDTH = CANVAS_WIDT... | Python | 0.000002 | @@ -1021,16 +1021,17 @@
_count)%0A
+%0A
@@ -1075,16 +1075,62 @@
s, size)
+%0A height += height / len(lines) * 2
%0A%0A
@@ -2852,16 +2852,22 @@
+= size
+ * 1.2
%0A%0A y
@@ -2928,10 +2928,10 @@
ze,
-3
2
+4
)%0A
|
a8ec11719ccc158fd457ed02f2b8459d1b452975 | Create tweets.py | tweets.py | tweets.py | Python | 0.000008 | @@ -0,0 +1,566 @@
+import sqlite3%0A%0Adef main(cursor):%0A cursor.execute(%22select * from tweets%22)%0A for tweet in cursor.fetchall():%0A tid = tweet%5B0%5D%0A tdate = tweet%5B1%5D%0A text = tweet%5B2%5D%0A geo = tweet%5B3%5D%0A t = str(tdate + text + geo)%0A %0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.