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 |
|---|---|---|---|---|---|---|---|
0abb8f6d266408f20c751726460ae2d87f307583 | solve 1 problem | solutions/factorial-trailing-zeroes.py | solutions/factorial-trailing-zeroes.py | Python | 0.000027 | @@ -0,0 +1,667 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A%22%22%22%0Afactorial-trailing-zeroes.py%0A %0ACreated by Shuailong on 2016-02-21.%0A%0Ahttps://leetcode.com/problems/factorial-trailing-zeroes/.%0A%0A%22%22%22%0A%0Aclass Solution(object):%0A def trailingZeroes(self, n):%0A %22%22%22%0A ... | |
c8fa91104d712bf2743b07b5edd5f38a040d6507 | Add unit tests for invoke_post_run | st2common/tests/unit/test_runners_utils.py | st2common/tests/unit/test_runners_utils.py | Python | 0 | @@ -0,0 +1,2762 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (the %2... | |
8977f320979998c9f18cfa7629c1811c7082dddf | Add setup.py (sigh) | setup.py | setup.py | Python | 0 | @@ -0,0 +1,700 @@
+import setuptools%0A%0Awith open(%22README.md%22, %22r%22) as fh:%0A long_description = fh.read()%0A%0Asetuptools.setup(%0A name=%22webxpath%22, # Replace with your own username%0A version=%220.0.2%22,%0A author=%22Shiplu Mokaddim%22,%0A author_email=%22shiplu@mokadd.im%22,%0A desc... | |
9af2c53af417295842f8ae329a8bb8abc99f693d | add setup.py file | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,165 @@
+#!/usr/bin/env python%0Afrom distutils.core import setup%0A%0Asetup(%0A name = 's7n-blog',%0A version = %221a1%22,%0A packages = %5B's7n', 's7n.blog'%5D,%0A )%0A
| |
1695dd95ee7750e355ac64d527ff75fb5ecbbdc7 | Remove unnecessary reparameterization_type specification for tf.distributions.Exponential. | tensorflow/python/ops/distributions/exponential.py | tensorflow/python/ops/distributions/exponential.py | # Copyright 2016 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.000016 | @@ -3581,149 +3581,8 @@
me)%0A
- # While the Gamma distribution is not reparameterizable, the exponential%0A # distribution is.%0A self._reparameterization_type = True%0A
|
e1be390ab7a90d1efdb75a0b2e04c6414645a23c | Create setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,1643 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%0Atry:%0A from setuptools import setup%0Aexcept ImportError:%0A from distutils.core import setup%0A%0A%0Awith open('README.rst') as readme_file:%0A readme = readme_file.read()%0A%0Awith open('HISTORY.rst') as history_file:%0A history ... | |
a4b9e5849fdff1875a36116c1c6948c1621990fe | rename gcp -> gcloud | setup.py | setup.py | from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
import os
import sys
# Kept manually in sync with airflow.__version__
version = '1.6.2'
class Tox(TestCommand):
user_options = [('tox-args=', None, "Arguments to pass to tox")]
def initialize_options... | Python | 0.000003 | @@ -1359,17 +1359,20 @@
2.1'%5D%0Agc
-p
+loud
= %5B%0A
@@ -3676,15 +3676,21 @@
'gc
-p
+loud
': gc
-p
+loud
,%0A
|
18c0682306ee383d0eaad467d8fd7c9f74bb6e4f | add setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,333 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Afrom setuptools import setup # , find_packages%0A%0Asetup(%0A name='pyoptwrapper',%0A version='1.0',%0A description='wrapper to pyopt',%0A author='Andrew Ning',%0A author_email='aning@byu.edu',%0A py_modules=%5B'pyoptwrapper'%5D,%0A ... | |
a03fa3d725f296d3fa3fda323171924671ec65c0 | add setup.py for setuptools support | setup.py | setup.py | Python | 0 | @@ -0,0 +1,554 @@
+from setuptools import setup, find_packages%0A%0Asetup(%0A name='mtools', %0A version='1.0.0',%0A packages=find_packages(),%0A scripts=%5B'scripts/mlaunch','scripts/mlog2json','scripts/mlogdistinct',%0A 'scripts/mlogfilter','scripts/mlogmerge','scripts/mlogversion',%0A 'scri... | |
b106d4fdaf1667061879dd170ddeec1bde2042aa | Add setup.py. | setup.py | setup.py | Python | 0 | @@ -0,0 +1,325 @@
+from distutils.core import setup%0A%0Asetup(name='twittytwister',%0A version='0.1',%0A description='Twitter client for Twisted Python',%0A author='Dustin Sallings',%0A author_email='dustin@spy.net',%0A url='http://github.com/dustin/twitty-twister/',%0A license='MIT',%0A platforms... | |
3ab1c4c28f816d0c6495ce5d7b14b854ec77f754 | Setting version number to 0.2.0 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
class UltraMagicString(object):
'''
Taken from
http://stackoverflow.com/questions/1162338/whats-the-right-way-to-use-unicode-metadata-in-setup-py
'''
def __init__(self, value):
self.value = value
... | Python | 0.999493 | @@ -723,12 +723,8 @@
.2.0
-pre1
',%0A
|
8ee80a5e346d5b952f3abacc21878da14c13c9f5 | Make app an owner of file formats. | setup.py | setup.py | # coding=utf-8
import sys
import os
if sys.platform.startswith('darwin'):
from setuptools import setup
APP = ['Cura/cura.py']
DATA_FILES = ['Cura/LICENSE', 'Cura/resources/images', 'Cura/resources/meshes', 'Cura/resources/example/', 'Cura/resources/firmware/']
PLIST = {
u'CFBundleName': u'Cura... | Python | 0 | @@ -787,25 +787,21 @@
ank': u'
-Alternate
+Owner
',%0A
@@ -996,33 +996,29 @@
lerRank': u'
-Alternate
+Owner
'%0A
@@ -1305,17 +1305,13 @@
: u'
-Alternate
+Owner
'%0A
|
dcedefebd46a80f18372e045e3e4869bb4c88d89 | Remove all tests from setup.py except those of gloo.gl | setup.py | setup.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
""" Vispy setup script.
Steps to do a new release:
Preparations:
* Test on Windows, Linux, Mac
* Make release notes
* Update API documentation and other docs that need... | Python | 0 | @@ -2352,16 +2352,17 @@
y.app',
+#
'vispy.a
@@ -2364,32 +2364,32 @@
spy.app.tests',%0A
-
'vispy.a
@@ -2424,16 +2424,17 @@
.gloo',
+#
'vispy.g
@@ -2516,16 +2516,17 @@
scene',
+#
'vispy.s
@@ -2653,24 +2653,24 @@
y.shaders',%0A
-
'vis
@@ -2675,24 +2675,25 @@
ispy.util',
+#
'vispy.util.
|
e0efdff7380101437c75ce6a50dd93302a3315e2 | Increase version dependency. | setup.py | setup.py | from setuptools import setup, find_packages
version='0.9'
setup(
name='pyres',
version=version,
description='Python resque clone',
author='Matt George',
author_email='mgeorge@gmail.com',
maintainer='Matt George',
license='MIT',
url='http://github.com/binarydud/pyres',
packages=f... | Python | 0 | @@ -41,13 +41,9 @@
ges%0A
-
%0A
+
vers
@@ -603,17 +603,16 @@
worker',
-
%0A
@@ -632,17 +632,16 @@
es_web',
-
%0A
@@ -791,17 +791,17 @@
'redis
-=
+%3E
=1.34.1'
@@ -1166,9 +1166,10 @@
thon'%5D,%0A
-
)
+%0A
|
8781799d2511dbafa7b11f2f8fb45356031a619b | Bump the sqlalchemy-citext version requirement | setup.py | setup.py | #!/usr/bin/env python
# Copyright 2013 Donald Stufft
#
# 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 ag... | Python | 0.000001 | @@ -1963,17 +1963,17 @@
text%3E=1.
-1
+2
.0%22,%0A
|
18d899f36a140e677637118039e245127b0d138a | remove the long description | setup.py | setup.py | from os.path import dirname, join
from setuptools import setup, find_packages
from tvrenamr import get_version
def fread(fname):
return open(join(dirname(__file__), fname)).read()
setup(
name = 'tvrenamr',
version = get_version(),
description = 'Rename tv show files using online databases',
long_... | Python | 1 | @@ -1,38 +1,4 @@
-from os.path import dirname, join%0A
from
@@ -76,82 +76,8 @@
on%0A%0A
-def fread(fname):%0A return open(join(dirname(__file__), fname)).read()%0A%0A
setu
@@ -200,57 +200,8 @@
s',%0A
- long_description = fread('README.markdown'),%0A
|
934e73247156b28d919957d738d8a5b03e403160 | Add setup.py. | setup.py | setup.py | Python | 0 | @@ -0,0 +1,342 @@
+%22%22%22%0Asetup.py for simple_img_gallery.%0A%22%22%22%0A%0Afrom distutils.core import setup%0A%0Asetup(name=%22simple_img_gallery%22,%0A version=%220.0.1%22,%0A description=%22Simple image gallery generation.%22,%0A author=%22Pete Florence%22,%0A author_email=%22%22,%0A ur... | |
52f679b0485a10176e0ac71dfbe0940baf4171ef | Update setup.py classifiers and imports [ci skip] | setup.py | setup.py | #!/usr/bin/env python
# Don't use __future__ in this script, it breaks buildout
# from __future__ import print_function
import os
import subprocess
import sys
import shutil
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.test import test as TestCommand... | Python | 0 | @@ -128,26 +128,8 @@
os%0A
-import subprocess%0A
impo
@@ -4374,16 +4374,75 @@
MacOS',%0A
+ 'Operating System :: MacOS :: MacOS X',%0A
|
ff5c68ccd566ba388f919bb663c5055685be3070 | Add initial setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,705 @@
+#!/usr/bin/env python%0A%0Afrom setuptools import setup%0A%0Asetup(%0A name='mdx_picture',%0A version='1.0',%0A author='Artem Grebenkin',%0A author_email='speechkey@gmail.com',%0A description='Python-Markdown extension supports the %3Cpicture%3E tag.',%0A url='http://www.artemgreben... | |
6972c0a6fc0431c7e41b110ea8c41dd9a4ed076c | Add distutils setup script | setup.py | setup.py | Python | 0 | @@ -0,0 +1,375 @@
+#!/usr/bin/env python3%0A%0Afrom distutils.core import setup%0A%0Asetup(%0A%09name='python-fsb5',%0A%09version='1.0',%0A%09author='Simon Pinfold',%0A%09author_email='simon@uint8.me',%0A%09description='Library and to extract audio from FSB5 (FMOD Sample Bank) files',%0A%09download_url='https://github.... | |
0bf30432084a5b6e71ea2ac36af165f7c4cee133 | Add setup.py | setup.py | setup.py | Python | 0.000001 | @@ -0,0 +1,920 @@
+#!/usr/bin/env python%0A%0Afrom setuptools import setup%0A%0Asetup(name='acapi',%0A version='0.1',%0A description='Acquia Cloud API client.',%0A author='Dave Hall',%0A author_email='me@davehall.com.au',%0A url='http://github.com/skwashd/python-acquia-cloud',%0A ... | |
3a235f8525ae89ae91c333f7cd10ed307c33011c | Exclude local data from package. | setup.py | setup.py |
from setuptools import setup, find_packages
setup(
name = "django-forms-builder",
version = __import__("forms_builder").__version__,
author = "Stephen McDonald",
author_email = "stephen.mc@gmail.com",
description = ("A Django reusable app providing the ability for admin "
"users to create... | Python | 0 | @@ -3,56 +3,611 @@
rom
-setuptools import setup, find_packages%0A%0A%0Asetup(%0A
+__future__ import with_statement%0Aimport os%0Afrom setuptools import setup, find_packages%0A%0A%0Aexclude = %5B%22forms_builder/example_project/dev.db%22,%0A %22forms_builder/example_project/local_settings.py%22%5D%0Aexclude ... |
0cdc580b5021448497ba78fce2e93f45500c2e24 | version bump | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='withings',
version='0.2',
description="Library for the Withings API",
author='Maxime Bouroumeau-Fuseau',
author_email='maxime.bouroumeau@gmail.com',
url="https://github.com/maximebf/python-withings",
license = "MIT License",
... | Python | 0.000001 | @@ -92,9 +92,9 @@
='0.
-2
+3
',%0A
|
3aa467f1af903e9c21029c50519c4986cea66fee | remove comment | corehq/apps/app_manager/detail_screen.py | corehq/apps/app_manager/detail_screen.py | from corehq.apps.app_manager import suite_xml as sx, xform
def get_column_generator(app, module, detail, column):
return get_class_for_format(column.format)(app, module, detail, column)
def get_class_for_format(slug):
return get_class_for_format._format_map.get(slug, FormattedDetailColumn)
get_class_for_forma... | Python | 0 | @@ -3493,697 +3493,8 @@
n 0%0A
-%22%22%22%0A%7Bvalue: %22plain%22, label: DetailScreenConfig.message.PLAIN_FORMAT%7D,%0A%7Bvalue: %22date%22, label: DetailScreenConfig.message.DATE_FORMAT%7D,%0A%7Bvalue: %22time-ago%22, label: DetailScreenConfig.message.TIME_AGO_FORMAT%7D,%0A%7Bvalue: %22phone%22, label: DetailScreenC... |
207116ee7ba8d8da521f497997da90066831a551 | Add codemod to replace __unicode__ with __str__ | django3_codemods/replace_unicode_with_str.py | django3_codemods/replace_unicode_with_str.py | Python | 0.000001 | @@ -0,0 +1,251 @@
+import sys%0A%0Afrom bowler import Query%0A%0A%0A(%0A Query(sys.argv%5B1%5D)%0A .select_function(%22__unicode__%22)%0A .rename('__str__')%0A .idiff()%0A),%0A(%0A Query(sys.argv%5B1%5D)%0A .select_method(%22__unicode__%22)%0A .is_call()%0A .rename('__str__')%0A .idiff()%0A)%... | |
d85a68e36443bfcdeed2d8f1f3960d1596ef762a | Create catchtheball.py | catchtheball.py | catchtheball.py | Python | 0.000007 | @@ -0,0 +1,1325 @@
+import simplegui%0Aimport random%0A%0AFRAME_WIDTH=STAGE_WIDTH=GROUND_WIDTH=821%0AFRAME_HEIGHT=498%0ASTAGE_HEIGHT=FRAME_HEIGHT-30%0APADDLE_HEIGHT=STAGE_HEIGHT%0APADDLE_WIDTH=8%0APADDLE_POS=%5BSTAGE_WIDTH/2,PADDLE_HEIGHT%5D%0A%0Aimage=simplegui.load_image(%22http://mrnussbaum.com/calendarclowns1/image... | |
54bb69cd3646246975f723923254549bc5f11ca0 | Add default paver commands | citools/paver.py | citools/paver.py | Python | 0.000001 | @@ -0,0 +1,1786 @@
+@task%0A@consume_args%0A@needs('unit', 'integrate')%0Adef test():%0A %22%22%22 Run whole testsuite %22%22%22%0A%0Adef djangonize_test_environment(test_project_module):%0A%0A sys.path.insert(0, abspath(join(dirname(__file__))))%0A sys.path.insert(0, abspath(join(dirname(__file__), %22tests%2... | |
0878c9224af57eea17c9b2c7f01d5fb0f5cfecfa | fix some pylint hints | utils/oscap_docker_python/get_cve_input.py | utils/oscap_docker_python/get_cve_input.py | # Copyright (C) 2015 Brent Baude <bbaude@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This l... | Python | 0.000005 | @@ -2410,16 +2410,20 @@
s due to
+ %7B0%7D
%22%0A
@@ -4189,32 +4189,33 @@
last-modified'%5D%0A
+%0A
except u
@@ -4219,17 +4219,16 @@
t urllib
-2
.HTTPErr
@@ -4382,16 +4382,23 @@
+
%22 attrib
@@ -4439,16 +4439,23 @@
%7B1%7D%5Cn%22%0A
+
@@ -5847,20 +5847,16 @@
.di... |
0575a141153fb07a5f03c0681cdf727450348fc0 | Create space.py | space.py | space.py | Python | 0.001193 | @@ -0,0 +1,728 @@
+def ParentOf(n, arr):%0A if arr%5Bn%5D == n:%0A return n%0A else:%0A return ParentOf(arr%5Bn%5D,arr)%0A%0An, p = list(map(int, input().split()))%0Aarr = %5B%5D%0Afor t in range(0,n):%0A arr.append(t)%0A%0Afor q in range(p):%0A #Quick Union the line%0A first, sec = list(ma... | |
3c074ab5c630590ca32f8951eecb3087afd8ae01 | add solution for Binary Tree Level Order Traversal II | src/binaryTreeLevelOrderTraversalII.py | src/binaryTreeLevelOrderTraversalII.py | Python | 0 | @@ -0,0 +1,660 @@
+# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return a list of lists of integers%0A%0A def levelOrderBotto... | |
79cf7834c4a92f84c3595af302c7b0bfa09331f2 | word2vec basic | Experiments/Tensorflow/Neural_Networks/logic_gate_linear_regressor.py | Experiments/Tensorflow/Neural_Networks/logic_gate_linear_regressor.py | Python | 0.999103 | @@ -0,0 +1,2603 @@
+'''%0ALogical Operation by 2-layer Neural Networks (using TF Layers) on TensorFlow%0AAuthor: Rowel Atienza%0AProject: https://github.com/roatienza/Deep-Learning-Experiments%0A'''%0A# On command line: python3 logic_gate_linear_regressor.py%0A# Prerequisite: tensorflow 1.0 (see tensorflow.org)%0A%0Afr... | |
f22b6368bdfe91cff06ede51c1caad04f769b437 | add management command to load location type into supply point | custom/colalife/management/commands/load_location_type_into_supply_point.py | custom/colalife/management/commands/load_location_type_into_supply_point.py | Python | 0 | @@ -0,0 +1,603 @@
+from corehq.apps.commtrack.models import SupplyPointCase%0Afrom corehq.apps.locations.models import Location%0Afrom django.core.management import BaseCommand%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Store location type with supply point.'%0A%0A def handle(self, *args, **options):%0A ... | |
3e02fe79f4fad6f5252af750a13d74d7a4f82cc5 | read in the file, probably badly | src/emc/usr_intf/touchy/filechooser.py | src/emc/usr_intf/touchy/filechooser.py | # Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Touchy i... | Python | 0.000001 | @@ -1788,37 +1788,13 @@
-self.emccommand.program_open(
+fn =
os.p
@@ -1838,16 +1838,135 @@
_text())
+%0A f = file(fn, 'r')%0A self.lines = f.readlines()%0A f.close()%0A self.emccommand.program_open(fn
)%0A
|
37793ec10e2b27e64efaa3047ae89a6d10a6634d | Update urlrewrite_redirect.py | flexget/plugins/urlrewrite_redirect.py | flexget/plugins/urlrewrite_redirect.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('urlrewrite_redirect')
class UrlRewriteRedirect(object):
"""Rewrites urls which actually redirect somewhere else."""
def __init__(self):
... | Python | 0 | @@ -783,16 +783,243 @@
return%0A
+ auth = None%0A if 'download_auth' in entry:%0A auth = entry%5B'download_auth'%5D%0A log.debug('Custom auth enabled for %25s url_redirect: %25s' %25 (entry%5B'title'%5D, entry%5B'download_auth'%5D))%0A
@@ -1057,16 +1057,27... |
e4ca040124e26b06a11e7fb51c3622a213285d24 | Create thresholding.py | thresholding.py | thresholding.py | Python | 0 | @@ -0,0 +1,974 @@
+import numpy as np%0Afrom PIL import Image%0A%0Adef discretize(a):%0A return np.uint8((a %3E 50)*255)%0A%0Aimage_id = 101%0Adirty_image_path = %22../input/train/%25d.png%22 %25 image_id%0Aclean_image_path = %22../input/train_cleaned/%25d.png%22 %25 image_id%0A%0Adirty = Image.open(dirty_image_path... | |
d78444cdb6018e2fe49905638ce7645e8de5738b | add util/csv_melt.py | util/csv_melt.py | util/csv_melt.py | Python | 0.000008 | @@ -0,0 +1,2492 @@
+#!/usr/bin/env python%0A# https://github.com/shenwei356/bio_scripts%22%0Aimport argparse%0Aimport csv%0Aimport re%0Aimport sys%0Aimport pandas as pd%0A%0Aparser = argparse.ArgumentParser(%0A description=%22Melt CSV file, you can append new column%22,%0A epilog=%22https://github.com/shenwei356/... | |
377c61203d2e684b9b8e113eb120213e85c4487f | Fix call to super() (#19279) | homeassistant/components/light/lutron.py | homeassistant/components/light/lutron.py | """
Support for Lutron lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.lutron/
"""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
from homeassistant.components.lutron import (
... | Python | 0 | @@ -1290,38 +1290,32 @@
uper().__init__(
-self,
area_name, lutro
@@ -2391,23 +2391,8 @@
= %7B
-%7D%0A attr%5B
'lut
@@ -2414,11 +2414,9 @@
_id'
-%5D =
+:
sel
@@ -2434,16 +2434,17 @@
evice.id
+%7D
%0A
|
0b1fc2eb8dad6e5b41e80c5b0d97b9f8a20f9afa | Add utils.py | krcurrency/utils.py | krcurrency/utils.py | Python | 0.000004 | @@ -0,0 +1,480 @@
+%22%22%22:mod:%60krcurrency.utils%60 --- Helpers%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A%22%22%22%0Afrom bs4 import BeautifulSoup as BS%0Aimport requests%0A%0A__all__ = 'request',%0A%0Adef request(url, encoding='utf-8', parselib='lxml'):%0A %22%22%22url%EB%A1%9C %EC%9A%94%EC%B2%AD%ED%95%9C ... | |
76a2c80b015228dd4c6aa932ca9b2faece23a714 | Create multiplesof3and5.py | multiplesof3and5.py | multiplesof3and5.py | Python | 0.998635 | @@ -0,0 +1,311 @@
+#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. %0A#The sum of these multiples is 23.%0A#Find the sum of all the multiples of 3 or 5 below 1000.%0A%0Aanswer = 0%0A%0Afor i in range (1,1000);%0A if i%253 = 0 or i%255 = 0;%0A answer = answer + i%0A ... | |
2d1624f088431e5f71214988499f732695a82b16 | Bump version 0.15.0rc3 --> 0.15.0rc4 | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.15.0rc3"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| Python | 0 | @@ -36,9 +36,9 @@
.0rc
-3
+4
%22%0Ave
|
5dd4deba3d5a53406e735aadad5ac917919b3852 | add tests for PlotableObject | tests/unit/TestPlotableObject.py | tests/unit/TestPlotableObject.py | Python | 0 | @@ -0,0 +1,2155 @@
+import os%0Aimport unittest%0A%0Aimport ROOT%0Afrom PyAnalysisTools.PlottingUtils import PlotableObject as po%0A%0Acwd = os.path.dirname(__file__)%0AROOT.gROOT.SetBatch(True)%0A%0A%0Aclass TestPlotableObject(unittest.TestCase):%0A def test_ctor(self):%0A obj = po.PlotableObject()%0A ... | |
f0651b2b68ecb4ac093a07d72722b65ea134baa9 | Remove trailing slashes. | pelican/__init__.py | pelican/__init__.py | import argparse
import os
from pelican.settings import read_settings
from pelican.utils import clean_output_dir
from pelican.writers import Writer
from pelican.generators import (ArticlesGenerator, PagesGenerator,
StaticGenerator, PdfGenerator)
def init_params(settings=None, path=Non... | Python | 0.000005 | @@ -207,17 +207,16 @@
nerator,
-
%0A
@@ -344,17 +344,16 @@
th=None,
-
%0A
@@ -1815,17 +1815,16 @@
p, keep)
-
%0A
|
854a1ab7c13b4d4d8e28ab13f0cdaef5c1fcb9a6 | Create solution.py | hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py | hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py | Python | 0.000018 | @@ -0,0 +1,413 @@
+#!/bin/python3%0A%0Aimport sys%0A%0Acmp = lambda a, b: (a %3E b) - (b %3E a)%0A%0AaliceScores = tuple(map(int, input().strip().split(' ')))%0AbobScores = tuple(map(int, input().strip().split(' ')))%0A%0AscoreCmp = tuple(map(lambda a, b: cmp(a, b), aliceScores, bobScores))%0AaliceScore =... | |
4764b5248cf91042a12ce6aef77a04c37360eb4f | Add initial shell of Pyglab class. | pyglab/pyglab.py | pyglab/pyglab.py | Python | 0 | @@ -0,0 +1,365 @@
+import requests%0A%0A%0Aclass Pyglab(object):%0A def __init__(self, token):%0A self.token = token%0A self.headers = %7B'PRIVATE-TOKEN', token%7D%0A self.user = None%0A%0A def sudo(self, user):%0A %22%22%22Permanently set a different username. Returns the old username... | |
70e04b20c5d78b41546aa4ea1a1e2fd82af7527f | Add JSON HttpResponse that does the encoding for you. | comrade/http/__init__.py | comrade/http/__init__.py | Python | 0 | @@ -0,0 +1,573 @@
+from django.core.serializers import json, serialize%0Afrom django.db.models.query import QuerySet%0Afrom django.http import HttpResponse%0Afrom django.utils import simplejson%0A%0Aclass HttpJsonResponse(HttpResponse):%0A def __init__(self, object, status=None):%0A if isinstance(object, Quer... | |
d3ba2b8cf84ba54d932fcc48b464f125798c0b27 | Add simple bash with git install script | toolbox/install_script_git.sh.py | toolbox/install_script_git.sh.py | Python | 0 | @@ -0,0 +1,587 @@
+#!/bin/bash%0Avenv=%22nephoria_venv%22%0Aneph_branch=%22oldboto%22%0Aadminapi_branch=%22master%22%0Ayum install -y python-devel gcc git python-setuptools python-virtualenv%0Aif %5B ! -d adminapi %5D; then%0A git clone https://github.com/nephomaniac/adminapi.git%0Afi%0Aif %5B ! -d nephoria %5D; the... | |
5ae194cacef0a24c3d6a0714d3f435939973b3cb | Add some helpful utilities | utils.py | utils.py | Python | 0 | @@ -0,0 +1,478 @@
+from functools import wraps%0A%0A%0Adef cached_property(f):%0A name = f.__name__%0A @property%0A @wraps(f)%0A def inner(self):%0A if not hasattr(self, %22_property_cache%22):%0A self._property_cache = %7B%7D%0A if name not in self._property_cache:%0A se... | |
93b1253389075174fa942e848d6c1f7666ffc906 | add solution for Combination Sum II | src/combinationSumII.py | src/combinationSumII.py | Python | 0.000001 | @@ -0,0 +1,704 @@
+class Solution:%0A # @param candidates, a list of integers%0A # @param target, integer%0A # @return a list of lists of integers%0A%0A def combinationSum2(self, candidates, target):%0A if not candidates:%0A return %5B%5D%0A candidates.sort()%0A n = len(candi... | |
19d5b2f58d712f49638dad83996f9e60a6ebc949 | Add a release script. | release.py | release.py | Python | 0 | @@ -0,0 +1,837 @@
+#!/usr/bin/env python%0Aimport re%0Aimport ast%0Aimport subprocess%0A%0Adef version():%0A _version_re = re.compile(r'__version__%5Cs+=%5Cs+(.*)')%0A%0A with open('pgcli/__init__.py', 'rb') as f:%0A version = str(ast.literal_eval(_version_re.search(%0A f.read().decode('utf-8'))... | |
7d2906d58db373f5f7326c140e8cb191bc3d0059 | Make other logging work when logging/config_file is in use | mopidy/utils/log.py | mopidy/utils/log.py | from __future__ import unicode_literals
import logging
import logging.config
import logging.handlers
class DelayedHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self._released = False
self._buffer = []
def handle(self, record):
if not self._relea... | Python | 0 | @@ -797,16 +797,265 @@
(True)%0A%0A
+ if config%5B'logging'%5D%5B'config_file'%5D:%0A # Logging config from file must be read before other handlers are%0A # added. If not, the other handlers will have no effect.%0A logging.config.fileConfig(config%5B'logging'%5D%5B'config_file'%5D)%0A%0A
s... |
0003b3fe31a1b92dda994b2f7eacf6cef7e08ce4 | Add check_blocked.py | check_blocked.py | check_blocked.py | Python | 0.000002 | @@ -0,0 +1,2613 @@
+# This script is licensed under the GNU Affero General Public License%0A# either version 3 of the License, or (at your option) any later%0A# version.%0A#%0A# This script was tested on GNU/Linux opreating system.%0A#%0A# To run this script:%0A# 1) Download the list of articles for the Wikipedia edi... | |
9b3e0c7eb28a67e2383cad6cbfa97fc4fd575756 | Add error classification | classify_logs.py | classify_logs.py | Python | 0.000002 | @@ -0,0 +1,1387 @@
+import re%0Aimport yaml%0A%0Aerror_types = %5B%22no package found%22,%0A %22unclassified%22%5D%0A%0A%0Adef classify_build_log(log_file):%0A %22%22%22%0A Takes a build log file object as an input and returns%0A a tupe %60(category, sub-category, sub-category)%60%0A%0A - miss... | |
aafa99714eff3c5021594ae5021bdd47b41c9c6b | save tpl environs after invoke shell constructor | assets/save_tpl_envs.py | assets/save_tpl_envs.py | Python | 0 | @@ -0,0 +1,352 @@
+# -*- coding:utf-8 -*-%0A%0Aimport os%0Aimport sys%0Aimport json%0A%0A%0Adef save_tpl_envs(path):%0A envs = %7B%7D%0A for key, value in os.environ.items():%0A if key.startswith('TPL_'):%0A envs%5Bkey%5B4:%5D%5D = value%0A with open(path, 'w') as fd:%0A fd.write(json.... | |
af9b0ee39d18ca174b19143bdda0d478c4d5a834 | add a driver for hourly reporting | scripts/iemre/rerun_hourly.py | scripts/iemre/rerun_hourly.py | Python | 0 | @@ -0,0 +1,255 @@
+import mx.DateTime%0Aimport stage4_hourlyre%0A%0Asts = mx.DateTime.DateTime(2010,5,1)%0Aets = mx.DateTime.DateTime(2010,5,13)%0Ainterval = mx.DateTime.RelativeDateTime(hours=1)%0Anow = sts%0Awhile now %3C ets:%0A print now%0A stage4_hourlyre.merge( now )%0A now += interval%0A
| |
0920a23a72e1e14179b75b4d2a50e956ee9deec0 | add skeleton generation file | disaggregator/generate.py | disaggregator/generate.py | Python | 0.000005 | @@ -0,0 +1,163 @@
+from appliance import ApplianceTrace%0Afrom appliance import ApplianceInstance%0Afrom appliance import ApplianceSet%0Afrom appliance import ApplianceType%0A%0Aimport fhmm%0A%0A%0A
| |
8ccab210054c2776a36b7e3648fa1e27eb49a27b | add deeplearning cross-validation NOPASS. PUBDEV-1696. | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | Python | 0 | @@ -0,0 +1,2302 @@
+import sys%0Asys.path.insert(1, %22../../../%22)%0Aimport h2o%0Aimport random%0A%0Adef cv_carsDL(ip,port):%0A # Connect to h2o%0A h2o.init(ip,port)%0A%0A # read in the dataset and construct training set (and validation set)%0A cars = h2o.import_frame(path=h2o.locate(%22smalldata/junit/c... | |
85a17f8a483c072192d9d267ca4a8c5e8224cd40 | assert_not_contains | django_nose/assertions.py | django_nose/assertions.py | # vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
"""
Assertions that sort of follow Python unittest/Django test cases
"""
from django.utils.encoding import smart_str
from django.http import QueryDict
from urlparse import urlsplit, urlunsplit
## Python
def fail_unless_equal(first, second, msg=... | Python | 0.999999 | @@ -2290,37 +2290,328 @@
fix%0A%0A assert
-False
+response.status_code == status_code, msg_prefix + %22Couldn't retrieve page: Response code was %25d (expeced %25d)%22 %25 (response.status_code, status_code)%0A%0A text = smart_str(text, response._charset)%0A%0A assert response.content.count(text) == 0, msg_p... |
063a701770d6613e5fdebaa7ae89d4d997c155ad | fix XSS in My Graphs | webapp/graphite/browser/views.py | webapp/graphite/browser/views.py | """Copyright 2008 Orbitz WorldWide
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... | Python | 0.000002 | @@ -3673,20 +3673,28 @@
'text':
+escape(
name
+)
%7D%0A%0A
|
1483f6cece70cb5de115ea1edc630e98292a8170 | Add Sorting/Selection.py & Selection() | Sorting/Selection.py | Sorting/Selection.py | Python | 0 | @@ -0,0 +1,1575 @@
+# @auther Besir Kurtulmus%0A# coding: utf-8%0A'''%0AThe MIT License (MIT)%0A%0ACopyright (c) 2014 Ahmet Besir Kurtulmus%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy of%0Athis software and associated documentation files (the %22Software%22), to deal in%0Athe Softw... | |
973696b0c50f235cfcef9e0cb30c6fc2f1028058 | add an index for the story_storytags table | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.py | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.py | Python | 0.000006 | @@ -0,0 +1,1003 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in wri... | |
3c4fd0477c7d6f9d0f30654271e73466d192d1e1 | Add data type for vectors | drudge/vec.py | drudge/vec.py | Python | 0 | @@ -0,0 +1,2635 @@
+%22%22%22Vectors and utilities.%22%22%22%0A%0Aimport collections.abc%0A%0Afrom sympy import sympify%0A%0A%0Aclass Vec:%0A %22%22%22Vectors.%0A%0A Vectors are the basic non-commutative quantities. Its objects consist of%0A an base and some indices. The base is allowed to be any Python obje... | |
d0d4688a8768dceeeb5d609a05de72fc24ac6b75 | Create pwned.py | pwned/src/pwned.py | pwned/src/pwned.py | Python | 0.000001 | @@ -0,0 +1,571 @@
+import hashlib, sys, urllib.request%0A%0Adef main():%0A%09hash = hashlib.sha1(bytes(sys.argv%5B1%5D, %22utf-8%22))%0A%09digest = hash.hexdigest().upper()%0A%09url = f%22https://api.pwnedpasswords.com/range/%7Bdigest%5B:5%5D%7D%22%0A%0A%09request = urllib.request.Request(url, headers=%7B%22User-Agent%... | |
aca14378e6f7091abed8f25183b36a36170caa76 | Fix State ID number to 8 chars limit | users/models.py | users/models.py | from django.db import models
from django.contrib import admin
from django.contrib.auth.models import User as AuthUser
# User-related models
class User(models.Model):
'''
Represents an user. Both organizers and participants are considered as
users. This allows usage of the same accounts for the users that ... | Python | 0.001402 | @@ -952,17 +952,17 @@
_length=
-7
+8
, blank=
|
3b7b9966f84b3560a597b80a346922fb33d55912 | Revert "[Bug 1241969] don't ignore the requested language when opening /ab-CD/firefox/" | bedrock/firefox/urls.py | bedrock/firefox/urls.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls import url
from bedrock.redirects.util import redirect
from bedrock.mozorg.util import page
impor... | Python | 0 | @@ -1378,16 +1378,37 @@
firefox'
+, locale_prefix=False
),%0A u
@@ -1691,16 +1691,37 @@
channel'
+, locale_prefix=False
),%0A p
|
806594afc5468d3cee183defba24501516b791f0 | add cities borders | belarus_city_borders.py | belarus_city_borders.py | Python | 0.999998 | @@ -0,0 +1,1508 @@
+from _helpers import cursor_wrap, dump%0A%0A%0A@cursor_wrap%0Adef main(cursor):%0A sql = %22%22%22%0A SELECT ct.osm_id, c.name AS country, '' AS region, '' AS subregion, ct.name AS city, ST_AsGeoJSON(ct.way)%0A FROM osm_polygon c%0A LEFT JOIN osm_polygon ct ON ST_Contains(c.w... | |
fdb901a59e8dd61892f5033efe49e3bbbdae097f | Create CNlab1.py | CNlab1.py | CNlab1.py | Python | 0.000002 | @@ -0,0 +1,1477 @@
+#To check the validity of ip address%0A%0Aimport sys%0Aimport textwrap%0A%0Adef valid(ip):%0A%0A if ip.count('.')!=3:%0A print(%22Invalid%22)%0A sys.exit(0)%0A ipl=%5B%5D%0A ipl=ip.split('.')%0A for i in ipl:%0A if not i.isdigit():%0A print(%22Invalid%22)%0A ... | |
f16dcf6fe2d53be0444faad9f265781282201d95 | Use consistent quotes | colorama/ansi.py | colorama/ansi.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\007'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set... | Python | 0 | @@ -349,12 +349,12 @@
C +
-%222;%22
+'2;'
+ t
@@ -424,11 +424,11 @@
) +
-%22J%22
+'J'
%0A%0Ade
@@ -482,11 +482,11 @@
) +
-%22K%22
+'K'
%0A%0A%0Ac
@@ -801,11 +801,11 @@
) +
-%22A%22
+'A'
%0A
@@ -860,11 +860,11 @@
) +
-%22B%22
+'B'
%0A
@@ -922,11 +922,11 @@
) +
-%22C%22
+'C'
%0A
@@ -981,11 +98... |
4a261bd97de5868ff6065ac69345d3bef38563f1 | Check history_object in historical records | simple_history/tests/tests.py | simple_history/tests/tests.py | from datetime import datetime, timedelta
from django.test import TestCase
from .models import Poll, Choice
today = datetime(2021, 1, 1, 10, 0)
tomorrow = today + timedelta(days=1)
class HistoricalRecordsTest(TestCase):
def assertDatetimesEqual(self, time1, time2):
self.assertAlmostEqual(time1, time2, ... | Python | 0 | @@ -501,16 +501,242 @@
, value)
+%0A self.assertEqual(record.history_object.__class__, Poll)%0A for key, value in values_dict.items():%0A if key != 'history_type':%0A self.assertEqual(getattr(record.history_object, key), value)
%0A%0A de
|
bf6f58d5958275070c1018174217873ea08db904 | Add test pull task | nodeconductor/structure/tests/tasks.py | nodeconductor/structure/tests/tasks.py | Python | 0.000074 | @@ -0,0 +1,336 @@
+from celery import shared_task%0A%0Afrom nodeconductor.core import utils as core_utils%0A%0A%0A@shared_task%0Adef pull_instance(serialized_instance, pulled_disk):%0A %22%22%22 Test-only task that allows to emulate pull operation %22%22%22%0A instance = core_utils.deserialize_instance(serialized... | |
7ce8c06c5447d89f941d482c84693e432384def6 | rename `file` to `filename` for clarity. | pysellus/loader.py | pysellus/loader.py | import os
import sys
from inspect import isfunction
from importlib import import_module
def load(path):
if _is_python_file(path):
sys.path.insert(0, os.path.dirname(path))
module = import_module(_get_module_name_from_path(path))
return _get_checks_from_module(module)
functions = []
... | Python | 0 | @@ -475,37 +475,32 @@
return _remove_
-file_
extension(path.s
@@ -1110,37 +1110,32 @@
_remove_
-file_
extension(file)%0A
@@ -1128,24 +1128,28 @@
tension(file
+name
)%0A fo
@@ -1154,16 +1154,20 @@
for file
+name
in os.l
@@ -1203,16 +1203,20 @@
not file
+name
.startsw
@@ -1249,16 +1249,20 @@
i... |
cc5f55fa6eb6d0ecaaef1c1e269fb40c2731fef5 | Add test helpers | src/lib/test_helpers.py | src/lib/test_helpers.py | Python | 0.000001 | @@ -0,0 +1,1608 @@
+# Copyright (C) 2015 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: jernej@reciprocitylabs.com%0A# Maintained By: jernej@reciprocitylabs.com%0A%0A%22%22%22%0AUtility classes for page o... | |
8e7350cbfc96541d9a3ddc970309c60793bb4126 | fix TermsFacet | corehq/apps/es/facets.py | corehq/apps/es/facets.py | class FacetResult(object):
def __init__(self, raw, facet):
self.facet = facet
self.raw = raw
self.result = raw.get(self.facet.name, {}).get(self.facet.type, {})
class Facet(object):
name = None
type = None
params = None
result_class = FacetResult
def __init__(self):
... | Python | 0.000001 | @@ -660,18 +660,18 @@
lf,
-name, term
+term, name
, si
|
04ded12c05b20fc3a25956712f8e0fb1723c3edb | Add a snippet (python/warnings). | python/warnings.py | python/warnings.py | Python | 0.000004 | @@ -0,0 +1,456 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2012 J%C3%A9r%C3%A9mie DECOCK (http://www.jdhp.org)%0A%0Aimport warnings%0A%0Adef custom_formatwarning(message, category, filename, lineno, line=%22%22):%0A %22%22%22Ignore everything except the message.%22%22%22%0A return %22... | |
630413b6bdc385095fe8da549b691d54fc6a4504 | Add ITWeek.py | ITWeek.py | ITWeek.py | Python | 0 | @@ -0,0 +1,351 @@
+import requests%0D%0Afrom bs4 import BeautifulSoup%0D%0A%0D%0Adef main():%0D%0A url = 'https://ex-portal3.reed.jp/list/SODECS2017_ja.html'%0D%0A res = requests.get(url)%0D%0A soup = BeautifulSoup(res.content, 'html.parser')%0D%0A companies = soup.find_all('tr')%0D%0A for company in com... | |
1f71153cf814f7d34835cea6eafe44683035d874 | Add compare_files.py | compare_files.py | compare_files.py | Python | 0.000002 | @@ -0,0 +1,497 @@
+import difflib%0A%0Adef compare_files(filename1, filename2):%0A f = open(filename1, %22r%22)%0A filelines1 = f.readlines()%0A f.close()%0A f = open(filename2, %22r%22)%0A filelines2 = f.readlines()%0A f.close()%0A diffs = difflib.context_diff(filelines1,%0A ... | |
3ce2e0b8825c7abc219a812c5abda45184fbfdec | add wot wikia plugin | plugins/wotwikia.py | plugins/wotwikia.py | Python | 0 | @@ -0,0 +1,1425 @@
+%22%22%22 WoT Wikia Plugin (botwot plugins.wiki) %22%22%22%0A%0A# Copyright 2015 Ray Schulz %3Chttps://rascul.io%3E%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the Licens... | |
46818f540d48bd967e8e0e5d846f0757f2ca6c1c | Add test for set_shard() | deepchem/data/tests/test_setshard.py | deepchem/data/tests/test_setshard.py | Python | 0.000001 | @@ -0,0 +1,541 @@
+import deepchem as dc%0Aimport numpy as np%0A%0A%0Adef test_setshard_with_X_y():%0A %22%22%22Test setharding on a simple example%22%22%22%0A X = np.random.rand(10, 3)%0A y = np.random.rand(10,)%0A dataset = dc.data.DiskDataset.from_numpy(X, y)%0A assert dataset.get_shape()%5B0%5D%5B0%5D == 10%0A... | |
6ad081e91e337e1627b70674109f45ba35248f8c | Add missing migration file to the repo | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | Python | 0 | @@ -0,0 +1,1145 @@
+%22%22%22add person id to shot history%0A%0ARevision ID: e839d6603c09%0ARevises: 346250b5304c%0ACreate Date: 2020-12-14 12:00:19.045783%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Aimport sqlalchemy_utils%0Aimport sqlalchemy_utils%0Aimport uuid%0A%0A# revision identifiers, use... | |
0538523f617ec1d410861b52a647c788c06c267a | Fix llg tests. | pyoommf/test_llg.py | pyoommf/test_llg.py | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
llg = LLG(t, m_init, Ms, alpha, gamma)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines[0]
line2 = lines[1... | Python | 0.000001 | @@ -117,32 +117,49 @@
ma = 2.21e5%0A
+name = 'llgtest'%0A
%0A llg = LLG(t
@@ -176,32 +176,38 @@
Ms, alpha, gamma
+, name
)%0A%0A mif_strin
@@ -847,24 +847,45 @@
ma = 2.21e5%0A
+ name = 'llgtest'%0A
%0A llg
@@ -918,16 +918,22 @@
a, gamma
+, name
)%0A%0A m
|
22252d6978f237a2a46415dcf54d4adbed92b1ce | Add LLG tests. | pyoommf/test_llg.py | pyoommf/test_llg.py | Python | 0 | @@ -0,0 +1,1016 @@
+from llg import LLG%0A%0Adef test_llg_mif():%0A t = 1.5e-9%0A m_init = (0, 1, 0)%0A Ms = 1e6%0A alpha = 0.01%0A gamma = 2.21e5%0A %0A llg = LLG(t, m_init, Ms, alpha, gamma)%0A%0A mif_string = llg.get_mif()%0A%0A lines = mif_string.split('%5Cn')%0A%0A assert 'Specify Oxs... | |
b21fbb09b33e40a33ad3ea33b0394fed421c8a6e | add num02 | pythonTest/num02.py | pythonTest/num02.py | Python | 0.999971 | @@ -0,0 +1,160 @@
+def reverse(x):%0D%0A changeTuple=tuple(x)%0D%0A reverseTuple=changeTuple%5B::-1%5D%0D%0A print(''.join(reverseTuple))%0D%0A%0D%0Atest = %22this is test string%22%0D%0Areverse(test)%0D%0A
| |
edc35e4aefe336eb1bf02dbf7104925389276fa6 | Add shellcheck for sh filetype | pythonx/lints/sh.py | pythonx/lints/sh.py | Python | 0 | @@ -0,0 +1,428 @@
+# -*- coding: utf-8 -*-%0A%0Afrom validator import Validator%0A%0A%0Aclass Sh(Validator):%0A __filetype__ = %22sh%22%0A%0A checker = %22shellcheck%22%0A args = %22-x -f gcc%22%0A regex = r%22%22%22%0A .+:%0A (?P%3Clnum%3E%5Cd+):%0A (?P%3Ccol%3E%5Cd+):%0A ... | |
c25cebf31648466111cb3d576e0a398bb4220ccf | Add test for sabnzbd cleanupfilename.py | sabnzbd/test_cleanupfilename.py | sabnzbd/test_cleanupfilename.py | Python | 0.000001 | @@ -0,0 +1,826 @@
+import unittest%0Afrom cleanupfilename import rename%0A%0A%0Aclass TestRename(unittest.TestCase):%0A files = %5B%5D%0A dirs = %5B%5D%0A%0A def setUp(self):%0A self.files = %5B('filename-sample.x264.mp4', 'filename.mp4'),%0A ('filename.mp4', 'filename.mp4')%5D%0A ... | |
d56b1623a278d61ff8b113b95534ce4dd6682e25 | fix bug 1018349 - migration | alembic/versions/1baef149e5d1_bug_1018349_add_coalesce_to_max_sort_.py | alembic/versions/1baef149e5d1_bug_1018349_add_coalesce_to_max_sort_.py | Python | 0 | @@ -0,0 +1,684 @@
+%22%22%22bug 1018349 - add COALESCE to max(sort) when adding a new product%0A%0ARevision ID: 1baef149e5d1%0ARevises: 26521f842be2%0ACreate Date: 2014-06-25 15:04:37.934064%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '1baef149e5d1'%0Adown_revision = '26521f842be2'%0A%0Afr... | |
d836571a8dff59371d156dffea7290228305ca17 | add tests for reading shapefiles via ogr | tests/python_tests/ogr_test.py | tests/python_tests/ogr_test.py | Python | 0 | @@ -0,0 +1,1703 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom nose.tools import *%0Afrom utilities import execution_path%0A%0Aimport os, mapnik%0A%0Adef setup():%0A # All of the paths used are relative, if we run the tests%0A # from another directory we need to chdir()%0A os.chdir(execution_pat... | |
bf8b19d19ea2a5f39cba90ca815560a89e476c6c | Create Output.py | Output.py | Output.py | Python | 0.000108 | @@ -0,0 +1,418 @@
+import os, time, sys%0Afrom threading import Thread%0Apipe_name = '/Users/stevenrelin/Documents/pipe_eye.txt'%0A%0Adef child( ):%0A pipeout = os.open(pipe_name, os.O_WRONLY)%0A counter = 0%0A while True:%0A time.sleep(1)%0A os.write(pipeout, 'Number %2503d%5Cn' %25 counter)%0A ... | |
5f20962d300850200ed796f941bf98662736d4da | Add server.py to serve files in the user's specified share dir | sandwich/server.py | sandwich/server.py | Python | 0 | @@ -0,0 +1,1145 @@
+from os import curdir, sep, path%0Aimport time%0Afrom BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer%0A%0Aimport config%0A%0Aclass StaticServeHandler(BaseHTTPRequestHandler):%0A%0A def do_GET(self):%0A%0A if not config.shared_directory:%0A self.send_error(404, 'User no... | |
d774bb7caa9637e4d453e19fcc43ee7b9b17702c | add script for computing WWA % times | scripts/sbw/wfo_time_percent.py | scripts/sbw/wfo_time_percent.py | Python | 0 | @@ -0,0 +1,1231 @@
+import iemdb%0Aimport numpy%0Aimport network%0A%0Ant = network.Table(%22WFO%22)%0A%0APOSTGIS = iemdb.connect('postgis', bypass=True)%0Apcursor = POSTGIS.cursor()%0A%0Aimport mx.DateTime%0A%0Asts = mx.DateTime.DateTime(2005,10,1)%0Aets = mx.DateTime.DateTime(2013,1,1)%0Ainterval = mx.DateTime.Relativ... | |
e56c3be6dc3ab8bf31b7ce9a3d3db275b18207f0 | Create sql-all.py | Django/sql-all.py | Django/sql-all.py | Python | 0.000706 | @@ -0,0 +1,203 @@
+$ ./manage.py sqlall name-app%0A%0A'''%0ACommandError: App 'name-app' has migrations. %0AOnly the sqlmigrate and sqlflush commands can be used when an app has migrations.%0A'''%0A%0ASo there before migrate to see it.%0A
| |
43841114f4403b46e0ef077be6e0832ce690dfb2 | add ipy_workdir | IPython/Extensions/ipy_workdir.py | IPython/Extensions/ipy_workdir.py | Python | 0.000001 | @@ -0,0 +1,640 @@
+#!/usr/bin/env python%0D%0A%0D%0Aimport IPython.ipapi%0D%0Aip = IPython.ipapi.get()%0D%0A%0D%0Aimport os%0D%0A%0D%0Aworkdir = None%0D%0Adef workdir_f(line):%0D%0A global workdir%0D%0A dummy,cmd = line.split(None,1)%0D%0A if os.path.isdir(cmd):%0D%0A workdir = cmd%0D%0A print %... | |
b78ba3220a64e9b01b3fc8c61ada0e85dc1157fc | Implement data dumper | oeplatform/dumper.py | oeplatform/dumper.py | Python | 0.000016 | @@ -0,0 +1,1529 @@
+import oeplatform.securitysettings as sec%0Aimport sqlalchemy as sqla%0Afrom subprocess import call%0Aimport os%0A%0Aexcluded_schemas = %5B%0A%0A %22information_schema%22,%0A %22public%22,%0A %22topology%22,%0A %22reference%22,%0A%5D%0A%0A%0Adef connect():%0A engine = _get_engine()%0A... | |
0254fbea5218e332dc0c54af198aa2b29381878b | Composite two smiley on top of the famous Michael jordan crying face | python/composite.py | python/composite.py | Python | 0.999822 | @@ -0,0 +1,904 @@
+import requests%0Aimport json%0A%0A# Composite two smiley on top of the famous Michael jordan crying face.%0A# A more sophisticated approach would be to extract the face landmarks using facelandmarks and composite something on the different regions.%0A# https://pixlab.io/#/cmd?id=merge for more info.... | |
8ce580d1f0890f72ab60efa4219de26b64ece897 | Add example skeleton script | example/example.py | example/example.py | Python | 0.000001 | @@ -0,0 +1,1446 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Afrom argparse import ArgumentParser%0Afrom getpass import getpass%0A%0Aclass BigFixArgParser(ArgumentParser):%0A name = %22hodor.py %5Boptions%5D%22%0A%0A def __init__(self):%0A description = %22A tool for creating a smarter planet%22%0A usage = %22%22... | |
30a4cb3794d52d1743dc482f2c2a83ced1dcbd90 | Make a clean report along with BLEU scores | session2/report.py | session2/report.py | Python | 0.000001 | @@ -0,0 +1,1992 @@
+import argparse, codecs, logging%0Aimport unicodecsv as csv%0Afrom nltk.align.bleu_score import bleu%0Aimport numpy as np%0A%0Adef setup_args():%0A parser = argparse.ArgumentParser()%0A parser.add_argument('src', 'Source file')%0A parser.add_argument('target', 'Translated data')%0A parse... | |
31bb487a2f75268cb0b60ef4539935df83b68a84 | Add auto solver for "W3-Radix Sorts". | quiz/3-radixsort.py | quiz/3-radixsort.py | Python | 0 | @@ -0,0 +1,1656 @@
+#!/usr/bin/env python3%0A%0A%0Adef make_arr(text):%0A return text.strip().split(' ')%0A%0A%0Adef print_arr(arr):%0A for t in arr:%0A print(t, end=' ')%0A print()%0A%0A%0Adef solve_q1(arr, time):%0A for t in range(len(arr%5B0%5D) - 1, time - 1, -1):%0A arr = sorted(arr, key=... | |
d959587c168424ed0d8e91a4a20ea36076a646b7 | add forgotten __init__.py | dhcpcanon/__init__.py | dhcpcanon/__init__.py | Python | 0.00035 | @@ -0,0 +1,40 @@
+__version__ = %220.1%22%0A__author__ = %22juga%22%0A
| |
98fe743217ebd7868d11d8518f25430539eae5a0 | add regrresion example | example/simple_regression_example.py | example/simple_regression_example.py | Python | 0 | @@ -0,0 +1,967 @@
+from sklearn import datasets, metrics, preprocessing%0Afrom stacked_generalization.lib.stacking import StackedRegressor%0Afrom sklearn.ensemble import RandomForestRegressor%0Afrom sklearn.ensemble import GradientBoostingRegressor%0Afrom sklearn.ensemble import ExtraTreesRegressor%0Afrom sklearn.linea... | |
896270bcd99b26e4128fd35dd3821a59807ae850 | Add the model.py file declarative generated from mysql. | doc/model/model_decla.py | doc/model/model_decla.py | Python | 0 | @@ -0,0 +1,1493 @@
+#autogenerated by sqlautocode%0A%0Afrom sqlalchemy import *%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy.orm import relation%0A%0Aengine = create_engine('mysql://monty:passwd@localhost/test_dia')%0ADeclarativeBase = declarative_base()%0Ametadata = DeclarativeBase.metad... | |
7aab44f006a6412d8f169c3f9a801f41a6ea0a95 | Remove start dates for the second time from draft dos2 briefs | migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py | migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py | Python | 0.000002 | @@ -0,0 +1,2077 @@
+%22%22%22Remove dates from draft dos2 briefs.%0AThis is identical to the previous migration but will be run again to cover any draft briefs with invalid%0Adates that could have appeared during the previous API rollout process (after the previous migration but before%0Athe code propogated fully to th... | |
77ccb8db873c31ad2bd8318118410abab3141312 | add __version__.py | europilot/__version__.py | europilot/__version__.py | Python | 0.001013 | @@ -0,0 +1,126 @@
+__title__ = 'europilot'%0A__description__ = 'End to end driving simulation inside Euro Truck Simulator 2'%0A__version__ = '0.0.1'%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.