commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
58627bd4cbe100a7cbd526be38cd69e8605984cd | Add json-encoder example | examples/json-encoder.py | examples/json-encoder.py | #!/usr/bin/env python3
from pycnic.core import WSGI, Handler
import datetime
import json
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime.datetime):
return o.isoformat()
return json.JSONEncoder.default(self, o)
class Hello(Handler):
def get... | Python | 0.000082 | |
ebfe2faa5fcf66f3f1ece597922d4a72b59c3e43 | Create B_Averages_ocean.py | Cas_1/B_Averages_ocean.py | Cas_1/B_Averages_ocean.py | #Averages of U,V,W,T,S and ETA
import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
dir0 = '/homedata/bderembl/runmit/test_southatlgyre' #Case 1 : 38 iterations
ds0 = open_mdsdataset(dir0,prefix=['Eta','U','V','W','T','S'])
pr... | Python | 0.001485 | |
8ada83d3140b871d7699988996ff7427c0526c9b | Remove extraneous logging from benchmarks | tensorflow/python/data/benchmarks/benchmark_base.py | tensorflow/python/data/benchmarks/benchmark_base.py | # Copyright 2019 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... | # Copyright 2019 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.000001 |
9afe19676cbb87985939bd0099301a7003a38b7f | check for monitoring file and directory count | samples/folder_check.py | samples/folder_check.py | #!/usr/bin/env python
import json,os,time
PLUGIN_VERSION="1"
HEARTBEAT="true"
#set this value to 1 if the file count needs to be recursive
INCLUDE_RECURSIVE_FILES=None
FOLDER_NAME="/"
THRESHOLD_COUNT=10
def get_data():
folder_checks_data = {}
folder_checks_data['plugin_version'] = PLUGIN_VERSION
fold... | Python | 0 | |
d881ee2866bb422a266871c1b426d76c669025da | Test for CASSANDRA-8741 | nodetool_test.py | nodetool_test.py | from ccmlib.node import NodetoolError
from dtest import Tester
from tools import require
class TestNodetool(Tester):
@require("8741")
def test_decommission_after_drain_is_invalid(self):
"""
@jira_ticket CASSANDRA-8741
Running a decommission after a drain should generate
an un... | Python | 0 | |
125b9ce4bc5b5966f3730f3d99dba122b1d295eb | use session.request instead of session.{method} | src/sentry/http.py | src/sentry/http.py | """
sentry.utils.http
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sentry
import six
import socket
import requests
import warnings
from django.conf import settings
from djan... | """
sentry.utils.http
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sentry
import six
import socket
import requests
import warnings
from django.conf import settings
from djan... | Python | 0 |
72cbdd0c1cf804eecb8f503f86e6be237719bf99 | add echo client for testing | network/echo-server/echo-client/main.py | network/echo-server/echo-client/main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | Python | 0.000003 | |
be96a2f7e3aeb59727ba88913cc6fda97bf8a423 | Add some unit tests | InvenTree/company/test_views.py | InvenTree/company/test_views.py | """ Unit tests for Company views (see views.py) """
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from .models import SupplierPart
class CompanyViewTest(TestCase):
fixtures = [
... | Python | 0.000001 | |
725832be85b7b0455cb735ce8a054007209d9645 | test scan scraper | src/hsimage.py | src/hsimage.py | import sys
from PIL import Image
img = Image.open(sys.argv[1])
width, height = img.size
xblock = 5
yblock = 5
w_width = width / xblock
w_height = height / yblock
blockmap = [(xb*w_width, yb*w_height, (xb+1)*w_width, (yb+1)*w_height)
for xb in xrange(xblock) for yb in xrange(yblock)]
newblockmap = list(bloc... | Python | 0.000001 | |
dede46a2d5ad1504991b05b8edab4d1ffd781f46 | fix out of range error in tracker remover plugin | searx/plugins/tracker_url_remover.py | searx/plugins/tracker_url_remover.py | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | '''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | Python | 0 |
a6fb8c86e14722527ff004ca1378458df252f8c0 | add doxygen module | modules/doxygen.py | modules/doxygen.py | """Doxygen module.
Create project's documentation.
Website: http://www.doxygen.org
"""
import os
import shlex
def doxygen(loader, variant=None, *args):
if len(args) == 1:
args = shlex.split(args[0])
if variant is None:
variant = os.environ.get('PROJECT_VARIANT',
loader.config... | Python | 0.000001 | |
7a74f85fc76af2df62bb92ff2997ab1b84caa3a0 | Test dummy IRC bot | tests/test_irc_bot_dummy.py | tests/test_irc_bot_dummy.py | """
:Copyright: 2007-2021 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
import pytest
from syslog2irc.irc import create_bot, IrcChannel, IrcConfig
from syslog2irc.signals import irc_channel_joined
@pytest.fixture
def config():
channels = {IrcChannel('#one'), IrcChannel('#two')}
return Ir... | Python | 0.000001 | |
3be6fadffbce4cdf5d45f4b34035b55db6abe2fc | add script for creating otu-tree table | ottreeindex/scripts/create_otu_table.py | ottreeindex/scripts/create_otu_table.py | # Collects the OTU - tree relationships across phylesystem
# Prints to file which is then inserted into postgres with COPY
# This is much faster than many inserts
from peyotl.api.phylesystem_api import PhylesystemAPI
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl import gen_otu_dict, iter_... | Python | 0 | |
a8ec11719ccc158fd457ed02f2b8459d1b452975 | Create tweets.py | tweets.py | tweets.py | import sqlite3
def main(cursor):
cursor.execute("select * from tweets")
for tweet in cursor.fetchall():
tid = tweet[0]
tdate = tweet[1]
text = tweet[2]
geo = tweet[3]
t = str(tdate + text + geo)
print '-----tweet: %s ' % text
print '------date: %... | Python | 0.000008 | |
0fa30986e1f97331f96444e0b3b0f86cbe20c68a | Add tests for JsonBackend __init__ and commit methods | shadho/backend/json/tests/test_db.py | shadho/backend/json/tests/test_db.py | import pytest
from shadho.backend.base.tests.test_db import TestBaseBackend
from shadho.backend.json.db import JsonBackend
import json
import os
import shutil
class TestJsonBackend(object):
def test_init(self):
"""Ensure that initialization sets up the db and filepath."""
# Test default initial... | Python | 0.000002 | |
871f79a0b2bd235df457e3a1dc502d5c18bd934a | Add some generic python utilities as a basis for scripts | tools/build/common_utils.py | tools/build/common_utils.py | from __future__ import print_function
import os
def game_root_path():
file_path = os.path.dirname(os.path.abspath(__file__))
return os.path.abspath(os.path.join(file_path, '..', '..'))
def files_with_type(root, type):
all_files = [os.path.join(root, filename) for filename in os.listdir(root)]
typed_f... | Python | 0.000001 | |
7d22c38348ccd411871942ef0dd43ed57794de16 | include benchmark code | bench.py | bench.py | from statistics import mean
import heapq
import importlib
import time
import numpy as np
r = np.random.random(1000*1000)
mergers = {
'heapq': ('merge', 'nlargest', 'nsmallest'),
'cyheapq': ('merge', 'nlargest', 'nsmallest'),
'cytoolz': ('merge_sorted', 'topk', None),
}
mods = list(mergers.keys())
name... | Python | 0.000001 | |
5b2aebb9b9f9fafe291f0890f03c44abd661ca68 | add celery_work | celery_work.py | celery_work.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from celery import Celery, platforms
from app import create_app
def make_celery(app):
"""Create the celery process."""
# Init the celery object via app's configuration.
celery = Celery(
app.import_name,
backend=app.config['CELERY_RE... | Python | 0.999978 | |
9c53e59ee0c4e5418b54d47c932454b7b907dc03 | Revert escape nickname, desc, etc in user profile | seahub/profile/forms.py | seahub/profile/forms.py | # encoding: utf-8
from django import forms
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, username):
nickname = self.cleaned_... | # encoding: utf-8
from django import forms
from django.utils.html import escape
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, userna... | Python | 0 |
b23ec502b89ab70b9e8edd1868f4e9717392b7b2 | Add missing migrations | account/migrations/0004_auto_20170416_1821.py | account/migrations/0004_auto_20170416_1821.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-16 18:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0003_passwordexpiry_passwordhistory'),
]
operations = [
migrations.AlterMo... | Python | 0.000029 | |
9a691ae746c5b501ed37792383600da1ba381b20 | Add exitcode.py | bin/exitcode.py | bin/exitcode.py | #!/usr/bin/env python
#
# Copyright 2010 University Of Southern California
#
# 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.000195 | |
ae94990bc8b790b5307ccaee992f09fefc045692 | add Tester lockedNormal | python/medic/plugins/Tester/lockedNormal.py | python/medic/plugins/Tester/lockedNormal.py | from medic.core import testerBase
from maya import OpenMaya
class LockedNormal(testerBase.TesterBase):
Name = "LockedNormal"
Description = "vertex(s) which has locked normal"
Fixable = True
def __init__(self):
super(LockedNormal, self).__init__()
def Match(self, node):
return nod... | Python | 0 | |
6852efdb02925a4e300611b49a693c59ca13e7b0 | Add wrapper for new vulkan worker (#6) | python/src/main/python/drivers/worker_vk.py | python/src/main/python/drivers/worker_vk.py | #!/usr/bin/env python3
# Copyright 2018 The GraphicsFuzz Project Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Python | 0 | |
088ec16cf33d4be4b396976d9e9ab1a5f17045fc | make contrib an app | adhocracy4/contrib/apps.py | adhocracy4/contrib/apps.py | from django.apps import AppConfig
class OrganisationsConfig(AppConfig):
name = 'adhocracy4.contrib'
label = 'a4contrib'
| Python | 0.000012 | |
e020f81593268899a04cce726823c512b8b54762 | copy over the PlotContainerEditor to the more appropriately named and located ComponentEditor. | enthought/enable2/component_editor.py | enthought/enable2/component_editor.py | """ Defines a Traits editor for displaying an Enable component.
"""
#-------------------------------------------------------------------------------
# Written by: David C. Morrill
# Date: 01/26/2007
# (c) Copyright 2007 by Enthought, Inc.
#-----------------------------------------------------------------------... | Python | 0 | |
06164dbeb1ec113b24ca25a41e624793d878875f | implement a transferrable voting algorithm | instant_runoff_voting.py | instant_runoff_voting.py | from collections import defaultdict, Counter
def runoff(voters):
"""
a function that calculates an election winner from a list of voter selections using an
Instant Runoff Voting algorithm. https://en.wikipedia.org/wiki/Instant-runoff_voting
Each voter selects several candidates in order of preference.
... | Python | 0 | |
5d6ef1cf969bac9fb53db0224eebdeb4a1bb6ff0 | Update app/exceptions/__init__.py | app/exceptions/__init__.py | app/exceptions/__init__.py |
class BadConfigurationError(Exception):
pass
class ClientUnavailableError(Exception):
pass
class ClusterNotConfiguredError(Exception):
pass
| Python | 0 | |
0efb59e8d1bef5a1d8e5e3eb7ffddf09f5b8943a | Add tests to LoadCommand | jarbas/core/tests/test_load_command.py | jarbas/core/tests/test_load_command.py | from unittest.mock import Mock, patch
from django.test import TestCase
from jarbas.core.management.commands import LoadCommand
from jarbas.core.models import Activity
from jarbas.core.tests import sample_activity_data
class TestStaticMethods(TestCase):
def setUp(self):
self.cmd = LoadCommand()
def ... | Python | 0.000001 | |
8affeda715b1facf12de1dab1d445bbe54616306 | Fix JSON serialisation problem with AJAX basket | oscar/core/ajax.py | oscar/core/ajax.py | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | Python | 0 |
63d22058d15a11fad7232683630976d472997c33 | Add planetary time recipe | recipes/planetarytime.py | recipes/planetarytime.py | """
Author: João Ventura <flatangleweb@gmail.com>
This recipe shows sample code for handling
planetary times.
"""
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.tools import planetarytime
# Build a date and location
date = Datetime('2015/03/13', '17:00', ... | Python | 0.999993 | |
98c863c9d45bdfb328a5e79d0928c8b9694bc753 | Remove redundant import | check_mesos.py | check_mesos.py | #!/usr/bin/env python
import nagiosplugin
import argparse
import logging
import re
INFINITY = float('inf')
HEALTHY = 1
UNHEALTHY = -1
try:
from urllib2 import *
except ImportError:
from urllib.request import *
from urllib.error import HTTPError
try:
import json
except ImportError:
import simplejson as json... | #!/usr/bin/env python
import nagiosplugin
import urllib2
import argparse
import logging
import re
INFINITY = float('inf')
HEALTHY = 1
UNHEALTHY = -1
try:
from urllib2 import *
except ImportError:
from urllib.request import *
from urllib.error import HTTPError
try:
import json
except ImportError:
import sim... | Python | 0.001503 |
92c8afbb5131374611fb21b4da0b0af1a2f37a45 | add dummy test | tests/dummy.py | tests/dummy.py | import pytest
from pyannote.database import get_databases
def test_dummy():
assert isinstance(get_databases(), list)
| Python | 0.999602 | |
0c8b7fa865df535f5baa33025c184bbf4234b7b1 | Create script to transform shapefile into csv distance matrix | shp_to_csv_distances.py | shp_to_csv_distances.py | """Create a csv matrix of distances between shapefile geometry objects.
Requirements: fiona, shapely
Written by: Taylor Denouden
Date: November 25, 2015
"""
import random
import fiona
from shapely.geometry import shape
from scripts.printer import print_progress
def main():
"""Main script execution."""
outf... | Python | 0 | |
6301b47bdcc4cb507a29583210f648c4e24834d6 | Add a utility script for decoding packet traces | util/decode_packet_trace.py | util/decode_packet_trace.py | #!/usr/bin/env python
# Copyright (c) 2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... | Python | 0 | |
9a4dd1c0c51cf2732b50d5594b2a4bf661b8262f | Add geoip_lookup.py | geoip_lookup.py | geoip_lookup.py | import sys
if len(sys.argv) < 2:
print """geoip_lookup.py ---
"resolve" IP addresses to approximate geo-information
Usage:
python geoip_lookup.py IP [ GEOIP_SERVER ]
where IP is the address to resolve, and
GEOIP_SERVER is an optional GeoIP server to contact.
(The Seattle network testbed provides two GeoIP ser... | Python | 0.000027 | |
24d1162740aa9a9948665d97dc082a555a1ccf13 | Rename initial_args to standard argv. | grip/command.py | grip/command.py | """\
grip.command
~~~~~~~~~~~~
Implements the command-line interface for Grip.
Usage:
grip [options] [<path>] [<address>]
grip -h | --help
grip --version
Where:
<path> is a file to render or a directory containing a README.md file
<address> is what to listen on, of the form <host>[:<port>], or just <port>... | """\
grip.command
~~~~~~~~~~~~
Implements the command-line interface for Grip.
Usage:
grip [options] [<path>] [<address>]
grip -h | --help
grip --version
Where:
<path> is a file to render or a directory containing a README.md file
<address> is what to listen on, of the form <host>[:<port>], or just <port>... | Python | 0 |
cf357e46b3d9664325ca69f3b7c0393c89ad44a7 | Add some function tests. | tests/test_func.py | tests/test_func.py | from .utils import assert_eval
def test_simple_func():
assert_eval('(def @a $a 8) (@a)', 1, 8)
def test_simple_func_args():
assert_eval(
'(def @a $a $a)'
'(@a 1)'
'(@a 2)'
'(@a 5)',
1,
1,
2,
5)
def test_func_args_overwrite_globals():
asse... | Python | 0 | |
2628bfa261c9bb76f4d3742bbb36f1179d961c83 | add Pool and OrderedPool tests | tests/test_pool.py | tests/test_pool.py | import unittest
import greenhouse
import greenhouse.poller
from test_base import TESTING_TIMEOUT, StateClearingTestCase
class PoolTestCase(StateClearingTestCase):
POOL = greenhouse.Pool
def test_basic(self):
def f(x):
return x ** 2
pool = self.POOL(f)
pool.start()
... | Python | 0 | |
79f57f27824caa423ff873fdee3a9b8916ed410b | extract speech information for reps | import/parse/speeches.py | import/parse/speeches.py | """
parse data from govtrack.us
from: data/crawl/govtrack/people.xml
"""
import web
from xml.sax import make_parser, handler
class SpeechesXML(handler.ContentHandler):
def __init__(self,callback):
self.callback = callback
self.current = None
def startElement(self, name, attrs):
... | Python | 0.998676 | |
ec6dff24e3049ddaab392f0bc5b8d8b724e41e20 | Print the trending Python repos on GitHub | trending_python.py | trending_python.py | #!/usr/bin/env python3
import bs4
import requests
url = 'https://github.com/trending?l=Python'
soup = bs4.BeautifulSoup(requests.get(url).content, 'lxml') # or 'html5lib'
repos = soup.find('ol', class_="repo-list").find_all('a', href=True)
repos = (r.text.strip().replace(' ', '') for r in repos if '/' in r.text)
pri... | Python | 0.998715 | |
37691851b6e21a6a51140f512fd9802e964b0785 | Create beta_pythons_dynamic_classes_3.py | Solutions/beta/beta_pythons_dynamic_classes_3.py | Solutions/beta/beta_pythons_dynamic_classes_3.py | def create_class(class_name, secrets = None):
if not class_name: return None
class NewClass(object):
pass
NewClass.__name__ = class_name
if not secrets: return NewClass
for i in secrets:
if 'function' in str(type(secrets[i])):
setattr(NewC... | Python | 0.000067 | |
32d9a97336c786660a838dc69cfab2ebe3436343 | update viafReconciliationPeople.py | viafReconciliationPeople.py | viafReconciliationPeople.py | import requests
import csv
from fuzzywuzzy import fuzz
import json
import urllib
baseURL = 'http://viaf.org/viaf/search/viaf?query=local.personalNames+%3D+%22'
f=csv.writer(open('viafPeopleResults.csv', 'wb'))
f.writerow(['search']+['result']+['viaf']+['lc']+['isni']+['ratio']+['partialRatio']+['tokenSort']+['tokenSet... | Python | 0 | |
2934f80f294759ec202e0305025da2d7e71d3ae3 | Add plot_throughput.py. | problem/net_file_xfer_tput_174608/plot_throughput.py | problem/net_file_xfer_tput_174608/plot_throughput.py | #! /usr/bin/env python3
# Copyright 2017 John Hanley.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, m... | Python | 0.000001 | |
9d1f8f6bfd59cf2e083276ef095618f8545c5167 | Add test to check packages for Python2.6 compatibility, as well as core. | lib/spack/spack/test/python_version.py | lib/spack/spack/test/python_version.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | Python | 0 |
3ea69c783393b6c62f3428c6ec83a24fe7634b6c | add grader in Python | 8-kyu/grader.py | 8-kyu/grader.py | def grader(score):
if score < 0.6 or score > 1:
return 'F'
elif score < 0.7:
return 'D'
elif score < 0.8:
return 'C'
elif score < 0.9:
return 'B'
else:
return 'A'
| Python | 0.000128 | |
37dda1d235017bebb9bb0f6eff150dd12222762f | remove organisation from db | migrations/versions/0162_remove_org.py | migrations/versions/0162_remove_org.py | """
Revision ID: 0162_remove_org
Revises: 0161_email_branding
Create Date: 2018-02-06 17:08:11.879844
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0162_remove_org'
down_revision = '0161_email_branding'
def upgrade():
# ### commands auto generated by ... | Python | 0 | |
d1e8a8bb6ffc852bf07c40968029c5def7dc0a96 | Correct the dict | nclxd/nova/virt/lxd/host_utils.py | nclxd/nova/virt/lxd/host_utils.py | # Copyright (c) 2015 Canonical Ltd
#
# 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 ... | # Copyright (c) 2015 Canonical Ltd
#
# 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 ... | Python | 0.999145 |
85060c7653a04f18e6f5cd016e113327ba3a2878 | Add support for Sercomm IP camera discovery. (#238) | netdisco/discoverables/sercomm.py | netdisco/discoverables/sercomm.py | """
Discover Sercomm network cameras.
These are rebranded as iControl and many others, and are usually
distributed as part of an ADT or Comcast/Xfinity monitoring package.
https://github.com/edent/Sercomm-API
"""
from . import SSDPDiscoverable
class Discoverable(SSDPDiscoverable):
"""Add support for discovering c... | Python | 0 | |
1295f2867eb7348959d86618b8e80c001cc41ff7 | Add 'lib' init module. | akhet/paster_templates/akhet/+package+/lib/__init__.py | akhet/paster_templates/akhet/+package+/lib/__init__.py | """Miscellaneous support packages for {{project}}.
"""
| Python | 0 | |
c491b9379966e772c0ab4649584a8d5a0773c403 | Update repositoryInstaller.py | scripts/devSetup/repositoryInstaller.py | scripts/devSetup/repositoryInstaller.py | from __future__ import print_function
__author__ = u'schmatz'
import configuration
import errors
import subprocess
import os
import sys
from which import which
#git clone https://github.com/nwinter/codecombat.git coco
class RepositoryInstaller():
def __init__(self,config):
self.config = config
asser... | from __future__ import print_function
__author__ = u'schmatz'
import configuration
import errors
import subprocess
import os
import sys
from which import which
#git clone https://github.com/nwinter/codecombat.git coco
class RepositoryInstaller():
def __init__(self,config):
self.config = config
asser... | Python | 0.000001 |
8fe99eedd4e1a1604277c42ed8f2ea0dc2e622de | add simple csv utility module | mediacloud/mediawords/util/csv.py | mediacloud/mediawords/util/csv.py | """Utility functions for dealing with csvs."""
import csv
import io
def get_csv_string_from_dicts(dicts: list) -> str:
"""Given a list of dicts, return a representative csv string."""
if len(dicts) < 1:
return ''
csvio = io.StringIO()
csvwriter = csv.DictWriter(csvio, fieldnames=dicts[0].ke... | Python | 0 | |
f6c2d5e37685b149cfd447545c58ce1fc4d836b9 | Add function to create view for Span candidate subclasses | snorkel/models/views.py | snorkel/models/views.py |
def create_serialized_candidate_view(session, C, verbose=True):
"""Creates a view in the database for a Candidate sub-class C defined over
Span contexts, which are direct children of a single sentence.
Creates VIEW with schema:
candidate.id, candidate.split, span0.*, ..., spanK.*, sentence.*
... | Python | 0 | |
135324dd3346f7830abbe64cb5eadf82d1ca963c | add - module for generating data sets. | versus/src/data.py | versus/src/data.py | """
Module for loading datasets
"""
import gzip
import theano.tensor as T
import theano
import numpy
import cPickle
import os
def load_MNIST(dataset):
''' Loads the dataset
:type dataset: string
:param dataset: the path to the dataset (here MNIST)
'''
#############
# LOAD DATA #
#######... | Python | 0 | |
9732c401fb51ae0b757be5108835b71e7c389850 | Add tests | django_comments_xtd/tests/test_get_version.py | django_comments_xtd/tests/test_get_version.py | try:
from unittest.mock import patch
except ImportError:
from mock import patch
from django.test import TestCase
class GetVersionTestCase(TestCase):
@patch('django_comments_xtd.VERSION', (2, 8, 0, 'f', 0))
def test_get_version_when_patch_equal_to_zero(self):
from django_comments_xtd import g... | Python | 0.000001 | |
2eb163c5dd675c2e7a9cedb5d6868545833cbf34 | Add lemma rules | spacy/en/lemma_rules.py | spacy/en/lemma_rules.py | # encoding: utf8
from __future__ import unicode_literals
LEMMA_RULES = {
"noun": [
["s", ""],
["ses", "s"],
["ves", "f"],
["xes", "x"],
["zes", "z"],
["ches", "ch"],
["shes", "sh"],
["men", "man"],
["ies", "y"]
],
"verb": [
[... | Python | 0.000237 | |
45628f2abd6ec66ad48679732d600174a3a7de26 | add a script | jython/surfaceMapToDs.py | jython/surfaceMapToDs.py | #!/bin/env jython
import sys
import java.io
import org.gavrog
def dsymbolFromCyclicAdjacencies(adjs):
vertexToChamber = {}
edgeToChamber = {}
chamberToVertex = {}
size = 0
for v in adjs:
vertexToChamber[v] = size
for w in adjs[v]:
if w == v:
raise Run... | Python | 0.000003 | |
25e0a9cab06e518add6c2a018258dd4d59ad5611 | Add python example that uses newly added download callbacks. | examples/python/download_packages_with_cbs.py | examples/python/download_packages_with_cbs.py | #!/usr/bin/env python
"""
librepo - Example of download_packages() function with use of end,
failure and mirrorfailure callbacks.
"""
import librepo
if __name__ == "__main__":
# Setup logging
#def debug_function(msg, _):
# print "DEBUG: %s" % msg
#librepo.set_debug_log_handler(debug_fun... | Python | 0 | |
4ca336ee7b29609e5cc87dccf1a66c233038aa94 | Create cpp_header_merger.py | cpp_header_merger.py | cpp_header_merger.py | __author__ = 'Joshua Zhang'
"""A C/C++ header merging tool """
import os
import re
import argparse
# matching c/c++ #include patterns
pattern_include = r"#.*include.+(\.hpp|\.h)+"
pattern_squote = r"<.+>"
pattern_quote = r'".+"'
pattern_pragma = r"#pragma.+once"
regex_include = re.compile(pattern_include, re.IGNORECA... | Python | 0 | |
e212ad90a8fedb8e29abe3683b99a28d4030b544 | Add process module for Popen compat handling | passpie/process.py | passpie/process.py | from subprocess import Popen, PIPE
from ._compat import *
class Proc(Popen):
def communicate(self, **kwargs):
if kwargs.get('input') and isinstance(kwargs['input'], basestring):
kwargs['input'] = kwargs['input'].encode('utf-8')
return super(Proc, self).communicate(**kwargs)
def ... | Python | 0 | |
860819e2f843fb1c93b95621110ba313cb3b718b | Add basic rtp support. | pcs/packets/rtp.py | pcs/packets/rtp.py | # Copyright (c) 2008, Bruce M. Simpson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | Python | 0 | |
53038aea2b439acdc265f81b9f031336ea1f27f3 | Add lc480_sliding_window_median.py | lc480_sliding_window_median.py | lc480_sliding_window_median.py | """Leetcode 480. Sliding Window Median
URL: https://leetcode.com/problems/sliding-window-median/
Hard
Median is the middle value in an ordered integer list.
If the size of the list is even, there is no middle value.
So the median is the mean of the two middle value.
Examples:
[2,3,4] , the median is 3
[2,3], the... | Python | 0.000044 | |
9a6bf30ecfa7b843d8588a8a7b052f87089e44c7 | convert csv to excel | write_excel.py | write_excel.py |
def Excel2CSV(ExcelFile, SheetName, CSVFile):
workbook = xlrd.open_workbook(ExcelFile)
try:
worksheet = workbook.sheet_by_name(SheetName)
except xlrd.biffh.XLRDError:
print "Missing portmap for switch " + str(SheetName)
print "Exiting program. Check spelling of Sheet name"
... | Python | 0.999999 | |
a5ec49a658de23263802c7ddad02a4e34073a2a4 | add example of a go block returning value through a channel | example/go_block.py | example/go_block.py | import csp
def lazy_echo(x):
yield csp.wait(0.5)
print "I'm done"
yield csp.stop(x)
def main():
chan = csp.go(lazy_echo(1))
print (yield csp.take(chan))
chan = csp.go(lazy_echo(2))
yield csp.wait(2)
print (yield csp.take(chan))
| Python | 0 | |
410834d842a2d024f8af24009ee99ef834f91e29 | Add migration for `room_history_entry.active_during` | pycroft/model/alembic/versions/20234ac06668_use_tstzrange_for_room_history_entry.py | pycroft/model/alembic/versions/20234ac06668_use_tstzrange_for_room_history_entry.py | """Use tstzrange for room_history_entry
Revision ID: 20234ac06668
Revises: f138079b24c5
Create Date: 2021-10-24 16:31:51.027020
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
from sqlalchemy.dialects.postgresql import TSTZRANGE
... | Python | 0.000001 | |
5007a2910f54c339c50667993c11fd4586412524 | add letter code | wordonhd/Letter.py | wordonhd/Letter.py | class Letter(object):
_values = {
'ENIOA': 1,
'SDTR': 2,
'MLKPBG': 3,
'ZVUFJH': 4,
'CW': 5,
'XY': 8,
'Q': 10
}
def __init__(self, letter):
self.letter = letter[-1]
self.wordon = letter[0] == '!'
@property
def value(self):
... | Python | 0.978909 | |
3ef7175814cd76621eeee00a26cff786ea032727 | Add flood it example | examples/floodit.py | examples/floodit.py | from guizero import App, Waffle, Text, PushButton, info
import random
# Set up the game - colours, width and height of board and no of moves allowed
colours = ["red", "blue", "green", "yellow", "fuchsia", "purple"]
b_width = 14
b_height = 14
moves_limit = 25
# Set up the palette
def init_palette():
[palette.set... | Python | 0.000005 | |
2e44b753a071aeba95b51bd03c5635a1eb4d7f28 | Create gcd.py | CiO/gcd.py | CiO/gcd.py | from fractions import gcd
def greatest_common_divisor(*args):
result, *args = args
for n in args:
result = gcd(result, n)
return result
| Python | 0.000001 | |
239488d33f94b0262e642fbf751878894fb7510e | add test for post form admin in articles | opps/articles/tests/test_forms.py | opps/articles/tests/test_forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
from opps.channels.models import Channel
from opps.core.widgets import OppsEditor
from ..models import Post
from ..forms import PostAdminForm
cl... | Python | 0 | |
94dbda64d07838a7408b94251972d81897536380 | Add listener example file | listeners_example.py | listeners_example.py | import turtle
turtle.penup()
turtle.ht()
def up():
print("You pressed Up!")
def down():
print("You pressed Down!")
def left():
print("You pressed Left!")
def right():
print("You pressed Right!")
turtle.onkey(up, 'Up')
turtle.onkey(down, 'Down')
turtle.onkey(left, 'Left')
turtle.onkey(right, 'R... | Python | 0 | |
1d0aff329c5adb836e7b055c042990de219debe0 | Add rough first implementation of widgets.py | wtforms/widgets.py | wtforms/widgets.py | """
wtforms.widgets
~~~~~~~~~~~~~~~
The WTForms widget system.
:copyright: 2009 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
from cgi import escape
__all__ = (
'ListWidget', 'TextInput', 'PasswordInput', 'HiddenInput', 'CheckboxInput',
'RadioI... | Python | 0 | |
8062aa6dcb20e3b1294ce62d6d0cce1841fd21e1 | Add cartan_wvecs.py | cartan_wvecs.py | cartan_wvecs.py | # Author: Hersh Singh [hershdeep@gmail.com]
# Date: August 05, 2013
# Description:
# Given the cartan matrix and the dynkin coefficients of the highest weight, return all the weight vectors, their weights
# Todo: dimensionality of each weight space using freudenthal's formula
# Reference: Cahn Chapter 10
from scipy im... | Python | 0.002077 | |
d3973ca556a28c84765ea8fbc19b2e8f66682fc2 | Add server.py module to tst package | tst/server.py | tst/server.py | import sys
import signal
import json
from subprocess import Popen, PIPE, CalledProcessError
import tst
from colors import *
from utils import to_unicode, cprint
class ConnectionFail(Exception): pass
class Server(object):
__instance = None
class Response:
def json(self):
if '_json'... | Python | 0 | |
be81dbc33e932e870a66ad0663c23e5d05b01ffa | Create Counter.py | Counter.py | Counter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@_ambonilla 2014
Using cocos & piglet libraries, is a small counter program
where when you push the up key it will add a number to the
displayed value, and the down key will substract one
"""
import cocos
import sys
from cocos.actions import *
import pyglet
from... | Python | 0.000001 | |
c80baf708c956a9814ef81213a66da8d443de12a | add migration | apps/bplan/migrations/0002_auto_20170509_1358.py | apps/bplan/migrations/0002_auto_20170509_1358.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('meinberlin_bplan', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='statement',
... | Python | 0.000001 | |
2c78290cc569eb70b5b7098d154da3fb7a2247a9 | Add db_mktag.py, command line tag creator. | db_mktag.py | db_mktag.py | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from sys import argv, exit
from dbclient import dbclient
if len(argv) not in (2, 3):
print "Usage:", argv[0], "tagname [tagtype]"
exit(1)
client = dbclient()
client.add_tag(*argv[1:])
| Python | 0 | |
3609c5842b33ca4146ad14b74c76f8954545aaa8 | Add commands for cases and variants | loqusdb/commands/view.py | loqusdb/commands/view.py | # -*- coding: utf-8 -*-
import logging
import click
from . import base_command
logger = logging.getLogger(__name__)
@base_command.command()
@click.option('-c' ,'--case-id',
help='Search for case'
)
@click.pass_context
def cases(ctx, case_id):
"""Display all cases in the database."""
ada... | Python | 0.000001 | |
dd2f332dd1b7a215d5a6aa81819e3d66d46c1b91 | add python solution for 20 | 01-50/20/20.py | 01-50/20/20.py | import math
print sum(int(c) for c in str(math.factorial(100)).rstrip('L'))
| Python | 0.000077 | |
7f661e24388e82ae2e2872ab11ee6a84d487aac7 | Create py-mysql-select.py | py-mysql-select.py | py-mysql-select.py | #!/usr/bin/env python
# --*-- coding:utf-8 --*--
import MySQLdb #操作mysql,需要加载MySQLdb模块
#创建连接
conn = MySQLdb.connect(host = '127.0.0.1',user = 'root',passwd = '123',db = 'mydb') #使用connect方法对数据库进行连接,相当于一个门
cur = conn.cursor() #使用conn.cursor方法,相当于操作的一双手
#操作数据库
reCount = cur.execute('select * from students') ... | Python | 0.000008 | |
48b2b234377d8e66ccb274e4845a835486228166 | Create test_utils.py | utils_test.py | utils_test.py | import pytest
from utils import *
def test_struct_initialization():
s = Struct(a=1, b=2)
assert s.a == 1
assert s.b == 2
def test_struct_assignment():
s = Struct(a=1)
s.a = 3
assert s.a == 3
def test_removeall_list():
assert removeall(4, []) == []
assert removeall(4, [1,2,3,4]) == [... | Python | 0.000001 | |
7581fbc397915c1ad72714203fee2349a84e14e9 | add notifiaction push script - pushNotif.py | API/ssc/SscData/pushNotif.py | API/ssc/SscData/pushNotif.py | from urllib2 import *
import urllib
import json
import sys
MY_API_KEY="AIzaSyCgSjnjxtYBGMOq7jNgnE_tbhpOJjU5nOo"
messageTitle = sys.argv[1]
messageBody = sys.argv[2]
data={
"to" : "/topics/sscapp",
"notification" : {
"body" : messageBody,
"title" : messageTitle,
"icon" : "notif_icon"
... | Python | 0 | |
4d883d16ad1f1793ac98cbc8161aa40e88d46b44 | Add unit tests for bitmask module | lib/stsci/tools/tests/test_bitmask.py | lib/stsci/tools/tests/test_bitmask.py | """
A module containing unit tests for the `bitmask` modue.
:Authors: Mihai Cara (contact: help@stsci.edu)
:License: `<http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE>`_
"""
from __future__ import (absolute_import, division, unicode_literals,
print_function)
import warnings
im... | Python | 0 | |
8d5f3136fb737c8058d8b0bb4d866d1fe5bb3af8 | Add main function for specchio | specchio/main.py | specchio/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from watchdog.observers import Observer
from specchio.handlers import SpecchioEventHandler
from specchio.utils import logger
def main():
"""Main function for specchio
Example: specchio test/ user@host:test/
:return: None
"""
... | Python | 0.000003 | |
e487ca21da9e7b62a860b91aadfecdf36df005a2 | add public templates module | pymzn/templates.py | pymzn/templates.py |
from .mzn import templates as _templates
from .mzn.templates import *
__all__ = _templates.__all__
| Python | 0.000001 | |
1019f866fc0e9c16ccbe726b4b21265dbfc1ac68 | Add search_rotated_sorted_array.py | data_structures/sorting/search_rotated_sorted_array.py | data_structures/sorting/search_rotated_sorted_array.py | # Search in a Rotated Sorted Array
# You are given a sorted array which is rotated at some random pivot point.
#
# Example: [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]
#
# You are given a target value to search. If found in the array return its index, otherwise return -1.
#
# You can assume there are no duplicates in ... | Python | 0.00001 | |
ffc1b443f13672d0a4002a38f5273b5f72cdb627 | Solve Even Fibonacci numbers | python/euler002.py | python/euler002.py | #!/bin/python3
# Project Euler #2: Even Fibonacci numbers
def fibonacci_sequence(n):
sequence = [1, 2]
while sequence[-1] + sequence[-2] < n:
sequence.append(sequence[-1] + sequence[-2])
return sequence
def evens(array):
return list(filter(lambda x: x % 2 == 0, array))
test_cases = int(input... | Python | 0.999998 | |
f5f2f87030e48dd751ed95eec08f29ab863a8ed9 | Compute the difference between two images | python/img_diff.py | python/img_diff.py | import requests
import json
# Compute the difference between two images and output the reconstructed image and the diff output.
# Keep in mind that the two images must be of the same size or call 'resize' or 'crop' before to
# fit the images to the same dimension.
# Read more on imgdiff here: https://pixlab.io/#/cmd?i... | Python | 1 | |
dc5aad16e63ff210aa3770f6eae18f215f78f8ce | Create 03.py | 01/hw/03.py | 01/hw/03.py | # Given the variables s and t defined as:
s = 'udacity'
t = 'bodacious'
# write Python code that prints out udacious
# without using any quote characters in
# your code.
print s[:3] + t[4:]
| Python | 0 | |
c953e4d292de795d25d00f0a2152a2cf1625dd95 | Add custom ucr expression tests | custom/enikshay/tests/test_ucr_expressions.py | custom/enikshay/tests/test_ucr_expressions.py | import uuid
from django.test import TestCase, override_settings
from nose.tools import nottest
from casexml.apps.case.const import CASE_INDEX_CHILD
from casexml.apps.case.mock import CaseIndex
from casexml.apps.case.mock import CaseStructure
from casexml.apps.case.tests.util import delete_all_cases
from corehq.apps.us... | Python | 0 | |
616e656cb9390321cb36d8f1b067d0bddaff11c2 | Add cli argument parser | frigg/worker/cli.py | frigg/worker/cli.py | # -*- coding: utf8 -*-
from fabric import colors
from frigg.worker.fetcher import fetcher
class Commands(object):
@staticmethod
def start():
print(colors.green("Starting frigg worker"))
fetcher()
@staticmethod
def unknown_command():
print(colors.red("Unknown command"))
if __... | Python | 0.000001 | |
80caf160aba107f539d18287a09fc30d6cf3d0a1 | add demo plotting the available 1D demo signals | demo/plot_demo_signals.py | demo/plot_demo_signals.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Plot the set of 1D demo signals available in `pywt.data.demo_signal`."""
import numpy as np
import matplotlib.pyplot as plt
import pywt
# use 'list' to get a list of all available 1d demo signals
signals = pywt.data.demo_signal('list')
subplots_per_fig = 5
signal_... | Python | 0 | |
944ab744ce4ba3fb30ce94ac2ec581e4b481610f | add img to the dirs that get created. | dj/scripts/mkdirs.py | dj/scripts/mkdirs.py | #!/usr/bin/python
# Makes the dir tree to put files into
import os,sys
from process import process
from main.models import Client, Show, Location, Episode
class mkdirs(process):
def mkdir(self,dir):
""" makes the dir if it doesn't exist """
ret = False
print(dir, end=' ')
if os.path.exi... | #!/usr/bin/python
# Makes the dir tree to put files into
import os,sys
from process import process
from main.models import Client, Show, Location, Episode
class mkdirs(process):
def mkdir(self,dir):
""" makes the dir if it doesn't exist """
ret = False
print(dir, end=' ')
if os.path.exi... | Python | 0 |
a20e4154e4b9a1432cae71e8f931486c42ae7493 | Update uflpost.py | ArduinoYun/Python/uflpost.py | ArduinoYun/Python/uflpost.py | """ SendDragonBoardData.py
Copyright 2016 OSIsoft, LLC.
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 appli... | """ SendDragonBoardData.py
Copyright 2016 OSIsoft, LLC.
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 appli... | Python | 0 |
4a30d30b82fbdccbb0f15ebb5c094b13ce791f7f | Add a utility class to normalize input | genderator/utils.py | genderator/utils.py | from unidecode import unidecode
class Normalizer:
def normalize(text):
text = Normalizer.remove_extra_whitespaces(text)
text = Normalizer.replace_hyphens(text)
# text = Normalizer.remove_accent_marks(text)
return text.lower()
@staticmethod
def replace_hyphens(text):
... | Python | 0.000002 | |
8b828e9c9daacd8bd6b5719e0ee50fc93f3c612d | add line-invoker, allows pipeline to be changed on the fly | line-invoker.py | line-invoker.py | #!/usr/bin/python
from __future__ import print_function
import sys
import subprocess
# A normal(ish) pipeline looks like the following:
# tailf input | grep -v foo | grep bar | cat >>output
# If we want to change the valu "foo", "bar" or otherwise change the
# pipeline, we have to kill the old pipeline and start a ... | Python | 0 | |
917708a749e2c9519cbb9841004a18eeff788af4 | Concatenate Final | Concatenate.py | Concatenate.py | # Copyright (c) 2017 Rahul V Sharma
# AUTHORS = Rahul Vinod Shaarma
# Website = www.rahul-sharma.com
# Email = sharmaR0810@gmail.com
# Don't Message Me unless Serios Help or you are not a hot girl.
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documen... | Python | 0.999998 | |
80cb11187894870ba9fe40e09834522d7ea2ee10 | Create middleware.py | middleware.py | middleware.py | Python | 0.000007 | ||
aadd5b5d60e1fa2939482790baa893d9624ad33b | Create mnist_lstm.py | mnist_lstm.py | mnist_lstm.py | from tensorflow.models.rnn import rnn_cell, rnn
import tensorflow as tf
import numpy as np
import input_data
sess = tf.Session()
'''
Classify MNIST using LSTM running row by row.
Good:
* No compilation time at all, which is cool.
Bad:
* Problem is that has all dimensions hard coded, which sucks.
Inspired by:
htt... | Python | 0.000004 | |
940c4f4238eac31f926e520dba473819abb44033 | Add a moksha.hub module with an initial OrbitedWidget | moksha/hub.py | moksha/hub.py | # This file is part of Moksha.
#
# Moksha 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 3 of the License, or
# (at your option) any later version.
#
# Moksha is distributed in the hope that i... | Python | 0 | |
7780c235f0f357ab918f0c031e7dc51f6ca072a9 | Solve problem 20 | problem020.py | problem020.py | #!/usr/bin/env python3
from functools import *
import operator
def factorial(number):
assert number >= 1
return reduce(operator.mul, range(1, number+1))
def digits(number):
yield from (int(digit) for digit in str(number))
print(sum(digits(factorial(100))))
| Python | 0.999999 | |
6fcb3adbcf85aa8039274f59d2b26401b5927fc4 | Create PowerofFour_001.py | kargtom/twodim/PowerofFour/PowerofFour_001.py | kargtom/twodim/PowerofFour/PowerofFour_001.py | def isPowerOfFour(n):
return n > 0 and n & n - 1 is 0 and n & 0x5555555555555555 != 0
| Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.