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 |
|---|---|---|---|---|---|---|---|
0319803c530ef0d42845e947be6c9510a70636d1 | add missing import for previous commit | bin/addons/base/ir/ir_cron.py | bin/addons/base/ir/ir_cron.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | Python | 0 | @@ -989,24 +989,41 @@
import time%0A
+import traceback%0A
from datetim
|
fea74aa88af88ea352b72525ecbf22a0fbd4e3db | Make a histogram and visualize it | ch02/histogram.py | ch02/histogram.py | Python | 0.000114 | @@ -0,0 +1,1097 @@
+# Load the parquet file containing flight delay records%0Aon_time_dataframe = spark.read.parquet('data/on_time_performance.parquet')%0A%0A# Register the data for Spark SQL%0Aon_time_dataframe.registerTempTable(%22on_time_performance%22)%0A%0A# Compute a histogram of departure delays%0Aon_time_datafr... | |
168f6a9d557d1813649fd060dbfa1217355443df | Implement main for entry | cheat_ext/main.py | cheat_ext/main.py | Python | 0.000002 | @@ -0,0 +1,943 @@
+from __future__ import print_function%0Aimport argparse%0A%0Afrom cheat_ext.installer import (%0A install, upgrade, remove%0A)%0Afrom cheat_ext.linker import link%0A%0A%0Adef _install(args):%0A install(args.repository)%0A link(args.repository)%0A%0A%0Adef _upgrade(args):%0A upgrade(args.r... | |
6420dc0127f0f33036fe0f9258d5350da5faef6d | Create filtering.py | sciquence/sequences/filtering.py | sciquence/sequences/filtering.py | Python | 0.000001 | @@ -0,0 +1,562 @@
+def parallel_filter(condition, *lists):%0A '''%0A %0A Parallelly filter multiple lists.%0A %0A Parameters%0A ----------%0A condition: callable%0A A function, which has as many arguments as the number of lists%0A lists: list of list%0A%0A Returns%0A -------%0A f... | |
0fb323e20cfd8662c1bdd84b0ab4d928cd6d35fc | Add missing unit test for NVP metadata_mode option | quantum/tests/unit/nicira/test_nvpopts.py | quantum/tests/unit/nicira/test_nvpopts.py | # Copyright 2013 Nicira Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0.000002 | @@ -5121,16 +5121,87 @@
ctions)%0A
+ self.assertEqual('access_network', cfg.CONF.NVP.metadata_mode)%0A
|
0bd93c02ab7917d570a74cf151dfb5789c3bf174 | Add a brutal script for removing concepts in bulk while testing | scripts/remove_concepts_after.py | scripts/remove_concepts_after.py | Python | 0 | @@ -0,0 +1,1937 @@
+# An entirely untested script to delete all the concepts in the%0A# CATMAID database for a particular project.%0A%0A# Mark Longair 2010%0A%0Aimport os%0A%0Afrom jarray import array%0A%0Afrom java.sql import DriverManager, Connection, SQLException, Types%0A%0A# FIXME: Just hardcode the user_id and pr... | |
39b156cb3e208c3d06ced6fb086ab171209ac346 | add ctable fixture | psi/ctable_mappings.py | psi/ctable_mappings.py | Python | 0.000001 | @@ -0,0 +1,1072 @@
+from ctable.fixtures import CtableMappingFixture%0Afrom ctable.models import ColumnDef, KeyMatcher%0A%0A%0Aclass EventsMapping(CtableMappingFixture):%0A name = 'events'%0A domains = %5B'psi-unicef', 'psi'%5D%0A couch_view = 'psi/events'%0A schedule_active = True%0A%0A @property%0A ... | |
f3a02b3570724964f60d10a8112e0d8eb32dddc7 | Add 4chan download script | 4chan.py | 4chan.py | Python | 0 | @@ -0,0 +1,2143 @@
+#!/usr/bin/python%0D%0A%0D%0A# Protip: want to monitor a thread and download all new images every 5 seconds?%0D%0A# while x= 0 ; do 4c %5B-nf%5D url; sleep 5; done%0D%0A%0D%0Aimport re, urllib, urllib2, argparse, os%0D%0A%0D%0Aparser = argparse.ArgumentParser(description='Downloads all full-size ima... | |
8add47cf7d04f2f5e9cbea4eb036eb513e481ddd | fix populate argument | manage.py | manage.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import click
from quokka import create_app
from quokka.ext.blueprints import blueprint_commands
from quokka.core.db import db
app = create_app()
if app.config.get("LOGGER_ENABLED"):
logging.basicConfig(
level=getattr(logging, app.config.get("LOG... | Python | 0.000003 | @@ -1560,13 +1560,30 @@
'-
--
f',%0A
+ '--filename',%0A
@@ -1671,16 +1671,23 @@
pulate(f
+ilename
):%0A %22
@@ -1777,16 +1777,16 @@
opulate%0A
-
Popu
@@ -1804,16 +1804,23 @@
lepath=f
+ilename
)()%0A%0A%0A@c
|
b166caa9fb0efa4aceab315fd6a945d2fe6922e4 | Patch fixed | erpnext/patches/v7_2/update_salary_slips.py | erpnext/patches/v7_2/update_salary_slips.py | import frappe
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
def execute():
salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip`
where (month is not null and month != '')
and (fiscal_year is not null and fiscal_year != '') and
(start_dat... | Python | 0.000001 | @@ -411,16 +411,27 @@
!= 2%22%22%22
+, as_dict=1
)%0A%0A%09for
|
c2151ae33c44f29d15d494d4862645beb33671cb | Add comments tests | kansha/card_addons/comment/tests.py | kansha/card_addons/comment/tests.py | Python | 0 | @@ -0,0 +1,1272 @@
+# -*- coding:utf-8 -*-%0A#--%0A# Copyright (c) 2012-2014 Net-ng.%0A# All rights reserved.%0A#%0A# This software is licensed under the BSD License, as described in%0A# the file LICENSE.txt, which you should have received as part of%0A# this distribution.%0A#--%0A%0Afrom nagare import security%0A%0Afr... | |
29a05075e500635b10a25931045702888b12618f | add main file | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,170 @@
+import gas%0AGASANALOG = 0%0AALARMLED = 13%0A%0Agas = machine.ADC(GASANALOG)%0AgasLED = machine.Pin(ALARMLED, machine.Pin.OUT)%0A%0Ag = gas.CheckGas(led=gasLED, sensor=gas, time=1000)%0A
| |
6b96008b3e89e3ff6a5616a68e49af3e41b2bc0b | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,1620 @@
+#!/usr/bin/python%0A%0A%22%22%22%0A__version__ = %22$Revision: 1.3 $%22%0A__date__ = %22$Date: 2004/04/14 02:38:47 $%22%0A%22%22%22%0A%0Aimport nID%0Aimport plugin%0Aimport os%0A%0Arepository_nid=%22all_url:https://www.dropbox.com/s/tvyxx5iidodidz2/nid_sample_list.txt?dl=1@name:Sample Repo Name@owne... | |
9e388ad5b78967f87a0b3b55235bd1e19183c152 | Test for the PaladinSpellSchema values | tests/models/spells/test_paladin_spells.py | tests/models/spells/test_paladin_spells.py | Python | 0 | @@ -0,0 +1,2493 @@
+import unittest%0A%0Afrom tests.delete_test_db import delete_test_db # module that deletes the DB :)%0Aimport database.main%0Afrom tests.create_test_db import engine, session, Base%0A%0A%0Adatabase.main.engine = engine%0Adatabase.main.session = session%0Adatabase.main.Base = Base%0Aimport models.ma... | |
803201baa32fb847f363b6807f92f2d0b6a51c51 | Test that an error in pre_gen_project aborts generation | tests/test_abort_generate_on_hook_error.py | tests/test_abort_generate_on_hook_error.py | Python | 0.000002 | @@ -0,0 +1,607 @@
+# -*- coding: utf-8 -*-%0A%0Aimport pytest%0A%0Afrom cookiecutter import generate%0Afrom cookiecutter import exceptions%0A%0A%0A@pytest.mark.usefixtures('clean_system')%0Adef test_pre_gen_hook(tmpdir):%0A context = %7B%0A 'cookiecutter': %7B%0A %22repo_dir%22: %22foobar%22,%0A ... | |
b079edc37cd8abb68194637ee90b9fecc51b9b98 | Add basic test for document quickcaching | corehq/apps/cachehq/tests.py | corehq/apps/cachehq/tests.py | Python | 0 | @@ -0,0 +1,1199 @@
+from copy import deepcopy%0Afrom mock import patch, MagicMock%0Afrom django.test import SimpleTestCase%0Afrom dimagi.ext import couchdbkit as couch%0Afrom corehq.apps.cachehq.mixins import CachedCouchDocumentMixin%0A%0A%0Aclass BlogPost(CachedCouchDocumentMixin, couch.Document):%0A title = couch.... | |
c8cc6f4fc111d5dd2d55295e569a10cd5739ceee | test : fix for python 2.6 | lib/spack/spack/test/environment.py | lib/spack/spack/test/environment.py | import unittest
import os
from spack.environment import EnvironmentModifications, apply_environment_modifications
class EnvironmentTest(unittest.TestCase):
def setUp(self):
os.environ.clear()
os.environ['UNSET_ME'] = 'foo'
os.environ['EMPTY_PATH_LIST'] = ''
os.environ['PATH_LIST'] ... | Python | 0.000013 | @@ -2651,24 +2651,18 @@
-self.
assert
-Is(x,
+ x is
y
-)
%0A
|
ce5ba72605e93e4fd83f36cced28d7c813c95e54 | Create myfile.py | myfile.py | myfile.py | Python | 0.000011 | @@ -0,0 +1,3496 @@
+import os%0Aimport re%0A%0A%0Adef searchByExt(rootpath, ext):%0A print '----- File List -----'%0A results = %5B%5D%0A for root, dirs, files in os.walk(rootpath):%0A for filename in files:%0A if re.search(r'.*%5C.%25s' %25 ext, filename):%0A result = os.path.... | |
b159433375714c67ac36e58d4323196222759f30 | Add missing migration from 096092b. | babybuddy/migrations/0003_add_refresh_help_text.py | babybuddy/migrations/0003_add_refresh_help_text.py | Python | 0 | @@ -0,0 +1,939 @@
+# Generated by Django 2.0.5 on 2018-07-15 14:16%0A%0Aimport datetime%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('babybuddy', '0002_add_settings'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(... | |
0104f898a4a54027688411dd20d39aeecfc31f6d | Create player.py | player.py | player.py | Python | 0 | @@ -0,0 +1,1545 @@
+import pygame%0Aimport ss%0A%0Aclass Player(pygame.sprite.Sprite):%0A%09def __init__(self, level, *groups):%0A%09%09super(Player, self).__init__(*groups)%0A%09%09self.Rimg = pygame.image.load('RangerDanR.png')%0A%09%09self.Limg = pygame.image.load('RangerDanL.png')%0A%09%09self.image = self.Rimg%0A%... | |
59fa328c62cc7808bce365ddb1e0e1c0d744913b | add a basic reader | reader.py | reader.py | Python | 0.000022 | @@ -0,0 +1,126 @@
+import feedparser%0A%0Arss_url = %22http://towerjoo.github.io/feed.xml%22%0Afeed= feedparser.parse(rss_url)%0Aimport pdb;pdb.set_trace()%0A%0A
| |
7a75185e7a7e7f5b3a1c78a21a6b75b24da1911a | Update __init__.py | tendrl/commons/flows/create_cluster/__init__.py | tendrl/commons/flows/create_cluster/__init__.py | # flake8: noqa
import json
import uuid
from tendrl.commons import flows
from tendrl.commons.event import Event
from tendrl.commons.message import Message
from tendrl.commons.flows import utils
from tendrl.commons.flows.create_cluster import ceph_help
from tendrl.commons.flows.create_cluster import gluster_help
from t... | Python | 0.000072 | @@ -799,32 +799,42 @@
= %5B%5D%0A if
+%22ceph%22 in
self.parameters%5B
@@ -833,37 +833,41 @@
ameters%5B
-'sds_type'%5D == %22ceph%22
+%22TendrlContext.sds_name%22%5D
:%0A
@@ -1514,16 +1514,26 @@
if
+%22ceph%22 in
self.par
@@ -1544,29 +1544,33 @@
ers%5B
-'sds_type'%5D == %22ceph%22
+%22Tendr... |
33ac2d94afb48e1ddeeefbe3f840c5f66a82fd98 | call get_object_or_404 outside our try block | memopol2/main/views.py | memopol2/main/views.py | import time
from datetime import datetime
from django.http import HttpResponse, HttpResponseServerError
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.utils import simplejson
from django.core import serializers
from django.contrib.admin.views.... | Python | 0 | @@ -5838,29 +5838,16 @@
:False%7D%0A
- try:%0A
posi
@@ -5913,16 +5913,25 @@
_id'%5D))%0A
+ try:%0A
|
374f516be38e9630ff1ff6cda4146d0ebd2a9537 | remove model | corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py | corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py | Python | 0.000001 | @@ -0,0 +1,301 @@
+# Generated by Django 2.2.13 on 2020-10-28 09:55%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('sms', '0047_merge_20200918_1641'),%0A %5D%0A%0A operations = %5B%0A migrations.DeleteModel(%0A name='SQ... | |
e41b79855e966977c4484efd4ad6a02475833b3e | Add ex4.4: tornado multiple requests with asyncio integration | code/ex4.4-tornado_with_asyncio.py | code/ex4.4-tornado_with_asyncio.py | Python | 0.000001 | @@ -0,0 +1,616 @@
+from tornado.platform.asyncio import AsyncIOMainLoop, to_asyncio_future%0Afrom tornado.httpclient import AsyncHTTPClient%0Aimport asyncio%0Aimport time%0A%0A%0AURL = 'http://127.0.0.1:8000'%0A%0A%0A@asyncio.coroutine%0Adef get_greetings():%0A http_client = AsyncHTTPClient()%0A response = yield ... | |
a8e66380cb63e52ad57f66cb9e1a652dca5b32b9 | Create __init__.py | puppet/__init__.py | puppet/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
e81426b1f7890c056f926281c5a445bc6e74c80b | Create py-参数传递.py | py-参数传递.py | py-参数传递.py | Python | 0.000005 | @@ -0,0 +1,144 @@
+# %E5%8C%85%E8%A3%B9%E5%85%B3%E9%94%AE%E5%AD%97%E4%BC%A0%E9%80%92 dic%E6%98%AF%E4%B8%80%E4%B8%AA%E5%AD%97%E5%85%B8 %E6%94%B6%E9%9B%86%E6%89%80%E6%9C%89%E7%9A%84%E5%85%B3%E9%94%AE%E5%AD%97%E4%BC%A0%E9%80%92%E7%BB%99%E5%87%BD%E6%95%B0func_t%0Adef func_t(**dic):%0A print type(dic)%0A print dic%0A%... | |
4f265b626c9ff5c333ea6c27cb08b45c2cecc7f3 | Add plugin code | gitcommitautosave.py | gitcommitautosave.py | Python | 0.000001 | @@ -0,0 +1,554 @@
+%22%22%22Git Commit Auto Save.%0A%0ASublime Text 3 package to auto save commit messages when the window is closed.%0AThis allows the user to close the window without having to save before,%0Aor having to deal with the %22Save File%22 popup.%0A%22%22%22%0Aimport sublime_plugin%0A%0A%0Aclass GitCommitA... | |
ac482caafe8c63de2606bb4894462f7b2e2bcb70 | Add initial script to print rosbag files | python/printbag.py | python/printbag.py | Python | 0 | @@ -0,0 +1,1078 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Convert a rosbag file to legacy lidar binary format.%0A%22%22%22%0A%0A%22%22%22LIDAR datatype format is:%0A (%0A timestamp (long),%0A flag (bool saved as int),%0A accelerometer%5B3%5D (double),%0A gps%5B3%5D (d... | |
5cf2c2c4dcbc9e0cca57a7634e5118c2dc278c75 | Add media compatibility | twilio/rest/resources/compatibility/media.py | twilio/rest/resources/compatibility/media.py | Python | 0 | @@ -0,0 +1,305 @@
+from twilio.rest.resources import InstanceResource, ListResource%0A%0A%0Aclass Media(InstanceResource):%0A pass%0A%0A%0Aclass MediaList(ListResource):%0A%0A def __call__(self, message_sid):%0A base_uri = %22%25s/Messages/%25s%22 %25 (self.base_uri, message_sid)%0A return MediaList... | |
a2e566cc0b925f80c30602141e890cdf9b13306b | Migrate to latest version of db. | migrations/versions/1003fd6fc47_.py | migrations/versions/1003fd6fc47_.py | Python | 0 | @@ -0,0 +1,958 @@
+%22%22%22empty message%0A%0ARevision ID: 1003fd6fc47%0ARevises: 1a54c4cacbe%0ACreate Date: 2015-03-24 13:33:50.898511%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '1003fd6fc47'%0Adown_revision = '1a54c4cacbe'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Afrom sq... | |
4aced6fea8ff8ccd087362cb237a9f00d111d0d8 | Add command to turn on locations flag | corehq/apps/commtrack/management/commands/toggle_locations.py | corehq/apps/commtrack/management/commands/toggle_locations.py | Python | 0.000001 | @@ -0,0 +1,976 @@
+from django.core.management.base import BaseCommand%0Afrom corehq.apps.domain.models import Domain%0Afrom corehq.feature_previews import LOCATIONS%0Afrom corehq.toggles import NAMESPACE_DOMAIN%0Afrom toggle.shortcuts import update_toggle_cache, namespaced_item%0Afrom toggle.models import Toggle%0A%0A... | |
1eaab9f929dc748e57865fb4c8717158e6c47fa5 | Add more index on contact activities | ureport/stats/migrations/0018_better_indexes.py | ureport/stats/migrations/0018_better_indexes.py | Python | 0 | @@ -0,0 +1,530 @@
+# Generated by Django 3.2.6 on 2021-10-13 12:37%0A%0Afrom django.db import migrations%0A%0A# language=SQL%0AINDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = %22%22%22%0ACREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null on stats_contactactivity (org_id, date, scheme) WHE... | |
9e947d389e68ff7d2653681c065bf55544874ba6 | move progress_bar.finish to after pool.join to avoid ipython zmq problems | qutip/parallel.py | qutip/parallel.py | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | Python | 0 | @@ -7927,66 +7927,61 @@
p
-rogress_bar.finished()%0A %0A pool.close()%0A pool.join
+ool.close()%0A pool.join()%0A progress_bar.finished
()%0A%0A
|
9becada645e9680974dbb18fee10983d204dfd3d | Create low-res cubes, masks, and moment arrays | 14B-088/HI/analysis/cube_pipeline_lowres.py | 14B-088/HI/analysis/cube_pipeline_lowres.py | Python | 0.000001 | @@ -0,0 +1,2811 @@
+%0A'''%0AConvolve the VLA + GBT data to 2 * beam and 5 * beam, then run the%0Amasking and moments pipeline.%0A%0AMake signal masks and compute the moments.%0A'''%0A%0Afrom astropy import log%0Aimport os%0Afrom radio_beam import Beam%0Afrom spectral_cube import SpectralCube%0Afrom cube_analysis impor... | |
d0a053acf6773c24b5fce2ec1ac56a5800ca1a28 | Add discord return types to VoiceStateUpdate props | musicbot/constructs.py | musicbot/constructs.py | import discord
from .utils import objdiff
class SkipState:
def __init__(self):
self.skippers = set()
self.skip_msgs = set()
@property
def skip_count(self):
return len(self.skippers)
def reset(self):
self.skippers.clear()
self.skip_msgs.clear()
def add_sk... | Python | 0 | @@ -1458,32 +1458,50 @@
def me(self)
+ -%3E discord.Member
:%0A return
@@ -1638,32 +1638,51 @@
ce_channel(self)
+ -%3E discord.Channel
:%0A return
@@ -1742,24 +1742,43 @@
hannel(self)
+ -%3E discord.Channel
:%0A re
|
8fbd7421e9517ead4293c62086f3305810c93b1b | Add initial manage/fabfile/ci.py (sketch) | manage/fabfile/ci.py | manage/fabfile/ci.py | Python | 0 | @@ -0,0 +1,481 @@
+from fabric.api import *%0A%0A@task%0A@role('ci')%0Adef install():%0A sudo(%22apt-get install git%22)%0A sudo(%22apt-get install maven2%22) # TODO: maven3%0A sudo(%22apt-get install groovy%22) # TODO: groovy-1.8, or gradle...%0A configure_groovy_grapes()%0A sudo(%22apt-get install pyth... | |
95d87c541ebf82109b882daebcb5b387f0f1cdb8 | Read the american physics society graph | exp/influence2/ReputationExp2.py | exp/influence2/ReputationExp2.py | Python | 0.000047 | @@ -0,0 +1,2522 @@
+import numpy %0Atry: %0A ctypes.cdll.LoadLibrary(%22/usr/local/lib/libigraph.so%22)%0Aexcept: %0A pass %0Aimport igraph %0Afrom apgl.util.PathDefaults import PathDefaults %0Afrom exp.util.IdIndexer import IdIndexer %0Aimport xml.etree.ElementTree as ET%0Aimport array %0A%0AmetadataDir = PathD... | |
8f391cfd541f68a3c4bfc20be68c32d4e2d6798f | Add server script | server.py | server.py | Python | 0.000001 | @@ -0,0 +1,1167 @@
+#!/usr/bin/python3%0A%0A# import the necessary components%0Afrom flask import Flask, request, jsonify%0Aapp = Flask(__name__)%0A%0A# define a dictionary to store our information in%0Ainfo = %7B%7D%0A%0A# listen for data at /data%0A@app.route(%22/data%22, methods=%5B%22GET%22, %22POST%22%5D)%0Adef ap... | |
a49d1d96b49eb6006e864bbaf2757cd5358b0110 | Create func.py | func.py | func.py | Python | 0.000037 | @@ -0,0 +1,392 @@
+#it's fun, c?%0Adef read_poi(file):%0A poi_dict = %7B%7D%0A%0A #taken from project2%0A for line in file:%0A line = line.rstrip()%0A if len(line) == 0:%0A continue%0A parts = line.split(' ', 2)%0A print(parts%5B0%5D,parts%5B1%5D,parts%5B2%5D)%0A%0A ... | |
4810c88d484bc02fe5f7983dbf9cac0be5a440cd | Create reverse_word_order.py | 09-revisao/practice_python/reverse_word_order.py | 09-revisao/practice_python/reverse_word_order.py | Python | 0.998843 | @@ -0,0 +1,611 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%22%22%22Exercise 15: Reverse Word Order%0A%0AWrite a program (using functions!) that asks the user for a long string%0Acontaining multiple words. Print back to the user the same string,%0Aexcept with the words in backwards order. For example, say I ... | |
c460874436ee087a50f9f7ec06c15ae9a110a656 | Initialize web spider class definition & imports | spider.py | spider.py | Python | 0 | @@ -0,0 +1,156 @@
+from scrapy.contrib.spiders import CrawlSpider, Rule%0Afrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor%0Afrom scrapy.selector import Selector%0A%0A
| |
3f6e3d60588dec447fffbfc7e5fc65f34cbd3aa7 | fix bug in version.py subprocess call | cobra/version.py | cobra/version.py | #!/usr/bin/env python
"""
Tracks the version number. If git is installed and file script
is located within a git repository, git describe is used to get
the version information. This version string is sanitized to
comply with PEP 386 and stored in the RELEASE-VERSION file.
If git describe can not be run, the RELEASE-... | Python | 0.000001 | @@ -707,19 +707,19 @@
bbrev%5D,
-dir
+cwd
=current
|
957490251e5038d9fb963f0c43ea3973e763c134 | Add test | tests/test_plotter.py | tests/test_plotter.py | Python | 0.000005 | @@ -0,0 +1,1262 @@
+from moca.plotter import create_plot%0Aimport os%0Aimport pytest%0A%0A@pytest.mark.mpl_image_compare(baseline_dir='data/images',%0A filename='ENCSR000AKB_PhyloP_1.png')%0A%0Adef join_path(head, leaf):%0A return os.path.join(head, leaf)%0A%0Adef test_image():%0A ba... | |
ed0a2a8fc20a44499d9db03d2eb8fcd58c1b0cd3 | Add unit tests | tests/test_session.py | tests/test_session.py | Python | 0.000001 | @@ -0,0 +1,1240 @@
+# Local imports%0Afrom uplink import session%0A%0A%0Adef test_base_url(uplink_builder_mock):%0A # Setup%0A uplink_builder_mock.base_url = %22https://api.github.com%22%0A sess = session.Session(uplink_builder_mock)%0A%0A # Run & Verify%0A assert uplink_builder_mock.base_url == sess.bas... | |
f1b22c952dabb3b66638000078e1ab2d0b7acea2 | Add missing utils file | homedisplay/homedisplay/utils.py | homedisplay/homedisplay/utils.py | Python | 0 | @@ -0,0 +1,193 @@
+import redis%0Aimport json%0A%0Aredis_instance = redis.StrictRedis()%0A%0Adef publish_ws(key, content):%0A redis_instance.publish(%22home:broadcast:generic%22, json.dumps(%7B%22key%22: key, %22content%22: content%7D))%0A
| |
f338d34e750fd4d06cd0992c7f457c403b1cff3b | add a simple tool to dump the GETLBASTATUS provisioning status | tools/getlbastatus.py | tools/getlbastatus.py | Python | 0 | @@ -0,0 +1,1103 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0Aimport sys%0A%0Afrom pyscsi.pyscsi.scsi import SCSI%0Afrom pyscsi.pyscsi.scsi_device import SCSIDevice%0Afrom pyscsi.pyscsi.scsi_enum_getlbastatus import P_STATUS%0A%0A%0Adef usage():%0A print 'Usage: getlbastatus.py %5B--help%5D %5B-l %3Clba%3E%5D %3C... | |
f7f122be60e8ffe03f8d449d619b21ec314b37a1 | Include total sync time used in sync_status_stats. | stats_cron.py | stats_cron.py | from tapiriik.database import db
from datetime import datetime, timedelta
# total distance synced
distanceSynced = db.sync_stats.aggregate([{"$group": {"_id": None, "total": {"$sum": "$Distance"}}}])["result"][0]["total"]
# sync time utilization
db.sync_worker_stats.remove({"Timestamp": {"$lt": datetime.utcnow() - ti... | Python | 0 | @@ -2207,16 +2207,59 @@
alErrors
+,%0A %22SyncTimeUsed%22: TotalSyncTimeUsed
%0A%7D)%0A%0Adb.
|
46c816f169b29a8fe91f14ab477222873d9bed88 | Add DocTestParser | robot/docparser.py | robot/docparser.py | Python | 0 | @@ -0,0 +1,778 @@
+import re%0A%0A%0Aclass DocTestParser(object):%0A %22%22%22Find all externaltestcaseid's in a test's docstring.%0A%0A If your externaltestcaseid prefix is abc and the test has 'abc-123' in it's docstring.%0A %60DocTestParser('abc').get_testcases()%60 would return %60%5B'abc-123'%5D%60.%0A ... | |
4f2c91c06ab13eec02ef0199ef45d0eeaf555ea7 | Add dunder init for lowlevel. | astrodynamics/lowlevel/__init__.py | astrodynamics/lowlevel/__init__.py | Python | 0 | @@ -0,0 +1,81 @@
+# coding: utf-8%0Afrom __future__ import absolute_import, division, print_function%0A
| |
6473cf17576fb0f52c653d96e22c4c9bf316250a | Remove elipses from examples instead of commenting them out | src/etc/extract-tests.py | src/etc/extract-tests.py | # Script for extracting compilable fragments from markdown
# documentation. See prep.js for a description of the format
# recognized by this tool. Expects a directory fragements/ to exist
# under the current directory, and writes the fragments in there as
# individual .rs files.
import sys, re;
if len(sys.argv) < 3:
... | Python | 0 | @@ -1610,15 +1610,8 @@
%22, %22
-/*...*/
%22, l
|
de10593be3c513d41423dffcedd220c02dd37d6c | Add config_default.py | config_default.py | config_default.py | Python | 0.000004 | @@ -0,0 +1,851 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on 2015-10-23 08:06:00%0A%0A@author: Tran Huu Cuong %3Ctranhuucuong91@gmail.com%3E%0A%0A%22%22%22%0Aimport os%0A%0A# Blog configuration values.%0A%0A# You may consider using a one-way hash to generate the password, and then%0A# use the hash again in the l... | |
95bb2d362e6a41b4e6421b5e8752b5040ea23d3f | Test file | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,293 @@
+from flir.stream import Stream%0Afrom flir.flir import FLIR%0Aimport time%0A%0A%0A#h = Stream(%22129.219.136.149%22, 4000)%0A#h.connect()%0A#time.sleep(5)%0A#h.write(%22PP-500%22.encode(%22ascii%22))%0A%0Ax = FLIR(%22129.219.136.149%22, 4000)%0Ax.connect()%0Ax.pan(30)%0Aprint(x.pan())%0Ax.pan_offset(... | |
ea422aabe19e13ad6811496470fcd7c341820333 | add reject quote route | main.py | main.py | from flask import *
from flask.json import JSONEncoder
from flask.ext.cors import CORS
from flask.ext.login import LoginManager, login_user , logout_user , current_user , login_required
import simplejson as json
import os, sys
import datetime
app = Flask(__name__)
sess = Session()
app.config.from_object('config')
if... | Python | 0 | @@ -3577,16 +3577,265 @@
alize)%0A%0A
+# unapproves/ rejects a single quote%0A@app.route(%22/quote/%3Cint:id%3E/reject%22, methods = %5B'PUT'%5D)%0A@login_required%0Adef reject_quote(id):%0A quote = Quote.query.get(id)%0A quote.active = False%0A db.session.commit()%0A return jsonify(quote.serialize)%0A%0A
... |
e2020af5ccd41f8571a2d0db4f5345ca9a8b561e | Add migration for db changes | gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py | gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py | Python | 0 | @@ -0,0 +1,1949 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.2 on 2017-08-05 01:07%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 ('app', '0009_aut... | |
a0cd167b9f19e2a4a9d1f2a80bc3586cce15c6ab | Add GMN DB migration to current | gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py | gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py | Python | 0 | @@ -0,0 +1,428 @@
+# Generated by Django 2.2 on 2019-04-18 20:12%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('app', '0018_auto_20180901_0115'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterModelOptions(%0A name='... | |
a6ef1e2456f84b50102c4192984b0c18b9c81a27 | Create scriptGenerator.py | scriptGenerator.py | scriptGenerator.py | Python | 0.000001 | @@ -0,0 +1,1603 @@
+#!/usr/bin/env python%0A#GENERATE A NEW SCRIPT %0Adef Creation():%0Afichero=open('generator.py','w')%0Afichero.close()%0Adef Save():%0Afichero=open('generator.py','a')%0Afichero.write('from PyQt4.QtGui import *%5Cn')%0Afichero.write('import sys%5Cn')%0Afichero.write('class Window(QWidget):%5Cn')%0Af... | |
844810f393724684d855e6e12fd20c392b6f06a0 | check if key even exists before going into os.environ | src/pyechonest/config.py | src/pyechonest/config.py | """
Global configuration variables for accessing the Echo Nest web API.
"""
ECHO_NEST_API_KEY = None
__version__ = "$Revision: 0 $"
# $Source$
import os
if(os.environ['ECHO_NEST_API_KEY']):
ECHO_NEST_API_KEY = os.environ['ECHO_NEST_API_KEY']
else:
ECHO_NEST_API_KEY = None
API_HOST = 'developer.echonest.co... | Python | 0.000001 | @@ -153,27 +153,16 @@
os%0A%0Aif(
-os.environ%5B
'ECHO_NE
@@ -172,17 +172,30 @@
API_KEY'
-%5D
+ in os.environ
):%0A E
@@ -922,12 +922,13 @@
tle you.%0A%22%22%22
+%0A
|
1c2ba73eb0405dcfd427574c197e6a0588390f67 | Simplify shipping template tags | oscar/templatetags/shipping_tags.py | oscar/templatetags/shipping_tags.py | from django import template
register = template.Library()
@register.tag
def shipping_charge(parse, token):
"""
Template tag for calculating the shipping charge for a given shipping
method and basket, and injecting it into the template context.
"""
return build_node(ShippingChargeNode, token)
@... | Python | 0 | @@ -57,32 +57,43 @@
y()%0A%0A%0A@register.
+assignment_
tag%0Adef shipping
@@ -100,28 +100,30 @@
_charge(
-parse, token
+method, basket
):%0A %22
@@ -289,44 +289,31 @@
urn
-build_node(ShippingChargeNode, token
+method.calculate(basket
)%0A%0A%0A
@@ -314,32 +314,43 @@
et)%0A%0A%0A@register.
+assignment_
tag%... |
3ef6a9dbe2916d669d3e7e7cfab86a365237bc19 | Make octane result format match the old v8_benchmark output. | tools/perf/perf_tools/octane.py | tools/perf/perf_tools/octane.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import multi_page_benchmark
from telemetry import util
class Octane(multi_page_benchmark.MultiPageBenchmark):
def MeasurePage(self, _, ... | Python | 0.999996 | @@ -739,24 +739,26 @@
0)%0A
-results%5B
+var key =
result_d
@@ -766,16 +766,56 @@
vs%5Br%5D.id
+.replace('Result-', '');%0A results%5Bkey
%5D = resu
@@ -992,20 +992,12 @@
ts%5B'
-Result-Octan
+scor
e'%5D
@@ -1201,32 +1201,164 @@
-results.Add(key, '', valu
+data_type = 'unimportant'%0A if key ... |
238f5788211ed117ceedbb234e7404bc02716d60 | add serializer.py | apps/zblog/serializers.py | apps/zblog/serializers.py | Python | 0.000004 | @@ -0,0 +1,368 @@
+%0Afrom rest_framework import serializers%0A%0A# Serializers define the API representation.%0Aclass ArticleSerializer(serializers.HyperlinkedModelSerializer):%0A class Meta:%0A model = Article%0A #fields = ('title', 'content', 'hits', 'created_time', 'updated_time', 'category', 'tags... | |
4e962d97b6a9d97db915c92c5a388a3a36573d63 | add 32 | p032.py | p032.py | Python | 0.999999 | @@ -0,0 +1,345 @@
+import itertools%0A%0Amatches = set()%0Afor i in itertools.permutations('123456789', 9):%0A for s in xrange(1, 4):%0A for s2 in xrange(s + 1, (14 - s) / 2):%0A a = int(''.join(i%5B:s%5D))%0A b = int(''.join(i%5Bs:s2%5D))%0A c = int(''.join(i%5Bs2:%5D))%0A ... | |
691a5873596c487eece704bad991270c6b275dde | Create Game_of_Master_Mind.py | Cracking_Coding_Interview/Game_of_Master_Mind.py | Cracking_Coding_Interview/Game_of_Master_Mind.py | Python | 0.000001 | @@ -0,0 +1,845 @@
+class Result:%0A def __init__(self):%0A self.hit = 0%0A self.pseudohit = 0%0A%0Adef estimate(guess, solution):%0A if len(guess) != len(solution): return None%0A result = Result()%0A idict = %7B%7D%0A for i, char in enumerate(guess):%0A if char == solution%5Bi%5D:%0... | |
b5906545121d4d5229552d3e2243a290810d1c1c | add self-connect.py | python/self-connect.py | python/self-connect.py | Python | 0.000001 | @@ -0,0 +1,458 @@
+#!/usr/bin/python%0A%0Aimport errno%0Aimport socket%0Aimport sys%0Aimport time%0A%0Aif len(sys.argv) %3C 2:%0A%09print %22Usage: %25s port%22 %25 sys.argv%5B0%5D%0A%09print %22port should in net.ipv4.ip_local_port_range%22%0Aelse:%0A%09port = int(sys.argv%5B1%5D)%0A%09for i in range(65536):%0A%09%09t... | |
d4151bf2a30fc8a497f7d4cb3f6eba4b6913447e | Create tester.py | tester.py | tester.py | Python | 0.000002 | @@ -0,0 +1,14 @@
+print(%22hey!%22)%0A
| |
2d5fa61c1edc91621befe54d7fd08642f67b68f8 | add jar_dir | recipes/pilon/pilon.py | recipes/pilon/pilon.py | #!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
#
# Program Parameters
#
import os
import... | Python | 0.000003 | @@ -2491,16 +2491,90 @@
s_args%0A%0A
+ if '--jar_dir' in sys.argv%5B1:%5D:%0A print(jar_path)%0A else:%0A
sys.
|
e1ceaa62c7e6f0974b21a23105280da49e9657bf | Send push notifications | regrowl/bridge/push.py | regrowl/bridge/push.py | Python | 0 | @@ -0,0 +1,1631 @@
+%22%22%22%0ASend push notifications%0A%0AUses pushnotify to send notifications to iOS and Android devices%0A%0ARequires https://pypi.python.org/pypi/pushnotify%0A%0ASample config%0A%0A%5Bregrowl.bridge.push%5D%0Alabel = prowl,%3Capikey%3E%0Aother = nma,%3Capikey%3E%0Aexample = pushover,%3Capikey%3E%... | |
f423a32dac3b3232a03e6eebdb0664d2b5cdf87e | Add test for ordinal | tests/app/utils/test_time.py | tests/app/utils/test_time.py | Python | 0.000418 | @@ -0,0 +1,183 @@
+from app.utils.time import make_ordinal%0A%0A%0Aclass WhenMakingOrdinal:%0A%0A def it_returns_an_ordinal_correctly(self):%0A ordinal = make_ordinal(11)%0A assert ordinal == '11th'%0A
| |
5647dfbf3aa2b2c5cb7f32b60b21a47ad2ee6f20 | add google foobar exercise | solution_level1.py | solution_level1.py | Python | 0.000001 | @@ -0,0 +1,397 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Adef answer(s):%0A re = ''%0A a = ord('a')%0A z = ord('z')%0A for c in s:%0A ascii_code = ord(c)%0A if ascii_code %3E= a and ascii_code %3C= z:%0A tmp = chr(a + z -ascii_code)%0A re = re + tmp%0A else... | |
e1b23ecf168d397da373c4441c67e655da58e3e9 | Add basic Log class to represent a log record. | source/bark/log.py | source/bark/log.py | Python | 0 | @@ -0,0 +1,958 @@
+# :coding: utf-8%0A# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips%0A# :license: See LICENSE.txt.%0A%0Afrom collections import MutableMapping%0A%0A%0Aclass Log(MutableMapping):%0A '''Hold individual log data.'''%0A%0A def __init__(self, *args, **kw):%0A '''Initialise log.'''%0A... | |
6c6214681ee89f2f67b09542fcf7690aa61954b9 | Add maybe_make_dir() | file/maybe_make_dir.py | file/maybe_make_dir.py | Python | 0.000001 | @@ -0,0 +1,530 @@
+import os%0A%0A# ==============================================================================%0A# MAYBE_MAKE_DIR%0A# ==============================================================================%0Adef maybe_make_dir(path):%0A %22%2... | |
c57bfdfae235e7ed7b5f13922a7fbc64dbd112f1 | Add a missing migration | junction/proposals/migrations/0025_auto_20200321_0049.py | junction/proposals/migrations/0025_auto_20200321_0049.py | Python | 0.013292 | @@ -0,0 +1,469 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2020-03-20 19:19%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('proposals', '0024_auto_20170610_1857'),%0A %5D%0A%0A ope... | |
0779277486a6812f5b58e1fc1ab6fe1e5dc35559 | add dummy api tests | nc/tests/test_api.py | nc/tests/test_api.py | Python | 0.000001 | @@ -0,0 +1,1201 @@
+from django.core.urlresolvers import reverse%0Afrom rest_framework import status%0Afrom rest_framework.test import APITestCase%0Afrom nc.models import Agency%0A%0A%0Aclass AgencyTests(APITestCase):%0A%0A def test_list_agencies(self):%0A %22%22%22Test Agency list%22%22%22%0A Agency.o... | |
9b68ee1e0ffb60ebffe0bb90da2512da4bbbeb99 | add split_from_listobj_and_tuple_it func | utils/split_listobj_and_tuple_it.py | utils/split_listobj_and_tuple_it.py | Python | 0.000018 | @@ -0,0 +1,52 @@
+%0Adef split_from_listobj_and_tuple_it():%0A return 0
| |
ece4598e6297ef071b1c928435efb3bee73e3ddb | Backup script. | scripts/backup.py | scripts/backup.py | Python | 0 | @@ -0,0 +1,367 @@
+import json%0Afrom app.firebase import db%0A%0A%22%22%22%0ABackup script for saving contents at the path in Firebase.%0A%22%22%22%0Adef backup(path):%0A backup = db().child(path).get().val()%0A with open(%22out.json%22, %22w%22) as f: json.dump(backup, f)%0A%0Aif __name__ == '__main__':%0A #... | |
2ad0a7f50b6b120c6e769033037c0e1661d2480d | Add spacer/exp_name.py to generate names for experiments | spacer/exp_name.py | spacer/exp_name.py | Python | 0.000016 | @@ -0,0 +1,1144 @@
+#! /usr/bin/env python3%0A%0A# Name for experiments directory%0A%0Aimport sys%0Aimport words%0Aimport argparse%0Aimport os.path%0Afrom datetime import datetime%0Aimport platform%0A%0A%0Aclass ExpNamer(object):%0A%0A def __init__(self):%0A self._name = 'exp_name'%0A self._help = 'Nam... | |
8b467efd1f998d05da0272a284773501f0b330ff | Add a test file which was missing from a recent branch | djangae/tests/test_meta_queries.py | djangae/tests/test_meta_queries.py | Python | 0.000001 | @@ -0,0 +1,1324 @@
+from django.db import models%0Afrom djangae.test import TestCase%0A%0Afrom djangae.contrib import sleuth%0A%0A%0Aclass MetaQueryTestModel(models.Model):%0A field1 = models.CharField(max_length=32)%0A%0A%0Aclass PrimaryKeyFilterTests(TestCase):%0A%0A def test_pk_in_with_slicing(self):%0A ... | |
62c04b70178f3df8a8c7cbf01de0896d3e808698 | Create __init__.py | mass_mailing_themes_boilerplate/__init__.py | mass_mailing_themes_boilerplate/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
615247c28d58fbbff40f5e4122441d77acb19003 | Integrate notification app in settings and add basic structure of files | notification/urls.py | notification/urls.py | Python | 0 | @@ -0,0 +1,504 @@
+from django.conf.urls import url%0Afrom link.views import LinkView, LinkReactionView, LinkCommentView%0A%0A%0Aurlpatterns = %5B%0A url(r'%5E$', LinkView.new, name='link_new'),%0A url(r'%5E(?P%3Cpost_id%3E%5B0-9%5D+)/add/$', LinkView.add, name='link_add'),%0A url(r'%5E(?P%3Cpost_id%3E%5B0-9%5... | |
ca1cfd2514d382b1187eab880014b6a611d3568d | add some testing for Resources and ResourceAttributesMixin | tests/resource.py | tests/resource.py | Python | 0 | @@ -0,0 +1,1523 @@
+import mock%0Aimport unittest%0Aimport httplib2%0Aimport slumber%0A%0A%0Aclass ResourceAttributesMixinTestCase(unittest.TestCase):%0A%0A def test_attribute_fallback_to_resource(self):%0A class ResourceMixinTest(slumber.ResourceAttributesMixin, slumber.MetaMixin, object):%0A clas... | |
7f4cfe09a29202475b0941558f8ab722e63cee7e | Add MPL 2.0 to license trove | scripts/migrations/023-add-new-trove-license-category.py | scripts/migrations/023-add-new-trove-license-category.py | Python | 0 | @@ -0,0 +1,570 @@
+import sys%0Aimport logging%0A%0Afrom ming.orm.ormsession import ThreadLocalORMSession%0A%0Afrom allura import model as M%0A%0Alog = logging.getLogger(__name__)%0A%0Adef main():%0A M.TroveCategory(trove_cat_id=905,%0A trove_parent_id=14,%0A shortname='mpl20',%... | |
07cccdbb7fdc6919503c5b11bca8604e1f7a0d59 | Create roman_numeral_convert.py | projects/roman_numeral_convert.py | projects/roman_numeral_convert.py | Python | 0.000383 | @@ -0,0 +1,501 @@
+%0A#Roman numerals are: %5Bi v x l c d m%5D%0A%0Adef stringer (x):%0A number_string = str(x)%0A a = number_string%5B0%5D%0A b = number_string%5B1%5D %0A c = number_string%5B2%5D %0A d = number_string%5B3%5D %0A%0A%0Aa_list = %5B I, II, III, IV, V, VI, VII, VIII, IX%5D%0Ab_list = %5B X, XX, XXX, ... | |
4e02394f87bec9f73364738550c0b441beb80696 | Build Tower | Codewars/BuildTower.py | Codewars/BuildTower.py | Python | 0.000001 | @@ -0,0 +1,129 @@
+def tower_builder(n_floors):%0A return %5B((n_floors - i)*' ' + (2*i - 1)*'*' + (n_floors - i)*' ') for i in range(1,n_floors+1)%5D%0A
| |
acedeb97935c53d0e7f1e39b2282f8a90bf379ee | add test case | test_flask.py | test_flask.py | Python | 0.000059 | @@ -0,0 +1,543 @@
+from pytest import fixture%0Afrom flask import Flask%0A%0Afrom flask_slack import Slack%0A%0A%0Aclass App(object):%0A%0A def __init__(self):%0A self.app = Flask(__name__)%0A self.app.debug = True%0A self.slack = Slack(self.app)%0A self.app.add_url_rule('/', view_func=se... | |
6beccf0c0b4e7788403415c05ae9f31e6c0a89eb | Add tests for Generalized Procrustes Analysis (GPA) | tests/test_gpa.py | tests/test_gpa.py | Python | 0 | @@ -0,0 +1,2442 @@
+import unittest%0A%0Aimport numpy as np%0Afrom sklearn import datasets%0Afrom sklearn import decomposition%0Afrom sklearn.utils import estimator_checks%0A%0Aimport prince%0A%0A%0Aclass TestGPA(unittest.TestCase):%0A%0A # def setUp(self):%0A def __init__(self):%0A # Create a list of 2-D ... | |
f86da5eddec2dd37f4797ea1caf404e8fec82701 | add unit tests for query parsing | test_query.py | test_query.py | Python | 0 | @@ -0,0 +1,1378 @@
+from query import parse_query%0Aimport copy%0A%0Adefault_parsed_query = %7B%0A 'from': '-24hours',%0A 'to': 'now',%0A 'min': None,%0A 'max': None,%0A 'avg_by': %7B%7D,%0A 'limit_targets': 500,%0A 'avg_over': None,%0A 'patterns': %5B'target_type=', 'unit='%5D,%0A 'group_by'... | |
0baca9564c9df7b06645f71abdda0fe3090f46a6 | Add a test-case for lit xunit output | utils/lit/tests/xunit-output.py | utils/lit/tests/xunit-output.py | Python | 0.999995 | @@ -0,0 +1,374 @@
+# Check xunit output%0A# RUN: %25%7Blit%7D --xunit-xml-output %25t.xunit.xml %25%7Binputs%7D/test-data%0A# RUN: FileCheck %3C %25t.xunit.xml %25s%0A%0A# CHECK: %3C?xml version=%221.0%22 encoding=%22UTF-8%22 ?%3E%0A# CHECK: %3Ctestsuites%3E%0A# CHECK: %3Ctestsuite name='test-data' tests='1' failures='... | |
e818989604ddaf34dd5730cc3b73093744b59a29 | Create themes.py | timpani/themes.py | timpani/themes.py | Python | 0 | @@ -0,0 +1,110 @@
+from . import database%0A%0ATHEME_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), %22../../themes%22))%0A
| |
2e90787a245d6a30c733699a819a1ff888c308b7 | add simple boot script | src/japronto/__main__.py | src/japronto/__main__.py | Python | 0 | @@ -0,0 +1,1260 @@
+from argparse import ArgumentParser%0Afrom importlib import import_module%0Aimport sys%0A%0Afrom .app import Application%0A%0A%0Adef main():%0A parser = ArgumentParser(prog='python -m japronto')%0A parser.add_argument('--host', dest='host', type=str, default='0.0.0.0')%0A parser.add_argumen... | |
bfa84c54166a606e4c7b587aeb10e5e79a2d0e50 | Add __init__ | tmdb3/__init__.py | tmdb3/__init__.py | Python | 0.000917 | @@ -0,0 +1,207 @@
+#!/usr/bin/env python%0A%0Afrom tmdb_api import Configuration, searchMovie, searchPerson, Person, %5C%0A Movie, Collection, __version__%0Afrom request import set_key%0Afrom tmdb_exceptions import *%0A%0A
| |
8c1fe9193f55fd758af74d3270e5630db630fa2c | Fix constraints tests | test/test_constraints.py | test/test_constraints.py | from __future__ import absolute_import
from __future__ import print_function
import keras
from keras.datasets import mnist
import keras.models
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.regularizers import l2, l1
from keras.constraints import maxnorm, nonneg
... | Python | 0.000012 | @@ -1766,969 +1766,8 @@
)%0A%09%0A
-model = Sequential()%0Amodel.add(Dense(784, 20))%0Amodel.add(Activation('relu', target=.4))%0Amodel.add(Dropout(0.1))%0Amodel.add(Dense(20, 20))%0Amodel.add(Activation('relu', target=.3))%0Amodel.add(Dropout(0.1))%0Amodel.add(Dense(20, 10))%0Amodel.add(Activation('softmax'))%0A%0A%0... |
60f5dbe34884683626ca7f045fa79d2c247197fe | add test for class checks | pychecker/pychecker2/tests/class.py | pychecker/pychecker2/tests/class.py | Python | 0 | @@ -0,0 +1,909 @@
+import compiler.ast%0A%0Aclass B(compiler.ast.Const):%0A%0A def x(self):%0A self.inherited = 1%0A%0Aclass A(B):%0A def __init__(self):%0A self.x = 1 # define x on A%0A self.w.q = 1%0A%0A def f(s, self): # unusual self%0A pr... | |
a5e599f4a7c2f20c4f0ed79366db985cba7ae85e | Add template context debugging templatetag | pylab/website/templatetags/debug.py | pylab/website/templatetags/debug.py | Python | 0 | @@ -0,0 +1,183 @@
+from django import template%0A%0Aregister = template.Library()%0A%0A%0A@register.simple_tag(name='pdb', takes_context=True)%0Adef pdb(context, *args, **kwargs):%0A import ipdb; ipdb.set_trace()%0A
| |
e7852c457da3cea0f8a20773cc3a355f559b845e | Update version to 1.7 | src/dashboard/src/main/migrations/0047_version_number.py | src/dashboard/src/main/migrations/0047_version_number.py | Python | 0 | @@ -0,0 +1,531 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef data_migration(apps, schema_editor):%0A Agent = apps.get_model('main', 'Agent')%0A Agent.objects %5C%0A .filter(identifiertype='preservation system', name='Archivematica') ... | |
a4a73ac2e5a15e53a0935987911c5905890bfab8 | Add Overwatch command. | orchard/overwatch.py | orchard/overwatch.py | Python | 0.000001 | @@ -0,0 +1,2590 @@
+%22%22%22Get stats for Overwatch.%22%22%22%0A%0Afrom plumeria.command import commands, CommandError%0Afrom plumeria.command.parse import Word%0Afrom plumeria.message.lists import build_list%0Afrom plumeria.util import http%0Afrom plumeria.util.http import BadStatusCodeError%0Afrom plumeria.util.rate... | |
010dd0366ddb62e52f295ec1648c1bab38f9e437 | move python wrappers to their own file | tremendous/api.py | tremendous/api.py | Python | 0 | @@ -0,0 +1,167 @@
+from tremendous.bindings import lib%0Afrom tremendous.bindings import ffi%0A%0Adef apply_format(color, body):%0A s = lib.apply_format(color, body)%0A return ffi.string(s)%0A
| |
69905bbee59bb2f65e389ba3c57d8d80bcd55407 | Fix typo in setup.py | scikits/learn/setup.py | scikits/learn/setup.py | from os.path import join
import warnings
import numpy
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
config = Configuration('learn',parent_package,top_path)
config.add_subpackag... | Python | 0.999224 | @@ -1485,16 +1485,17 @@
near_sou
+r
ces.appe
|
19c5600486ea7bee68eb1098636b21757938d799 | Add is_prime python | math/is_prime/python/is_prime.py | math/is_prime/python/is_prime.py | Python | 0.999978 | @@ -0,0 +1,351 @@
+import math%0A%0Adef is_prime(number):%0A if number %3C= 1: return False%0A if number == 2: return True%0A if (number %25 2) == 0: return False%0A%0A for i in range(3, int(math.sqrt(number)) +1,2):%0A if number %25 1 == 0: return False%0A return True%0A%0Anumber = input (%22Enter number :%22)... | |
582128f1061ab74da76d26a366bfd3c8fee8f007 | Add scripts/fill_events.py to generate mock data | scripts/fill_events.py | scripts/fill_events.py | Python | 0.000001 | @@ -0,0 +1,507 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport os%0A%0Asys.path.append(os.path.join(os.path.dirname('__file__'), '..', 'src'))%0A%0Afrom random import randint%0Afrom datetime import datetime, timedelta%0A%0Afrom logsandra.model.client import CassandraClient%0A%0A%0Aclient = CassandraClient('test', 'loca... | |
a102fb888b60454d7efbe26e4afb38a59c212769 | Add script to delete spam users. | p3/management/commands/delete_spam_users.py | p3/management/commands/delete_spam_users.py | Python | 0 | @@ -0,0 +1,1760 @@
+# -*- coding: utf-8 -*-%0A%22%22%22 Delete users creating by spambots.%0A%0A%22%22%22%0A%0Aimport logging as log%0Afrom optparse import make_option%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom django.db import transaction%0Afrom assopy import models as amodels%0A%0A###%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.