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 |
|---|---|---|---|---|---|---|---|
5e51cda3a7441f6e31477988b1288d1497fe23d9 | Add arguments snippet | code/python/snippets/arguments.py | code/python/snippets/arguments.py | Python | 0.000007 | @@ -0,0 +1,861 @@
+%22%22%22%0AAdd command line arguments to your script.%0A%0AThis snippet adds the default command line arguments required for any interaction with the UpGuard API.%0A%0ATo Use:%0A%0A1. Copy snippet to the top of your script%0A2. Populate description (this is shown when running %60--help%60)%0A3. Acce... | |
8bdc9c0685500b822787779b5ebffa46b00d8138 | Add script | lightshow.py | lightshow.py | Python | 0.000002 | @@ -0,0 +1,1322 @@
+#!/usr/bin/sudo / usr/bin/python%0A%0Aimport RPi.GPIO as GPIO%0Afrom time import sleep%0A%0AGPIO.setmode(GPIO.BOARD)%0AGPIO.setwarnings(False)%0A%0Aleds = %7B'floor':%5B%5D, 'top-left':%5B%5D%7D%0A%0Adef setupled(name, pins):%0A%09for i in range(0, 3):%0A%09%09GPIO.setup(pins%5Bi%5D, GPIO.OUT)%0A%09... | |
1a4052deb8e0ab2deb7038220ae23d7bb9311ce9 | Add initial version of the script | ovf_to_facter.py | ovf_to_facter.py | Python | 0.000001 | @@ -0,0 +1,1900 @@
+#!/usr/bin/python%0A%0A#stdlib%0Aimport json%0Aimport os%0Aimport subprocess%0Afrom xml.dom.minidom import parseString%0A%0Adef which(cmd):%0A %22%22%22Python implementation of %60which%60 command.%22%22%22%0A for path in os.environ%5B%22PATH%22%5D.split(os.pathsep):%0A file = os.path.j... | |
2f0ba9368bc44cffce1dcf2ec483aabf04c2e127 | add python #5 | python/5.py | python/5.py | Python | 0.000032 | @@ -0,0 +1,1270 @@
+#!/usr/bin/env python %0A%0A'''%0AProblem%0A=======%0A%0A2520 is the smallest number that can be divided by each of the numbers from 1 to 10 %0Awithout any remainder. What is the smallest positive number that is evenly divisible%0Aby all of the numbers from 1 to 20?%0A%0ALatest Run Stats%0A====== =... | |
459f87be465e0f5554c708fe60679494d152c8fd | Create permissions.py | templates/root/main/permissions.py | templates/root/main/permissions.py | Python | 0.000001 | @@ -0,0 +1,499 @@
+from rest_framework import permissions%0A%0Aclass IsOwnerOrReadOnly(permissions.BasePermission):%0A%09%22%22%22%0A%09Custom permission to only allow owners of an object to edit it.%0A%09%22%22%22%0A%0A%09def has_object_permissions(self, request, view, obj):%0A%09%09# Read permissions are allowed to a... | |
4a98686b63563b209456a8933ef34477adcdae43 | extend Phabricator class and do nothing | phabricate/phab.py | phabricate/phab.py | Python | 0 | @@ -0,0 +1,92 @@
+from phabricator import Phabricator as _Phabricator%0A%0Aclass Phabricator(_Phabricator):%0A%09pass%0A
| |
cca6b0c28747a3b0307fccd33dee60fcb42d910d | Test Fix. | tests/components/garage_door/test_demo.py | tests/components/garage_door/test_demo.py | """
tests.components.garage_door.test_demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests demo garage door component.
"""
import unittest
import homeassistant.core as ha
import homeassistant.components.garage_door as gd
LEFT = 'garage_door.left_garage_door'
RIGHT = 'garage_door.right_garage_door'
class TestGarageDoorDemo(... | Python | 0 | @@ -1092,35 +1092,36 @@
self.assert
-Tru
+Fals
e(gd.is_closed(s
@@ -1263,36 +1263,35 @@
self.assert
-Fals
+Tru
e(gd.is_closed(s
|
67d0d381003dc02d5e1eae9d0c8591daee4b93b3 | Migrate SnafuComics to single-class module. | dosagelib/plugins/snafu.py | dosagelib/plugins/snafu.py | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
from ..helpers import indirectStarter... | Python | 0 | @@ -322,17 +322,16 @@
%0A%0Aclass
-_
Snafu(_P
@@ -571,16 +571,22 @@
lf, name
+, path
):%0A
@@ -594,17 +594,16 @@
super(
-_
Snafu, s
@@ -634,24 +634,87 @@
cs/' + name)
+%0A self.url = 'http://snafu-comics.com/swmseries/' + path
%0A%0A def na
@@ -864,1334 +864,1088 @@
@
-property%0A def u... |
43cf23e793794fd45322471a52c83785070ac243 | add simple_graph | simple_graph.py | simple_graph.py | Python | 0.999579 | @@ -0,0 +1,1558 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0A%0Aclass Graph(object):%0A%0A def __init__(self):%0A self.gdict = %7B%7D%0A%0A def nodes(self):%0A return self.gdict.keys()%0A%0A def edges(self):%0A self.edges = %5B%5D%0A for node in self.gd... | |
d7e6291564a5d5683a8b03fc9a761ad3e3dd70ea | Bump version to stable. | usb/__init__.py | usb/__init__.py | # Copyright (C) 2009-2014 Wander Lairson Costa
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided... | Python | 0 | @@ -2073,15 +2073,8 @@
0, 0
-, 'rc1'
)%0A__
@@ -2098,10 +2098,8 @@
d.%25d
-%25s
' %25
|
59c9f7d63e333a9e00ffbb3089dfde3fe2d34826 | Fix check on empty body in serialization | src/sentry/interfaces/http.py | src/sentry/interfaces/http.py | """
sentry.interfaces.http
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
__all__ = ('Http',)
from django.utils.translation import ugettext as _
from urllib import urlencode
from urlparse import parse_qsl, urlsplit, ... | Python | 0.000001 | @@ -3276,34 +3276,39 @@
body)%0A el
-se
+if body
:%0A bo
|
7d9b004b3fb33ed9f16ca657ddb6ee3ddf452802 | add dump2pe (t2_08 sample) | elfesteem/t2_08_dump2pe.py | elfesteem/t2_08_dump2pe.py | Python | 0 | @@ -0,0 +1,1241 @@
+#! /usr/bin/env python%0A%0Aimport pe%0Afrom pe_init import PE%0Aimport rlcompleter,readline,pdb, sys%0Afrom pprint import pprint as pp%0Areadline.parse_and_bind(%22tab: complete%22)%0Aimport shlex%0A%0Af = open('my_dump.txt', 'r')%0A%0Afor i in xrange(27):%0A f.readline()%0A%0Astate = 0%0Afuncs ... | |
062b4d045580adaebf30376cae1b88387dc7f3bb | add test_db | www/test_deb.py | www/test_deb.py | Python | 0.000001 | @@ -0,0 +1,496 @@
+# coding=utf-8%0Afrom www.models import User%0Afrom www.transwarp import db%0A%0A__author__ = 'xubinggui'%0A%0Adb.create_engine(user='www-data', password='www-data', database='awesome')%0A%0Au = User(name='Test', email='test@example.com', password='1234567890', image='about:blank')%0A%0Au.insert()%0A... | |
64c24ee2813e5d85866d14cfdee8258b91c09df6 | add debug topology file | evaluation/topo-fattree.py | evaluation/topo-fattree.py | Python | 0.000001 | @@ -0,0 +1,1891 @@
+%22%22%22Custom topology example%0A%0ATwo directly connected switches plus a host for each switch:%0A%0A host --- switch --- switch --- host%0A%0AAdding the 'topos' dict with a key/value pair to generate our newly defined%0Atopology enables one to pass in '--topo=mytopo' from the command line.%0A%... | |
d0474ea69c9bcc5b07829603778e0277d1fd733a | fix moved Glottolog identifier of nepa1252 | migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py | migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py | Python | 0 | @@ -0,0 +1,1654 @@
+# coding=utf-8%0A%22%22%22fix missing nepa1252 identifier%0A%0ARevision ID: 1715ee79365%0ARevises: 506dcac7d75%0ACreate Date: 2015-04-15 19:34:27.655000%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '1715ee79365'%0Adown_revision = '506dcac7d75'%0A%0Aimport datetime%0A%0Af... | |
18e66983c49c68e9000acd331d6888c4c72a99b3 | Fix mypy error. | zerver/signals.py | zerver/signals.py | from __future__ import absolute_import
from django.dispatch import receiver
from django.contrib.auth.signals import user_logged_in
from django.core.mail import send_mail
from django.conf import settings
from django.template import loader
from django.utils import timezone
from typing import Any, Dict, Optional
def get... | Python | 0 | @@ -304,16 +304,54 @@
Optional
+%0Afrom zerver.models import UserProfile
%0A%0Adef ge
@@ -1882,50 +1882,8 @@
text
-%0A from zerver.models import UserProfile
%0A%0A
|
2749b4b754562c45a54b3df108c5c40c8d548038 | Create __init__.py | web/__init__.py | web/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
1396ff4ab4e6664c265f97958951815a525f7823 | Remove confusing navigation tabs from header. | reddit_donate/pages.py | reddit_donate/pages.py | from r2.lib.pages import Reddit
from r2.lib.wrapped import Templated
class DonatePage(Reddit):
extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"]
def __init__(self, title, content, **kwargs):
Reddit.__init__(
self,
title=title,
content=content,
... | Python | 0 | @@ -369,16 +369,102 @@
)%0A%0A
+ def build_toolbars(self):%0A # get rid of tabs on the top%0A return %5B%5D%0A%0A
%0Aclass D
|
eefa1f039d935a7242bb14bdb6f672db1ff24302 | Create omega-virus.py | omega-virus.py | omega-virus.py | Python | 0 | @@ -0,0 +1,906 @@
+#!/usr/bin/python%0A%0A#%0A# Insert docopt user help menu here?%0A#%0A%0A%0A#%0A# End docopt%0A#%0A%0Adef sectors()%0A%09# Blue%0A%09# Green%0A%09# Red%0A%09# Yellow%0A%09%0Adef roomList()%0A%09# List of rooms%0A%09# Green (open rooms)%0A%09# Blue (requires blue key)%0A%09# Red (requires red key)%0A%... | |
04f937a24279699164278d47fc5d0790a9062132 | add gunicorn.py | wsgi_gunicorn.py | wsgi_gunicorn.py | Python | 0.007978 | @@ -0,0 +1,234 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom werkzeug.contrib.fixers import ProxyFix%0Afrom app import create_app%0A%0Aapp = create_app()%0A%0Aapp.wsgi_app = ProxyFix(app.wsgi_app)%0A%0Aif __name__ == '__main__':%0A app.run(host='0.0.0.0')%0A
| |
7a9a25f5e1f57d4cdd4d324c5937714c74976a56 | Fix test_get_creds_from_env_vars_when_required_vars_missing | tests/unit/cli/test_envutils.py | tests/unit/cli/test_envutils.py | # Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | Python | 0.000003 | @@ -6060,32 +6060,114 @@
_missing(self):%0A
+ if %22OS_USERNAME%22 in os.environ:%0A del os.environ%5B%22OS_USERNAME%22%5D%0A
self.ass
|
14baa70de3353975b6240d470c2406e1a889358c | Update project.py | erpnext/projects/doctype/project/project.py | erpnext/projects/doctype/project/project.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, get_url
from frappe import _
from frappe.model.document import Document
class Project(Document):... | Python | 0.000001 | @@ -2224,16 +2224,41 @@
lf.save(
+ignore_permissions = True
)%0A%0A%09def
|
d254428e484172ccd0a0763eb989241b08a26c3b | string compress kata second day | string-compress-kata/day-2.py | string-compress-kata/day-2.py | Python | 0.999077 | @@ -0,0 +1,1316 @@
+# -*- codeing: utf-8 -*-%0A%0Aclass Compressor(object):%0A%0A def compress(self, toCompress):%0A if toCompress is None:%0A return %22%22%0A else:%0A compressed = %5B%5D%0A index = 0%0A length = len(toCompress)%0A while index %3C... | |
a81f39089b4c60e2cb05ea892afacbcbea6f1c5d | add tests for oxml_parser | tests/oxml/test___init__.py | tests/oxml/test___init__.py | Python | 0.000001 | @@ -0,0 +1,1355 @@
+# encoding: utf-8%0A%0A%22%22%22%0ATest suite for pptx.oxml.__init__.py module, primarily XML parser-related.%0A%22%22%22%0A%0Afrom __future__ import print_function, unicode_literals%0A%0Aimport pytest%0A%0Afrom lxml import etree, objectify%0A%0Afrom pptx.oxml import oxml_parser%0A%0A%0Aclass Descri... | |
f8c3feaf3f400cbcf3e04d9705f0cb36d083c6d7 | Include migratio for ProductPlan. | conductor/accounts/migrations/0012_productplan.py | conductor/accounts/migrations/0012_productplan.py | Python | 0 | @@ -0,0 +1,819 @@
+# Generated by Django 2.0.9 on 2018-11-08 02:50%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B(%22accounts%22, %220011_auto_20180831_0320%22)%5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A name=%22... | |
4db13bdab18934bebcfe5b102044f936e0eab892 | Add a place to put random stuff and a list of components as a python module. | etc/component_list.py | etc/component_list.py | Python | 0 | @@ -0,0 +1,1510 @@
+COMPONENTS = %5B%09%0A %22AdaBoost%22,%0A%09%22AutoInvert%22,%0A%09%22AutoMlpClassifier%22,%0A%09%22BiggestCcExtractor%22,%0A%09%22BinarizeByHT%22,%0A%09%22BinarizeByOtsu%22,%0A%09%22BinarizeByRange%22,%0A%09%22BinarizeBySauvola%22,%0A%09%22BitDataset%22,%0A%09%22BitNN%22,%0A%09%22BookStore%22,%0... | |
f7aeb7a708ef2e40546d27d480073fdc113d639e | Add check_babel_syntax ; see note below | unnaturalcode/check_babel_syntax.py | unnaturalcode/check_babel_syntax.py | Python | 0 | @@ -0,0 +1,2414 @@
+#!/usr/bin/python%0A# Copyright 2017 Dhvani Patel%0A#%0A# This file is part of UnnaturalCode.%0A# %0A# UnnaturalCode is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundat... | |
b29fe95eb2cb86a7ae9170fbf8ceb2533bc84578 | Add the photo.index module (with minimal functionality so far). | photo/index.py | photo/index.py | Python | 0 | @@ -0,0 +1,2324 @@
+%22%22%22Provide the class Index which represents an index of photos.%0A%22%22%22%0A%0Aimport os%0Aimport os.path%0Aimport fnmatch%0Afrom collections import MutableSequence%0Aimport yaml%0A%0A%0Aclass Index(MutableSequence):%0A%0A defIdxFilename = %22.index.yaml%22%0A%0A def __init__(self, idx... | |
eff993eac0924299cd273d0c582e24c57f2c4a84 | Add 263-ugly-number.py | 263-ugly-number.py | 263-ugly-number.py | Python | 0.999999 | @@ -0,0 +1,1457 @@
+%22%22%22%0AQuestion:%0A Ugly Number%0A%0A Write a program to check whether a given number is an ugly number.%0A%0A Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.%0A%0A ... | |
cd44e4a62e8c8f8ddba0634ccc0bb157f7745726 | add 129 | vol3/129.py | vol3/129.py | Python | 0.999994 | @@ -0,0 +1,266 @@
+def A(n):%0A if n %25 5 == 0:%0A return 1%0A x = 1%0A ret = 1%0A while x != 0:%0A x = (x * 10 + 1) %25 n%0A ret += 1%0A return ret%0A%0Aif __name__ == %22__main__%22:%0A LIMIT = 10 ** 6%0A i = LIMIT + 1%0A while A(i) %3C= LIMIT:%0A i += 2%0A prin... | |
a8663257ad4b4d0688c54d0e94949ab602c61561 | allow validation for empty/missing @brief. | util/py_lib/seqan/dox/validation.py | util/py_lib/seqan/dox/validation.py | #!/usr/env/bin python
"""Some validation for proc_doc.Proc*"""
__author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>'
class ProcDocValidator(object):
"""Validate proc_doc.Proc* objects.
Implements the visitor pattern.
"""
def __init__(self, msg_printer):
self.msg_printer = msg_print... | Python | 0 | @@ -2939,16 +2939,580 @@
ning')%0A%0A
+%0Aclass EmptyBriefValidator(ProcDocValidator):%0A %22%22%22Warns if there is no non-empty @brief section for an entry.%22%22%22%0A%0A def validate(self, proc_entry):%0A IGNORED = %5B'mainpage', 'page'%5D%0A if proc_entry.kind in IGNORED:%0A return ... |
0ede4e22370a3f8217fee8ff995a9c7057d8b00b | Add test for redis test helper | vumi_http_retry/tests/test_redis.py | vumi_http_retry/tests/test_redis.py | Python | 0 | @@ -0,0 +1,910 @@
+import json%0A%0Afrom twisted.trial.unittest import TestCase%0Afrom twisted.internet.defer import inlineCallbacks%0A%0Afrom vumi_http_retry.tests.redis import create_client, zitems%0A%0A%0Aclass TestRedis(TestCase):%0A @inlineCallbacks%0A def setUp(self):%0A self.redis = yield create_cli... | |
d0237f2b77a49933a4b22b43f967e414be196ff4 | Add sysmod module to replace old introspection modules | salt/modules/sysmod.py | salt/modules/sysmod.py | Python | 0 | @@ -0,0 +1,1480 @@
+'''%0AThe sys module provides information about the available functions on the%0Aminion.%0A'''%0A%0Adef __virtual__():%0A '''%0A Return as sys%0A '''%0A return 'sys'%0A%0A%0Adef doc(module=''):%0A '''%0A Return the docstrings for all modules, these strings are aggregated into%0A ... | |
fa55ceb71ff254f8ed3413a35acfe20da7c03a91 | Create BT Comm wrapper class | rxbtcomm.py | rxbtcomm.py | Python | 0 | @@ -0,0 +1,1613 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A# Copyright (c) 2016 F Dou%3Cprogrammingrobotsstudygroup@gmail.com%3E%0A# See LICENSE for details.%0A%0A%0Aimport bluetooth%0Aimport logging%0A%0Aclass RxBtComm(object):%0A %22%22%22BT communication wrapper:%0A%0A Attributes:%0A addy: A stri... | |
4053aa99100e2fdc1a342a472492f53138a66d6b | Add internal utils module | pies/_utils.py | pies/_utils.py | Python | 0.000001 | @@ -0,0 +1,2341 @@
+%22%22%22%0A pies/_utils.py%0A%0A Utils internal to the pies library and not meant for direct external usage.%0A%0A Copyright (C) 2013 Timothy Edmund Crosley%0A%0A Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated%0A document... | |
b52b4cb39029d55a06e15b527cb4789e2988093d | Add word2vec example | word2vec.py | word2vec.py | Python | 0.002897 | @@ -0,0 +1,1191 @@
+from pyspark.sql import SparkSession%0Afrom pyspark.ml.feature import Word2Vec%0A%0Adef main():%0A spark = SparkSession.builder %5C%0A .appName(%22Spark CV-job ad matching%22) %5C%0A .config(%22spark.some.config.option%22, %22some-value%22) %5C%0A .master(%22local%5B*%5D%22) ... | |
9607c55eacfd58704a4e83a2476471aa2da6124c | add package py-doxypypy (#3284) | var/spack/repos/builtin/packages/py-doxypypy/package.py | var/spack/repos/builtin/packages/py-doxypypy/package.py | Python | 0 | @@ -0,0 +1,1635 @@
+##############################################################################%0A# Copyright (c) 2013-2016, 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... | |
83fa6b23563903192376a3419b460b9b06479248 | Add procstat.py | src/procstat.py | src/procstat.py | Python | 0 | @@ -0,0 +1,1714 @@
+import os.path%0Aimport argparse%0Aimport logging%0A%0Alogging.basicConfig(level=logging.DEBUG)%0A%0A%0Aclass Procstat():%0A%09PROCSTATPATH = '/proc/%25d/stat'%0A%09STATLIST = (%0A%09%09'pid',%0A%09%09'comm',%0A%09%09'state',%0A%09%09'ppid',%0A%09%09'pgrp',%0A%09%09'session',%0A%09%09'tty_nr',%0A%09... | |
0728e6a4f8f06e1d4d137259f76796d1dbfa1a9d | add a wsgi.py that eagerly reads in POSTdata | edx_ora/wsgi_eager.py | edx_ora/wsgi_eager.py | Python | 0 | @@ -0,0 +1,2185 @@
+%22%22%22%0AWSGI config for ora project.%0A%0AThis module contains the WSGI application used by Django's development server%0Aand any production WSGI deployments. It should expose a module-level variable%0Anamed %60%60application%60%60. Django's %60%60runserver%60%60 and %60%60runfcgi%60%60 commands... | |
fb336764f1a95d591e04f0061009c555b7217274 | Create FoodDiversity.py | FoodDiversity.py | FoodDiversity.py | Python | 0 | @@ -0,0 +1,1449 @@
+import csv%0Aimport math%0Aimport collections%0Afrom collections import Counter%0A%0A# EntFunc calculates the Shannon index for the diversity of venues in a given zip code.%0Adef EntFunc(list,list2):%0A k = 0%0A Entropy = 0%0A for k in range(0, len(BusinessName)):%0A if BusinessName%... | |
40d687be843e3de56eb00a028e07866391593315 | Add defaults.py | salt/defaults.py | salt/defaults.py | Python | 0 | @@ -0,0 +1,294 @@
+# -*- coding: utf-8 -*-%0A'''%0ADefault values, to be imported elsewhere in Salt code%0A%0ADo NOT, import any salt modules (salt.utils, salt.config, etc.) into this file,%0Aas this may result in circular imports.%0A'''%0A%0A# Default delimiter for multi-level traversal in targeting%0ADEFAULT_TARGET_D... | |
3de2e625af9047b64cc2718e6e79be0c428b6ae7 | Solve Code Fights extract each kth problem | CodeFights/extractEachKth.py | CodeFights/extractEachKth.py | Python | 0.000853 | @@ -0,0 +1,752 @@
+#!/usr/local/bin/python%0A# Code Fights Extract Each Kth Problem%0A%0A%0Adef extractEachKth(inputArray, k):%0A return %5Be for i, e in enumerate(inputArray) if (i + 1) %25 k != 0%5D%0A%0A%0Adef main():%0A tests = %5B%0A %5B%5B1, 2, 3, 4, 5, 6, 7, 8, 9, 10%5D, 3, %5B1, 2, 4, 5, 7, 8, 10%5... | |
0f1f96ce23ab89c8de3cf24645c4ea77fa2a9196 | add first test with random data | test_window.py | test_window.py | Python | 0.000001 | @@ -0,0 +1,417 @@
+from telescope import LST%0Afrom windows import TelescopeEventView%0Aimport tkinter as tk%0Aimport numpy as np%0A%0Alst = LST(0, 0, 0)%0A%0Aroot = tk.Tk()%0Aviewer1 = TelescopeEventView(root, lst, np.random.normal(size=lst.n_pixel))%0Aviewer2 = TelescopeEventView(root, lst, np.random.normal(size=lst.... | |
60b5948508a67cb213ca04b5faacb77e27d8f84c | Add fields expicitly declared in form | samples/forms.py | samples/forms.py | import datetime #for checking renewal date range.
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from .models import (Patient, AdmissionNote, FluVaccine,
CollectionType, CollectedSample,
Symptom, ObservedSymptom,
)
from fioc... | Python | 0 | @@ -798,34 +798,46 @@
-exclude = %5B'admission_note
+fields = %5B'was_applied', 'date_applied
', %5D
|
5ca9e468b9709ae2c7358551a19e668e580ea396 | add deserialized json object validation functions | src/validate.py | src/validate.py | Python | 0 | @@ -0,0 +1,814 @@
+from collections import Counter%0A%0Amodeltypes = set(%5B%22asymmetric_beta_bernoulli%22, %22normal_inverse_gamma%22, %22pitmanyor_atom%22, %22symmetric_dirichlet_discrete%22, %22poisson_gamma%22%5D)%5D)%0A%0Adef assert_map_consistency(map_1, map_2):%0A assert(len(map_1)==len(map_2))%0A for key... | |
fc017a578a402b3d24523d1a41b7a4fdc0b107ef | add a starter proxy script | scripts/proxy.py | scripts/proxy.py | Python | 0 | @@ -0,0 +1,1136 @@
+#!/usr/bin/env python%0A%0A'''%0A%09Copyright (C) Kalan MacRow, 2013%0A%0A%09This code is distributed with jquery.instagram.js %0A%09under the MIT license.%0A%0A%09https://github.com/kmacrow/jquery.instagram.js%0A'''%0A%0Aimport os%0Aimport cgi%0Aimport sys%0Aimport cgitb%0Aimport urllib2%0A%0A %0A#... | |
a319f2f1606a5c4d33e846b496e555140607c98d | Add track_name script | track_names.py | track_names.py | Python | 0.000002 | @@ -0,0 +1,529 @@
+import midi%0Aimport sys%0A%0Adef track_name(track):%0A for ev in track:%0A if isinstance(ev, midi.TrackNameEvent):%0A return ''.join(map(chr, ev.data))%0A name = 'no name, first 6 events:'%0A for ev in track%5B:6%5D:%0A name += '%5Cn %25s' %25 ev%0A return name%0A%0Adef main(argv):... | |
877a7b7449a1d88c14633376a2dfaca8c619c26a | Add solution to exercis 3.6. | exercises/chapter_03/exercise_03_06/exercise_03_06.py | exercises/chapter_03/exercise_03_06/exercise_03_06.py | Python | 0 | @@ -0,0 +1,1897 @@
+# 3-6 Guest List%0A%0Aguest_list = %5B%22Albert Einstein%22, %22Isac Newton%22, %22Marie Curie%22, %22Galileo Galilei%22%5D%0A%0Amessage = %22Hi %22 + guest_list%5B0%5D + %22 you are invited to dinner at 7 on saturday.%22%0Aprint(message)%0A%0Amessage = %22Hi %22 + guest_list%5B1%5D + %22 you are in... | |
5c7538ca1e43eb4529c04169a9a15c513bc3e659 | Add segment_tangent_angle tests module | tests/plantcv/morphology/test_segment_tangent_angle.py | tests/plantcv/morphology/test_segment_tangent_angle.py | Python | 0.000001 | @@ -0,0 +1,595 @@
+import pytest%0Aimport cv2%0Afrom plantcv.plantcv import outputs%0Afrom plantcv.plantcv.morphology import segment_tangent_angle%0A%0A%0A@pytest.mark.parametrize(%22size%22, %5B3, 100%5D)%0Adef test_segment_tangent_angle(size, morphology_test_data):%0A # Clear previous outputs%0A outputs.clear()... | |
6d2d224d246569a35a7b4ae5d8086e83bbb67155 | move server.py to project dir | server/server.py | server/server.py | Python | 0 | @@ -0,0 +1,1802 @@
+from datetime import datetime%0Aimport json%0Afrom http.server import BaseHTTPRequestHandler, HTTPServer%0A%0ASERVER_PORT = 90%0AHOST_ADDRESS = ''%0A%0A%0Adef save_data(user_email):%0A file = open('users.txt', 'a+')%0A current_time = datetime.now().strftime('%25Y-%25m-%25d %25H:%25M:%25S')%0A ... | |
a8db8c0448d98e2de0e662581542bd644e673c7c | Add migration removing generated objects with factories | geotrek/core/migrations/0018_remove_other_objects_from_factories.py | geotrek/core/migrations/0018_remove_other_objects_from_factories.py | Python | 0 | @@ -0,0 +1,886 @@
+# Generated by Django 2.0.13 on 2020-04-06 13:40%0A%0Afrom django.conf import settings%0Afrom django.contrib.gis.geos import Point, LineString%0Afrom django.db import migrations%0A%0A%0Adef remove_generated_objects_factories(apps, schema_editor):%0A ComfortModel = apps.get_model('core', 'Comfort')... | |
3ddf1f4a2bcae247978b66fd63848b3ed9782234 | add donwloader | MistDownloader.py | MistDownloader.py | Python | 0.000014 | @@ -0,0 +1,1078 @@
+#!/usr/bin/python%0D%0A# -*- coding: utf-8 -*-%0D%0Aimport urllib%0D%0Aimport os%0D%0Aimport time%0D%0Aimport sys%0D%0Aimport traceback%0D%0A%0D%0Acnt=0%0D%0Aleast_cnt=0%0D%0Aif len(sys.argv)==2:%0D%0A%09least_cnt=int(sys.argv%5B1%5D)%0D%0Aprint least_cnt%0D%0A%0D%0Aif not os.path.exists(%22mp3%22):... | |
54e3d3147feb33f21c5bc78a8f3b4721574fcbb9 | Create A.py | Google-Code-Jam/2017-1B/A.py | Google-Code-Jam/2017-1B/A.py | Python | 0.000004 | @@ -0,0 +1,1054 @@
+import os%0Aimport sys%0A%0A%0Ascript = __file__%0AscriptPath = os.path.dirname(script)%0AscriptFile = os.path.basename(script)%5B0%5D%0Afiles = %5Bf for f in os.listdir(scriptPath) if scriptFile in f and '.in' in f%5D%0Aif '%7B%7D-large'.format(scriptFile) in str(files):%0A size = 'large'%0Aelif '... | |
a067c18f8534d79a85538eaf11e34e99f9e17286 | develop update to pair master, going to rename master now | oh_shit.py | oh_shit.py | Python | 0 | @@ -0,0 +1,1331 @@
+from app import app, db%0Afrom app.mod_sms.models import *%0A%0Aug1 = UserGroup(name='Canyon Time', phone='+17868378095', active=True)%0Aug2 = UserGroup(name='test', phone='+18503783607', active=True)%0A%0Aryan = User(fname='Ryan', lname='Kuhl', phone='+13058985985', active=True)%0Asimon = User(fna... | |
01c98087541828421da49295abedd3d894cdb3b5 | Create luz.py | opt/luz.py | opt/luz.py | Python | 0.000028 | @@ -0,0 +1,874 @@
+#!/usr/bin/env python%0A%0A#%09Realizado por: Roberto Arias (@bettocr)%0A#%09%0A#%09Permite encender y apagar luces leds%0A#%09%0A%0Aimport RPi.GPIO as GPIO, time, os %0A%0AGPIO.setmode(GPIO.BCM)%0Aon = 0 # luces encendidas%0AMAX=5200 # luminocidad maxima antes de encender el led, entre mayor ma... | |
fe186bf85472cf4e683d9838e36e60c680e6dc77 | Add test | python/ql/test/library-tests/PointsTo/new/code/w_function_values.py | python/ql/test/library-tests/PointsTo/new/code/w_function_values.py | Python | 0.000319 | @@ -0,0 +1,425 @@
+def test_conditoinal_function(cond):%0A def foo():%0A return %22foo%22%0A%0A def bar():%0A return %22bar%22%0A%0A if cond:%0A f = foo%0A else:%0A f = bar%0A%0A sink = f()%0A return sink%0A%0A%0Af_false = test_conditoinal_function(False)%0Af_true = test_co... | |
1afb7bb7b1f3e8ef3070f1100dac683b2b8254ee | remove unused table | xbrowse_server/base/migrations/0003_delete_xhmmfile.py | xbrowse_server/base/migrations/0003_delete_xhmmfile.py | Python | 0.000013 | @@ -0,0 +1,318 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('base', '0002_auto_20160117_1843'),%0A %5D%0A%0A operations = %5B%0A migrations.DeleteMode... | |
49c673c5c8374867fc9bf026717fe137bdba84bc | Add test file for graph.py and add test of Greengraph class constructor | greengraph/test/test_graph.py | greengraph/test/test_graph.py | Python | 0 | @@ -0,0 +1,622 @@
+from greengraph.map import Map%0Afrom greengraph.graph import Greengraph%0Afrom mock import patch%0Aimport geopy%0Afrom nose.tools import assert_equal%0A%0Astart = %22London%22%0Aend = %22Durham%22%0A%0Adef test_Greengraph_init():%0A with patch.object(geopy.geocoders,'GoogleV3') as mock_GoogleV3:%... | |
54553efa024d74ec60647ea7616191a52fe9948f | Add a command to create collaborator organisations | akvo/rsr/management/commands/create_collaborator_organisation.py | akvo/rsr/management/commands/create_collaborator_organisation.py | Python | 0 | @@ -0,0 +1,1364 @@
+# -*- coding: utf-8 -*-%0A%0A# Akvo Reporting is covered by the GNU Affero General Public License.%0A# See more details in the license.txt file located at the root folder of the Akvo RSR module.%0A# For additional details on the GNU license please see %3C http://www.gnu.org/licenses/agpl.html %3E.%0... | |
2b7de72ef67d3a7216902cfc6073760336d9d67a | use separate test project from ForgeSVN's tests | ForgeImporters/forgeimporters/google/tests/test_code.py | ForgeImporters/forgeimporters/google/tests/test_code.py | from unittest import TestCase
from mock import Mock, patch
from allura.tests import TestController
from forgesvn.tests import with_svn
from forgeimporters.google.code import (
get_repo_url,
GoogleRepoImporter,
GoogleRepoImportController,
)
class TestGetRepoUrl(TestCase):
def tes... | Python | 0 | @@ -102,38 +102,275 @@
rom
-forgesvn.tests import with_svn
+allura.tests.decorators import with_tool%0A%0A%0A# important to be distinct from 'test' which ForgeSVN uses, so that the tests can run in parallel and not clobber each other%0Atest_project_with_repo = 'test2'%0Awith_svn = with_tool(test_project_with_repo, 'S... |
a3d837afe6662edb10395baa8851de551d0915a5 | add email templates tests | auth0/v3/test/management/test_email_endpoints.py | auth0/v3/test/management/test_email_endpoints.py | Python | 0.000001 | @@ -0,0 +1,1337 @@
+import unittest%0Aimport mock%0Afrom ...management.email_templates import EmailTemplates%0A%0A%0Aclass TestClients(unittest.TestCase):%0A%0A @mock.patch('auth0.v3.management.email_templates.RestClient')%0A def test_create(self, mock_rc):%0A mock_instance = mock_rc.return_value%0A%0A ... | |
cee2683d3c0a60739b8e4f1c1dbaa74981a42392 | add class skeleton for schedule generator | angular_flask/classtime/scheduler.py | angular_flask/classtime/scheduler.py | Python | 0 | @@ -0,0 +1,1038 @@
+class Scheduler(object):%0A %22%22%22%0A Helper class which builds optimal schedules out of %0A class listings.%0A%0A Use static methods only - do not create instances of%0A the class.%0A %22%22%22%0A def __init__(self):%0A pass%0A%0A @staticmethod%0A def generate_s... | |
82e4c67bd7643eed06e7cd170ca1d0de41c70912 | Add a data analyzer class. | core/data/DataAnalyzer.py | core/data/DataAnalyzer.py | Python | 0 | @@ -0,0 +1,744 @@
+%22%22%22%0ADataAnalyzer%0A%0A:Authors:%0A%09Berend Klein Haneveld%0A%22%22%22%0A%0A%0Aclass DataAnalyzer(object):%0A%09%22%22%22%0A%09DataAnalyzer%0A%09%22%22%22%0A%0A%09def __init__(self):%0A%09%09super(DataAnalyzer, self).__init__()%0A%0A%09@classmethod%0A%09def histogramForData(cls, data, nrBins)... | |
3f85610873d88592970c64661e526b2a576e300f | Add new sms message generator | sms_generator.py | sms_generator.py | Python | 0.000003 | @@ -0,0 +1,1145 @@
+def generate_new_procedure_message(procedure, ward, timeframe, doctor):%0A unique_reference = str(1)%0A message = str.format(%22%7B0%7D is available on %7B1%7D. Attend the ward in %7B2%7D and meet %7B3%7D in the junior doctors' office. %22%0A %22To accept this opportuni... | |
926631d068a223788714cd645ae5336881c6853f | Update messageable.py | praw/models/reddit/mixins/messageable.py | praw/models/reddit/mixins/messageable.py | """Provide the MessageableMixin class."""
from ....const import API_PATH
class MessageableMixin:
"""Interface for classes that can be messaged."""
def message(self, subject, message, from_subreddit=None):
"""
Send a message to a redditor or a subreddit's moderators (mod mail).
:param... | Python | 0.000001 | @@ -475,17 +475,8 @@
g to
- send the
%0A
@@ -484,16 +484,25 @@
+send the
message
@@ -540,24 +540,36 @@
re sent from
+%0A
the subredd
@@ -570,28 +570,16 @@
ubreddit
-%0A
rather
@@ -611,16 +611,28 @@
ed user.
+%0A
Note th
@@ -637,28 +637,16 @@
that the
-%0A ... |
73bd8200f6ad23c60a05831e3b79497b830f19cd | Update old lithium comments about llvm-symbolizer 3.6 to 3.8 versions. | interestingness/envVars.py | interestingness/envVars.py | #!/usr/bin/env python
#
# 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/.
import copy
import os
import platform
isLinux = (platform.system() == 'Linux')
isMac = (platfor... | Python | 0 | @@ -1124,32 +1124,76 @@
th version 3.6.2
+,%0A # assumed to work with clang 3.8.0
.%0A # Crea
@@ -1265,17 +1265,17 @@
lizer-3.
-6
+8
%0A
@@ -1554,17 +1554,17 @@
lizer-3.
-6
+8
.'%0A
@@ -1616,17 +1616,17 @@
lizer-3.
-6
+8
/usr/bi
|
378cb69d413eb8ffaf811b607fc037be923a2aba | Write tests for SSLRedirectMiddleware | iogt/tests/test_middleware.py | iogt/tests/test_middleware.py | Python | 0 | @@ -0,0 +1,1629 @@
+from django.test import (%0A TestCase,%0A Client,%0A RequestFactory,%0A override_settings,%0A)%0A%0Afrom molo.core.tests.base import MoloTestCaseMixin%0Afrom molo.core.models import Main%0A%0Afrom iogt.middleware import SSLRedirectMiddleware%0A%0A%0APERMANENT_REDIRECT_STATUS_CODE = 301%0... | |
e0ac456eae45a1b7e1482ff712be600b384f94b3 | Include new example to show group circle connectivity. | examples/connectivity/plot_custom_grouped_connectivity_circle.py | examples/connectivity/plot_custom_grouped_connectivity_circle.py | Python | 0 | @@ -0,0 +1,2695 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AExample how to create a custom label groups and plot grouped connectivity%0Acircle with these labels.%0A%0AAuthor: Praveen Sripad %3Cpravsripad@gmail.com%3E%0A Christian Kiefer %3Cch.kiefer@fz-juelich.de%3E%0A%22%22%22%0A%0Aimport matplotlib.pyplot as pl... | |
f50efeb78d9b503a7d6e97db8b1cd68b429aa2c4 | allow to run tox as 'python -m tox', which is handy on Windoze | tox/__main__.py | tox/__main__.py | Python | 0 | @@ -0,0 +1,38 @@
+from tox._cmdline import main%0A%0Amain()%0A
| |
f7e504652707b09c0a0b7e7b1691094ef6d35509 | add proper tomography example | examples/solvers/conjugate_gradient_tomography.py | examples/solvers/conjugate_gradient_tomography.py | Python | 0.998527 | @@ -0,0 +1,2901 @@
+# Copyright 2014-2016 The ODL development group%0A#%0A# This file is part of ODL.%0A#%0A# ODL is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at... | |
236d7d885dadcb681357212a5c6b53c28eac0aa1 | Create d1-1.py | 2018/d1-1.py | 2018/d1-1.py | Python | 0.000001 | @@ -0,0 +1,167 @@
+with open(%22completed/input_c1-1.txt%22, %22r%22) as f:%0A line = %220%22%0A sum = 0%0A while line:%0A sum += int(line)%0A line = f.readline()%0A print(%22Final Frequency: %7B%7D%22, sum)%0A
| |
8de92e74317a74b53991bdcbb3594f0e94e4cf17 | Add Monty Hall simulation | montyhall.py | montyhall.py | Python | 0 | @@ -0,0 +1,1230 @@
+import random%0Aimport sys%0A%0Adef game():%0A # Place car behind one door%0A car = random.randint(1, 3)%0A # Player selects a door%0A first_choice = random.randint(1, 3)%0A%0A reveal_options = %5B1, 2, 3%5D%0A # Don't reveal the car%0A reveal_options.remove(car)%0A # Don't r... | |
b177a0f2e9b42347f56c4499aaa080af97e0e530 | add validity check | 2018/04.10/python/jya_gAPIclass.2.py | 2018/04.10/python/jya_gAPIclass.2.py | Python | 0.000001 | @@ -0,0 +1,1843 @@
+import requests, base64%0Aimport config%0A%0Aid = config.GAPI_CONFIG%5B'client_id'%5D%0Asecret = config.GAPI_CONFIG%5B'client_secret'%5D%0Atype = config.GAPI_CONFIG%5B'grant_type'%5D%0A%0Aclass GapiClass:%0A def __init__(self, host='https://gapi.gabia.com'):%0A self.__host = host%0A ... | |
8e8e11990e430302eca24d32ba0b88dcc66233d6 | Add connect2 wifi via pyobjc | clburlison_scripts/connect2_wifi_pyobjc/connect2_wifi_pyobjc.py | clburlison_scripts/connect2_wifi_pyobjc/connect2_wifi_pyobjc.py | Python | 0 | @@ -0,0 +1,546 @@
+#!/usr/bin/python%0A%22%22%22%0AI didn't create this but I'm storing it so I can reuse it.%0Ahttp://stackoverflow.com/a/34967364/4811765%0A%22%22%22%0Aimport objc%0A%0ASSID = %22MyWifiNetwork%22%0APASSWORD = %22MyWifiPassword%22%0A%0Aobjc.loadBundle('CoreWLAN',%0A bundle_path='/System/... | |
a6d6b833e33dc465b0fa828018e2cbba748f8282 | Add utility class for evaluation | pygraphc/evaluation/EvaluationUtility.py | pygraphc/evaluation/EvaluationUtility.py | Python | 0 | @@ -0,0 +1,457 @@
+%0Aclass EvaluationUtility(object):%0A @staticmethod%0A def convert_to_text(graph, clusters):%0A # convert clustering result from graph to text%0A new_clusters = %7B%7D%0A for cluster_id, nodes in clusters.iteritems():%0A for node in nodes:%0A memb... | |
a2a2d6ab7edaa6fab9d2fb95586fde8f1f74b1cc | add new package (#24672) | var/spack/repos/builtin/packages/py-aniso8601/package.py | var/spack/repos/builtin/packages/py-aniso8601/package.py | Python | 0 | @@ -0,0 +1,557 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyAniso8601(PythonPackage):%0A %22%22%22A library for pa... | |
f9a8642e3c5cfbce2e949c019dce3d538eefcd43 | Juan Question | JuanQuestion/Juan.py | JuanQuestion/Juan.py | Python | 0.999983 | @@ -0,0 +1,626 @@
+from string import uppercase%0D%0Afrom string import lowercase%0D%0A%0D%0Aif __name__ == '__main__':%0D%0A asking = True%0D%0A%0D%0A print(%22Juan Questions%22)%0D%0A print(%22Presione 1 para salir%22)%0D%0A%0D%0A while asking == True:%0D%0A response = input(%22Pregunta algo: %22)%... | |
44eaf0fda528dcf2260f01fd8fd1ac12c138c594 | Remove Duplicate code. | oneflow/profiles/models.py | oneflow/profiles/models.py | # -*- coding: utf-8 -*-
import uuid
import base64
from jsonfield import JSONField
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
#from django.db.models.signals import post_save
#from django.contrib.auth import get_user_model
from django.utils.translation im... | Python | 0.000004 | @@ -2640,1992 +2640,8 @@
)%0A%0A%0A
-class AbstractUserProfile(models.Model):%0A %22%22%22 A mixin for any User class (even not real Django %60User%60)%0A which adds primitives to get/set if a given email was sent%0A to the user, and various other methods based on profile data.%0A%0A It's under... |
6a6abadc2395810076b89fb38c759f85426a0304 | Add framework for own SVM from scratch | supportVectorMachine/howItWorksSupportVectorMachine.py | supportVectorMachine/howItWorksSupportVectorMachine.py | Python | 0 | @@ -0,0 +1,781 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Support Vector Machine (SVM) classification for machine learning.%0A%0ASVM is a binary classifier. The objective of the SVM is to find the best%0Aseparating hyperplane in vector space which is also referred to as the%0Adecision boundary. And it decides what separati... | |
2e1c257c0215f398e4ac5cc7d2d20ffa62492817 | Create NewChatAlert.pyw | NewChatAlert.pyw | NewChatAlert.pyw | Python | 0 | @@ -0,0 +1,2760 @@
+# TODO: Check for cookie expiration%0A# TODO: Check for failed request%0A# TODO: Check for rejected cookie%0A# TODO: Get Cookie from other browsers (IE and Firefox)%0A# - See https://bitbucket.org/richardpenman/browser_cookie (and perhaps contribute)?%0A%0Afrom os import getenv%0Afrom sqlite3 ... | |
1d4938232aa103ea2a919796e9fa35e2699d41d9 | Create PythonAnswer2.py | PythonAnswer2.py | PythonAnswer2.py | Python | 0.999202 | @@ -0,0 +1,370 @@
+def fibonacci(x):%0A a = 0 #first number%0A b = 1 #second number%0A for x in range(x - 1):%0A a, b = b, a + b #a becomes b and b becomes a and b added together%0A return a #returns the next number in the sequence%0A%0Aprint %22Fibonacci Answer%22%0Afor x in range(1, 35): ... | |
5c60be411e61d5edfbf658509b437973d596a3ba | Create server.py | Networking/server.py | Networking/server.py | Python | 0.000001 | @@ -0,0 +1,2006 @@
+# -*- coding: utf-8 -*-%0A%0Aimport socket, math%0A%0A# demarrage du serveur%0Aserver = %22127.0.0.1%22%0Aport = 55042%0Amysock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)%0Amysock.bind((server, port))%0A%0AJOG_IP = %5BNone,None,None,None,None,None,None,None,None,None%5D%0AJOG_coordinates= %5... | |
92ec849fc18d7cb610839abe2213ce30ceced46b | Add ci settings file for postgresql database | InvenTree/InvenTree/ci_postgresql.py | InvenTree/InvenTree/ci_postgresql.py | Python | 0 | @@ -0,0 +1,457 @@
+%22%22%22%0AConfiguration file for running tests against a MySQL database.%0A%22%22%22%0A%0Afrom InvenTree.settings import *%0A%0A# Override the 'test' database%0Aif 'test' in sys.argv:%0A eprint('InvenTree: Running tests - Using MySQL test database')%0A %0A DATABASES%5B'default'%5D = %7B%0A... | |
f7db5d9cac80432a7016043a1b2781fbaa7f040e | Create new package. (#6891) | var/spack/repos/builtin/packages/r-rappdirs/package.py | var/spack/repos/builtin/packages/r-rappdirs/package.py | Python | 0 | @@ -0,0 +1,1765 @@
+##############################################################################%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... | |
6d2efcea281775c31cd1df29eac63054e3fe51df | Create solution.py | data_structures/linked_list/problems/delete_n_after_m/py/solution.py | data_structures/linked_list/problems/delete_n_after_m/py/solution.py | Python | 0.000018 | @@ -0,0 +1,899 @@
+import LinkedList%0A%0A# Problem description: %0A# Solution time complexity: %0A# Comments: %0A%0A# Linked List Node inside the LinkedList module is declared as:%0A#%0A# class Node:%0A# def __init__(self, val, nxt=None):%0A# self.val = val%0A# self.nxt... | |
c84ce4b2494771c48890c122420e4665828ac4f8 | Solve Code Fights different rightmost bit problem | CodeFights/differentRightmostBit.py | CodeFights/differentRightmostBit.py | Python | 0.00005 | @@ -0,0 +1,711 @@
+#!/usr/local/bin/python%0A# Code Different Right-most Bit (Core) Problem%0A%0A%0Adef differentRightmostBit(n, m):%0A return (n %5E m) & -(n %5E m)%0A%0A%0Adef main():%0A tests = %5B%0A %5B11, 13, 2%5D,%0A %5B7, 23, 16%5D,%0A %5B1, 0, 1%5D,%0A %5B64, 65, 1%5D,%0A ... | |
8d0d564eae53a10b98b488b8c13eb952134cfc5e | Create 0408_country_body_part.py | 2018/0408_country_body_part.py | 2018/0408_country_body_part.py | Python | 0.000023 | @@ -0,0 +1,613 @@
+#!/usr/bin/python%0A'''%0ANPR 2018-04-08%0Ahttp://www.npr.org/puzzle%0A%0AName part of the human body, insert a speech hesitation, and you'll name a country %E2%80%94 what is it?%0A'''%0A%0Afrom nltk.corpus import gazetteers%0Aimport nprcommontools as nct%0A%0A#%25%25%0ABODY_PARTS = nct.get_category_... | |
61ec74a685deec0b1ddc0a9274e5df0a597c6b6b | Create TweetStreamer.py | TweetStreamer.py | TweetStreamer.py | Python | 0.000001 | @@ -0,0 +1,2337 @@
+import tweepy%0Afrom tweepy import Stream%0Afrom tweepy import OAuthHandler%0Afrom tweepy.streaming import StreamListener%0Aimport json%0Afrom elasticsearch import Elasticsearch%0Aimport datetime%0Afrom watson_developer_cloud import NaturalLanguageUnderstandingV1%0Aimport watson_developer_cloud.natu... | |
3345dc2f1ac15f06d3e95b5ead894ee9d3a27d9e | Add file writer utility script | piwrite.py | piwrite.py | Python | 0.000001 | @@ -0,0 +1,498 @@
+#!/bin/env python%0A%0Aimport argparse%0Aimport sys%0Aimport os%0A%0Aparser = argparse.ArgumentParser(description=%22Write multiple svgs from stdin to files%22)%0Aparser.add_argument('-o', '--outfile', metavar='OUTFILE', default='output.svg')%0A%0Aargs = parser.parse_args()%0A%0Abase, extension = os.... | |
7147dfc237acb64a8e655e63681a387282043994 | Add lc0031_next_permutation.py | lc0031_next_permutation.py | lc0031_next_permutation.py | Python | 0.000001 | @@ -0,0 +1,839 @@
+%22%22%22Leetcode 31. Next Permutation%0AMedium%0A%0AURL: https://leetcode.com/problems/next-permutation/%0A%0AImplement next permutation, which rearranges numbers into the lexicographically%0Anext greater permutation of numbers.%0A%0AIf such arrangement is not possible, it must rearrange it as the l... | |
46d5b197e022815c2074fbc94ca324d31d470dd0 | Implement a fasttext example (#3446) | examples/imdb_fasttext.py | examples/imdb_fasttext.py | Python | 0 | @@ -0,0 +1,2003 @@
+'''This example demonstrates the use of fasttext for text classification%0A%0ABased on Joulin et al's paper:%0A%0ABags of Tricks for Efficient Text Classification%0Ahttps://arxiv.org/abs/1607.01759%0A%0ACan achieve accuracy around 88%25 after 5 epochs in 70s.%0A%0A'''%0A%0Afrom __future__ import pri... | |
dde0efeec1aca8ed3ec2e444bbb4c179be89fec5 | Create MooreNeightbourhood.py | Checkio/MooreNeightbourhood.py | Checkio/MooreNeightbourhood.py | Python | 0 | @@ -0,0 +1,1787 @@
+def count_neighbours(grid, row, col):%0A neig = 0%0A if (col - 1 %3E= 0):%0A if (grid%5Brow%5D%5Bcol - 1%5D == 1):%0A neig += 1%0A if (col - 1 %3E= 0 and row - 1 %3E= 0):%0A if (grid%5Brow - 1%5D%5Bcol -1%5D == 1):%0A neig += 1%0A if (row - 1 %3E= 0):%... | |
a3df0567c295f0b2879c9a4f095a31108359d531 | Add missing migration for invoice status | nodeconductor/billing/migrations/0003_invoice_status.py | nodeconductor/billing/migrations/0003_invoice_status.py | Python | 0 | @@ -0,0 +1,439 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('billing', '0002_pricelist'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0A ... | |
269a34e87797a3271013e23d504a6f6a159ae48e | Index testgroup_test.test_id | migrations/versions/3a3366fb7822_index_testgroup_test.py | migrations/versions/3a3366fb7822_index_testgroup_test.py | Python | 0.000011 | @@ -0,0 +1,432 @@
+%22%22%22Index testgroup_test.test_id%0A%0ARevision ID: 3a3366fb7822%0ARevises: 139e272152de%0ACreate Date: 2014-01-02 22:20:55.132222%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '3a3366fb7822'%0Adown_revision = '139e272152de'%0A%0Afrom alembic import op%0A%0A%0Adef upgr... | |
7b40a4902d1dc43c73a7858fc9286a641b3a9666 | Add validation function removed from main script. | assess_isoform_quantification/options.py | assess_isoform_quantification/options.py | Python | 0 | @@ -0,0 +1,191 @@
+from schema import Schema%0A%0A%0Adef validate_file_option(file_option, msg):%0A msg = %22%7Bmsg%7D '%7Bfile%7D'.%22.format(msg=msg, file=file_option)%0A return Schema(open, error=msg).validate(file_option)%0A
| |
d04118acc5421d4b48e31c78874a740eb469c3d7 | fix boan1244 'Boëng' | migrations/versions/506dcac7d75_fix_boan1244_mojibake.py | migrations/versions/506dcac7d75_fix_boan1244_mojibake.py | Python | 0.000001 | @@ -0,0 +1,821 @@
+# coding=utf-8%0A%22%22%22fix boan1244 mojibake%0A%0ARevision ID: 506dcac7d75%0ARevises: 4513ba6253e1%0ACreate Date: 2015-04-15 19:20:59.059000%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '506dcac7d75'%0Adown_revision = '4513ba6253e1'%0A%0Aimport datetime%0A%0Afrom alemb... | |
85e4a327ba641fbe9c275b4760c60683ca215d61 | Add unit tests. | test_pto.py | test_pto.py | Python | 0 | @@ -0,0 +1,1613 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Tests for PTO.%22%22%22%0Aimport unittest%0A%0A%0Aimport pto%0Aimport time%0A%0A%0A_TIMEOUT = 5%0A_FUZZ_FACTOR = 1%0A%0A%0Aclass SlowClass(object):%0A @pto.timeout(_TIMEOUT)%0A def slow_instance_method(self):%0A cut_off = time.t... | |
2067bdb9d0f9947a674cb94d0c988049f3038ea4 | create test stubs | test_viz.py | test_viz.py | Python | 0.000002 | @@ -0,0 +1,636 @@
+def test_create_distance_matrix():%0A pass%0A%0Adef test_get_translation_table():%0A pass%0A%0A%0Adef test_naive_backtranslate():%0A pass%0A%0Adef test_get_peptide_index():%0A pass%0A%0Adef test_demo_dna_features_viewer():%0A pass%0A%0Adef test_ngrams():%0A pass%0A%0Adef test_make_t... | |
e304aae71617cdba0ffcb720a24406375fb866a1 | Copy of Ryan's PCMToWave component. | Sketches/MH/audio/ToWAV.py | Sketches/MH/audio/ToWAV.py | Python | 0.000002 | @@ -0,0 +1,2775 @@
+from Axon.Component import component%0Aimport string%0Aimport struct%0Afrom Axon.Ipc import producerFinished, shutdown%0A%0Aclass PCMToWave(component):%0A def __init__(self, bytespersample, samplingfrequency):%0A super(PCMToWave, self).__init__()%0A self.bytespersample = bytespersam... | |
0ac91856caf274cee92c1261dfd9cb652f1c665f | Fix 'test_help' for shell client. | glanceclient/tests/functional/test_readonly_glance.py | glanceclient/tests/functional/test_readonly_glance.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
# d... | Python | 0 | @@ -4309,16 +4309,87 @@
ge-list'
+, 'image-deactivate',%0A 'image-reactivate'
))%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.