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 |
|---|---|---|---|---|---|---|---|
5a5900a5c0ab1e0ac41469770e3775faf482c21e | write TagField basic | tags/fields.py | tags/fields.py | Python | 0.000004 | @@ -0,0 +1,1201 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Afrom django.db.models.fields import CharField%0Afrom django.utils.translation import ugettext_lazy as _%0A%0Afrom tags.models import Tag%0A%0A%0Aclass TagField(CharField):%0A def __init__(self,%0A verbose_name=_(u'Tags'),%0A ... | |
11d2f5e649ef5c5aedec9723894cd29c1d4d81f4 | Add missing migration | froide/document/migrations/0027_alter_document_content_hash.py | froide/document/migrations/0027_alter_document_content_hash.py | Python | 0.0002 | @@ -0,0 +1,434 @@
+# Generated by Django 3.2.4 on 2021-07-07 20:08%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('document', '0026_auto_20210603_1617'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
36e3cb292b24d5940efed635c49bf5bb62007edb | Create __init__.py | acupoints/__init__.py | acupoints/__init__.py | Python | 0.000011 | @@ -0,0 +1 @@
+%0A
| |
41631175c7aae124f7504f068d9c2f8cf1c9e617 | Add exception to describe errors in configuration processing | plugins/configuration/configurationtype/configuration_error.py | plugins/configuration/configurationtype/configuration_error.py | Python | 0 | @@ -0,0 +1,1295 @@
+#!/usr/bin/env python%0A#-*- coding: utf-8 -*-%0A%0A#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.%0A#The license can also be read online: %3Chttps://creativecommons.org/publicdomain/zero/1.0... | |
a857273666cb616e1c019bedff81d3014070c896 | increase Proofread of Henochbuch | scripts/online_scripts/150916_increase_proofread_Henochbuch.py | scripts/online_scripts/150916_increase_proofread_Henochbuch.py | Python | 0 | @@ -0,0 +1,481 @@
+# -*- coding: utf-8 -*-%0A__author__ = 'eso'%0Aimport sys%0Asys.path.append('../../')%0Afrom tools.catscan import CatScan%0Aimport re%0Aimport requests%0Aimport pywikibot%0Afrom pywikibot import proofreadpage%0A%0Asite = pywikibot.Site()%0A%0Afor i in range(455, 474):%0A page = pywikibot.proofread... | |
29179bd9a9aa1dafa2dce08dee0339fd5d320238 | add similar processes to test config, one of them matching name, and the other exe | src/collectors/processmemory/test/testprocessmemory.py | src/collectors/processmemory/test/testprocessmemory.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch, Mock
from diamond.collector import Collector
from processmemory import ProcessMem... | Python | 0 | @@ -747,32 +747,168 @@
%0A %7D,%0A
+ 'bar': %7B%0A 'name': '%5Ebar',%0A %7D,%0A 'barexe': %7B%0A 'exe': 'bar$'%0A %7D%0A
%7D%0A %7D%0A
@@ -897,24 +897,24 @@
%7D%0A %7D%0A
-
%7D%0A%0A d
@@ -2188,32 +2188,358... |
1d75b7e0bd0c498b5ea2c32c4e98a278ca2aed1b | make sitelockdown generic | src/python/expedient/common/middleware/sitelockdown.py | src/python/expedient/common/middleware/sitelockdown.py | Python | 0 | @@ -0,0 +1,1241 @@
+'''%0A@author jnaous%0A'''%0Afrom django.conf import settings%0Afrom django.http import HttpResponseRedirect%0Afrom utils import RegexMatcher%0A%0Aclass SiteLockDown(RegexMatcher):%0A %22%22%22%0A This middleware class will force almost every request coming from%0A Django to be authenticate... | |
4f8fff9fb2da7bbdab68a0a4c02b51d00410e8c4 | Add synthtool scripts (#3765) | java-automl/google-cloud-automl/synth.py | java-automl/google-cloud-automl/synth.py | Python | 0.000001 | @@ -0,0 +1,1225 @@
+# Copyright 2018 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by a... | |
c7987bde28992ef0ae8cae9fca500730b2fcea15 | Add url rewriter for eztv | flexget/plugins/urlrewrite_eztv.py | flexget/plugins/urlrewrite_eztv.py | Python | 0 | @@ -0,0 +1,1913 @@
+from __future__ import unicode_literals, division, absolute_import%0Aimport re%0Aimport logging%0Afrom urlparse import urlparse, urlunparse%0Afrom requests import RequestException%0A%0Afrom flexget import plugin%0Afrom flexget.event import event%0Afrom flexget.plugins.plugin_urlrewriting import UrlR... | |
dc48c6068f04d007ab5ab318cd73783ae83464be | Fix error when trying a crash on a signature without proposed new signature | FTB/Signatures/CrashSignature.py | FTB/Signatures/CrashSignature.py | '''
Crash Signature
Represents a crash signature as specified in https://wiki.mozilla.org/Security/CrashSignatures
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can ... | Python | 0.000002 | @@ -6367,16 +6367,75 @@
wLines =
+ %5B%5D%0A if newRawCrashSignature:%0A newLines =
newRawC
|
c60b152573ccfe01997f3d970968180ac82af8ba | Add forgotten migration | bluebottle/funding_stripe/migrations/0014_auto_20190916_1645.py | bluebottle/funding_stripe/migrations/0014_auto_20190916_1645.py | Python | 0.000004 | @@ -0,0 +1,491 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2019-09-16 14:45%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('funding_stripe', '0013_auto_20190913_1458'),%0A ... | |
7d6932a07caed84c424f62ab8d980fde7eddeaed | Create lc375.py | LeetCode/lc375.py | LeetCode/lc375.py | Python | 0.000001 | @@ -0,0 +1,578 @@
+class Solution(object):%0A def getMoneyAmount(self, n):%0A %22%22%22%0A :type n: int%0A :rtype: int%0A %22%22%22%0A dp = %5B%5B0 for x in range(n+1)%5D for y in range(n+1)%5D%0A for i in range(2,n+1):%0A for x in range(n):%0A if x... | |
74d718b19ec49c0ca4c724533af1ec725003adef | remove emtry transtion of region | cities_light/management/commands/region_missing_translations.py | cities_light/management/commands/region_missing_translations.py | Python | 0.001989 | @@ -0,0 +1,445 @@
+from django.core.management.base import BaseCommand%0A%0A%0Aclass Command(BaseCommand):%0A%0A def handle(self, *args, **options):%0A from cities_light import Region%0A for item in Region.published.all():%0A if not item.translations.all():%0A obj = item.trans... | |
b09bfaa7a9f9bed7f3d19176cd67b83031347872 | Largest prime factor | p3.py | p3.py | Python | 0.999936 | @@ -0,0 +1,673 @@
+# Find the largest prime factor of a positive (composite) number%0A%0Adef prime_factors(n):%0A factors = %5B%5D%0A d = 2%0A while n %3E 1:%0A while n %25 d == 0:%0A factors.append(d)%0A n /= d%0A d = d + 1%0A return factors%0A%0Apfs = prime_factors(6008... | |
1fff4fb083e2ac0dad8d8a3ac59fc68ef2939073 | required drilldown*s* not singular | cubes/backends/mixpanel/store.py | cubes/backends/mixpanel/store.py | # -*- coding=utf -*-
from ...model import *
from ...browser import *
from ...stores import Store
from ...errors import *
from .mixpanel import *
from string import capwords
DIMENSION_COUNT_LIMIT = 100
time_dimension_md = {
"name": "time",
"levels": ["year", "month", "day", "hour"],
"hierarchies": [
... | Python | 0.99897 | @@ -1946,16 +1946,17 @@
rilldown
+s
might b
@@ -2049,25 +2049,28 @@
rilldown
+s
%22:
+%5B
%22time%22
+%5D
,%0A
|
e20002febd14a2f6d31b43ee85d57bfa26c745e5 | test game/board.py | yaranullin/game/tests/board.py | yaranullin/game/tests/board.py | Python | 0 | @@ -0,0 +1,1792 @@
+# yaranullin/game/tests/board.py%0A#%0A# Copyright (c) 2012 Marco Scopesi %3Cmarco.scopesi@gmail.com%3E%0A#%0A# Permission to use, copy, modify, and distribute this software for any%0A# purpose with or without fee is hereby granted, provided that the above%0A# copyright notice and this permission no... | |
d3f556b6d7da2c67fc9dcc6b7d73a0d1b76d278c | Add tests for valid recipes | tests/functional_tests/test_valid_recipes.py | tests/functional_tests/test_valid_recipes.py | Python | 0.000001 | @@ -0,0 +1,1032 @@
+import os%0A%0Aimport pytest%0A%0Afrom conda_verify import utils%0Afrom conda_verify.exceptions import RecipeError%0Afrom conda_verify.verify import Verify%0A%0A%0A@pytest.fixture%0Adef recipe_dir():%0A return os.path.join(os.path.dirname(__file__), 'test-recipes')%0A%0A%0A@pytest.fixture%0Adef v... | |
40f4bc4602da9f66c08a6ee7dcdb3af71e891441 | Create Python1.py | Python1.py | Python1.py | Python | 0.999934 | @@ -0,0 +1,84 @@
+#!/usr/bin/env python%0Adef main():%0A%09print('hello world')%0Aprint '------------'%0Amain()%0A
| |
1de7573b08274646d961e7a667ed48aff5ca2932 | return export path from Rule.do_build() | peru/rule.py | peru/rule.py | import os
import subprocess
from .cache import compute_key
from .error import PrintableError
class Rule:
def __init__(self, name, build_command, export):
self.name = name
self.build_command = build_command
self.export = export
def cache_key(self, resolver, input_tree):
return... | Python | 0 | @@ -492,22 +492,86 @@
-if not
+%22%22%22Executes the rule and returns the exported directory.%22%22%22%0A if
self.bu
@@ -599,28 +599,17 @@
-return%0A
try:%0A
+
@@ -688,16 +688,20 @@
+
+
except s
@@ -735,16 +735,20 @@
r as e:%0A
+
@@ -813,143 +813... |
729bed3fd3e7bd3ecabda3ab25525019f3f83661 | Add py-imageio for python3 (#8553) | var/spack/repos/builtin/packages/py-imageio/package.py | var/spack/repos/builtin/packages/py-imageio/package.py | Python | 0.000001 | @@ -0,0 +1,2135 @@
+##############################################################################%0A# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
1cb2855054c40e6de7c6f9bf8efb7c8331009ca8 | add new package (#24702) | var/spack/repos/builtin/packages/py-iso8601/package.py | var/spack/repos/builtin/packages/py-iso8601/package.py | Python | 0 | @@ -0,0 +1,554 @@
+# 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 PyIso8601(PythonPackage):%0A %22%22%22Simple module to p... | |
ace0f80344519a747a71e09faca46c05594dd0d9 | Add examples/req_rep.py | examples/req_rep.py | examples/req_rep.py | Python | 0 | @@ -0,0 +1,1795 @@
+#!env/bin/python%0A%0A%22%22%22%0AExample txzmq client.%0A%0A examples/req_rep.py --method=connect --endpoint=ipc:///tmp/req_rep_sock --mode=req%0A%0A examples/req_rep.py --method=bind --endpoint=ipc:///tmp/req_rep_sock --mode=rep%0A%22%22%22%0Aimport os%0Aimport socket%0Aimport sys%0Aimport t... | |
05a2a8115ae5bcab8e4980520327120111ca260a | Fix dupe add logic re: unreleased | fabric/changelog.py | fabric/changelog.py | import docutils
import ipdb
class issue(docutils.nodes.Element):
@property
def type(self):
return self['type_']
@property
def backported(self):
return self['backported']
@property
def number(self):
return self.get('number', None)
class release(docutils.nodes.Element)... | Python | 0 | @@ -2419,99 +2419,25 @@
#
-Add all to unreleased, add bugs to others too%0A lines%5B'unreleased'%5D.append(focus)
+Bugs go errywhere
%0A
@@ -2566,24 +2566,155 @@
pend(focus)%0A
+ # Non-bugs only go into unreleased (next release)%0A else:%0A lines%5B'unreleased'%5... |
3ed611cebed6c9283b5668a7c237deae265fdd64 | create fedex_cir_import.py | fedex_cir_import.py | fedex_cir_import.py | Python | 0 | @@ -0,0 +1,3471 @@
+import os, pdb, psycopg2%0A%0A%0Aprint 'begin script - fedex_cir_import.py'%0A%0Apath = '/usr/local/cirdata/'%0Aimported = '/usr/local/cirdata/imported/'%0AphoenixDB = psycopg2.connect(%22dbname='database' user='user' host='host' password='password'%22)%0A %0A%0Afor file in os.listdir(path):%0A ... | |
513df9e9ce48c7877244d5c9ad1dcf220d368386 | Add findexposurehist to finde exposure dist for each country. | findexposurehist.py | findexposurehist.py | Python | 0 | @@ -0,0 +1,1833 @@
+from __future__ import division%0A%0Aimport ConfigParser%0Aimport csv%0Aimport time%0Aimport datetime%0A%0Aimport matplotlib; matplotlib.use('Agg')%0Aimport matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport scipy as sp%0Aimport scipy.stats as spstats%0A%0Aimport exposure%0Aimport util%0A%0Adef ... | |
539098d24cb671fe30543917928404a8de0f02e5 | make video using ffmpeg | fisspy/makemovie.py | fisspy/makemovie.py | Python | 0.000001 | @@ -0,0 +1,1526 @@
+%22%22%22%0AMakevideo%0A%0AUsing the ffmpeg make a movie file from images%0A%22%22%22%0Afrom __future__ import absolute_import, division, print_function%0Aimport numpy as np%0Aimport subprocess as sp%0Aimport platform%0Afrom matplotlib.pyplot import imread%0Afrom shutil import copy2%0Aimport os%0A%0... | |
ef20713c0b4b7378fe91aae095258452d01e81ba | Create 1.py | basics/action/QWidgetAction/1.py | basics/action/QWidgetAction/1.py | Python | 0.000007 | @@ -0,0 +1,551 @@
+class SelectionSetsView(QTableView):%0A def _onContextMenu(self, widget, pos):%0A menu = QtGui.QMenu()%0A colorAction = menu.addAction(%22Edit Color%22)%0A colorAction.triggered.connect(partial(self._editColor, widget, pos))%0A colorWidgetAction = QtGui.QWidgetAction(me... | |
5ed5a0af116e9ac64ca7cf5a8be68997d44a21c9 | Version bump to 1.0.1 | mezzanine/__init__.py | mezzanine/__init__.py |
__version__ = "1.0.0"
| Python | 0 | @@ -13,11 +13,11 @@
= %221.0.
-0
+1
%22%0A
|
51b72ace0e0041199c596074718c2f8b22f5de71 | Create stripmanager.py | stripmanager.py | stripmanager.py | Python | 0.000001 | @@ -0,0 +1,1215 @@
+import time%0Afrom neopixel import *%0Aimport datamanager%0A%0A# LED strip configuration:%0ALED_COUNT = 60 # Number of LED pixels.%0ALED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).%0ALED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)%... | |
a19aff3173a85ca8b0035873c3a6315d3dbedba4 | Create main.py | gateway/src/main.py | gateway/src/main.py | Python | 0.000001 | @@ -0,0 +1,217 @@
+#!/usr/bin/env python%0A#Gateway main script.%0A#Communicate with end devices via LoRa.%0A#Communicate with server via MQTT(hbmqtt) and HTTP POST.%0A#Save data in the sqlite database.%0A#Parse JSON from MQTT and LoRa protocol.%0A
| |
754a717c8abc0f6b2683071684420240ff0aef17 | add heap | ds/heap.py | ds/heap.py | Python | 0.000005 | @@ -0,0 +1,1408 @@
+class BinHeap:%0A def __init__(self):%0A self.heap_list = %5B0%5D%0A self.size = 0%0A%0A def siftup(self, i):%0A while i // 2 %3E 0:%0A if self.heap_list%5Bi%5D %3C self.heap_list%5Bi//2%5D:%0A self.heap_list%5Bi//2%5D, self.heap_list%5Bi%5D = sel... | |
58c604a8574ade75aecbd80314004a9539e80c84 | Add ?wv command for encouraging action | plugins/volunteers.py | plugins/volunteers.py | Python | 0 | @@ -0,0 +1,262 @@
+__commands__ = '''%0A ?wv %5Bname%5D - congratulates people on their public sprited gesture%0A'''%0A%0A%0Adef plugin(bot):%0A bot.hear(r'%5E%5C?wv$', %22Well volunteered!%22)%0A bot.hear(r'%5E%5C?wv%5Cs(.+)$', lambda response: %22Well volunteered %25s!%22 %25 response.match.group(1).strip())... | |
b15d6bf7a8dede16394cc8455d5096066f15e964 | Update module.py | module/module.py | module/module.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | Python | 0.000001 | @@ -4422,16 +4422,28 @@
%5D = u''%0A
+
%0A
@@ -4453,74 +4453,183 @@
#
-If hope your public ip is ok, becaue we will use it as address :)%0A
+use public ip, else fall back to private one%0A if h%5B'_EC2_PUBLIC_IP'%5D:%0A h%5B'address'%5D = h%5B'_EC2_PUBLIC_IP'%5D%0A ... |
2d1fd9c81ca9f17270ecef6505830cb798632091 | initialize graph test file. | test_simple_graph.py | test_simple_graph.py | Python | 0 | @@ -0,0 +1,480 @@
+#!/usr/bin/env python%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0A%0Adef test_init(self):%0A return%0A%0A%0Adef test_nodes():%0A return nodes%0A%0A%0Adef test_edges():%0A return edges%0A%0A%0Adef test_add_node(value):%0A return%0A%0A%0Adef test_a... | |
87eab562e847d7cdde7867c41453b10add376fba | Add test script | test_madoka.py | test_madoka.py | Python | 0.000001 | @@ -0,0 +1,2394 @@
+# -*- coding: utf-8 -*-%0Afrom nose.tools import eq_, ok_%0Aimport madoka%0Aimport os%0A%0A%0Aclass Test_madoka(object):%0A%0A def test_inc(self):%0A sketch = madoka.Sketch()%0A sketch.inc('mami', 3)%0A eq_(1, sketch.get('mami', 3))%0A sketch.inc('mami', 3)%0A e... | |
100c2bb05d002c5b07e0d6ae4a242346e1362c2b | Create condition.py | colino/condition.py | colino/condition.py | Python | 0 | @@ -0,0 +1,598 @@
+from __future__ import (absolute_import, division,%0A print_function, unicode_literals)%0A%0Aclass Condition(object):%0A%0A def __init__(self, condition_model):%0A # used for holding objects like compiled reges%0A self.init_context = %7B%7D%0A # variables referenced by cond... | |
cf6172353ad5f73185b8de0d60510a0713aa9895 | Transform omorfi tagged text into finnpos format. | bin/omorfi2finnpos.py | bin/omorfi2finnpos.py | Python | 0 | @@ -0,0 +1,3013 @@
+from sys import stdin, argv, stderr%0Afrom re import findall%0A%0Adef get_lemma(string, convert_type):%0A if convert_type == 'ftb':%0A word_id_strs = findall('%5C%5BWORD_ID=%5B%5E%5C%5D%5D*%5C%5D', string)%0A lemma_parts = %5B word_id_str%5B9:%5D%5B:-1%5D for word_id_str in word_id_... | |
723a7ef13c34bf6e292377db9849753d34b4d0d1 | add new helper to display completion on learner dashboard | openedx/core/djangoapps/appsembler/html_certificates/helpers.py | openedx/core/djangoapps/appsembler/html_certificates/helpers.py | Python | 0.000001 | @@ -0,0 +1,2126 @@
+%22%22%22%0AAppsembler Helpers to improve course info in learner dashboard.%0AWe should remove this after Maple, since all the info is in the new course_home_api.%0A%22%22%22%0A%0Aimport beeline%0A%0Afrom xmodule.modulestore.django import modulestore%0Afrom common.djangoapps.student.helpers import c... | |
898e1692ed87890cf77a7534e3c51afed112a131 | add a top-level __init__.py with imports of the main classes | pyreaclib/__init__.py | pyreaclib/__init__.py | Python | 0.000008 | @@ -0,0 +1,578 @@
+%22%22%22%0Apyreaclib is a python module that interprets the nuclear reaction rates%0Acataloged by the JINA ReacLib project:%0A%0Ahttps://groups.nscl.msu.edu/jina/reaclib/db/%0A%0AIt provides both interactive access to the rates, for use in Jupyter%0Anotebooks as well as methods for writing python an... | |
a7a20eacc94f1bca2baf5c37632f116e34f2f079 | Create data_cleansed.py | data_cleansed.py | data_cleansed.py | Python | 0 | @@ -0,0 +1,853 @@
+# Data Cleansing%0Aimport pandas as pd%0Adf = pd.DataFrame()%0A# 1. Explore data: df.head(), df.tail(), df.info(), df.describe()%0A# Check NULL values totals: df.isna().sum()%0A# 2. Drop NaValues: df.dropna(inplace=True)%0A# 3. Deal with Duplicates: df.duplicated().value_counts()%0A''' A general ... | |
d90bb9ddfbac20fa9ae7d7ecf37064cb8a86b26e | add algorithm which choose the node with largest degree to query | degree_largest.py | degree_largest.py | Python | 0.000001 | @@ -0,0 +1,1395 @@
+from random import sample,random,choice%0Afrom core import Algorithm%0Afrom egraphs import FBEgoGraph%0A%0Aclass DegreeLargest(Algorithm):%0A%0A def update_graph(self, start_node, new_node):%0A g = self.sampled_graph%0A start_id = g.vs%5B'name'%5D.index(start_node)%0A if new_... | |
7b4f3784f3c27e861b2b741fe2a02c82a97e8fb9 | change storage test file name | blockchain_storage/tests.py | blockchain_storage/tests.py | Python | 0.000001 | @@ -0,0 +1,334 @@
+import hashlib%0Aimport leveldb%0A%0Adatabase = leveldb.LevelDB('/home/operator/PycharmProjects/CrAB/db', create_if_missing=False)%0Ahash = hashlib.sha256('data'.encode())%0Aprint('hash: ', hash.digest())%0Adatabase.Put(hashlib.sha256('data'.encode()).digest(), 'something'.encode())%0Aprint(database.... | |
40ad674ae170347ed69b19434241438bb09e473d | Define decorator for requiring login | app/decorators.py | app/decorators.py | Python | 0.000001 | @@ -0,0 +1,296 @@
+from functools import wraps%0A%0Afrom flask import redirect, session, url_for%0A%0Adef login_required(f):%0A @wraps(f)%0A def wrapper(*args, **kwargs):%0A if session.get('logged_in', False):%0A return f(*args, **kwargs)%0A return redirect(url_for('public.login'))%0A ... | |
bb90850d95998fec515e6581de049562494fa484 | Allow a debug param to be passed that keeps the script from running automatically. | boto/pyami/startup.py | boto/pyami/startup.py | # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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 the rights to use, copy, modi... | Python | 0 | @@ -2722,32 +2722,102 @@
n_script(self):%0A
+ debug = self.get_user_data('debug')%0A if not debug:%0A
if self.
@@ -2825,24 +2825,28 @@
odule_name:%0A
+
@@ -2901,32 +2901,36 @@
+
+
self.get_user_da
@@ -2959,16 +2959,20 @@
+
s = cls(
@@ ... |
789af47e06a559287562affe49d450c27c1d3ed1 | handle anonymous users | src/sentry/debug/middleware.py | src/sentry/debug/middleware.py | from __future__ import absolute_import
import json
import re
import threading
from debug_toolbar.middleware import DebugToolbarMiddleware
from debug_toolbar.toolbar import DebugToolbar
from django.utils.encoding import force_text
# Inherit from DebugToolbarMiddleware because of DJDT monkey patching
class DebugMiddl... | Python | 0.000004 | @@ -604,16 +604,89 @@
dr maps%0A
+ if not request.user.is_authenticated():%0A return False%0A
|
f608e18aa9fa2d13ce5a08f63ab44b942678ff5d | convert avg_face_maker from ipynb to .py and commit | avg_face_maker.py | avg_face_maker.py | Python | 0.000004 | @@ -0,0 +1,986 @@
+%22%22%22Create an average face from a list of faces%22%22%22%0A%0Aimport numpy as np%0Aimport cv2%0Aimport sqlite3%0Aimport json%0A%0Aconn = sqlite3.connect(%22face.db%22)%0Ac = conn.cursor()%0A%0Afaces_data = c.execute(%22SELECT * FROM (SELECT * FROM faces) as t1 inner join (select rowid, instagram... | |
15dca96debdc04d18ef69e457dc0c41e5288d99b | create fields.py so you don't have to specify trix fields in the admin | trix/fields.py | trix/fields.py | Python | 0 | @@ -0,0 +1,243 @@
+from django.db import models%0A%0Afrom trix.widgets import TrixEditor%0A%0A%0Aclass TrixField(models.TextField):%0A%0A def formfield(self, **kwargs):%0A kwargs.update(%7B'widget': TrixEditor%7D)%0A return super(TrixField, self).formfield(**kwargs)%0A
| |
2572feea64ee5e4556763132d0663fe4412fe369 | Add fixtures to test_journal.py and add test for write_entry method. | test_journal.py | test_journal.py | Python | 0 | @@ -0,0 +1,2154 @@
+# -*- coding: utf-8 -*-%0Afrom contextlib import closing%0Afrom pyramid import testing%0Aimport pytest%0A%0Afrom journal import connect_db%0Afrom journal import DB_SCHEMA%0A%0A%0ATEST_DSN = 'dbname=test_learning_journal user=mark'%0A%0A%0Adef init_db(settings):%0A with closing(connect_db(settings... | |
7ad1c83776c78e39b47792e6a8240686b04d3726 | Create main.v.py | contracts/main.v.py | contracts/main.v.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
6cffe1d30c16062e3a0414310aad89e7a04b2df6 | add handler-specific tests | tests/test_handler_specific.py | tests/test_handler_specific.py | Python | 0.000001 | @@ -0,0 +1,298 @@
+from pygelf import GelfTlsHandler%0Aimport pytest%0A%0A%0Adef test_tls_handler_creation():%0A with pytest.raises(ValueError):%0A GelfTlsHandler(host='127.0.0.1', port=12204, validate=True)%0A%0A with pytest.raises(ValueError):%0A GelfTlsHandler(host='127.0.0.1', port=12204, keyfil... | |
2069dccb5f1cf5dc4c0dc0ec3cca3daa3e4c87b3 | Remove solr.thumbnail from test config. | tests/config.py | tests/config.py | import os
import django
from django.conf import settings, global_settings
import oscar
def configure():
if not settings.configured:
from oscar.defaults import OSCAR_SETTINGS
# Helper function to extract absolute path
location = lambda x: os.path.join(
os.path.dirname(os.path.... | Python | 0 | @@ -889,42 +889,8 @@
s',%0A
- 'sorl.thumbnail',%0A
|
4121e3502f10f0ca36f696bf32e2dfe64bb19d0e | Create tibrvlisten.py | examples/api/tibrvlisten.py | examples/api/tibrvlisten.py | Python | 0.000001 | @@ -0,0 +1,2452 @@
+%0A%0Aimport sys%0Aimport getopt%0Afrom tibrv.events import *%0A%0Adef usage() :%0A print()%0A print(%22tibrvlisten.py %5B-service service%5D %5B-network network%5D%22)%0A print(%22 %5B-daemon daemon%5D %3Csubject%3E %22)%0A print()%0A sys.exit(1)%0A%0A%0Adef get_params(... | |
5d8a9223905117e6b01099c318a2294e148f84b4 | Add rpmgrill check | coprcheck/checks.py | coprcheck/checks.py | Python | 0 | @@ -0,0 +1,2291 @@
+%22%22%22Checks to run on fetched builds.%22%22%22%0A%0A%0Afrom contextlib import contextmanager%0Afrom distutils.spawn import find_executable%0Afrom functools import wraps%0Aimport fnmatch%0Aimport os%0Afrom shutil import rmtree%0Afrom subprocess import check_call%0A%0A%0Aclass MissingBinaryError(O... | |
df227e598aeda7646a6ae24384a1d9e7f9179dc2 | add vcs parsing test | tests/test_vcs_requirements.py | tests/test_vcs_requirements.py | Python | 0 | @@ -0,0 +1,249 @@
+from pundle import parse_vcs_requirement%0A%0A%0Adef test_parse_vcs_requirement():%0A assert parse_vcs_requirement('git+https://github.com/pampam/PKG.git@master#egg=PKG') == %5C%0A ('pkg', 'git+https://github.com/pampam/PKG.git@master#egg=PKG', None)%0A
| |
5d7e4615657d947ec4a7500433f7008de223b622 | Add test | tests/test_dllist.py | tests/test_dllist.py | Python | 0.000005 | @@ -0,0 +1,869 @@
+# Copyright (C) 2016, 2017 Allen Li%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless requir... | |
722b11eab90c6d532ea96209f7632e17181c0b3e | Test if points are in footprint | tests/test_inpoly.py | tests/test_inpoly.py | Python | 0.000004 | @@ -0,0 +1,773 @@
+import unittest%0Aimport pcl%0Aimport numpy as np%0Afrom patty_registration.conversions import loadLas, loadCsvPolygon%0Afrom numpy.testing import assert_array_equal, assert_array_almost_equal%0Afrom matplotlib import path%0A%0Aclass TestInPoly(unittest.TestCase):%0A def testInPoly(self):%0A ... | |
01494bfbc15987a2b925ca7990e8704767c9457b | Create secret.py | tests/secret.py | tests/secret.py | Python | 0 | @@ -0,0 +1,39 @@
+public_key = 'xxx'%0Aprivate_key = 'yyy'%0A
| |
6b132720c1f7596db34a2fdab3f6ca0134aaabc9 | create new model to store uploaded images with id | api/migrations/0001_initial.py | api/migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,501 @@
+# Generated by Django 3.0 on 2020-11-07 13:11%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A initial = True%0A%0A dependencies = %5B%0A %5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A name='UploadedImages',%0A ... | |
ca90d083005e1c29b3b394d556296fd8e734c40a | implement top extrapolation module | PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py | PyAnalysisTools/AnalysisTools/TopExtrapolationModule.py | Python | 0 | @@ -0,0 +1,1837 @@
+from PyAnalysisTools.base import _logger%0Aimport ROOT%0A%0A%0Aclass TopExtrapolationModule(object):%0A def __init__(self, **kwargs):%0A _logger.debug('Initialising TopExtrapolationModule')%0A self.build_functions(**kwargs)%0A self.type = %22DataModifier%22%0A%0A def build... | |
181ca07d3d7bdb3e07b8f9e608ebd8e42235a38c | test module; | mas_vae/models.py | mas_vae/models.py | Python | 0 | @@ -0,0 +1,2526 @@
+from keras import backend as K%0Afrom keras.models import Model, Sequential%0Afrom keras.layers import Input, Dense, concatenate%0Afrom keras.layers import Flatten, Reshape, BatchNormalization%0Afrom keras.layers import Conv2D, MaxPooling2D, Conv2DTranspose%0A%0Afrom mas_tools.ml import save_model_a... | |
0515cdac701b6fbd4bb9281b6412313ad31072cc | Add file to run flask app | app.py | app.py | Python | 0.000001 | @@ -0,0 +1,821 @@
+from flask import Flask, request%0Afrom twilio import twiml%0Aimport subprocess%0A%0Afrom cmd import cmds%0A%0Aapp = Flask(__name__)%0A%0Aimport os%0AACCOUNT_SID = %22%22 #os.environ%5B'ACCOUNT_SID'%5D%0AAUTH_TOKEN = %22%22 #os.environ%5B'AUTH_TOKEN'%5D%0AAPP_SID = %22Twilix%22 #os.environ%5B'APP_SID... | |
a0ee0998457976aa45b3d3a462f2b2aab1bfb15f | add objects module | crossprocess/objects.py | crossprocess/objects.py | Python | 0 | @@ -0,0 +1,185 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%0Aclass SimpleObject(object):%0A def __init__(self, name):%0A self.__name = name%0A%0A def get_name(self):%0A return self.__name%0A
| |
8c276c8c2e45ff0fe634669ea65d0df40c96463c | Add python example using metadata | examples/python/metadata.py | examples/python/metadata.py | Python | 0.000059 | @@ -0,0 +1,877 @@
+from infomap import infomap%0A%0AmyInfomap = infomap.Infomap(%22--two-level --meta-data-rate 0.3%22)%0A%0A# Add weight as an optional third argument%0AmyInfomap.addLink(0, 1)%0AmyInfomap.addLink(0, 2)%0AmyInfomap.addLink(0, 3)%0AmyInfomap.addLink(1, 0)%0AmyInfomap.addLink(1, 2)%0AmyInfomap.addLink(2,... | |
7115d25c57404a42bc29513eb514073747d876ce | Add platform_map to remap Platform.os and arch based on config | src/rez/utils/platform_mapped.py | src/rez/utils/platform_mapped.py | Python | 0 | @@ -0,0 +1,1457 @@
+import re%0A%0A%0Adef platform_mapped(func):%0A %22%22%22%0A Decorates functions for lookups within a config.platform_map dictionary.%0A The first level key is mapped to the func.__name__ of the decorated function.%0A Regular expressions are used on the second level key, values.%0A No... | |
904a37589d8ef0f7b69d9b0f83f41c94fbbfcde6 | Update 1.7 migrations | aldryn_categories/migrations/0003_auto_20150128_1359.py | aldryn_categories/migrations/0003_auto_20150128_1359.py | Python | 0 | @@ -0,0 +1,760 @@
+# -*- 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 ('aldryn_categories', '0002_auto_20150109_1415'),%0A %5D%0A%0A operations = %5B%0A migratio... | |
8a1448ed3bd426d11f6222d63f77604ec132b2da | Add an example for pre signed URL | examples/signed_url_auth.py | examples/signed_url_auth.py | Python | 0.000011 | @@ -0,0 +1,1785 @@
+# Copyright 2016 Catalyst IT Ltd%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 License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# ... | |
59f37975bb06edd38bbcdea6f0ea031f079ba2c3 | Add an utility function to load YAML | lib/hawaiibuildbot/common/utils.py | lib/hawaiibuildbot/common/utils.py | Python | 0.000003 | @@ -0,0 +1,974 @@
+#%0A# This file is part of Hawaii.%0A#%0A# Copyright (C) 2015 Pier Luigi Fiorini %3Cpierluigi.fiorini@gmail.com%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, ei... | |
8e58bf21cf39892df07d42d650619e2292b8efb5 | Create new package (#7796) | var/spack/repos/builtin/packages/perl-statistics-pca/package.py | var/spack/repos/builtin/packages/perl-statistics-pca/package.py | Python | 0.000002 | @@ -0,0 +1,1843 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
f6fc6960bf44c63fd854455efd3d5eff135d5877 | Fix failing build due to missing file | SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py | SegmentEditorSplitVolume/SegmentEditorSplitVolumeLib/__init__.py | Python | 0 | @@ -0,0 +1,182 @@
+from SegmentEditorEffects.AbstractScriptedSegmentEditorEffect import *%0Afrom SegmentEditorEffects.AbstractScriptedSegmentEditorLabelEffect import *%0A%0Afrom SegmentEditorEffect import *%0A
| |
c81ecdf74f3e668559ed4c257e3cdfb1d95f376c | Add files via upload | myFirstPythonProgram.py | myFirstPythonProgram.py | Python | 0 | @@ -0,0 +1,341 @@
+# Bryan Barrows%0A# CSC 110 - 9830%0A# January 13th, 2017%0A# File: myFirstPythonProgram.py%0A# A simple program illustrating chaotic behavior.%0A%0Adef main():%0A print(%22This program illustrates a chaotic function%22)%0A x = eval(input(%22Enter a number between 0 and 1: %22))%0A for i in ... | |
f3eb56111c115e65db6e55fcd1c69d695178b33b | Integrate LLVM at llvm/llvm-project@6144fc2da1b8 | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "eb03fa1d2c05bad5a5f75a89d47b4b31d84bb90b"
LLVM_SHA256 = "53260f7983218c72b07f905694505188695e94e4e68fb9f2959f89073724feac"
tf_http_archive(
... | Python | 0.000004 | @@ -160,133 +160,133 @@
= %22
-eb03fa1d2c05bad5a5f75a89d47b4b31d84bb90b%22%0A LLVM_SHA256 = %2253260f7983218c72b07f905694505188695e94e4e68fb9f2959f89073724feac
+6144fc2da1b87dc64ff887d73b60f7708f5cb0a4%22%0A LLVM_SHA256 = %22e6fe7c8df75bc1d3fb5f29758431e056406542768dd48333d32675dd4e06f1aa
%22%0A%0A
|
62b2c69482d36a7afcdb732dd70a037d2513ba51 | Add script to execute a simple command in a remote server over SSH | bh_sshcmd.py | bh_sshcmd.py | Python | 0.000001 | @@ -0,0 +1,657 @@
+import paramiko # pip install paramiko%0Aimport os%0A%0A%0Adef ssh_command(ip, user, command):%0A # you can run this script as%0A # SSH_PRIV_KEY=%5Byour private key path%5D python bh_sshcmd.py%0A key = paramiko.RSAKey.from_private_key_file(os.getenv('SSH_PRIV_KEY'))%0A%0A client = parami... | |
7ea3075b488b9cb89594128f41c22f0a14b7566c | Fix Exception names | tvrenamr/cli/core.py | tvrenamr/cli/core.py | #!/usr/bin/env python
from __future__ import absolute_import
import functools
import logging
import sys
import click
from tvrenamr import errors
from tvrenamr.cli.helpers import (build_file_list, get_config, start_dry_run,
stop_dry_run)
from tvrenamr.logs import start_logging
from ... | Python | 0.000045 | @@ -5860,27 +5860,15 @@
ors.
-No
Network
-Connection
Exce
@@ -6136,37 +6136,14 @@
rect
-CustomRegularExpressionSyntax
+RegExp
Exce
|
cb7b286d1aa9fc10669b1b59afe334995a4c1174 | add missed migration | taiga/projects/userstories/migrations/0021_auto_20201202_0850.py | taiga/projects/userstories/migrations/0021_auto_20201202_0850.py | Python | 0.000003 | @@ -0,0 +1,953 @@
+# Generated by Django 2.2.14 on 2020-12-02 08:50%0A%0Afrom django.db import migrations, models%0Aimport taiga.base.utils.time%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('userstories', '0020_userstory_swimlane'),%0A %5D%0A%0A operations = %5B%0A ... | |
74d094e1071f4fadffbb5f2351c4e171e528b68e | Update split-array-into-consecutive-subsequences.py | Python/split-array-into-consecutive-subsequences.py | Python/split-array-into-consecutive-subsequences.py | # Time: O(n)
# Space: O(1)
# You are given an integer array sorted in ascending order (may contain duplicates),
# you need to split them into several subsequences,
# where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split.
#
# Example 1:
# Input: [1,2,3,3,4,5]
# Ou... | Python | 0.000154 | @@ -1217,17 +1217,16 @@
, cnt3 =
-
cnt, 0,
|
615cb67e0082b6a2d2ab1c91623e9b2a20ddedec | create milestone migration for Havana release | neutron/db/migration/alembic_migrations/versions/havana_release.py | neutron/db/migration/alembic_migrations/versions/havana_release.py | Python | 0 | @@ -0,0 +1,1183 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Copyright 2013 OpenStack Foundation%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 License at%0A#%0A# ... | |
e5247e1123ecd2e5ea1d98668ceded22d99c1c42 | Create twitter-auth.py | twitter-auth.py | twitter-auth.py | Python | 0.000012 | @@ -0,0 +1,117 @@
+# paste your apps.twitter.com keys in here%0Aaccess_key = %22%22%0Aaccess_secret = %22%22%0Aconsumer_key = %22%22%0Aconsumer_secret = %22%22%0A
| |
f63747a7e19b82a59d7ff1435725c3f35a4ba61b | Add contex processor to use cart in any template | apps/cart/context_processors.py | apps/cart/context_processors.py | Python | 0 | @@ -0,0 +1,79 @@
+from .cart import Cart%0A%0A%0Adef cart(request):%0A return %7B'cart': Cart(request)%7D%0A
| |
9f0b46080ff3d8861e5b11527b6490d6e3d918fb | test making sure form edits are atomic | corehq/ex-submodules/couchforms/tests/test_edits.py | corehq/ex-submodules/couchforms/tests/test_edits.py | import os
from django.test import TestCase
from couchforms.models import XFormDeprecated
from couchforms.tests.testutils import post_xform_to_couch
class EditFormTest(TestCase):
ID = '7H46J37FGH3'
def tearDown(self):
try:
XFormInstance.get_db().delete_doc(self.ID)
except:
... | Python | 0.000432 | @@ -12,35 +12,177 @@
rom
-django.test import TestCase
+couchdbkit import ResourceNotFound, RequestFailed%0Afrom django.test import TestCase%0Afrom mock import MagicMock%0Afrom corehq.apps.receiverwrapper import submit_form_locally
%0Afro
@@ -223,16 +223,31 @@
precated
+, XFormInstance
%0Afrom co
@@ -460,16 +460,33... |
7c6077e107f40a3fcc3e1414f26071ceab0e0cf6 | Create missing migration in taiga.projects.notifications | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | Python | 0.000001 | @@ -0,0 +1,528 @@
+# -*- 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 ('notifications', '0005_auto_20151005_1357'),%0A %5D%0A%0A operations = %5B%0A migrations.A... | |
d9d27733d1885de0723f91558973c038be0386ec | Fix arm/disarm calls. (#17381) | homeassistant/components/alarm_control_panel/spc.py | homeassistant/components/alarm_control_panel/spc.py | """
Support for Vanderbilt (formerly Siemens) SPC alarm systems.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.spc/
"""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.helpers.dispatche... | Python | 0.000001 | @@ -2692,32 +2692,38 @@
reaMode%0A
+await
self._api.change
@@ -2736,32 +2736,68 @@
area=self._area,
+%0A
new_mode=AreaMo
@@ -2943,32 +2943,38 @@
reaMode%0A
+await
self._api.change
@@ -2987,32 +2987,68 @@
area=self._area,
+%0A ... |
f10209add7513cba71441b410bf3a52a1d1c816c | add new site PyDéfis | tehbot/plugins/challenge/py.py | tehbot/plugins/challenge/py.py | Python | 0 | @@ -0,0 +1,886 @@
+# -*- coding: utf-8 -*-%0Afrom tehbot.plugins.challenge import *%0Aimport urllib%0Aimport urllib2%0Aimport urlparse%0Aimport lxml.html%0Aimport re%0A%0Aclass Site(BaseSite):%0A def prefix(self):%0A return u%22%5BPyD%C3%A9fis%5D%22%0A%0A def siteurl(self):%0A return %22https://pyde... | |
90a22bf70efbc6b14c697305919f6fca3aae39a1 | Create __init__.py | __init__.py | __init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
ad053bd49c0a108ed06df5385a6571b405476bd8 | Create web_browser.py | web_browser.py | web_browser.py | Python | 0.000417 | @@ -0,0 +1,180 @@
+from webbrowser import *%0A%0Aurl=%22https://www.google.co.in%22%0A%0Aopen(url)%0A%0A'''%0AThis script lets you open the given link from terminal directly.%0AIt is made meanwhile learning python.%0A'''%0A
| |
a2c702e226074763f78cc49eea30a020853bc6a7 | Use `raise SystemError` instead of calling sys.exit(). | libexec/windows_shares_discovery_runner.py | libexec/windows_shares_discovery_runner.py | #!/usr/bin/env python
#
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | Python | 0 | @@ -865,19 +865,8 @@
rse%0A
-import sys%0A
impo
@@ -2214,29 +2214,37 @@
md, exp%0A
-sys.e
+raise SystemE
xit(2)%0A%0Ap_de
@@ -2462,13 +2462,21 @@
-sys.e
+raise SystemE
xit(
|
3b29a94a7009c0b652e8eca0b175bb97250e1b33 | Add an extract_features(image, measurements) function returning a feature vector | feature_extraction/extraction.py | feature_extraction/extraction.py | Python | 0.000018 | @@ -0,0 +1,365 @@
+import numpy as np%0A%0A%22%22%22%0AGiven an image as a Numpy array and a set of measurement objects%0Aimplementing a compute method returning a feature vector, return a combined%0Afeature vector.%0A%22%22%22%0Adef extract_features(image, measurements):%0A%09# TODO(liam): parallelize multiple measure... | |
1ee6e4f99318a065ee6cceaf2ed470bb3513188e | Add py-hstspreload (#19188) | var/spack/repos/builtin/packages/py-hstspreload/package.py | var/spack/repos/builtin/packages/py-hstspreload/package.py | Python | 0 | @@ -0,0 +1,673 @@
+# 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 PyHstspreload(PythonPackage):%0A %22%22%22Chromium HSTS ... | |
6533ac770ffd97ece23dcaba154a31297be76b04 | add Steam Store helper | reviews/utils.py | reviews/utils.py | Python | 0 | @@ -0,0 +1,1198 @@
+import requests%0Afrom django.core.cache import cache%0A%0A%0Aclass SteamException(Exception):%0A pass%0A%0A%0Aclass SteamStore(object):%0A l = None%0A cc = None%0A%0A def __init__(self, language='en', country='jp'):%0A self.l = language%0A self.cc = country%0A%0A def ap... | |
d11491d30a2fb418dd40bf7e97d4d35cc84d6f3f | Move Chuck database query function to another file | pyjokes/chuck.py | pyjokes/chuck.py | Python | 0 | @@ -0,0 +1,406 @@
+# -*- coding: utf-8 -*-%0A%0Aimport json%0A%0Atry:%0A from urllib2 import urlopen%0Aexcept:%0A from urllib.request import urlopen%0A%0A%0Adef get_chuck_nerd_jokes():%0A url = 'http://api.icndb.com/jokes/random?limitTo=%5Bnerdy%5D'%0A response = urlopen(url).readall().decode('utf-8')%0A ... | |
46db4860911e687bf5d3beef5f0b2f96ea145cd2 | FIX lasso_dense_vs_sparse_data.py example needed update. | examples/linear_model/lasso_dense_vs_sparse_data.py | examples/linear_model/lasso_dense_vs_sparse_data.py | """
==============================
Lasso on dense and sparse data
==============================
We show that linear_model.Lasso and linear_model.sparse.Lasso
provide the same results and that in the case of
sparse data linear_model.sparse.Lasso improves the speed.
"""
print __doc__
from time import time
import nump... | Python | 0 | @@ -831,32 +831,47 @@
_intercept=False
+, max_iter=1000
)%0Adense_lasso =
@@ -905,32 +905,47 @@
_intercept=False
+, max_iter=1000
)%0A%0At0 = time()%0As
@@ -960,39 +960,24 @@
sso.fit(X, y
-, max_iter=1000
)%0Aprint %22Spa
@@ -1048,31 +1048,16 @@
fit(X, y
-, max_iter=1000
)%0Aprint
@@ -1622,16 +1622,31 @@
pt=... |
35e30faabc3fd7ca68b7b28c9fd5b7a4c15b0e21 | add charset compilation script | util/charset.py | util/charset.py | Python | 0 | @@ -0,0 +1,1959 @@
+# charset.py - lazy utility script for compiling character svgs, animation data and details into a single .json%0A#%0A# Usage:%0A# python charset.py %5Bcharset directory%5D%0A#%0A# The charset directory should have the following:%0A# - 'base.json' which contains the data and animation timings fo... | |
0d9613a1410aad150ccaf4b828971ec6f9e31520 | Create lang.py | lang.py | lang.py | Python | 0.000024 | @@ -0,0 +1 @@
+%0A
| |
2f268173e25bee5d671583bb905829e0ffd4f631 | Add management command to clear all matches mostly useful with heroku | match/management/commands/reset-matches.py | match/management/commands/reset-matches.py | Python | 0 | @@ -0,0 +1,250 @@
+from django.core.management.base import BaseCommand, CommandError%0Afrom match.models import Match%0A%0Aimport sys%0A%0Aclass Command(BaseCommand):%0A help = 'Reset all match data'%0A%0A def handle(self, *args, **options):%0A Match.objects.all().delete()%0A
| |
732eee568f19ed2e63f357b62fa539ff50a1c046 | add program to display light readings in terminal in inf loop | light.py | light.py | Python | 0 | @@ -0,0 +1,1107 @@
+#!/usr/bin/python%0A%22%22%22%0Alight.py%0A%0ARead analog values from the photoresistor%0A%0A=======%0Arun with:%0A sudo ./light.py%0A%0ACopyright 2014 David P. Bradway (dpb6@duke.edu)%0A%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in c... | |
591bdcbfb80927d0ffb4922eb684fe7ce17c5456 | Add manage.py | web/zoohackathon2016/manage.py | web/zoohackathon2016/manage.py | Python | 0.000001 | @@ -0,0 +1,814 @@
+#!/usr/bin/env python%0Aimport os%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22zoohackathon2016.settings%22)%0A try:%0A from django.core.management import execute_from_command_line%0A except ImportError:%0A # The abo... | |
cb26da63add95ebf9e7aa84a381293dd80f433cb | add test_db, test is OK | www/test_db.py | www/test_db.py | Python | 0.998585 | @@ -0,0 +1,537 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A__author__ = 'Haibo-Yu'%0A%0Afrom models import User, Blog, Comment%0A%0Afrom transwarp import db%0A%0Adb.create_engine(user='www-data', password='www-data', database='awesome')%0A%0Au = User(name='Test', email='test@example.com', password='1234567... | |
ad5b3a334203394792c90b0d1bfe2dda8efe13b3 | add admin interface for tracking logs | common/djangoapps/track/admin.py | common/djangoapps/track/admin.py | Python | 0 | @@ -0,0 +1,143 @@
+'''%0Adjango admin pages for courseware model%0A'''%0A%0Afrom track.models import *%0Afrom django.contrib import admin%0A%0Aadmin.site.register(TrackingLog)%0A
| |
0196d9498644223959b4efae4fc084552bec8393 | Add check_tar test. | check_tar.py | check_tar.py | Python | 0 | @@ -0,0 +1,3139 @@
+#!/usr/bin/env python3%0Afrom argparse import ArgumentParser%0Aimport logging%0Aimport os%0Aimport tarfile%0Afrom textwrap import dedent%0Aimport re%0Aimport sys%0A%0A%0Aclass TarfileNotFound(Exception):%0A %22%22%22Raised when specified tarfile cannot be found.%22%22%22%0A%0A%0Aclass TestedDirNo... | |
a0123aad7414ce78be6b0c984f0895bba9568c99 | Solve 50. | 050/solution.py | 050/solution.py | Python | 0.999992 | @@ -0,0 +1,1259 @@
+# coding: utf-8%0A%0A%22%22%22 Project Euler problem #50. %22%22%22%0A%0Aimport itertools as it%0A%0A%0Adef problem():%0A u%22%22%22 Solve the problem.%0A%0A The prime 41, can be written as the sum of six consecutive primes:%0A%0A 41 = 2 + 3 + 5 + 7 + 11 + 13%0A%0A This is the longest su... | |
4e7310e8d7485e132c62c85599e2694d228e0747 | Add an example | examples/chat.py | examples/chat.py | Python | 0 | @@ -0,0 +1,825 @@
+from zeroservices import BaseService%0Afrom zeroservices import ZeroMQMedium%0A%0Afrom time import time%0A%0A%0Aclass ChatService(BaseService):%0A%0A def __init__(self, username):%0A self.username = username%0A super(ChatService, self).__init__(ZeroMQMedium(self, port_random=True))%0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.