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 |
|---|---|---|---|---|---|---|---|
d716098727293c2c90c97a41c57bab57330c176c | Fix read_only tests. | kitsune/sumo/tests/test_readonly.py | kitsune/sumo/tests/test_readonly.py | import copy
from django.conf import settings
from django.db import models
from django.db.utils import DatabaseError
from django.test import TestCase
from django.utils import importlib
from nose.tools import assert_raises, eq_
from pyquery import PyQuery as pq
from kitsune.questions.models import Question
from kitsun... | Python | 0 | @@ -146,43 +146,27 @@
Case
-%0Afrom django.utils import importlib
+, override_settings
%0A%0Afr
@@ -800,323 +800,32 @@
__)%0A
- settings.SLAVE_DATABASES = %5B'default'%5D%0A settings_module = importlib.import_module(settings.SETTINGS_MODULE)%0A settings_module.read_only_mode(settings._wrapped.__... |
9a22cf7452723686a5065658ce5c9d31333c8a33 | Add download random leader avatar to examples | examples/download_random_leader_avatar.py | examples/download_random_leader_avatar.py | Python | 0 | @@ -0,0 +1,1721 @@
+# Run with Python 3%0Aimport json%0Aimport requests%0Afrom random import randint%0Aimport shutil%0Aimport math%0A%0A# 1. Get your keys at https://stepic.org/oauth2/applications/ (client type = confidential,%0A# authorization grant type = client credentials)%0Aclient_id = %22...%22%0Aclient_secret = ... | |
e79437b7badcbc7e48e5090e2e27b892c323e829 | add script to make bedgraph from lumpy probbaly (-P) output | scripts/prob_bedpe_to_bedgraph.py | scripts/prob_bedpe_to_bedgraph.py | Python | 0 | @@ -0,0 +1,1133 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport numpy as np%0A%0Afrom optparse import OptionParser%0A%0Aparser = OptionParser()%0A%0Aparser.add_option(%22-b%22,%0A %22--bedpe_file%22,%0A dest=%22bedpe_file%22,%0A help=%22BEDPE file%22)%0A%0Aparser.add_option(%22-n%22,%0A %22--name%22,%0A ... | |
a3b7224da3d45458af59d0ade4814b10e789b24d | Fix target capacity calculation | senlin/policies/scaling_policy.py | senlin/policies/scaling_policy.py | # 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 or agreed to in writing, software
# distributed unde... | Python | 0.000808 | @@ -6640,32 +6640,43 @@
count =
+ min(count,
current - clust
@@ -6682,24 +6682,25 @@
ter.min_size
+)
%0A
@@ -6897,16 +6897,27 @@
count =
+ min(count,
cluster
@@ -6935,16 +6935,17 @@
current
+)
%0A
|
18728051374484ca93b59d60a4e6941bdc5c6192 | Add missing migration | project/creditor/migrations/0010_auto_20190131_1731.py | project/creditor/migrations/0010_auto_20190131_1731.py | Python | 0.0002 | @@ -0,0 +1,508 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('creditor', '0009_auto_20160123_2128'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
efecaf8cdb7ca4623d2efd53590adf976fd36954 | Add test ref #261. | setuptools/tests/test_build_py.py | setuptools/tests/test_build_py.py | Python | 0 | @@ -0,0 +1,669 @@
+import os%0A%0Aimport pytest%0A%0Afrom setuptools.dist import Distribution%0A%0A%0A@pytest.yield_fixture%0Adef tmpdir_as_cwd(tmpdir):%0A with tmpdir.as_cwd():%0A yield tmpdir%0A%0A%0Adef test_directories_in_package_data_glob(tmpdir_as_cwd):%0A %22%22%22%0A Directories matching the glo... | |
2526c91b77b538e1f37bd279783de0ac5452c463 | Add test to validate legislative parameters in XML and JSON format. | tests/legislation_tests.py | tests/legislation_tests.py | Python | 0 | @@ -0,0 +1,2679 @@
+# -*- coding: utf-8 -*-%0A%0A%0A# OpenFisca -- A versatile microsimulation software%0A# By: OpenFisca Team %3Ccontact@openfisca.fr%3E%0A#%0A# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team%0A# https://github.com/openfisca%0A#%0A# This file is part of OpenFisca.%0A#%0A# OpenFisca is free softwar... | |
5f3af12d40e7c9ff388385e408d65565cb916def | Add Swagger integration test | openfisca_web_api/tests/test_swagger_integration.py | openfisca_web_api/tests/test_swagger_integration.py | Python | 0 | @@ -0,0 +1,1150 @@
+# -*- coding: utf-8 -*-%0A%0A%0A# OpenFisca -- A versatile microsimulation software%0A# By: OpenFisca Team %3Ccontact@openfisca.fr%3E%0A#%0A# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team%0A# https://github.com/openfisca%0A#%0A# This file is part of OpenFisca.%0A#%0A# OpenFisca is free s... | |
0507a47f1c15bac5f6eddbeb9c712f5c2b2a9358 | Add tests for msgpack reader. | intake_bluesky/tests/test_msgpack.py | intake_bluesky/tests/test_msgpack.py | Python | 0 | @@ -0,0 +1,1551 @@
+import intake_bluesky.msgpack # noqa%0Aimport intake%0Afrom suitcase.msgpack import Serializer%0Aimport os%0Aimport pytest%0Aimport shutil%0Aimport tempfile%0Aimport time%0Aimport types%0A%0Afrom .generic import * # noqa%0A%0ATMP_DIR = tempfile.mkdtemp()%0ATEST_CATALOG_PATH = %5BTMP_DIR%5D%0A%0AYA... | |
2e1d70391b26ae353ca95ce25a08d59f1d8f9f9e | Create multifilebuilder_gtk3.py | lib/python/multifilebuilder_gtk3.py | lib/python/multifilebuilder_gtk3.py | Python | 0 | @@ -0,0 +1,1902 @@
+# -*- python -*-%0A# Copyright (C) 2014 Jeff Epler %3Cjepler@unpythonic.net%3E%0A#%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation; either version 2 of the L... | |
216c7c21adcbec601ebcc624eac4b5087422e5d2 | add test for sugarsource | sncosmo/tests/test_sugarsource.py | sncosmo/tests/test_sugarsource.py | Python | 0.000001 | @@ -0,0 +1,1955 @@
+# Licensed under a 3-clause BSD style license - see LICENSES%0A%0A%22%22%22Tests for SUGARSource (and wrapped in Model)%22%22%22%0A%0Aimport os%0A%0Aimport numpy as np%0Aimport pytest%0Afrom numpy.testing import assert_allclose%0A%0Aimport sncosmo%0A%0A%0Adef sugar_model(Xgr=0, q1=0, q2=0, q3=0, A=0... | |
da85d929118a9ac51a112a405818838e476a2f80 | Add blank test for updating later.. | tests/test_pi_mqtt_gpio.py | tests/test_pi_mqtt_gpio.py | Python | 0 | @@ -0,0 +1,26 @@
+def test_noop():%0A pass%0A
| |
06455d743590e47bfe5c9e1a6ff745622abe9cb5 | add tests for polymorphism | tests/test_polymorphism.py | tests/test_polymorphism.py | Python | 0 | @@ -0,0 +1,828 @@
+import pytest%0A%0Afrom dataclasses import dataclass%0Afrom hologram import JsonSchemaMixin, ValidationError%0Afrom hologram.helpers import StrEnum, StrLiteral%0Afrom typing import Union%0A%0A%0Aclass Bar(StrEnum):%0A x = %22x%22%0A y = %22y%22%0A%0A%0A@dataclass%0Aclass BarX(JsonSchemaMixin):%... | |
64fac50f77c492edf20b0e4161b9da988831f2ed | change author can also be null | src/c3nav/editor/migrations/0002_auto_20170612_1615.py | src/c3nav/editor/migrations/0002_auto_20170612_1615.py | Python | 0.000368 | @@ -0,0 +1,623 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.2 on 2017-06-12 16:15%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies... | |
a42a6a54f732ca7eba700b867a3025739ad6a271 | Move main code to function because of pylint warning 'Invalid constant name' | list_all_users_in_group.py | list_all_users_in_group.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import grp
import pwd
import inspect
import argparse
def list_all_users_in_group(groupname):
"""Get list of all users of group.
Get sorted list of all users of group GROUP,
including users with main group GROUP.
Ori... | Python | 0 | @@ -743,33 +743,19 @@
t)%0A%0A
-if __name__ == %22__
+%0Adef
main
-__%22
+()
:%0A
@@ -1252,8 +1252,48 @@
esult))%0A
+%0A%0Aif __name__ == %22__main__%22:%0A main()%0A
|
76aed66701ac9f267ef08bde0f0b55e2ad905e68 | Add micro bench arith-modulo | graal/edu.uci.python.benchmark/src/micro/arith-modulo.py | graal/edu.uci.python.benchmark/src/micro/arith-modulo.py | Python | 0.000001 | @@ -0,0 +1,575 @@
+# zwei 10/09/13%0A# arithmetic ops (partially extracted from spectralnorm)%0Aimport time%0A%0Adef docompute(num):%0A%09for i in range(num):%0A%09%09sum = 0%0A%09%09j = 0%0A%0A%09%09# if i == 0:%0A%09%09# %09i += 1%0A%0A%09%09while j %3C i:%0A%09%09%09if i %25 3 == 0:%0A%09%09%09%09temp = 1%0A%09%09%0... | |
996a4dd0223d8f327dbe822f9f6e430465c6c70f | add django settings for djsupervisor | measure_mate/settings/supervisord.py | measure_mate/settings/supervisord.py | Python | 0 | @@ -0,0 +1,84 @@
+from measure_mate.settings.base import *%0A%0AINSTALLED_APPS += (%0A 'djsupervisor',%0A)%0A
| |
d6acd4324f5fe5e57750a335b35cd42edd8544b5 | Solve the puzzle. | 01/solve.py | 01/solve.py | Python | 0.000084 | @@ -0,0 +1,557 @@
+%22%22%22Report the manhattan distance between a starting point and an ending point,%0Agiven a set of directions to follow to get move between the two points.%22%22%22%0A%0A%0Afrom distance import get_distance%0Afrom directions import load_directions, follow_directions%0A%0A%0Adef main():%0A direc... | |
8eff29ba9777cd977f04a2c0b68d598ad63c8f47 | Create 02.py | 02/ex/02.py | 02/ex/02.py | Python | 0 | @@ -0,0 +1,681 @@
+# Define a procedure, stamps, which takes as its input a positive integer in%0A# pence and returns the number of 5p, 2p and 1p stamps (p is pence) required %0A# to make up that value. The answer should use as many 5p stamps as possible,%0A# then 2 pence stamps and finally 1p stamps.%0A%0Adef stamps(n... | |
406fcf5297458f5469364faf8180683b89fd527c | Add wmi sampler tests (#5859) | datadog_checks_base/tests/test_wmisampler.py | datadog_checks_base/tests/test_wmisampler.py | Python | 0 | @@ -0,0 +1,1920 @@
+# (C) Datadog, Inc. 2020-present%0A# All rights reserved%0A# Licensed under a 3-clause BSD style license (see LICENSE)%0A%0Aimport pytest%0Afrom tests.utils import requires_windows%0A%0Atry:%0A from datadog_checks.base.checks.win.wmi import WMISampler%0Aexcept ImportError:%0A pass%0A%0A%0A@req... | |
d067d9937ff34787e6f632d86075af29c27d98f8 | Add py solution for 714. Best Time to Buy and Sell Stock with Transaction Fee | py/best-time-to-buy-and-sell-stock-with-transaction-fee.py | py/best-time-to-buy-and-sell-stock-with-transaction-fee.py | Python | 0 | @@ -0,0 +1,364 @@
+class Solution(object):%0A def maxProfit(self, prices, fee):%0A %22%22%22%0A :type prices: List%5Bint%5D%0A :type fee: int%0A :rtype: int%0A %22%22%22%0A hold, not_hold = None, 0%0A for p in prices:%0A hold, not_hold = max(hold, not_hold ... | |
4c2c80e0004a758787beb555fbbe789cce5e82fc | Fix variable referenced before assginment in vmwareapi code. | nova/tests/test_vmwareapi_vm_util.py | nova/tests/test_vmwareapi_vm_util.py | Python | 0.000001 | @@ -0,0 +1,1841 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Copyright 2013 Canonical Corp.%0A# All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the Licen... | |
c687ab125af67d769afc781731b1a2b663a5bb2c | Use SystemRandom to generate unpredictable random slugs. Fixed duplicate characters in the choice string, removed iI from it to prevent confusion. Fixes issue #40. | dpaste/models.py | dpaste/models.py | import datetime
import random
import mptt
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from dpaste.highlight import LEXER_DEFAULT
L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4)
T = getattr(settings, '... | Python | 0 | @@ -1,12 +1,26 @@
+from datetime
import datet
@@ -27,33 +27,62 @@
ime%0A
+from os
import
+u
random%0A
-import mptt
+from random import SystemRandom
%0A%0Afr
@@ -242,16 +242,29 @@
zy as _%0A
+import mptt%0A%0A
from dpa
@@ -299,16 +299,35 @@
EFAULT%0A%0A
+R = SystemRandom()%0A
L = geta
@@ -437,17 +437,16 @@
... |
f3c823db63a6ca6b6679c2a9de8dcb1ccc805e37 | Remove print | blog/templatetags/blog_tags.py | blog/templatetags/blog_tags.py | from datetime import datetime
from django import template
import sys
from events.models import EventPage, EventsIndexPage
from blog.models import BlogPage, BlogIndexPage, CodeBlock
from collections import OrderedDict
register = template.Library()
@register.inclusion_tag(
'blog/tags/blog_sidebar.html',
ta... | Python | 0.000016 | @@ -827,29 +827,8 @@
ne%0A%0A
- print(archives)%0A%0A
|
1dc439fcf7a823270156708208339a8bf420703c | Create Generic Sitemap abstract django | opps/sitemaps/sitemaps.py | opps/sitemaps/sitemaps.py | Python | 0 | @@ -0,0 +1,887 @@
+# -*- coding: utf-8 -*-%0Afrom django.contrib.sitemaps import GenericSitemap as DjangoGenericSitemap%0Afrom django.contrib.sitemaps import Sitemap as DjangoSitemap%0Afrom django.utils import timezone%0A%0Afrom opps.articles.models import Article%0A%0A%0Adef InfoDisct(googlenews=False):%0A article ... | |
7bab9610bf9278b8dedb55a513f22130e2f629ed | Add PP example | examples/13_PreferedPhase.py | examples/13_PreferedPhase.py | Python | 0.000001 | @@ -0,0 +1,2243 @@
+%22%22%22This example illustrate hox to find the prefered-phase (PP).%0A%0AFirst, the amplitude is binned according to phase slices (360%C2%B0/nbins). Then,%0Athe PP is defined as the phase where the amplitude is maximum.%0A%22%22%22%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom tens... | |
25b7f06a0f185a7e83aab38888e32b41c2c31853 | Create 02.py | 03/hw/02.py | 03/hw/02.py | Python | 0 | @@ -0,0 +1,381 @@
+# Define a procedure, greatest,%0A# that takes as input a list%0A# of positive numbers, and%0A# returns the greatest number%0A# in that list. If the input%0A# list is empty, the output%0A# should be 0.%0A%0Adef greatest(xs):%0A greatest = 0%0A for x in xs:%0A if x %3E greatest:%0A ... | |
9e21a0552bd283eab2b0d35562cf2ab8edbb81bd | Clarify import output. | events/categories.py | events/categories.py | import re
from events.models import Category, CategoryLabel
from difflib import get_close_matches
ENDING_PARENTHESIS_PATTERN = r' \([^)]+\)$'
class CategoryMatcher(object):
def __init__(self):
label_to_category_ids = {}
self.name_to_category_ids = {}
for label_id, category_id in Category.a... | Python | 0.000009 | @@ -1277,16 +1277,25 @@
bels), '
+category
keys')%0A%0A
|
321c857d4cc2bacdeaa398d3b4b1fd7769f33718 | Add py-soupsieve package (#12827) | var/spack/repos/builtin/packages/py-soupsieve/package.py | var/spack/repos/builtin/packages/py-soupsieve/package.py | Python | 0 | @@ -0,0 +1,702 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PySoupsieve(PythonPackage):%0A %22%22%22A modern CSS sel... | |
107994f3ac39b60b389fa4d7eb4efbb284b70a10 | implement logic improvement suggestion by @balloob | homeassistant/components/sensor/ecobee.py | homeassistant/components/sensor/ecobee.py | """
homeassistant.components.sensor.ecobee
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ecobee Thermostat Component
This component adds support for Ecobee3 Wireless Thermostats.
You will need to setup developer access to your thermostat,
and create and API key on the ecobee website.
The first time you run this component... | Python | 0 | @@ -1750,19 +1750,24 @@
'type'%5D
-==
+not in (
'tempera
@@ -1771,17 +1771,17 @@
erature'
-:
+,
%0A
@@ -1789,36 +1789,24 @@
-dev.append(%0A
@@ -1817,111 +1817,32 @@
- EcobeeSensor(sensor%5B'name'%5D, 'temperature', index))%0A elif item%5B'type'%5D == 'hum... |
4509caefde4829327fecb45b5aded0938c2f8c0b | Add index parameter to scrape sensor (#21084) | homeassistant/components/sensor/scrape.py | homeassistant/components/sensor/scrape.py | """
Support for getting data from websites with scraping.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.scrape/
"""
import logging
import voluptuous as vol
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from homeassistant.components.se... | Python | 0 | @@ -942,16 +942,37 @@
'select'
+%0ACONF_INDEX = 'index'
%0A%0ADEFAUL
@@ -1181,32 +1181,90 @@
TR): cv.string,%0A
+ vol.Optional(CONF_INDEX, default=0): cv.positive_int,%0A
vol.Optional
@@ -2139,16 +2139,51 @@
F_ATTR)%0A
+ index = config.get(CONF_INDEX)%0A
unit
@@ -2891,32 +2891,39 @@
e, select, attr... |
6ca8bb70e8e9c6d40418e836d222648478eb8f31 | Split Questins into students and institutions | tada/schools/migrations/0005_auto_20150427_1938.py | tada/schools/migrations/0005_auto_20150427_1938.py | Python | 0 | @@ -0,0 +1,3331 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('schools', '0004_auto_20150427_1912'),%0A %5D%0A%0A operations = %5B%0A migrations.Create... | |
687661d05179d7a36629a6bd036cdb8dc6a3c637 | Create BasePage.py | BasePage.py | BasePage.py | Python | 0 | @@ -0,0 +1,1060 @@
+from selenium import webdriver%0Afrom selenium.webdriver.common.by import By%0A%0A#This is the base class that define attributes and methods to all classes%0A%0Aclass BasePage(object):%0A def __init__(self, driver):%0A self.driver = driver%0A self.driver.implicitly_wait(30)%0A ... | |
5d6777cc386f6fbd982b5021a55b9a8a0510ef1a | Convert month | ch06_07_p.py | ch06_07_p.py | Python | 0.003029 | @@ -0,0 +1,198 @@
+months = %5B'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'%5D%0A%0Amonth, day, year = input().strip().split(%22/%22)%0Aprint(%22%25s %25s %25s%22 %25 (day, months%5Bint(month) - 1%5D, year))%0A%0A
| |
1db6185a9637377ff63b2b824d625eaf6a990cb3 | The default number of sentences was wrong | corpora/semeval_to_stanford.py | corpora/semeval_to_stanford.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import sh
import sys
from corpora.parsers import ColumnCorpusParser
from tqdm import tqdm
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument... | Python | 0.999999 | @@ -603,12 +603,13 @@
ult=
-4851
+27132
,%0A
|
3dc50a3f5dbb674a8b7e5383768bc5ebe72ea077 | add AUC example | examples/classification_auc.py | examples/classification_auc.py | Python | 0.998252 | @@ -0,0 +1,889 @@
+from tgboost import TGBoost%0Aimport pandas as pd%0A%0Atrain = pd.read_csv('train.csv')%0Atrain = train.sample(frac=1.0, axis=0) # shuffle the data%0Aval = train.iloc%5B0:5000%5D%0Atrain = train.iloc%5B5000:%5D%0A%0A%0Atrain_y = train.label%0Atrain_X = train.drop('label', axis=1)%0Aval_y = val.label... | |
301f8cf79d1793826a9b73fca6406c005a1c1638 | Create search.py (#4900) | examples/contrib/search.py | examples/contrib/search.py | Python | 0 | @@ -0,0 +1,3070 @@
+import re%0Aimport typing%0A%0Afrom json import dumps%0A%0Afrom mitmproxy import command, ctx, flow%0A%0A%0AMARKER = ':mag:'%0ARESULTS_STR = 'Search Results: '%0A%0A%0Aclass Search:%0A def __init__(self):%0A self.exp = None%0A%0A @command.command('search')%0A def _search(self,%0A ... | |
15b7279b0437cf14c2d5657b99d037beb044949f | Convert JSON to TSV | JSON2TSV.py | JSON2TSV.py | Python | 0.999999 | @@ -0,0 +1,1061 @@
+#!/usr/bin/env python%0A# -*- coding: latin-1 -*-%0A''' Script to convert a JSON file to TSV. Adapted from http://kailaspatil.blogspot.com/2013/07/python-script-to-convert-json-file-into.html%0A'''%0Aimport fileinput%0Aimport json%0Aimport csv%0Aimport sys%0A%0AEPILOG = ''' Usage: %25(prog)s -i %5Bi... | |
7707e65ed591b890d91bcb7bf22923b8c17a113a | Add tests from Gregor's PR | readthedocs/rtd_tests/tests/test_api_permissions.py | readthedocs/rtd_tests/tests/test_api_permissions.py | Python | 0 | @@ -0,0 +1,2972 @@
+from functools import partial%0Afrom mock import Mock%0Afrom unittest import TestCase%0A%0Afrom readthedocs.restapi.permissions import APIRestrictedPermission%0A%0A%0Aclass APIRestrictedPermissionTests(TestCase):%0A def get_request(self, method, is_admin):%0A request = Mock()%0A req... | |
44f70a0c8ea9613214ce6305c262a8508b4bc598 | create add_user.py | add_user.py | add_user.py | Python | 0.000005 | @@ -0,0 +1,776 @@
+#!/usr/bin/python%0A%0Aimport bluetooth%0A%0Aprint(%22Scanning for bluetooth devices in discoverable mode...%22)%0Anearby_devices = bluetooth.discover_devices(lookup_names = True)%0A%0Afor i, (addr, name) in enumerate(nearby_devices):%0A print(%22%5B%7B%7D%5D %7B%7D %7B%7D%22.format(i, addr, name)... | |
c8c679221e0a36ac6074c0869bfc4b75d9745ae2 | Create a.py | abc066/a.py | abc066/a.py | Python | 0.000489 | @@ -0,0 +1,69 @@
+a, b, c = map(int, input().split())%0A%0Aprint(min(a + b, b + c, a + c))%0A
| |
365152787cae36c12691e4da52a0575bd56d7d1b | Add tests for tril, triu and find | tests/cupyx_tests/scipy_tests/sparse_tests/test_extract.py | tests/cupyx_tests/scipy_tests/sparse_tests/test_extract.py | Python | 0 | @@ -0,0 +1,2760 @@
+import unittest%0A%0Aimport numpy%0Atry:%0A import scipy.sparse%0A scipy_available = True%0Aexcept ImportError:%0A scipy_available = False%0A%0Aimport cupy%0Afrom cupy import testing%0Afrom cupyx.scipy import sparse%0A%0A%0A@testing.parameterize(*testing.product(%7B%0A 'shape': %5B(8, 3)... | |
a4d3056bbbe71d73d901c13927264157c9c51842 | Add lc004_median_of_two_sorted_arrays.py | lc004_median_of_two_sorted_arrays.py | lc004_median_of_two_sorted_arrays.py | Python | 0.007128 | @@ -0,0 +1,669 @@
+%22%22%22Leetcode 4. Median of Two Sorted Arrays%0AHard%0A%0AThere are two sorted arrays nums1 and nums2 of size m and n respectively.%0A%0AFind the median of the two sorted arrays. %0AThe overall run time complexity should be O(log (m+n)).%0A%0AYou may assume nums1 and nums2 cannot be both empty.%0A... | |
8a836213f7466de51c6d3d18d1a5ba74bb28de4a | Add hdf5-vol-async package. (#26874) | var/spack/repos/builtin/packages/hdf5-vol-async/package.py | var/spack/repos/builtin/packages/hdf5-vol-async/package.py | Python | 0 | @@ -0,0 +1,785 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Hdf5VolAsync(CMakePackage):%0A %22%22%22This package ena... | |
034fe49d29f229e8fafc6b1034fc2685cd896eb2 | Create create-studio-item | my-ACG/create-studio-item/edit.py | my-ACG/create-studio-item/edit.py | Python | 0.000002 | @@ -0,0 +1,1657 @@
+# -*- coding: utf-8 -*-%0Aimport argparse%0Aimport csv%0Aimport os%0Aimport re%0Aimport urllib.parse%0A%0Aos.environ%5B'PYWIKIBOT_DIR'%5D = os.path.dirname(os.path.realpath(__file__))%0Aimport pywikibot%0A%0A%0Asite = pywikibot.Site()%0Asite.login()%0Adatasite = site.data_repository()%0A%0A%0Adef ma... | |
9b572d4f53b23f3dc51dbfb98d46d0daa68d3569 | fix pep8 on core admin profile | opps/core/admin/profile.py | opps/core/admin/profile.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from opps.core.models import Profile
class ProfileAdmin(admin.ModelAdmin):
pass
admin.site.register(Profile, ProfileAdmin)
| Python | 0 | @@ -89,16 +89,17 @@
rofile%0A%0A
+%0A
class Pr
|
71d4fee2e7a9c44de0f395883b75e1ca9976fe9e | fix query for oaipmh | portality/models/oaipmh.py | portality/models/oaipmh.py | from datetime import datetime
from copy import deepcopy
from portality.models import Journal, Article
class OAIPMHRecord(object):
earliest = {
"query": {
"bool": {
"must": [
{ "term": { "admin.in_doaj": True } }
]
}
},
... | Python | 0.999999 | @@ -1,34 +1,4 @@
-from datetime import datetime%0A
from
@@ -1306,16 +1306,22 @@
%7D%7D, %7B%22id
+.exact
%22 : %22des
|
419e001591566df909b03ffd0abff12171b62491 | Create binary_search_iter.py | binary_search_iter.py | binary_search_iter.py | Python | 0.000041 | @@ -0,0 +1,526 @@
+#GLOBALS%0A#=======%0AFIRST_IDX = 0%0A%0Adef chop(number, int_list):%0A%09list_size = length(int_list)%0A%09start_idx = FIRST_IDX%0A%09end_idx = list_size-1%0A%09current_idx = end_idx/2%0A%09itr_counter = list_size%0A%09while itr_counter%3E0:%0A%09%09current_value = int_list%5Bcurrent_idx%5D%0A%09%09... | |
6c4c26f5383740257b8bca56ce1ea9011053aff6 | add new package : keepalived (#14463) | var/spack/repos/builtin/packages/keepalived/package.py | var/spack/repos/builtin/packages/keepalived/package.py | Python | 0 | @@ -0,0 +1,1453 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Keepalived(AutotoolsPackage):%0A %22%22%22%0A Keepal... | |
5ef097bc394ef5be9b723ca0732bb842ab82e9e1 | Include app.wsgi into repository as an example #8 | website/app.wsgi | website/app.wsgi | Python | 0 | @@ -0,0 +1,652 @@
+import sys%0Afrom pathlib import Path%0A%0Apath = Path(__file__)%0A%0A# when moving virual environment, update following line%0Avenv_location = str(path.parents%5B2%5D)%0A%0A# in Python3 there is no builtin execfile shortcut - let's define one%0Adef execfile(filename):%0A globals = dict( __file__ ... | |
8d6676f2e19ab9df01c681b6590c6f4adb0f938c | add profile model | fbmsgbot/models/profile.py | fbmsgbot/models/profile.py | Python | 0.000001 | @@ -0,0 +1,284 @@
+class Profile():%0A %0A def __init__(self, **kwargs):%0A self.first_name = kwargs%5B'first_name'%5D%0A%09self.last_name = kwargs%5B'last_name'%5D%0A%09self.profile_pic = kwargs%5B'profile_pic'%5D%0A%09self.locale = kwargs%5B'locale'%5D%0A%09self.timezone = kwargs%5B'timezone'%5D%0A%09sel... | |
a57b877313f1dc7aa3a6c5c31b925f5c14ddf791 | Fix some minor docstring bugs | nikola/plugins/command/console.py | nikola/plugins/command/console.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Chris Warrick, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation... | Python | 0 | @@ -2782,16 +2782,23 @@
%22%22%22
+Run an
IPython
@@ -3331,16 +3331,22 @@
%22%22%22
+Run a
bpython
@@ -3747,17 +3747,23 @@
%22%22%22
-P
+Run a p
lain Pyt
|
7a3a6720a47f380cf20a06aaa47634675099bf92 | Django learning site forms: add model forms QuizForm, TrueFalseQuestionForm, MultipleChoiceQuestionForm | python/django/learning_site_forms/courses/forms.py | python/django/learning_site_forms/courses/forms.py | Python | 0.997456 | @@ -0,0 +1,611 @@
+from django import forms%0A%0Afrom . import models%0A%0Aclass QuizForm(forms.ModelForm):%0A class Meta:%0A model = models.Quiz%0A fields = %5B%0A 'title',%0A 'description',%0A 'order',%0A 'total_questions',%0A %5D%0A%0A%0Aclass TrueF... | |
8d12f36f7b10ff3c6c6296a20f488c3ec18715c5 | Convert to Package | Integrations/Whois/Whois.py | Integrations/Whois/Whois.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import socket
import socks
import whois
from urlparse import urlparse
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
''' GLOBAL VARS '''
if not demisto.params().get('... | Python | 0.999999 | @@ -263,16 +263,31 @@
rning)%0A%0A
+# flake8: noqa%0A
%0A''' GLO
|
37f80e8a8a86612f44fd8e6cd3b15d73bc737404 | Fix reuse bug? | tools/profiling/microbenchmarks/bm_json.py | tools/profiling/microbenchmarks/bm_json.py | # Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Python | 0 | @@ -6116,16 +6116,32 @@
= True%0A
+ break%0A
yiel
|
519b141349b4d39902416be560b989160d48b141 | add echo_delay to estimate the delay between two wav files | echo_delay.py | echo_delay.py | Python | 0.000001 | @@ -0,0 +1,672 @@
+%0Aimport sys%0Aimport wave%0Aimport numpy as np%0Afrom gcc_phat import gcc_phat%0A%0A%0Aif len(sys.argv) != 3:%0A print('Usage: %7B%7D near.wav far.wav'.format(sys.argv%5B0%5D))%0A sys.exit(1)%0A%0A%0Anear = wave.open(sys.argv%5B1%5D, 'rb')%0Afar = wave.open(sys.argv%5B2%5D, 'rb')%0Arate = nea... | |
c71924d4baea473a36f0c22f0878fea7a9ff2800 | Create constants.py | a2/constants.py | a2/constants.py | Python | 0.000006 | @@ -0,0 +1,641 @@
+import re%0Aimport time%0A%0A#first link to view the cruise %0Abase_link = 'https://www.princess.com/find/cruiseDetails.do?voyageCode=2801'%0A%0A#element to find%0Abutton_element = 'md-hidden'%0A%0A#gets the current time%0Atime = time.strftime('%25I:%25M:%25S')%0A%0Aforming = 'building request'%0Asep... | |
3dcd012977d4dfea69ec4a51650ac9a4fd375842 | add missing migration file | registration/migrations/0007_auto_20160416_1217.py | registration/migrations/0007_auto_20160416_1217.py | Python | 0.000001 | @@ -0,0 +1,494 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.2 on 2016-04-16 03:17%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('registration', '0006_auto_20160416_1202'),%0A %5D... | |
64d675304b2d66d89e55dcff167d1dd20e6b000c | add fragment molecule class for monte carlo simulation | afm/molecule.py | afm/molecule.py | Python | 0 | @@ -0,0 +1,194 @@
+%0Aclass FragmentMolecule(object):%0A%0A%09def __init__(self, composition):%0A%09%09self.composition = composition%0A%0A%09def __str__(self):%0A%09%09%22%22%22%0A%09%09Return a string representation.%0A%09%09%22%22%22%0A%09%09return self.composition%0A
| |
f3c2b9087a06b508a278cb8e6f79200caae1ac07 | Add a tool to encode udot instructions in asm code so we compile on any toolchain. | standalone/encode.py | standalone/encode.py | Python | 0 | @@ -0,0 +1,1507 @@
+import sys%0Aimport re%0A%0A%0Adef encode_udot_vector(line):%0A m = re.search(%0A r'%5Cbudot%5B %5D+v(%5B0-9%5D+)%5B %5D*.%5B %5D*4s%5B %5D*,%5B %5D*v(%5B0-9%5D+)%5B %5D*.%5B %5D*16b%5B %5D*,%5B %5D*v(%5B0-9%5D+)%5B %5D*.%5B %5D*16b',%0A line)%0A if not m:%0A return 0, line%0A%0A mat... | |
fb8b1d7cb6e98e97fb383ca7457cb1cd237f8184 | Add usernamer.py | examples/username.py | examples/username.py | Python | 0.000013 | @@ -0,0 +1,447 @@
+# Madenning Username Generator%0A# Returns first char of first name and first 7 chars of last name%0A%0A%0Adef usernamer(first_name, last_name):%0A username = first_name%5B0%5D + last_name%5B:7%5D%0A return username.lower()%0A%0A%0Aif __name__ == '__main__':%0A # Testing%0A assert usernam... | |
1417d5345d68ef67ba6e832bbc45b8f0ddd911bc | Create testTemplate.py | data_structures/linked_list/utils/testTemplate.py | data_structures/linked_list/utils/testTemplate.py | Python | 0.000001 | @@ -0,0 +1,856 @@
+# A test template for Python solutions.%0A%0Aimport sys%0A%0Adef TestMain(sol, log=sys.stdout, doNotLogPassed=True) -%3E bool:%0A %22%22%22%0A @param sol: the function to be tested.%0A @param log: a stream or a file to log the tester output to.%0A @param doNotLogPa... | |
3ea318cf5c1b66106bf496d513efdd6e86d0f665 | add vowpal_wabbit requirement installation | robustus/detail/install_vowpal_wabbit.py | robustus/detail/install_vowpal_wabbit.py | Python | 0 | @@ -0,0 +1,3096 @@
+# =============================================================================%0A# COPYRIGHT 2013 Brain Corporation.%0A# License under MIT license (see LICENSE file)%0A# =============================================================================%0A%0Aimport logging%0Aimport os%0Afrom requirement ... | |
30567284410b9bb7154b8d39e5dfe7bc4bb1b269 | Add migration for on_delete SET_NULL | herald/migrations/0006_auto_20170825_1813.py | herald/migrations/0006_auto_20170825_1813.py | Python | 0.000027 | @@ -0,0 +1,610 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.8 on 2017-08-25 23:13%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies ... | |
1999295556ba404c7542d2001d7fdca80de54b5f | update api | functions/bcftools/main.py | functions/bcftools/main.py | Python | 0 | @@ -0,0 +1,971 @@
+%22%22%22%0ALambda example with external dependency%0A%22%22%22%0A%0Aimport logging%0Afrom subprocess import Popen, PIPE%0Aimport json%0A%0Alogger = logging.getLogger()%0Alogger.setLevel(logging.INFO)%0A%0Adef return_msg(out, err, status = 200):%0A return %7B%0A 'statusCode': status... | |
f3c4bac262c6d09730b3f0c4a24639fde8b4d923 | Add wsgi compatible example gunicorn application | gunicorn-app.py | gunicorn-app.py | Python | 0 | @@ -0,0 +1,1198 @@
+from __future__ import unicode_literals%0A%0Aimport multiprocessing%0A%0Aimport gunicorn.app.base%0A%0Afrom gunicorn.six import iteritems%0A%0A%0Adef number_of_workers():%0A return (multiprocessing.cpu_count() * 2) + 1%0A%0A%0Adef handler_app(environ, start_response):%0A response_body = b'Work... | |
8d8522c95492f034db2a43e95a6c9cd3fb60c798 | Create glove2word2vec.py | glove2word2vec.py | glove2word2vec.py | Python | 0.000735 | @@ -0,0 +1,2707 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# Copyright (C) 2016 Manas Ranjan Kar %3Cmanasrkar91@gmail.com%3E%0A# Licensed under the MIT License https://opensource.org/licenses/MIT%0A%0A%22%22%22%0ACLI USAGE: python glove2word2vec.py %3CGloVe vector file%3E %3COutput model file%3E%0A%0ACon... | |
c718cf1d483b2570b886269cf990458b195500b5 | Remove Access-Control-Allow-Origin after all | gratipay/utils/cache_static.py | gratipay/utils/cache_static.py | """
Handles caching of static resources.
"""
from base64 import b64encode
from hashlib import md5
from aspen import Response
ETAGS = {}
def asset_etag(path):
if path.endswith('.spt'):
return ''
if path in ETAGS:
h = ETAGS[path]
else:
with open(path) as f:
h = ETAGS[p... | Python | 0 | @@ -1662,151 +1662,8 @@
etag
-%0A if 'Access-Control-Allow-Origin' not in response.headers:%0A response.headers%5B'Access-Control-Allow-Origin'%5D = 'https://gratipay.com'
%0A%0A
|
2f6bfddbff166115e59db7763a62258a06b4e789 | Apply orphaned migration | project/apps/api/migrations/0010_remove_chart_song.py | project/apps/api/migrations/0010_remove_chart_song.py | Python | 0 | @@ -0,0 +1,345 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('api', '0009_auto_20150722_1041'),%0A %5D%0A%0A operations = %5B%0A migrations.RemoveField... | |
0f787b6b8a6a069edb0f654cdf9000a8dba3277c | Version Change | geocoder/__init__.py | geocoder/__init__.py | #!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
"""
Geocoder
~~~~~~~~
Simple and consistent geocoding library written in Python.
Many online providers such as Google & Bing have geocoding services,
these providers do not include Python libraries and have different
JSON responses between each... | Python | 0.000001 | @@ -643,17 +643,17 @@
= '1.6.
-3
+4
'%0A__lice
|
c0c7eeded364e02509fd66f95acd30e9928c663c | Do not respect context | taskwiki/taskwiki.py | taskwiki/taskwiki.py | import sys
import vim # pylint: disable=F0401
from tasklib.task import TaskWarrior, Task
# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
import cache
import util
import vwtask
"""
How this plugin works:
1.) On startup, it reads all the tasks and syncs info ... | Python | 0.999521 | @@ -598,16 +598,87 @@
he(tw)%0A%0A
+# Make sure context is not respected%0Atw.config.update(%7B'context':''%7D)%0A%0A
%0Aclass W
|
2a41ad4f6bce3b554287831ed594afbc0ddc5959 | Move matching tasks detection to a separate property | taskwiki/viewport.py | taskwiki/viewport.py | import itertools
import re
import vim # pylint: disable=F0401
import vwtask
import regexp
import util
class ViewPort(object):
"""
Represents viewport with a given filter.
A ViewPort is a vimwiki heading which contains (albeit usually hidden
by the vim's concealing feature) the definition of TaskWarr... | Python | 0.000005 | @@ -1945,16 +1945,314 @@
ilter)%0A%0A
+ @property%0A def matching_tasks(self):%0A # Split the filter into CLI tokens and filter by the expression%0A # By default, do not list deleted tasks%0A args = %5B%22-DELETED%22%5D + self.taskfilter%0A return set(%0A task for task in s... |
08772aa328b12d358b5047dcfa6f43120d4ffd25 | remove extra whitespace | gmusicapi/session.py | gmusicapi/session.py | # -*- coding: utf-8 -*-
"""
Sessions handle the details of authentication and transporting requests.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import * # noqa
from contextlib import closin... | Python | 0.99999 | @@ -3966,24 +3966,16 @@
nInfo')%0A
-
%0A
|
b3ab8fa855a08f0d63885b6df206715d1f36a817 | Add DNS-over-HTTPS example script | mrequests/examples/dns-over-https.py | mrequests/examples/dns-over-https.py | Python | 0 | @@ -0,0 +1,962 @@
+import mrequests%0Afrom urlencode import urlencode%0A%0ADOH_IP = %221.1.1.1%22%0ADOH_SERVER = b%22cloudflare-dns.com%22%0ADOH_PATH = %22/dns-query%22%0A%0A%0Adef gethostbyname(name):%0A params = urlencode(%7B%0A %22name%22: name,%0A %22type%22: %22A%22%0A %7D)%0A headers = %7B%... | |
4f765997c740f1f9b2dc985e7f3b0a467e8c311a | add code. | image_to_yymmdd_dir_by_EXIF.py | image_to_yymmdd_dir_by_EXIF.py | Python | 0.000001 | @@ -0,0 +1,1041 @@
+# -*- coding: utf-8 -*- %0A%0Afrom PIL import Image%0Aimport os%0Aimport shutil%0A%0Auser_name = os.getlogin()%0A# image/hoge.jpg, image/fuga.png, etc...%0Asrc_dir = %22/Users/%22 + user_name + %22/Desktop/image/%22%0A# create dst_dir/yyyymmdd/%0Adst_dir = %22/Users/%22 + user_name + %22/Desktop/dst... | |
f7a1998f67a02530604e4b727c7600704e4eb341 | update pelu to K2 | keras_contrib/layers/advanced_activations.py | keras_contrib/layers/advanced_activations.py | from .. import initializers
from keras.engine import Layer
from .. import backend as K
import numpy as np
class PELU(Layer):
"""Parametric Exponential Linear Unit.
It follows:
`f(x) = alphas * (exp(x / betas) - 1) for x < 0`,
`f(x) = (alphas / betas) * x for x >= 0`,
where `alphas` & `betas` are l... | Python | 0 | @@ -1963,23 +1963,16 @@
).__init
-ializer
__(**kwa
|
920dbe007501ea99b95c41f94fb8f4a48c40717a | Add SensorsCollector, which collects data from libsensors via PySensors | src/collectors/SensorsCollector/SensorsCollector.py | src/collectors/SensorsCollector/SensorsCollector.py | Python | 0 | @@ -0,0 +1,1112 @@
+import diamond.collector%0A%0Aimport sensors%0A%0Aclass SensorsCollector(diamond.collector.Collector):%0A %22%22%22%0A This class collects data from libsensors. It should work against libsensors 2.x and 3.x, pending%0A support within the PySensors Ctypes binding: http://pypi.python.org/pypi... | |
66f32607d9d140be2a8e71270862074c53121a68 | Create dataUIwgt.py | pyside/pyside_basics/jamming/dataUIwgt.py | pyside/pyside_basics/jamming/dataUIwgt.py | Python | 0.000002 | @@ -0,0 +1,1810 @@
+from PySide import QtGui%0A%0A%0Aclass Data(object):%0A def __init__(self):%0A self.requiredNames = %22A B C D E%22.split(' ')%0A self.availableActions = %22Set Select Delete%22.split(' ')%0A %0A def Set(self, name):%0A print %22setting %22, name%0A %0A def Select... | |
ae948c95ea0087f33f13ef3463dc022eda0301a2 | Add a solution for the MadLibs lab | python/labs/make-a-short-story/mystory.py | python/labs/make-a-short-story/mystory.py | Python | 0.000008 | @@ -0,0 +1,722 @@
+# Create a function for adjectives so I don't repeat myself in prompts.%0Adef get_adjective():%0A return raw_input(%22Give me an adjective: %22)%0A%0Adef get_noun():%0A return raw_input(%22Give me a noun: %22)%0A%0Adef get_verb():%0A return raw_input(%22Give me a verb: %22)%0A%0Aadjective1 =... | |
3cf1eb01540a126ef6a38219f89a41a0f05ad63f | Format fixing | constants.py | constants.py | Python | 0.000001 | @@ -0,0 +1,1292 @@
+UNITS = %22SI%22%0A%0AUNIT_LENGTH = 1%0AUNIT_MASS = 1%0AUNIT_TIME = 1%0A%0ADEFAULT_GRAVITATIONAL_CONSTANT = 6.673e-11 # m3 kg-1 s-2 %0ADEFAULT_SPEED_OF_LIGHT = 299792458 # m s-1%0ADEFAULT_SOLAR_MASS = 1.98892e30 # kg%0ADEFAULT_PARSEC ... | |
476f2493576c55c0f412165e3c3ce8225599ba0a | Copy caller_checker.py | server/src/voodoo/gen2/caller_checker.py | server/src/voodoo/gen2/caller_checker.py | Python | 0.000004 | @@ -0,0 +1,927 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A#%0A# Copyright (C) 2005 onwards University of Deusto%0A# All rights reserved.%0A#%0A# This software is licensed as described in the file COPYING, which%0A# you should have received as part of this distribution.%0A#%0A# This software consists of contribut... | |
77b34390345208a6e0bc5ad30cdce62e42ca0c56 | Add simple command to list speakers and tickets | wafer/management/commands/pycon_speaker_tickets.py | wafer/management/commands/pycon_speaker_tickets.py | Python | 0 | @@ -0,0 +1,1609 @@
+import sys%0Aimport csv%0Afrom optparse import make_option%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom django.contrib.auth.models import User%0Afrom wafer.talks.models import ACCEPTED%0A%0A%0Aclass Command(BaseCommand):%0A help = %22List speakers and associated tickets.%22%... | |
c2e882855ea56c265ef46646ec5e20f78d0ad064 | add migrations for missing phaselogs after fixing bulk project status updates | bluebottle/projects/migrations/0028_auto_20170619_1555.py | bluebottle/projects/migrations/0028_auto_20170619_1555.py | Python | 0 | @@ -0,0 +1,1279 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.7 on 2017-06-19 13:55%0Afrom __future__ import unicode_literals%0Aimport datetime%0Afrom django.db import migrations%0A%0Adef fix_phaselog_for_incorrect_project_statuses(apps, schema_editor):%0A %22%22%22%0A #BB-9886 : Fix to add a new proje... | |
3bf484de25cc77b0fc8f04e77f3993f4c1e939a8 | Break on self.quitting line | tests/test_shells/postproc.py | tests/test_shells/postproc.py | #!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import socket
import sys
import codecs
import platform
import re
test_type = sys.argv[1]
test_client = sys.argv[2]
shell = sys.argv[3]
fname = os.path.join('tests', 'shel... | Python | 0 | @@ -3421,16 +3421,71 @@
ne = ''%0A
+%09%09%09%09if line == '-%3E self.quitting = True%5Cn':%0A%09%09%09%09%09break%0A
%09%09%09W.wri
|
9cb5658c53a2202931e314ced3ee66714301a087 | Create _im_rot_manual_detect.py | resources/_py_in/_im_rot_manual_detect.py | resources/_py_in/_im_rot_manual_detect.py | Python | 0.000064 | @@ -0,0 +1,2557 @@
+# PYTHON%0A# MANISH DEVGAN%0A# https://github.com/gabru-md%0A%0A# Program helps in detecting faces which are%0A# tilted right or left! The detection is done by %0A# rotating the image and the trying to detect the %0A# potential faces in it!%0A%0A#BEGIN%0A%0A# importing %0A%0Aimport cv2%0Aimport nump... | |
36ada2dc33ccb3cb1803f67a112e3559efd7e821 | Add file to initialize item endpoint - Add item_fields | app/api/item.py | app/api/item.py | Python | 0 | @@ -0,0 +1,440 @@
+%22%22%22 Routes for bucket_item Functionality%22%22%22%0A# from flask import g%0A# from flask import Blueprint, request, jsonify%0Afrom flask_restplus import fields%0A# from app.models.bucketlist import Bucketlist%0A# from app import api%0A%0Aitem_fields = %7B%0A 'id': fields.Integer,%0A 'name... | |
6c34347dc0bac58ca4e8e25f355f6ad0f7295ccd | Find/replace with regular expressions | ocradmin/plugins/util_nodes.py | ocradmin/plugins/util_nodes.py | """
Nodes to perform random things.
"""
from nodetree import node, writable_node, manager
from ocradmin.plugins import stages, generic_nodes
NAME = "Utils"
from HTMLParser import HTMLParser
class HTMLContentHandler(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self._data = []
... | Python | 0.999564 | @@ -34,16 +34,26 @@
s.%0A%22%22%22%0A%0A
+import re%0A
from nod
@@ -1913,85 +1913,103 @@
def
-content_data(self, data, tag, attrs):%0A %22%22%22Replace all content data.%22%22%22
+__init__(self, *args, **kwargs):%0A super(FindReplaceNode, self).__init__(*args, **kwargs)
%0A
@@ -2017,138 +2017,400 ... |
bf53f738bb5408622b08eedb9b0b0c6f80487a0c | Create 0603_verbs_vehicles.py | 2019/0603_verbs_vehicles.py | 2019/0603_verbs_vehicles.py | Python | 0.000036 | @@ -0,0 +1,847 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ANPR 2019-06-02%0Ahttps://www.npr.org/2019/06/02/728600551/sunday-puzzle-lets-go-toe-to-toe?utm_medium=RSS&utm_campaign=sundaypuzzle%0A%0AThink of a verb in its present and past tense forms. %0ADrop the first letter of each word. %0AThe re... | |
60f54674cc7bb619d5275dbd49e346ecee276ff2 | fix reload module | importloader.py | importloader.py | Python | 0.000001 | @@ -0,0 +1,348 @@
+%EF%BB%BF#!/usr/bin/python%0A# -*- coding: UTF-8 -*-%0A%0Adef load(name):%0A%09try:%0A%09%09obj = __import__(name)%0A%09%09reload(obj)%0A%09%09return obj%0A%09except:%0A%09%09pass%0A%0A%09try:%0A%09%09import importlib%0A%09%09obj = importlib.__import__(name)%0A%09%09importlib.reload(obj)%0A%09%09retu... | |
152db7b696b949c67b5121d42fba28ec31eceb47 | Create everyeno_keys.py | everyeno_keys.py | everyeno_keys.py | Python | 0 | @@ -0,0 +1,257 @@
+tumblr_consumer_key = ''%0Atumblr_consumer_secret = ''%0Atumblr_token_key = ''%0Atumblr_token_secret = ''%0A%0Agoogle_developerKey = ''%0A%0Atwitter_consumer_key = ''%0Atwitter_consumer_secret = ''%0Atwitter_token_key = ''%0Atwitter_token_secret = ''%0A%0Adiscogs_user_token = ''%0A
| |
768b6fd5f4af994ca9af1470cfcc7fa7eb216a8f | Add a binding.gyp file. | binding.gyp | binding.gyp | Python | 0 | @@ -0,0 +1,254 @@
+%7B%0A 'targets': %5B%0A %7B%0A 'target_name': 'validation',%0A 'cflags': %5B '-O3' %5D,%0A 'sources': %5B 'src/validation.cc' %5D%0A %7D,%0A %7B%0A 'target_name': 'bufferutil',%0A 'cflags': %5B '-O3' %5D,%0A 'sources': %5B 'src/bufferutil.cc' %5D%0A %7D%0A ... | |
e9b8330d71e48702198117652768ba6791bc1401 | adds hello world | app/helloworld.py | app/helloworld.py | Python | 0.999588 | @@ -0,0 +1,972 @@
+#!/usr/local/bin/python3.7%0A%0Afrom pprint import pprint%0Afrom bson.objectid import ObjectId%0Afrom pymongo import MongoClient%0Aimport datetime%0A%0Aclient = MongoClient('mongodb://localhost:27017/')%0Adb = client.test_database%0Acollection = db.test_collection%0Apost = %7B%22author%22: %22Mike%22... | |
3bbf06964452683d986db401556183f575d15a55 | Add script for inserting project into DB | insert-project.py | insert-project.py | Python | 0.000001 | @@ -0,0 +1,1507 @@
+#!/usr/bin/env python3%0Aimport pymongo%0Aimport subprocess%0Aimport re%0Afrom datetime import datetime%0Aimport argparse%0Afrom json import load as load_json%0Aimport sys%0A%0A%0Adef _info(msg):%0A sys.stdout.write(msg + '%5Cn')%0A sys.stdout.flush()%0A%0A%0Acl_parser = argparse.ArgumentParse... | |
28e483c32d3e946f0f9159fe7459531f284d50aa | Add shared counter support to cache. | app/molcounter.py | app/molcounter.py | Python | 0 | @@ -0,0 +1,2714 @@
+from google.appengine.api import memcache %0Afrom google.appengine.ext import db%0Aimport random%0Aimport collections%0Aimport logging%0A%0Aclass GeneralCounterShardConfig(db.Model):%0A %22%22%22Tracks the number of shards for each named counter.%22%22%22%0A name = db.StringProperty(required=True)... | |
dbed291584150ef3d219c487f32b47a8f4907195 | question 1.7 | crack_1_7.py | crack_1_7.py | Python | 0.999967 | @@ -0,0 +1,394 @@
+test = %5B%5B0,1,2,3%5D,%0A%09%5B1,0,2,3%5D,%0A%09%5B1,2,0,3%5D,%0A%09%5B1,2,3,0%5D%5D%0Araw = %5B%5D%0Acol = %5B%5D%0Alength = len(test)%0Afor x in xrange(length):%0A%09for y in xrange(length):%0A%09%09if test%5Bx%5D%5By%5D == 0:%0A%09%09%09raw.append(x)%0A%09%09%09col.append(y)%0A%0Afor x in raw:%0... | |
305b53b4c0ab4be7e2e2c4f9d7d4754915d3eea6 | Fix bug in perturb_params | dadi/Misc.py | dadi/Misc.py | """
Miscellaneous utility functions. Including ms simulation.
"""
import os,sys,time
import numpy
import scipy.linalg
#: Storage for times at which each stream was flushed.
__times_last_flushed = {}
def delayed_flush(stream=sys.stdout, delay=1):
"""
Flush a stream, ensuring that it is only flushed every 'del... | Python | 0.000001 | @@ -3446,16 +3446,17 @@
(fold *
+(
2*numpy.
@@ -3484,16 +3484,17 @@
ams))-1)
+)
%0A if
|
666c1c0f45c51c92e8e23c2dc144853063363abe | Make events plugin work with i18n_subsites | events/events.py | events/events.py | # -*- coding: utf-8 -*-
"""
events plugin for Pelican
=========================
This plugin looks for and parses an "events" directory and generates
blog posts with a user-defined event date. (typically in the future)
It also generates an ICalendar v2.0 calendar file.
https://en.wikipedia.org/wiki/ICalendar
Author: ... | Python | 0 | @@ -3213,60 +3213,804 @@
-for e in events:%0A dtstart, dtend, metadata =
+multiLanguageSupportNecessary = %22i18n_subsites%22 in generator.settings%5B%22PLUGINS%22%5D%0A if multiLanguageSupportNecessary:%0A currentLang = os.path.basename(os.path.normpath(generator.settings%5B'OUTPUT_PATH'%5D))%0... |
2c6700d7a16ec7e76847f3664655aaf6c8f171eb | Create test_servo5v.py | test/test_servo5v.py | test/test_servo5v.py | Python | 0.000003 | @@ -0,0 +1,206 @@
+from gadgets.motors.servos import Servo5V%0Aimport time%0Aimport random%0A%0Aservo = Servo5V(pin_number=12,freq=100)%0Acount = 0%0Awhile count %3C 185:%0A%09time.sleep(0.1)%0A%09servo.write(count)%0A%09count += 5%0Aservo.cleanup()%09%0A%09%0A
| |
7c9c95795dbbc5f64b532720f5749b58361c222b | add collector for http://www.dshield.org/ | collectors/dshield.py | collectors/dshield.py | Python | 0 | @@ -0,0 +1,1982 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Aimport socket%0Aimport requests%0Aimport ipwhois%0Afrom pprint import pprint%0A%0A%0Adef get_url(url):%0A try:%0A res = requests.get(url)%0A except requests.exceptions.ConnectionError:%0A raise requests.exceptions.ConnectionError(%... | |
8fe73523b7141f93d8523e56a7c6a5cc2ed82051 | Test case for ioddrivesnmp class | src/collectors/iodrivesnmp/test/testiodrivesnmp.py | src/collectors/iodrivesnmp/test/testiodrivesnmp.py | Python | 0 | @@ -0,0 +1,668 @@
+#!/usr/bin/python%0A# coding=utf-8%0A################################################################################%0A%0Afrom test import CollectorTestCase%0Afrom test import get_collector_config%0A%0Afrom iodrivesnmp import IODriveSNMPCollector%0A%0A%0Aclass TestIODriveSNMPCollector(CollectorTestC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.