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 |
|---|---|---|---|---|---|---|---|
7ab37e931a836faa78a78f5d8358d845f72cdf49 | Add low level Gemini serial command script | point/gemini_cmd.py | point/gemini_cmd.py | Python | 0.000003 | @@ -0,0 +1,1195 @@
+#!/usr/bin/env python3%0A%0A%22%22%22%0AA simple script for sending raw serial commands to Gemini.%0A%22%22%22%0A%0Aimport time%0Aimport serial%0Aimport readline%0A%0Adef main():%0A%0A ser = serial.Serial('/dev/ttyACM0', baudrate=9600)%0A%0A while True:%0A cmd = input('%3E ')%0A%0A ... | |
f65789fb705b43b446d1fc4b899074a66685a420 | add missed file | workbench/clients/workbench_client.py | workbench/clients/workbench_client.py | Python | 0.000001 | @@ -0,0 +1,915 @@
+''' This encapsulates some boilerplate workbench client code '''%0Aimport ConfigParser%0Aimport argparse%0Aimport os%0A%0Adef grab_server_args():%0A ''' Grab server info from configuration file '''%0A workbench_conf = ConfigParser.ConfigParser()%0A config_path = os.path.join(os.path.dirname(... | |
f203136772cfdca96a44a848d646426a42111698 | Solve 20. | 020/solution.py | 020/solution.py | Python | 0.999988 | @@ -0,0 +1,287 @@
+%22%22%22 Project Euler problem #20. %22%22%22%0A%0Aimport math as mt%0A%0A%0Adef problem():%0A %22%22%22 Solve the problem.%0A%0A Find the sum of the digits in the number 100!%0A%0A Answer: 648%0A%0A %22%22%22%0A num = mt.factorial(100)%0A return sum(map(int, str(num)))%0A%0A%0Aif ... | |
fe88269d03915e06cba0d0d228e2f4e78592d172 | Create 0007_ssoaccesslist.py | evewspace/API/migrations/0007_ssoaccesslist.py | evewspace/API/migrations/0007_ssoaccesslist.py | Python | 0.000003 | @@ -0,0 +1,748 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0001_initial'),%0A ('API', '0006_auto_20161223_1751'),%0A %5D%0A%0A operations = ... | |
97749df49156b652d12104b030e7ec7cc327d123 | add test for canonical | quantecon/tests/test_dle.py | quantecon/tests/test_dle.py | """
Tests for dle.py file
"""
import sys
import os
import unittest
import numpy as np
from scipy.linalg import LinAlgError
from numpy.testing import assert_allclose
from numpy import dot
from quantecon.dle import DLE
ATOL = 1e-10
class TestDLE(unittest.TestCase):
def setUp(self):
"""
Given LQ co... | Python | 0 | @@ -3505,16 +3505,373 @@
=ATOL)%0A%0A
+ def test_canonical(self):%0A solutions = %7B%0A 'pihat': np.array(%5B%5B1.%5D%5D),%0A 'llambdahat': np.array(%5B%5B-1.48690584e-19%5D%5D),%0A 'ubhat': np.array(%5B%5B30., -0., -0.%5D%5D)%0A %7D%0A self.dle.canonical()%0A ... |
5b67f6ddea05cb301a317e500657cb1cd0949bff | Create solution.py | hackerrank/algorithms/sorting/easy/running_time_of_quicksort/py/solution.py | hackerrank/algorithms/sorting/easy/running_time_of_quicksort/py/solution.py | Python | 0.000018 | @@ -0,0 +1,1578 @@
+#!/bin/python%0A%0Aclass QuickSort(object):%0A def __init__(self, debugMode = False):%0A self._debugMode = debugMode%0A self._swapCount = 0%0A %0A def partition(self, L, lo, hi):%0A if hi - lo %3C 2:%0A return lo%0A i = j = lo%0A v = hi - 1%0A ... | |
844d94619f2cf221ab5bd550f3136be4d164155b | add working dir | working_dir/diff.py | working_dir/diff.py | Python | 0.000002 | @@ -0,0 +1,1757 @@
+#! /usr/bin/env python%0A#! coding: utf8%0Aimport os, argparse, re, glob%0A%0Adb_user = 'aleph'%0Adb_pass = 'swbrIcu3Iv4cEhnTzmJL'%0A%0A# parse args%0Aparser = argparse.ArgumentParser(description='')%0Aparser.add_argument('--locale', '-l', default='zhCN',%0A help='Locale to extrac... | |
bb0178d0b97f52bb163cf13be3bd763840426f32 | Add API tests | django/artists/tests/test_api.py | django/artists/tests/test_api.py | Python | 0 | @@ -0,0 +1,1936 @@
+import json%0A%0Afrom django.core.urlresolvers import reverse%0Afrom mock import patch%0Afrom rest_framework import status%0Afrom rest_framework.test import APITestCase%0A%0Afrom artists.models import Artist%0Afrom echonest.models import SimilarResponse%0A%0A%0Aclass ArtistTest(APITestCase):%0A%0A ... | |
36beb6ae8bc41e5d131dbbdc65d6716d498375c7 | add script to diff bonferonni & benjamini-whitney p-value corrections | server/diffBHvsBon.py | server/diffBHvsBon.py | Python | 0 | @@ -0,0 +1,2485 @@
+#!/usr/bin/env python2.7%0A%22%22%22%0AdiffBHvsBon.py%0AThis reports differnences between the BenjaminiWhitney-FDR p-value correction%0Avs. the Bonferroni%0A%22%22%22%0A%0Aimport sys, os, csv, traceback, glob%0A%0Adef diffBHvsBon():%0A #basePath = '/Users/swat/data/mcrchopra/first/'%0A #tmpBas... | |
55fa30c236095006e6f9c970ef668598c4348a96 | Add microservice plugin for adding static attributes to responses. | src/satosa/micro_service/attribute_modifications.py | src/satosa/micro_service/attribute_modifications.py | Python | 0 | @@ -0,0 +1,1099 @@
+import os%0A%0Aimport yaml%0A%0Afrom satosa.internal_data import DataConverter%0Afrom satosa.micro_service.service_base import ResponseMicroService%0A%0A%0Aclass AddStaticAttributes(ResponseMicroService):%0A %22%22%22%0A Add static attributes to the responses.%0A%0A The path to the file des... | |
b72dd1c890491ccfe2de66f89f5adc035e862acb | Create HtmlParser.py | service/HtmlParser.py | service/HtmlParser.py | Python | 0.000002 | @@ -0,0 +1,291 @@
+#########################################%0A# HtmlParser.py%0A# description: html parser%0A# categories: %5Bdocument%5D%0A# possibly more info @: http://myrobotlab.org/service/HtmlParser%0A#########################################%0A# start the service%0Ahtmlparser = Runtime.start(%22htmlparser%22,%2... | |
9c8402bdadb4860a3876aa2ab0f94b9ddac8cfd5 | Add offboard_sample.py | script/offboard_sample.py | script/offboard_sample.py | Python | 0.000001 | @@ -0,0 +1,2334 @@
+#!/usr/bin/env python%0A%0Aimport rospy%0A%0Afrom geometry_msgs.msg import PoseStamped%0Afrom mavros_msgs.msg import State%0Afrom mavros_msgs.srv import CommandBool, CommandBoolRequest%0Afrom mavros_msgs.srv import SetMode, SetModeRequest%0A%0Acurrent_state = State()%0Adef state_cb(msg):%0A globa... | |
b883b3066848957376d841cb4ffdf2d5646315c8 | add quick-testlist.py | scripts/quick-testlist.py | scripts/quick-testlist.py | Python | 0 | @@ -0,0 +1,1859 @@
+#!/usr/bin/env python%0A#%0A# Copyright 2015 Intel Corporation%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a%0A# copy of this software and associated documentation files (the %22Software%22),%0A# to deal in the Software without restriction, including without limitat... | |
718379eea1e0c58ba76ada08d64512d9f4904c07 | add new package (#10060) | var/spack/repos/builtin/packages/eztrace/package.py | var/spack/repos/builtin/packages/eztrace/package.py | Python | 0 | @@ -0,0 +1,812 @@
+# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Eztrace(AutotoolsPackage):%0A %22%22%22EZTrace is a tool... | |
cfe9550bfe7d8659c06892af8a32662cb372bea9 | add new package : sysstat (#13907) | var/spack/repos/builtin/packages/sysstat/package.py | var/spack/repos/builtin/packages/sysstat/package.py | Python | 0 | @@ -0,0 +1,1036 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Sysstat(AutotoolsPackage):%0A %22%22%22The sysstat pack... | |
56592b10e25cd1f2cf8d122df389268ab24b3729 | refactor and use OOMMF_PATH environment variable to locate oommf.tcl | oommfmif/__init__.py | oommfmif/__init__.py | import subprocess
def get_version():
p = subprocess.Popen("~/git/oommf/oommf/oommf.tcl +version", shell=True,
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
p.wait()
stdout, stderr = p.stdout.read(), p.stderr.read()
# version is returned in stderr
print(stderr.split()[0:... | Python | 0 | @@ -1,8 +1,18 @@
+import os%0A
import s
@@ -26,103 +26,439 @@
ss%0A%0A
-%0Adef get_version():%0A p = subprocess.Popen(%22~/git/oommf/oommf/oommf.tcl +version%22, shell=True
+# Environment variable OOMMF_PATH should point to the directory which%0A# contains 'oommf.tcl'%0Aoommf_path = os.environ%5B'OOMMF_PATH'%5D%0A... |
94f5f630c315bc6951c98cd2a9f4908ce05d59a4 | Test float precision in json encoding. | fedmsg/tests/test_encoding.py | fedmsg/tests/test_encoding.py | Python | 0 | @@ -0,0 +1,434 @@
+import unittest%0Aimport fedmsg.encoding%0A%0Afrom nose.tools import eq_%0A%0A%0Aclass TestEncoding(unittest.TestCase):%0A def test_float_precision(self):%0A %22%22%22 Ensure that float precision is limited to 3 decimal places. %22%22%22%0A msg = dict(some_number=1234.123456)%0A ... | |
dfb4c5422c79fcd413d0d9a028cb5548e2678454 | Add script for generating test certificates | generate_test_certificates.py | generate_test_certificates.py | Python | 0 | @@ -0,0 +1,287 @@
+import trustme%0A%0A# Create a CA%0Aca = trustme.CA()%0A%0A# Issue a cert signed by this CA%0Aserver_cert = ca.issue_cert(u%22www.good.com%22)%0A%0A# Save the PEM-encoded data to a file%0Aca.cert_pem.write_to_path(%22GoodRootCA.pem%22)%0Aserver_cert.private_key_and_cert_chain_pem.write_to_path(%22www... | |
f063ebffaa52c3807dac641ae01146235d77210c | Remove superfluous comment. | src/python/twitter/common/contextutil/__init__.py | src/python/twitter/common/contextutil/__init__.py | # ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | Python | 0 | @@ -2830,171 +2830,8 @@
%22%22%22%0A
- # argh, I would love to use os.fdopen here but then fp.name == '%3Cfdopen%3E'%0A # and that's unacceptable behavior for most cases where I want to use temporary_file%0A
fh
|
989537e91109becdae96b8484b6cb9a007137d0a | FIX m2o on wizard with ondelete | account_statement_move_import/wizard/account_statement_move_import_wizard.py | account_statement_move_import/wizard/account_statement_move_import_wizard.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api, _
class... | Python | 0 | @@ -940,32 +940,60 @@
required=True,%0A
+ ondelete='cascade',%0A
)%0A jo
|
8b8c6c85d05d0291829f68d3bb02d8a8d22631f7 | remove unusage import | jieba/analyse/textrank.py | jieba/analyse/textrank.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import json
import collections
from operator import itemgetter
import jieba.posseg as pseg
class UndirectWeightedGraph:
d = 0.85
def __init__(self):
self.graph = collections.defaultdict(list)
def ad... | Python | 0.000003 | @@ -95,20 +95,8 @@
sys%0A
-import json%0A
impo
|
89a78e09ee52c27df8cd548839b240984b13d61d | add client exception | kafka/exception/client.py | kafka/exception/client.py | Python | 0.000001 | @@ -0,0 +1,292 @@
+class FailedPayloadsException(Exception):%0A pass%0A%0A%0Aclass ConnectionError(Exception):%0A pass%0A%0A%0Aclass BufferUnderflowError(Exception):%0A pass%0A%0A%0Aclass ChecksumError(Exception):%0A pass%0A%0A%0Aclass ConsumerFetchSizeTooSmall(Exception):%0A pass%0A%0A%0Aclass ConsumerN... | |
de71fee0a095ea043c66be92ad8bd6685b7fc74f | Fix #7026 adding a new wol parameter (#7144) | homeassistant/components/switch/wake_on_lan.py | homeassistant/components/switch/wake_on_lan.py | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | Python | 0 | @@ -611,16 +611,61 @@
urn_off'
+%0ACONF_BROADCAST_ADDRESS = 'broadcast_address'
%0A%0ADEFAUL
@@ -835,32 +835,85 @@
ST): cv.string,%0A
+ vol.Optional(CONF_BROADCAST_ADDRESS): cv.string,%0A
vol.Optional
@@ -1236,16 +1236,75 @@
DDRESS)%0A
+ broadcast_address = config.get(CONF_BROADCAST_ADDRESS)%0A
off_... |
05004f8dc48fe15268bc2d0146e5788f0bdf463e | Add missing migration | djedi/migrations/0002_auto_20190722_1447.py | djedi/migrations/0002_auto_20190722_1447.py | Python | 0 | @@ -0,0 +1,392 @@
+# Generated by Django 2.2.3 on 2019-07-22 14:47%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('djedi', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A model_name='... | |
c1d0ed6b5e4a1be5866ace6eca98fd52495e3f7e | add dc= and role= groups | plugins/inventory/terraform.py | plugins/inventory/terraform.py | #!/usr/bin/env python
"""\
Dynamic inventory for Terraform - finds all `.tfstate` files below the working
directory and generates an inventory based on them.
"""
from __future__ import unicode_literals, print_function
import argparse
from collections import defaultdict
import json
import os
import sys
parser = argpars... | Python | 0.000006 | @@ -4848,16 +4848,212 @@
able')%0A%0A
+ # groups specific to microservices-infrastructure%0A if 'role' in attrs%5B'metadata'%5D:%0A groups.append('role=' + attrs%5B'metadata'%5D%5B'role'%5D)%0A groups.append('dc=' + attrs%5B'consul_dc'%5D)%0A%0A
retu
|
c201245a01ded92bec91f1f34320e87666330c44 | add mbtiles command | seedsource_core/django/seedsource/management/commands/create_vector_tiles.py | seedsource_core/django/seedsource/management/commands/create_vector_tiles.py | Python | 0.00123 | @@ -0,0 +1,810 @@
+from django.core.management import BaseCommand%0Afrom seedsource_core.django.seedsource.models import SeedZone%0Aimport subprocess%0A%0Aclass Command(BaseCommand):%0A help = 'Facilitates converting of vector data into vector tiles.'%0A%0A def handle(self, *args, **options):%0A def write_... | |
08364dae50a68b5d053eadc836c02b51873df250 | Add dog_cat | cnn/dog_cat/dog_cat.py | cnn/dog_cat/dog_cat.py | Python | 0.999994 | @@ -0,0 +1,2067 @@
+from keras.models import Sequential%0D%0Afrom keras.layers import Convolution2D, MaxPooling2D%0D%0Afrom keras.layers import Activation, Dropout, Flatten, Dense%0D%0Afrom keras.preprocessing.image import ImageDataGenerator%0D%0A%0D%0A%0D%0Adef save_history(history, result_file):%0D%0A loss = histo... | |
fa7a24493e6e8029ea2dd7f3bf244b08353c50a3 | create run commnd | manage.py | manage.py | Python | 0 | @@ -0,0 +1,339 @@
+import os%0Afrom flask_script import Manager%0Afrom flask_migrate import Migrate, MigrateCommand%0A%0Afrom app import app, db%0A%0A%0Aapp.config.from_object(os.getenv('APP_SETTINGS', 'config.DevelopmentConfig'))%0A%0Amigrate = Migrate(app, db)%0Amanager = Manager(app)%0A%0Amanager.add_command('db', M... | |
6bd35a2df0dbeca2668999dafbbd05779911cca7 | add directory for state | src/mugen/state/serialize.py | src/mugen/state/serialize.py | Python | 0 | @@ -0,0 +1,317 @@
+#!/usr/bin/env python%0A%0A# This script reads a specification of a datastructure with fields in it and writes%0A# out a class that contains those fields and a way to serialize/deserialize them%0A# to a stream. This is similar to google's protobuf but using a much simpler%0A# implementation.%0A%0A# T... | |
d5aae9d0a770cad05c76c30754f5fcc57be5bd9b | Solve Fuel Spent in python | solutions/uri/1017/1017.py | solutions/uri/1017/1017.py | Python | 0.999999 | @@ -0,0 +1,68 @@
+h = float(input())%0As = float(input())%0A%0Aprint(f%22%7Bh * s / 12.0:.3f%7D%22)%0A
| |
52f4d72387810994a7106e4fa55c3bfcda798a1c | Create __init__.py | ENN/__init__.py | ENN/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
f3f073379b71a13fea4255622c7df19bec02fdd7 | bump version | EMpy/version.py | EMpy/version.py | __author__ = 'Lorenzo Bolla'
version = '0.1.3'
| Python | 0 | @@ -42,7 +42,7 @@
0.1.
-3
+4
'%0A
|
05e37a58825a6b75ade5ffdd25e887f9c9a7409c | Add net/ip.py containing python function wrapping /sbin/ip | net/ip.py | net/ip.py | Python | 0.000015 | @@ -0,0 +1,2757 @@
+#!/usr/bin/env python%0A# Copyright (c) 2012 Citrix Systems, Inc.%0A#%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU Lesser General Public License as published%0A# by the Free Software Foundation; version 2.1 only. with the special%0A# exce... | |
2b57a443807de26c9e71c97fd029e3d8416db597 | Add feature usage shuffler | SessionTools/feature_usage_shuffler.py | SessionTools/feature_usage_shuffler.py | Python | 0 | @@ -0,0 +1,2106 @@
+# Condenses all the feature files into a single location,%0A# Split by the names of the features%0A%0A%0Aimport sys%0Afrom os.path import isfile%0Aimport os%0Aimport json%0A%0Apath = sys.argv%5B1%5D%0Aout_path = sys.argv%5B2%5D%0Apaths = %5B%5D%0A%0Ai = 0%0Askipped = 0%0A%0Apretty_print_json_output ... | |
66bb19a5937091812b80b9c0d98c6f52b9d47165 | add new package : kafka (#14315) | var/spack/repos/builtin/packages/kafka/package.py | var/spack/repos/builtin/packages/kafka/package.py | Python | 0 | @@ -0,0 +1,1484 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Kafka(Package):%0A %22%22%22%0A Kafka is used for bu... | |
16e6f88e094d4eac8ba154eed5681187f14ab652 | Create __init__.py | spacegame/__init__.py | spacegame/__init__.py | Python | 0.000001 | @@ -0,0 +1,315 @@
+%22%22%22SpaceGame%0A%0AA simple 2d space shooter made with python and pygame.%0A%22%22%22%0A%0A# Make sure you ha python34 and pygame 1.9.1+ installed before run this code.%0Aimport pygame%0Aimport pygame.locals as c%0A%0A# this module itself does nothing important, but its good to have pygame%0A# i... | |
00cdcceb131814b24546c36810682ed78ba866c6 | Create database column class (DBCol) | pyfwk/struc/dbcol.py | pyfwk/struc/dbcol.py | Python | 0 | @@ -0,0 +1,567 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0A dbcol.py: DBCol is a struct describing an sqlite database table column%0A%22%22%22%0A%0A%0A# ----------------------------DATABASE-COLUMN-----------------------------#%0Aclass DBCol:%0A name = None%0A datatype = None%0A%0A def __init__(self, name, data... | |
891eef2354e4cf0a552e5c8023c2778bf45a3582 | add py lib and the first py fiel | pylib/EncodingLib.py | pylib/EncodingLib.py | Python | 0.000001 | @@ -0,0 +1,1021 @@
+# coding=utf-8%0A%0Aimport sys%0A%0A# sys.stdout = codecs.lookup('iso8859-1')%5B-1%5D(sys.stdout)%0A%0Aprint 'System Encoding is', sys.getdefaultencoding()%0A%0A# python%E4%B8%AD%E7%9A%84str%E5%AF%B9%E8%B1%A1%E5%85%B6%E5%AE%9E%E5%B0%B1%E6%98%AF%228-bit string%22 %EF%BC%8C%E5%AD%97%E8%8A%82%E5%AD%97%... | |
2644625e137963ef2982d7ff0a3241bfcbde1ac6 | Prepend the logs with '...' if they aren't complete | raven_cron/runner.py | raven_cron/runner.py | from os import getenv, SEEK_END
from raven import Client
from subprocess import call
from tempfile import TemporaryFile
from argparse import ArgumentParser
from sys import argv, exit
from time import time
from .version import VERSION
MAX_MESSAGE_SIZE = 1000
parser = ArgumentParser(description='Wraps commands and repo... | Python | 0.00028 | @@ -1534,21 +1534,51 @@
-if buf.tell()
+file_size = buf.tell()%0A if file_size
%3C M
@@ -1618,16 +1618,52 @@
seek(0)%0A
+ last_lines = buf.read()%0A
@@ -1690,16 +1690,17 @@
f.seek(-
+(
MAX_MESS
@@ -1707,16 +1707,19 @@
AGE_SIZE
+-3)
, SEEK_E
@@ -1722,17 +1722,20 @@
EK_END)%0A
-%... |
e66a690271f23fc2a4904e446bbdf0bf6b491a60 | Add manager migration | osf/migrations/0028_auto_20170504_1548.py | osf/migrations/0028_auto_20170504_1548.py | Python | 0.000002 | @@ -0,0 +1,415 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-05-04 20:48%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0027_auto_20170428_1435'),%0A %5D%0A%0A operatio... | |
84e3475158797a60312068c284aa8d61d9466c6e | add model | www/models.py | www/models.py | Python | 0 | @@ -0,0 +1,709 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'''%0AModels for user, blog, comment%0A'''%0A%0A__author__ = 'Ian Zheng'%0A%0Aimport time, uuid%0A%0Afrom www.orm import Model, StringField, BooleanField, IntegerField, FloatField%0A%0Adef next_id():%0A return '%25015d%25s000' %25 (int(time.tim... | |
3e9d5f9cf1c28619422cb012e532e776c4cc8b99 | fix bug 1369498: remove adi-related tables and stored procedures | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | Python | 0 | @@ -0,0 +1,901 @@
+%22%22%22bug 1369498 remove adi%0A%0ARemove ADI-related tables and stored procedures.%0A%0ARevision ID: eb8269f6bb85%0ARevises: 0db05da17ae8%0ACreate Date: 2018-07-19 20:00:52.933551%0A%0A%22%22%22%0A%0Afrom alembic import op%0A%0A%0A# revision identifiers, used by Alembic.%0Arevision = 'eb8269f6bb85... | |
4f5ce4af85971ea3c15c90b8a482b611b8bf6c4c | move logging code to evaluation directory | src/evaluation/log.py | src/evaluation/log.py | Python | 0 | @@ -0,0 +1,813 @@
+%22%22%22 This module provides a globally accessible%0A logger created from the config file %22%22%22%0A%0Aimport logging%0Aimport os%0A%0Adef _create_logger_from_config():%0A %22%22%22 Create the logger from the config file %22%22%22%0A conf = %7B%0A %22name%22: %22StackLogger%22,%0A... | |
6d93ad1df3eb4a50038b7429fe9ed98a8d44af6f | add solution for Divide Two Integers | src/divideTwoIntegers.py | src/divideTwoIntegers.py | Python | 0.000184 | @@ -0,0 +1,572 @@
+class Solution:%0A # @return an integer%0A%0A def divide(self, dividend, divisor):%0A if divisor == 0:%0A return 2147483647%0A positive = (dividend %3C 0) is (divisor %3C 0)%0A dividend, divisor = abs(dividend), abs(divisor)%0A res = 0%0A while divi... | |
51466e360320267afab41704caecebac0dff1dc2 | Add a handler for performing client load testing. | src/example/bench_wsh.py | src/example/bench_wsh.py | Python | 0.000053 | @@ -0,0 +1,2322 @@
+# Copyright 2011, 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 the above copyright%0A# notic... | |
8dbc2dd48d1d0e25972ad359464694d352d58705 | add transpilation of the arangodb social graph | examples/createSocialGraph.py | examples/createSocialGraph.py | Python | 0.00189 | @@ -0,0 +1,2180 @@
+#!/usr/bin/python%0Aimport sys%0Afrom pyArango.connection import *%0Afrom pyArango.graph import *%0Afrom pyArango.collection import *%0A%0A%0Aclass Social(object):%0A class male(Collection) :%0A _fields = %7B%0A %22name%22 : Field()%0A %7D%0A %0... | |
3af86cf1521170ffeb886802f4a96f403e86bf82 | add title | src/slidegen/DataProvider.py | src/slidegen/DataProvider.py | from glob import glob
import random
class DataProviderBase(object):
def __init__(self):
'''
Init your data provider
'''
raise NotImplementedError('Please ')
def image(self, size):
'''
size in ['big', 'medium', 'small']
big for full page background
... | Python | 0.999996 | @@ -2393,24 +2393,169 @@
.product())%0A
+ '%25s%E6%9C%83%E5%9C%A8%E8%BF%91%E6%9C%9F%E5%85%A7%E6%8E%A8%E5%87%BA%25s' %25 (self.company(), self.product()),%0A '%E5%95%8A%E5%93%88%E5%93%88%E5%93%88%E4%BD%A0%E7%9C%8B%E7%9C%8B%E4%BD%A0',%0A '%25s%E6%9C%AA%E4%BE%86%E5%B0%87%E5%8F%96%E4%BB%A3... |
06d2d7dd155f5ac888a8c0d2d9c45c61b95de714 | update tests for thresholding for ecm | CPAC/network_centrality/tests/test_thresh_and_sum.py | CPAC/network_centrality/tests/test_thresh_and_sum.py | Python | 0 | @@ -0,0 +1,2206 @@
+%22%22%22%0AThis tests the functions in network_centrality/thresh_and_sum.pyx%0A%22%22%22%0A%0Aimport os, sys%0Aimport numpy as np%0Afrom numpy.testing import *%0A%0Afrom nose.tools import ok_, eq_, raises, with_setup%0Afrom nose.plugins.attrib import attr # http://nose.readthedocs.org/en/latest/... | |
82fa373c46581e84f8e5ea0da733ef5c65928165 | Update MultipleParticleSystems.pyde | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | """
Multiple Particle Systems
by Daniel Shiffman.
Click the mouse to generate a burst of particles
at mouse location.
Each burst is one instance of a particle system
with Particles and CrazyParticles (a subclass of Particle).
Note use of Inheritance and Polymorphism here.
"""
from crazy_particle import CrazyParticle... | Python | 0 | @@ -794,8 +794,13 @@
useY)))%0A
+ %0A
|
70bc8413dc3748f606e76f5e4e4abcde6b851cdd | Read and UDP | bari_spitter.py | bari_spitter.py | Python | 0.000001 | @@ -0,0 +1,1108 @@
+#!/usr/bin/python3%0A# coding=utf-8%0A%22%22%22reads barometric pressure sensor and writes it to UDP socket with timestamp%0A%22%22%22%0Aimport socket%0Afrom datetime import datetime%0Afrom time import sleep%0Afrom time import time%0A%0Aimport ms5637%0A%0A__author__ = 'Moe'%0A__copyright__ = 'Copyri... | |
6811b4014fc0267edf4d397ccab86b0e986c2215 | Implement the INFO command | txircd/modules/rfc/cmd_info.py | txircd/modules/rfc/cmd_info.py | Python | 0.999339 | @@ -0,0 +1,1207 @@
+from twisted.plugin import IPlugin%0Afrom twisted.words.protocols import irc%0Afrom txircd import version%0Afrom txircd.module_interface import Command, ICommand, IModuleData, ModuleData%0Afrom zope.interface import implements%0A%0Aclass InfoCommand(ModuleData, Command):%0A implements(IPlugin, IM... | |
0f199556df6bd498f01cccdce6316b733c876acc | Add migration file | InvenTree/part/migrations/0046_auto_20200804_0107.py | InvenTree/part/migrations/0046_auto_20200804_0107.py | Python | 0.000001 | @@ -0,0 +1,480 @@
+# Generated by Django 3.0.7 on 2020-08-04 01:07%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('part', '0045_auto_20200605_0932'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A mo... | |
f8fcae7dd7579b51c3c204337dfa70c702fdbf38 | add new namedtuple Chunk | AlphaTwirl/HeppyResult/Chunk.py | AlphaTwirl/HeppyResult/Chunk.py | Python | 0.00003 | @@ -0,0 +1,362 @@
+# Tai Sakuma %3Ctai.sakuma@cern.ch%3E%0A%0A##__________________________________________________________________%7C%7C%0Aimport collections%0A%0A##__________________________________________________________________%7C%7C%0AChunk = collections.namedtuple('Chunk', 'inputPath treeName maxEvents start comp... | |
83986f6ade666e5f12ae599048369ecdd9856737 | VISIBLE not visible | src/sentry/api/endpoints/team_project_index.py | src/sentry/api/endpoints/team_project_index.py | from __future__ import absolute_import
from rest_framework import serializers, status
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.bases.team import TeamEndpoint
from sentry.api.serializers import serialize
from sentry.models import Project, ProjectStatus, AuditL... | Python | 0.999528 | @@ -1953,15 +1953,15 @@
tus.
-visible
+VISIBLE
,%0A
|
b5dd2894120ceee04ca43fd6f408e2404ccd12ad | Include ethash w/macos build | factories/cpp_ethereum_osx.py | factories/cpp_ethereum_osx.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: caktux
# @Date: 2015-02-23 15:00:28
# @Last Modified by: caktux
# @Last Modified time: 2015-04-05 23:12:26
import factory
reload(factory)
from factory import *
import cpp_ethereum
reload(cpp_ethereum)
from cpp_ethereum import *
def cmake_osx_cmd(cmd=[], cc... | Python | 0 | @@ -417,16 +417,47 @@
fault%22)%0A
+ cmd.append(%22-DETHASHCL=1%22)%0A
if h
|
658cefded99d140db212b9525f791ce2e0336472 | Fix NameError in custom_csrf_failure | pydotorg/views.py | pydotorg/views.py | from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.translation import ugettext as _
from django.utils.version import get_docs_version
from django.views.csrf import CSRF_FAILURE_TEMPLATE, CSRF_FAILURE_TEMPLATE_NAME
from django.views.g... | Python | 0.000008 | @@ -2102,29 +2102,42 @@
emplate(
-template_name
+CSRF_FAILURE_TEMPLATE_NAME
)%0A ex
@@ -2167,68 +2167,8 @@
st:%0A
- if template_name == CSRF_FAILURE_TEMPLATE_NAME:%0A
@@ -2237,20 +2237,16 @@
mplate.%0A
-
@@ -2301,20 +2301,16 @@
-
c = Cont
@@ -2320,109 +2320,8 @@
(c)... |
f531eb7d1734d6d715893356a50d11eee6bc009a | Test mobile set password form | corehq/apps/users/tests/forms.py | corehq/apps/users/tests/forms.py | Python | 0 | @@ -0,0 +1,1037 @@
+from collections import namedtuple%0Afrom django.contrib.auth import get_user_model%0Afrom django.test import TestCase%0Afrom corehq.apps.users.forms import SetUserPasswordForm%0A%0AProject = namedtuple('Project', %5B'name', 'strong_mobile_passwords'%5D)%0A%0A%0Aclass TestSetUserPasswordForm(TestCas... | |
e10c696fd3125a15ca9b27baed6949f7dfbf3e19 | update tests (add digitlib.curric) | restclients/tests.py | restclients/tests.py | from django.utils import unittest
from restclients.test.uwnetid.subscription import EmailForwardingTest
from restclients.test.util.date_formator import formatorTest
from restclients.test.hfs.idcard import HfsTest
from restclients.test.library.mylibinfo import MyLibInfoTest
from restclients.test.sws.compatible import ... | Python | 0 | @@ -263,24 +263,82 @@
yLibInfoTest
+%0Afrom restclients.test.digitlib.curric import DigitLibTest
%0A%0Afrom restc
|
b3f436e14df37d4af602dcdc9882ce27c97fabd4 | Add a yaml sdb module (#37563) | salt/sdb/yaml.py | salt/sdb/yaml.py | Python | 0 | @@ -0,0 +1,1964 @@
+# -*- coding: utf-8 -*-%0A'''%0APull sdb values from a YAML file%0A%0A:maintainer: SaltStack%0A:maturity: New%0A:platform: all%0A%0A.. versionadded:: Nitrogen%0A%0AConfiguration:%0A%0A.. code-block:: yaml%0A%0A my-yaml-file:%0A driver: yaml%0A files:%0A - /path/to/fo... | |
a2151435057e3e42b8ecf6323b8276f4698fdd15 | Create getTermSize.py | ssh_utils/getTermSize.py | ssh_utils/getTermSize.py | Python | 0 | @@ -0,0 +1,2725 @@
+#!/usr/bin/env python%0A%0A%22%22%22 getTerminalSize()%0A - get width and height of console%0A - works on linux,os x,windows,cygwin(windows)%0A%22%22%22%0A%0A__all__=%5B'getTerminalSize'%5D%0A%0A%0Adef getTerminalSize():%0A import platform%0A current_os = platform.system()%0A tuple_xy=None%0A ... | |
6c38414d899b00cf0ba386e59721354f3b2a799b | Update bechdel.py | bechdel.py | bechdel.py | Python | 0 | @@ -0,0 +1,1552 @@
+# Difficulty level: Advanced%0A%0A# Goal #1: Create a program that will print out a list of movie titles and a set of ratings defined below into a particular format.%0A%0A# First, choose any five movies you want.%0A%0A# Next, look each movie up manually to find out four pieces of information:%0A#%09... | |
5b0f490cb527b0940dc322b060069f44fb29accd | Add git versioning | expyfun/_git.py | expyfun/_git.py | Python | 0 | @@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-%0A
| |
bcfac4b7ea5b10b5b6e84a756d716ef6c47cdd62 | Create finalproject.py | finalproject.py | finalproject.py | Python | 0.000002 | @@ -0,0 +1,6 @@
+code!%0A
| |
2cdf030ee6d8a545c071f2c033d88c6c2091ef08 | Add freeze_graph tool | freeze_graph.py | freeze_graph.py | Python | 0.000001 | @@ -0,0 +1,2280 @@
+# code from https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc%0A# Thanks Morgan%0A%0Aimport os, argparse%0A%0Aimport tensorflow as tf%0Afrom tensorflow.python.framework import graph_util%0A%0Adir = os.path.dirname(os.path.realpath(__file__))%0A%0A%... | |
2207e8dfbf1ea0f11cac0a95f7c5317eaae27f9b | Add cron state support | salt/states/cron.py | salt/states/cron.py | Python | 0 | @@ -0,0 +1,1024 @@
+'''%0AManage cron states%0A'''%0A%0Adef present(name,%0A user='root',%0A minute='*',%0A hour='*',%0A daymonth='*',%0A month='*',%0A dayweek='*',%0A ):%0A '''%0A Verifies that the specified cron job is present for the specified user%0A '''%0A ... | |
86c2441be14dbc3303b0bc65356372728a62fd4a | Add infrastructure for counting database queries | test/performance.py | test/performance.py | Python | 0.000001 | @@ -0,0 +1,1650 @@
+from contextlib import contextmanager%0Aimport json%0Aimport os%0Aimport re%0Aimport sys%0Afrom django.conf import settings%0Afrom django.db import connection, reset_queries%0A%0A%0Acount = %7B%7D%0A%0A%0A@contextmanager%0Adef count_queries(k):%0A q = 0%0A debug = settings.DEBUG%0A try:%0A ... | |
059b7c5705d2134ca998e67caf65e3125d503dbc | add sitemap.py | staticpy/page/sitemap.py | staticpy/page/sitemap.py | Python | 0.000002 | @@ -0,0 +1,748 @@
+from __future__ import absolute_import%0A%0Aimport os%0A%0Afrom jinja2 import Environment, PackageLoader%0A%0Afrom ..utils import write_to_file%0A%0A%0Aclass Sitemap(object):%0A def __init__(self, site):%0A self.env = Environment(loader=PackageLoader('dynamic', 'templates'))%0A self.... | |
b5568053325bd78c277d4bc0adff59cd12e10f48 | Add a script to build plugin. | build-plugin.py | build-plugin.py | Python | 0 | @@ -0,0 +1,267 @@
+import os%0AUnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'%0AUATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')%0AFullPluginFile = os.path.abspath('UnrealCV.uplugin')%0Aos.system('%25s BuildPlugin -plugin=%25s' %25 (UATScript, FullPluginFile))%0A
| |
bf42dd5246d935b0179faf1d563baa98bbcf0dbc | Create setup.py | Python/setup.py | Python/setup.py | Python | 0.000001 | @@ -0,0 +1,1365 @@
+#==================================================================================================%0A# Copyright (C) 2016 Olivier Mallet - All Rights Reserved %0A#================================================================================================... | |
5ae41fc3763f4fd4a25a7863ab139ef2709e9565 | Fix missing import | Python/setup.py | Python/setup.py | #!/usr/bin/env python
from setuptools import setup
requirements = [x.strip() for x in open("requirements.txt")]
# Automatically run 2to3 for Python 3 support
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='ml_metrics',
version='0.1.2',
description='Machine Learning Evalu... | Python | 0.999463 | @@ -44,16 +44,27 @@
rt setup
+%0Aimport sys
%0A%0Arequir
|
2aa07b8ac9ba2ec8d2b1ac814b5a1fb3074a2616 | test loading dataset | test_loadDataset.py | test_loadDataset.py | Python | 0.000002 | @@ -0,0 +1,1921 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# File: test_loadDataset.py%0A# Author: Rafa%C5%82 Nowak %3Crafal.nowak@cs.uni.wroc.pl%3E%0A%0Aimport unittest%0A%0Aclass TestLoadDataset(unittest.TestCase):%0A %22%22%22Test load_CIFAR_dataset function from utils%22%22%22%0A def test_certain_i... | |
21d931e35d9e0b32415a408f28e45894f0c3e800 | Add task files for celery async process | django_backend_test/noras_menu/tasks.py | django_backend_test/noras_menu/tasks.py | Python | 0.000001 | @@ -0,0 +1,1374 @@
+# -*- encoding: utf-8 -*-%0A%0A#app_mail/tasks.py%0Aimport requests%0Aimport simplejson as json%0A%0Afrom django_backend_test.celery import app%0Afrom django.template.loader import render_to_string%0Afrom django.utils.html import strip_tags%0Afrom django.core.mail import EmailMultiAlternatives%0Afro... | |
849a29b22d656c8079b4ccaf922848fb057c80c5 | Add migration to assign appropriate sheets to Transnational CountryRegion | forms/migrations/0023_assign_sheets_to_transnational.py | forms/migrations/0023_assign_sheets_to_transnational.py | Python | 0 | @@ -0,0 +1,1546 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.core.exceptions import ObjectDoesNotExist%0Afrom django.db import migrations%0A%0A%0Adef assign_transnational_region_to_sheets(apps, schema_editor):%0A from forms.models import sheet_models%0A%0A CountryRegion =... | |
22738b2cae0a6c77127bbf5385b7265247ffb306 | migrate also user profiles | geography/management/commands/migrate_geography_user.py | geography/management/commands/migrate_geography_user.py | Python | 0 | @@ -0,0 +1,1416 @@
+from proso_user.models import UserProfile%0Afrom django.core.management.base import BaseCommand%0Afrom optparse import make_option%0Afrom contextlib import closing%0Afrom django.db import connection%0Afrom clint.textui import progress%0Afrom django.db import transaction%0A%0A%0Aclass Command(BaseCom... | |
fdcb04a71d8163ed87aaa387c3f1d77143c49089 | Made it so I can compare various runs to make sure they're numerically identical. | megadiff.py | megadiff.py | Python | 0.999819 | @@ -0,0 +1,1434 @@
+#!/usr/bin/python%0A# megadiff.py%0A# Alex Szatmary%0A# 2009-08-08%0A# This is useful in comparing different runs with the same set of%0A# parameters. The idea is that, while revising the code, megadiff can%0A# be used when numerically identical results are expected from run to%0A# run. This is usef... | |
e7640ad635a77eecbcc5291792b514e42958876e | add magic-gen.py | scripts/magic-gen.py | scripts/magic-gen.py | Python | 0 | @@ -0,0 +1,1393 @@
+#!/bin/env python%0Aimport os, sys%0Aimport struct%0A%0A# This program parses criu magic.h file and produces%0A# magic.py with all *_MAGIC constants except RAW and V1.%0Adef main(argv):%0A%09if len(argv) != 3:%0A%09%09print(%22Usage: magic-gen.py path/to/image.h path/to/magic.py%22)%0A%09%09exit(1)%... | |
03c0aa498470037ef2aa6a8233198ff521f8d42f | add the links demo | demos/gtk-demo/demos/links.py | demos/gtk-demo/demos/links.py | Python | 0 | @@ -0,0 +1,2639 @@
+#!/usr/bin/env python%0A# -*- Mode: Python; py-indent-offset: 4 -*-%0A# vim: tabstop=4 shiftwidth=4 expandtab%0A#%0A# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri %3Cjohnp@redhat.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the... | |
dc82990f7a00e5e1e4d2a860630507f9cb3b81d4 | add script for just opening a package source | scripts/pkgsource.py | scripts/pkgsource.py | Python | 0 | @@ -0,0 +1,621 @@
+#!/usr/bin/python%0A%0Aimport sys%0Afrom conary.lib import util%0Asys.excepthook = util.genExcepthook()%0A%0Aimport logging%0Aimport updatebot.log%0A%0Aupdatebot.log.addRootLogger()%0Alog = logging.getLogger('test')%0A%0Afrom aptmd import Client%0Afrom updatebot import config%0Afrom updatebot import ... | |
eeb9b9877f1aa5bc1f22ac4883fe58a57ee0474a | Add script to test HOTS | scripts/test_hots.py | scripts/test_hots.py | Python | 0 | @@ -0,0 +1,633 @@
+import numpy as np%0A%0A%0Aevents = %5B%0A (1162704874, -5547),%0A (1179727586, -5548),%0A (1209562198, -5547),%0A (1224960594, -5548),%0A %5D%0A%0At, x = zip(*events)%0At = np.array(t)%0Ax = np.array(x)%0A%0At = t - t%5B0%5D # redefine zero time%0Aalpha = 1/t%5B-1%5D%0At = alpha*t # s... | |
3862ea1b1cae1c3be80824495d1c6937a18378b9 | test added | tests/pycut_test.py | tests/pycut_test.py | Python | 0 | @@ -0,0 +1,1028 @@
+#! /usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A%0A%0A# import funkc%C3%AD z jin%C3%A9ho adres%C3%A1%C5%99e%0Aimport sys%0Aimport os.path%0Aimport copy%0A%0Apath_to_script = os.path.dirname(os.path.abspath(__file__))%0Asys.path.append(os.path.join(path_to_script, %22../src/%22))%0Aimport unittest%... | |
ee169acf82eff08daa40c461263712f2af2a1131 | Add a standalone simulation script (really a duplicate of sensitivity.py) | scripts/simulate.py | scripts/simulate.py | Python | 0 | @@ -0,0 +1,1294 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22%0AThis script runs stand-alone simulation on an RMG job. This is effectively the %0Asame script as sensitivity.py%0A%22%22%22%0A%0Aimport os.path%0Aimport argparse%0A%0Afrom rmgpy.tools.sensitivity import runSensitivity%0A%0A###########... | |
0f31db66a38073e1549d977909c5f4c5d3eab280 | Create permutation-in-string.py | Python/permutation-in-string.py | Python/permutation-in-string.py | Python | 0.999383 | @@ -0,0 +1,1109 @@
+# Time: O(n)%0A# Space: O(1)%0A%0A# Given two strings s1 and s2, write a function to return true%0A# if s2 contains the permutation of s1. In other words,%0A# one of the first string's permutations is the substring of the second string.%0A#%0A# Example 1:%0A# Input:s1 = %22ab%22 s2 = %22eidbaooo%22... | |
ebb797bb7596adc71b1e906cb7d7f94b56e8f535 | Create subarray-sum-equals-k.py | Python/subarray-sum-equals-k.py | Python/subarray-sum-equals-k.py | Python | 0.9988 | @@ -0,0 +1,822 @@
+# Time: O(n)%0A# Space: O(n)%0A%0A# Given an array of integers and an integer k,%0A# you need to find the total number of continuous subarrays whose sum equals to k.%0A#%0A# Example 1:%0A# Input:nums = %5B1,1,1%5D, k = 2%0A# Output: 2%0A#%0A# Note:%0A# The length of the array is in range %5B1, 20,00... | |
c9b75d5195666efaef8b52d9f2f2b70d9b11f25f | Create individual file used for initializing db | server/models/db.py | server/models/db.py | Python | 0 | @@ -0,0 +1,58 @@
+from flask_sqlalchemy import SQLAlchemy%0A%0Adb = SQLAlchemy()
| |
c0ba4a18433a05f492cfb78716fc77e14c8b4f56 | test solvable:filelist attribute | bindings/python/tests/filelist.py | bindings/python/tests/filelist.py | Python | 0.999908 | @@ -0,0 +1,696 @@
+#%0A# Check Filelists%0A#%0A%0Aimport unittest%0A%0Aimport sys%0Asys.path.insert(0, '../../../build/bindings/python')%0A%0Aimport satsolver%0A%0A%0Aclass TestSequenceFunctions(unittest.TestCase):%0A %0A def test_filelists(self):%0A pool = satsolver.Pool()%0A assert pool%0A pool.set_arch(... | |
d1eceaf35b74166f3471dea86b194f67a152cb19 | add Python script to diff two source trees | dev-tools/scripts/diffSources.py | dev-tools/scripts/diffSources.py | Python | 0.000049 | @@ -0,0 +1,2285 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (the ... | |
74f3f70337e9924e4fce030d6a5941ce506bfee9 | Add a runserver script to start the application for development purposes | runserver.py | runserver.py | Python | 0 | @@ -0,0 +1,397 @@
+#!/usr/bin/env python%0A%0A## These two lines are needed to run on EL6%0A__requires__ = %5B'SQLAlchemy %3E= 0.8', 'jinja2 %3E= 2.4'%5D%0Aimport pkg_resources%0A%0Aimport sys%0Afrom werkzeug.contrib.profiler import ProfilerMiddleware%0A%0Afrom fresque import APP%0AAPP.debug = True%0A%0Aif '--profile' ... | |
93039b9cbea2c8355b8d8651ec0d15cdd73169a6 | Create findmean.py | udacity/findmean.py | udacity/findmean.py | Python | 0.000009 | @@ -0,0 +1,663 @@
+# The mean of a set of numbers is the sum of the numbers divided by the%0A# number of numbers. Write a procedure, list_mean, which takes a list of numbers%0A# as its input and return the mean of the numbers in the list.%0A%0A# Hint: You will need to work out how to make your division into decimal%0A#... | |
7ea9bbd3315fed4d6fd319a865517a4f72228342 | Create test.py | Python/test.py | Python/test.py | Python | 0.000005 | @@ -0,0 +1 @@
+%0A
| |
199b6bb0c62028d93e1204d96591500b0f76e834 | Add Robot_V002b.py Object Oriented Version | Robot_V002b.py | Robot_V002b.py | Python | 0.000006 | @@ -0,0 +1,2301 @@
+#!/usr/bin/python%0A%0Aimport sys%0Asys.path.append(%22/home/pi/Documents/Robots/slcypi/MA%22) ### ADD PATH%0Asys.path.append(%22/home/pi/Documents/Robots/slcypi/HAT_Python3%22) ### ADD PATH%0Aimport time%0Afrom time import sleep%0Aimport atexit%0Aimport pygame%0Aimport pygame.camera%0Afrom PIL impo... | |
eeb0187b9d474b9b5d1710e8f45f8116894eb15c | Read Temperature from DS18B20. Post the data to data.sparkfun.com | temp-sensor02/main.py | temp-sensor02/main.py | Python | 0 | @@ -0,0 +1,945 @@
+from machine import Pin%0Afrom ds18x20 import DS18X20%0Aimport onewire%0Aimport time%0Aimport machine%0Aimport ujson%0Aimport urequests%0A%0Adef posttocloud(temperature):%0A keystext = open(%22sparkfun_keys.json%22).read()%0A keys = ujson.loads(keystext)%0A url = keys%5B'inputUrl'%5D + %22?private... | |
d2e63dfc644e323bf23fbd6654f7493ed94d7991 | Use HTTPS for libchromiumcontent's URL | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'http://github-janky-artifacts.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'cfbe8ec7e14af4cabd1474386f54e197db1f7ac1'
PLATFORM = {
'cygwin': 'win32',
'darwin': ... | Python | 0 | @@ -136,11 +136,29 @@
http
+s
://
+s3.amazonaws.com/
gith
@@ -179,25 +179,8 @@
acts
-.s3.amazonaws.com
/lib
|
632f71651864517cc977f79dcdac7f3b0f516b49 | Add example script to post experiment and task data | scripts/post_data.py | scripts/post_data.py | Python | 0 | @@ -0,0 +1,991 @@
+#!/usr/bin/env python3%0A%0Aimport requests%0A%0A%0Adomain = 'http://dakis.gimbutas.lt/api/'%0Aexp_data = %7B%0A %22description%22: %22First successful post through API%22,%0A %22algorithm%22: %22TestTasks%22,%0A %22neighbours%22: %22Nearest%22,%0A %22stopping_criteria%22: %22x_dist%22,%0... | |
0c96781e2c85ea73f7fc926f7f3cfc805d6543d7 | Define chunked_argmax | Examples/SegmentVesselsUsingNeuralNetworks/scripts-xyz-slices/deploy.py | Examples/SegmentVesselsUsingNeuralNetworks/scripts-xyz-slices/deploy.py | """Routines used for applying an already trained network to images"""
import os.path
import subprocess
import time
import itk
import numpy as np
import utils
from utils import script_params
def duplicate(im):
"""Duplicate an itk image"""
f = itk.ImageDuplicator.New(im)
f.Update()
return f.GetOutput... | Python | 0.000003 | @@ -1676,24 +1676,863 @@
ert.mha')%0A%0A%0A
+def chunked_argmax(arr, window):%0A %22%22%22Compute a tuple (length arr.ndim) of arrays representing the%0A indices of the max values in window-shaped chunks of arr, which%0A must evenly divide into windows.%0A%0A %22%22%22%0A split_dim = arr.reshape(tuple(x... |
1c5ddc6803853e48eb77bd337fedbaabc56a0102 | Add empty MultiLayerPercetrsons file. | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | Python | 0 | @@ -0,0 +1,181 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0Au%22%22%22%0ACopyright (c) 2016 Masaru Morita%0A%0AThis software is released under the MIT License.%0ASee LICENSE file included in this repository.%0A%22%22%22%0A%0A
| |
5fc6b3c64b29dc5b17fec90f331cc7a2ca22704f | add main file | sms2email.py | sms2email.py | Python | 0.000001 | @@ -0,0 +1,2682 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A%0A'''%0AWork at python2.5, iphone4(ios6) with cydia, using hotmail to send the message.%0A'''%0A%0Aimport sqlite3 as sql%0Aimport email%0Aimport os%0Aimport sys%0Aimport codecs%0Aimport string%0Aimport datetime%0Afrom Queue import Queue%0Aimport tim... | |
762b87e25ded495aab3b5ff96774e8a2230f395d | Move xblock tagging model import into method. | cms/lib/xblock/tagging/tagging.py | cms/lib/xblock/tagging/tagging.py | # -*- coding: utf-8 -*-
"""
Structured Tagging based on XBlockAsides
"""
from django.conf import settings
from webob import Response
from xblock.core import XBlock, XBlockAside
from xblock.fields import Dict, Scope
from xblock.fragment import Fragment
from edxmako.shortcuts import render_to_string
from xmodule.capa_m... | Python | 0 | @@ -383,43 +383,8 @@
EW%0A%0A
-from .models import TagCategories%0A%0A
_ =
@@ -723,32 +723,148 @@
ags%0A %22%22%22%0A
+ # Import is placed here to avoid model import at project startup.%0A from .models import TagCategories%0A
return T
|
4e8d4f21749a329dd114926d3654512e9842a1e1 | Change FULL_NAME_FUNCTION to GET_FULL_NAME_FUNCTION. | idbase/views.py | idbase/views.py | from django.shortcuts import render, redirect
from django.conf import settings
from idbase.exceptions import InvalidSessionError
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def index(request, template=None):
"""Render the Identity home page."""
conf = {'urls': sett... | Python | 0.000014 | @@ -663,16 +663,20 @@
tings, '
+GET_
FULL_NAM
@@ -723,16 +723,20 @@
ettings.
+GET_
FULL_NAM
|
28749f1a0560411cfd6207563a29ff50a8bc014c | update wikinews family file from trunk r9996 | pywikibot/families/wikinews_family.py | pywikibot/families/wikinews_family.py | # -*- coding: utf-8 -*-
from pywikibot import family
__version__ = '$Id$'
# The Wikimedia family that is known as Wikinews
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wikinews'
self.languages_by_size = [
'sr', 'en', 'pl', 'fr', ... | Python | 0 | @@ -972,32 +972,482 @@
'zh'%0A %7D%0A%0A
+ # CentralAuth cross avaliable projects.%0A self.cross_projects = %5B%0A 'wiktionary', 'wikibooks', 'wikiquote', 'wikisource', 'wikinews',%0A 'wikiversity', 'meta', 'mediawiki', 'test', 'incubator', 'commons',%0A 'species',... |
c5e1b8f34c740f52117098cf5bc8f42e4c88a931 | fix for #45 | snapchat_bots/bot.py | snapchat_bots/bot.py | import logging, time, uuid, requests, base64
from pysnap import Snapchat
from pysnap.utils import make_request_token, timestamp
from snap import Snap
from constants import DEFAULT_TIMEOUT, STATIC_TOKEN, BASE_URL
FORMAT = '[%(asctime)-15s] %(message)s'
logging.basicConfig(format=FORMAT)
logger = logging.getLogger()
log... | Python | 0 | @@ -6136,21 +6136,16 @@
nap.
-get(%22
uploaded
%22):%0A
@@ -6140,18 +6140,16 @@
uploaded
-%22)
:%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.