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 |
|---|---|---|---|---|---|---|---|
2cd1e7fcdf53c312c3db8e6f1d257084a87cccbb | Add migration to update action implementation hashes. | recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py | recipe-server/normandy/recipes/migrations/0045_update_action_hashes.py | Python | 0 | @@ -0,0 +1,1050 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Aimport hashlib%0Afrom base64 import b64encode, urlsafe_b64encode%0A%0Afrom django.db import migrations%0A%0A%0Adef make_hashes_urlsafe_sri(apps, schema_editor):%0A Action = apps.get_model('recipes', 'Action')%0A%0A for acti... | |
fa349a967f9f1149dc9aae1bab168f7be7436320 | Use HTTP/1.1 for memory cache http server. | tools/telemetry/telemetry/core/memory_cache_http_server.py | tools/telemetry/telemetry/core/memory_cache_http_server.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import BaseHTTPServer
import mimetypes
import os
import SimpleHTTPServer
import SocketServer
import sys
import zlib
class MemoryCacheHTTPRequestHandler(... | Python | 0.000076 | @@ -3115,17 +3115,17 @@
'HTTP/1.
-0
+1
'%0A http
|
1253cf2773b510f88b4391e22f0e98b4ef3cdf52 | Create serializers.py | templates/root/main/serializers.py | templates/root/main/serializers.py | Python | 0.000002 | @@ -0,0 +1,595 @@
+from django.contrib.auth.models import User%0Afrom rest_framework import serializers%0Afrom %3C%25= appName %25%3E.models import Sample%0A%0Aclass SampleSerializer(serializers.HyperlinkedModelSerializer):%0A%09owner = serializers.ReadOnlyField(source='owner.username')%0A%09%0A%09class Meta:%0A%09%09m... | |
c6015e049ab1ce059298af9147851f9a6a1c1e46 | Replace NotImplemented singleton with NotImplementedError exceptin | src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py | src/ggrc_workflows/services/workflow_cycle_calculator/one_time_cycle_calculator.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: urban@reciprocitylabs.com
# Maintained By: urban@reciprocitylabs.com
import datetime
from ggrc_workflows.services.workflow_cycle_calculator import ... | Python | 0.999768 | @@ -943,32 +943,37 @@
e NotImplemented
+Error
(%22Relative days
@@ -985,32 +985,37 @@
ot applicable %22%0A
+
@@ -1211,32 +1211,37 @@
e NotImplemented
+Error
(%22Relative days
@@ -1253,32 +1253,37 @@
ot applicable %22%0A
+
@@ -1389,16 +1389,21 @@
lemented
+Error
(%... |
c775da3c1f73798ecaa1e1c46402bb03d21468cb | Update forward compatibility horizon to 2022-10-10 | tensorflow/python/compat/compat.py | tensorflow/python/compat/compat.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | Python | 0 | @@ -1335,17 +1335,18 @@
22, 10,
-9
+10
)%0A_FORWA
|
5dc2f523473f4921c3b7f1915966c0ac22b09474 | Create package and metadatas | mots_vides/__init__.py | mots_vides/__init__.py | Python | 0 | @@ -0,0 +1,166 @@
+%22%22%22%0AMots-vides%0A%22%22%22%0A__version__ = '2015.1.21.dev0'%0A%0A__author__ = 'Fantomas42'%0A__email__ = 'fantomas42@gmail.com'%0A%0A__url__ = 'https://github.com/Fantomas42/mots-vides'%0A
| |
02e9602a5723aa3cbe9395290e4c18e439065007 | Remove redundant code | numpy/distutils/tests/test_fcompiler.py | numpy/distutils/tests/test_fcompiler.py | from __future__ import division, absolute_import, print_function
from numpy.testing import assert_
import numpy.distutils.fcompiler
customizable_flags = [
('f77', 'F77FLAGS'),
('f90', 'F90FLAGS'),
('free', 'FREEFLAGS'),
('arch', 'FARCH'),
('debug', 'FDEBUG'),
('flags', 'FFLAGS'),
('linker_... | Python | 0.999999 | @@ -927,139 +927,8 @@
'1')
-%0A fc = numpy.distutils.fcompiler.new_fcompiler(compiler='none')%0A flag_vars = fc.flag_vars.clone(lambda *args, **kwargs: None)
%0A%0A
|
b9bb7e36977b757a63015ac3af8b538f0c67f16c | add manage.py | manage.py | manage.py | Python | 0.000001 | @@ -0,0 +1,460 @@
+from argparse import ArgumentParser%0A%0A%0Adef apply_migrates(args):%0A print('migrate')%0A%0A%0Adef make_parser():%0A parser = ArgumentParser()%0A subparsers = parser.add_subparsers()%0A%0A migrate = subparsers.add_parser('migrate')%0A migrate.set_defaults(func=apply_migrates)%0A%0A ... | |
8fa7120606e206d08acbad198e253ea428eef584 | Add tests for inline list compilation | tests/compiler/test_inline_list_compilation.py | tests/compiler/test_inline_list_compilation.py | Python | 0 | @@ -0,0 +1,1107 @@
+import pytest%0A%0Afrom tests.compiler import compile_snippet, internal_call, STATIC_START, LOCAL_START%0Afrom thinglang.compiler.errors import NoMatchingOverload, InvalidReference%0Afrom thinglang.compiler.opcodes import OpcodePopLocal, OpcodePushStatic%0A%0A%0Adef test_inline_list_compilation():%... | |
142cb17be1c024839cd972071b2f9665c87ed5f1 | Update downloadable clang to r338452 | third_party/clang_toolchain/download_clang.bzl | third_party/clang_toolchain/download_clang.bzl | """ Helpers to download a recent clang release."""
def _get_platform_folder(os_name):
os_name = os_name.lower()
if os_name.startswith("windows"):
return "Win"
if os_name.startswith("mac os"):
return "Mac"
if not os_name.startswith("linux"):
fail("Unknown platform")
return "L... | Python | 0 | @@ -1676,12 +1676,12 @@
%2233
-6424
+8452
%22%0A
@@ -1821,237 +1821,237 @@
: %222
-ea97e047470da648f5d078af008bce6891287592382cee3d53a1187d996da94%22,%0A %22Mac%22: %22c6e28909cce63ee35e0d51284d9f0f6e8838f7fb8b7a0dc9536c2ea900552df0%22,%0A %22Win%22: %221299fda7c4378bfb81337f7e5f351c8a1f953f51e0744e... |
3ddf0f0fead6018b5c313253a0df2165452cfb6e | Add shared babel init code | src/eduid_common/api/translation.py | src/eduid_common/api/translation.py | Python | 0 | @@ -0,0 +1,549 @@
+# -*- coding: utf-8 -*-%0A%0Afrom flask import request%0Afrom flask_babel import Babel%0A%0A__author__ = 'lundberg'%0A%0A%0Adef init_babel(app):%0A babel = Babel(app)%0A app.babel = babel%0A%0A @babel.localeselector%0A def get_locale():%0A # if a user is logged in, use the locale f... | |
30bca45e1ac9fc6953728950695135b491403215 | Add test for logical constant folding. | tests/basics/logic_constfolding.py | tests/basics/logic_constfolding.py | Python | 0 | @@ -0,0 +1,442 @@
+# tests logical constant folding in parser%0A%0Adef f_true():%0A print('f_true')%0A return True%0A%0Adef f_false():%0A print('f_false')%0A return False%0A%0Aprint(0 or False)%0Aprint(1 or foo)%0Aprint(f_false() or 1 or foo)%0Aprint(f_false() or 1 or f_true())%0A%0Aprint(0 and foo)%0Aprint... | |
5b3863c90d4bc07bbc170fc213b4a4c46b3ddc01 | Test setting selinux context on lost+found (#1038146) | tests/formats_test/selinux_test.py | tests/formats_test/selinux_test.py | Python | 0 | @@ -0,0 +1,2024 @@
+#!/usr/bin/python%0Aimport os%0Aimport selinux%0Aimport tempfile%0Aimport unittest%0A%0Afrom devicelibs_test import baseclass%0Afrom blivet.formats import device_formats%0Aimport blivet.formats.fs as fs%0A%0Aclass SELinuxContextTestCase(baseclass.DevicelibsTestCase):%0A %22%22%22Testing SELinux c... | |
68d620d56625c4c1bd30a30f31840d9bd440b29e | Add find_objects test module | tests/plantcv/test_find_objects.py | tests/plantcv/test_find_objects.py | Python | 0.000002 | @@ -0,0 +1,806 @@
+import cv2%0Aimport numpy as np%0Afrom plantcv.plantcv import find_objects%0A%0A%0Adef test_find_objects(test_data):%0A # Read in test data%0A img = cv2.imread(test_data.small_rgb_img)%0A mask = cv2.imread(test_data.small_bin_img, -1)%0A cnt, _ = test_data.load_contours(test_data.small_co... | |
36033be962fcc3e97d14dd06b42bcd3be52a97c5 | Add floting_point.py | parser/sample/floting_point.py | parser/sample/floting_point.py | Python | 0.000001 | @@ -0,0 +1,1872 @@
+import logging%0A%0Afrom lex_tokens import LexToken%0Afrom ply.yacc import yacc%0A%0A%0Aclass FloatingPointParser(object):%0A class FloatingPointSyntaxError(Exception): pass%0A%0A def __init__(self, debug=False):%0A if debug:%0A self._log = logging.getLogger('PhysicalDivideCh... | |
be17cf90b06a118d579c0211dd3bc2d45433fb2d | Write unit tests for _handle_long_response | tests/test_handle_long_response.py | tests/test_handle_long_response.py | Python | 0.000064 | @@ -0,0 +1,1679 @@
+import context%0A%0Aclass TestHandleLongResponse(context.slouch.testing.CommandTestCase):%0A bot_class = context.TimerBot%0A config = %7B'start_fmt': '%7B:%25Y%7D', 'stop_fmt': '%7B.days%7D'%7D%0A normal_text = %22@genericmention: this is generic mention message contains a URL %3Chttp://foo... | |
feafe480d651ee6b58a1631f4eb4533f63ea6ad4 | Add user tests | tests/api/test_user.py | tests/api/test_user.py | Python | 0.000001 | @@ -0,0 +1,1981 @@
+from unittest import mock%0A%0Afrom groupy.api import user%0Afrom .base import get_fake_response%0Afrom .base import TestCase%0A%0A%0Aclass UserTests(TestCase):%0A def setUp(self):%0A self.m_session = mock.Mock()%0A self.m_session.get.return_value = get_fake_response(data=%7B'id': '... | |
063899021158fe872745b335595b3094db9834d8 | Add a test for 'version. | pycket/test/test_version.py | pycket/test/test_version.py | Python | 0.000055 | @@ -0,0 +1,251 @@
+#! /usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# Test the version here.%0A#%0A%0Aimport pytest%0Afrom pycket.test.testhelper import check_equal%0A%0AEXPECTED_VERSION='6.1.1.8'%0A%0A%0Adef test_version():%0A check_equal('(version)', '%22%25s%22' %25 EXPECTED_VERSION)%0A%0A# EOF%0A
| |
e940963a6372a4de1a4a28eff1854716f47471e5 | Add deploy script | conda-recipe/deploy.py | conda-recipe/deploy.py | Python | 0.000001 | @@ -0,0 +1,2429 @@
+#!/usr/bin/env python%0A%0A%0A%22%22%22%0ADeploy dbcollection to pypi and conda.%0A%22%22%22%0A%0A%0Aimport os%0Aimport shutil%0Aimport subprocess%0A%0A%0A# PyPi%0Aprint('PyPi: Upload sdist...')%0Amsg1 = subprocess.run(%5B%22python%22, 'setup.py', 'sdist', 'upload'%5D, stdout=subprocess.PIPE)%0Aprin... | |
b52ba28a8315a0cdeda7593d087607f582f77f18 | Create __init__.py | model/__init__.py | model/__init__.py | Python | 0.000429 | @@ -0,0 +1,20 @@
+__version__='0.0.0'%0A
| |
721720b1f4d63f1368714f764794c8d406e4982d | Add to_data test | tests/test_firebase.py | tests/test_firebase.py | Python | 0.000004 | @@ -0,0 +1,168 @@
+import pytest%0Aimport linkatos.firebase as fb%0A%0A%0Adef test_to_data():%0A url = 'https://foo.com'%0A data = %7B'url': 'https://foo.com'%7D%0A assert fb.to_data(url) == data%0A
| |
35e6e986ee41c0d951d6c56451abb49086ace30e | Enable text search on secondaries. PYTHON-530 | pymongo/read_preferences.py | pymongo/read_preferences.py | # Copyright 2012 10gen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License",
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | Python | 0.000003 | @@ -6072,16 +6072,28 @@
icate%22,%0A
+ %22text%22,%0A
%5D)%0A%0A%0Acla
|
4b2df28a979312875d5a72a1713f535b0e34a1e6 | fix config mocking. | solr/test_solr.py | solr/test_solr.py | # (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import threading
import time
from types import ListType
import unittest
# 3p
from nose.plugins.attrib import attr
# project
from aggregator import MetricsAggregator
from dogstatsd import Server
from jmx... | Python | 0 | @@ -180,16 +180,28 @@
unittest
+%0Aimport mock
%0A%0A# 3p%0Af
@@ -235,16 +235,31 @@
ort attr
+%0Aimport logging
%0A%0A# proj
@@ -312,101 +312,694 @@
rom
-dogstatsd import Server%0Afrom jmxfetch import JMXFetch%0Afrom shared.test.common import Fixtures
+tests.checks.common import Fixtures%0A%0A%0ALOG_INFO = %7B%0A... |
fe37335645993ad10c9902aaaaf0ca2c53912d49 | Create Average Movies rating etl | movies_avg_etl.py | movies_avg_etl.py | Python | 0 | @@ -0,0 +1,1882 @@
+import pyspark%0A%0Aspark = (%0A pyspark.sql.SparkSession.builder.appName(%22FromDatabase%22)%0A .config(%22spark.driver.extraClassPath%22, %22%3Cdriver_location%3E/postgresql-42.2.18.jar%22)%0A .getOrCreate()%0A)%0A%0A%0A# Read table from db using Spark JDBC%0Adef extract_movies_to_df():%0... | |
e072d06ce649765b9c7f8be13af09cea0ef60a0b | Improve autonested_transaction | neutron/db/api.py | neutron/db/api.py | # Copyright 2011 VMware, Inc.
# All Rights Reserved.
#
# 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 ... | Python | 0.000006 | @@ -854,35 +854,8 @@
tils
-%0Afrom sqlalchemy import exc
%0A%0Afr
@@ -2375,27 +2375,41 @@
ter.%22%22%22%0A
-try
+if sess.is_active
:%0A se
@@ -2438,52 +2438,30 @@
egin
-_
+(
nested
-(
+=True
)%0A e
-xcept exc.InvalidRequestError
+lse
:%0A
@@ -2521,25 +2521,8 @@
ue)%0A
- finally:%0A
... |
c95bfb10f87bd0a637d0ad790d484b7957441371 | Add WSGI support. | pypi.wsgi | pypi.wsgi | Python | 0 | @@ -0,0 +1,1559 @@
+#!/usr/bin/python%0Aimport sys,os%0Aprefix = os.path.dirname(__file__)%0Asys.path.insert(0, prefix)%0Aimport cStringIO, webui, store, config%0A%0Astore.keep_conn = True%0A%0Aclass Request:%0A%0A def __init__(self, environ, start_response):%0A self.start_response = start_response%0A ... | |
39313cd933e0038b9a9bfa8b6b4cb50e3707d455 | add k_min.py | Algo-1/week2/7-K-Min/k_min.py | Algo-1/week2/7-K-Min/k_min.py | Python | 0.000104 | @@ -0,0 +1,1328 @@
+class KMin:%0A%0A # Quick sort%0A%0A @staticmethod%0A def swap(numbers, i, j):%0A temp = numbers%5Bi%5D%0A numbers%5Bi%5D = numbers%5Bj%5D%0A numbers%5Bj%5D = temp%0A%0A # The last element is a pivot, all smaller elements are to left of it%0A # and greater element... | |
f44fd9df7ac7fa5e553e99d98c1376439a33ffc8 | Change device pull to handle root,and renamed local file as well history.db from results.db | wlauto/workloads/androbench/__init__.py | wlauto/workloads/androbench/__init__.py | # Copyright 2013-2015 ARM Limited
#
# 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 w... | Python | 0 | @@ -1168,23 +1168,23 @@
ctory, '
-results
+history
.db')%0A
@@ -1219,32 +1219,46 @@
db, host_results
+, as_root=True
)%0A qs = '
|
f700ca39535c5eb14015dd84f4bc0dad2b086d23 | Add ex_fzf.py | examples/ex_fzf.py | examples/ex_fzf.py | Python | 0.000005 | @@ -0,0 +1,885 @@
+#!/usr/bin/env python%0Aimport string%0Aimport textwrap%0Aimport pprint%0A%0Afrom dynmen import Menu%0A%0A%0Afzf = Menu(command=('fzf',))%0A%0Aexampl_inp_dict = vars(string)%0Aexampl_inp_dict = %7Bk:v for k,v in exampl_inp_dict.items() if not k.startswith('_')%7D%0A%0Adef print_obj(obj, prefix=' '... | |
45edceb65a9cac9f61215ad77e9c048d092c0b57 | add examples/roster.py | examples/roster.py | examples/roster.py | Python | 0 | @@ -0,0 +1,3276 @@
+%0Aimport dbus%0Aimport dbus.glib%0Aimport gobject%0Aimport sys%0A%0Afrom account import read_account, connect%0A%0Afrom telepathy.client.channel import Channel%0Afrom telepathy.constants import (%0A CONNECTION_HANDLE_TYPE_CONTACT, CONNECTION_HANDLE_TYPE_LIST,%0A CONNECTION_STATUS_CONNECTED, C... | |
7d198f3eaca6a91b731b3e25c0285cd46e72935a | Remove duplicates in authorized origins table | swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py | swh/web/common/migrations/0005_remove_duplicated_authorized_origins.py | Python | 0.000001 | @@ -0,0 +1,880 @@
+# Copyright (C) 2019 The Software Heritage developers%0A# See the AUTHORS file at the top-level directory of this distribution%0A# License: GNU Affero General Public License version 3, or any later version%0A# See top-level LICENSE file for more information%0A%0Afrom __future__ import unicode_litera... | |
91541cf82f435cb261d9debc85a2a8ae6dd74ab1 | Add a function to initialize the logging. | xutils/init_logging.py | xutils/init_logging.py | Python | 0 | @@ -0,0 +1,1286 @@
+# encoding: utf-8%0Afrom __future__ import print_function, absolute_import, unicode_literals, division%0Aimport logging%0A%0A%0Adef init_logging(logger=None, level=%22DEBUG%22, log_file=%22%22, file_config=None, dict_config=None):%0A # Initialize the argument logger with the arguments, level and ... | |
507e3bad4e877330eea29675dafb8210ab6bada5 | Add tests for file agent | tests/test_agent.py | tests/test_agent.py | Python | 0 | @@ -0,0 +1,1464 @@
+%22%22%22%0ATests for a agent.%0A%22%22%22%0A%0Aimport io%0Aimport os%0A%0Aimport pytest%0A%0Afrom onirim import action%0Afrom onirim import agent%0Afrom onirim import component%0A%0Adef file_agent(in_str):%0A return agent.File(io.StringIO(in_str), open(os.devnull, %22w%22))%0A%0Adef content():%0... | |
c67e1af4f765f143cb1b8420e053c1a9f00edd05 | Add migrations for new statuses. | course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py | course_discovery/apps/course_metadata/migrations/0168_auto_20190404_1733.py | Python | 0 | @@ -0,0 +1,1732 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2019-04-04 17:33%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.manager%0Aimport djchoices.choices%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%... | |
d308874989667f36da1638f22d6b2d7e823b5ebd | Add script to extract reads or alignments matching a barcode. | extract-barcode.py | extract-barcode.py | Python | 0 | @@ -0,0 +1,1714 @@
+%22%22%22%0Acode to extract a single cell from a set of alignments or reads marked via Valentine's umis %0Arepository:%0Ahttps://github.com/vals/umis%0A%22%22%22%0Aimport regex as re%0Aimport sys%0Afrom argparse import ArgumentParser%0Afrom pysam import AlignmentFile%0A%0Adef extract_barcode(sam, ba... | |
048d0d7ce30b66af8bf48bcb0cb7f8bfb90fff0c | Add tests for Part, Pin, Bus and Net iterators. | tests/test_iters.py | tests/test_iters.py | Python | 0 | @@ -0,0 +1,877 @@
+import pytest%0Afrom skidl import *%0Afrom .setup_teardown import *%0A%0Adef test_iters_1():%0A %22%22%22Test bus iterator.%22%22%22%0A b_size = 4%0A b = Bus('chplx', b_size)%0A for hi in b:%0A for lo in b:%0A if hi != lo:%0A led = Part('device','LED')%0A ... | |
60fbfa0b440a762fd25f19148313f5ba27d619aa | add a testing file | DataStructures/Trees/main.py | DataStructures/Trees/main.py | Python | 0.000001 | @@ -0,0 +1,82 @@
+import BST%0A%0A#Environent for testing BST%0A%0Adef main():%0A%0A print 'Testing'%0A%0Amain()%0A
| |
00aad4a302518400dbb936c7e2ce1d7560c5762f | Add files via upload | src/que_.py | src/que_.py | Python | 0 | @@ -0,0 +1,1697 @@
+class our_queue(object):%0A def __init__(self):%0A %22%22%22initializes queue%22%22%22%0A self.head = self%0A self.tail = self%0A self.next_node = None%0A self.data = None%0A self.size = 0%0A%0A def enqueue(self, val):%0A %22%22%22creates new no... | |
ccc663b3a96268dcdf2256d461a11d845a1044a1 | Add the original test case of bug #1469629, formatted according to local conventions. | Lib/test/leakers/test_dictself.py | Lib/test/leakers/test_dictself.py | Python | 0 | @@ -0,0 +1,232 @@
+'''Test case for %22self.__dict__ = self%22 circular reference bug (#1469629)'''%0A%0Aimport gc%0A%0Aclass LeakyDict(dict):%0A pass%0A%0Adef leak():%0A ld = LeakyDict()%0A ld.__dict__ = ld%0A del ld%0A gc.collect(); gc.collect(); gc.collect()%0A
| |
ceaabf80649a8a83c6ddfc548a3fa369c973e5c6 | Complete alg fizzbuzz | alg_fizzbuzz.py | alg_fizzbuzz.py | Python | 0.99999 | @@ -0,0 +1,429 @@
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0A%0Adef fizzbuzz(n):%0A%09ls = %5B%5D%0A%09for i in range(1, n + 1):%0A%09%09if i %25 15 == 0:%0A%09%09%09ls.append('fizzbuzz')%0A%09%09elif i %25 3 == 0:%0A%09%09%09ls.append('fizz')%... | |
e670901ebaf7422f7a71f78a3dc94730eba5605b | Add a module full of hinting helpers. | fmn/lib/hinting.py | fmn/lib/hinting.py | Python | 0 | @@ -0,0 +1,2162 @@
+%22%22%22 Helpers for %22datanommer hints%22 for rules.%0A%0ARules can optionally define a %22hint%22 for a datanommer query. For%0Ainstance, if a rule has to do with filtering for bodhi messages, then a%0Aprovided hint could be %7B'category': 'bodhi'%7D. This simply speeds up the%0Aprocess of loo... | |
1d31feb4fadadc377fbb3cf0f18c38f5a8d39aca | disable tray icon when fail | launcher/1.2.0/start.py | launcher/1.2.0/start.py | #!/usr/bin/env python
# coding:utf-8
import os, sys
current_path = os.path.dirname(os.path.abspath(__file__))
python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0'))
noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch'))
sys.path.append(noarch_lib)
if sy... | Python | 0.000001 | @@ -915,16 +915,79 @@
-from mac
+try:%0A from mac_tray import sys_tray%0A except:%0A from non
_tra
|
719dd9064904d2e94cacd5c9ab349b0658344294 | Create weather_proc.py | tmp/weather_proc.py | tmp/weather_proc.py | Python | 0.000047 | @@ -0,0 +1,1466 @@
+import argparse%0Afrom datetime import datetime%0Aimport numpy as np%0A%0A# timeslot indexing funtion%0Adef get_time_index(timestamp):%0A day = int(timestamp.date().day) - 1%0A slot = int((timestamp.time().hour * 3600 + timestamp.time().minute * 60 + timestamp.time().second) / 600)%0A retur... | |
9f2e4aad6d3a4004e80378f44aa178b37dd6da57 | add ShellExecError | tpl/errors.py | tpl/errors.py | Python | 0.000001 | @@ -0,0 +1,400 @@
+# -*- coding:utf-8 -*-%0A%0Afrom gettext import gettext as _%0A%0A%0Aclass BaseError(BaseException):%0A ERR_MSG = _('')%0A%0A%0Aclass ShellExecError(BaseError):%0A ERR_MSG = _('Command exit code not zero. %5CnExit Code:%5Cn%7B%7D.%5CnOut:%5Cn%7B%7D%5CnErr:%5Cn%7B%7D')%0A%0A def __init__(self... | |
3d027df005725cbc5dfbba0262b0c52c5392d7f0 | Add whoami resource which decodes token and returns user info from token | app/resources/check_token.py | app/resources/check_token.py | Python | 0 | @@ -0,0 +1,1173 @@
+from flask import make_response, jsonify%0Afrom flask_restful import Resource, reqparse, marshal, fields%0Afrom app.models import User%0Afrom app.common.auth.token import JWT%0A%0Auser_fields = %7B%0A %22id%22: fields.Integer,%0A %22username%22: fields.String,%0A %22created_at%22: fields.D... | |
62484ca423d6adfa19a581d7b74472e8475cf817 | Create findbro.py | findbro/findbro.py | findbro/findbro.py | Python | 0.000001 | @@ -0,0 +1,1858 @@
+# findbro.py v0.1%0A# Matches Bro logs against a specified list of UIDs%0A# Can run on N number of Bro logs%0A# Performs no error checking%0A# Should only be run on directories that contains only gzip Bro logs%0A# Best way to collect UIDs is via bro-cut and grep%0A# %0A# Josh Liburdi 2016%0A%0Afrom ... | |
f34dabd23faa7d50e507b829e576c1968bdc2d52 | Print The Message Happy New Year | src/iterations/exercise3.py | src/iterations/exercise3.py | Python | 0.000028 | @@ -0,0 +1,364 @@
+# Print The Message %22Happy new Year%22 followed by the name of a person%0A# taken from a list for all people mentioned in the list.%0A%0Adef print_Happy_New_Year_to( listOfPeople ):%0A%09%0A%09for user in listOfPeople:%0A%09%09print 'Happy New Year, ', user%0A%0A%09print 'Done!'%0A%0Adef main( ):%0... | |
67cb63bcb776b1a89d8e96a7b90c02724ef5b0b6 | update migrations | sweettooth/extensions/migrations/0005_auto_20190112_1733.py | sweettooth/extensions/migrations/0005_auto_20190112_1733.py | Python | 0.000023 | @@ -0,0 +1,774 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.18 on 2019-01-12 17:33%0Afrom __future__ import unicode_literals%0A%0Aimport autoslug.fields%0Afrom django.db import migrations, models%0Aimport sweettooth.extensions.models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B... | |
3aa6ba18655a92753f33622ac80be66eb3b69ff6 | Add useful python functions | device_resolutions.py | device_resolutions.py | Python | 0.000043 | @@ -0,0 +1,1612 @@
+from math import sqrt%0Aimport csv%0A%0Adef as_orientation(x, y, is_portrait=False):%0A if is_portrait:%0A return (y, x) if x %3E y else (x, y)%0A else:%0A return (x, y) if x %3E y else (y, x)%0A%0Adef as_portrait(x, y):%0A %22%22%22Given a dimensions, return that pair in port... | |
dad5f0a06dd057eccde5a086c84d5c639bb74ae9 | Add back peaks for backwards compatibility with a deprecation warning. | dipy/reconst/peaks.py | dipy/reconst/peaks.py | Python | 0 | @@ -0,0 +1,210 @@
+import warnings%0A%0Aw_s = %22The module 'dipy.reconst.peaks' is deprecated.%22%0Aw_s += %22 Please use the module 'dipy.direction.peaks' instead%22%0Awarnings.warn(w_s, DeprecationWarning)%0A%0Afrom dipy.direction.peaks import *%0A
| |
52a8a0c0def2930667155660c8844bb6836f9ff5 | add script for table of orders/country | scripts/country_order_stats.py | scripts/country_order_stats.py | Python | 0 | @@ -0,0 +1,529 @@
+import sqlite3%0Aimport pandas as pd%0A%0ATICKET_SALE_START_DATE = '2016-01-01'%0A%0Aconn = sqlite3.connect('data/site/p3.db')%0A%0Ac = conn.cursor()%0A%0Aquery = c.execute(%22%22%22%0ASELECT ORDER_ID, COUNTRY_ID%0AFROM assopy_orderitem, assopy_order%0AWHERE assopy_orderitem.order_id == assopy_order.... | |
696b9d1177d24ca6c455052f15e529f4952196a0 | add test | @test/test_lang_with.py | @test/test_lang_with.py | Python | 0.000002 | @@ -0,0 +1,1408 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (c) 2018~2999 - Cologler %3Cskyoflw@gmail.com%3E%0A# ----------%0A#%0A# ----------%0A%0Afrom jasily.lang import with_it, with_objattr, with_objattrs%0A%0Aclass SomeLock:%0A def __init__(self):%0A self.locked = False%0A%0A def __enter__(self):%0A... | |
791ce2275933f16cf483dad1b16948441292e61c | add hook for google-api-python-client (#3965) | scripts/hooks/hook-pydrive2.py | scripts/hooks/hook-pydrive2.py | Python | 0 | @@ -0,0 +1,136 @@
+from PyInstaller.utils.hooks import copy_metadata%0A%0Adatas = copy_metadata(%22pydrive2%22)%0Adatas += copy_metadata(%22google-api-python-client%22)%0A
| |
534db68d8f773c459788650590b6585fc0369e19 | create a default permission handler for ObjectOwner | apps/Localizr/permissions.py | apps/Localizr/permissions.py | Python | 0 | @@ -0,0 +1,304 @@
+from rest_framework.permissions import IsAuthenticated, SAFE_METHODS%0A%0A%0Aclass IsObjectOwner(IsAuthenticated):%0A%0A%09def has_object_permission(self, request, view, obj):%0A%09%09if request.method in SAFE_METHODS:%0A%09%09%09return True%0A%09%09if hasattr(obj, 'created_by'):%0A%09%09%09return ob... | |
f7d3ca5d537140e07ff95d082f2a78e86bc06604 | Add flip | zl/indicators/flip.py | zl/indicators/flip.py | Python | 0.000053 | @@ -0,0 +1,2124 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A%0A# Copyright 2013 Jason Koelker%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.apac... | |
4cea1c1231da1583fb177e976f473fa52b9ec450 | Fix SelectJmes documentation | scrapy/loader/processors.py | scrapy/loader/processors.py | """
This module provides some commonly used processors for Item Loaders.
See documentation in docs/topics/loaders.rst
"""
from scrapy.utils.misc import arg_to_iter
from scrapy.utils.datatypes import MergeDict
from .common import wrap_loader_context
class MapCompose(object):
def __init__(self, *functions, **def... | Python | 0 | @@ -2497,12 +2497,8 @@
ram
-str
valu
@@ -2506,29 +2506,35 @@
: a
-string with JSON data
+data structure (dict, list)
to
|
e07cc0ea6e56339d117fd5d81c0939b0c658727e | Create cnn.py | Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py | Classifying_datasets/Convolutional_Neural_Networks/Convolutional_Neural_Networks/cnn.py | Python | 0.000003 | @@ -0,0 +1,2101 @@
+# Convolutional Neural Network%0A%0A# Part 1 - Building the CNN%0A%0A# Importing the Keras libraries and packages%0Afrom keras.models import Sequential%0Afrom keras.layers import Conv2D%0Afrom keras.layers import MaxPooling2D%0Afrom keras.layers import Flatten%0Afrom keras.layers import Dense%0A%0A#... | |
5199ee1a544b2aa59895a1b22359d6a9adb765a3 | Add .prepare-commit-msg.py | .prepare-commit-msg.py | .prepare-commit-msg.py | Python | 0.000011 | @@ -0,0 +1,1399 @@
+#!/usr/bin/env python%0A%0A# This script is an optional git hook and will prepend the issue%0A# number to a commit message in the correct format for Github to parse.%0A#%0A# If you wish to use it, create a shortcut to this file in .git/hooks called%0A# 'prepare-commit-msg' e.g. from top folder of yo... | |
ce28c5642c3ab543fc48e2f4f1f0b2f2a62890a2 | Add script to extract information for playbook files | src/misc/parse_tool_playbook_yaml.py | src/misc/parse_tool_playbook_yaml.py | Python | 0 | @@ -0,0 +1,986 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport os%0Aimport argparse%0Aimport re%0Aimport yaml%0A%0Adef get_revision_number(yaml_content, tool_name):%0A for tool in yaml_content%5B'tools'%5D:%0A if tool%5B%22name%22%5D == tool_name:%0A if tool.has_key(%22... | |
24c763ead7af8a669ff1055b3f352f513274a47f | Insert a note at a specific position in a linked list | all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py | all-domains/data-structures/linked-lists/insert-a-node-at-a-specific-positin-in-a-linked-list/solution.py | Python | 0.000001 | @@ -0,0 +1,1406 @@
+# https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list%0A# Python 2%0A%0A%22%22%22%0A Insert Node at a specific position in a linked list%0A head input could be None as well for empty list%0A Node is defined as%0A%0A class Node(object):%0A%0A def __init__(sel... | |
db914944615f16c4b170e7dfd428901d5fc29271 | Add test for image.fromstring - refs #1805 | tests/python_tests/image_test.py | tests/python_tests/image_test.py | Python | 0 | @@ -0,0 +1,934 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport os, mapnik%0Afrom timeit import Timer, time%0Afrom nose.tools import *%0Afrom utilities import execution_path%0A%0Adef setup():%0A # All of the paths used are relative, if we run the tests%0A # from another directory we ne... | |
dedcdaf1a55b08c275af29c535a7ae574b8ee5d2 | Add 20150517 question. | LeetCode/number_of_islands.py | LeetCode/number_of_islands.py | Python | 0.000001 | @@ -0,0 +1,1619 @@
+%22%22%22%0AGiven a 2d grid map of '1's (land) and '0's (water), count the number of%0Aislands. An island is surrounded by water and is formed by connecting adjacent%0Alands horizontally or vertically. You may assume all four edges of the grid are%0Aall surrounded by water.%0A%0AExample 1:%0A%0A1111... | |
bf3378d0749abb499c286d92583218749773e174 | change code fami as famille in param | src/scripts/aggregates_all_years.py | src/scripts/aggregates_all_years.py | # -*- coding:utf-8 -*-
#
# This file is part of OpenFisca.
# OpenFisca is a socio-fiscal microsimulation software
# Copyright © 2011 Clément Schaff, Mahdi Ben Jelloul
# Licensed under the terms of the GVPLv3 or later license
# (see openfisca/__init__.py for details)
# Script to compute the aggregates for all the refer... | Python | 0.000004 | @@ -1175,18 +1175,18 @@
(2006,20
+1
0
-7
)%0A fo
|
681c67381eef9384845e0041214011797be6ea03 | Create text2hex.py | text2hex.py | text2hex.py | Python | 0.001615 | @@ -0,0 +1,1684 @@
+# Program Name : text2hex%0A# Programmer : The Alpha%0A# Credits : Iranpython.blog.ir%0A# Version : 0.91(Beta Version)%0A# Linted By : Pyflakes%0A# Info : text2hex is a simple tool that uses to convert strings to hex.%0A%0Afrom PyQt4.QtCore import *%0Afrom PyQt4.QtGui import *... | |
dce13f074187cb95644b0ac3cfd84d1e0649f93c | Fix bytes/str handling in disqus SSO. | mezzanine/generic/templatetags/disqus_tags.py | mezzanine/generic/templatetags/disqus_tags.py | from __future__ import unicode_literals
from future.builtins import int, str
import base64
import hashlib
import hmac
import json
import time
from mezzanine import template
register = template.Library()
@register.simple_tag
def disqus_id_for(obj):
"""
Returns a unique identifier for the object to be used ... | Python | 0 | @@ -65,16 +65,18 @@
ort
-int, str
+bytes, int
%0A%0Aim
@@ -1498,20 +1498,44 @@
4encode(
-data
+bytes(data, encoding=%22utf8%22)
)%0A #
@@ -1670,11 +1670,13 @@
MAC(
-str
+bytes
(sec
@@ -1686,11 +1686,54 @@
_key
-)
,
+encoding=%22utf8%22),%0A bytes(
'%25s
@@ -1759,16 +1759,34 @@
estamp... |
913a77592a9f399820cddbc7753c24182ad21639 | Add options for plots | src/rnaseq_lib/plot/opts.py | src/rnaseq_lib/plot/opts.py | Python | 0.000001 | @@ -0,0 +1,643 @@
+gene_curves = %7B%0A 'Curve': %7B'plot': dict(height=120, width=600, tools=%5B'hover'%5D, invert_xaxis=True, yrotation=45, yaxis='left'),%0A 'style': dict(line_width=1.5)%7D,%0A 'Curve.Percentage_of_Normal_Samples': %7B'plot': dict(xaxis=None, invert_yaxis=True),%0A ... | |
9fb860e0c5b0ff6e696b8102197c3255f7b2d3d7 | The goods | graph_role_deps.py | graph_role_deps.py | Python | 0.998626 | @@ -0,0 +1,710 @@
+#!/usr/bin/python%0A'''Graphs role dependencies in roles/ as a graphviz digraph'''%0A%0Aimport os%0Aimport yaml%0Aimport sys%0A%0Aprint 'digraph %7B'%0A%0Afor role in os.listdir('./roles'):%0A try:%0A with open('./roles/%25s/meta/main.yml' %25 role) as meta:%0A data = yaml.load(m... | |
fa1e30635f57aaffdc74eaa307b8c74f89bf50ae | add base gender choices object | accelerator_abstract/models/base_gender_choices.py | accelerator_abstract/models/base_gender_choices.py | Python | 0.001809 | @@ -0,0 +1,1077 @@
+# MIT License%0A# Copyright (c) 2017 MassChallenge, Inc.%0A%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models%0A%0Afrom accelerator_abstract.models.accelerator_model import AcceleratorModel%0A%0AGENDER_MALE_CHOICE = %22Male%22%0AGENDER_FEMALE_CHOICE = %22Female%22%0AGENDER_... | |
b55ef35a68305269e8a49a8afcdf46d94d06361f | add drf module | src/common/drf.py | src/common/drf.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+from rest_framework.exceptions import APIException%0A%0Aclass ServiceUnavailable(APIException):%0A status_code = 503%0A default_detail = 'Service temporarily unavailable, try again later.'%0A default_code = 'service_unavailable'
| |
3f7b6649db97547b77ed757aae28eeeb739fa154 | fix a bug in reading the boolean environment variable | tweeza/app.py | tweeza/app.py | # -*- coding: utf-8 -*-
""" The main application entry. """
import os
from flask import Flask, request, g, render_template
from config import DevelopmentConfig
# Bluprints:
from frontend.views import frontend
from dashboard.views import dashboard
from users import users, User
from items.views import items
# from flask... | Python | 0.000039 | @@ -1352,24 +1352,57 @@
.cfg%0A %22%22%22
+%0A%0A import ast # Python %3E= 2.6
%0A config_
@@ -1421,16 +1421,37 @@
%0A if
+ast.literal_eval(str(
os.envir
@@ -1474,19 +1474,14 @@
ON')
+))
: #
- are we
in
|
cdfee7e893564157e2143f20dea0b10c8bd33cfb | Create pythonLock.py | ving2/pythonLock.py | ving2/pythonLock.py | Python | 0.00002 | @@ -0,0 +1,849 @@
+%0A%0Afrom threading import Thread%0Afrom threading import Lock%0Ai = 0%0A%0Adef someThreadFunction1(lock): %0A# Potentially useful thing:%0A# In Python you %22import%22 a global variable, instead of %22export%22ing it when you declare it%0A# (This is probably an effort to make you feel bad ab... | |
01c3a20cd7ef44fe0363d8a270425699669af74f | FIX json in metadata - new resource | test/acceptance/component/get_productandrelease_list/features/steps.py | test/acceptance/component/get_productandrelease_list/features/steps.py | from lettuce import step, world
from commons.product_steps import ProductSteps
from commons.rest_utils import RestUtils
from commons.constants import *
from commons.utils import response_body_to_dict
from nose.tools import assert_equals, assert_true, assert_false, assert_in
api_utils = RestUtils()
product_steps = Pr... | Python | 0 | @@ -193,16 +193,61 @@
_to_dict
+, replace_none_value_metadata_to_empty_string
%0A%0Afrom n
@@ -1103,16 +1103,205 @@
ADATA%5D:%0A
+ # Workaround: xmldict manage Empty values as None value%0A replace_none_value_metadata_to_empty_string(product_and_release%5BPRODUCT%5D%5BPRODUCT_ME... |
9266e24e616174cc37b5e6f7926dfda81471abb5 | Initialize PracticeQuestions | books/CrackingCodesWithPython/Chapter13/PracticeQuestions.py | books/CrackingCodesWithPython/Chapter13/PracticeQuestions.py | Python | 0 | @@ -0,0 +1,688 @@
+# Chapter 13 Practice Questions%0A%0A# 1. What do the following expressions evaluate to?%0Aprint(17 %25 1000)%0Aprint(5 %25 5)%0A%0A# 2. What is the GCD of 10 and 15?%0A# Don't do this - imports should be at the top of the file%0Afrom books.CrackingCodesWithPython.Chapter13.cryptomath import gcd%0Apr... | |
c9e90ef5413bd560422e915d213df73ad88dffd7 | Add apigateway integration test for PutIntegration | tests/integration/test_apigateway.py | tests/integration/test_apigateway.py | Python | 0 | @@ -0,0 +1,1954 @@
+# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22). You%0A# may not use this file except in compliance with the License. A copy of%0A# the License is located at%0A#%0A# http://aws.amazon.com/apache2.0/%... | |
4ce7a1932d9cde635263a4fe5a80af57589e1cfa | add NASM 2.13.02 Conan package recipe | build_env/Conan/packages/NASM/2.13.02/conanfile.py | build_env/Conan/packages/NASM/2.13.02/conanfile.py | Python | 0 | @@ -0,0 +1,1515 @@
+import os%0Afrom conans import ConanFile, AutoToolsBuildEnvironment, tools%0A%0A%0A%0Aclass NASM(ConanFile):%0A%09name = %22NASM%22%0A%09version = %222.13.02%22%0A%09url = %22http://www.nasm.us%22%0A%09settings = %7B%22os%22: %5B%22Linux%22%5D%7D%0A%0A%0A%0A%09def getSubdirectories(self, d):%0A%09%0... | |
9fb564d8f02d92432a62be02c906e3b227f48c10 | Create add_results_new.py | run_tests/shaker_run/add_results_new.py | run_tests/shaker_run/add_results_new.py | Python | 0.000004 | @@ -0,0 +1,742 @@
+custom_res1 = %5B%7B'status_id': 5, 'content': 'Check %5BOperations per second Median; iops%5D', 'expected': '88888', 'actual': '7777'%7D,%7B'status_id': 5, 'content': 'Check %5Bdeviation; %25%5D', 'expected': '5555', 'actual': '9999'%7D%5D%0Ares1 = %7B'test_id': test_4kib_read, 'status_id': 5, 'cust... | |
729f1c5147e4d4ce242d73731c8e455b2a50fca3 | add 188 | vol4/188.py | vol4/188.py | Python | 0.999986 | @@ -0,0 +1,223 @@
+def tetration(a, b, m):%0A t0 = 1%0A for i in range(b):%0A t1 = pow(a, t0, m)%0A if t0 == t1:%0A break%0A t0 = t1%0A return t0%0A%0Aif __name__ == %22__main__%22:%0A print tetration(1777, 1855, 10 ** 8)%0A
| |
98c1ff71d57749168f0ca35d97dbe77a8a67e082 | Add module for utilities related to xgboost | mltils/xgboost/utils.py | mltils/xgboost/utils.py | Python | 0 | @@ -0,0 +1,304 @@
+%0Axgb_to_sklearn = %7B%0A 'eta': 'learning_rate',%0A 'num_boost_round': 'n_estimators',%0A 'alpha': 'reg_alpha',%0A 'lambda': 'reg_lambda',%0A 'seed': 'random_state',%0A%7D%0A%0Adef to_sklearn_api(params):%0A return %7B%0A xgb_to_sklearn.get(key, key): value%0A for ke... | |
bbb10ba41db6f70512fe6bcb5207377606a22455 | Create Mordecai_Output.py | Geoparser_Comparison/English/Mordecai_Output.py | Geoparser_Comparison/English/Mordecai_Output.py | Python | 0.000198 | @@ -0,0 +1,1593 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ADownload and run Mordecai from following link: %0A %0A %22https://github.com/openeventdata/mordecai%22%0A %0A To change the corpus, just change the name in main function.%0A%22%22%22%0A%0Aimport xml.etree.ElementTree as et%0A... | |
9d98c3280d4e9dc6dda172d11e02922fc9958471 | add homwork01_v0.2.py | 01/homwork01_v0.2.py | 01/homwork01_v0.2.py | Python | 0.000065 | @@ -0,0 +1,463 @@
+#!/usr/bin/env python%0A#coding=utf-8%0A%0Anum_list = %5B1,2,3,2,12,3,1,3,21,2,2,3,4111,22,3333,444,111,4,5,777,65555,45,33,45%5D%0A%0Amax2 = max1 = num_list%5B0%5D%0A# print max1, max2%0A# max1 bigger than max2%0A# 1. n%3Emax1 and n%3Emax2%0A# 2. n%3C=max1 and n%3Emax2%0A# 3. n%3Cmax1 and n%3C=max2%... | |
7b27f4cdb8135e7d5fd18ff11e2eae9325e6f17a | Move METROPOLIS_FORK_BLKNUM | ethereum/config.py | ethereum/config.py | from rlp.utils import decode_hex
from ethereum import utils
from ethereum.db import BaseDB
default_config = dict(
# Genesis block difficulty
GENESIS_DIFFICULTY=131072,
# Genesis block gas limit
GENESIS_GAS_LIMIT=3141592,
# Genesis block prevhash, coinbase, nonce
GENESIS_PREVHASH=b'\x00' * 32,
... | Python | 0.000005 | @@ -1634,16 +1634,16 @@
NUM=
-99999999
+2 ** 100
,%0A
|
73bc2dbfe40db224a38725f4412e33b1b5accac6 | Add script example. | examples/script.py | examples/script.py | Python | 0 | @@ -0,0 +1,1351 @@
+# Copyright (c) 2013 Jordan Halterman %3Cjordan.halterman@gmail.com%3E%0A# See LICENSE for details.%0Aimport sys, os%0Asys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))%0A%0A# The Active Redis API provides native support for Redis server-side%0A# Lua scripting.%0Afrom active_redis impor... | |
fbaca2f2a0ceaa77606d9c24846a1a1b045dc460 | remove deleted files from manifest | addons/l10n_lu/__openerp__.py | addons/l10n_lu/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2011 Thamini S.à.R.L (<http://www.thamini.com>)
# Copyright (C) 2011 ADN Consultants S.à... | Python | 0 | @@ -2381,44 +2381,8 @@
l',%0A
- 'account.tax.template.csv',%0A
|
c0ee3bb87a26a57bc7dc1bd4e1aaf6136f94bc17 | Add missing filters.py file in organizations | ain7/organizations/filters.py | ain7/organizations/filters.py | Python | 0.000001 | @@ -0,0 +1,1116 @@
+# -*- coding: utf-8%0A%22%22%22%0A ain7/organizations/filters.py%0A%22%22%22%0A#%0A# Copyright %C2%A9 2007-2015 AIn7 Devel Team%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 S... | |
f56181aaf6df758abb988d10c757c6eba72d5025 | write beginning of method for storing probabilities in a hash | parser.py | parser.py | Python | 0.000011 | @@ -0,0 +1,303 @@
+import re%0A%0AprobabilityHash = %7B%5B%5D, %22%22%7D%0A#%5Bword1, word2%5D, count%0A%0Adef parseIntoProbabilityHash(text):%0A stripPunctuation = re.sub(ur%22%5B%5E%5Cw%5Cd'%5Cs%5D+%22,' ',text)%0A wordsInText = stripPunctuation.split()%0A n = 0%0A for word in wordsInText:%0A probabilityHash%5... | |
5e54e5ebf9add6d8bd879d963803ee57fd591f4b | Write new Preparation tests | whats_fresh/whats_fresh_api/tests/views/entry/test_new_preparation.py | whats_fresh/whats_fresh_api/tests/views/entry/test_new_preparation.py | Python | 0.000001 | @@ -0,0 +1,3642 @@
+from django.test import TestCase%0Afrom django.core.urlresolvers import reverse%0Afrom whats_fresh_api.models import *%0Afrom django.contrib.gis.db import models%0Aimport json%0A%0A%0Aclass NewPreparationTestCase(TestCase):%0A %22%22%22%0A Test that the New Preparation page works as expected.%... | |
4d92b111eecd3ce938676edee36b288c42484905 | test scraper for UKÄ | statscraper/scrapers/uka_scraper.py | statscraper/scrapers/uka_scraper.py | Python | 0 | @@ -0,0 +1,2562 @@
+# encoding: utf-8%0Au%22%22%22 A scraper to fetch Swedish university application statistics from%0A the Swedish Higher Education Authority (Universitetskansler%C3%A4mbetet, UK%C3%84),%0A at http://statistik.uka.se%0A%22%22%22%0Afrom statscraper import BaseScraper, Dataset, Dimension, Result, Collect... | |
d2762f81a9f8ed405ca5fc9d567004af182d137b | add importer for delimited data | python/delim_import.py | python/delim_import.py | Python | 0 | @@ -0,0 +1,1618 @@
+from json_generator import JsonGenerator, writeTrackEntry%0A%0Adef delimImport(file, skipLines, colNames, dataDir, trackLabel, key = None,%0A delim = %22%5Ct%22, chunkBytes = 200000, compress = True,%0A config = %7B'style': %7B'className': 'feature2'%7D%7D ):%0A fh =... | |
de456b7e6397d775bd244b7e20eb1d675ca1bde0 | Add logging to attrib plugin | nose2/plugins/attrib.py | nose2/plugins/attrib.py | from unittest import TestSuite
from nose2.events import Plugin
undefined = object()
# TODO: eval attribs
class AttributeSelector(Plugin):
"""TODO: document"""
def __init__(self):
self.attribs = []
self.addOption(self.attribs, "A", "attr", "Attribulate")
def startTestRun(self, event):
... | Python | 0 | @@ -1,12 +1,27 @@
+import logging%0A
from unittes
@@ -73,16 +73,50 @@
Plugin%0A%0A
+log = logging.getLogger(__name__)%0A
undefine
@@ -409,16 +409,81 @@
return%0A
+ log.debug('Attribute selector attribs %25s', self.attribs)%0A
|
554f139ed02caa436e6e17baf5d880402ced8e21 | Raise exception if script contains invalid import | django_extensions/management/commands/runscript.py | django_extensions/management/commands/runscript.py | # -*- coding: utf-8 -*-
import sys
import importlib
import traceback
from django.apps import apps
from django_extensions.management.email_notifications import EmailNotificationCommand
from django_extensions.management.utils import signalcommand
class Command(EmailNotificationCommand):
help = 'Runs a script in d... | Python | 0.000014 | @@ -3407,16 +3407,20 @@
+ t =
importl
@@ -3445,59 +3445,8 @@
od)%0A
- t = __import__(mod, %5B%5D, %5B%5D, %5B%22 %22%5D)%0A
@@ -3460,17 +3460,16 @@
except
-(
ImportEr
@@ -3475,25 +3475,8 @@
rror
-, AttributeError)
as
@@ -3958,80 +3958,20 @@
if
-verbosity %3E 0 and not silent... |
51a5c7626b634687be57c3e6ed05ea07f6468ad0 | add analyzer test | timeside/tests/api/test_analyzer.py | timeside/tests/api/test_analyzer.py | Python | 0.000001 | @@ -0,0 +1,1454 @@
+# -*- coding: utf-8 -*-%0A%0Aimport timeside%0Afrom sys import stdout%0Aimport os.path%0Aimport numpy%0A%0A%0Aclass TestAnalyzer:%0A %0A graphers = timeside.core.processors(timeside.api.IGrapher)%0A decoders = timeside.core.processors(timeside.api.IDecoder)%0A encoders= timeside.core.pro... | |
b634e5966c48299eda8cc9a3dcd4e8f769df6812 | Create 5kyu_tree_to_list.py | Solutions/5kyu/5kyu_tree_to_list.py | Solutions/5kyu/5kyu_tree_to_list.py | Python | 0.000002 | @@ -0,0 +1,414 @@
+class Node:%0A def __init__(self, data, child_nodes=None):%0A self.data = data%0A self.child_nodes = child_nodes%0A%0Adef tree_to_list(tr):%0A call = to_list(tr, 0, %5B%5D)%0A return call%0A %0Adef to_list(tr, depth, res):%0A res.append(%5Btr.data, depth%5D)%0A if tr.c... | |
f1cb1cb0cdcf7ef3d5d0e286bfbd9d9664239098 | Create 6kyu_alphabetized.py | Solutions/6kyu/6kyu_alphabetized.py | Solutions/6kyu/6kyu_alphabetized.py | Python | 0.000033 | @@ -0,0 +1,102 @@
+def alphabetized(s):%0A return ''.join(s for s in sorted(s, key=lambda s: s.lower()) if s.isalpha())%0A
| |
2eddc73e2d7b78fbfac521eb1e6014ca26421510 | Add forgotten migration | osmdata/migrations/0012_auto_20170829_1539.py | osmdata/migrations/0012_auto_20170829_1539.py | Python | 0.000004 | @@ -0,0 +1,566 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.4 on 2017-08-29 15:39%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osmdata', '0011_... | |
d00243d9500118400f7e08409d9564b15b2b4148 | Add trivial CLI example | examples/cliExample.py | examples/cliExample.py | Python | 0.000004 | @@ -0,0 +1,1756 @@
+# Very Simple CLI example%0A%0Afrom OTXv2 import OTXv2%0Aimport IndicatorTypes%0Aimport argparse%0A%0A# Your API key%0AAPI_KEY = ''%0AOTX_SERVER = 'https://otx.alienvault.com/'%0Aotx = OTXv2(API_KEY, server=OTX_SERVER)%0A%0Aparser = argparse.ArgumentParser(description='Description of your program')%... | |
ecc8a93ddda784102311ebfd4c3c93624f356778 | Add migration to add strip_html sql function | cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py | cnxarchive/sql/migrations/20160723123620_add_sql_function_strip_html.py | Python | 0 | @@ -0,0 +1,335 @@
+# -*- coding: utf-8 -*-%0A%0A%0Adef up(cursor):%0A cursor.execute(%22%22%22%5C%0ACREATE OR REPLACE FUNCTION strip_html(html_text TEXT)%0A RETURNS text%0AAS $$%0A import re%0A return re.sub('%3C%5B%5E%3E%5D*?%3E', '', html_text, re.MULTILINE)%0A$$ LANGUAGE plpythonu IMMUTABLE;%0A %22%22%22)%0... | |
0f5b15a1f909c79b40a3f2655d00bc7852d41847 | add missing migration | conversion_service/conversion_job/migrations/0003_auto_20151120_1528.py | conversion_service/conversion_job/migrations/0003_auto_20151120_1528.py | Python | 0.000258 | @@ -0,0 +1,892 @@
+# -*- 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 ('conversion_job', '0002_auto_20151119_1332'),%0A %5D%0A%0A operations = %5B%0A migrations.... | |
a5724d42e4acaa1a81aa66b69dc72b0b5fa31eae | Update build.py | infra/gcb/build.py | infra/gcb/build.py | #!/usr/bin/python2
"""Starts project build on Google Cloud Builder.
Usage: build.py <project_dir>
"""
import base64
import collections
import datetime
import os
import subprocess
import sys
import time
import urllib
import yaml
from oauth2client.client import GoogleCredentials
from oauth2client.service_account impo... | Python | 0.000001 | @@ -1533,37 +1533,16 @@
'gcr.io/
-clusterfuzz-external/
oss-fuzz
|
86fdca61d8a53270d4aa28c3105f7948b04cb6f3 | use first-3 octets to identify unknowns | hops.py | hops.py | #!/usr/bin/python
import socket
import struct
import sys
#
# from the web!
#
def iptoint(ip):
return int(socket.inet_aton(ip).encode('hex'),16)
def inttoip(ip):
return socket.inet_ntoa(hex(ip)[2:].zfill(8).decode('hex'))
AS2NAME={}
def get_asno(as_raw):
as_long = as_raw.replace('"','').replace('&','').re... | Python | 0.000071 | @@ -1214,16 +1214,93 @@
easier.%0A
+ # note: also only return first three octets to reduce number of 'unknowns'%0A
return
@@ -1304,16 +1304,17 @@
urn %22x%22+
+(
inttoip(
@@ -1317,16 +1317,36 @@
oip(ip).
+rpartition('.'))%5B0%5D.
replace(
@@ -1349,17 +1349,16 @@
ace(%22.%22,
-
%22%22)%0A%0Adef
|
ed45aa20bc54714c6eb355417520c3d90a6b47fc | Add init.py | init.py | init.py | Python | 0.000063 | @@ -0,0 +1,426 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0Aimport django%0A%0Aos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'readthedocs.settings.dev')%0Asys.path.append(os.getcwd())%0Adjango.setup()%0A%0Afrom django.contrib.auth.models import User%0Aadmin = User.objects.create_user('admin', '', 'admin')%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.