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 |
|---|---|---|---|---|---|---|---|
8a1dff9437a4f013a96369a1fe174c505e8636cb | Add missing migration (fix #130) | puput/migrations/0004_auto_20170912_0928.py | puput/migrations/0004_auto_20170912_0928.py | Python | 0 | @@ -0,0 +1,521 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-09-12 09:28%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport django.db.models.manager%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('puput', '0003_add_short_f... | |
eb5cd2704196e8b2231b524d35433a042618ba95 | Update unit tests for /bi/ | adagios/bi/tests.py | adagios/bi/tests.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.test.client import Client
from adagios.bi import *
class TestGraphs(TestCase):
def ... | Python | 0 | @@ -3964,32 +3964,301 @@
PageLoad(self):%0A
+ self.loadPage('/bi')%0A self.loadPage('/bi/add')%0A self.loadPage('/bi/add/subprocess')%0A self.loadPage('/bi/add/graph')%0A%0A def loadPage(self, url):%0A %22%22%22 Load one specific page, and assert if return code is not 200 %22%22%2... |
8a3d757be17d395ba14ae7458036a78d10e3e212 | Test to find out how to remove a file a git repo. | holamundo.py | holamundo.py | Python | 0 | @@ -0,0 +1,102 @@
+#!/usr/bin/env python%0A%0A%0Adef main():%0A print(%22Hola mundo!!%22)%0A%0A%0Aif __name__ == %22__main__%22:%0A main()%0A
| |
17aefac614890b1fe7079a76b803707ae3fbb832 | Add perihelion | Project3/analysis/perihelion.py | Project3/analysis/perihelion.py | Python | 0.999979 | @@ -0,0 +1,2235 @@
+#!/bin/python3%0A# -*- coding: utf-8 -*-%0Afrom runner import Runner%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0A%0Aclass Perihelion(Runner):%0A def setup(self):%0A self%5B'number of years'%5D = 100%0A self%5B'do save results'%5D = True%0A self%5B'do save any ... | |
7197116b27fe6b2ba694e49d6d2b54698b5e1505 | bump version | flask_github.py | flask_github.py | # -*- coding: utf-8 -*-
"""
GitHub-Flask
============
Authenticate users in your Flask app with GitHub.
"""
import logging
from urllib import urlencode
from urlparse import parse_qs
from functools import wraps
import requests
from flask import redirect, request, json
__version__ = '0.3.3'
logger = logg... | Python | 0 | @@ -296,17 +296,17 @@
= '0.3.
-3
+4
'%0A%0Alogge
|
41f68e14fe890cac3de391f7bc4cdd5c2e5b9d75 | test B07 | spec/Order_B07_spec.py | spec/Order_B07_spec.py | Python | 0.000001 | @@ -0,0 +1,786 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Afrom primestg.order.orders import Order%0Afrom expects import expect, equal%0A%0Awith description('Order B07 Generation'):%0A%0A with it('generates expected B07 xml'):%0A expected_result = '%3COrder IdPet=%221234%22 IdReq=%22B07%22 Version=%... | |
87a00798e0f3033b3ad2b258c7bfeb7efd8ea388 | Use helper provided by model's common module. | aleph/model/role.py | aleph/model/role.py | import logging
from uuid import uuid4
from flask import current_app
from aleph.core import db, url_for, get_config
from aleph.data.validate import validate
from aleph.model.common import SoftDeleteModel, IdModel
log = logging.getLogger(__name__)
membership = db.Table('role_membership',
db.Column('group_id', db.... | Python | 0 | @@ -12,31 +12,8 @@
ing%0A
-from uuid import uuid4%0A
from
@@ -182,16 +182,29 @@
IdModel
+, make_textid
%0A%0Alog =
@@ -2358,19 +2358,21 @@
y =
-uu
+make_text
id
-4
()
-.hex
%0A%0A
|
45a91a5c32227aabf17b52960d98851cd7608dd1 | add qha plot tool (function version) | workflows/tools/plot_quasiparticle_scan.py | workflows/tools/plot_quasiparticle_scan.py | Python | 0 | @@ -0,0 +1,1078 @@
+from aiida import load_dbenv%0Aload_dbenv()%0A%0Afrom aiida.orm import load_node, load_workflow%0Afrom aiida.orm import Code, DataFactory%0A%0Aimport matplotlib.pyplot as plt%0A%0AStructureData = DataFactory('structure')%0AParameterData = DataFactory('parameter')%0AArrayData = DataFactory('array')%0... | |
082e7d63192c2e7eaa4210e0c559b145313ecc3a | Add files via upload | server/src/datasource/parse_indepexpends.py | server/src/datasource/parse_indepexpends.py | Python | 0 | @@ -0,0 +1,611 @@
+from datasource import fec%0D%0Afrom datasource import propublica%0D%0Aimport os%0D%0A%0D%0A%0D%0AFEC_APIKEY = os.getenv('FEC_API_KEY', '')%0D%0AProPublica_APIKEY = os.getenv('PP_API_KEY', '')%0D%0A%0D%0AFecApiObj = fec.FECAPI(FEC_APIKEY)%0D%0Acommittees = FecApiObj.get_committees()%0D%0APPCampFinObj... | |
d8ba95ddb1e469600c735316a1aeafa115399b3c | Add an execution module called key to return minion public key finger | salt/modules/key.py | salt/modules/key.py | Python | 0.000001 | @@ -0,0 +1,366 @@
+'''%0AFunctions to view the minion's public key information%0A'''%0A%0A# Import python libs%0Aimport os%0A%0A# Import Salt libs%0Aimport salt.utils%0A%0Adef finger():%0A '''%0A Return the minion's public key fingerprint%0A%0A CLI Example::%0A%0A salt '*' key.finger%0A '''%0A ret... | |
ce8465e5f0f085bedcd1a84220316c8eab29a493 | Add Tensor Flow | python/src/algorithm/coding/setupdate.py | python/src/algorithm/coding/setupdate.py | Python | 0.000019 | @@ -0,0 +1,434 @@
+n = int(input())%0As = set(map(int, input().split()))%0A%0AN = int(input())%0A%0Afor i in range(N):%0A cmd = input()%0A B = set(map(int, input().split()))%0A if %22symmetric_difference_update%22 in cmd:%0A s.symmetric_difference_update(B)%0A elif %22intersection_update%22 in cmd:%0... | |
b3889f8ff6d66963d4253d6796c3bb20dc9adbb7 | Add external driver and parameter file | scripts/my_Param.py | scripts/my_Param.py | Python | 0 | @@ -0,0 +1,1523 @@
+#=================================================%0A# Observation%0A#-------------------------------------------------%0AsstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc'%0AtauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc'%0A%0AsstNam... | |
771fc766446e1610a0599102720dc7e0f358e0e6 | Add wsgi file | app.wsgi | app.wsgi | Python | 0.000001 | @@ -0,0 +1,35 @@
+from app import app as application%0A
| |
fc636dbaacb5d2d1ebba1ba7f577ee4ec4deb958 | Add synthtool scripts (#3765) | google-cloud-containeranalysis/synth.py | google-cloud-containeranalysis/synth.py | Python | 0.000001 | @@ -0,0 +1,1329 @@
+# Copyright 2018 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by a... | |
1fe3fd59e4000216c4d6694690dc0ba866a66ecb | add bloom_count_intersection.py | scripts/bloom_count_intersection.py | scripts/bloom_count_intersection.py | Python | 0.000019 | @@ -0,0 +1,1332 @@
+## using bloom filter to count intersection%0A%0Aimport khmer%0Aimport sys%0Aimport screed%0Afrom screed.fasta import fasta_iter%0A%0Afilename = sys.argv%5B1%5D%0AK = int(sys.argv%5B2%5D) # size of kmer%0AHT_SIZE= int(sys.argv%5B3%5D)# size of hashtable%0AN_HT = int(sys.argv%5B4%5D) # number of hash... | |
4722c73643cbf9cbd63f05736a8469afc4c03443 | test project: convert IPAddressField fields to GenericIPAddressField | test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py | test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py | from django.db import models
class TestMe(models.Model):
test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor")
test_ip = models.IPAddressField(help_text="Lorem dolor")
test_url = models.URLField(help_text="Lorem dolor")
test_int = models.IntegerField(help_text="Lorem dolor")
... | Python | 0.000003 | @@ -148,32 +148,39 @@
est_ip = models.
+Generic
IPAddressField(h
@@ -2048,16 +2048,23 @@
models.
+Generic
IPAddres
|
63f91c2459cb98cf0cfb1e60d298944212d9d639 | add missing file in symm | symm/addons.py | symm/addons.py | Python | 0.000001 | @@ -0,0 +1,1362 @@
+#%0A# Author: Qiming Sun %3Cosirpt.sun@gmail.com%3E%0A#%0A%0Aimport numpy%0Aimport pyscf.lib.logger%0A%0Adef label_orb_symm(mol, irrep_name, symm_orb, mo):%0A nmo = mo.shape%5B1%5D%0A s = mol.intor_symmetric('cint1e_ovlp_sph')%0A mo_s = numpy.dot(mo.T, s)%0A orbsym = %5BNone%5D * nmo%0A ... | |
4eaa92fc9b08af21193a71bb996d2b9644bcea09 | Allow predicting matches 3 mins in the past | helpers/match_time_prediction_helper.py | helpers/match_time_prediction_helper.py | import datetime
import time
import pytz
import numpy as np
from helpers.match_manipulator import MatchManipulator
class MatchTimePredictionHelper(object):
EPOCH = datetime.datetime.fromtimestamp(0)
@classmethod
def as_local(cls, time, timezone):
return pytz.utc.localize(time).astimezone(timezon... | Python | 0.000001 | @@ -198,16 +198,90 @@
stamp(0)
+%0A MAX_IN_PAST = datetime.timedelta(minutes=-3) # One match length, ish
%0A%0A @c
@@ -4895,16 +4895,34 @@
imezone)
+ + cls.MAX_IN_PAST
if is_l
|
5339da4272baa6d423a69fd94adb15ede6c7ce26 | Allow for missing /etc/adagios/adagios.conf | adagios/settings.py | adagios/settings.py | # Django settings for adagios project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Hack to allow relative template paths
import os
from glob import glob
djangopath = os.path.dirname(__file__)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'd... | Python | 0.000001 | @@ -141,16 +141,42 @@
ort glob
+%0Afrom warnings import warn
%0A%0Adjango
@@ -1256,16 +1256,18 @@
e zone.%0A
+#
TIME_ZON
@@ -4606,16 +4606,25 @@
s.conf%22%0A
+try:%0A
execfile
@@ -4644,16 +4644,329 @@
igfile)%0A
+except IOError, e:%0A # Only raise on errors other than file not found (missing config is OK... |
005872ea37dfdd4b8ab8b16e3c5b0083fb86cdb9 | Add settings file | scripts/settings.py | scripts/settings.py | Python | 0.000001 | @@ -0,0 +1,2097 @@
+#!/usr/bin/env python%0A%0A%0A#===============================================================================%0A# GLOBAL CONSTANTS%0A#===============================================================================%0A%0A# --- Set up GPIO referencing----%0Abroadcom_ref = True%0A%0Aif broadcom_ref... | |
746dd90a17d756f5601ddcbbd6c2de6fed9c75d5 | add splitter script | scripts/splitter.py | scripts/splitter.py | Python | 0.000001 | @@ -0,0 +1,612 @@
+import sys%0Aimport os%0Aimport json%0Aimport pdb%0A%0A%0Acontent = %22%22%0Afor line in sys.stdin:%0A content += line%0A%0Adata = json.loads(content)%0A%0Aprint('ok')%0A%0A%0Afor item in data:%0A filename = %22items_data/%7B0%7D.json%22.format(item%5B'_key'%5D)%0A print(%22creating %22.form... | |
7a49dfb41888b6afed4ff3dca3987f641e497056 | Add PageHandler | handler/page.py | handler/page.py | Python | 0 | @@ -0,0 +1,452 @@
+#!/usr/bin/python%0A# -*- coding:utf-8 -*-%0A# Powered By KK Studio%0A%0Afrom BaseHandler import BaseHandler%0A%0A# 404 Page%0Aclass Page404Handler(BaseHandler):%0A def get(self):%0A self.render('page/404.html', title=%22404%22)%0A%0A# 500 Page%0Aclass Page500Handler(BaseHandler):%0A def... | |
d3248cebcb1ef161dfc706d99b4d361205fc9fbe | Add wsgi file | t10server.wsgi | t10server.wsgi | Python | 0.000001 | @@ -0,0 +1,45 @@
+from teeminus10_api import app as application
| |
2866c8fbb3549ffd2405c5b13338a3fdf87a6c5d | add checks | dog/checks.py | dog/checks.py | Python | 0.000001 | @@ -0,0 +1,155 @@
+from discord.ext import commands%0A%0Aowner_id = '97104885337575424'%0A%0Adef is_owner():%0A return commands.check(lambda ctx: ctx.message.author.id == owner_id)%0A
| |
482859488865fe9b1e05a923e7aafeb7e090f049 | Create volumeBars.py | python/volumeBars.py | python/volumeBars.py | Python | 0.000001 | @@ -0,0 +1,434 @@
+#!/usr/bin/env python%0Afrom rgbmatrix import RGBMatrix%0Afrom random import randint%0Aimport time%0A%0Arows = 16%0Achains = 1%0Aparallel = 1%0AledMatrix = RGBMatrix(rows, chains, parallel)%0Aheight = ledMatrix.height%0Awidth = ledMatrix.width%0AnextFrame = ledMatrix.CreateFrameCanvas()%0A%0Awhile Tr... | |
15839dd4b37761e49599f6b278f6bd6e6d18b1e5 | Add initial rpc implementation example | examples/mailbox/rpc.py | examples/mailbox/rpc.py | Python | 0 | @@ -0,0 +1,1139 @@
+import sys%0Asys.path.append('.') # NOQA%0A%0Afrom xwing.mailbox import spawn, run, stop%0A%0A%0Aclass Server(object):%0A%0A def hello_world(self):%0A return 'Hello World!'%0A%0A def run(self):%0A async def rpc_server(mailbox, server):%0A while True:%0A ... | |
f09bddb89681fdd03ac190a1caa4847b3da7a61f | add script for reinserting unparsed sentences into the parser output | src/corex/save_unparsables.py | src/corex/save_unparsables.py | Python | 0.000003 | @@ -0,0 +1,1259 @@
+#!/usr/bin/python%0A%0A# This script takes the input file (one-sentence-per-line) for the %0A# the Berkeleyparser (topological fields model) and compares it to the%0A# parser's output file. Sentences missing in the parser output (unparsables)%0A# in the output are inserted from the parsers input fil... | |
7d52d1efaf5bb07bfbb66e78f7c51e92b6c531dd | Use BytesIO. Closes #17 | ajaximage/image.py | ajaximage/image.py | import os
from PIL import Image, ImageOps
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import SimpleUploadedFile
def resize(file_, max_width=0, max_height=0, crop=0):
max_width = int(max_w... | Python | 0 | @@ -73,16 +73,22 @@
StringIO
+ as IO
%0Aexcept
@@ -119,22 +119,27 @@
import
-String
+BytesIO as
IO%0A%0Afrom
@@ -841,22 +841,16 @@
temp =
-String
IO()%0A%0A
|
5f9c6e49597abe07a74cd2e7370216bd0fc57cd4 | add topology | scripts/topology.py | scripts/topology.py | Python | 0.000018 | @@ -0,0 +1,1592 @@
+#!/usr/bin/python%0A%0Afrom mininet.net import Mininet%0Afrom mininet.node import Controller, OVSSwitch%0Afrom mininet.cli import CLI%0Afrom mininet.log import setLogLevel%0Aimport sys%0A%0Adef multiControllerNet( number ):%0A %22Create a network from semi-scratch with multiple controllers.%22%0A... | |
4ff6b846311a0f7bd6cfcf2e661a7c53061406fe | Add command to print vault info | glaciercmd/command_vault_info.py | glaciercmd/command_vault_info.py | Python | 0.000001 | @@ -0,0 +1,779 @@
+import boto%0A%0Aclass CommandVaultInfo(object):%0A%0A def execute(self, args, config):%0A glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret'))%0A%0A try:%0A vault = glacier_con... | |
d3f152ffa1d6109ded2cf85c5f8312ee4a26ec92 | version devel | src/robotide/version.py | src/robotide/version.py | # Automatically generated by `pavement.py`.
VERSION = '1.4'
| Python | 0.000001 | @@ -52,11 +52,22 @@
= '
-1.4
+devel-20150627
'%0A
|
adcbdc06f0c476bc4c24e8c69d06cffbb6726a9f | Add migration | ovp_organizations/migrations/0023_auto_20170712_1704.py | ovp_organizations/migrations/0023_auto_20170712_1704.py | Python | 0.000002 | @@ -0,0 +1,611 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-07-12 17:04%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('ovp_organization... | |
582ebd448508625ed2c9f362aaafc3fc46e60df0 | Add unit tests for security_scan | functest/tests/unit/features/test_security_scan.py | functest/tests/unit/features/test_security_scan.py | Python | 0 | @@ -0,0 +1,1289 @@
+#!/usr/bin/env python%0A%0A# Copyright (c) 2017 Orange and others.%0A#%0A# All rights reserved. This program and the accompanying materials%0A# are made available under the terms of the Apache License, Version 2.0%0A# which accompanies this distribution, and is available at%0A# http://www.apache.org... | |
25f5ff62e1652e3293d12e3e73e44e7d7c21463c | upgrade incs | bin/upgrade_fortran_inc.py | bin/upgrade_fortran_inc.py | Python | 0.000001 | @@ -0,0 +1,1537 @@
+#!/usr/bin/env python3%0A# -*- coding: utf8 -*-%0A%0A# py f:%5Cdev%5Cprogs%5Cbin%5Cclean_fortran.py ricks.f90%0A%0A# f:%5Cf90ppr%5Cmoware%5Cf90ppr.exe %3C tmp.f90 %3E out.txt%0A%0Aimport sys, os, subprocess, shutil%0Asys.path.append(r'C:%5Cmsys64%5Cmingw64%5Cbin')%0A%0Af90ppr_exe = r%22F:%5Cf90ppr%5... | |
0fe4a3c3a1d31230c9b5c931ff1e33584f1ccd4e | Create maximum-length-of-pair-chain.py | Python/maximum-length-of-pair-chain.py | Python/maximum-length-of-pair-chain.py | Python | 0.998344 | @@ -0,0 +1,971 @@
+# Time: O(nlogn)%0A# Space: O(1)%0A%0A# You are given n pairs of numbers.%0A# In every pair, the first number is always smaller than the second number.%0A#%0A# Now, we define a pair (c, d) can follow another pair (a, b)%0A# if and only if b %3C c. Chain of pairs can be formed in this fashion.%0A#%0A... | |
4f586f16eaf3e06d347bf9976a02005c70cd7e13 | Create installTests.py | installTests.py | installTests.py | Python | 0.000001 | @@ -0,0 +1,168 @@
+import unittest%0Aimport install%0A%0A%0Aclass TestOperationWrapperMethods(unittest.TestCase):%0A%0A def setUp(self):%0A # TODO: Write Tests%0A self.test_dataset = %22%22%0A
| |
95182581beebbd181b20b23ee02657cb18347dd6 | update spec: update read_spectrum.py: add read_spectrum for elodie | bopy/spec/read_spectrum.py | bopy/spec/read_spectrum.py | Python | 0 | @@ -0,0 +1,1353 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A%0AAuthor%0A------%0ABo Zhang%0A%0AEmail%0A-----%0Abozhang@nao.cas.cn%0A%0ACreated on%0A----------%0A- Tue Mar 8 15:26:00 2016 read_spectrum%0A%0AModifications%0A-------------%0A-%0A%0AAims%0A----%0A- read various kinds of spectra%0A%0A%22%22%22%0A%0Aimport ... | |
39bb6cd51ce5351bfd93adac7b083a52b25590f8 | Create 6kyu_vending_machine.py | Solutions/6kyu/6kyu_vending_machine.py | Solutions/6kyu/6kyu_vending_machine.py | Python | 0.000057 | @@ -0,0 +1,1198 @@
+class VendingMachine():%0A%0A def __init__(self, items, money):%0A self.items = dict(enumerate(items))%0A self.money = money%0A%0A def vend(self, selection, item_money):%0A try:%0A n,v = %5B(n,self.items%5Bn%5D) for n in self.items %0A if (s... | |
9d88196f37757f26dde89bdb5430d76cc4b96fd3 | Fix for Python3.4 build, requiring a __hash__ to work. | sknn/dataset.py | sknn/dataset.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, unicode_literals, print_function)
from pylearn2.space import Space, CompositeSpace, VectorSpace
from pylearn2.utils import safe_zip
from pylearn2.datasets.dataset import Dataset
from pylearn2.utils.iteration import (FiniteDatasetIterator, resolve_iterato... | Python | 0 | @@ -730,42 +730,254 @@
-pass%0A%0A def __eq__(self, other):
+%22%22%22%0A Short-circuit the entire validation if the user has specified it's not necessary.%0A %22%22%22%0A pass%0A%0A def __eq__(self, other):%0A %22%22%22%0A Equality should work between Fast and slow Vector... |
5e96dd2846660f14e1d7b691ba928da63b699f19 | Add support for Spotify | services/spotify.py | services/spotify.py | Python | 0 | @@ -0,0 +1,1055 @@
+from oauthlib.common import add_params_to_uri%0Aimport foauth.providers%0A%0A%0Aclass Spotify(foauth.providers.OAuth2):%0A # General info about the provider%0A provider_url = 'https://spotify.com/'%0A docs_url = 'https://developer.spotify.com/web-api/endpoint-reference/'%0A category = 'M... | |
062c4bc134f77f9279d18774b954a06566f99c5a | Add logger | src/acquisition/covidcast/logger.py | src/acquisition/covidcast/logger.py | Python | 0.00002 | @@ -0,0 +1,3157 @@
+%22%22%22Structured logger utility for creating JSON logs in Delphi pipelines.%22%22%22%0Aimport logging%0Aimport sys%0Aimport threading%0Aimport structlog%0A%0A%0Adef handle_exceptions(logger):%0A %22%22%22Handle exceptions using the provided logger.%22%22%22%0A def exception_handler(etype, v... | |
934f4ccfc4e34c5486c3d5a57b429742eb9b5915 | add algorithms.ml to make format for machine learning | algorithms/ml.py | algorithms/ml.py | Python | 0.000004 | @@ -0,0 +1,1262 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A%0A%22%22%22%0AMachine learning algorithms.%0A%22%22%22%0A%0Aimport sys%0A%0Afrom optparse import OptionParser%0A%0Afrom jcvi.apps.base import ActionDispatcher, debug%0Adebug()%0A%0A%0Adef main():%0A%0A actions = (%0A ('libsvm', 'convert cs... | |
2ca07d4a8893196bbf304bcdac16688505e6123a | Add a management command to register webhooks | shopify/webhooks/management/commands/webhookregister.py | shopify/webhooks/management/commands/webhookregister.py | Python | 0.000001 | @@ -0,0 +1,250 @@
+from django.core.management.base import NoArgsCommand%0A%0Afrom webhooks.models import Webhook%0A%0A%0Aclass Command(NoArgsCommand):%0A help = 'Register all created Shopify webhooks'%0A%0A def handle_noargs(self, **options):%0A Webhook.objects.register()%0A
| |
4aafeac9c238ffb8dc448c87f18abfd7f1f0c9d7 | store data dir info | gemini/anno_info.py | gemini/anno_info.py | Python | 0 | @@ -0,0 +1,205 @@
+#!/usr/bin/env python%0A%22%22%22%0AStore the path for GEMINI data-dir%0A%22%22%22%0A%0Afrom gemini.config import read_gemini_config%0A%0Aconfig = read_gemini_config()%0Aanno_dirname = config%5B%22annotation_dir%22%5D%0A%0Aprint anno_dirname%0A%0A%0A%0A
| |
9d6a053441505fae600915e24a263de798843fbb | Add test_weapon class | test_weapon.py | test_weapon.py | Python | 0.000001 | @@ -0,0 +1,1094 @@
+import unittest%0Aimport weapon%0A%0A%0Aclass TestWeapon(unittest.TestCase):%0A def setUp(self):%0A self.w = weapon.Weapon('bow', 30, 1.0, 1)%0A self.w2 = weapon.Weapon('bow', 30, 2.0, 1)%0A%0A def test_weapon_init(self):%0A self.assertEqual('bow', self.w.type)%0A s... | |
7a4b4a116a10f389f6d14321547fa1966b262c0d | Add Hacker News | sources/misc.py | sources/misc.py | Python | 0 | @@ -0,0 +1,2737 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2020 Clarence Ho (clarenceho at gmail dot com)%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restricti... | |
cd48829eb08df62d8222128b33a7c00b9ca2ed8a | Add files via upload | interpro_go_extraction_direct.py | interpro_go_extraction_direct.py | Python | 0 | @@ -0,0 +1,1855 @@
+#!/usr/bin/env python2%0A%0A# Daniel Elsner%0A%0A# 26.09.2016%0A%0A# ake the GO ID directly from Interproscan, without the need of previous cutting and grepping.%0A%0A# Input: The interproscan-output.tsv file%0A%0Aimport sys%0A%0Awith open(sys.argv%5B1%5D, 'r') as readfile:%0A id_list_content = l... | |
ed578177781ff1d4aeb0b7abb7d5f11fc5a7c626 | Create copy of WeakList and set it to raise exception instead of removing item from list | grammpy/WeakList.py | grammpy/WeakList.py | Python | 0 | @@ -0,0 +1,2606 @@
+#!/usr/bin/env python%0A%22%22%22%0A:Author Patrik Valkovic%0A:Created 31.08.2017 12:11%0A:Licence GNUv3%0APart of grammpy%0A%0A%0AOriginal implementation: https://github.com/apieum/weakreflist%0A%22%22%22%0A%0Aimport weakref%0Afrom .exceptions import TreeDeletedException%0A%0A__all__ = %5B%22WeakLi... | |
ee859881af0633d4d2d88015c907cfa856516dbe | Create TwoSum II for Lint | lintcode/000-000-Two-Sum-II/TwoSumII.py | lintcode/000-000-Two-Sum-II/TwoSumII.py | Python | 0 | @@ -0,0 +1,425 @@
+class Solution:%0A # @param nums, an array of integer%0A # @param target, an integer%0A # @return an integer%0A def twoSum2(self, nums, target):%0A # Write your code here%0A nums.sort()%0A i, j = 0, len(nums) - 1%0A res = 0%0A while i %3C j:%0A ... | |
52e8a378d8a31989c9d93ef83eabbe6df339f915 | Add data migration to add category components for VPC. | src/waldur_mastermind/marketplace/migrations/0083_offering_component.py | src/waldur_mastermind/marketplace/migrations/0083_offering_component.py | Python | 0 | @@ -0,0 +1,1643 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0Afrom waldur_mastermind.marketplace_openstack import STORAGE_TYPE, RAM_TYPE, CORES_TYPE, PACKAGE_TYPE%0A%0A%0Adef create_category_components(apps, schema_editor):%0A CATEGORY_TITLE = 'Priva... | |
df0772b3ae02ff0180f18410cf4350b493db9cb4 | Create fold_stereonet_fisher_mean.py | fold_stereonet_fisher_mean.py | fold_stereonet_fisher_mean.py | Python | 0.003638 | @@ -0,0 +1,1067 @@
+#Definition of inputs and outputs%0A#==================================%0A##%5BMes scripts GEOL%5D=group%0A##entree=vector%0A##dip_dir=field entree%0A##dip=field entree%0A%0A#Algorithm body%0A#==================================%0Afrom qgis.core import *%0Afrom apsg import *%0A%0A%0Alayer = processin... | |
8ce4b91c9f1eca911809bc2e8c315ea24eac10ae | Add scheduler example | schedule.py | schedule.py | Python | 0.000001 | @@ -0,0 +1,353 @@
+import schedule%0Aimport time%0A%0Adef job():%0A print(%22I'm working...%22)%0A%0Aschedule.every(10).minutes.do(job)%0Aschedule.every().hour.do(job)%0Aschedule.every().day.at(%2210:30%22).do(job)%0Aschedule.every(5).to(10).minutes.do(job)%0Aschedule.every().monday.do(job)%0Aschedule.every().wednes... | |
9ab752bc96c1ad8d6e718cbf87f247aba4ab76a9 | Create MiddleCharacter.py | Edabit/MiddleCharacter.py | Edabit/MiddleCharacter.py | Python | 0.000001 | @@ -0,0 +1,488 @@
+#!/usr/bin/env python3%0A'''%0ACreate a function that takes a string and returns the middle character(s). With conditions.%0A'''%0Adef get_middle(word):%0A%09if len(word) %3C= 2:%0A%09%09return word%0A%09elif len(word) %25 2 == 0:%0A%09%09return word%5B(len(word) // 2) - 1%5D + word%5B(len(word) // 2... | |
0cff0d69f0d2f52f950be37f95c8f261a9741ae7 | Create KAKAO_DATA_PREPARE_NEW.py | KAKAO_DATA_PREPARE_NEW.py | KAKAO_DATA_PREPARE_NEW.py | Python | 0 | @@ -0,0 +1,1842 @@
+import h5py%0Afrom scipy.spatial import distance%0Aimport scipy.misc%0Aimport numpy as np %0A%0Apath = './Desktop/COVER_SONG/chroma_data_training/CP_1000ms_training_s2113_d2113_170106223452.h5'%0A%0Af1 = h5py.File(path)%0AdatasetNames=%5Bn for n in f1.keys()%5D%0A%0AX = f1%5B'X'%5D%0AidxDis_train = ... | |
3de9ab07b67bd37e418cba16318aa813326793bb | Create createREFgenomesForPhasing.py | createREFgenomesForPhasing.py | createREFgenomesForPhasing.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
c87779ed6e0163503c01efd3a3913b547954d73d | Create convcsv.py | convcsv.py | convcsv.py | Python | 0.000412 | @@ -0,0 +1,1657 @@
+#!/usr/bin/python%0A#%0A# convert spreadsheet data, removing multiple spaces%0A#%0Aimport os, sys, getopt, shutil, glob, re, traceback, json, csv%0Adef handle_exception():%0A traceback.print_exc()%0A os._exit(1)%0Adef addRow(lst,row):%0A key = row%5B9%5D%0A if key in lst:%0A setlst = ... | |
1c81643eaed91b4171a4e68699d930e5ef3688db | Add negative API tests for policy validation | senlin/tests/tempest/api/policies/test_policy_validate_negative.py | senlin/tests/tempest/api/policies/test_policy_validate_negative.py | Python | 0.000005 | @@ -0,0 +1,2750 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in wri... | |
f040351dd3397ba7297b69b2468b2b37589c0d8f | Add task to get stats about files | games/management/commands/get_installer_urls.py | games/management/commands/get_installer_urls.py | Python | 0.000001 | @@ -0,0 +1,1668 @@
+import json%0Afrom collections import defaultdict%0A%0Afrom django.core.management.base import BaseCommand%0Afrom common.util import load_yaml%0Afrom games import models%0A%0A%0Aclass Command(BaseCommand):%0A def handle(self, *args, **kwargs):%0A self.stdout.write(%22Installer stats%5Cn%22... | |
cff5035ad469adc46ed9cf446bb95d9a1e07bd77 | Fix inline template | judge/templatetags/smart_math.py | judge/templatetags/smart_math.py | from HTMLParser import HTMLParser
from django.template import Library
from django.conf import settings
import re
register = Library()
MATHTEX_CGI = 'http://www.forkosh.com/mathtex.cgi'#settings.get('MATHTEX_CGI', 'http://www.forkosh.com/mathtex.cgi')
inlinemath = re.compile(r'~(.*?)~|\\\((.*?)\\\)')
def inline_temp... | Python | 0.000001 | @@ -401,16 +401,34 @@
%3Cimg
+ class=%22tex-image%22
src=%22%25s
@@ -454,16 +454,33 @@
%3Cspan
+ class=%22tex-text%22
style=%22
|
12445164d5a7651ddcc381f5e602577d8372fe6a | Add is_eq_size script | is_eq_size.py | is_eq_size.py | Python | 0.000077 | @@ -0,0 +1,559 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport click%0Afrom PIL import Image%0Afrom utils import get_file_list%0A%0A%0A@click.command()%0A@click.argument('path', type=click.Path(exists=True))%0Adef is_eq_size(path):%0A %22%22%22%0A Test all pictures in folder (recursive) for size e... | |
ad052e71145296897c1510752c0f3403b9cb45a4 | add 1st py file | hello.py | hello.py | Python | 0 | @@ -0,0 +1,54 @@
+print('Hello, Python!');%0A%0Aname = input();%0Aprint(name);
| |
73f2260e0e5ae3534f13664063808abbe73b1d72 | add a new extractor, from json files | bin/extract_json.py | bin/extract_json.py | Python | 0 | @@ -0,0 +1,1635 @@
+#!/usr/bin/env python%0A# -*- coding:utf-8 -*-%0A%0A# Copyright 2015 Pablo Santiago Blum de Aguiar %3Cscorphus@gmail.com%3E. All rights%0A# reserved. Use of this source code is governed by Apache License, Version 2.0,%0A# that can be found on https://opensource.org/licenses/Apache-2.0%0A%0Aimport js... | |
9c5031abd52152508e4ad2e06e685d1df193b279 | fix forced push | cocos/layer/base_layers.py | cocos/layer/base_layers.py | # ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008 Daniel Moisset, Ricardo Quesada, Rayentray Tappa, Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follow... | Python | 0.000003 | @@ -3644,32 +3644,74 @@
ndlers_enabled:%0A
+ if self.is_event_handler:%0A
dire
@@ -3931,32 +3931,74 @@
ndlers_enabled:%0A
+ if self.is_event_handler:%0A
dire
|
81a38564379af16f4ea2d64572e517a6657f4450 | add first test for NormalIndPower and normal_power | statsmodels/stats/tests/test_power.py | statsmodels/stats/tests/test_power.py | Python | 0 | @@ -0,0 +1,1757 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Tests for statistical power calculations%0A%0ANote:%0A test for ttest power are in test_weightstats.py%0A tests for chisquare power are in test_gof.py%0A%0ACreated on Sat Mar 09 08:44:49 2013%0A%0AAuthor: Josef Perktold%0A%22%22%22%0A%0Aimport numpy as np%0Af... | |
f24c8376847b0226f3d3f674af2f568367f15234 | add data structure for parens problem | src/linked_list.py | src/linked_list.py | Python | 0.000002 | @@ -0,0 +1,2277 @@
+%22%22%22Singly-Linked List in Python.%22%22%22%0A%0A%0Aclass Node(object):%0A %22%22%22docstring for LinkedList.%22%22%22%0A%0A def __init__(self, data, next_item=None):%0A %22%22%22Init for instance of a node.%22%22%22%0A self.data = data%0A self.next_item = next_item%0A... | |
9992a4ff90156a1c5678303530c2feeaecf700d6 | Create a_deco.py | src/misc/a_deco.py | src/misc/a_deco.py | Python | 0.00033 | @@ -0,0 +1,959 @@
+import os%0Aimport sys%0Aimport linecache%0A%0A%0Adef trace(func):%0A %22%22%22%0A A trace decorator%0A from: https://zhuanlan.zhihu.com/p/20175869%0A%0A :param func:%0A :return:%0A %22%22%22%0A def globaltrace(frame, why, arg):%0A if why == %22call%22:%0A retur... | |
463502a251111199da130e508929a35b2f126f4e | Add columns to User model | bookmarks/models.py | bookmarks/models.py | Python | 0.000001 | @@ -0,0 +1,543 @@
+from sqlalchemy import Column, Integer, String%0Afrom bookmarks.database import Base%0A%0A%0Aclass User(Base):%0A __tablename__ = 'users'%0A id = Column(Integer, primary_key=True)%0A username = Column(String(50), unique=True, nullable=False)%0A name = Column(String(120))%0A email = Col... | |
0c77666c259ba78899863bbbe482a857102c19be | add settings module | hackerearth/settings.py | hackerearth/settings.py | Python | 0.000034 | @@ -0,0 +1,377 @@
+%0A%0A# v3 API endpoints of HackerEarth Code Checker API%0ACOMPILE_API_ENDPOINT = 'https://api.hackerearth.com/v3/code/compile'%0ARUN_API_ENDPOINT = 'https://api.hackerearth.com/v3/code/run'%0A%0A# Max run time of a program in seconds%0ARUN_TIME_UPPER_LIMIT = 5%0A%0A%0A# Max memory consumption allow... | |
36af113eb363ddf25f96ab53e41db0ea7f3bb481 | add a python scripts to generate user weibo file from weibo.txt | src/main/python/data_aggregation.py | src/main/python/data_aggregation.py | Python | 0 | @@ -0,0 +1,1695 @@
+import sys, os%0A%0Adef generateData(inputData, outputDir, userLimit):%0A%09print %22Generate person weibo to folder: %22 + outputDir%0A%09if not os.path.isdir(outputDir):%0A os.mkdir(outputDir)%0A print 'Directory created at: ' + outputDir%0A%09currentID = %22%22%0A%09userNum ... | |
8c78679bc9875c698f639a0c45a5208b43162f4e | comment obsolete ff prefs script. | setup/nodes/review/set_ff_prefs.py | setup/nodes/review/set_ff_prefs.py | #!/usr/bin/python
import os
import ConfigParser
home_dir = os.path.expanduser('~')
print "home dir:", home_dir
profiles_path= os.path.join(home_dir, ".mozilla","firefox","profiles.ini")
print "profiles_path:", profiles_path
# read ini file
config = ConfigParser.RawConfigParser()
config.read([profiles_path])
profile... | Python | 0 | @@ -12,16 +12,381 @@
python%0A%0A
+%22%22%22%0AAllow a web page to access local files.%0AThis makes it easier to preview title screens and video files.%0A%0AFF stores profiles in ~/.mozilla/firefox/profiles.ini%0AFF settings are set by creating a .js file that sets things on startup%0A%0A1. count number of FF profiles... |
bb11ab050fe9a7bb0ffe83419eb0e87390f7deac | Add registration method for TB | hopsutil/tensorboard.py | hopsutil/tensorboard.py | Python | 0 | @@ -0,0 +1,932 @@
+%22%22%22%0AUtility functions to retrieve information about available services and setting up security for the Hops platform.%0A%0AThese utils facilitates development by hiding complexity for programs interacting with Hops services.%0A%22%22%22%0A%0Aimport socket%0Aimport subprocess%0Aimport os%0Aimp... | |
b22cfb4c6b8c0c0c3751078b720313d0e2baff1d | Test API call | src/filmyBot.py | src/filmyBot.py | Python | 0.000001 | @@ -0,0 +1,1298 @@
+import time,json,requests%0Aimport os%0Afrom slackclient import SlackClient%0A%0A# get the Slack API token as an environment variable%0ASLACK_BOT_TOKEN = os.environ%5B%22SLACK_BOT_TOKEN%22%5D%0ACHANNEL_NAME = %22test2%22%0ABOT_ID = %22U53TE8XSS%22%0A%0ASLACK_BOT_NAME = %22%3C@%22 + BOT_ID + %22%3E%2... | |
6f2ab55d0b83c33fad322101e7214425efd10829 | add colors to module | comoving_rv/plot.py | comoving_rv/plot.py | Python | 0 | @@ -0,0 +1,139 @@
+colors = dict()%0Acolors%5B'line_marker'%5D = '#3182bd'%0Acolors%5B'gp_model'%5D = '#ff7f0e'%0Acolors%5B'not_black'%5D = '#333333'%0Acolors%5B'fit'%5D = '#2ca25f'%0A
| |
963b1ab24767acb5253b9fe2f29749d8656b2918 | index file added | index.py | index.py | Python | 0.000001 | @@ -0,0 +1,2093 @@
+#!/usr/bin/env python%0Aimport web%0Aimport page%0Aimport upload%0Aimport utils%0A#from google.appengine.ext import db%0Aimport logging%0Afrom Cheetah.Template import Template%0Aimport os%0A%0Aurls = (%0A '/page', page.app_page,%0A '/upload', upload.app_upload,%0A '/login', %22login%22,%0A ... | |
b91eb0b8b5bd66ea0bf090e6c6e71232c81d6e7a | Add mount.py | kiwi/mount.py | kiwi/mount.py | Python | 0.000002 | @@ -0,0 +1,590 @@
+def mountpoint(path):%0A try:%0A subprocess.check_call(%5B'mountpoint', path%5D,%0A stdout=subprocess.PIPE, stderr=subprocess.PIPE)%0A except subprocess.CalledProcessError:%0A return False%0A%0A return True%0A%0Adef unmount(path):%0A subprocess.check_call(%5B'umou... | |
cc1a799da671fbbbdd0406eeebc8c5a801a099d5 | Add extension test | tests/test_extension.py | tests/test_extension.py | Python | 0.000001 | @@ -0,0 +1,645 @@
+%22%22%22%0Atests.test_extension%0A====================%0A%0ATests for extension%0A%0A%22%22%22%0Aimport json%0A%0Afrom flask import Flask%0Afrom flask_swag import Swag%0A%0A%0Adef test_extension():%0A %22%22%22Basic test for flask extension.%22%22%22%0A app = Flask(__name__)%0A app.config%5... | |
4181f69bda52c4cbec7ac1d7529d44e26ede61d1 | create object base classes. | pygeobase/object_base.py | pygeobase/object_base.py | Python | 0 | @@ -0,0 +1,3236 @@
+# Copyright (c) 2015, Vienna University of Technology, Department of Geodesy%0A# and Geoinformation. 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 ... | |
88ec4243ff78fe511331461b7563bd49f7124fe2 | Add tuple. | tuple/tuple.py | tuple/tuple.py | Python | 0.000014 | @@ -0,0 +1,106 @@
+#!/usr/local/bin/python%0Ax=(42,)%0Aprint x%0Ay=3*(3,)%0Aprint y%0Az=tuple(%22hello%22)%0Ai=1,2,3%0Aprint i%5B2%5D%0Aprint i%5B0:2%5D%0A
| |
24788b106b9cdd70e7240dc3eccac82fba290c85 | Add test for yaml enviroment | tests/util/test_yaml.py | tests/util/test_yaml.py | """Test Home Assistant yaml loader."""
import io
import unittest
from homeassistant.util import yaml
class TestYaml(unittest.TestCase):
"""Test util.yaml loader."""
def test_simple_list(self):
"""Test simple list."""
conf = "config:\n - simple\n - list"
with io.StringIO(conf) as f:... | Python | 0 | @@ -57,16 +57,26 @@
unittest
+%0Aimport os
%0A%0Afrom h
@@ -904,8 +904,696 @@
ssert 0%0A
+%0A def test_enviroment_variable(self):%0A %22%22%22Test config file with enviroment variable.%22%22%22%0A os.environ%5B%22PASSWORD%22%5D = %22secret_password%22%0A conf = %22password: !env_var PASSWORD%... |
2b0a96791ad43ef1f27b610233dd34027cf83c75 | Create currency-style.py | CiO/currency-style.py | CiO/currency-style.py | Python | 0.000003 | @@ -0,0 +1,298 @@
+import re%0A%0A%0Adef checkio(text):%0A numbers = re.findall('(?%3C=%5C$)%5B%5E %5D*%5Cd', text)%0A for old in numbers:%0A new = old.replace('.', ',')%0A if ',' in new and len(new.split(',')%5B-1%5D) == 2:%0A new = '.'.join(new.rsplit(',', 1))%0A text = text.rep... | |
a46f960e811123a137e4e5fe4350f6a850e9b33e | Create average-of-levels-in-binary-tree.py | Python/average-of-levels-in-binary-tree.py | Python/average-of-levels-in-binary-tree.py | Python | 0.004195 | @@ -0,0 +1,1272 @@
+# Time: O(n)%0A# Space: O(h)%0A%0A# Given a non-empty binary tree,%0A# return the average value of the nodes on each level in the form of an array.%0A#%0A# Example 1:%0A# Input:%0A# 3%0A# / %5C%0A# 9 20%0A# / %5C%0A# 15 7%0A# Output: %5B3, 14.5, 11%5D%0A# Explanation:%0A# The av... | |
ee076055f11638b8711658972dda8c4d4b40f666 | Enforce max length on project name (#3982) | src/sentry/web/forms/add_project.py | src/sentry/web/forms/add_project.py | from __future__ import absolute_import
from django import forms
from django.utils.translation import ugettext_lazy as _
from sentry.models import AuditLogEntry, AuditLogEntryEvent, Project
from sentry.signals import project_created
from sentry.utils.samples import create_sample_event
BLANK_CHOICE = [("", "")]
cla... | Python | 0 | @@ -408,11 +408,10 @@
gth=
-200
+64
,%0A
|
96f224a6b80720a88fefc8530aea113f975ef110 | Add new layout window command | new_layout.py | new_layout.py | Python | 0 | @@ -0,0 +1,305 @@
+import sublime, sublime_plugin%0A%0Aclass NewLayoutCommand(sublime_plugin.TextCommand):%0A def run(self, edit, **args):%0A self.view.window().run_command(%22set_layout%22, args)%0A self.view.window().run_command(%22focus_group%22, %7B %22group%22: 0 %7D)%0A self.view.window().run_command(%2... | |
62ff128888bce33cf87e083a921ddac65a2f1879 | Add regression test for #3951 | spacy/tests/regression/test_issue3951.py | spacy/tests/regression/test_issue3951.py | Python | 0.000001 | @@ -0,0 +1,585 @@
+# coding: utf8%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0Afrom spacy.matcher import Matcher%0Afrom spacy.tokens import Doc%0A%0A%0A@pytest.mark.xfail%0Adef test_issue3951(en_vocab):%0A %22%22%22Test that combinations of optional rules are matched correctly.%22%22%22%0A match... | |
8436253648c67205de23db8797c9fcc7c2172b3e | add the actual test | test/test_slice.py | test/test_slice.py | Python | 0.001366 | @@ -0,0 +1,310 @@
+# -*- Mode: Python -*-%0A# vi:si:et:sw=4:sts=4:ts=4%0A%0A'''%0ATests related to slices.%0A'''%0A%0Aimport unittest%0Aimport common%0A%0Aclass SliceTestCase:#(common.TestCase):%0A '''%0A test that slices work.%0A '''%0A def test_slice(self):%0A self.check('test_slice')%0A %0Aif _... | |
8ca0e88b7df79461f401e7c46c822f16223ddd0b | Create solution.py | hackerrank/algorithms/implementation/easy/between_two_sets/py/solution.py | hackerrank/algorithms/implementation/easy/between_two_sets/py/solution.py | Python | 0.000018 | @@ -0,0 +1,671 @@
+#!/bin/python3%0A%0Aimport sys%0A%0A# Hackerrank Python3 environment does not provide math.gcd%0A# as of the time of writing. We define it ourselves.%0Adef gcd(n, m):%0A while m %3E 0:%0A n, m = m, n %25 m%0A return n%0A%0Adef lcm(x, y):%0A return (x * y) // gcd(x, y)%0A%0Adef between... | |
325465d18e963400b427f259547d4292a47368c9 | Use Django nose for tests. | oneflow/settings/snippets/common_development.py | oneflow/settings/snippets/common_development.py | #
# Include your development machines hostnames here.
#
# NOTE: this is not strictly needed, as Django doesn't enforce
# the check if DEBUG==True. But Just in case you wanted to disable
# it temporarily, this could be a good thing to have your hostname
# here.
#
# If you connect via http://localhost:8000/, everything i... | Python | 0 | @@ -518,8 +518,95 @@
.org'%0A%5D%0A
+%0AINSTALLED_APPS += ('django_nose', )%0A%0ATEST_RUNNER = 'django_nose.NoseTestSuiteRunner'%0A%0A
|
3e9289f142efd0769beff97cddfcbcbede40f85a | add a half written Qkkk | pacfiles/Qkkk.py | pacfiles/Qkkk.py | Python | 0.999936 | @@ -0,0 +1,1231 @@
+#!/usr/bin/env python3%0Aimport pyalpm%0Aimport pycman%0Aimport tarfile%0Aimport sys, os, os.path%0A%0Apacmanconf = pycman.config.init_with_config(%22/etc/pacman.conf%22)%0Arootdir = pacmanconf.rootdir%0A%0Adef local_database():%0A%09handle = pacmanconf%0A%09localdb = handle.get_localdb()%0A%09packa... | |
701acbccc764101e00eef35dfff81dda5c5437a3 | Create pages_in_dict.py | pages_in_dict.py | pages_in_dict.py | Python | 0.000001 | @@ -0,0 +1,525 @@
+import codecs%0Aimport os%0Aimport re%0A%0Aletters = %5B%5D%0Ano_letters = %5B%5D%0Anumber_of = %7B%7D%0A%0Apages = os.listdir(%22.%22)%0A%0A%0Afor page in pages:%0A if page.endswith('.html'):%0A if page%5B0:3%5D not in letters:%0A letters.append(page%5B0:3%5D)%0A f = code... | |
39bf0b2ab6f89cfe3450102699a5bbeaf235011a | Create 4.py | 4.py | 4.py | Python | 0.000001 | @@ -0,0 +1,1296 @@
+#!/usr/bin/env python%0A%0AMAX_TRI = 999999L%0A%0Atriangles = %5B%5D%0A%0Adef next_pos(mn, pos):%0A if mn %3E triangles%5BMAX_TRI - 1%5D:%0A return -1%0A else:%0A maxv = MAX_TRI - 1%0A minv = 0%0A mid = minv + (maxv - minv) / 2%0A while triangles%5Bmid%5D != mn and minv %3C maxv:%0A... | |
ac357bc1ccefe55e25bb34021772301726ceec0e | Complete P4 | Quiz/Problem4_defMyLog.py | Quiz/Problem4_defMyLog.py | Python | 0.000001 | @@ -0,0 +1,237 @@
+def myLog(x, b):%0A '''%0A x: a positive integer%0A b: a positive integer; b %3E= 2%0A%0A returns: log_b(x), or, the logarithm of x relative to a base b.%0A '''%0A if x %3C b:%0A return 0%0A else:%0A return 1 + myLog(x / b, b)
| |
39d2813153d422ac22442eedb9f185d04203d848 | add some docstrings | pdfkit/pdfkit.py | pdfkit/pdfkit.py | # -*- coding: utf-8 -*-
import re
import subprocess
import sys
from .source import Source
from .configuration import Configuration
from itertools import chain
import io
import codecs
class PDFKit(object):
"""
url_or_file: str - either a URL, a path to a file or a string containing HTML
... | Python | 0.000022 | @@ -4175,16 +4175,340 @@
tions):%0A
+ %22%22%22Updates a dict of config options to make then usable on command line%0A%0A options: dict %7Boption name: value%7D%0A%0A returns:%0A dict: %7Boption name: value%7D - option names lower cased and prepended with%0A ... |
51feabbc27821c5acb7f0ceb932d19c0d79f16d1 | test ssl version check functions as expected in python 2.6 | tests/test_help.py | tests/test_help.py | Python | 0 | @@ -0,0 +1,590 @@
+# -*- encoding: utf-8%0A%0Aimport sys%0A%0Aimport pytest%0A%0Afrom requests.help import info%0A%0A%0A@pytest.mark.skipif(sys.version_info%5B:2%5D != (2,6), reason=%22Only run on Python 2.6%22)%0Adef test_system_ssl_py26():%0A %22%22%22OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we ... | |
63804c534f23ffbe16ff539087048d99f9fcaf17 | Implement test_encoder_decoder | test_encoder_decoder.py | test_encoder_decoder.py | Python | 0.003162 | @@ -0,0 +1,2468 @@
+#! /usr/bin/env python%0A# coding:utf-8%0A%0A%0Aif __name__ == %22__main__%22:%0A%0A import sys%0A import argparse%0A from seq2seq import decode%0A from util import load_dictionary%0A import configparser%0A import os%0A from chainer import serializers%0A%0A # GPU config%0A ... | |
8eeb4c2db613c1354c38696ac6691cf79f66a383 | Add spider for Brookdale Senior Living | locations/spiders/brookdale.py | locations/spiders/brookdale.py | Python | 0 | @@ -0,0 +1,1610 @@
+# -*- coding: utf-8 -*-%0Aimport scrapy%0Aimport json%0Afrom locations.items import GeojsonPointItem%0A%0AURL = 'https://www.brookdale.com/bin/brookdale/community-search?care_type_category=resident&loc=&finrpt=&state='%0A%0AUS_STATES = (%0A %22AL%22, %22AZ%22, %22AR%22, %22CA%22, %22CO%22, %22... | |
47893c708f3b63f79a01d5ee927f4c7d3f6dff27 | Create script to delete untitled and unpublished projects | akvo/rsr/management/commands/delete_untitled_and_unpublished_projects.py | akvo/rsr/management/commands/delete_untitled_and_unpublished_projects.py | Python | 0 | @@ -0,0 +1,2442 @@
+# -*- coding: utf-8 -*-%0A%0A# Akvo Reporting is covered by the GNU Affero General Public License.%0A# See more details in the license.txt file located at the root folder of the Akvo RSR module.%0A# For additional details on the GNU license please see %3C http://www.gnu.org/licenses/agpl.html %3E.%0... | |
03c837b0da9d7f7a6c6c54286631e9a403da3e60 | Add network scan python script - Closes #7 | backend/net_scan.py | backend/net_scan.py | Python | 0 | @@ -0,0 +1,1254 @@
+#!/usr/bin/python%0A%0Aimport sys, getopt, nmap%0A%0Adef usage():%0A print 'sword_nmap.py -t %3Ctarget%3E -p %3Cport range%3E'%0A%0Adef main(argv):%0A target=''%0A port_range=''%0A try:%0A opts, args = getopt.getopt(argv,'ht:p:',%5B'target=','ports='%5D)%0A except getopt.Getopt... | |
4699c1c301f1cb99f6c9e616b31769c01bc291d5 | change datafiles in v1.* to make it work in v2.* | v1_to_v2.py | v1_to_v2.py | Python | 0.000001 | @@ -0,0 +1,369 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport optparse, pickle, exam%0A%0Adef main():%0A opt = optparse.OptionParser()%0A (options, args) = opt.parse_args()%0A%0A for i in args:%0A with open(i,'rb') as f: data = pickle.load(f)%0A data = exam.QuestForm(data)%0A ... | |
0403d6f78189be3f3b22f068dad1db0c53687ef7 | Add ptch module and base PatchFile class. This class can unpack RLE-compressed patchfiles. | ptch/__init__.py | ptch/__init__.py | Python | 0 | @@ -0,0 +1,1614 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0APTCH files are a container format for Blizzard patch files.%0AThey begin with a 72 byte header containing some metadata, immediately%0Afollowed by a RLE-packed BSDIFF40.%0AThe original BSDIFF40 format is compressed with bzip2 instead of RLE.%0A%22%22%22%0A%0A#fr... | |
8533c93505a733980406ce655372c7742dfcfdfc | Add update policy that allows for in place upgrade of ES cluster (#1537) | troposphere/policies.py | troposphere/policies.py | from . import AWSProperty, AWSAttribute, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'MinSuccessfulInstancesPercent... | Python | 0 | @@ -1396,32 +1396,82 @@
oolean, False),%0A
+ 'EnableVersionUpgrade': (boolean, False),%0A
%7D%0A%0A%0Aclass Re
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.