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 |
|---|---|---|---|---|---|---|---|
0ee1150e1f8f0c8cae7b906c4d349b8867bbe0b4 | Add dmrg example | examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py | examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py | Python | 0 | @@ -0,0 +1,994 @@
+#!/usr/bin/env python%0Aimport numpy%0Afrom pyscf import gto%0Afrom pyscf import scf%0Afrom pyscf import mcscf%0Afrom pyscf.mrpt.nevpt2 import sc_nevpt%0Afrom pyscf.dmrgscf.dmrgci import DMRGSCF%0A%0A#%0A# This calculation requires about 10 GB memory per processor.%0A#%0A%0Ab = 1.5%0Amol = gto.Mole()... | |
61516c8a98bb9f0286bec2e8cfeb93cc96d5e74e | Print the initial metrics in relativity.py | examples/relativity.py | examples/relativity.py | #!/usr/bin/env python
import iam_sympy_example
"""
This example calculates the Ricci tensor from the metric and does this
on the example of Schwarzschild solution.
"""
from sympy import exp, Symbol, sin, Rational, Derivative, dsolve, Function, \
Matrix, Eq, pprint, Pow
def grad(f,X):
a=[]
f... | Python | 0.001055 | @@ -3029,16 +3029,47 @@
-#
print
-g
+%22Initial metric:%22%0A pprint(gdd)
%0A
|
1830c24988fccd7069bb4f9d4c66940ce623425f | add execute apcupsd cgi sample | execute_apcupsd_cgi.py | execute_apcupsd_cgi.py | Python | 0 | @@ -0,0 +1,409 @@
+from http.server import CGIHTTPRequestHandler, test%0D%0Aimport os%0D%0A%0D%0Adef main():%0D%0A # http://stackoverflow.com/questions/11419572/how-to-set-the-documentroot-while-using-pythons-httpserver%0D%0A os.chdir(r%22C:%5Capcupsd%22)%0D%0A%0D%0A # %E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%8... | |
c3afc6c28530c3dfc3bd57d9a1841a60bf92ba4f | Fix bug which caused page cyclers to always clear cache before load. | tools/perf/benchmarks/netsim_top25.py | tools/perf/benchmarks/netsim_top25.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from perf_tools import page_cycler
class NetsimTop25(test.Test):
"""Measures load time of the top 25 sites under simulated cab... | Python | 0.000008 | @@ -364,50 +364,8 @@
ler%0A
- test.clear_cache_before_each_run = True%0A
pa
@@ -538,8 +538,120 @@
,%0A %7D%0A
+%0A def __init__(self):%0A super(NetsimTop25, self).__init__()%0A self.test.clear_cache_before_each_run = True%0A
|
b5c21a5eeb8894ae93290c4c78fa23e5207bc0b3 | Create Flaskapp.wsgi | Flaskapp.wsgi | Flaskapp.wsgi | Python | 0.000206 | @@ -0,0 +1,211 @@
+#!/usr/bin/python%0Aimport sys%0Aimport logging%0Alogging.basicConfig(stream=sys.stderr)%0Asys.path.insert(0,%22/var/www/FlaskApp/%22)%0A%0Afrom FlaskApp import app as application%0Aapplication.secret_key = 'Add your secret key'%0A
| |
3c2f3baa1a76d386d5604c0c1dc8d4f3a33b11ad | Create Helloworld.py | Helloworld.py | Helloworld.py | Python | 0.000446 | @@ -0,0 +1,22 @@
+print('Hello World!')%0A
| |
ee614036b45e9f10f680cef56a5eaa2d86c424fb | Create cybercrimeatmtracker.py | plugins/feeds/public/cybercrimeatmtracker.py | plugins/feeds/public/cybercrimeatmtracker.py | Python | 0.000156 | @@ -0,0 +1,1441 @@
+import re%0Aimport logging%0Afrom dateutil import parser%0Afrom datetime import datetime, timedelta%0Afrom core.observables import Hash%0Afrom core.feed import Feed%0Afrom core.errors import ObservableValidationError%0A%0A%0Aclass CybercrimeAtmTracker(Feed):%0A%0A default_values = %7B%0A '... | |
ece838042acd75ba7edde833856ac02e4efe9977 | Create PPTconnect.py | PPTconnect.py | PPTconnect.py | Python | 0 | @@ -0,0 +1,2303 @@
+from TwitterAPI import TwitterAPI%0Aimport win32com.client%0Afrom MSO import *%0A%0A # Open PowerPoint%0AApplication = win32com.client.Dispatch(%22PowerPoint.Application%22)%0A%0A# Add a presentation%0APresentation = Application.Presentations.Add()%0A%0A# Go to http://dev.twitter.com and create an a... | |
65029a09af9dcafc156a5a0632a63e3cf4b6c50d | add benchmark to compare to lasagne | benchmarks/lag_task_lasgne.py | benchmarks/lag_task_lasgne.py | Python | 0 | @@ -0,0 +1,2387 @@
+from __future__ import division, absolute_import%0Afrom __future__ import print_function, unicode_literals%0A%0Aimport numpy as np%0Aimport theano%0Aimport theano.tensor as T%0Aimport lasagne%0A%0AfX = theano.config.floatX%0A%0A# ################################## config ############################... | |
985087efdcd80c4896f5ea215dddab1d98662f1d | set unit to B by default in doc string | src/collectors/processresources/processresources.py | src/collectors/processresources/processresources.py | # coding=utf-8
"""
A Diamond collector that collects memory usage of each process defined in it's
config file by matching them with their executable filepath or the process name.
This collector can also be used to collect memory usage for the Diamond process.
Example config file ProcessResourcesCollector.conf
```
en... | Python | 0.000002 | @@ -329,17 +329,16 @@
ue%0Aunit=
-k
B%0Acpu_in
|
33abec38e82e132a6e192d5ae0535b84d8aa47f4 | add import script for Poole | polling_stations/apps/data_collection/management/commands/import_poole.py | polling_stations/apps/data_collection/management/commands/import_poole.py | Python | 0 | @@ -0,0 +1,359 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E06000029'%0A addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.CSV'%0A stations_name = 'parl.2017-06-08/Version 1/... | |
b6b92e278202c27b124909aa5352726799d8d162 | add stack with max python solution | 08-stack-n-queue/8.1-stack-with-max/python/stackMax.py | 08-stack-n-queue/8.1-stack-with-max/python/stackMax.py | Python | 0 | @@ -0,0 +1,2027 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Fri Aug 18 10:08:25 2017%0A%0A@author: LiuQianKevin%0A%22%22%22%0Aclass Stack:%0A class cache:%0A def __init__(self, _max = -float('inf'), count = 0):%0A self.max = _max;%0A self.count = count;... | |
f78f74d836d2eca1cafe3b6401b5c8d13e6d139b | Fix type1/type2 | geotrek/tourism/migrations/0004_auto_20190328_1339.py | geotrek/tourism/migrations/0004_auto_20190328_1339.py | Python | 0.999983 | @@ -0,0 +1,885 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.14 on 2019-03-28 12:39%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('tourism', '0003_auto_20190306_1417'),%0A %5D%0A... | |
f29a0845bc0983e18ce6484543b206dfb3091818 | Add easier way to import cv2 | vision/opencv.py | vision/opencv.py | Python | 0.000003 | @@ -0,0 +1,63 @@
+import sys%0Asys.path.append('lib/opencv/build/lib')%0A%0Aimport cv2%0A
| |
2848955e59b5106ffe48c4ebfa05095a6be460e5 | Add visual script | visual/visual.py | visual/visual.py | Python | 0.000001 | @@ -0,0 +1,1347 @@
+#!/usr/bin/env python3%0A%0Aimport re%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport unittest%0A%0Aclass Parser:%0A%09'''Wta log parser'''%0A%0A%09def __init__(self):%0A%09%09'''Open log file'''%0A%09%09self._pattern = re.compile(%0A%09%09%09r'%5Era=((?:%5B0-9a-fA-F%5D%7B2%7D:)%7B5%... | |
b5cc83a705eaa22872d304b92c7b6e57b5581604 | Add unit-test for "readbytes_multiple" | puresnmp/test/test/test_helpers.py | puresnmp/test/test/test_helpers.py | Python | 0.000002 | @@ -0,0 +1,877 @@
+'''%0ATests for unit-test helpers%0A'''%0A%0Afrom textwrap import dedent%0Afrom binascii import hexlify%0Aimport puresnmp.test as th%0Afrom io import StringIO%0A%0A%0Adef test_readbytes_multiple():%0A data = StringIO(dedent(%0A '''%5C%0A #%0A # This is a comment%0A #%0A... | |
86075483e28000066f3d8298cbd80d12aefc5908 | Support default_value for boolean type handler | pybindgen/typehandlers/booltype.py | pybindgen/typehandlers/booltype.py | # docstrings not neede here (the type handler interfaces are fully
# documented in base.py) pylint: disable-msg=C0111
from base import ReturnValue, Parameter, \
ReverseWrapperBase, ForwardWrapperBase
class BoolParam(Parameter):
DIRECTIONS = [Parameter.DIRECTION_IN]
CTYPES = ['bool']
def convert_c_... | Python | 0 | @@ -660,32 +660,67 @@
nst, self.name)%0A
+ if self.default_value:%0A
py_name
@@ -802,75 +802,415 @@
-wrapper.parse_params.add_parameter('O', %5B'&'+py_name%5D, self.value)%0A
+else:%0A py_name = wrapper.declarations.declare_variable('PyObject *', 'py_'+self.name, 'NULL')%0A ... |
f434e45b58bfa7001d21d1920a65903f941df833 | Add __main__.py so that the package can be executed by `python -m jiebarpc` [ciskip] | jiebarpc/__main__.py | jiebarpc/__main__.py | Python | 0.000001 | @@ -0,0 +1,890 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, unicode_literals%0Aimport sys%0Aimport argparse%0A%0Afrom jiebarpc import JiebaRPCServer, JiebaRPCDispatcher%0A%0A%0Adef main(host, port, processnum=1):%0A server = JiebaRPCServer(JiebaRPCDispatcher(processnu... | |
5d297710416ebaea3a79e1ded0604d53178c493a | add python solution for Project Euler problem 1 | python_challenges/project_euler/problem_1.py | python_challenges/project_euler/problem_1.py | Python | 0.998958 | @@ -0,0 +1,651 @@
+__author__ = 'tilmannbruckhaus'%0A%0A%0Adef divisible_by_3_or_5(i):%0A divisible = i %25 3 == 0 or i %25 5 == 0%0A # print(%22natural number:%22, i, %22is divisible:%22, divisible)%0A return divisible%0A%0A%0Adef sum_of_multiples_of_3_or_5(limit):%0A # If we list all the natural numbers b... | |
1db14473edff479f97703fb68cb1aa8d65c25023 | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py | Python | 0.000138 | @@ -0,0 +1,1511 @@
+#!/usr/bin/env python%0A%22%22%22Benchmark exp.%22%22%22%0A%0Aimport timeit%0A%0Aname = %22exp%22%0Arepeats = 3%0Aiterations = 1000000%0A%0A%0Adef print_version():%0A %22%22%22Print the TAP version.%22%22%22%0A%0A print(%22TAP version 13%22)%0A%0A%0Adef print_summary(total, passing):%0A %22... | |
d1f4e257b449b6993e0cdc87055113018b6efabb | Create promoter_bin.py | code_collection/promoter_bin.py | code_collection/promoter_bin.py | Python | 0.000002 | @@ -0,0 +1,391 @@
+import sys%0A%0Apeak=%5B%5D%0Awith open(sys.argv%5B1%5D,'r') as f:%0A%09for line in f:%0A%09%09line=line.strip('%5Cn').split('%5Ct')%0A%09%09peak.append(int(line%5B3%5D))%0Af.close()%0A%0Anum=int(len(peak)/100.0)%0Abin=%5B%5D%0Afor i in range(99):%0A%09bin.append(str(i+1)+'%5Ct'+str(sum(peak%5Bnum*i:... | |
93a3b7d61877e9350ea2b32ade918755fc874bb8 | Create run_test.py | recipes/django-environ/run_test.py | recipes/django-environ/run_test.py | Python | 0.000004 | @@ -0,0 +1,189 @@
+import django%0Afrom django.conf import settings%0Asettings.configure(INSTALLED_APPS=%5B'environ', 'django.contrib.contenttypes', 'django.contrib.auth'%5D) %0Adjango.setup() %0A %0Aimport environ%0A
| |
19186f44b1ed4c4b60ffc1ef796fa0894b25da68 | Add garage.partdefs.sockets | py/garage/garage/partdefs/sockets.py | py/garage/garage/partdefs/sockets.py | Python | 0.000051 | @@ -0,0 +1,482 @@
+from garage import parameters%0Afrom garage import parts%0Afrom garage import sockets%0A%0A%0APARTS = parts.Parts(sockets.__name__)%0APARTS.patch_getaddrinfo = parts.AUTO%0A%0A%0APARAMS = parameters.define_namespace(sockets.__name__, 'socket utils')%0APARAMS.patch_getaddrinfo = parameters.create(%0A ... | |
b7d23a337ad121a032a8aa2c395c3705bad12b28 | add migration to grandfather in all existing plans to have Case Sharing via Groups and Child Cases privileges | corehq/apps/accounting/migrations/0043_grandfather_case_privs.py | corehq/apps/accounting/migrations/0043_grandfather_case_privs.py | Python | 0 | @@ -0,0 +1,883 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.21 on 2019-07-23 16:43%0Afrom __future__ import unicode_literals%0A%0Afrom __future__ import absolute_import%0Afrom django.core.management import call_command%0Afrom django.db import migrations%0A%0Afrom corehq.apps.hqadmin.management.commands.cchq... | |
304826205804e3972968b16fbf9bb9021eaf9acd | add FieldOfStudyHierarchy class | scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py | scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py | Python | 0.000108 | @@ -0,0 +1,1068 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.4 on 2016-03-11 13:19%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 ('core', '0014_pub... | |
ce4bcc19e61518273e054553494288364ab4f677 | Add lc085_maximal_rectangle.py | lc085_maximal_rectangle.py | lc085_maximal_rectangle.py | Python | 0.002349 | @@ -0,0 +1,570 @@
+%22%22%22Leetcode 85. Maximal Rectangle%0AHard%0A%0AURL: https://leetcode.com/problems/maximal-rectangle/%0A%0AGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle%0Acontaining only 1's and return its area.%0A%0AExample:%0AInput:%0A%5B%0A %5B%221%22,%220%22,%221%22,%220%22,%2... | |
5d8af7dec1806e7f897a89d1a54ff5f2dc5bfec0 | Add 'merge-json.py' script to make the final annotations file. | bin/merge-json.py | bin/merge-json.py | Python | 0 | @@ -0,0 +1,401 @@
+#!/usr/bin/env python%0Afrom collections import Mapping%0Aimport json%0Aimport sys%0A%0Afilename1 = sys.argv%5B1%5D%0Afilename2 = sys.argv%5B2%5D%0A%0Ajson_data1=open(filename1).read()%0AdictA = json.loads(json_data1)%0Ajson_data2=open(filename2).read()%0AdictB = json.loads(json_data2)%0A%0Amerged_di... | |
eda01dc886cde85ee9ee84d54fa0d5c5a11a776e | Disable failing android tests on cros. | tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py | tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py | # Copyright 2013 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 logging
import os
import unittest
from telemetry import test
from telemetry.core import bitmap
from telemetry.core import util
from telemetry.core.pl... | Python | 0.990071 | @@ -1060,16 +1060,45 @@
tore()%0A%0A
+ @test.Disabled('chromeos')%0A
def te
@@ -1714,16 +1714,45 @@
5.0%7D)%0A%0A
+ @test.Disabled('chromeos')%0A
def te
|
7f319b9f84e441cbe893fd2cc68ecd77cfcfd987 | create perl-file-which package (#6800) | var/spack/repos/builtin/packages/perl-file-which/package.py | var/spack/repos/builtin/packages/perl-file-which/package.py | Python | 0 | @@ -0,0 +1,1594 @@
+##############################################################################%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... | |
a2b4389db17759086c4cd804b6cbfb1b658d547e | Create equal_sides_of_an_array.py | equal_sides_of_an_array.py | equal_sides_of_an_array.py | Python | 0.998288 | @@ -0,0 +1,333 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Equal Sides Of An Array%0A#Problem level: 6 kyu%0A%0Adef find_even_index(arr):%0A if not sum(arr%5B1:%5D): return 0%0A if not sum(arr%5B:len(arr)-1%5D): return len(arr)-1%0A for i in range(1, len(arr)-1):%0A if sum(arr%5B:i%5D)==s... | |
d2978eae5b502cc5bc4b020044b88f02522f90cd | Add jobs.utils module | virtool/jobs/utils.py | virtool/jobs/utils.py | Python | 0.000001 | @@ -0,0 +1,155 @@
+def is_running_or_waiting(document):%0A latest_state = document%5B%22status%22%5D%5B-1%5D%5B%22state%22%5D%0A return latest_state != %22waiting%22 and latest_state != %22running%22%0A
| |
3bae93629c81cc33e565912e4b9bafeff536ec22 | Create hostgroup_info.py | examples/hostgroup_info.py | examples/hostgroup_info.py | Python | 0.000001 | @@ -0,0 +1,627 @@
+def queryHostGroupInfo():%0A %22%22%22%0A %22query host group info%22%0A %22%22%22%0A if lsf.lsb_init(%22queryHostGroupInfo%22) %3E 0:%0A return -1;%0A%0A strArr = lsf.new_stringArray(2);%0A lsf.stringArray_setitem(strArr, 0, %22hg1%22);%0A lsf.stringArray_setitem(strArr, ... | |
986b20363cc84be1822588dd7cc935fca7ef7f48 | add test for get_genofile_samplelist in marker_regression/run_mapping.py | wqflask/tests/wqflask/marker_regression/test_run_mapping.py | wqflask/tests/wqflask/marker_regression/test_run_mapping.py | Python | 0 | @@ -0,0 +1,977 @@
+import unittest%0Afrom unittest import mock%0Afrom wqflask.marker_regression.run_mapping import get_genofile_samplelist%0A%0A%0Aclass AttributeSetter:%0A%09def __init__(self,obj):%0A%09%09for k,v in obj.items():%0A%09%09%09setattr(self,k,v)%0A%0A%0Aclass MockDataSetGroup(AttributeSetter):%0A%09%0A%09... | |
fe145fd87db777d9eeb361688d502b1b3ec4b2e1 | Add a new Model-View-Projection matrix tool. | Transformation.py | Transformation.py | Python | 0 | @@ -0,0 +1,1095 @@
+# -*- coding:utf-8 -*- %0A%0A# ***************************************************************************%0A# Transformation.py%0A# -------------------%0A# update : 2013-11-13%0A# copyright : (C) 2013 by Micha%C... | |
c2089b3ed549d89942f57075d0b6d573d980bc30 | make app load in worker in uwsgi.ini, pass db configuration dynamically to docker image as env variable | app/config.py | app/config.py | Python | 0 | @@ -0,0 +1,732 @@
+from datetime import timedelta%0A%0A%0Aclass Config(object):%0A DEBUG = False%0A TESTING = False%0A SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://%7B%7D:%7B%7D@%7B%7D/%7B%7D'%0A APP_NAME = '%7B%7D Server'%0A SECRET_KEY = '%7B%7D'%0A JWT_EXPIRATION_DELTA = timedelta(days=30)%0A ... | |
2f0700093141643bd66e99d271f9e74087e148e6 | Add Message model migration file. | core/migrations/0002_message.py | core/migrations/0002_message.py | Python | 0 | @@ -0,0 +1,2633 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-08-05 19:19%0Afrom __future__ import unicode_literals%0A%0Aimport django.contrib.postgres.fields%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A depende... | |
30c5b785863df0269c7abbbc5000d83df4f815c2 | Predict some data similar to problem on assignment | outlier_detection/svm_classification_with_synthetic_data.py | outlier_detection/svm_classification_with_synthetic_data.py | Python | 0.999856 | @@ -0,0 +1,1017 @@
+import numpy as np%0Afrom matplotlib import pyplot as plt%0Aimport matplotlib.font_manager%0Afrom sklearn import svm%0A%0A%0Adef main():%0A tests = 20%0A%0A # Generate train data%0A X = (np.random.randn(120, 2) * %0A np.array(%5B0.08, 0.02%5D) + %0A np.array(%5B0.3, 0.6%... | |
7a400bc652e465d90f0212143836999a83f32eed | Make assert statement more specific (#4248) | tests/sentry/web/frontend/test_2fa.py | tests/sentry/web/frontend/test_2fa.py | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.testutils import TestCase
from sentry.models import TotpInterface
class TwoFactorAuthTest(TestCase):
def test_security_renders_without_2fa(self):
user = self.create_user('foo@example.com')
self.login... | Python | 0.000456 | @@ -3180,34 +3180,54 @@
Contains(resp, '
-QR
+Scan the below QR code
')%0A self.
@@ -3601,18 +3601,38 @@
(resp, '
-QR
+Scan the below QR code
')%0A
|
68dbfedf90fb9e6c922971deaeccad148a258a70 | Add tests for PyEcore extension (EClass/EModelElement tests) | tests/test_dynamic_ecore_extension.py | tests/test_dynamic_ecore_extension.py | Python | 0 | @@ -0,0 +1,1042 @@
+import pytest%0Afrom pyecore.ecore import *%0Aimport pyecore.ecore as ecore%0Afrom ordered_set import OrderedSet%0A%0A%0Adef test__EModelElement_extension():%0A A = EClass('A', superclass=(EModelElement.eClass))%0A a = A()%0A assert a.eAnnotations == OrderedSet()%0A%0A annotation = EAnno... | |
40431228c8535f325b005bb52485cae87a8be714 | Add test module for napalm_acl | tests/unit/modules/test_napalm_acl.py | tests/unit/modules/test_napalm_acl.py | Python | 0 | @@ -0,0 +1,1380 @@
+# -*- coding: utf-8 -*-%0A'''%0A :codeauthor: :email:%60Anthony Shaw %3Canthonyshaw@apache.org%3E%60%0A'''%0A%0A# Import Python Libs%0Afrom __future__ import absolute_import%0A%0A# Import Salt Testing Libs%0Afrom tests.support.mixins import LoaderModuleMockMixin%0Afrom tests.support.unit import T... | |
f987b39bb43301c735f30169010832665953efe6 | Add a sample permission plugin for illustrating the check on realm resources, related to #6211. | sample-plugins/public_wiki_policy.py | sample-plugins/public_wiki_policy.py | Python | 0 | @@ -0,0 +1,2047 @@
+from fnmatch import fnmatchcase%0A%0Afrom trac.config import Option%0Afrom trac.core import *%0Afrom trac.perm import IPermissionPolicy%0A%0Aclass PublicWikiPolicy(Component):%0A %22%22%22Sample permission policy plugin illustrating how to check %0A permission on realms.%0A%0A Don't forget ... | |
784cd71fe24b1f5ce57a1982186dabc768892883 | Fix discount calculation logic | saleor/product/models/discounts.py | saleor/product/models/discounts.py | from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible
from django_prices.models import PriceField
from prices import FixedDiscount
class NotApplicable(Value... | Python | 0.000106 | @@ -988,16 +988,312 @@
+from ...product.models import ProductVariant%0A if isinstance(variant, ProductVariant):%0A pk = variant.product.pk%0A check_price = variant.get_price_per_item()%0A else:%0A pk = variant.pk%0A check_price = variant.get_price_per_... |
964d01fd9a730d02aac85740bce0ef9dace6517b | add migrations | molo/core/migrations/0054_merged_cms_models.py | molo/core/migrations/0054_merged_cms_models.py | Python | 0.000001 | @@ -0,0 +1,1615 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.12 on 2017-02-21 12:13%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0Aimport modelcluster.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5... | |
17b4efb401d36060f51e07da5ace83c008d421c5 | Create table charge_observation. | problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py | problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py | Python | 0 | @@ -0,0 +1,759 @@
+%22%22%22Create table charge_observation.%0A%0ARevision ID: 2154afa58ba0%0ARevises: %0ACreate Date: 2020-01-05 12:18:25.331846%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0A# revision identifiers, used by Alembic.%0Arevision = '2154afa58ba0'%0Adown_revision = None%0Abranch... | |
841fb156fff3d257d39afdc9d3d4e587427fe2cf | Add new file missed in earlier commit place holder for projects that do not load for some reason | Source/Scm/wb_scm_project_place_holder.py | Source/Scm/wb_scm_project_place_holder.py | Python | 0 | @@ -0,0 +1,1980 @@
+'''%0A ====================================================================%0A Copyright (c) 2016 Barry A Scott. All rights reserved.%0A%0A This software is licensed as described in the file LICENSE.txt,%0A which you should have received as part of this distribution.%0A%0A =========================... | |
f1ba45809e6682235c07ab89e4bc32e56b2fa84f | Create i_love_lance_janice.py | i_love_lance_janice.py | i_love_lance_janice.py | Python | 0.000014 | @@ -0,0 +1,1978 @@
+%22%22%22%0AI Love Lance & Janice%0A=====================%0AYou've caught two of your fellow minions passing coded notes back and forth - while they're on duty, no less! Worse, you're pretty sure it's not job-related - they're both huge fans of the space soap opera %22Lance & Janice%22. You know how... | |
a08a7da41300721e07c1bff8e36e3c3d69af06fb | Add py-asdf package (#12817) | var/spack/repos/builtin/packages/py-asdf/package.py | var/spack/repos/builtin/packages/py-asdf/package.py | Python | 0 | @@ -0,0 +1,1124 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyAsdf(PythonPackage):%0A %22%22%22The Advanced Scienti... | |
6e0be0636d53e2a78c677441fbf4174042110541 | Normalize tool_name case for timing logs. | Allura/allura/lib/custom_middleware.py | Allura/allura/lib/custom_middleware.py | import os
import re
import logging
import tg
import pkg_resources
from paste import fileapp
from pylons import c
from pylons.util import call_wsgi_application
from timermiddleware import Timer, TimerMiddleware
from webob import exc, Request
import pysolr
from allura.lib import helpers as h
log = logging.getLogger(__... | Python | 0.00001 | @@ -7568,16 +7568,24 @@
ool_name
+.lower()
)%0A
|
7f4642fc2e0edba668482f2ebbb64ab8870e709a | Initialize P01_basics | books/AutomateTheBoringStuffWithPython/Chapter01/P01_basics.py | books/AutomateTheBoringStuffWithPython/Chapter01/P01_basics.py | Python | 0.000002 | @@ -0,0 +1,1466 @@
+# This program performs basic Python instructions%0A%0A# Expressions%0Aprint(2 + 2)%0Aprint(2 + 3 * 6)%0Aprint((2 + 3) * 6)%0Aprint(48565878 * 578453)%0Aprint(2 ** 8)%0Aprint(23 / 7)%0Aprint(23 // 7)%0Aprint(23 %25 7)%0Aprint(2 + 2)%0Aprint((5 - 1) * ((7 + 1) / (3 - 1)))%0A%0A# Uncommen... | |
ea6d73ac2b9274eae0a866acd1e729854c59fb17 | Add update.py to drive the update loop. | kettle/update.py | kettle/update.py | Python | 0 | @@ -0,0 +1,2065 @@
+#!/usr/bin/env python%0A%0A# Copyright 2017 The Kubernetes Authors.%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/... | |
5114f177741b105f33819b98415702e53b52eb01 | Add script to update site setup which is used at places like password reset email [skip ci] | corehq/apps/hqadmin/management/commands/update_site_setup.py | corehq/apps/hqadmin/management/commands/update_site_setup.py | Python | 0 | @@ -0,0 +1,2117 @@
+from django.core.management.base import BaseCommand, CommandError%0Afrom django.contrib.sites.models import Site%0Afrom django.conf import settings%0A%0A%0Aclass Command(BaseCommand):%0A def add_arguments(self, parser):%0A parser.add_argument(%0A 'site_address',%0A he... | |
49d0dd94c3925c3721d059ad3ee2db51d176248c | Put 80col suppression check in the right place | hooks/pre_commit_checks.py | hooks/pre_commit_checks.py | # Copyright (c) 2015 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 os
import re
import sys
import time
def _FormatError(msg, files):
return ('%s in these files:\n' % msg +
'\n'.join([' ' + x for x in file... | Python | 0 | @@ -4462,24 +4462,85 @@
eturn True%0A%0A
+ if '@suppress longLineCheck' in line:%0A return True%0A%0A
if line_
@@ -4835,69 +4835,8 @@
ue%0A%0A
- if '@suppress longLineCheck' in line:%0A return True%0A%0A
@@ -5432,9 +5432,8 @@
results%0A
-%0A
|
6fd0cee9bca0449aa6aab6a62e470ba8ff909cbb | print all caesar rotations for some string | language/rotN.py | language/rotN.py | Python | 0.031516 | @@ -0,0 +1,503 @@
+#! /usr/bin/env python%0Aimport string%0A%0Aciphered = %22LVFU XAN YIJ UVXRB RKOYOFB%22%0A%0Adef make_rot_n(n):%0A # http://stackoverflow.com/questions/3269686/short-rot13-function%0A lc = string.ascii_lowercase%0A uc = string.ascii_uppercase%0A trans = string.maketrans(lc + uc,%0A ... | |
bce076cd383d7349a397a9716feb3f6e84281078 | Make lasagne.utils.floatX support scalars and avoid copies when possible | lasagne/utils.py | lasagne/utils.py | import numpy as np
import theano
import theano.tensor as T
def floatX(arr):
"""Converts numpy array to one with the correct dtype.
Parameters
----------
arr : numpy array
The array to be converted.
Returns
-------
numpy array
The input array in the ``floatX`` dtype confi... | Python | 0 | @@ -88,16 +88,26 @@
onverts
+data to a
numpy ar
@@ -114,37 +114,41 @@
ray
-to one with the correct dtype
+of dtype %60%60theano.config.floatX%60%60
.%0A%0A
@@ -186,27 +186,26 @@
arr :
-numpy
array
+_like
%0A
@@ -209,21 +209,20 @@
The
-array
+data
to be c
@@ -262,24 +262,26 @@
-%0A nump... |
b7c3bd6c6ab5bc606b17d7bbbc3038d4b347c425 | send down indicator names in english and hindi | custom/bihar/reports/indicators/fixtures.py | custom/bihar/reports/indicators/fixtures.py | from xml.etree import ElementTree
from corehq.apps.groups.models import Group
from corehq.apps.users.models import CommCareUser
from custom.bihar.reports.indicators.indicators import IndicatorDataProvider, IndicatorConfig, INDICATOR_SETS
# meh
hard_coded_domains = ('care-bihar', 'bihar')
hard_coded_indicators = 'homev... | Python | 0 | @@ -27,16 +27,104 @@
entTree%0A
+from django.utils import translation%0Afrom django.utils.translation import ugettext as _%0A
from cor
@@ -2466,19 +2466,66 @@
ag, text
+, attrib=None
):%0A
+ attrib = attrib or %7B%7D%0A
@@ -2556,16 +2556,31 @@
ment(tag
+, attrib=attrib
)%0A
@@ -2957,16 ... |
d3dbb797575221d574fdda9c3d087d8696f6091a | Add netstring lib | lib/netstring.py | lib/netstring.py | Python | 0.000002 | @@ -0,0 +1,943 @@
+def encode_netstring(s):%0A return str(len(s)).encode('ascii') + b':' + s + b','%0A%0Adef consume_netstring(s):%0A %22%22%22If s is a bytestring beginning with a netstring, returns (value, rest)%0A where value is the contents of the netstring, and rest is the part of s%0A after the netstr... | |
9f5c3715f4b3cd5bf451bdc504cded6459e8ee79 | add one test file and add content to it | test/unit_test/test_similarity2.py | test/unit_test/test_similarity2.py | Python | 0 | @@ -0,0 +1,509 @@
+from lexos.helpers.error_messages import MATRIX_DIMENSION_UNEQUAL_MESSAGE%0A%0Acount_matrix = %5B%5B'', 'The', 'all', 'bobcat', 'cat', 'caterpillar',%0A 'day.', 'slept'%5D,%0A %5B'catBobcat', 9.0, 9.0, 5.0, 4.0, 0.0, 9.0, 9.0%5D,%0A %5B'catCaterpillar', 9.... | |
44863ff1f7064f1d9a9bb897822834eb6755ed59 | Add SMTP auth server | authserver.py | authserver.py | Python | 0.000001 | @@ -0,0 +1,529 @@
+import bcrypt%0Aimport asyncore%0Afrom secure_smtpd import SMTPServer, FakeCredentialValidator%0Afrom srht.objects import User%0A%0Aclass UserValidator(object):%0A def validate(self, username, password):%0A user = User.query.filter(User.username == username).first()%0A if not user:%0... | |
f56e390be0e2cea8e08080029aad756a6ab3c91f | Add lc0253_meeting_rooms_ii.py from Copenhagen :) | lc0253_meeting_rooms_ii.py | lc0253_meeting_rooms_ii.py | Python | 0 | @@ -0,0 +1,475 @@
+%22%22%22Leetcode 253. Meeting Rooms II (Premium)%0AMedium%0A%0AURL: https://leetcode.com/problems/meeting-rooms-ii%0A%0AGiven an array of meeting time intervals consisting of start and end times%0A%5B%5Bs1,e1%5D,%5Bs2,e2%5D,...%5D (si %3C ei),%0Afind the minimum number of conference rooms required.%... | |
8b4c34e84d306b5f9021de47bc3ae9050e2fc2b3 | Fix loading of ply files exported by meshlab | compare_clouds.py | compare_clouds.py | Python | 0 | @@ -0,0 +1,429 @@
+#!/usr/bin/env python3%0A%0Afrom pathlib import Path%0A%0A%22%22%22Code for comparing point clouds%22%22%22%0A%0Acloud1Path = Path(%22./data/reconstructions/2016_10_24__17_43_17/reference.ply%22)%0Acloud2Path = Path(%22./data/reconstructions/2016_10_24__17_43_17/high_quality.ply%22)%0A%0Afrom load_pl... | |
4f70773bb9041c44b0f83ef61a46d5fa974b366e | Create conwaytesting.py | conwaytesting.py | conwaytesting.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
0bf7d9fb20a3d2588ffc0e8341ec2af3df5fe300 | Add test for depot index page | depot/tests/test_depot_index.py | depot/tests/test_depot_index.py | Python | 0 | @@ -0,0 +1,1962 @@
+from django.test import TestCase, Client%0Afrom depot.models import Depot%0A%0A%0Adef create_depot(name, state):%0A return Depot.objects.create(name=name, active=state)%0A%0A%0Aclass DepotIndexTestCase(TestCase):%0A%0A def test_depot_index_template(self):%0A response = self.client.get('... | |
f77f9775277a100c7809698c75cb0855b07b884d | Fix accidentally added import | git/test/test_util.py | git/test/test_util.py | # test_utils.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import tempfile
from git.test.lib import (
TestBase,
assert_equal
)
from git.util import... | Python | 0 | @@ -510,22 +510,8 @@
te,%0A
- tzoffset,%0A
)%0Afr
|
2a903d721c44f9c6b53c8516b28b9dd6c1faa5e0 | Create crawler_utils.py | crawler_utils.py | crawler_utils.py | Python | 0.000017 | @@ -0,0 +1,815 @@
+import json%0Aimport os.path%0A%0A%0Adef comments_to_json(comments):%0A result = %5B%5D%0A for comment in comments:%0A result.append(%7B%22score%22: comment.score,%0A %22url%22: comment.permalink,%0A %22body%22: comment.body,%0A ... | |
d81a1f3ef63aef7f003a018f26ea636cf47cfc5d | Add init file for installation | jswatchr/__init__.py | jswatchr/__init__.py | Python | 0 | @@ -0,0 +1,23 @@
+from jswatchr import *%0A
| |
7850371982cc50dc2a5a59c7b01d5a1bec80cf3f | Add FairFuzz tool spec | benchexec/tools/fairfuzz.py | benchexec/tools/fairfuzz.py | Python | 0 | @@ -0,0 +1,2082 @@
+%22%22%22%0ABenchExec is a framework for reliable benchmarking.%0AThis file is part of BenchExec.%0ACopyright (C) 2007-2015 Dirk Beyer%0AAll rights reserved.%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License.%0AYo... | |
37db687b4167aee0e88036c5d85995de891453ed | Create cbalusek_01.py | Week01/Problem01/cbalusek_01.py | Week01/Problem01/cbalusek_01.py | Python | 0.000048 | @@ -0,0 +1,397 @@
+#This project defines a function that takes any two numbers and sums their multiples to some cutoff value%0A%0Adef sum(val1, val2, test):%0A i = 1%0A j = 1%0A cum = 0%0A while i*val1 %3C test:%0A cum += i*val1%0A i += 1%0A while j*val2 %3C test:%0A if j*val2%25val1... | |
cc79ee252e09ade17961d03265c61a87e270bd88 | Make color emoji use character sequences instead of PUA. | nototools/map_pua_emoji.py | nototools/map_pua_emoji.py | Python | 0 | @@ -0,0 +1,2256 @@
+#!/usr/bin/python%0A#%0A# Copyright 2014 Google Inc. All rights reserved.%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/lic... | |
4b0b0361ed8d231844344d014412f7b647baae0b | Remove more stray import IPy | nova/tests/network/base.py | nova/tests/network/base.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | Python | 0 | @@ -836,11 +836,15 @@
ort
-IPy
+netaddr
%0Aimp
|
2a5b7773af3e9516d8a4a3df25c0b829598ebb1c | Remove redundant str typecasting | nova/tests/uuidsentinel.py | nova/tests/uuidsentinel.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Python | 0.000009 | @@ -924,12 +924,8 @@
%5D =
-str(
self
@@ -953,17 +953,16 @@
e_uuid()
-)
%0A
|
ac673650673f7d6b9785d577499037bf9db4435a | refactor prompt abstraction | lib/smashlib/prompt.py | lib/smashlib/prompt.py | Python | 0.000003 | @@ -0,0 +1,1124 @@
+%22%22%22 smash.prompt %22%22%22%0Afrom smashlib.data import PROMPT_DEFAULT as DEFAULT%0A%0Aclass Prompt(dict):%0A%0A def __setitem__(self, k, v, update=True):%0A if k in self:%0A raise Exception,'prompt component is already present: ' + str(k)%0A super(Prompt, self).__se... | |
2c178c5ea05d2454ef6896aaf9c58b6536f5a15f | Create bubblesort.py | bubblesort.py | bubblesort.py | Python | 0.000003 | @@ -0,0 +1,451 @@
+def bubblesort(lst):%0A #from last index to second%0A for passes in range(len(lst) - 1, 0, -1):%0A #from %5B0,passes%5B keep swapping to put the largest%0A #number at index passes%0A for i in range(passes):%0A if lst%5Bi%5D %3E lst%5Bi+1%5D:%0A swa... | |
9e954d5181d36762a8c34e69516c7f5510bae5a7 | add exception class to use for mtconvert errors | oldowan/mtconvert/error.py | oldowan/mtconvert/error.py | Python | 0 | @@ -0,0 +1,345 @@
+%0Aclass MtconvertError(Exception):%0A %22%22%22Exception raised for errors in the mtconvert module.%0A%0A Attributes:%0A expression -- input expression in which the error occurred%0A message -- explanation of the error%0A %22%22%22%0A%0A def __init__(self, expression, messa... | |
3adcefcad4fc3ecb85aa4a22e8b3c4bf5ca4e6f5 | Add tests for revision updates via import | test/integration/ggrc/converters/test_import_update.py | test/integration/ggrc/converters/test_import_update.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from integration.ggrc.converters import TestCase
from ggrc import models
class TestImportUpdates(TestCase):
""" Test importing of already existing objects """
def setUp(self):
TestCase.setUp(sel... | Python | 0 | @@ -106,16 +106,63 @@
file%3E%0A%0A
+%22%22%22Tests for bulk updates with CSV import.%22%22%22%0A%0A
from int
@@ -718,16 +718,221 @@
policy%22)
+%0A revision_count = models.Revision.query.filter(%0A models.Revision.resource_type == %22Policy%22,%0A models.Revision.resource_id == policy.id%0A ).c... |
e48caa4bb61cce466ad5eb9bffbfba8e33312474 | Add Python EC2 TerminateInstances example | python/example_code/ec2/terminate_instances.py | python/example_code/ec2/terminate_instances.py | Python | 0 | @@ -0,0 +1,2520 @@
+# snippet-comment:%5BThese are tags for the AWS doc team's sample catalog. Do not remove.%5D%0A# snippet-sourcedescription:%5Bterminate_instances.py demonstrates how to terminate an Amazon EC2 instance.%5D%0A# snippet-service:%5Bec2%5D%0A# snippet-keyword:%5BAmazon EC2%5D%0A# snippet-keyword:%5BPyth... | |
34c0ca7ba0f8d2ac51583dfab4ea2f4cee7a62d5 | add script to read csv files to list | python/read_formated_txt_file/read_csv2list.py | python/read_formated_txt_file/read_csv2list.py | Python | 0 | @@ -0,0 +1,426 @@
+import csv%0A%0Adef csv_to_list(csv_file, delimiter=','):%0A %22%22%22 %0A Reads in a CSV file and returns the contents as list,%0A where every row is stored as a sublist, and each element%0A in the sublist represents 1 cell in the table.%0A %0A %22%22%22%0A with open(csv_file, '... | |
d402c25a6b257778e08e6db2890ae575432daed0 | Add new linkedlist file for intersection | linkedlist/intersection.py | linkedlist/intersection.py | Python | 0 | @@ -0,0 +1,2192 @@
+def intersection(h1, h2):%0A %22%22%22%0A This function takes two lists and returns the node they have in common, if any.%0A In this example:%0A 1 -%3E 3 -%3E 5%0A %5C%0A 7 -%3E 9 -%3E 11%0A /%0A 2 -%3E 4 -%3E 6%0A ...we would return 7.... | |
8f1cf446a0b602e6e64ccebaa794e7ec6a2f840d | add support routines for oversampling | compressible_fv4/initialization_support.py | compressible_fv4/initialization_support.py | Python | 0 | @@ -0,0 +1,534 @@
+%22%22%22Routines to help initialize cell-average values by oversampling the%0Ainitial conditions on a finer mesh and averaging down to the requested%0Amesh%22%22%22%0A%0Aimport mesh.fv as fv%0A%0Adef get_finer(myd):%0A%0A mgf = myd.grid.fine_like(4)%0A fd = fv.FV2d(mgf)%0A%0A for v in myd.n... | |
4227cef6567023717c8d66f99ce776d9d8aa0929 | Add OS::Contrail::PhysicalRouter | contrail_heat/resources/physical_router.py | contrail_heat/resources/physical_router.py | Python | 0.000001 | @@ -0,0 +1,1781 @@
+from heat.engine import properties%0Afrom vnc_api import vnc_api%0Afrom contrail_heat.resources import contrail%0Aimport uuid%0A%0A%0Aclass HeatPhysicalRouter(contrail.ContrailResource):%0A PROPERTIES = (%0A NAME,%0A ) = (%0A 'name',%0A )%0A%0A properties_schema = %7B%0A ... | |
5cebd0b56f81dfc02feb5511dade82ebf6db99ff | add presence.py | litecord/presence.py | litecord/presence.py | Python | 0.000002 | @@ -0,0 +1,1065 @@
+'''%0Apresence.py - presence management%0A%0ASends PRESENCE_UPDATE to clients when needed%0A'''%0A%0Aclass PresenceManager:%0A def __init__(self, server):%0A self.server = server%0A%0A async def update_presence(self, user_id, status):%0A '''%0A PresenceManager.update_prese... | |
02c59aa1d2eec43442f4bcf1d6662535e094bffd | add move pics by modified date | media/pic_date_move.py | media/pic_date_move.py | Python | 0 | @@ -0,0 +1,1074 @@
+'''%0AFile: pic_date_move.py%0ACreated: 2021-04-01 10:46:38%0AModified: 2021-04-01 10:46:43%0AAuthor: mcxiaoke (github@mcxiaoke.com)%0ALicense: Apache License 2.0%0A'''%0A%0Aimport os%0Aimport sys%0Aimport shutil%0Afrom datetime import date, datetime%0Aimport pathlib%0A%0A%0Adef move_one_file(src_fi... | |
3ae5dc9a4325251033d3db9cae0d80eb4812815d | Add lazy iterator | minio/lazy_iterator.py | minio/lazy_iterator.py | Python | 0.00005 | @@ -0,0 +1,1136 @@
+# Minimal Object Storage Library, (C) 2015 Minio, Inc.%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%0... | |
860f93d2bb4c08b63c64fe9e5b7b620b824d8490 | test ++/--/+ | pychecker/pychecker2/utest/ops.py | pychecker/pychecker2/utest/ops.py | Python | 0.000069 | @@ -0,0 +1,466 @@
+from pychecker2 import TestSupport%0Afrom pychecker2 import OpChecks%0A%0Aclass OpTests(TestSupport.WarningTester):%0A def testOperator(self):%0A for op in %5B'--', '++'%5D:%0A self.warning('def f(x):%5Cn'%0A ' return %25sx' %25 op,%0A ... | |
1ff7708fba64f289a957214dd089f224b74f2467 | Make exclude_from_indexes a set, and public API. (#3756) | datastore/google/cloud/datastore/entity.py | datastore/google/cloud/datastore/entity.py | # Copyright 2014 Google 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, ... | Python | 0.000001 | @@ -4546,33 +4546,32 @@
ey%0A self.
-_
exclude_from_ind
@@ -4604,16 +4604,16 @@
r_list(%0A
+
@@ -4663,16 +4663,93 @@
dexes))%0A
+ %22%22%22Names of fields which are *not* to be indexed for this entity.%22%22%22%0A
@@ -5310,25 +5310,24 @@
self.
-_
exclude_from
@@ -5344,17 +... |
cfb77bbe0c77a67c536614bf9fece1e9fcde4eb0 | make find_configs filter name more descriptive | crosscat/utils/experiment_utils.py | crosscat/utils/experiment_utils.py | import os
#
import crosscat.utils.file_utils as file_utils
import crosscat.utils.geweke_utils as geweke_utils
import crosscat.utils.general_utils as general_utils
result_filename = geweke_utils.summary_filename
writer = geweke_utils.write_result
reader = geweke_utils.read_result
runner = geweke_utils.run_geweke
def... | Python | 0.000001 | @@ -525,24 +525,28 @@
def is_
-one_deep
+this_dirname
(filepat
@@ -773,16 +773,20 @@
(is_
-one_deep
+this_dirname
, fi
|
58fee826ab5298f7de036bf320bbc109b853eec8 | Add null check for sds sync thread which can be optional | tendrl/commons/manager/__init__.py | tendrl/commons/manager/__init__.py | import abc
import logging
import six
from tendrl.commons import jobs
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class Manager(object):
def __init__(
self,
sds_sync_thread,
central_store_thread,
):
self._central_store_thread = central_store_... | Python | 0 | @@ -542,32 +542,70 @@
r_thread.stop()%0A
+ if self._sds_sync_thread:%0A
self._sd
@@ -617,32 +617,32 @@
c_thread.stop()%0A
-
self._ce
@@ -782,32 +782,70 @@
_thread.start()%0A
+ if self._sds_sync_thread:%0A
self._sd
@@ -858,32 +858,32 @@
_thread.start()%0A
-
s... |
82ccb8522f82337c9602742a62c954492784d7fc | Update forward compatibility horizon to 2019-06-13 | 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 | @@ -1139,17 +1139,17 @@
19, 6, 1
-2
+3
)%0A%0A%0A@tf_
|
20bd1d719f238de4da303b9e71a0618b64eedcf1 | Update forward compatibility horizon to 2022-03-28 | 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 | @@ -1339,9 +1339,9 @@
3, 2
-7
+8
)%0A_F
|
7601684473a5fd980e6abcd9bd1eac338b9be547 | Update forward compatibility horizon to 2022-10-07 | 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 | @@ -1339,9 +1339,9 @@
10,
-6
+7
)%0A_F
|
3437fba39d5bca77fd7627aad15ba76fb75f5731 | Update forward compatibility horizon to 2018-08-15 | 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 | @@ -1124,9 +1124,9 @@
8, 1
-4
+5
)%0A%0A%0A
|
677f5a50251ef707bef10fb1f0e3c5111e4a7297 | Update forward compatibility horizon to 2019-10-04 | 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 | @@ -1383,17 +1383,17 @@
19, 10,
-3
+4
)%0A_FORWA
|
27cce3b6708a17f813f0a82871c988fec3a36517 | Add quart to contrib (#300) | rollbar/contrib/quart/__init__.py | rollbar/contrib/quart/__init__.py | Python | 0 | @@ -0,0 +1,315 @@
+%22%22%22%0AIntegration with Quart%0A%22%22%22%0A%0Afrom quart import request%0Aimport rollbar%0A%0A%0Adef report_exception(app, exception):%0A rollbar.report_exc_info(request=request)%0A%0A%0Adef _hook(request, data):%0A data%5B'framework'%5D = 'quart'%0A%0A if request:%0A data%5B'co... | |
e5a39d4e17a0555cb242731b34f0ee480367b4fe | Add task that sends out notifications | foireminder/foireminder/reminders/tasks.py | foireminder/foireminder/reminders/tasks.py | Python | 0.999047 | @@ -0,0 +1,450 @@
+from django.utils import timezone%0A%0Afrom .models import ReminderRequest, EmailReminder%0A%0A%0Adef send_todays_notifications(self):%0A today = timezone.now()%0A reminders = ReminderRequest.objects.filter(%0A start__year=today.year,%0A start__month=today.month,%0A start__... | |
9efda5a5a2b7aa16423e68fb10e1a0cb94c1f33e | Create rectangles_into_squares.py | rectangles_into_squares.py | rectangles_into_squares.py | Python | 0.999056 | @@ -0,0 +1,335 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Rectangles into Squares%0A#Problem level: 6 kyu%0A%0Adef sqInRect(lng, wdth):%0A if lng==wdth: return None%0A li=%5B%5D%0A while lng and wdth:%0A if lng%3Ewdth:%0A lng-=wdth%0A li.append(wdth)%0A else:... | |
c5fc38749dcf966787f6c6a201e23c310a22358c | Add script to update UniProt protein names | src/main/resources/org/clulab/reach/update_uniprot.py | src/main/resources/org/clulab/reach/update_uniprot.py | Python | 0 | @@ -0,0 +1,3386 @@
+import os%0Aimport re%0Aimport csv%0Aimport requests%0Aimport itertools%0Afrom gilda.generate_terms import parse_uniprot_synonyms%0A%0A%0A# Base URL for UniProt%0Auniprot_url = 'http://www.uniprot.org/uniprot'%0A# Get protein names, gene names and the organism%0Acolumns = %5B'id', 'protein%2520names... | |
aeadfbd4ae1f915291328f040cda54f309743024 | Add main application code | oline-gangnam-style.py | oline-gangnam-style.py | Python | 0.000001 | @@ -0,0 +1,480 @@
+from jinja2 import Environment, FileSystemLoader%0A%0Aimport json%0Aimport os%0Aimport sys%0A%0Aenv = Environment(loader=FileSystemLoader(%22.%22))%0Atemplate = env.get_template('ircd.conf.jinja')%0A%0Aconfig = %7B%7D%0A%0Awith open(sys.argv%5B1%5D if len(sys.argv) %3E 1 else %22config.json%22, %22r%... | |
7a6b5396ce760eaa206bfb9b556a374c9c17f397 | Add DecisionTree estimator. | bike-sharing/2-decision-tree.py | bike-sharing/2-decision-tree.py | Python | 0 | @@ -0,0 +1,2879 @@
+import math%0Aimport argparse%0Afrom datetime import datetime%0Aimport numpy as np%0Afrom sklearn import cross_validation%0Afrom sklearn import tree%0Afrom sklearn import metrics%0A%0Adef load_data(path, **kwargs):%0A return np.loadtxt(path, **kwargs)%0A%0Adef save_data(path, data, **kwargs):%0A ... | |
c58c58d5bf1394e04e30f5eeb298818558be027f | Add directory for tests of rules removin | tests/rules_tests/clearAfterNonTermRemove/__init__.py | tests/rules_tests/clearAfterNonTermRemove/__init__.py | Python | 0 | @@ -0,0 +1,111 @@
+#!/usr/bin/env python%0A%22%22%22%0A:Author Patrik Valkovic%0A:Created 17.08.2017 22:06%0A:Licence GNUv3%0APart of grammpy%0A%0A%22%22%22
| |
9a7091c1502b9758c1492a1c99ace7d4ad74026c | move integer_divions to syntax | tests/pyccel/parser/scripts/syntax/integer_division.py | tests/pyccel/parser/scripts/syntax/integer_division.py | Python | 0.000022 | @@ -0,0 +1,59 @@
+5 // 3%0Aa // 3%0A5 // b%0Aa // b%0A%0A5.// 3.%0Aa // 3.%0A5.// b%0Aa // b%0A
| |
17e0b81463e3c4c9b62f95f40912b270652a8e63 | Create new package (#6376) | var/spack/repos/builtin/packages/r-ggridges/package.py | var/spack/repos/builtin/packages/r-ggridges/package.py | Python | 0 | @@ -0,0 +1,1825 @@
+##############################################################################%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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.