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 |
|---|---|---|---|---|---|---|---|
681c21a5fbf3bc713468e33bb10dfa9bf6d62850 | Add migration to fix admin users with roles | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | from django.db import migrations
from corehq.apps.es import UserES
from corehq.apps.users.models import WebUser
from corehq.util.couch import DocUpdate, iter_update
from corehq.util.django_migrations import skip_on_fresh_install
from corehq.util.log import with_progress_bar
@skip_on_fresh_install
def fix_users(apps,... | Python | 0 | |
53d796dff32581efe5c92c61f27a4de3b7f8d5cd | Add Row class. | Row.py | Row.py | # -*- coding: utf-8 -*-
from collections import OrderedDict
from pprintpp import pprint as pp
import copy
import json
class Row(object):
"""ref http://stackoverflow.com/questions/4014621/a-python-class-that-acts-like-dict"
"""
kc_map = {}
#ex: {'_id':{ id: 1, name: 2, ... }}
inv_kc_map = {}
#... | Python | 0 | |
3134e22eb5da9bd7104c199f788288e0fc823db2 | Add basic endopoints powered by bottle | app.py | app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
from bottle import route, run, template, request, response
import os
import uuid
@route('/')
def get_simple_form():
"""
Returns simple images upload form
:return:
"""
return ('<form action="/imgs" method="post" enctype="multipart/form-da... | Python | 0 | |
07442bd7ddd07635002493bafb6ac16a24fd5d82 | Add script for http live streaming | hls.py | hls.py | var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
var zlib = require('zlib');
PORT = 8000;
http.createServer(function (req, res) {
var uri = url.parse(req.url).pathname;
if (uri == '/player.html') {
res.writeHead(200, { 'Content-Type': 'text/htm... | Python | 0 | |
4596c0a54457ee515d164bafc399010af190eaa9 | Add basic http service to turn a led ON-OFF | led.py | led.py | from flask import Flask
import RPi.GPIO as GPIO
app = Flask(__name__)
@app.route("/led/on/")
def led_on():
GPIO.output(11, GPIO.HIGH)
return "Led ON"
@app.route("/led/off/")
def led_off():
GPIO.output(11, GPIO.LOW)
return "Led OFF"
if __name__ == "__main__":
GPIO.setmode(GPIO.BOARD)
GPIO... | Python | 0 | |
95a94367a90f6424535b4120bc8e95a34624fc56 | Create util.py | code/util.py | code/util.py | import pandas as pd
import numpy as np
import math
from itertools import chain, combinations
import itertools
from numpy.random import random
from bisect import bisect_left
from random import sample
from scipy.stats.distributions import poisson, gamma, beta, bernoulli, binom
import time
import operator
from collection... | Python | 0.000002 | |
3492ffd5ffa0c7d1dfb5a9f4a587777245044685 | add test cases of ruamel.yaml backend | tests/backend/yaml/ruamel_yaml.py | tests/backend/yaml/ruamel_yaml.py | #
# Copyright (C) - 2018 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
# pylint: disable=ungrouped-imports
from __future__ import absolute_import
import os
import anyconfig.backend.yaml.pyyaml as TT
import tests.backend.common as TBC
from an... | Python | 0 | |
d4f3f65a9c6dbe4a7119eb65f872524a45f756a7 | Add codifflib.py | codifflib.py | codifflib.py | import sys
from difflib import SequenceMatcher
from pygments import lex
from pygments.lexers.c_cpp import CLexer
from pygments.styles import get_style_by_name
class CodeDiff:
opcode_style = {
'insert': {'bgcolor': 'eaffea'}, 'replace': {'bgcolor': 'fff68f'},
'delete': {'bgcolor': 'ffaaaa'}, 'equal': {'bgco... | Python | 0 | |
3f9a8ee16e47f4ce0d75a1b856341c05436c2aff | Create sending_email.py | sending_email.py | sending_email.py | # -*- coding: utf-8 -*-
"""
Created on Wed May 10 16:32:22 2017
This scripts are used to send out data from Pasture to Wenlong from field.
Key features:
- Parse and send out all .par files
- Send out email at certain intervals: such as one day.
@author: wliu14
"""
from email import encoders
from email.mime.text impor... | Python | 0.000005 | |
03f46b0d6867bcb8a88e53b26089705cb1667bbd | Add script to generate images from all samples | tools/create_from_sample_texts.py | tools/create_from_sample_texts.py | #!/usr/bin/env python
import teetime
import os
def main():
with open('samples/sample-texts.txt') as fh:
for line in fh:
print line.strip()
path = teetime.create_typography(line.strip(), colors=False)
os.rename(path, os.path.join('samples', os.path.basename(path)))
if... | Python | 0 | |
08c0c68ed52e9644cc92ad8afdc423b43b4c1326 | Add Fractal_Tree.py. | Fractal_Tree.py | Fractal_Tree.py | __author__ = "ClaytonBat"
import turtle
def tree(branchLen,t):
if branchLen > 5:
t.forward(branchLen)
t.right(20)
tree(branchLen-15,t)
t.left(40)
tree(branchLen-15,t)
t.right(20)
t.backward(branchLen)
def main():
t = turtle.Turtle()
myWin = turtle.Sc... | Python | 0 | |
1893473729acd938a0657127b82892af1bdb987b | Create AbortMultipartUploads.py | obs/cleanUnmergedFragments/AbortMultipartUploads.py | obs/cleanUnmergedFragments/AbortMultipartUploads.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import commands
if __name__ == '__main__':
if len(sys.argv[1:]) > 0:
bucket_nameurl = str(sys.argv[1:][0])
else:
bucket_nameurl = ""
print("bucket name should be specified\nAbortMultipartUploads.py [s3://BucketName]")
sys.exit... | Python | 0 | |
6dca2d95144ebe22f58cb4dafb00a3f8a402316e | add answer for question 4 | question_4/heguilong.py | question_4/heguilong.py | #!/usr/bin/env python3
"""
File: heguilong.py
Author: heguilong
Email: hgleagle@gmail.com
Github: https://github.com/hgleagle
Description:
斐波那契数列由0和1开始,之后的斐波那契系数就是由之前的两数相加而得出,例如
斐波那契数列的前10个数是 0, 1, 1, 2, 3, 5, 8, 13, 21, 34。
"""
import sys
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)... | Python | 0.999999 | |
a50ce7117e4c1300410b74b5511722e4d7d57be4 | Implement script to automate setting scope location and time | set_when_and_where.py | set_when_and_where.py | #!/usr/bin/env python
import config
import configargparse
import math
import time
import nexstar
import ephem
parser = configargparse.ArgParser(default_config_files=config.DEFAULT_FILES)
parser.add_argument('--scope', help='serial device for connection to telescope', default='/dev/ttyUSB0')
parser.add_argument('--lat... | Python | 0 | |
1212677ac1087498fa83a3d4d9e8ba9d13c35b20 | Add the basic structure for the notification handler. | handler/notification.py | handler/notification.py | class ListHandler(BaseHandler):
| Python | 0 | |
7225514cd2e4acb3bf78d6ba1c221caf9c084490 | Add plotting script for correction files | utils/plot_correction_files.py | utils/plot_correction_files.py | import numpy as np
from matplotlib import pyplot as plt
import glob
import re
import math
import rasterio as rio
import argparse
import os
"""
This script plots the original interferogram, the corresponding correction file,
and the resulting corrected interferogram from a PyRate directory with already,
processed data... | Python | 0 | |
77fc04ddf6dbc9cb618b427b36628adb019b2f43 | add import script | scripts/import.py | scripts/import.py | #!/usr/bin/python
#
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rp... | Python | 0 | |
42a9c36d711f2550cc68fdba96b6af36d3d31d8d | Create grasshopperDebug.py | CodeWars/8kyu/grasshopperDebug.py | CodeWars/8kyu/grasshopperDebug.py | def weather_info (temp):
c = convertToCelsius(temp)
if (c <= 0):
return (str(c) + " is freezing temperature")
else:
return (str(c) + " is above freezing temperature")
def convertToCelsius (temp):
temp = (((float(temp) - 32) * 5) / 9)
return temp
| Python | 0.00002 | |
5fb777f782eaf04153dad491410046b03eecde04 | Add new script to list "out of compliance" agent packages | python-library-and-examples/agent-package-compliance.py | python-library-and-examples/agent-package-compliance.py | #!/usr/bin/env python
from __future__ import print_function
import pyacc
class App(pyacc.AccCommandLineApp):
"""
List agents that are not running the latest version of their package,
with optional filtering.
"""
def build_arg_parser(self):
"""
Add some more args to the standard s... | Python | 0 | |
9ba0ff62572dcfd7912c9b58091b59844f8e1753 | Add script for Helmholtz rates | results/sccg-table.py | results/sccg-table.py | import os
import sys
import pandas as pd
p4_data = "helmholtz-results/helmholtz_conv-d-4.csv"
p5_data = "helmholtz-results/helmholtz_conv-d-5.csv"
p6_data = "helmholtz-results/helmholtz_conv-d-6.csv"
p7_data = "helmholtz-results/helmholtz_conv-d-7.csv"
data_set = [p4_data, p5_data, p6_data, p7_data]
for data in data... | Python | 0 | |
d4354b021cb0b782b5201c3b18fe3b07f89e2c45 | add initial migration | src/migrations/versions/25fc3f52af44_.py | src/migrations/versions/25fc3f52af44_.py | """empty message
Revision ID: 25fc3f52af44
Revises:
Create Date: 2017-04-10 17:15:01.049591
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '25fc3f52af44'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | Python | 0 | |
248c738b31e43ef456d47045bc5f5b2d58d35d98 | add autocomplete with a German-Korean dictionary | workflow/dedic_naver_search.py | workflow/dedic_naver_search.py | # Naver Search Workflow for Alfred 2
# Copyright (C) 2013 Jinuk Baek
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... | Python | 0.000003 | |
4137bdd36fa4a1b4e194c2c61f803cecdebe8f69 | Implement MySQL driver | lib/mysql_driver.py | lib/mysql_driver.py | import mysql.connector
import sql_driver
import screen_buffer
class MySQLDriver(sql_driver.SqlDriver):
class Factory(object):
def __init__(self, **mysql_conf):
self._mysql_conf = mysql_conf
if 'port' in self._mysql_conf:
self._mysql_conf['port'] = int(self._mysql_co... | Python | 0.000001 | |
6a29e9f963af4920b21c64d157ca90b0d7d081c4 | implement parallelForLoop.py | pythonPractiseSamples/parallelForLoop.py | pythonPractiseSamples/parallelForLoop.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Damian Ziobro <damian@xmementoit.com>
#
from joblib import Parallel, delayed
import multiprocessing
n=1000000
def squareRoot(i):
return i*i
cpus = multiprocessing.cpu_count()
#cpus = 1
results = Parallel(n_jobs=cpus)(delayed(s... | Python | 0.000064 | |
b9711e4fd82441669fdd97b1e5eeb12f03e995a5 | Make srrun use the proper executable on windows | srrun.py | srrun.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
import subprocess
import sys
mypath = os.path.abspath(__fil... | #!/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 subprocess
import sys
mypath = os.path.abspath(__file__)
mydir = os.... | Python | 0.000083 |
5d1da267791456f6c5e386d6e7204d02371c2eb2 | Add tests for gold projects | readthedocs/rtd_tests/tests/test_gold.py | readthedocs/rtd_tests/tests/test_gold.py | from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django_dynamic_fixture import get
from django_dynamic_fixture import new
from readthedocs.gold.models import GoldUser, LEVEL_CHOICES
from readthedocs.projects.models import Project
def crea... | Python | 0 | |
680ab5562e2b4599c74b9605b688538c1da1479d | add profiler helper function | lib/util/profile.py | lib/util/profile.py | import cProfile
def profile_this(fn):
def profiled_fn(*args, **kwargs):
fpath = fn.__name__ + '.profile'
prof = cProfile.Profile()
ret = prof.runcall(fn, *args, **kwargs)
prof.dump_stats(fpath)
return ret
return profiled_fn
# Just use the following decorator to get a ps... | Python | 0.000001 | |
73479f2efe46623f40ea4a49edfc79de0725a291 | Create cdbhelp.py | cdbhelp.py | cdbhelp.py | """cdbhelp.py
This file will define a window which displays help information.
"""
from tkinter import *
from tkinter import ttk
class cdbHelp:
def __init__(self, tag):
self.bgcolor = 'lavender'
self.helpwin = Tk()
#self.frame=Frame(self.helpwin).grid()
self.helpw... | Python | 0.000029 | |
426afb06904b2e4ebab380b6d5ea79c2f481cb44 | add text encoder | rlp/sedes/text.py | rlp/sedes/text.py | from rlp.exceptions import SerializationError, DeserializationError
from rlp.atomic import Atomic
class Text:
"""A sedes object for encoded text data of certain length.
:param min_length: the minimal length in encoded characters or `None` for no lower limit
:param max_length: the maximal length in encode... | Python | 0.000039 | |
c83e946a2b5205c7246b1cfbde7b6e84759b3876 | add potentiometer script | potentiometer.py | potentiometer.py | #from pydcpf.appliances.quido import Device as QuidoDevice
#from pydcpf.appliances.ad4xxx_drak4 import Device as AD4Device
#from pydcpf.appliances.evr116 import Device as EVRDevice
#from pydcpf.appliances.AC250Kxxx import Device as AC250KDevice
TELNET = "telnet 192.168.2.243 10001"
time_delay = 0.2
time_step = 0.001
... | Python | 0.000001 | |
afa810d9b80a5a304395c588455fe421a4a02129 | Add a simple script which monitors the paused domains on a host, checks them against the xapi database, logs anomalies, and optionally destroys the domain if it has been in an error state for longer than a threshold (currently 60s) | scripts/examples/python/monitor-unwanted-domains.py | scripts/examples/python/monitor-unwanted-domains.py | #!/usr/bin/env python
import subprocess, XenAPI, inventory, time, sys
# Script which monitors the domains running on a host, looks for
# paused domains which don't correspond to VMs which are running here
# or are about to run here, logs them and optionally destroys them.
# Return a list of (domid, uuid) tuples, one... | Python | 0 | |
eb3510933b356c5b97e7a0cce9ebad563f21bf3c | Create BinTreeInTraversal_002.py | leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py | leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py | class Solution:
# @param root, a tree node
# @return a list of integers
def iterative_inorder(self, root, list):
stack = []
while root or stack:
if root:
stack.append(root)
root = root.left
else:
root = stack.pop()
... | Python | 0 | |
7ac77a2f95bebad6a13e1d538c366c8688c9d0a6 | Create __init__.py | crispy/localevents/__init__.py | crispy/localevents/__init__.py | import core
| Python | 0.000429 | |
aafdd253bc818d605023dd2a22164d2ac3cdc911 | Add first draft of outdoor map (for issue #3) | examples/outdoor.py | examples/outdoor.py | #!/usr/bin/python
"""Example map generator: Outdoor
This script demonstrates vmflib by generating a map with a 2D skybox and
some terrain (a displacement map).
"""
from vmf import *
from vmf.types import Vertex
from vmf.tools import Block
m = vmf.ValveMap()
walls = []
# Floor
floor = Block(Vertex(0, 0, -512), (102... | Python | 0 | |
268eb8d8591a529c0ee67e6f37b287956b39eb1b | Copy kafka-patch-review.py from kafka trunk | kafka-patch-review.py | kafka-patch-review.py | #!/usr/bin/env python
import argparse
import sys
import os
import time
import datetime
import tempfile
import commands
from jira.client import JIRA
def get_jira():
options = {
'server': 'https://issues.apache.org/jira'
}
# read the config file
home=jira_home=os.getenv('HOME')
home=home.rstrip('/')
jir... | Python | 0 | |
1c228a8de02c81df8d22bde75ac22b902ee39c77 | Add oedb connection helper | data_processing/tools/io.py | data_processing/tools/io.py | from sqlalchemy import create_engine
def oedb_session(section='oedb'):
"""Get SQLAlchemy session object with valid connection to OEDB"""
# get session object by oemof.db tools (requires .oemof/config.ini
try:
from oemofof import db
conn = db.connection(section=section)
except:
... | Python | 0 | |
f7742c3ffcd86667e86e7cb80977f24eddc5444c | add wrapper for `gr1x` that circumvents entry point | examples/wrapper.py | examples/wrapper.py | #!/usr/bin/env python
"""Wrapper to circumvent the entry point.
Because, if development versions of dependencies are installed,
but `install_requires` contains no local identifiers,
then the entry point raises a `VersionConflict` for its context.
"""
import sys
from tugs import solver
if __name__ == '__main__':
... | Python | 0 | |
00c8c165e3f9a136a8950ca1fb0f2d9ade6731d6 | Add a regression test for whitespace normalization in the BibTeX parser. | pybtex/tests/bibtex_parser_test.py | pybtex/tests/bibtex_parser_test.py | from pybtex.database import BibliographyData
from pybtex.core import Entry
from pybtex.database.input.bibtex import Parser
from cStringIO import StringIO
test_data = [
(
'''
''',
BibliographyData(),
),
(
'''@ARTICLE{
test,
title={Polluted
... | Python | 0 | |
0acccca55220e4019d1f2380283a6cbc594c41cc | add registry mounting example | samples/mount.py | samples/mount.py | from __future__ import with_statement
import os
import sys
import stat
import errno
import inspect
import calendar
from fuse import FUSE, FuseOSError, Operations, fuse_get_context
from Registry import Registry
PERMISSION_ALL_READ = int("444", 8)
def unixtimestamp(ts):
"""
unixtimestamp converts a datetim... | Python | 0 | |
3a6725103b3d39701cf4f71f911b2a4f5484eb1e | Improve the repr for the BaseEstimator | scikits/learn/base.py | scikits/learn/base.py | """
Base class for all estimators.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD Style
import inspect
import numpy as np
from .metrics import zero_one, mean_square_error
################################################################################
class BaseEstimator(object):
"... | """
Base class for all estimators.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD Style
import inspect
import numpy as np
from .metrics import zero_one, mean_square_error
################################################################################
class BaseEstimator(object):
"... | Python | 0 |
337928d30d96146cb8033e3ccb15d7d6d0c85d5a | add managed_layer_test | python/tests/managed_layer_test.py | python/tests/managed_layer_test.py | import neuroglancer
def test_visible():
layer = neuroglancer.ManagedLayer('a', {'type': 'segmentation', 'visible': False})
assert layer.name == 'a'
assert layer.visible == False
assert layer.to_json() == {'name': 'a', 'type': 'segmentation', 'visible': False}
layer.visible = True
assert layer.t... | Python | 0.000091 | |
38903c6b6e4dec9fd2fe73b0c468a8b3f2ab870a | Add multi np array | python_practice/numpy_exercise2.py | python_practice/numpy_exercise2.py | import numpy as np
Matrix_A = np.array( [[1,1],[0,1]] )
Matrix_B = np.array( [[2,0],[3,4]] )
print Matrix_A*Matrix_B
print Matrix_A.dot(Matrix_B)
print np.dot(Matrix_A, Matrix_B)
| Python | 0.999987 | |
46393dca28abe0df421066e76b26f198ad790690 | Create NimGame_001.py | leetcode/NimGame_001.py | leetcode/NimGame_001.py | class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
return not (n % 4 == 0)
| Python | 0.000001 | |
648df0127879804041e795cb9479e08ddfd6459b | fix syntax errors | family.py | family.py | #!/usr/bin/env python
"""This module defines the family class.
"""
import person
class Family:
"""Class Person
TBD - document class
"""
def __init__(self):
self.adults = []
self.children = []
def AddAdultsFromCombinedField(self, teacher, name_field, grade):
paren... | #!/usr/bin/env python
"""This module defines the family class.
"""
import person
class Family:
"""Class Person
TBD - document class
"""
def __init__(self):
self.adults = []
self.children = []
def AddAdultsFromCombinedField(self, teacher, name_field, grade):
paren... | Python | 0.000009 |
0aa078c8beb6bad3dd0f30463f2925f01282e353 | add merge script | scripts/merge.py | scripts/merge.py | #! /usr/bin/env python
import gzip
import json
import sys
ret = {
"samples": []
}
def opn(fn):
if fn.endswith('.gz'):
return gzip.open(fn)
return open(fn)
for file_name in sys.argv[1:]:
with opn(file_name) as f:
file_content = json.load(f)
ret["samples"].extend(file_content["samples"])
print(json... | Python | 0.000001 | |
9a045ac0c5cfe39689d8e1446674193e8862d269 | add IPLookup | cogs/ip.py | cogs/ip.py | #!/bin/env python
import discord
from discord.ext import commands
from utils import aiohttp_wrap as aw
class IPLookup:
def __init__(self, bot):
self.bot = bot
self.aio_session = bot.aio_session
self.api_uri = 'http://ip-api.com/json/{}'
@commands.command(aliases=['ip'])
async def ... | Python | 0 | |
2d53172748f1dc7c8462fa79a6a158e4689b2363 | Add ThermalDisplacements test | test/phonon/test_thermal_displacement.py | test/phonon/test_thermal_displacement.py | import numpy as np
temps = [0.000000, 100.000000, 200.000000, 300.000000, 400.000000, 500.000000,
600.000000, 700.000000, 800.000000, 900.000000]
td_ref = [
[0.00571624, 0.00571624, 0.00571624, 0.00403776, 0.00403776, 0.00403776],
[0.00877353, 0.00877353, 0.00877353, 0.00654962, 0.00654962, 0.00654962... | Python | 0 | |
314fcab1904cd0c5e434789bef09766d33e2d6ef | add synth.py for generation | packages/google-cloud-asset/synth.py | packages/google-cloud-asset/synth.py | # copyright 2018 google 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 applicable law or agreed to in writing, s... | Python | 0 | |
37f7ab9435939a144b08fdbb52e1e519ad139318 | add some field definitions | ldapdb/models/fields.py | ldapdb/models/fields.py | # -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (C) 2009 Bolloré telecom
# See AUTHORS file for a full list of contributors.
#
# This program 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 vers... | Python | 0.000003 | |
24dbbd880142ed0925c30083cd3926b47c7ba90c | add mobilenet | dataset/models/tf/mobilenet.py | dataset/models/tf/mobilenet.py | ''' Contains class for MobileNet '''
import numpy as np
import tensorflow as tf
from . import TFModel
from .layers import conv_block
_DEFAULT_BODY = {'strides': [1, 2, 1, 2, 1, 2,
1, 1, 1, 1, 1,
2, 2],
'double_filters': [True, True, False, T... | Python | 0.000001 | |
c4e83d80a9600b9059619c73bc5756ce7b2a1d6d | add extract images module | menpo3d/extractimage.py | menpo3d/extractimage.py | import numpy as np
from menpo3d.rasterize import GLRasterizer, model_to_clip_transform
from menpo.shape import PointCloud
def render_hi_res_shape_image(mesh, render_width=3000):
h, w = mesh.range()[:2]
aspect_ratio = w / h
height = render_width * aspect_ratio
r = GLRasterizer(
projection_matr... | Python | 0.000001 | |
c5fd2a7bccb45325acdf7f0800843ddb9ad82b64 | split Natura2000 pdf files | migrations/split_pdf.py | migrations/split_pdf.py | #use http://pybrary.net/pyPdf/
from pyPdf import PdfFileWriter, PdfFileReader
import re
pattern = re.compile(r"RO(SCI|SPA)\d{4}")
source_path = "/Users/cornel/Downloads/2011-10-20_protectia_naturii_RO_SPA_SDF_2011.pdf"
pdf = PdfFileReader(file(source_path, "rb"))
def save_pdf(output, name):
outputStream = file... | Python | 0 | |
8ffcf96b5b270fa77026c8c62ee267363ae2e7b1 | Add virtualenv plugin: build python environment. | fapistrano/plugins/virtualenv.py | fapistrano/plugins/virtualenv.py | # -*- coding: utf-8 -*-
"""
virtualenv plugin provide
2 virtualenv environment:
1. virtualenvwrapper in /home/depploy/.virtulaenvs/%(project_name)s
2. virtualenv in each release directory
2 pip install:
1. pip
2. pip wheel
"""
from fabric.api import run, env, prefix, cd
from fabric.contrib.files import exists
from... | Python | 0 | |
4987e1722f8b55e99fbc9455eafe0210b5973060 | create server bootstrap script | server/server.py | server/server.py | #! /usr/bin/python
# encoding=utf-8
import os
import cherrypy
from http.router import Router
def bootstrap():
api_config = os.path.abspath(os.path.join(os.getcwd(), 'config/api.conf'))
router = Router()
cherrypy.tools.CORS = cherrypy.Tool('before_handler', router.cors)
cherrypy.tree.mount(router, '/a... | Python | 0.000001 | |
45c81e268df7f01fdeb64b053583b2946739eebe | add pactest with pacparser lib | pactest.py | pactest.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
'''
You have to install pacparser before runing this script.
You can get pacparser from https://code.google.com/p/pacparser.
'''
import pacparser
import time
def get_pac_result(filename, url, host):
pacparser.init()
pacparser.parse_pac(filename)
ret_str = pacparser.find_pr... | Python | 0.000126 | |
a68d89a4f351f8df2bfceeac77540b23e29827be | Add failing test for bug #1375 -- no out-of-bounds error for token.nbor() | spacy/tests/regression/test_issue1375.py | spacy/tests/regression/test_issue1375.py | from __future__ import unicode_literals
import pytest
from ...vocab import Vocab
from ...tokens.doc import Doc
@pytest.mark.xfail
def test_issue1375():
'''Test that token.nbor() raises IndexError for out-of-bounds access.'''
doc = Doc(Vocab(), words=['0', '1', '2'])
with pytest.raises(IndexError):
... | Python | 0 | |
6418326667f0819a028606dee1683965a0092e0a | add functions to find the data dir | cs251tk/specs/dirs.py | cs251tk/specs/dirs.py | import os
def get_specs_dir():
return os.path.join(get_data_dir(), 'cs251tk', 'specs')
def get_data_dir():
return os.getenv('XDG_DATA_HOME', os.path.join(os.getenv('HOME'), '.local', 'share'))
| Python | 0.000001 | |
4af8e31da47b321cfbd84223619379167c9c7d3b | Add config file with list of programs | app/config.py | app/config.py | programs = {
"ascii_text": {
"title": "ASCII Text",
"path": "programs/ascii_text.py",
},
"blink_sun": {
"title": "Blink Sun",
"path": "programs/blink_sun.py"
},
"cheertree": {
"title": "Cheertree",
"path": "programs/cheertree.py"
},
"cross": {
... | Python | 0.000001 | |
7749a3531cc2985112b7ef60421dd9c07e742bcb | Add fabfile.py file to project | fabfile.py | fabfile.py | #! /usr/bin/env python2
# -*- coding: utf-8 -*-
"""The jupyterhub stack fabric file"""
from fabric.api import local
def git():
"""Setup Git"""
local("git remote rm origin")
local("git remote add origin https://korniichuk@github.com/korniichuk/jupyterhub.git")
local("git remote add bitbucket https://... | Python | 0 | |
c6d47e22825da4516f313f4a8bef6237c17b48b9 | Clear user's profile id cache on organization change. | judge/signals.py | judge/signals.py | from django.core.cache.utils import make_template_fragment_key
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.core.cache import cache
from .models import Problem, Contest, Submission, Organization, Profile, NavigationBar, MiscConfig, Language, Judge, \
B... | from django.core.cache.utils import make_template_fragment_key
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.core.cache import cache
from .models import Problem, Contest, Submission, Organization, Profile, NavigationBar, MiscConfig, Language, Judge, \
B... | Python | 0 |
fcea7c42c7b793a84febd29112b50fc89b5fd6f4 | Add fabfile to generate documentation | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
"""
fabfile
Fab file to build and push documentation to github
:copyright: © 2013 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import time
from fabric.api import local, lcd
def upload_documentation():
"""
Build an... | Python | 0.000001 | |
1d19208600c137cc4b27fd4c046d424982c6e4f5 | Rename base class DakotaBase | dakota/dakota_base.py | dakota/dakota_base.py | #! /usr/bin/env python
"""A base class for all Dakota experiments."""
from abc import ABCMeta, abstractmethod
class DakotaBase(object):
"""Describe features common to all Dakota experiments."""
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
"""Create a set of default experiment ... | Python | 0 | |
1e82283cc85b2eb449969849d23c4ffa2c090426 | Add script to batch convert a directory recursively | scripts/directory_batch_convert.py | scripts/directory_batch_convert.py | import os
import sys
import re
from pathlib import Path
import argparse
from convert2netcdf4 import parseandconvert
parser = argparse.ArgumentParser(description='Recursively batch convert Vaisala old-binary format to NetCDF files. Keeps directory structure.')
parser.add_argument('--from', dest='fromdir', help='Input... | Python | 0.000001 | |
8a3caf06f146ff9d3cf20d0d739c78cb93c16325 | Add migrations | ureport/polls/migrations/0049_auto_20160810_1823.py | ureport/polls/migrations/0049_auto_20160810_1823.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0048_populate_age_and_gender_on_poll_results'),
]
operations = [
migrations.AlterField(
model_name='pol... | Python | 0.000001 | |
b69643de7f9ec207949e0054d2b1e98dbb81d898 | Add new package: librelp (#18779) | var/spack/repos/builtin/packages/librelp/package.py | var/spack/repos/builtin/packages/librelp/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Librelp(AutotoolsPackage):
"""Librelp is an easy to use library for the RELP protocol. REL... | Python | 0 | |
860f8224bf8ef2f1553a17842d1389491f43bfa5 | Add missing migration for wagtail.tests | wagtail/tests/migrations/0008_auto_20141113_2125.py | wagtail/tests/migrations/0008_auto_20141113_2125.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tests', '0007_registerdecorator'),
]
operations = [
migrations.AlterField(
model_name='pagechoosermodel',
... | Python | 0 | |
78420caaac5c5055d9264e9905c5e14e9756a064 | Add Cli_server_tcp, just like Cli_server_local, but using TCP socket. | sippy/Cli_server_tcp.py | sippy/Cli_server_tcp.py | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | Python | 0 | |
057173c48a56c0c858212233ee60dcbb88e22838 | Add tests.py, including one failure | mysite/profile/tests.py | mysite/profile/tests.py | import django.test
from search.models import Project
import twill
from twill import commands as tc
from twill.shell import TwillCommandLoop
from django.test import TestCase
from django.core.servers.basehttp import AdminMediaHandler
from django.core.handlers.wsgi import WSGIHandler
from StringIO import StringIO
# FIXM... | Python | 0.000002 | |
bfc386c1a894811532ccfc65ce45339a964c5ac0 | Create batch_clip.py | batch_clip.py | batch_clip.py | # clips all .shps in folder to a boundary polygon
from subprocess import call
import os
# in dir of to be clipped shps and boundary file
shp_folder = "nrn_rrn_on_shp_en"
clip_poly = "clip_bound.shp"
#output dir name
# os.mkdir("clipped")
c = 0
for subdir, dirs, files in os.walk(shp_folder):
for file in files:
i... | Python | 0.000003 | |
d1e403fce1affd0c7da1753fda441dd9a9c1d9ff | copy ISON settings for BBC | net/settings_bbc.py | net/settings_bbc.py | # settings_ison.py
from settings_common import *
TEMPDIR = '/data2/tmp'
DATABASES['default']['NAME'] = 'an-ison'
LOGGING['loggers']['django.request']['level'] = 'WARN'
SESSION_COOKIE_NAME = 'IsonAstrometrySession'
ssh_solver_config = 'an-ison'
sitename = 'ison'
| Python | 0 | |
f20ed3b4941fef84e95afce4db0349ed8da3070e | Create Hour_Rain_Map.py | Hour_Rain_Map.py | Hour_Rain_Map.py | #############################################################################
# Name: Elizabeth Rentschlar #
# Assistantce from: #
# Purpose: Use Hourly rain totals condensed in Hours.py to create a series #
# ... | Python | 0.000001 | |
d8ad74b80f214ca313d01533ea6f15082cbb3af2 | Add tests for calibration procedure (draft) | srttools/core/tests/test_calibration.py | srttools/core/tests/test_calibration.py | from ..calibration import CalibratorTable
from ..read_config import read_config
from ..scan import list_scans
import numpy as np
import matplotlib.pyplot as plt
import unittest
from astropy.table import Table
from ..imager import ScanSet
import os
import glob
class Test2_Calibration(unittest.TestCase):
@classmeth... | Python | 0 | |
427f4562dc2a4fa7b805154e3ffd732381ed6e8d | Add dbwriter.py | dbwriter.py | dbwriter.py | from pymongo import MongoClient
import os
from pathlib import Path
def main():
client = MongoClient('localhost', 27017)
db = client['thesis-database']
#tfidf-cv-category
collection = db['tfidf-cv-category']
path = 'Calculated/tfidf/cv-category'
for filename in os.listdir(path):
if filena... | Python | 0.000001 | |
ac8fdf7dc902caed2757ea40483fff951af93ac8 | add cu2qu.cli module exporting a main() function for console script | Lib/cu2qu/cli.py | Lib/cu2qu/cli.py | import os
import argparse
import logging
import shutil
import multiprocessing as mp
from contextlib import closing
from functools import partial
import cu2qu
from cu2qu.ufo import font_to_quadratic, fonts_to_quadratic
import defcon
logger = logging.getLogger("cu2qu")
def _cpu_count():
try:
return mp.cp... | Python | 0.000001 | |
afcd636772952c8b6d2cca51e1851af29f5b6707 | Create PostForm. | blog/forms.py | blog/forms.py | from django import forms
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = '__all__'
def clean_slug(self):
return self.cleaned_data['slug'].lower()
| Python | 0 | |
04d89cc1f9682f8c42605f945ac85a7a908ade73 | Add model workflows. | horizon/workflows/models.py | horizon/workflows/models.py | import six
from django import forms, template
from django.forms.forms import NON_FIELD_ERRORS # noqa
from django.template.defaultfilters import linebreaks # noqa
from django.template.defaultfilters import safe # noqa
from django.template.defaultfilters import slugify
from django.utils.encoding import force_text
from... | Python | 0 | |
e39290b71299843eff858fb51543b99a06178a1d | Add a simple 8x benchmark script | ice40/picorv32_benchmark.py | ice40/picorv32_benchmark.py | #!/usr/bin/env python3
import os, sys, threading
from os import path
import subprocess
import re
num_runs = 8
if not path.exists("picorv32.json"):
os.remove("picorv32.json")
subprocess.run(["wget", "https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v"], check=True)
subprocess.run(["y... | Python | 0 | |
30081b470fc3522afc4af3a4fc33eb28bc85d6d6 | Add project config manager | polyaxon_cli/managers/project.py | polyaxon_cli/managers/project.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from polyaxon_schemas.project import ProjectConfig
from polyaxon_cli.managers.base import BaseConfigManager
class ProjectConfigManager(BaseConfigManager):
"""Manages access token configuration .plxprojectconfig file."""
... | Python | 0.000001 | |
aec80109daf855f64f666f998aa2a96755e653f5 | add rpython-compatible implementation of load_resource() for win32 | esky/bdist_esky/pypy_winres.py | esky/bdist_esky/pypy_winres.py | """
esky.bdist_esky.pypy_winres: access win32 exe resources in rpython
This module provides some functions for accessing win32 exe resources from
rpython code. It's a trimmed-down version of the esky.winres module with
just enough functionality to get the py2exe compiled bootstrapper working.
"""
from pypy.r... | Python | 0 | |
aafb588ef57abd2b42067531a387144317e6618d | Change the name to facebook_reptile.py' | src/facebook_reptile.py | src/facebook_reptile.py | #!/usr/bin/python
from urllib2 import urlopen, URLError
import ujson as json
import time
from httplib import BadStatusLine
import sys, os
import time
import gzip
from argparse import ArgumentParser
"""
This is the info from the bogus app I used
"""
app_id = '653943651304297'
app_secret = '1bc923adced1393d7565dca0... | Python | 0.999729 | |
8e1a117c0d0bf3614beed0410862d1dc1a91b306 | Create shp2zip.py | upload-geospatial-data/python/shp2zip.py | upload-geospatial-data/python/shp2zip.py | import os
import shutil
import zipfile
# Creates a zip file containing the input shapefile
# inShp: Full path to shapefile to be zipped
# Delete: Set to True to delete shapefile files after zip
def ZipShp (inShp, Delete = True):
#List of shapefile file extensions
extensions = [".shp",".shx",".dbf",".sbn","... | Python | 0.000007 | |
06804460f2b0e70b7b08d6657353c1c172a0df4c | add examples/tube-stream-private.py | examples/tube-stream-private.py | examples/tube-stream-private.py | import sys
from stream_tube_client import StreamTubeJoinerPrivateClient, \
StreamTubeInitiatorPrivateClient
def usage():
print "Usage:\n" \
"Offer a stream tube to [contact] using the trivial stream server:\n" \
"\tpython %s [account-file] [contact]\n" \
"Accept a strea... | Python | 0 | |
d304c1cd9b35f92a6f5bb1c739402b8f3a6c22c8 | Create cigar_party.py | Python/CodingBat/cigar_party.py | Python/CodingBat/cigar_party.py | # http://codingbat.com/prob/p195669
def cigar_party(cigars, is_weekend):
if is_weekend and cigars >= 40:
return True
elif not is_weekend and (cigars >= 40 and cigars <= 60):
return True
else:
return False
| Python | 0.000357 | |
dbf1d68fd3c3681b1aa7673b1cfd8a2cc3417edf | Create problem5.py | Project-Euler/Problem5/problem5.py | Project-Euler/Problem5/problem5.py | """
[ref.href] https://projecteuler.net/problem=5
Smallest multiple.
2520 is the smallest number that can be divided by each
of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly
divisible by all of the numbers from 1 to 20?
"""
EPS = 1e-6
def IsDivisibleByAll(n, di... | Python | 0.000048 | |
b76b64ae3914d66bcf0e3eef60390c96c2cd1a43 | Clean up W601 error | wagtail/contrib/wagtailsitemaps/tests.py | wagtail/contrib/wagtailsitemaps/tests.py | from django.test import TestCase
from django.core.cache import cache
from wagtail.wagtailcore.models import Page, PageViewRestriction, Site
from wagtail.tests.testapp.models import SimplePage, EventIndex
from .sitemap_generator import Sitemap
class TestSitemapGenerator(TestCase):
def setUp(self):
self.h... | from django.test import TestCase
from django.core.cache import cache
from wagtail.wagtailcore.models import Page, PageViewRestriction, Site
from wagtail.tests.testapp.models import SimplePage, EventIndex
from .sitemap_generator import Sitemap
class TestSitemapGenerator(TestCase):
def setUp(self):
self.h... | Python | 0.000006 |
d441cfd92cd8d843f22f181d485786fe1ed8948f | Add herokustatus plugin | plugins/herokustatus.py | plugins/herokustatus.py | import urllib.parse
import requests
class Plugin:
def __call__(self, bot):
bot.on_respond(r"heroku st(atus)?$", self.on_respond)
bot.on_help("herokustatus", self.on_help)
def on_respond(self, bot, msg, reply):
url = "https://status.heroku.com/api/v3/current-status"
headers = { ... | Python | 0 | |
ccec48923d3cd375e37aa6b552d1460813001d05 | add simple team daemon python example | examples/python/team_daemon.py | examples/python/team_daemon.py | #! /usr/bin/env python
"""
Team daemon example. Implements very basic active backup functionality.
Note that this application spawns its own team device instead of connecting
to an existing one.
Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
This library is free software; you can redistribute it and/or modify it
u... | Python | 0 | |
0af447c0371bd157c03fc5097ac8c0e0a5873ff7 | Add temporary satellites analysis example. | examples/satellites_analyze.py | examples/satellites_analyze.py | assert __name__ == '__main__'
import bayeslite.bql as bql
import bayeslite.core as core
import bayeslite.parse as parse
import crosscat.LocalEngine as localengine
import getopt
import sys
# XXX This is wrong -- should be part of bayesdb proper. But it, and
# copypasta of it, will do for now until internals are restr... | Python | 0 | |
034cb3a0fe2a2c0c8b47fd631ca28bbfa7091902 | add recursive preOrder BST | BST/bst.py | BST/bst.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
class Node(object):
def __init__(self, value):
self.left = None
self.right = None
self.value = value
# recursive
def preOrderRecur(ro... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
class Node(object):
def __init__(self, value):
self.left = None
self.right = None
self.value = value
# iterative
def preOrder(root):
... | Python | 0.000046 |
022ab3e18660a310545d59a467f6eb9703fb5422 | Add dummy settings for database (which hopefully work). | beernburger/my_settings.py | beernburger/my_settings.py | """
Django settings for beernburger project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | Python | 0 | |
bdfbea2e5896a6a20ae15f053b80b664e946eb88 | Solved task 2 on bio algorithms | Stepic/BioinformaticsAlgorithms/ReverseComplement.py | Stepic/BioinformaticsAlgorithms/ReverseComplement.py | # Reverse Complement Problem: Reverse complement a nucleotide pattern
def main():
dna = ''
with open('dna.txt', 'r') as f:
dna = f.read()
comp_dna = ''
for i in dna[::-1]:
if i == 'A':
comp_dna += 'T'
elif i == 'T':
comp_dna += 'A'
elif i == 'C'... | Python | 0.998269 | |
1d48cbd2a9882d20b71fe26841a8c8575fbb3ba9 | Add script to generate all attention plots for dataset | bin/visualize_attention.py | bin/visualize_attention.py | #! /usr/bin/env python
""" Generates model predictions.
"""
import os
import tensorflow as tf
from tensorflow.python.platform import gfile
import numpy as np
from matplotlib import pyplot as plt
from seq2seq import graph_utils
from seq2seq.inference import create_inference_graph, create_predictions_iter
tf.flags.D... | Python | 0.000001 | |
aa52332d622e16b3d1524eb2dc12047cec02fb33 | Create calculator.py | calculator.py | calculator.py | # my-first-calculator
#Description is in the name
#calculator
print "For addition press 1"
print "For subtraction press 2"
print "For multiplication press 3"
print "For division press 4"
print "If you're all done press 5"
cmd=float(int(raw_input("Enter operation number:")))
#Addition
if cmd==1:
print "Ok begi... | Python | 0.000001 | |
069a5758b16624ac2b547ede44123b64c89baf96 | Add simple script mapping YTID to KA URLs. | map_ytids_to_ka_urls.py | map_ytids_to_ka_urls.py | #!/usr/bin/env python3
from kapi import *
from utils import *
import argparse, sys
import time
def read_cmd():
"""Function for reading command line options."""
desc = "Program for mapping YouTube IDs to KA URLs to Crowdin WYSIWYG editor."
parser = argparse.ArgumentParser(description=desc)
parser.add_argu... | Python | 0 | |
41265e02f47a55d11dcc921aeeebebba290ed61f | Fix Dee. | game/migrations/0008_fix_dee.py | game/migrations/0008_fix_dee.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def fix_dee(apps, schema_editor):
Character = apps.get_model('game', 'Character')
dee = Character.objects.get(name='Dee')
dee.en_face = 'characters/front_view/Dee.svg'
dee.save()
class Migrati... | Python | 0 | |
31af59fdfa988924da8a6b02b191ae9ba8ab5f02 | Add initial SDS011 sensor reader script | RpiAir/sds011.py | RpiAir/sds011.py | # coding=utf-8
"""
TODO:
check sleep command from here!
http://www.codegists.com/snippet/python/sds011_kadamski_python
"""
from __future__ import print_function
import serial
import struct, sys
import sys
import datetime
class Sds011Reader:
def __init__(self, port, baudrate=9600):
self.ser = serial.... | Python | 0 | |
6d0f78ccdb8587d5a35ee297198a664274598747 | Create run_test.py | recipes/pytest-sugar/run_test.py | recipes/pytest-sugar/run_test.py | import django
from django.conf import settings
settings.configure(INSTALLED_APPS=['pytest_sugar', 'django.contrib.contenttypes', 'django.contrib.auth'])
django.setup()
import pytest_sugar
| Python | 0.000004 | |
e50dc18525e0e4cbbef56cd16ba4e2d9690464f1 | Add solution for problem 34 | euler034.py | euler034.py | #!/usr/bin/python
from math import factorial, log
values = [0]*10
for i in range(10):
values[i] = factorial(i)
total = 0
for i in range(10, factorial(9) * 7):
target = 0
test = i
while test != 0:
x = test % 10
target += values[x]
test = test // 10
if i == target:
t... | Python | 0 | |
427752b4ee3d63d1bf29a9a2a9be011662df8556 | add login handler | jupyterhub_login.py | jupyterhub_login.py | from sandstone.lib.handlers.base import BaseHandler
import requests
import os
class JupyterHubLoginHandler(BaseHandler):
def get(self):
api_token = os.environ['JUPYTERHUB_API_TOKEN']
url = '{protocol}://{host}/hub/api/authorizations/token/{token}'.format(
protocol=self.request.protocol... | Python | 0.000001 | |
8bd8ae1daa432bce9881214c4d326ac8a38e2046 | Correct MAPE loss | keras/objectives.py | keras/objectives.py | from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
from six.moves import range
epsilon = 1.0e-9
def mean_squared_error(y_true, y_pred):
return T.sqr(y_pred - y_true).mean(axis=-1)
def mean_absolute_error(y_true, y_pred):
return T.abs_(y_pred - y_true).mean(axis=... | from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
from six.moves import range
epsilon = 1.0e-9
def mean_squared_error(y_true, y_pred):
return T.sqr(y_pred - y_true).mean(axis=-1)
def mean_absolute_error(y_true, y_pred):
return T.abs_(y_pred - y_true).mean(axis=... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.