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 |
|---|---|---|---|---|---|---|---|
3ca7eaca8026088dba1719a5dd2e3da1a6ffe404 | add householder qr algorithm - not working yet. | qr/hqr.py | qr/hqr.py | Python | 0 | @@ -0,0 +1,414 @@
+from numpy import *%0A%0Adef inner(v,w):%0A return sum(v.conj() * w)%0A%0Adef qr(a):%0A (m,n) = shape(a)%0A v = zeros((m,n))%0A for k in range(n):%0A print(%22k=%25d%22 %25 k)%0A x = a%5Bk:m,k%5D%0A x%5B0%5D += sign(x%5B0%5D)*linalg.norm(x)%0A vk = x / linalg.n... | |
c111bc4dd1c040b2ddf1a83c4d93692a77eb269f | Create __init__.py | fade/database/versions/__init__.py | fade/database/versions/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
3067c29b47974d75e8f9a6f01596e9be10411b81 | Add admin.py file | admin.py | admin.py | Python | 0.000001 | @@ -0,0 +1,1965 @@
+# Copyright (c) 2010, Scott Ferguson%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 met:%0A# * Redistributions of source code must retain the above copyright%0A# ... | |
d942340fb5cfe8aa9aade11b3117b9848097c8a1 | Write an abstraction for storing locality state in ES | alerts/geomodel/journal.py | alerts/geomodel/journal.py | Python | 0.000054 | @@ -0,0 +1,1043 @@
+'''To make GeoModel code more testable, we abstract interaction with%0AElasticSearch away via a %22journal interface%22. This is just a function that,%0Acalled with an ES index and a list of %60Entry%60, stores the contained locality%0Astate data in ElasticSearch.%0A'''%0A%0Afrom typing import Call... | |
b1f964e9725a18014de17d454bb733b7ad43cd38 | Write Pytac script to write all readback pvs to file | pytac/write_to_file_readback_pvs.py | pytac/write_to_file_readback_pvs.py | Python | 0 | @@ -0,0 +1,867 @@
+import pytac.load_csv%0Aimport pytac.epics%0A%0A%0Adef write_data_to_file(file_name, data):%0A fin = open(file_name, 'w')%0A for row in data:%0A fin.write('%7B0%7D%5Cn'.format(row))%0A fin.close()%0A%0A%0Adef get_readback_pvs(mode):%0A lattice = pytac.load_csv.load(mode, pytac.epic... | |
a88aed479937b09b560c8820d3d5c1003a94b9f1 | add google hangout parser | parse_hangouts.py | parse_hangouts.py | Python | 0.000004 | @@ -0,0 +1,1107 @@
+#!/usr/bin/env python%0A# usage: %60python parse_hangouts.py path/to/takeout/%60%0A%0Aimport json%0Aimport sys%0A%0A%0A# holy wow this format is a mess without any docs%0Adef parse_hangouts(path):%0A data = json.loads(open(path, 'r').read())%0A ids = %7B%7D%0A for conversation in data%5B'co... | |
514a04b5ffa7c9e3ede068c860933e9a404e6063 | add missing file. | biokit/stats/criteria.py | biokit/stats/criteria.py | Python | 0.000001 | @@ -0,0 +1,217 @@
+import math%0A%0A%0Adef AIC(L, k):%0A return 2*k - 2 * math.log(L)%0A%0A%0Adef AICc(L, k, n):%0A return AIC(L, k) + 2*k*(k+1.)/(n-k-1.)%0A%0A%0Adef BIC(L, k, n):%0A return -2 * math.log(L) + k * (math.log(n) - math.log(2*math.pi))%0A%0A
| |
ee8b3fd94bac16390b367dc5030489738ff67958 | add example to get UETable from data base | tools/getUETable_cfg.py | tools/getUETable_cfg.py | Python | 0 | @@ -0,0 +1,1579 @@
+import FWCore.ParameterSet.Config as cms%0Aprocess = cms.Process(%22jectxt%22)%0Aprocess.load('Configuration.StandardSequences.Services_cff')%0Aprocess.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')%0A# define your favorite global tag%0Aprocess.GlobalTag.globaltag = '74X_da... | |
5e1440874bc4e3f5ab2de23f72ad7f950ccce12e | add missing migration for the `fake` backend | squad/ci/migrations/0019_add_fake_backend.py | squad/ci/migrations/0019_add_fake_backend.py | Python | 0.000001 | @@ -0,0 +1,536 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.10 on 2018-02-26 21:03%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('ci', '0018_testjob_dates'),%0A %5D%0A%0A ope... | |
0083a6fadad8bb0f202bab2af183a10f09e19459 | Add simple demo of piglow - lighting arms | piglow/demo_piglow.py | piglow/demo_piglow.py | Python | 0 | @@ -0,0 +1,288 @@
+from piglow import PiGlow%0Aimport time%0A%0Adef brighten_arm( arm ):%0A%0A for i in range( 1, 10 ):%0A piglow.arm( arm, i )%0A time.sleep( 0.11 )%0A%0A time.sleep( 0.5 )%0A piglow.arm( arm, 0 )%0A%0Apiglow = PiGlow()%0A%0Apiglow.all(0)%0A%0Abrighten_arm( 1 )%0Abrighten_arm( 2 ... | |
e9e67243f9a5af7c38294c35fbbbb09f5ea224ee | Add missing pandas import | libs/utils/analysis/cpus_analysis.py | libs/utils/analysis/cpus_analysis.py | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | Python | 0.000001 | @@ -710,16 +710,36 @@
ab as pl
+%0Aimport pandas as pd
%0A%0Afrom t
|
b3f8be5b6ab7e4e713004447a3cfbda743d80394 | Add management command to update corpus logic hashes | rules/management/commands/CorpusLogicUpdate.py | rules/management/commands/CorpusLogicUpdate.py | Python | 0 | @@ -0,0 +1,940 @@
+import logging%0Afrom django.core.management.base import BaseCommand, CommandError%0A%0Afrom plyara import YaraParser%0Afrom rules.models import YaraRule%0A%0A# Configure Logging%0Alogging.basicConfig(level=logging.INFO)%0A%0A%0Aclass Command(BaseCommand):%0A%0A help = 'Recalculate the logic hashe... | |
aefb6fbf38f8756458e487328139caf41afb6cee | Create MD5-DICT.py | MD5-DICT.py | MD5-DICT.py | Python | 0 | @@ -0,0 +1,572 @@
+from hashlib import md5%0A# by TheZakMan%0A# Exemplo de md5: 21232f297a57a5a743894a0e4a801fc3 (admin)%0A# dict: /usr/share/wordlists/rockyou.txt%0A%0Aprint %22%5BMd5 Dict-Cracker%5D%22%0Aprint %22%7C wordlist.txt %7C%5Cn%22%0Acrackme = raw_input(%22MD5:%22)%0A%0A#f = open('wordlist.txt', 'r')%0Af =... | |
14e32e60181083c8d0271fc974f3f1161ea81c74 | Add first pass on create_tab script | tools/tab/create_tab.py | tools/tab/create_tab.py | Python | 0 | @@ -0,0 +1,754 @@
+#!/usr/bin/env python%0A%0Aimport datetime%0Aimport io%0Aimport os%0Aimport sys%0Aimport tarfile%0A%0ATAB_VERSION = 1%0A%0Aoutput_filename = sys.argv%5B1%5D%0Aname = sys.argv%5B2%5D%0Ainputs = sys.argv%5B3:%5D%0A%0Ametadata = %5B%5D%0A%0A%0Ametadata.append('tab-version = %7B%7D'.format(TAB_VERSION))%... | |
916250bc9509986f1dfce3b09ddbc7a49aa79d42 | Add admin for payments | payments/admin.py | payments/admin.py | Python | 0 | @@ -0,0 +1,153 @@
+# -*- coding: utf-8 -*-%0Afrom django.contrib import admin%0A%0Afrom .models import Payment, Refund%0A%0A%0Aadmin.site.register(Payment)%0Aadmin.site.register(Refund)%0A
| |
25f0615f4fb35779ce8688c5d29f92288ac2c30d | Add filesystem checks class | util/filesystem.py | util/filesystem.py | Python | 0.000001 | @@ -0,0 +1,1213 @@
+import os%0A%0A%0Aclass FSCheck:%0A def __init__(self, filepath, name: None):%0A if name is None:%0A name = filepath%0A%0A self.filepath = filepath%0A self.name = name%0A%0A def exists(self, error: True):%0A if not os.path.exists(self.filepath):%0A ... | |
cd7d80da95a3702a31fe0b8a62f4eadfeaa65b85 | simplify user profile source | authentic2/attribute_aggregator/user_profile.py | authentic2/attribute_aggregator/user_profile.py | '''
VERIDIC - Towards a centralized access control system
Copyright (C) 2011 Mikael Ates
This program 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
Licen... | Python | 0.000028 | @@ -2440,123 +2440,26 @@
-user_profile = user%0A field_names = set()%0A field_names.update(user_profile._meta.get_all_field_names()
+field_names = set(
)%0A
@@ -3758,24 +3758,16 @@
d = user
-_profile
._meta.g
@@ -3940,51 +3940,8 @@
ue =
- getattr(user_profile, field_name, None) or
get
|
edabec29ebb99e938fd3523951597e336ddd3adc | Add text vectorizers benchmarks (#9086) | benchmarks/bench_text_vectorizers.py | benchmarks/bench_text_vectorizers.py | Python | 0 | @@ -0,0 +1,2112 @@
+%22%22%22%0A%0ATo run this benchmark, you will need,%0A%0A * scikit-learn%0A * pandas%0A * memory_profiler%0A * psutil (optional, but recommended)%0A%0A%22%22%22%0A%0Afrom __future__ import print_function%0A%0Aimport timeit%0Aimport itertools%0A%0Aimport numpy as np%0Aimport pandas as pd%0Afrom memo... | |
9bee248bce5edbf073f66e5d7a621f22bbba314f | Fix a failing test | zmq/devices/__init__.py | zmq/devices/__init__.py | """0MQ Device classes for running in background threads or processes."""
#
# Copyright (c) 2010 Brian E. Granger
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Soft... | Python | 0.999524 | @@ -1075,16 +1075,38 @@
redqueue
+, monitoredqueuedevice
%0A%0Afrom z
|
8c168933c85f828ec85d6c069143e3c4174657b7 | Create 10.CubeProperties.py | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/10.CubeProperties.py | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/10.CubeProperties.py | Python | 0 | @@ -0,0 +1,442 @@
+import math%0A%0AcubeSide = float(input())%0Aparameter = input()%0A%0Aif parameter == %22face%22:%0A face = math.sqrt(math.pow(cubeSide, 2) * 2)%0A print(%22%25.2f%22 %25 face)%0A%0Aelif parameter == %22space%22:%0A space = math.sqrt(math.pow(cubeSide, 2) * 3)%0A print(%22%25.2f%22 %25 sp... | |
9df4f11d878ee8d13dcbcee49745bdcc8ab3e507 | Remove logging from test config | .travis/localsettings.py | .travis/localsettings.py | import os
####### Configuration for CommCareHQ Running on Travis-CI #####
####### Database config. This assumes Postgres #######
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'commcarehq',
'USER': 'postgres',
'PASSWORD': '',
'HOST':... | Python | 0.000001 | @@ -1770,8 +1770,334 @@
S=False%0A
+%0A# No logging%0ALOGGING = %7B%0A 'version': 1,%0A 'handlers': %7B%0A 'null': %7B%0A 'level': 'DEBUG',%0A 'class': 'django.utils.log.NullHandler',%0A %7D,%0A %7D,%0A 'loggers': %7B%0A '': %7B%0A 'level': 'CRITICAL',%... |
16f29bfc832a64accd6ef67c2140f70ea07f2f05 | Add PyUnit for deep feature extraction of a LeNet model with mxnet. | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py | Python | 0 | @@ -0,0 +1,1093 @@
+from __future__ import print_function%0Aimport sys, os%0Asys.path.insert(1, os.path.join(%22..%22,%22..%22,%22..%22))%0Aimport h2o%0Afrom tests import pyunit_utils%0Afrom h2o.estimators.deepwater import H2ODeepWaterEstimator%0A%0Adef deepwater_lenet():%0A if not H2ODeepWaterEstimator.available(): r... | |
9a1635dcdb21548fcb7b1f718624c991602588e6 | Initialize P01_isPhoneNumber | books/AutomateTheBoringStuffWithPython/Chapter07/P01_isPhoneNumber.py | books/AutomateTheBoringStuffWithPython/Chapter07/P01_isPhoneNumber.py | Python | 0.00737 | @@ -0,0 +1,704 @@
+# This program returns True if a string is a phone number and False if not%0A# However, it's not very efficient%0A%0A%0Adef isPhoneNumber(text):%0A if len(text) != 12:%0A return False%0A for i in range(0, 3):%0A if not text%5Bi%5D.isdecimal():%0A return False%0A if t... | |
715e43bc81227d86f6a8a102aab488d47db801f4 | Make a jobspec | tools/run_tests/run_microbenchmark.py | tools/run_tests/run_microbenchmark.py | #!/usr/bin/env python2.7
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | Python | 0.998946 | @@ -3416,16 +3416,32 @@
.append(
+jobset.JobSpec(%5B
'rm', '%25
@@ -3458,24 +3458,26 @@
fnize(line)
+%5D)
)%0A if len
|
c564c7361769c116a07ebb127c9453ec09b75699 | Return true when iCloud finishes setting up | homeassistant/components/device_tracker/icloud.py | homeassistant/components/device_tracker/icloud.py | """
homeassistant.components.device_tracker.icloud
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device tracker platform that supports scanning iCloud devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.icloud/
"""
import logging
imp... | Python | 0 | @@ -1075,24 +1075,30 @@
return
+ False
%0A%0A try:%0A
@@ -1447,16 +1447,22 @@
return
+ False
%0A%0A de
@@ -3052,12 +3052,29 @@
ond=0%0A )%0A
+%0A return True%0A
|
af6272941a66967c3a64d735223fefc917056562 | add example | examples/python/rgb-lcd.py | examples/python/rgb-lcd.py | Python | 0 | @@ -0,0 +1,1231 @@
+# Author: Brendan Le Foll %3Cbrendan.le.foll@intel.com%3E%0A# Copyright (c) 2014 Intel Corporation.%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining%0A# a copy of this software and associated documentation files (the%0A# %22Software%22), to deal in the Software without r... | |
771eede117c29af75c1d8d21f0da538bd280b5c1 | Create search.py | search.py | search.py | Python | 0 | @@ -0,0 +1,2516 @@
+# Requires Parallel to be installed%0A# Use the below command to start with all available cores used%0A# seq %60nproc%60 %7C parallel -u python script.py%0A%0A__authors__ = %5B'Chick3nputer', 'Supersam654'%5D%0A%0Afrom itertools import islice, product%0Aimport string%0Aimport hashlib%0Afrom random i... | |
5ee78767ebaa5c1bbceb7ce2c82fa6687169b0c2 | Add exercice The Paranoid Android | codingame/medium/paranoid_android.py | codingame/medium/paranoid_android.py | Python | 0.000567 | @@ -0,0 +1,2709 @@
+class Elevator(object):%0A def __init__(self, floor, pos):%0A super(Elevator, self).__init__()%0A self.floor = floor%0A self.pos = pos%0A self.direction = None%0A%0A def __str__(self):%0A return 'Elevator on floor %25i (pos %25i) with dir %25s' %25 (self.floo... | |
f7132b86ca5f4dafeb88ca65b3d7fe71c6886cc5 | Add packageinfo command | cerbero/commands/info.py | cerbero/commands/info.py | Python | 0.000001 | @@ -0,0 +1,2240 @@
+# 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... | |
cb79c9bf74cb18f3ee86c7c3d5415ce1b088dde2 | Add missing markdown file. | allmychanges/markdown.py | allmychanges/markdown.py | Python | 0 | @@ -0,0 +1,185 @@
+import CommonMark%0A%0A%0Adef render_markdown(text):%0A parser = CommonMark.DocParser()%0A renderer = CommonMark.HTMLRenderer()%0A ast = parser.parse(text)%0A return renderer.render(ast)%0A
| |
114ea6c10658d2c199c68637d04bdd968fcc4452 | Test case for task.info.json files | voyager_tasks/test/test_info_files.py | voyager_tasks/test/test_info_files.py | Python | 0 | @@ -0,0 +1,1805 @@
+import os%0Aimport sys%0Aimport glob%0Aimport json%0Aimport unittest%0Asys.path.append(os.path.dirname(os.path.dirname(__file__)))%0Aimport voyager_tasks%0A%0A%0Aclass TestInfoFiles(unittest.TestCase):%0A %22%22%22Test case for checking info files exist%0A for each task and have a valid struct... | |
24f536a72b0467ff3ee1615f515ecff9fbf36bb3 | Add pair sum | ch07_04.py | ch07_04.py | Python | 0.999136 | @@ -0,0 +1,317 @@
+number_of_data = int(input().strip())%0A%0Ama = %5B0%5D * number_of_data%0Anumbers = %5Bint(c) for c in input().strip().split()%5D%0A%0Afor i in range(1, number_of_data - 1):%0A ma%5Bi%5D = (sum(numbers%5Bi-1:i+2%5D)/3)%0A%0Ama%5B0%5D = sum(numbers%5B0:2%5D)/2%0Ama%5B-1%5D = sum(numbers%5Bnumber_o... | |
afa0efbdfc6bc4d19eaba919bc82c907fce37fa7 | add base for API endpoint | datasets/api.py | datasets/api.py | Python | 0.000001 | @@ -0,0 +1,195 @@
+import json%0A%0Afrom flask import request, Response, url_for%0Afrom jsonschema import validate, ValidationError%0A%0Aimport models%0Aimport decorators%0Afrom datasets import app%0Afrom database import session%0A%0A
| |
ce9ac96a6f1e57ebbce162b7e097675c23f1f2f4 | Implement simple gaussian process regression. | projects/jakub/gaussian_processes/gaussian_process_regression.py | projects/jakub/gaussian_processes/gaussian_process_regression.py | Python | 0 | @@ -0,0 +1,1864 @@
+import csv%0Aimport sys%0A%0Aimport matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport sklearn%0Aimport sklearn.gaussian_process.kernels%0A%0A%0Akernel = (sklearn.gaussian_process.kernels.ConstantKernel()%0A + sklearn.gaussian_process.kernels.Matern(length_scale=2, nu=3/2)%0A +... | |
c4aca4fe1bf02286f218ca855a41e380987818f7 | Add test example | fcap/tests/test_example.py | fcap/tests/test_example.py | Python | 0.000002 | @@ -0,0 +1,155 @@
+import unittest%0A%0A%0Aclass BasicTestSuite(unittest.TestCase):%0A %22%22%22Basic test cases.%22%22%22%0A%0A def test_absolute_truth_and_meaning(self):%0A assert True%0A
| |
fa27978c50364c903e2c343560f66db6ddc76bdb | add setup.py | play_tox/setup.py | play_tox/setup.py | Python | 0.000001 | @@ -0,0 +1,45 @@
+from setuptools import setup%0Asetup(name=%22x%22)%0A
| |
6c4edaefe30905f62b885b931a1c5ca6d65cd220 | Add tests for project model | server/tests/models/test_project.py | server/tests/models/test_project.py | Python | 0 | @@ -0,0 +1,2113 @@
+from server.models import Project%0Afrom server.tests.helpers import fixtures, FlaskTestCase%0A%0A%0Aclass TestProject(FlaskTestCase):%0A @fixtures('single_project.json')%0A def test_get_single_owner(self):%0A %22%22%22Test getting single project owner%0A %22%22%22%0A with... | |
ee62d6a972e5af72fc9a5e2e36d1a7822a1703af | Add sample on veh handle setup in remote process | samples/remote_veh_segv.py | samples/remote_veh_segv.py | Python | 0 | @@ -0,0 +1,1057 @@
+import windows%0Aimport windows.test%0A%0Afrom windows.generated_def.winstructs import *%0A%0A#c = windows.test.pop_calc_64()%0A%0A%0Ac = windows.test.pop_calc_64(dwCreationFlags=CREATE_SUSPENDED)%0A%0A%0Apython_code = %22%22%22%0Aimport windows%0Aimport ctypes%0Aimport windows%0Afrom windows.vector... | |
0e5ba1d9ae7ca7d5439d886abe732f0fcebed49b | Create classes.py | classes.py | classes.py | Python | 0.000001 | @@ -0,0 +1,22 @@
+class String(object):%0A
| |
e29bdc567c3d1f04f9e9ec17792052b0f66f918e | reorder users migration | apostello/migrations/0010_auto_20160421_1411.py | apostello/migrations/0010_auto_20160421_1411.py | Python | 0.000002 | @@ -0,0 +1,435 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-04-21 13:11%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('apostello', '0009_userprofile_message_cost_limit'),%0A %5... | |
c97509b510fb13fffdfbc490146b3940c62b3db9 | too soon. sorry | src/pyechonest/decorators.py | src/pyechonest/decorators.py | Python | 0.998673 | @@ -0,0 +1,852 @@
+# from http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize%0Aclass memoized(object):%0A %22%22%22Decorator that caches a function's return value each time it is called.%0A If called later with the same arguments, the cached value is returned, and%0A not re-evaluated.%0A %22%22%22%0... | |
a519b7c91a8ea84549efcdf145aed56cf89b9d59 | Create users.py | app/api_1_0/users.py | app/api_1_0/users.py | Python | 0.000001 | @@ -0,0 +1,1786 @@
+from flask import jsonify, request, current_app, url_for%0Afrom . import api%0Afrom ..models import User, Post%0A%0A%0A@api.route('/users/%3Cint:id%3E')%0Adef get_user(id):%0A user = User.query.get_or_404(id)%0A return jsonify(user.to_json())%0A%0A%0A@api.route('/users/%3Cint:id%3E/posts/')%0A... | |
52a8a1cd093f8bdbaf0abfc85eff2d3682e24b12 | Add Python script for questions linting | scripts/check-questions.py | scripts/check-questions.py | Python | 0.000001 | @@ -0,0 +1,2182 @@
+#!/usr/bin/env python3%0A%0A%0Aimport os%0Aimport sys%0Aimport json%0Aimport collections%0Aimport unicodedata%0A%0A%0ATEXT_FIELD = %22t%22%0AOPTIONS_FIELD = %22o%22%0AKIND_FIELD = %22k%22%0ACORRECT_FIELD = %22c%22%0AMANDATORY_FIELDS = %7BTEXT_FIELD, OPTIONS_FIELD, CORRECT_FIELD%7D%0A%0A%0Adef norm(s... | |
3a662b5820ea90c0cd63116a610ede25558c5562 | Add tests directory to sourceterm package and start test module. | sourceterm/tests/test_srcequations.py | sourceterm/tests/test_srcequations.py | Python | 0 | @@ -0,0 +1,230 @@
+'''%0ACreated on 25 Aug 2010%0A%0A@author: ith%0A'''%0Aimport unittest%0A%0A%0Aclass Test(unittest.TestCase):%0A%0A%0A def testName(self):%0A pass%0A%0A%0Aif __name__ == %22__main__%22:%0A #import sys;sys.argv = %5B'', 'Test.testName'%5D%0A unittest.main()
| |
150a13e1854a93f9330349486717588900c05c6d | Fix imdb min_score schema to allow numbers | flexget/plugins/filter/imdb.py | flexget/plugins/filter/imdb.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget.plugin import register_plugin, get_plugin_by_name, PluginError, priority
from flexget.utils.log import log_once
log = logging.getLogger('imdb')
class FilterImdb(object):
"""
This plugin allows filtering based on IM... | Python | 0.000015 | @@ -1693,37 +1693,36 @@
ore': %7B'type': '
-integ
+numb
er'%7D,%0A
|
3d11921f67c1928bb79869c3af1f8836360219fd | Add SIF assembler for Boolean network generation | indra/assemblers/sif_assembler.py | indra/assemblers/sif_assembler.py | Python | 0 | @@ -0,0 +1,2819 @@
+import networkx as nx%0Afrom indra.statements import *%0A%0Aclass SifAssembler(object):%0A def __init__(self, stmts=None):%0A if stmts is None:%0A self.stmts = %5B%5D%0A else:%0A self.stmts = stmts%0A self.graph = nx.DiGraph()%0A self.nodes = %7B%... | |
732bee4960cb2448d829f5b30c114958a3ebbab2 | Generate QR | genqr.py | genqr.py | Python | 0.999999 | @@ -0,0 +1,1496 @@
+#!/usr/bin/env python%0A'''Generate QR code using Google Charts API'''%0A%0Aimport sys%0A# Python 3/2 compatibility%0Aif sys.version_info%5B:2%5D %3C (3, 0):%0A from urllib import urlopen, urlencode%0A import httplib%0A stdout = sys.stdout%0Aelse:%0A from urllib.request import urlopen%0A... | |
f552979125531fade029bc8baa51e2d0bb9dd320 | Simplify retrieving of config home in core init method | powerline/core.py | powerline/core.py | # -*- coding: utf-8 -*-
import importlib
import json
import os
import sys
from colorscheme import Colorscheme
from theme import Theme
class Powerline(object):
def __init__(self, ext):
try:
config_home = os.environ['XDG_CONFIG_HOME']
except KeyError:
config_home = os.path.expanduser('~/.config')
config... | Python | 0.000001 | @@ -186,16 +186,8 @@
t):%0A
-%09%09try:%0A%09
%09%09co
@@ -208,17 +208,21 @@
.environ
-%5B
+.get(
'XDG_CON
@@ -234,45 +234,9 @@
OME'
-%5D%0A%09%09except KeyError:%0A%09%09%09config_home =
+,
os.
@@ -263,16 +263,17 @@
config')
+)
%0A%0A%09%09conf
|
5999d8b572d8f28fc4fee0826660a40ec108d15b | Create trimfile.py | bin/preprocess/trimfile.py | bin/preprocess/trimfile.py | Python | 0.000001 | @@ -0,0 +1,53 @@
+#!/usr/bin/python%0A%0A%0A%0A%0A%0A%0A%0Adef trimOne():%0A%0A%0A return 0%0A
| |
d268c5870623b1c5f6da202264cb1b399f037ec8 | Create rename.py | rename.py | rename.py | Python | 0.000003 | @@ -0,0 +1,683 @@
+import sys%0Aimport os%0A%0Aif len ( sys.argv ) == 4:%0A%09args = sys.argv %5B 1: %5D%0Aelse:%0A%09print 'Usage: python rename.py %5Bpath%5D'%0A%09sys.exit ( 0 )%0A%0Apath = '.'%0Afilenames = os.listdir ( str ( path ) )%0A%0A# Check some things%0Atext = open ( args %5B 0 %5D, 'r' ).read ( )%0Aorigina... | |
8e61c18d23812a70d65ec42d7c36c5f1b7ed829d | add script for 50bp window gff summary. | scripts/summarize_gff50.py | scripts/summarize_gff50.py | Python | 0 | @@ -0,0 +1,1157 @@
+import sys%0Aimport os.path as op%0Asys.path.insert(0, %22/home/brentp/src/methylcode/code/%22)%0A%0Afrom methyl import MethylGroup%0Aprefix = sys.argv%5B1%5D # something like: out1234n/thaliana_v9%0Aacontext = sys.argv%5B2%5D # CHH or CHG or CG%0Awindow = 50%0A%0Amg = MethylGroup(prefix)%0A%0A%0Afh... | |
a3d79e11fea266a2996b588a9cbbe6272722ea8b | Fix a bug caught by counter unittesting | sparts/counters.py | sparts/counters.py | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
"""Module for implementing time-... | Python | 0 | @@ -6160,18 +6160,34 @@
-if
+while not done and
now - w
@@ -6290,28 +6290,25 @@
ues(window)%0A
-
+%0A
@@ -6312,32 +6312,82 @@
if done:%0A
+ # TODO: %22prune%22 any remaining samples%0A
|
3dc9204c80f2f7be5f82200c059a6a62f02bf6c1 | Update blogroll and social links. | www/pelicanconf.py | www/pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | Python | 0 | @@ -407,15 +407,13 @@
(('
-Pelican
+NumPy
', '
@@ -423,22 +423,21 @@
p://
-getpelican.com
+www.numpy.org
/'),
@@ -452,18 +452,13 @@
('
-Python.org
+SciPy
', '
@@ -468,19 +468,21 @@
p://
-python
+www.scipy
.org
-/
'),%0A
@@ -496,14 +496,15 @@
('
-Jinja2
+IPython
', '
@@ -514,19 +514,15 @@
p://
-jinja.po... |
04b0ed7ae4966259aa1967dc7e5ebb093be583c8 | Fix glance filesystem store race condition | glance/store/filesystem.py | glance/store/filesystem.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 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/... | Python | 0.000002 | @@ -3880,16 +3880,325 @@
ept
+(
IOError
-:
+, OSError):%0A if os.path.exists(self.datadir):%0A # NOTE(markwash): If the path now exists, some other%0A # process must have beat us in the race condition. But it%0A # doesn't hurt, so we can safely ... |
e1e24a4fd232342dcca4151a0fa5aa3990ceb3b9 | initial hello world | hello.py | hello.py | Python | 0.999715 | @@ -0,0 +1,14 @@
+print %22hello%22%0A
| |
d80388591e3a55969688957b7c1bbd9bcda40296 | Create social_feedback_counter.py compatible with hatebu, fb_like & tweet | social_feedback_counter.py | social_feedback_counter.py | Python | 0 | @@ -0,0 +1,1108 @@
+# coding:utf-8%0A%0Aimport urllib%0Aimport json%0A%0A%0Aclass SocialFeadbackCounter(object):%0A def __init__(self, url):%0A self.url = url%0A%0A def hatebu(self):%0A api_url = 'http://b.hatena.ne.jp/entry/json/' + self.url%0A hb_json = json.loads(urllib.urlopen(api_url).re... | |
1866bb1ad5f5c4338c2173327d620e92c2ba5043 | Create basic PodSixNet server | server.py | server.py | Python | 0 | @@ -0,0 +1,1001 @@
+from PodSixNet.Channel import Channel%0Afrom PodSixNet.Server import Server%0A%0Afrom time import sleep%0A%0A#Create the channel to deal with our incoming requests from the client%0A#A new channel is created every time a client connects%0Aclass ClientChannel(Channel):%0A%0A #Create a function tha... | |
0cc0b16a6f29d31c3c2b3e2ad4eb313b010f7806 | test addBuilds() method | errata_tool/tests/test_add_builds.py | errata_tool/tests/test_add_builds.py | Python | 0.000001 | @@ -0,0 +1,753 @@
+import requests%0A%0A%0Aclass TestAddBuilds(object):%0A%0A def test_add_builds_url(self, monkeypatch, mock_post, advisory):%0A monkeypatch.setattr(requests, 'post', mock_post)%0A advisory.addBuilds(%5B'ceph-10.2.3-17.el7cp'%5D, release='RHEL-7-CEPH-2')%0A assert mock_post.resp... | |
fbbd6526612bbb450c5c4c1ecffd21e32f4c98c6 | Add simple server | server.py | server.py | Python | 0.000001 | @@ -0,0 +1,216 @@
+import SimpleHTTPServer%0Aimport SocketServer%0A%0APORT = 8000%0A%0AHandler = SimpleHTTPServer.SimpleHTTPRequestHandler%0A%0Ahttpd = SocketServer.TCPServer(('', PORT), Handler)%0A%0Aprint %22serving at port%22, PORT%0Ahttpd.serve_forever()%0A
| |
9e6bae8aa92ed0332efd689b6f43063b0569ef0a | add 16.py | 16.py | 16.py | Python | 0.998462 | @@ -0,0 +1,1450 @@
+%22%22%22Python challenge #16:%0Ahttp://www.pythonchallenge.com/pc/return/mozart.html%22%22%22%0Aimport urllib2%0Afrom PIL import Image%0Aurl = 'http://www.pythonchallenge.com/pc/return/mozart.gif'%0Aun = 'huge'%0Apw = 'file'%0Apink = (255, 0, 255)%0A%0A%0Adef main():%0A setup_auth_handler()%0A ... | |
af320490aaa59d69faed9357d9690d945272bec5 | add empty file to test Slack integration | A2.py | A2.py | Python | 0 | @@ -0,0 +1,25 @@
+#!/usr/bin/env python3%0A%0A%0A
| |
31a74f1b9b50036a9b1de603f3437516eaef7807 | Create pb.py | pb.py | pb.py | Python | 0.000715 | @@ -0,0 +1,156 @@
+print %22ParseBasic interpreter v0.1%22%0Aprint %22Copyright 2015 NETponents%22%0Aprint %22Licensed under MIT license%22%0Aprint %22Commercial use of this build is prohibited%22%0A
| |
c4015ed868b65ce5c7ed660c84e252a950294642 | Add basic functionality to query the (horrible) website. | r1.py | r1.py | Python | 0 | @@ -0,0 +1,1625 @@
+from datetime import date%0Aimport bs4%0Aimport itertools as it%0Aimport re%0Aimport requests%0A%0A%0Adef grouper(iterable, n, fillvalue=None):%0A args = %5Biter(iterable)%5D * n%0A return it.izip_longest(fillvalue=fillvalue, *args)%0A%0A%0Adef extract_name(bsitem):%0A return bsitem.find('s... | |
b49571316595b97ba602ac737f9c47ce682ac7b0 | Solving 53 | 53.py | 53.py | Python | 0.999999 | @@ -0,0 +1,128 @@
+class Solution:%0A # @param s : A string%0A # @return : A string%0A def reverseWords(self, s):%0A # write your code here
| |
7dede788648d5569587214722a2a128f419a7b8a | Create v1.py | v1.py | v1.py | Python | 0 | @@ -0,0 +1,1289 @@
+print %22This is Pizza Pi R Squared. What's it do? It lets you determine whether buying a small pizza or a large pizza is a better value in terms of cost per bite of pizza.%22%0A %0Adiameter_one = int(raw_input(%22What's the first pizza's diameter (in inches)?%22))%0Acost_one = int(raw_input(%22Ho... | |
a998bd2686ab924035325d7288131a7141a457bb | Apply orphaned migration | project/apps/api/migrations/0010_remove_chart_song.py | project/apps/api/migrations/0010_remove_chart_song.py | Python | 0 | @@ -0,0 +1,345 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('api', '0009_auto_20150722_1041'),%0A %5D%0A%0A operations = %5B%0A migrations.RemoveField... | |
fe668b882d3c27f8f7bf7f8cf6d338bf3216310e | add testing script in temp location | aki.py | aki.py | Python | 0 | @@ -0,0 +1,1534 @@
+#!/usr/bin/env python%0A# XXX this is a helpful script, but probably belongs in scriptworker/test/data%0Afrom __future__ import print_function%0A%0Aimport aiohttp%0Aimport asyncio%0Afrom copy import deepcopy%0Aimport json%0Aimport logging%0Aimport pprint%0Aimport sys%0Afrom scriptworker.constants im... | |
59b01485c70d42e32acb4c80efbe0e393ca8c437 | Add aes.py | aes.py | aes.py | Python | 0.001639 | @@ -0,0 +1,1372 @@
+# -*- coding: utf-8 -*-%0A%0Aimport base64%0Afrom Crypto import Random%0Afrom Crypto.Cipher import AES%0A%0A%0Aclass AESCipher:%0A def __init__(self, key):%0A self.bs = 32%0A if len(key) %3E= 32:%0A self.key = key%5B:32%5D%0A else:%0A self.key = self._pa... | |
68b8ad567545c7ec07f13089f2b3e4ecd4cc835e | Create api.py | api.py | api.py | Python | 0 | @@ -0,0 +1,1016 @@
+from flask import Flask%0Afrom flask.ext.restful import reqparse, abort, Api, Resource%0Afrom profile import Profile%0A%0Aapp = Flask(__name__)%0Aapi = Api(app)%0A%0A%0A%0Adef abort_if_user_doesnt_exist(user):%0A if not isValid(user):%0A abort(404, message=%22User %7B%7D doesn't exist%22.f... | |
beca6dad76746f5e6cce76749efda391d5c49a6e | Number 5 is done | ex5.py | ex5.py | Python | 0.998276 | @@ -0,0 +1,733 @@
+#!/usr/bin/env python%0A%0A#feel free to sub your own details.. like I have from the original of Mr Shaw's%0Amy_name = %22Davii%22%0Amy_age = 34 #not a lie!%0Amy_height = 186 #CM%0Amy_weight = 90 #kg .. I need to diet.%0Amy_eyes = %22blue%22%0Amy_teeth = %22white%22 #maybe a little coffee staining%0A... | |
265bedb193f8615f99daa63c921b572408921605 | Add tests for quick sort | test_quick_sort.py | test_quick_sort.py | Python | 0 | @@ -0,0 +1,1167 @@
+# -*- coding: utf-8 -*-%0Afrom quick_sort import quick_sort%0A%0A%0Adef test_sorted():%0A my_list = list(range(100))%0A quick_sort(my_list)%0A assert my_list == list(range(100))%0A%0A%0Adef test_reverse():%0A my_list = list(range(100))%5B::-1%5D%0A quick_sort(my_list)%0A assert my_... | |
017fa0b360c23696d3176f48e2c53accac8bcfc5 | Add version module | redcap/version.py | redcap/version.py | Python | 0.000001 | @@ -0,0 +1,18 @@
+VERSION = '0.5.2'%0A
| |
426ef95ba1b2f3ac42c16a3594d186c4c9226a6e | add admin | referral/admin.py | referral/admin.py | Python | 0 | @@ -0,0 +1,411 @@
+from django.contrib import admin%0A%0Afrom models import Campaign, Referrer%0A%0Aclass ReferrerInine(admin.TabularInline):%0A model = Referrer%0A extra = 0%0A%0Aclass CampaignAdmin(admin.ModelAdmin):%0A inlines = (ReferrerInine, )%0A%0Aclass ReferrerAdmin(admin.ModelAdmin):%0A list_displa... | |
747800528b3709759738081ee580e380bf164c02 | add skeletons of new unit tests to be added | pymatgen/analysis/defects/tests/test_compatibility.py | pymatgen/analysis/defects/tests/test_compatibility.py | Python | 0 | @@ -0,0 +1,824 @@
+# coding: utf-8%0A# Copyright (c) Pymatgen Development Team.%0A# Distributed under the terms of the MIT License.%0A%0Afrom __future__ import unicode_literals%0A%0Aimport unittest%0A%0Afrom pymatgen.util.testing import PymatgenTest%0A%0A%0Aclass DefectCompatibilityTest(PymatgenTest):%0A%0A def test... | |
b68db14e5ecd2e8ccaaa0412798a8669232fb8e5 | Add constraint variables in solver | solver.py | solver.py | Python | 0.000002 | @@ -0,0 +1,1593 @@
+from collections import namedtuple%0A%0Afrom past import autotranslate%0A# python-constraint is python2, so we'll use python-future's autotranslate function%0Aautotranslate(%5B'constraint'%5D)%0Aimport constraint%0A%0A# periods is an int for how many periods per week are required for this subject%0A... | |
92f2b8c5b44fd6f306e32275b24daddb35fa3e53 | function to calculate_effective_permittivity | gdsfactory/simulation/effective_permittivity.py | gdsfactory/simulation/effective_permittivity.py | Python | 0.998539 | @@ -0,0 +1,2574 @@
+%22%22%22Calculate the effective refractive index for a 1D mode.%22%22%22%0A%0Afrom typing import Literal%0A%0Aimport numpy as np%0Afrom scipy.optimize import fsolve%0A%0A%0Adef calculate_effective_permittivity(%0A epsilon_film: float,%0A epsilon_substrate: float,%0A epsilon_cladding: float... | |
a14d696cad5b3249997257298150977fa53f9cc8 | Add lc151_reverse_words_in_a_string.py | lc151_reverse_words_in_a_string.py | lc151_reverse_words_in_a_string.py | Python | 0.998758 | @@ -0,0 +1,1155 @@
+%22%22%22Leetcode 151. Reverse Words in a String%0AMedium%0A%0AGiven an input string, reverse the string word by word. %0A%0AExample 1:%0AInput: %22the sky is blue%22%0AOutput: %22blue is sky the%22%0A%0AExample 2:%0AInput: %22 hello world! %22%0AOutput: %22world! hello%22%0AExplanation: Your reve... | |
b80d7927225f172653922317ef5c96e90876588d | Create SemiSupervisedTSNE.py | sstsne/SemiSupervisedTSNE.py | sstsne/SemiSupervisedTSNE.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
2fbcd2c5c47b4066e74619196dc333fa88a015d1 | isolate pipe operator overload code | tests/pipe_test.py | tests/pipe_test.py | Python | 0.000001 | @@ -0,0 +1,1196 @@
+# -*- coding: utf-8 -*-%0Aimport asyncio%0Aimport pytest%0Aimport paco%0Afrom paco.pipe import overload%0A%0A%0Adef test_pipe_operator_overload():%0A @asyncio.coroutine%0A def filterer(x):%0A return x %3C 8%0A%0A @asyncio.coroutine%0A def mapper(x):%0A return x * 2%0A%0A ... | |
fd6eea38f389a440f2c7d69e0de29677a64dbd2c | Add manual wifi table migration script. | ichnaea/scripts/migrate.py | ichnaea/scripts/migrate.py | Python | 0 | @@ -0,0 +1,2818 @@
+%22%22%22%0AManual migration script to move networks from old single wifi table%0Ato new sharded wifi table structure.%0A%22%22%22%0Afrom collections import defaultdict%0Aimport sys%0Aimport time%0A%0Afrom ichnaea.config import read_config%0Afrom ichnaea.db import (%0A configure_db,%0A db_work... | |
d4c7869d62635eca3108d743c2bc12c9f394d68a | Add archive.File class, which allows downloading from archive.org | tests/test_item.py | tests/test_item.py | Python | 0 | @@ -0,0 +1,493 @@
+import os, sys%0Ainc_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))%0Asys.path.insert(0, inc_path)%0A%0Aimport archive%0A%0Adef test_item():%0A item = archive.Item('stairs')%0A assert item.metadata%5B'metadata'%5D%5B'identifier'%5D == 'stairs'%0A%0A%0Adef test_file():%0A ... | |
fa4b4de37b38f0ff800bbd2ac007ab6521720258 | Add test for box migration script | scripts/tests/test_box_migrate_to_external_account.py | scripts/tests/test_box_migrate_to_external_account.py | Python | 0 | @@ -0,0 +1,2808 @@
+from nose.tools import *%0A%0Afrom scripts.box.migrate_to_external_account import do_migration, get_targets%0A%0Afrom framework.auth import Auth%0A%0Afrom tests.base import OsfTestCase%0Afrom tests.factories import ProjectFactory, UserFactory%0A%0Afrom website.addons.box.model import BoxUserSettings... | |
47d24759f25a183f26f96fe595fcbd3750ef0149 | Fix pjlink issue (#20510) | homeassistant/components/media_player/pjlink.py | homeassistant/components/media_player/pjlink.py | """
Support for controlling projector via the PJLink protocol.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.pjlink/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
PLATFORM_SCHEMA, SUPP... | Python | 0.000001 | @@ -3055,32 +3055,86 @@
the device.%22%22%22%0A
+ from pypjlink.projector import ProjectorError%0A
with sel
@@ -3153,32 +3153,53 @@
) as projector:%0A
+ try:%0A
pwst
@@ -3238,16 +3238,20 @@
+
if pwsta
@@ -3257,18 +3257,34 @@
ate
-== 'off':%0A
+in ('on', 'w... |
7056f00934c0956bfe1a6aed7558cb3b9fd1de57 | add ability to retrieve sorted profiler statistics | tornado_profile.py | tornado_profile.py | """Profile a Tornado application via REST."""
import tornado.web
import yappi
__author__ = "Megan Kearl Patten <megkearl@gmail.com>"
def start_profiling():
"""Start profiler."""
# POST /profiler
yappi.start(builtins=False, profile_threads=False)
def is_profiler_running():
"""Return True if the prof... | Python | 0 | @@ -39,16 +39,49 @@
EST.%22%22%22%0A
+from operator import itemgetter%0A%0A
import t
@@ -891,16 +891,954 @@
s(20)%0A%0A%0A
+def get_profiler_statistics(sort=%22cum_time%22, count=20):%0A %22%22%22Return profiler statistics.%0A%0A :param str sort: dictionary key to sort by%0A :param int%7CNone count: the num... |
97d62cd3cb08c8d43a804eb7989b03df3626f0ab | Create music.py | music.py | music.py | Python | 0.000003 | @@ -0,0 +1,214 @@
+from microbit import *%0Aimport music%0Aimport random%0A%0Awhile True:%0A %0A music.play(music.NYAN, loop=True, wait=False)%0A %0A if getValidDab():%0A music.play(music.POWER_UP)%0A else:%0A music.play(music.POWER_DOWN)%0A %0A
| |
9c26b042c38963bf95cc6456b0f9082c1c0827f3 | Add ttype API tests | tests/test_api_ttype.py | tests/test_api_ttype.py | Python | 0 | @@ -0,0 +1,1632 @@
+from urllib import urlencode%0Aimport json%0Afrom .base import MyTestCase%0Afrom privacyidea.lib.user import (User)%0Afrom privacyidea.lib.tokens.totptoken import HotpTokenClass%0Afrom privacyidea.models import (Token)%0Afrom privacyidea.lib.config import (set_privacyidea_config, get_token_types,%0A... | |
86cae13f7dde04f7031ae111e596f2d8c03d5420 | Add tests of CSVFile and StdOut recorders | tests/test_recorders.py | tests/test_recorders.py | Python | 0 | @@ -0,0 +1,1496 @@
+import pytest%0Afrom plumbium.processresult import record, pipeline, call%0Afrom plumbium.recorders import CSVFile, StdOut%0Afrom collections import OrderedDict%0A%0A%0A@pytest.fixture%0Adef simple_pipeline():%0A @record()%0A def recorded_function():%0A call(%5B'echo', '6.35'%5D)%0A%0A ... | |
2ccc6127c817c8c9b88d11a405ee96e8c33e8e4b | print the pre-cleaned and validated params to console to see the objects we've retrieved, call the .items() method on headers to get more direct access to the WebOb request object's header vals. | server.py | server.py | import webapp2
from paste import httpserver
__author__ = "Brian Tomlinson <darthlukan@gmail.com>"
class Processor(object):
"""
Performs some basic validation of data and cleanup as needed
before passing off to the "heavy lifter"
NOTE: Dummy logic for now as placeholders.
"""
def __init__(sel... | Python | 0 | @@ -1,12 +1,39 @@
+from pprint import pprint%0A%0A
import webap
@@ -1422,34 +1422,42 @@
.request.headers
+.items()
,%0A
-
'bod
@@ -1633,32 +1633,55 @@
arams%0A %7D%0A
+ pprint(params)%0A
processe
@@ -2024,16 +2024,24 @@
.headers
+.items()
,%0A
@@ -2217,32 +2217,32 @@
.re... |
c850cb4832e6273c8239eeb7d457d8e16bb472d6 | Add graph factory | graph_generation/graph_template.py | graph_generation/graph_template.py | Python | 0 | @@ -0,0 +1,687 @@
+%22%22%22%0AThis module implements factory for creating a graph.%0ACurrent version supports proto and networkx graphs.%0A%22%22%22%0A%0Afrom proto_graph import ProtoGraph%0Afrom nx_graph import NxGraph%0A%0A%0Aclass GraphTemplate:%0A %22%22%22%0A A class to get instance of a selected class for g... | |
4bd9e4db4af430ae34ed87f695d72ae99ba5bb70 | Set up first test level, started to create constraints | solver.py | solver.py | Python | 0.000001 | @@ -0,0 +1,892 @@
+from constraint import *%0A%0A# Empty space is 0%0A# Brick is a 1%0A# Block is a 2%0A# West facing player - 3%0A# East facing player - 4%0A# Door - 5%0Alevel = %5B%5B1,1,1,1,1,1,1,1,1,1%5D,%0A %5B1,0,0,0,0,0,0,0,0,1%5D,%0A %5B1,0,0,0,0,0,0,0,0,1%5D,%0A %5B1,0,0,0,0,0,0,0,0,1%5... | |
c92e0350527e7715b6b625c33a79c993aeae66fd | Add gui.py | gui.py | gui.py | Python | 0.000002 | @@ -0,0 +1,750 @@
+#!/usr/bin/python%0A%0Aimport sys%0Afrom PyQt5.QtWidgets import QMainWindow, QDesktopWidget, QApplication%0A%0Aclass MainWindow(QMainWindow):%0A%0A def __init__(self):%0A super(MainWindow, self).__init__()%0A self.init_UI()%0A%0A def init_UI(self):%0A WINDOW_WIDTH = 800%0A ... | |
2fb5557aed14d047d1ae120f0ff91c0e355d779f | Add simple perf measuring tool | ref.py | ref.py | Python | 0.000001 | @@ -0,0 +1,516 @@
+#!/usr/bin/env python2%0A%0Aimport sys%0Aimport subprocess%0A%0A%22%22%22%0AUsage:%0A ./ref.py ./main -B 1000000 -t 3 -T 31%0A%22%22%22%0A%0Asystem = subprocess.check_output%0A%0Agithash = system(%22git rev-parse HEAD%22, shell=True).strip()%0Adate = system(%22date -Ihours%22, shell=True).strip()%... | |
3bb3a1f1babab9e6516f635290baa4d4e9762b8d | add pressure box device | mecode/devices/efd_pressure_box.py | mecode/devices/efd_pressure_box.py | Python | 0 | @@ -0,0 +1,1182 @@
+import serial%0A%0ASTX = '%5Cx02' #Packet Start%0AETX = '%5Cx03' #Packet End%0AACK = '%5Cx06' #Acknowledge%0ANAK = '%5Cx15' #Not Acknowledge%0AENQ = '%5Cx05' #Enquiry%0AEOT = '%5Cx04' #End Of Transmission%0A%0A%0Aclass EFDPressureBox(object):%0A %0A def __init__(self, comport='COM4'):%0A... | |
7927fd0c13f14b348faa63c08683c6f80bdc7a0f | Create 5.3_nextsmallbig.py | 5.3_nextsmallbig.py | 5.3_nextsmallbig.py | Python | 0.010827 | @@ -0,0 +1,133 @@
+%22%22%22%0Agiven a positive integer, return the next smallest and largest%0Anumber with the same number of 1s in the binary represenation%0A%22%22%22%0A
| |
2ec45bb864634084d5d951649d6a2f6a77cee76f | Update forward compatibility horizon to 2019-05-21 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.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 | @@ -1139,17 +1139,17 @@
19, 5, 2
-0
+1
)%0A%0A%0A@tf_
|
718503b075d7bf79f430ea9de4fdcc95ad665e7d | Update forward compatibility horizon to 2019-07-06 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.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 | @@ -1142,9 +1142,9 @@
7,
-5
+6
)%0A%0A%0A
|
c9e111804974f21dbe297855ab217e964526baa2 | Add search_hints option. | tensorflow/tools/docs/generate2.py | tensorflow/tools/docs/generate2.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.999137 | @@ -1438,16 +1438,134 @@
to.%22)%0A%0A
+flags.DEFINE_bool(%22search_hints%22, True,%0A %22Include meta-data search hints at the top of each file.%22)%0A%0A
%0Adef bui
@@ -1599,16 +1599,35 @@
l_prefix
+, search_hints=True
):%0A %22%22%22
@@ -1776,16 +1776,96 @@
links.%0A
+ search_hints: Bool.... |
1e82d6110bee6953b78ee357ed5e0b94710b1357 | fix urls | heroku/urls.py | heroku/urls.py | Python | 0.005145 | @@ -0,0 +1,673 @@
+from django.conf.urls import include, url%0A%0Aurlpatterns = %5B%0A url(r'%5Efafl', include('fafl.urls')),%0A url(r'%5E', include('aristotle_cloud.urls')),%0A url(r'%5Epublish/', include('aristotle_mdr.contrib.self_publish.urls', app_name=%22aristotle_self_publish%22, namespace=%22aristotle_... | |
6f9ced48a8c423e505e21cfa9a0b0d05b4c86f5c | Add lava context processor. | lava_server/context_processors.py | lava_server/context_processors.py | Python | 0.000001 | @@ -0,0 +1,875 @@
+# Copyright (C) 2010, 2011 Linaro Limited%0A#%0A# Author: Zygmunt Krynicki %3Czygmunt.krynicki@linaro.org%3E%0A#%0A# This file is part of LAVA Server.%0A#%0A# LAVA Server is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License version 3%... | |
54f6b9e5d8769ba608fe0d3f14eda2746319d6d2 | Add class DepthSerializerMixin | mixins.py | mixins.py | Python | 0 | @@ -0,0 +1,418 @@
+class DepthSerializerMixin(object):%0A%09%22%22%22Custom method 'get_serializer_class', set attribute 'depth' based on query parameter in the url%22%22%22%0A%09%0A%09def get_serializer_class(self):%0A%09%09serializer_class = self.serializer_class%0A%09%09query_params = self.request.QUERY_PARAMS%0A%09... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.