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 |
|---|---|---|---|---|---|---|---|
31f4974482f1652b00324c9bc5760689ed4dd0fa | Create __init__.py | FAFT_64-points_R2C/__init__.py | FAFT_64-points_R2C/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
4d465ba648ce4af7547818574bd2b08be835eb09 | Add initial template of zenodo-deposit.py | bin/zenodo-deposit.py | bin/zenodo-deposit.py | Python | 0 | @@ -0,0 +1,1219 @@
+import requests%0A%0Aheaders = %7B%22Content-Type%22: %22application/json%22%7D%0Ar = requests.post('https://zenodo.org/api/deposit/depositions',%0A params=%7B'access_token': ZENODO_KEY%7D, json=%7B%7D,%0A headers=headers)%0A# Get the deposition id from the previous... | |
8411eb2ee14718141b7242e54b60c3e8da906e4d | Add grep plugin | plugins/grep.py | plugins/grep.py | Python | 0.000001 | @@ -0,0 +1,952 @@
+import io%0Aimport re%0Aimport unittest%0A%0A%0Aclass Plugin:%0A def on_command(self, bot, msg, stdin, stdout, reply):%0A pattern_str = %22 %22.join(msg%5B%22args%22%5D%5B1:%5D)%0A if pattern_str:%0A pattern = re.compile(pattern_str)%0A for line in map(str.strip... | |
299f08729c1a1c2d1893809a7ae7e53d51054d90 | Add realtime.py | realtime.py | realtime.py | Python | 0.000809 | @@ -0,0 +1,1937 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Aclass twsk:%0A def __init__(self,no = None):%0A self.stock = ''%0A if no is None:%0A no = random.randrange(1000,8000)%0A%0A ok = 1%0A ok_times = 0%0A%0A while ok:%0A ok = 0%0A try:%0A page = urllib2.urlopen('http... | |
cca86b7dc339719863fb5cf66388a18b4f40b9c1 | Create plugin.py | cea/plugin.py | cea/plugin.py | Python | 0.000001 | @@ -0,0 +1,896 @@
+%22%22%22%0AA base class for creating CEA plugins. Subclass this class in your own namespace to become a CEA plugin.%0A%22%22%22%0A%0A### NOTE / FIXME: have this class read in the scripts.yml and schemas.yml. plots need to be python classes.%0A%0Aclass CeaPlugin(object):%0A %22%22%22%0A A CEA P... | |
5084957b070e19334d7256a727ff995989f0e14e | add tar raw loader | src/loaders/tarraw.py | src/loaders/tarraw.py | Python | 0 | @@ -0,0 +1,1041 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2017 shmilee%0A%0A'''%0AContains TarFile raw loader class.%0A'''%0A%0Aimport os%0Aimport tarfile%0A%0Afrom ..glogger import getGLogger%0Afrom .base import BaseRawLoader%0A%0A__all__ = %5B'TarRawLoader'%5D%0Alog = getGLogger('L')%0A%0Aclass TarRawLoader(Ba... | |
3eccb0323590c876735fe8c664cd2e4866bd3089 | Add SKeys function | kopytka/transforms.py | kopytka/transforms.py | Python | 0 | @@ -0,0 +1,200 @@
+from django.db.models import CharField, Func%0Afrom django.contrib.postgres.fields import ArrayField%0A%0A%0Aclass SKeys(Func):%0A function = 'skeys'%0A arity = 1%0A output_field = ArrayField(CharField())%0A
| |
d56d2b2db736b9160c49ea7694732b047a398f3d | Add version.py | conda.recipe/version.py | conda.recipe/version.py | Python | 0.000001 | @@ -0,0 +1,248 @@
+def main():%0A inp = sys.stdin.read().strip().split('-')%0A try:%0A inp%5B1%5D = 'post%2503d' %25 int(inp%5B1%5D)%0A except IndexError:%0A pass%0A print('.'.join(inp))%0A return 0%0A%0A%0Aif __name__ == '__main__':%0A import sys%0A sys.exit(main())%0A
| |
18c93f4c70a2247bcce8a853c30038097cb9f7b2 | Add test for optional page admin registrations for Country and CountryGroup. | cms/apps/pages/tests/test_admin_destructive.py | cms/apps/pages/tests/test_admin_destructive.py | Python | 0 | @@ -0,0 +1,956 @@
+from django.conf import settings%0Afrom django.contrib import admin%0Afrom django.test import TestCase%0A%0Afrom ..models import Country, CountryGroup, Page%0A%0Aimport sys%0A%0A%0Aclass TestArticleAdminBase(TestCase):%0A%0A def test_article_admin(self):%0A NEW_MIDDLEWARE_CLASSES = settings... | |
e2c6bc3303038dcf2fcc0741f2c20ebda86198b2 | Remove trailing whitespace | corehq/ex-submodules/casexml/apps/phone/xml.py | corehq/ex-submodules/casexml/apps/phone/xml.py | from __future__ import absolute_import
import logging
from xml.sax import saxutils
from xml.etree import ElementTree
from casexml.apps.case import const
from casexml.apps.case.xml import check_version, V1
from casexml.apps.case.xml.generator import get_generator, date_to_xml_string,\
safe_element
USER_REGISTRATION... | Python | 0.999999 | @@ -1033,21 +1033,17 @@
on=V1):%0A
-
%0A
+
chec
@@ -1061,20 +1061,16 @@
ersion)%0A
-
%0A if
@@ -1082,17 +1082,16 @@
is None:
-
%0A
@@ -1252,21 +1252,17 @@
ement()%0A
-
%0A
+
# if
@@ -1908,21 +1908,17 @@
_block)%0A
-
%0A
+
if d
@@ -2183,33 +2183,25 @@
date_block)%0A
... |
92d8b1e184aca53094f986017d40ec3e7c0ec987 | Fix exception while using Bot.send and Bot.send_photo | botogram/frozenbot.py | botogram/frozenbot.py | """
botogram.frozenbot
A frozen version of the real bot
Copyright (c) 2015 Pietro Albini <pietro@pietroalbini.io>
Released under the MIT license
"""
import logbook
from . import utils
from . import objects
class FrozenBotError(Exception):
pass
class FrozenBot:
"""A frozen version of botog... | Python | 0.000011 | @@ -4474,36 +4474,38 @@
at(%7B%22id%22: chat,
+%22
type
+%22
: %22%22%7D, self.api)
@@ -4720,20 +4720,22 @@
: chat,
+%22
type
+%22
: %22%22%7D, s
|
06e0c4663dd9dcc99778b80ad288a5b845bb9d2f | add default string length for tutorial method (mysql requires it) | cubes/tutorial/sql.py | cubes/tutorial/sql.py | import sqlalchemy
import csv
def create_table_from_csv(connectable, file_name, table_name, fields, create_id = False, schema = None):
"""Create a table with name `table_name` from a CSV file `file_name` with columns corresponding
to `fields`. The `fields` is a list of two string tuples: (name, type) where type... | Python | 0 | @@ -1103,16 +1103,21 @@
y.String
+(256)
%7D%0A%0A
|
4607b954ea9c2abb58e084d12179d42868fc12d0 | Create hash-digest-rename.py | hash-digest-rename.py | hash-digest-rename.py | Python | 0.000112 | @@ -0,0 +1,1427 @@
+#!/usr/bin/env python3%0A%0Aimport hashlib%0Aimport os%0Aimport sys%0A%0A%0Adef normalize_algorithm(name):%0A # Since the name might be caps or have dashes,%0A # we normalize to lowercase as used by Python's hashlib.%0A%0A return name.lower().replace(%22-%22, %22%22)%0A%0A%0Adef plural(numb... | |
06c9a86ab4fd12c319d35d64a135740077e1d93a | modify pkg_info | storages/pkg_info.py | storages/pkg_info.py | Python | 0.000001 | @@ -0,0 +1,169 @@
+package = %22django-oss-storage%22%0Aversion = %220.3.5%22%0Aurl = %22http://oss.aliyun.com%22%0Alicense = %22The MIT License (MIT)%22%0Ashort_description = 'Django Aliyun OSS storage backend.'
| |
cee4d852003a1ec8f19714ee1503888068cf9749 | Create svm.py | svm.py | svm.py | Python | 0.000004 | @@ -0,0 +1,1997 @@
+import numpy as np%0Aimport pandas as pd%0Afrom sklearn import metrics,cross_validation%0Afrom sklearn.cross_validation import train_test_split%0Afrom sklearn import svm%0A%0A#Read training data and split into train and test data%0Adata=pd.read_csv('train.csv')%0Adata1=data.values%0AX=data1%5B:,1:%5... | |
d5364fe87c4491bc564ba1406604ee423788a8a8 | Add lc01161_maximum_level_sum_of_a_binary_tree.py | lc01161_maximum_level_sum_of_a_binary_tree.py | lc01161_maximum_level_sum_of_a_binary_tree.py | Python | 0.000296 | @@ -0,0 +1,1045 @@
+%22%22%22Leetcode 1161. Maximum Level Sum of a Binary Tree%0AMedium%0A%0AURL: https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/%0A%0AGiven the root of a binary tree, the level of its root is 1, %0Athe level of its children is 2, and so on.%0A%0AReturn the smallest level X such that t... | |
08d84ae22faca08e5f3d12a39d3fd23491293ef0 | fix double property | corehq/apps/userreports/models.py | corehq/apps/userreports/models.py | from couchdbkit import ResourceNotFound
from couchdbkit.ext.django.schema import Document, StringListProperty
from couchdbkit.ext.django.schema import StringProperty, DictProperty, ListProperty
from corehq.apps.userreports.exceptions import BadSpecError
from corehq.apps.userreports.factory import FilterFactory, Indicat... | Python | 0.000001 | @@ -4312,30 +4312,16 @@
roperty%0A
- @property%0A
@mem
|
e6a972e4a5f0be7c78439f8437c693cfb3381e54 | create class Level - basic class methods | meow_letters/level.py | meow_letters/level.py | Python | 0 | @@ -0,0 +1,327 @@
+class Level(object):%0A %22%22%22Represents user level%0A %22%22%22%0A def __init__(self, level=1):%0A %22%22%22Level class initializer%0A%0A :param level: int positive number that represents level%0A %22%22%22%0A self.level = level%0A%0A def __repr__(self):%0A... | |
8053701daf9abdb35c870b1b70940bb60d60328c | Create annotate_gwas_results_from_vcf.py | annotate_gwas_results_from_vcf.py | annotate_gwas_results_from_vcf.py | Python | 0.000001 | @@ -0,0 +1,278 @@
+#!/usr/bin/python%0A%0Aimport argparse%0Aimport re%0Aimport pysam%0Aimport os%0Aimport string%0Afrom pysam import VariantFile%0Aimport itertools%0A%0A%22%22%22%0Aannotate_gwas_results_from_vcf.py This script will take a vcf file and gwas results and add additional columns from a %0ASnpEff annotated V... | |
ac720cc02d35c3baa8e1c09c2639126ae7173f2b | Add NLDN file reader | NLDN.py | NLDN.py | Python | 0 | @@ -0,0 +1,1563 @@
+from datetime import datetime%0Aimport numpy as np%0Afrom numpy.lib.recfunctions import drop_fields, append_fields%0A%0Aclass NLDNdataFile(object):%0A %0A stroke_DC3 = %7B'columns':%5B ('date','S10'), ('time','S20'), %0A ('lat','f4'), ('lon','f4'), %0A ... | |
5c834d19a113301e3bdc07dc03fb1486825825c5 | Add an initial moksha.api.hub API, with a dumb send_message method. | moksha/api/hub/hub.py | moksha/api/hub/hub.py | Python | 0 | @@ -0,0 +1,620 @@
+from orbited import json%0Afrom moksha.hub import MokshaHub%0A%0Adef send_message(topic, message):%0A %22%22%22 Send a %60message%60 to a specific %60topic%60 %22%22%22%0A%0A # Right now we're instantiating a new connection & channel each message..%0A # we could potentially do this in the Da... | |
d34ad4b0b969dd6c10fc7c1646f934016ba8ddd7 | Add a script to list undocumented files and directories | tools/distrib/c-ish/check_documentation.py | tools/distrib/c-ish/check_documentation.py | Python | 0 | @@ -0,0 +1,2642 @@
+#!/usr/bin/env python2.7%0A%0A# Copyright 2015, Google Inc.%0A# 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 are%0A# met:%0A#%0A# * Redistributions of source code must retain... | |
37f2c3036890f9bbfd88a369dfd590744256aaf9 | works again. woo hoo | nova/scheduler/api.py | nova/scheduler/api.py | # Copyright (c) 2011 Openstack, LLC.
# 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 requi... | Python | 0.999961 | @@ -6559,53 +6559,180 @@
-return %5Bserver.__dict__ for server in result%5D
+server = result%5B0%5D.__dict__%0A%0A for k in server.keys():%0A if k%5B0%5D == '_' or k == 'manager':%0A del server%5Bk%5D%0A%0A return dict(server=server)
%0A%0A%0Ad
|
da2c42a62ce71f4eac944fbe4ffe74804077f8b9 | generate multiple month MALT at once | corehq/apps/data_analytics/malt_generator.py | corehq/apps/data_analytics/malt_generator.py | import logging
from corehq.apps.app_manager.models import get_app
from corehq.apps.data_analytics.models import MALTRow
from corehq.apps.domain.models import Domain
from corehq.apps.smsforms.app import COMMCONNECT_DEVICE_ID
from corehq.apps.sofabed.models import FormData, MISSING_APP_ID
from corehq.util.quickcache imp... | Python | 0.999913 | @@ -576,24 +576,29 @@
espan_object
+_list
):%0A s
@@ -609,16 +609,21 @@
datespan
+_list
= dates
@@ -632,16 +632,96 @@
n_object
+_list%0A%0A def _reset_datespan(self, datespan):%0A self.datespan = datespan
%0A%0A de
@@ -857,24 +857,131 @@
ll_users():%0A
+ for datespan in self.d... |
fd4074160a943fb8841780211395a58ff5719dc1 | Add `settings.py` | settings.py | settings.py | Python | 0 | @@ -0,0 +1,238 @@
+import os%0A%0Auser_agent = 'when is my cakeday by /u/avinassh'%0Ascopes = %5B'identity'%5D%0Aapp_key = os.environ%5B'APP_KEY'%5D%0Aapp_secret = os.environ%5B'APP_SECRET'%5D%0Arefresh_token = os.environ%5B'REFRESH_TOKEN'%5D%0Aaccess_token = os.environ%5B'ACCESS_TOKEN'%5D%0A
| |
d3ce90054a85c8711b95f6cf1fb975d78b8a2101 | add first try to understand stew api | core.py | core.py | Python | 0 | @@ -0,0 +1,47 @@
+from stew.types.nat import Nat%0A%0Aprint(Nat(10))%0A
| |
b363b20440e564b2909736c64cb543cd632b4ae4 | Print daily form submission counts | custom/covid/management/commands/fetch_form_case_counts.py | custom/covid/management/commands/fetch_form_case_counts.py | Python | 0 | @@ -0,0 +1,2097 @@
+import itertools%0Afrom datetime import date, datetime, timedelta%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom corehq.apps.enterprise.models import EnterprisePermissions%0Afrom corehq.apps.es import CaseES, FormES%0A%0A%0Aclass Command(BaseCommand):%0A%0A def add_arguments(s... | |
447720e9f18447476bc3d4f8b16a9eed018b260e | Add lc074_search_a_2d_matrix.py | lc074_search_a_2d_matrix.py | lc074_search_a_2d_matrix.py | Python | 0.000025 | @@ -0,0 +1,845 @@
+%22%22%22Leetcode 74. Search a 2D Matrix.%0AMedium%0A%0AURL: https://leetcode.com/problems/search-a-2d-matrix/%0A%0AWrite an efficient algorithm that searches for a value in an m x n matrix. %0AThis matrix has the following properties:%0A%0AIntegers in each row are sorted from left to right.%0AThe fi... | |
b6ac5540021dd7de2a97d4cb9f668059a16a7e94 | Write edit preparation test | whats_fresh/whats_fresh_api/tests/views/entry/test_edit_preparation.py | whats_fresh/whats_fresh_api/tests/views/entry/test_edit_preparation.py | Python | 0.000002 | @@ -0,0 +1,2153 @@
+from django.test import TestCase%0Afrom django.core.urlresolvers import reverse%0Afrom whats_fresh_api.models import *%0Afrom django.contrib.gis.db import models%0Afrom django.contrib.auth.models import User%0Aimport json%0A%0A%0Aclass EditPreparationTestCase(TestCase):%0A %22%22%22%0A Test th... | |
8354354be70851b91a66e11a784d19684345df4d | Add triangular distribution. | equadratures/distributions/triangular.py | equadratures/distributions/triangular.py | Python | 0.000001 | @@ -0,0 +1,3412 @@
+%22%22%22The Triangular distrubution.%22%22%22%0Afrom equadratures.distributions.template import Distribution%0Afrom equadratures.distributions.recurrence_utils import custom_recurrence_coefficients%0Aimport numpy as np%0Afrom scipy.stats import triang%0ARECURRENCE_PDF_SAMPLES = 8000%0A%0Aclass Tria... | |
e451343922251b552e902b84aa925b0a04ae958f | Add test script | src/test.py | src/test.py | Python | 0.000001 | @@ -0,0 +1,66 @@
+import wrangler%0A%0Aif __name__ == '__main__':%0A%09wrangler.test_task()%0A
| |
b438141932dc32c2bb0749ad0bf1cafaed09c711 | Add dynamic resizing support. | asciimatics/exceptions.py | asciimatics/exceptions.py | Python | 0 | @@ -0,0 +1,472 @@
+class ResizeScreenError(Exception):%0A %22%22%22%0A Asciimatics raises this Exception if the terminal is resized while playing%0A a Scene (and the Screen has been told not to ignore a resizing event).%0A %22%22%22%0A%0A def __init__(self, message):%0A %22%22%22%0A :param ... | |
d3e90e4dca1cce2f27ccf9c24c1bb944f9d708b9 | Add a unit test file for MessageDirectory | test/test_message_directory.py | test/test_message_directory.py | Python | 0 | @@ -0,0 +1,3338 @@
+%22%22%22%0ACreated on 18 May 2018.%0A%0A@author: Greg Corbett%0A%22%22%22%0A%0Aimport shutil%0Aimport tempfile%0Aimport unittest%0A%0Afrom ssm.message_directory import MessageDirectory%0A%0A%0Aclass TestMessageDirectory(unittest.TestCase):%0A %22%22%22Class used for testing the MessageDirectory ... | |
25bb3511e6b06f739e4ebe8aed79ec25d1ecae29 | use get_total_case_count | corehq/ex-submodules/casexml/apps/case/tests/test_multi_case_submits.py | corehq/ex-submodules/casexml/apps/case/tests/test_multi_case_submits.py | from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests import delete_all_xforms, delete_all_cases
from couchforms.tests.testutils import post_xform_to_couch
from casexml.apps.case.xform import process_case... | Python | 0.000239 | @@ -84,16 +84,79 @@
ettings%0A
+from casexml.apps.case.dbaccessors import get_total_case_count%0A
from cas
@@ -549,45 +549,16 @@
s()%0A
-%0A
- def testParallel(self):%0A
-
self
@@ -577,67 +577,60 @@
(0,
-len(CommCareCase.view(%22case/by_user%22, reduce=False).all()))
+get_total_case_count())%0A%0A ... |
2414789b86be5303e95ce8a4b98bca345d224bd9 | Add pythondoc HTMLParser code | html.py | html.py | Python | 0.000002 | @@ -0,0 +1,329 @@
+import HTMLParser%0Aimport requests%0A%0A%0Aclass WikiParse(HTMLParser.HTMLParser):%0A def handle_starttag(self, tag, attrs):%0A print %22start tag%22, tag%0A%0A def handle_endtag(self, tag):%0A print %22end tag%22, tag%0A%0A def handle_data(self, data):%0A print %22data... | |
499127a1dcb4edce3a823fb3fd1787db3a5b96b2 | Add util.py to add helpers to mailchimp handlers | app/mailchimp/util.py | app/mailchimp/util.py | Python | 0 | @@ -0,0 +1,694 @@
+import re%0A%0Aresp_match = lambda status: re.match(r%22%5E%5B4,5%5D%5B0-9%5D%5B0-9%5D$%22,status)%0A%0Adef handle_response(func):%0A %22%22%22Utility function that pre processes a %0A mailchimp response%0A %22%22%22%0A r = func()%0A try:%0A if resp_match(r%5B%22status%22%5D)... | |
11b8fee12d0c4ccaa6c922e00e601efdf1706a89 | Add proof-of-concept video tracking | videoconcept.py | videoconcept.py | Python | 0.000006 | @@ -0,0 +1,1442 @@
+import numpy as np%0Aimport sys%0Asys.path.append('/usr/local/Cellar/opencv3/3.2.0/lib/python2.7/site-packages')%0Afrom imutils.object_detection import non_max_suppression%0Aimport imutils%0Aimport cv2%0Aimport time%0A%0Ahog = cv2.HOGDescriptor()%0Ahog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeop... | |
5d128562c1f90537e6c4164b7651cae6b7f2838b | Add missing import | python/qitoolchain/actions/convert_package.py | python/qitoolchain/actions/convert_package.py | ## Copyright (c) 2012-2014 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.
"""Convert a binary archive into a qiBuild package.
"""
import os
import qisys
import qisys.parsers
from qitoolchain.convert import convert_pack... | Python | 0.000008 | @@ -235,16 +235,37 @@
ort os%0A%0A
+from qisys import ui%0A
import q
|
7fd09bd791661ab0b12921dfd977591690d9c01a | Add form tests for LoginForm | accounts/tests/test_forms.py | accounts/tests/test_forms.py | Python | 0 | @@ -0,0 +1,500 @@
+%22%22%22accounts app unittests for views%0A%0A%22%22%22%0Afrom django.test import TestCase%0A%0Afrom accounts.forms import LoginForm%0A%0A%0Aclass LoginFormTest(TestCase):%0A %22%22%22Tests the form which validates the email used for login.%0A%0A %22%22%22%0A def test_valid_email_accepted(s... | |
860dda2cc4741ac8167a7f81bd9d835364d5954a | Change apache package URL to https (#7622) | docs/build_version_doc/AddPackageLink.py | docs/build_version_doc/AddPackageLink.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 0 | @@ -1379,32 +1379,33 @@
src_url = %22http
+s
://www.apache.or
@@ -1427,32 +1427,32 @@
i/incubator/%22 %5C%0A
-
%22m
@@ -1533,32 +1533,33 @@
pgp_url = %22http
+s
://www.apache.or
@@ -1691,32 +1691,33 @@
sha_url = %22http
+s
://www.apache.or
@@ -1834,24 +1834,24 @@
(tag, tag)%0A
-
md5_url ... |
a719f3b15664555543266f0575210f750d8cb631 | Add hwmon instrument | wa/instrumentation/hwmon.py | wa/instrumentation/hwmon.py | Python | 0.000015 | @@ -0,0 +1,3505 @@
+# Copyright 2017 ARM Limited%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required ... | |
dc6b7da10f8da0adad984a24b9c3f5904fe48de5 | Add simpler video playback example. | examples/video.py | examples/video.py | Python | 0.000726 | @@ -0,0 +1,680 @@
+#!/usr/bin/env python%0A%0A'''Simple example of video playback.%0A%0AUsage::%0A%0A video.py %3Cfilename%3E%0A%0ASee the Programming Guide for a partial list of supported video formats.%0A'''%0A%0A__docformat__ = 'restructuredtext'%0A__version__ = '$Id$'%0A%0Aimport sys%0Aimport pyglet%0A%0Aif len(... | |
28a7077b7f05f52d0bff7a849f8b50f82f73dbdb | Add a script to convert an index to a md5 file. | idx2md5.py | idx2md5.py | Python | 0 | @@ -0,0 +1,190 @@
+#! /usr/bin/python%0A%0Afrom __future__ import print_function%0Aimport sys%0Aimport photo.index%0A%0Aidx = photo.index.Index(idxfile=sys.argv%5B1%5D)%0Afor i in idx:%0A print(%22%25s %25s%22 %25 (i.md5, i.filename))%0A
| |
05e2b100512a9c9b06c5d7d2701867f155c5e3f0 | Add API tests for profile validation | senlin/tests/tempest/api/profiles/test_profile_validate.py | senlin/tests/tempest/api/profiles/test_profile_validate.py | Python | 0.000034 | @@ -0,0 +1,1554 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in wri... | |
48a4d8aba5818a280a19a3eded51fc9518e04a47 | Rename methods to set and receive match attributes | axelrod/player.py | axelrod/player.py | from functools import wraps
import inspect
import random
import copy
from axelrod import Actions, flip_action
from .game import DefaultGame
C, D = Actions.C, Actions.D
# Strategy classifiers
def is_basic(s):
"""
Defines criteria for a strategy to be considered 'basic'
"""
stochastic = s.classifier... | Python | 0 | @@ -2659,34 +2659,29 @@
self.set_
-tournament
+match
_attributes(
@@ -2695,34 +2695,29 @@
def receive_
-tournament
+match
_attributes(
@@ -2805,26 +2805,21 @@
use of
-tournament
+match
_attribu
@@ -2917,26 +2917,21 @@
def set_
-tournament
+match
_attribu
|
5cf2a26d50c839cdabee52624069dcf2878680a0 | Handle new warnings with tidy exceptions. | nikola/filters.py | nikola/filters.py | # Copyright (c) 2012 Roberto Alsina y otros.
# 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, pub... | Python | 0 | @@ -3637,32 +3637,222 @@
continue%0A
+ elif 'proprietary attribute %22data-toggle%22' in line or %5C%0A 'proprietary attribute %22data-target%22':%0A # Some of our own tricks%0A continue%0A
else
|
baeaa2b2e9ed7b6d932adae9aee0517a0e73428f | Add __init__ file to iso_639_3/ | iso_639_3/__init__.py | iso_639_3/__init__.py | Python | 0.000001 | @@ -0,0 +1,106 @@
+from __future__ import absolute_import%0Afrom iso_639_3.iso_639_3 import iso_639_3%0A%0Alanguages = iso_639_3()%0A
| |
35662cf6a174f1924f20d6b78241e6095fa9fb3e | Fix syntax error in build/all_android.gyp | build/all_android.gyp | build/all_android.gyp | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO(thakis): Remove this file after https://codereview.chromium.org/139743016
# has been in the tree for a while.
{
'targets': [
{
'target... | Python | 0.99796 | @@ -409,22 +409,22 @@
%5D,%0A
-%5D
+%7D
,%0A %5D,%0A%7D%0A
|
8751397275a6de993b2c317e85aee26c0ce3d9a9 | add tests for middleware | src/python/expedient_geni/tests.py | src/python/expedient_geni/tests.py | Python | 0 | @@ -0,0 +1,2073 @@
+'''%0ACreated on Oct 8, 2010%0A%0A@author: jnaous%0A'''%0Afrom expedient.common.tests.manager import SettingsTestCase%0Afrom django.core.urlresolvers import reverse%0Afrom django.conf import settings%0Aimport os%0Afrom expedient_geni.utils import get_user_cert_fname, get_user_key_fname%0Afrom django... | |
4053948ba58b266ef66e181776c2fe4bc37b4760 | Create Anagrams.py | Array/Anagrams.py | Array/Anagrams.py | Python | 0.000002 | @@ -0,0 +1,941 @@
+Given an array of strings, return all groups of strings that are anagrams.%0ANote: All inputs will be in lower-case.%0A%0AReference: http://blog.csdn.net/linhuanmars/article/details/21664747%0A# Notes: anagrams definition: two strings, which have the same character, maybe different order %0A# 1) Save... | |
ba0d43898c397a0275b92079f7a963aeff09fcb3 | add missing boolean check to use_aws | dataactcore/config.py | dataactcore/config.py | import os.path
from os.path import expanduser, normpath, dirname
import yaml
import re
# set the location of the DATA Act broker config file
CONFIG_PATH = os.path.join(dirname(__file__), 'config.yml')
try:
with open(CONFIG_PATH) as c:
CONFIG_ALL = yaml.load(c)
except IOError:
raise IOError('Error read... | Python | 0 | @@ -733,16 +733,24 @@
se_aws'%5D
+ is True
or CONF
|
adc12504811dff0318f085887e207517d780862b | add merge migration | osf/migrations/0106_merge_20180531_0919.py | osf/migrations/0106_merge_20180531_0919.py | Python | 0.000001 | @@ -0,0 +1,333 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.11 on 2018-05-31 14:19%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0105_merge_20180525_1529'),%0A ('osf', '0104... | |
cac9e9fa65a9b7f1055f193822a66e5edcad88ee | Create twitch.py | HexChat/twitch.py | HexChat/twitch.py | Python | 0.000001 | @@ -0,0 +1,1482 @@
+import hexchat%0A%0A__module_name__ = 'Twitch'%0A__module_author__ = 'TingPing'%0A__module_version__ = '0'%0A__module_description__ = 'Better integration with Twitch.tv'%0A# Very much a work in progress...%0A%0A# Best used with my 'mymsg.py' script so you can sync your messages with the web clients.... | |
53d1e2ca188fbcae1899b6190ad3e59bdf5911bb | Create base64_enc_dec.py | Encryption/base64_enc_dec.py | Encryption/base64_enc_dec.py | Python | 0.000041 | @@ -0,0 +1,2274 @@
+%22%22%22%0AName : Bas 64 Encryption, encoder and decoder%0ACreated By : Agus Makmun (Summon Agus)%0ABlog : bloggersmart.net - python.web.id%0ALicense : GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007%0ADocumentation : https://github.com/agusmakmun/Some-E... | |
94500a279da6f03362c82961e9a97d0223175bd7 | Create LabelPerimeter.py | LabelPerimeter.py | LabelPerimeter.py | Python | 0 | @@ -0,0 +1,1750 @@
+import numpy as np%0A%0A%0Adef LabelPerimeter(L, Connectivity=4):%0A %22%22%22Converts a label or binary mask image to a binary perimeter image.%0A%0A Uses 4-neighbor or 8-neighbor shifts to detect pixels whose values do%0A not agree with their neighbors.%0A%0A Parameters%0A ---------... | |
cf6cf3433cbc816a14534f12bad36d20c908d869 | Create Subset.py | Samples/Subset.py | Samples/Subset.py | Python | 0.000001 | @@ -0,0 +1,846 @@
+import uuid%0Afrom TM1py import Subset, TM1Queries%0A%0Arandom_string1 = str(uuid.uuid4())%0Arandom_string2 = str(uuid.uuid4())%0A%0Aq = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)%0A%0A# create dynamic subset%0As = Subset(dimension_name='plan_business_unit', subset_name=ra... | |
bf6737d8ddd8c0ff21a550da44d23b8ec39c70eb | Add 1-4.py, simple hashing in set 1 | set1/1-4.py | set1/1-4.py | Python | 0.018314 | @@ -0,0 +1,439 @@
+# This is a hack to make sure Python 2.x and 3.x behave the same%0A# You can ignore this bit%0Atry:%0A input = raw_input%0Aexcept NameError:%0A pass%0A%0A%0A# Real program starts here%0Adef hash_password(string):%0A return str(len(string) %25 10)%0A%0A%0Ahashed_password = %226%22%0A%0Aprint(... | |
cfc49a2013be11e277ef27b01e8921a3acac1365 | Add an helper for loadtests. | loadtests/loadtest.py | loadtests/loadtest.py | from urlparse import urlparse
import random
import json
import hmac
import hashlib
import math
import mohawk
from requests.auth import AuthBase
from loads.case import TestCase
class TestLoop(TestCase):
def test_all(self):
self.register()
token = self.generate_token()
call_id, session, c... | Python | 0 | @@ -688,16 +688,164 @@
tatus)%0A%0A
+ def _get_json(self, resp):%0A try:%0A return resp.json()%0A except Exception:%0A print resp.text%0A raise%0A%0A
def
@@ -852,32 +852,32 @@
register(self):%0A
-
resp = s
@@ -1003,16 +1003,65 @@
/push'%7D)
+%0A ... |
861a5fcda82fefbe10c844fda4075688dc6baf8e | Save submissions, and redirect user to the submission detail page after completing form. | mzalendo/votematch/views.py | mzalendo/votematch/views.py | import models
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
def quiz_detail (request, slug):
quiz = get_object_or_404(
models.Quiz,
slug=slug
)
return render_to_response(
'votematch/quiz_detail.html',... | Python | 0 | @@ -132,16 +132,17 @@
ontext%0A%0A
+%0A
def quiz
@@ -166,16 +166,17 @@
slug):%0A
+%0A
quiz
@@ -242,21 +242,983 @@
g%0A )%0A
-
%0A
+ # If this is a POST then extract all the answers%0A if request.method == 'POST':%0A%0A # get the answers. Use the current set of statements to look for%0A ... |
4653596825bf00fe403e77c4b11a0def6bac2649 | add settings.py | settings.py | settings.py | Python | 0.000004 | @@ -0,0 +1,423 @@
+#!/usr/bin/env python%0A%0A%22%22%22settings.py%0A%0AUdacity conference server-side Python App Engine app user settings%0A%0A$Id$%0A%0Acreated/forked from conference.py by wesc on 2014 may 24%0A%0A%22%22%22%0A%0A# Replace the following lines with client IDs obtained from the APIs%0A# Console or Cloud... | |
dc6ac64817d9eb1022c4b8e8a0bba399104c2bbc | Set HOME too | spawn-test-env.py | spawn-test-env.py | #!/usr/bin/python -t
import sys, os
import gtk, gobject
import pwd
import types
def change_user(user):
try:
pwrec = pwd.getpwnam(user)
except KeyError:
raise Exception("Username '%s' does not exist." % user)
uid = pwrec[2]
os.setuid(uid)
return pwrec[6]
def shell_watch_cb(pid, condition, user_data=None):
g... | Python | 0 | @@ -253,16 +253,17 @@
urn
+(
pwrec%5B6%5D
%0A%0Ade
@@ -258,16 +258,27 @@
pwrec%5B6%5D
+, pwrec%5B5%5D)
%0A%0Adef sh
@@ -745,21 +745,29 @@
r_pid%0A%0A%09
+(
shell
+, home)
= chang
@@ -1185,16 +1185,16 @@
DISPLAY%0A
-
%09os.envi
@@ -1231,16 +1231,43 @@
%5D = addr
+%0A%09os.environ%5B%22HOME%22%5D = home
%0A... |
08ec17c3ad674ff249307d03be8decb9c241a5d6 | add simple test | test/test_normalized_intensities.py | test/test_normalized_intensities.py | Python | 0.000011 | @@ -0,0 +1,833 @@
+import os%0Aimport unittest%0A%0Aimport numpy as np%0A%0Afrom sdi.binary import Dataset%0A%0A%0Aclass TestRead(unittest.TestCase):%0A %22%22%22 Test basic reading of binary files%0A %22%22%22%0A%0A def setUp(self):%0A self.test_dir = os.path.dirname(__file__)%0A%0A def test_normali... | |
9bad5f9233519f55a8fcdf74f8ce67a280529594 | Add a storage class for ProfileData | app/soc/profiling/storage.py | app/soc/profiling/storage.py | Python | 0 | @@ -0,0 +1,1511 @@
+#!/usr/bin/python2.5%0A#%0A# Copyright 2010 the Melange authors.%0A# Copyright 2009 Jake McGuire.%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# htt... | |
2efca59352ec413ea0d4d759e525730af02e841a | Remove print | homeassistant/components/binary_sensor/rest.py | homeassistant/components/binary_sensor/rest.py | """
homeassistant.components.binary_sensor.rest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The rest binary sensor will consume responses sent by an exposed REST API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.rest/
"""
from datetime im... | Python | 0.000016 | @@ -2869,54 +2869,8 @@
%22%22%22%0A
- print(%22### UPDATE %22, self.rest.data)%0A%0A
|
5681936147081229eba1b4c0dc7faff89a281b21 | Create solution.py | leetcode/easy/maxium_subarray/py/solution.py | leetcode/easy/maxium_subarray/py/solution.py | Python | 0.000018 | @@ -0,0 +1,475 @@
+class Solution(object):%0A def maxSubArray(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A if len(nums) == 0:%0A return 0%0A %0A maxSub = nums%5B0%5D%0A maxSoFar = nums%5B0%5D%0A ... | |
71a1a8efe93312373f2ec83536b265be0246c895 | Add "xcsoar.flightpath.FlightPathFix" constructor tests | tests/lib/xcsoar/flightpath_test.py | tests/lib/xcsoar/flightpath_test.py | Python | 0.000001 | @@ -0,0 +1,1640 @@
+from datetime import datetime%0A%0Afrom skylines.lib.xcsoar_ import FlightPathFix%0A%0Afrom pytest import approx%0A%0A%0Adef test_list_to_fix():%0A values = %5Bdatetime(2016, 5, 4, 8, 10, 50), 29450,%0A dict(latitude=50.82191666668235, longitude=6.181650000001908),%0A 23... | |
3b3294f337c1658b952ea05a385252bd618d4def | Create ThrSumClose_001.py | leetcode/016-3Sum-Closest/ThrSumClose_001.py | leetcode/016-3Sum-Closest/ThrSumClose_001.py | Python | 0 | @@ -0,0 +1,561 @@
+#@author: cchen%0A#It will be updated later%0A%0Aclass Solution:%0A # @return an integer%0A def threeSumClosest(self, num, target):%0A num.sort()%0A mindiff=100000%0A res=0%0A for i in range(len(num)):%0A left=i+1; right=len(num)-1%0A while left... | |
8ae846689b03d11cd9c231cffa7113339948df99 | Create simple_join_Spark.py | MapReduce_Examples/simple_join_Spark.py | MapReduce_Examples/simple_join_Spark.py | Python | 0.000009 | @@ -0,0 +1 @@
+%0A
| |
0571c0828f8a39d080d804e32e937b65bfe897ef | add development.py configuration | glim/prototype/app/config/development.py | glim/prototype/app/config/development.py | Python | 0.000001 | @@ -0,0 +1,1491 @@
+%22%22%22%0A Here, %22development%22 is the environment. You can run configuration%0A using the following;%0A%0A $ glim start --env development # loads the development configuration%0A%0A%22%22%22%0A%0Aimport os%0Aimport glim.paths%0A%0Aconfig = %7B%0A%0A # the configurations of extensions%0A ... | |
c4e6b2b68e6acd8f83091fc055897628b8df05bb | Add migration for django-simple-history == 1.9.0 | lowfat/migrations/0105_auto_20170615_1400.py | lowfat/migrations/0105_auto_20170615_1400.py | Python | 0.000056 | @@ -0,0 +1,1245 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.2 on 2017-06-15 14:00%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('lowfat', '0104_auto_20170607_1428'),%0A %5D%0A%... | |
9b91aa78fcb541f03deb137dc9c5c02918e7ffe0 | Add widget | geotrek/maintenance/widgets.py | geotrek/maintenance/widgets.py | Python | 0.000001 | @@ -0,0 +1,718 @@
+from mapentity.widgets import LeafletWidget%0A%0Afrom .models import Topology%0A%0A%0Aclass InterventionWidget(LeafletWidget):%0A %22%22%22 A widget allowing to create topologies on a map.%0A %22%22%22%0A is_point_topology = True%0A%0A def serialize(self, value):%0A if value:%0A ... | |
11b2bc33fe08e116347c21cc8ae5baa6e9352bb8 | add scheduler module __init__ | awx/main/scheduler/__init__.py | awx/main/scheduler/__init__.py | Python | 0 | @@ -0,0 +1,101 @@
+# Copyright (c) 2017 Ansible, Inc.%0A#%0A%0Afrom awx.main.scheduler.task_manager import TaskManager # noqa%0A
| |
97781668a6ae80d4fa6330ccd70a6d01fe9a44a1 | Add C11 executor support; #276 | dmoj/executors/C11.py | dmoj/executors/C11.py | Python | 0 | @@ -0,0 +1,293 @@
+from .gcc_executor import GCCExecutor%0A%0A%0Aclass Executor(GCCExecutor):%0A command = 'gcc11'%0A flags = %5B'-std=c11'%5D%0A ext = '.c'%0A name = 'C11'%0A test_program = '''%0A#include %3Cstdio.h%3E%0A%0Aint main() %7B%0A int ch;%0A while ((ch = getchar()) != EOF)%0A put... | |
22946180e9e5e660be14d453ddf5bb37564ddf33 | Add a script to build a map of all the tiles | build-tile-map.py | build-tile-map.py | Python | 0 | @@ -0,0 +1,1065 @@
+#!/usr/bin/env python%0Afrom osgeo import ogr%0Afrom osgeo import osr%0Afrom glob import glob%0Aimport os%0A%0Adriver = ogr.GetDriverByName(%22ESRI Shapefile%22)%0Ads = driver.CreateDataSource(%22tile-map.shp%22)%0A%0Asrs = osr.SpatialReference()%0Asrs.ImportFromEPSG(26915)%0A%0Alayer = ds.CreateLay... | |
e56dcf595a646d03dbd9d49ab27a37adfe87f3e5 | Add shell command | cerbero/commands/shell.py | cerbero/commands/shell.py | Python | 0.000012 | @@ -0,0 +1,1261 @@
+# cerbero - a multi-platform build system for Open Source software%0A# Copyright (C) 2012 Andoni Morales Alastruey %3Cylatuya@gmail.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Library General Public%0A# License as published by... | |
ef0410257af6787724e2e31471e465052dd8e4e3 | add sample to get entropy | chapter_02/get_entropy.py | chapter_02/get_entropy.py | Python | 0 | @@ -0,0 +1,1293 @@
+# coding: utf-8%0Aimport sys%0Aimport math%0A%0A%0Adef shannon_ent(probs):%0A return sum(%0A map(lambda p: -p*math.log2(p if p %3E 0 else 1), probs)%0A )%0A%0A%0Adef seq2dic(seq):%0A dic = %7B%7D%0A for ch in seq:%0A if ch in dic:%0A dic%5Bch%5D += 1%0A el... | |
f0762de9a941745e199ba6ed3e02a475e9838d13 | Package for integration tests | nailgun/nailgun/test/integration/__init__.py | nailgun/nailgun/test/integration/__init__.py | Python | 0 | @@ -0,0 +1,634 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright 2013 Mirantis, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/l... | |
8c297e4403e840022b8b0db65dc098858acf27d7 | refactor by removing duplication. | nucleotide-count/example.py | nucleotide-count/example.py | NUCLEOTIDES = 'ATCGU'
def count(strand, abbreviation):
_validate(abbreviation)
return strand.count(abbreviation)
def nucleotide_counts(strand):
return {
abbr: strand.count(abbr)
for abbr in 'ATGC'
}
def _validate(abbreviation):
if abbreviation not in NUCLEOTIDES:
raise ... | Python | 0 | @@ -12,17 +12,16 @@
= 'ATCG
-U
'%0A%0A%0Adef
@@ -218,14 +218,19 @@
in
-'ATGC'
+NUCLEOTIDES
%0A
|
acabc683b8dae5321a744108d182a610ddfe117d | Update __init__.py | tendrl/commons/objects/__init__.py | tendrl/commons/objects/__init__.py | import abc
import logging
import etcd
import six
from tendrl.commons.central_store import utils as cs_utils
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class BaseObject(object):
def __new__(cls, *args, **kwargs):
if not hasattr(cls, "internal"):
if hasattr(cls, "load_d... | Python | 0.000072 | @@ -190,32 +190,52 @@
Object(object):%0A
+ internal = True%0A
def __new__(
@@ -2822,24 +2822,44 @@
om(object):%0A
+ internal = True%0A
def __ne
|
6bf04c596670bcb7b00c79f9b8f42c9fcd37cc76 | Create hourly_entries.py | Udacity_Data_Analysis/hourly_entries.py | Udacity_Data_Analysis/hourly_entries.py | Python | 0.000082 | @@ -0,0 +1,643 @@
+import pandas as pd%0A%0A# Cumulative entries and exits for one station for a few hours.%0Aentries_and_exits = pd.DataFrame(%7B%0A 'ENTRIESn': %5B3144312, 3144335, 3144353, 3144424, 3144594,%0A 3144808, 3144895, 3144905, 3144941, 3145094%5D,%0A 'EXITSn': %5B1088151, 1088159, 108... | |
6475560c20cc53e8877f246b075a7e432271f694 | Create auth.py | src/auth.py | src/auth.py | Python | 0.000001 | @@ -0,0 +1,103 @@
+class TwitterAuth:%0A%09consumer_key=%22#%22%0A%09consumer_secret=%22#%22%0A%09%0A%09access_token=%22#%22%0A%09access_token_secret=%22#%22%0A
| |
55689cc63b321803e33da2029f2a1d34467d435d | Add migration | fellowms/migrations/0052_merge.py | fellowms/migrations/0052_merge.py | Python | 0.000002 | @@ -0,0 +1,346 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-08-04 14:37%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('fellowms', '0051_event_required_blog_posts'),%0A ('fe... | |
c0b37b879b2e20ee71663e64be76ad11c1e1794c | Add a script that can be used to compare asyncio.sleep to time.sleep | async/3.7/basic/compsleep.py | async/3.7/basic/compsleep.py | Python | 0.000015 | @@ -0,0 +1,731 @@
+#!/usr/bin/env python%0A%0A%22%22%22https://docs.python.org/3.7/library/asyncio-task.html %E5%A4%89%E5%A5%8F%E7%89%88%0A%0AFeatures:%0A- asyncio.gather()%0A- asyncio.sleep()%0A- asyncio.run()%0A%22%22%22%0A%0Aimport asyncio%0Aimport logging%0Aimport time%0A%0Aconcurrent = 3%0Adelay = 5%0A%0A# PYTHONA... | |
505ee67af2a3c8a9c8725d7506725c3109a0891d | add drivetimer | drivetimer/scratch.py | drivetimer/scratch.py | Python | 0.000001 | @@ -0,0 +1,1883 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ASpyder Editor%0A%0AThis is a temporary script file.%0A%22%22%22%0A%0Aimport requests%0A%0AstockSymbol = 'NASDAQ:ETSY' #string as MARKET:STOCK see alphavantage API guide for details%0AalphaVantageAPI = '3R81P8I8EK4HV3ES' #alphavantage API key%0A%0A#==============... | |
e6dff5f5eac3e5ce93ed925374a27abe53eeb1a7 | Add dictlike: dictionary like object for JSON wrappers | src/dictlike.py | src/dictlike.py | Python | 0 | @@ -0,0 +1,1304 @@
+class DictLike(object):%0A%09%22%22%22 Base class for a dictionary based object.%0A%09 Think about wrappers around JSON data. %22%22%22%0A%09def __init__(self, data):%0A%09%09object.__setattr__(self, '_data', data)%0A%09def __getattr__(self, name):%0A%09%09try:%0A%09%09%09return self._data%5Bname... | |
eaf5d72ed584e67619100bb7cdb7deebd9506614 | Add `appengine_config.py` | appengine_config.py | appengine_config.py | Python | 0 | @@ -0,0 +1,210 @@
+%0Adef webapp_add_wsgi_middleware(app):%0A %22%22%22%22 Wrap WSGI application with the appstats middleware. %22%22%22%0A from google.appengine.ext.appstats import recording%0A return recording.appstats_wsgi_middleware(app)%0A
| |
ee1df360979ec24fd8233210372eedd3071cee87 | Add test file to check consistent use of default arguments | tests/test_argspec.py | tests/test_argspec.py | Python | 0 | @@ -0,0 +1,1758 @@
+%22%22%22Make sure that arguments of open/read/write don't diverge%22%22%22%0A%0Aimport pysoundfile as sf%0Afrom inspect import getargspec%0A%0A%0Aopen = getargspec(sf.open)%0Ainit = getargspec(sf.SoundFile.__init__)%0Aread_function = getargspec(sf.read)%0Aread_method = getargspec(sf.SoundFile.read)... | |
2b99781e67e1e2e0bb3863c08e81b3cf57a5e296 | Add request bouncer test cases | tests/test_bouncer.py | tests/test_bouncer.py | Python | 0 | @@ -0,0 +1,1370 @@
+from rest_framework import status%0Afrom rest_framework.test import APITestCase%0Afrom django.contrib.auth import get_user_model%0A%0Afrom api_bouncer.models import Api%0A%0AUser = get_user_model()%0A%0A%0Aclass BouncerTests(APITestCase):%0A def setUp(self):%0A self.superuser = User.object... | |
b330b96c46832568369d95ff98a1553ae8439880 | Set "Credit Account" on "Sale Payment" in test | tests/test_invoice.py | tests/test_invoice.py | # -*- coding: utf-8 -*-
"""
Invoice test suite
:copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, USER, DB_NAME, CONTEXT
from trytond.transaction... | Python | 0.000001 | @@ -4679,16 +4679,80 @@
ateway,%0A
+ 'credit_account': party2.account_receivable.id,%0A
|
57378cdd87ec76751b7ad6b03fe3e46bad9b29e5 | add process test | tests/test_process.py | tests/test_process.py | Python | 0.000001 | @@ -0,0 +1,335 @@
+import unittest%0A%0Aimport needy.process%0A%0A%0Aclass ProcessTest(unittest.TestCase):%0A%0A def test_list_command_output(self):%0A self.assertEqual('hello', needy.process.command_output(%5B'printf', 'hello'%5D))%0A%0A def test_shell_command_output(self):%0A self.assertEqual('hel... | |
fa176de3145c1b98e31cb210c82b7367842b9b6b | add test_regular.py | tests/test_regular.py | tests/test_regular.py | Python | 0.000081 | @@ -0,0 +1,34 @@
+%0Adef test_regular():%0A return 0%0A
| |
28345a0ecb92ef8e7d45fa27d082e21cc1bdd8cd | Add python solution | weighted_uniform_strings/prithaj.py | weighted_uniform_strings/prithaj.py | Python | 0.001003 | @@ -0,0 +1,558 @@
+#!/bin/python%0A%0Aimport sys%0Aimport string%0A%0Aweights = %7Bstring.lowercase%5Bi%5D:i+1 for i in xrange(len(string.lowercase))%7D%0A%0Adef return_weights(a):%0A my_weights, prev, count = set(), '', 1%0A for i in a:%0A if i != prev:%0A prev = i%0A count = 1%0A ... | |
ab1bc996d477c84187df381ec77e7aaab299783b | Add test for calc_md5() function | tests/test_utils.py | tests/test_utils.py | Python | 0.000012 | @@ -0,0 +1,111 @@
+from mws.mws import calc_md5%0A%0A%0Adef test_calc_md5():%0A assert calc_md5(b'mws') == b'mA5nPbh1CSx9M3dbkr3Cyg=='%0A
| |
048a9adbe15201ad0011776587e167725b12f624 | Add script copy_dotfiles_to_repo.py | bin/copy_dotfiles_to_repo.py | bin/copy_dotfiles_to_repo.py | Python | 0.000001 | @@ -0,0 +1,2186 @@
+#!/usr/bin/env python2%0A# coding: utf-8%0A%22%22%22%0ACopy the dotfiles that dotbot control from home directory to repository.%0AThis is used on Windows/msys2, where symlinks aren't supported and I want to%0Acheck in possibly local edits to the repository.%0A%22%22%22%0Afrom __future__ import absol... | |
4ed3a5600222756fce826dbe9fb409730b0174e7 | Add init.py | uber-py/__init__.py | uber-py/__init__.py | Python | 0.000063 | @@ -0,0 +1,210 @@
+__author__ = 'Vivan'%0A__version__ = '1.0.0'%0A%0A'''%0ASpecify modules to be imported.%0A'''%0A%0Aimport json%0A%0Atry:%0A import httplib2%0Aexcept ImportError:%0A print %22Please ensure that the httplib2 package is installed.%22%0A%0A
| |
f4462b621b42ae73c9f7853b7e2dac5b730f07d3 | Implement SimProcedure rewind() | simuvex/procedures/libc___so___6/rewind.py | simuvex/procedures/libc___so___6/rewind.py | Python | 0.000001 | @@ -0,0 +1,360 @@
+import simuvex%0A%0Afrom . import _IO_FILE%0A%0A######################################%0A# rewind%0A######################################%0A%0Aclass rewind(simuvex.SimProcedure):%0A #pylint:disable=arguments-differ%0A%0A def run(self, file_ptr):%0A fseek = simuvex.SimProcedures%5B'libc.... | |
f43a7dbce4e78bd658b01652c63d852aea5fed0e | add copyFilesFromList.py script | copyFilesFromList.py | copyFilesFromList.py | Python | 0.000001 | @@ -0,0 +1,1979 @@
+# !/usr/local/bin/python3.4.2%0A# ----Copyright (c) 2016 Carnegie Hall %7C The MIT License (MIT)----%0A# ----For the full license terms, please visit https://github.com/CarnegieHall/quality-control/blob/master/LICENSE----%0A# argument 0 is the script name%0A# argument 1 is the path to the grandparen... | |
20c5dee179bcb4a6b153bad04fb400cf16e5e01b | Test for basefixture | tests/fixtures/test_basefixture.py | tests/fixtures/test_basefixture.py | Python | 0 | @@ -0,0 +1,399 @@
+from unittest import TestCase%0A%0Afrom dynamic_fixtures.fixtures.basefixture import BaseFixture%0A%0A%0Aclass BaseFixtureTestCase(TestCase):%0A%0A def test_load_not_implemented(self):%0A %22%22%22%0A Case: load is not implemented%0A Expected: Error get raised%0A %22%22... | |
777ddec03e59ceace746dca4e73d39c71400d10e | Initialize P03_combinePdfs | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePdfs.py | books/AutomateTheBoringStuffWithPython/Chapter13/P03_combinePdfs.py | Python | 0.000002 | @@ -0,0 +1,803 @@
+#! python3%0A# combinePdfs.py - Combines all the PDFs in the current working directory into%0A# a single PDF.%0A%0Aimport PyPDF4, os%0A%0A# Get all the PDF filenames.%0ApdfFiles = %5B%5D%0Afor filename in os.listdir('.'):%0A if filename.endswith(%22.pdf%22):%0A pdfFiles.append(filename)%0Ap... | |
4c473b54ba64e642efb454a309d2027cd902cc17 | add __init__.py | blaze/data/__init__.py | blaze/data/__init__.py | Python | 0.00212 | @@ -0,0 +1,215 @@
+from __future__ import absolute_import, division, print_function%0A%0Afrom .core import *%0Afrom .csv import *%0Afrom .sql import *%0Afrom .json import *%0Afrom .hdf5 import *%0Afrom .filesystem import *%0Afrom .usability import *%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.