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 |
|---|---|---|---|---|---|---|---|
9cc13ca511987584ea4f52cf0c2e57e6b98a9e8b | Add lc0350_intersection_of_two_arrays_ii.py | lc0350_intersection_of_two_arrays_ii.py | lc0350_intersection_of_two_arrays_ii.py | """Leetcode 350. Intersection of Two Arrays II
Easy
URL: https://leetcode.com/problems/intersection-of-two-arrays-ii/
Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2]
Output: [2,2]
Example 2:
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
Output: [4,9... | Python | 0.000351 | |
eb3882051241843716ef9b7ceef8aeb6ee2a35c6 | add mysqlproxy.py | misc/mysqlproxy.py | misc/mysqlproxy.py | #!/usr/bin/env python3
##############################################################################
#The MIT License (MIT)
#
#Copyright (c) 2016 Hajime Nakagami
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to dea... | Python | 0.000002 | |
f1c389a0028c6f92300573bef587c084204e858f | Create circlecli.py | mocks/circlecli.py | mocks/circlecli.py | # -*- coding: utf-8 -*-
"""
Mocks for the CircleCLI API library tests.
"""
from httmock import response, urlmatch
NETLOC = r'(.*\.)?circleci\.com$'
HEADERS = {'content-type': 'application/json'}
GET = 'get'
class Resource:
""" A CircleCli resource.
:param path: The file path to the resource.
"""
... | Python | 0 | |
efc76b2a0abe82cad0e1074bc51b6e9a6c5b5b35 | add test when no description in object | tests/check-no-description.py | tests/check-no-description.py | #!/usr/bin/python3
# coding: utf-8
import sys
import json
import requests
import pprint
import unittest
import string
import random
import os
import json
import time
import datetime
import base64
import uuid
import argparse
import string
pp = pprint.PrettyPrinter(depth=6)
parser = argparse.ArgumentParser()
parser.ad... | Python | 0 | |
30359b6e9ec105b2938cedd59127e5fa40964396 | Create setrun.py | rect-shelf/setrun.py | rect-shelf/setrun.py | Python | 0.000001 | ||
39d2a5eec167e659cd30f5522a9e4e9ca11a620a | Create layoutUVPlus.py | af_scripts/uv/layoutUVPlus.py | af_scripts/uv/layoutUVPlus.py | import pymel.core as pm
import math
sels = pm.ls(sl=1)
gap = 0.003
for i, x in enumerate(sels):
x=x.getShape()
pm.select('{0}.map[:]'.format(x), r=1)
buv = pm.polyEvaluate(x,b2=1)
w = abs(buv[0][1] - buv[0][0])
if i==0:
pm.polyEditUV(u=-buv[0][0]+(gap*(i+1)),v=-buv[1][0]+gap)
else:
pm.polyEditUV(u=-buv[0][0]+... | Python | 0 | |
eee6b08e07e60a8ec1f3c2fa2e156344e01737d2 | clean out | avatar/admin.py | avatar/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | Python | 0.000002 |
2d9300aeefc840e007d7c615ce48ad36343038f2 | Add "--optimize-autoloader" to `composer.phar install` command | php-silex/setup.py | php-silex/setup.py | import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("php-silex/web/index.php", "192.168.100.102", "" + args.database_host + "")
setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home +... |
import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
def start(args):
setup_util.replace_text("php-silex/web/index.php", "192.168.100.102", "" + args.database_host + "")
setup_util.replace_text("php-silex/deploy/php-silex", "\".*\/FrameworkBenchmarks", "\"" + home ... | Python | 0.000004 |
26011563bf0880206269582a87f9fff61f262c83 | add a new migration | osf/migrations/0056_citationstyle_has_bibliography.py | osf/migrations/0056_citationstyle_has_bibliography.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-29 14:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0055_auto_20170823_1648'),
]
operations = [
migrations.AddField(
... | Python | 0.000001 | |
d637cbe9c904fb0f0b67fbc10f66db299d153f4e | Add basic smoke tests for doc generation | tests/functional/test_docs.py | tests/functional/test_docs.py | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | Python | 0 | |
8fb94de6b72847bdb618ffa60fa037d16bab443e | Add closing tests module | tests/plantcv/test_closing.py | tests/plantcv/test_closing.py | import pytest
import cv2
import numpy as np
from plantcv.plantcv import closing
def test_closing(test_data):
# Read in test data
bin_img = cv2.imread(test_data.small_bin_img, -1)
filtered_img = closing(gray_img=bin_img)
# Assert that the output image has the dimensions of the input image and is binary... | Python | 0 | |
548f4f6512ced9a9c41a074a3c8382f87ccafa66 | add image resizing to python script and give it a better name | xkcd1110_stitch.py | xkcd1110_stitch.py | #! /usr/bin/env python
"""Combines resized tiles grabbed from xkcd 1110 into one large png"""
import Image
import os
import sys
def coord(image_x, image_y, tilesize):
'''
converts x, y coordinates to tile naming format
'''
image_dir = "images/"
if image_x > 0:
#east
lng = "%se" %... | Python | 0.000001 | |
c32d62eb82bbe6d728d66d7544c45dfb296afcd4 | Implement regression test runner in Python | tests/run_regression_tests.py | tests/run_regression_tests.py | #!/usr/bin/env python3
# this file is an experiment to run regression tests in parallel
# using Python for cross platform to run with the same script on all platforms
# (currently .sh for Linux, .bat for Windows, ??? for Mac)
import os
import queue
import subprocess
import threading
class TestRunner(object):
de... | Python | 0.000001 | |
c226835aa56a2d5ba8583e63c4b75765cd24711d | add new package (#27971) | var/spack/repos/builtin/packages/py-zipfile-deflate64/package.py | var/spack/repos/builtin/packages/py-zipfile-deflate64/package.py | # Copyright 2013-2021 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 PyZipfileDeflate64(PythonPackage):
"""Extract Deflate64 ZIP archives with Python's zipfile... | Python | 0 | |
8c6646d75ec6f9345e1582c02611984a1d953582 | add reproducing case | tests/trac/test-issue-0092.py | tests/trac/test-issue-0092.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import pyxb.binding.generate
import pyxb.utils.domutils
import xml.dom.minidom as dom
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
xsd = '''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns... | Python | 0.000141 | |
86d8f0fd48ccb577a8300362ea9d181e63d2fa5d | Add unit tests for bandit.core.issue | tests/unit/core/test_issue.py | tests/unit/core/test_issue.py | # -*- coding:utf-8 -*-
#
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... | Python | 0.000001 | |
3d935fcc7d2d2afb004348a8839f2ec7813fe78c | Add unbound performance plugin | satori-rules/plugin/unbound/30_unbound.py | satori-rules/plugin/unbound/30_unbound.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# -- prioritized --
import sys
import os.path
# sys.path.append(os.path.join(os.path.dirname(__file__), '../libs'))
# -- stdlib --
import json
import re
import socket
import subprocess
import time
# -- third party --
# -- own --
# -- ... | Python | 0 | |
a0714c8754c769c4fee868f2b449d9dc69d144a9 | Add Welcome plugin to welcome new members | plugins/welcome.py | plugins/welcome.py | import json
from plugin import Plugin
class Welcome(Plugin):
"""
Welcomes new members when they join the Slack team
"""
def __init__(self):
Plugin.__init__(self)
self.event_type = 'team_join'
def on_event(self, bot, event, response):
# Get list of all channels (don't incl... | Python | 0 | |
3ce048f8c0346c30173b52a691bd18ece1cbc13d | Add a TensorFlow Probability sample | scripts/stock_price/tough_question_tfp.py | scripts/stock_price/tough_question_tfp.py | #!/usr/bin/python3
# coding: utf-8
'''
Implementation of the article below with TensorFlow Probability
'Bayesian Methods for Hackers'
https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_PyMC3.ipynb
Based on an example of Ten... | Python | 0.000184 | |
e42c115f8a612b3995e30b3606913acb7e7b0f63 | Create 2-off.py | Code/2-off.py | Code/2-off.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
print "Lights off"
GPIO.output(18,GPIO.LOW)
GPIO.output(23,GPIO.LOW)
GPIO.output(24,GPIO.LOW)
GPIO.cleanup()
| Python | 0.000001 | |
a2214039defb1094d47b7ce0abc4e56032136508 | Add merge migration | osf/migrations/0137_merge_20181011_1525.py | osf/migrations/0137_merge_20181011_1525.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-10-11 15:25
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0136_merge_20181010_2242'),
('osf', '0136_add_ember_auth_register_waffle_flag'),
... | Python | 0.000001 | |
1a3b9eec2a947a8f036fdea80a4d7de4b7549211 | Add prime functions library | prime_functions.py | prime_functions.py | import numpy as np
from math import sqrt
def get_primes_below(n):
# http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
""" Input n>=6, Returns a array of primes, 2 <= p < n """
sieve = np.ones(n/3 + (n % 6 == 2), dtype=np.bool)
sieve[0] = False
... | Python | 0.000005 | |
3f01678bdcdf62d1e6e7189db6ed1337f57bdfd8 | Create rename_add_prefix.py | rename_add_prefix.py | rename_add_prefix.py | def applyPrefix( prefix, name):
test = name.find(prefix)
if test == -1 or test != 0:
name = prefix + name
return name
class renamePrefixDialog(MQWidget.Dialog):
def __init__(self, parent):
MQWidget.Dialog.__init__(self, parent)
self.title = "Add Prefix to Selected Objects"
self.frame0 = self.create... | Python | 0.000005 | |
451a65d6b5cbc182418f00703e2da84b7c346a70 | Create Dictionary._((glas+python?glaskrypt)) | Dictionary.py | Dictionary.py | #!/usr/bin/env python
#
# Basic hack
#
# What?Needed??
# Bison like parser for js
# _WHY? Because I forget things easily
class Dict(dict)
def __init__(self, keyd, *arguments,**context):
self._context = context
# Elaborate on that
class Elaboration(Dict)
pass
# To bind them together... I have n... | Python | 0.00002 | |
0ebddf569f291ceca050972fe9cfd3d9e498e87c | add timeout decorator | pyannote/audio/utils/timeout.py | pyannote/audio/utils/timeout.py | #!/usr/bin/env python
# encoding: utf-8
# Shamelessly stolen from
# https://gist.github.com/TySkby/143190ad1b88c6115597c45f996b030c
"""Easily put time restrictions on things
Note: Requires Python 3.x
Usage as a context manager:
```
with timeout(10):
something_that_should_not_exceed_ten_seconds()
```
Usage as a... | Python | 0.000001 | |
152def3ad56af928b81586867e3c8ee85cbf5311 | Add a client application class | blitz/client.py | blitz/client.py | __author__ = 'Will Hart'
from blitz.io.database import DatabaseClient
from blitz.io.tcp import TcpClient
import blitz.web.api as blitz_api
import blitz.web.http as blitz_http
import logging
#import json
import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.web
class Config(object):
"""... | Python | 0.000001 | |
927a49da0ac7fe633c72f6d08ed93710c1d71630 | Refactor image alias tests to reduce copypasta | pylxd/tests/test_image_alias.py | pylxd/tests/test_image_alias.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 |
ca0bec705a6c68c7540c9b7f0a02972e1f26723c | Create py-递归设置.py | py-递归设置.py | py-递归设置.py | #!/usr/bin/python
# -*- encoding:utf-8 -*-
import sys
sys.setrecursionlimit(1500) # set the maximum depth as 1500
def recursion(n):
if(n <= 0):
return
print n
recursion(n - 1)
if __name__ == "__main__":
recursion(1200)
| Python | 0.000001 | |
cc5cf15bbbdcf6a4481bc88854b3a80f1fc99241 | rename file openFileRooms.py in openfilerooms.py | trunk/editor/openfilerooms.py | trunk/editor/openfilerooms.py | #!/usr/bin/env python
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from structData.area import Area
from structData.action import Action
from structData.param import Param
from structData.ite... | Python | 0.000004 | |
61419ddc8db5f393bd79d200fc09424721877729 | Change BG color of None state TIs | airflow/utils/state.py | airflow/utils/state.py | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | Python | 0 |
ad7d04f73637d6228b82fbb89d51c13844cb1025 | Fix styling of the invites icon | shell/view/frame/ActivitiesBox.py | shell/view/frame/ActivitiesBox.py | # Copyright (C) 2006, Red Hat, Inc.
#
# 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 version.
#
# This program is distributed in... | # Copyright (C) 2006, Red Hat, Inc.
#
# 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 version.
#
# This program is distributed in... | Python | 0 |
c926a130853f33155c57e621b52ab62aecef8049 | 20170104 initial commit py2mysql.py | python/py2mysql.py | python/py2mysql.py | # -*- coding: utf-8 -*-
"""
#
# author : jiankaiwang (http://welcome-jiankaiwang.rhcloud.com/)
# source code in github : seed (https://github.com/jiankaiwang/seed)
# document in gitbook : seed (https://www.gitbook.com/book/jiankaiwang/seed/details)
#
# desc : function to print key-value query data
def dictRes(a):
... | Python | 0.999371 | |
5ade8c78e6ab875047ca29779dc37f9029a9f0d6 | Create set_auth.py | bluemix/set_auth.py | bluemix/set_auth.py | import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'username'
user.email = 'your@email.com'
user.password = 'pwd'
session = settings.Session()
session.add(user)
session.commit()
session.close()
| Python | 0.000003 | |
6ce3ae4ef4a274e76bf1f6d76f0675bec2391d17 | add first pass of maria DB slave nagiors monitor - slave_sql and slave_io checks are done | check_mariadb_slaves.py | check_mariadb_slaves.py | #!/usr/bin/env python
"""MariaDB slave status checker"""
import sys
import argparse
import MySQLdb
class SlaveStatusCheck(object):
"""Class to help us run slave status queries against MariaDB"""
REPLICATION_LAG_MODE = 'replication_lag'
SLAVESQL_MODE = 'slave_sql'
SLAVEIO_MODE = 'slave_io'
MODES = ... | Python | 0 | |
cb5b85fc4a011f7eb9628b7099311b399f4d033d | Create born_on_a_friday.py | born_on_a_friday.py | born_on_a_friday.py | #!/usr/bin/env python3
from datetime import datetime
from typing import Tuple
def ask_month_day_year(prompt: str = "Enter your birthday") -> Tuple[int, int, int]:
date = input(f"{prompt} in the format: MM/DD/YYYY ")
month, day, year = (int(x.strip()) for x in date.split("/"))
return month, day, year
de... | Python | 0.000048 | |
576dd7270714ec63beab9ce6af22f94e20dc1dd5 | Add admin model classes to forum_tracking app | machina/apps/forum_tracking/admin.py | machina/apps/forum_tracking/admin.py | # -*- coding: utf-8 -*-
# Standard library imports
from __future__ import unicode_literals
# Third party imports
from django.contrib import admin
# Local application / specific library imports
from machina.core.db.models import get_model
ForumReadTrack = get_model('forum_tracking', 'ForumReadTrack')
TopicReadTrack ... | Python | 0 | |
2f7e3cf34e8460565d572507c2f97b98ac653036 | Allow overriding of DEFAULT_ENV_PREFIX | cbs/__init__.py | cbs/__init__.py |
from functools import partial
import importlib
import inspect
import os
from django.utils import six
from .utils import as_bool
DEFAULT_ENV_PREFIX = ''
class env(object):
'''
Decorator to make environ based settings simpler.
@env
def SOMETHING_KEY(self):
return 'default'
You can ove... |
from functools import partial
import importlib
import inspect
import os
from django.utils import six
from .utils import as_bool
DEFAULT_ENV_PREFIX = ''
class env(object):
'''
Decorator to make environ based settings simpler.
@env
def SOMETHING_KEY(self):
return 'default'
You can ove... | Python | 0.00027 |
115d17320e9fcd3eab4e60f222f382a7d551948b | Add unittests for magnumclient.v1.client module | magnumclient/tests/v1/test_client.py | magnumclient/tests/v1/test_client.py | # Copyright (c) 2015 Thales Services SAS
#
# 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 l... | Python | 0.000001 | |
a59f86ea4905534237f9a1e055bce6a3a3d5fb81 | add migration so edit_messaging is set to True when the role has edit_data set to True | corehq/apps/users/migrations/0037_add_edit_messaging_permission.py | corehq/apps/users/migrations/0037_add_edit_messaging_permission.py |
from django.db import migrations
from corehq.apps.users.models_role import SQLPermission, UserRole
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def migrate_edit_migrations_permissions(apps, schema_editor):
permission, created = SQLPermission.objects.get_or_create(value=... | Python | 0.012809 | |
a824039003abd693ff568d753c60bb6025bfd868 | Add cleanup_slaves.py script. | scripts/tools/cleanup_slaves.py | scripts/tools/cleanup_slaves.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Removes checkouts from try slaves."""
import os
import subprocess
import sys
ROOT_DIR = os.path.join(os.path.dirname(os.path.a... | Python | 0.000008 | |
72467acd590ae5a3494e5059ce2ba99cf656baaa | Add IsAdminOrReadOnly permission class | registries/permissions.py | registries/permissions.py | from rest_framework.permissions import IsAdminUser, SAFE_METHODS
class IsAdminOrReadOnly(IsAdminUser):
"""
Allows read-only access to all users (including anonymous users) and write access to admin users only
"""
def has_permission(self, request, view):
is_admin = super().has_permission(reques... | Python | 0.000002 | |
d34b2a13b454ca2c08bd5e8bc3b38d80fb5367c6 | add initial mockup of curses UI | pyfs/ui.py | pyfs/ui.py | import curses
import os
import sys
import pyfs
class SimplePager(object):
def __init__(self):
self._old_stdout = sys.__stdout__
self._old_stdout_fd = os.dup(sys.stdout.fileno())
os.dup2(sys.stderr.fileno(), sys.stdout.fileno())
tty = open('/dev/tty')
os.dup2(tty.fileno(), ... | Python | 0.000001 | |
961fe99941860665d3c5f5782540d996eecdce94 | Prepare experimental data. | qm/expt.py | qm/expt.py | """ experimental data """
from collections import defaultdict
import logging
import pickle
from urllib.request import urlopen
import numpy as np
import yaml
from . import cachedir, systems
class HEPData:
"""
Interface to a HEPData yaml file.
"""
def __init__(self, inspire_rec, table, version=1):
... | Python | 0 | |
01b9d4a491e2d732e9684d0782dcbf38df5eeec9 | Add adapters.py to new channelworm directory | channelworm/adapters.py | channelworm/adapters.py | # configure django to use default settings
# note that this can also be done using an environment variable
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
if hasattr(settings, 'DEBUG'):
# settings are configured already
pass
else:
# load default settings if they're ... | Python | 0 | |
f4689709f55a5e3209de7221853cb35a36699dcd | add file | check_sphinx.py | check_sphinx.py | import py
import subprocess
def test_linkcheck(tmpdir):
doctrees = tmpdir.join("_build/doctrees")
htmldir = tmpdir.join("_build/html")
subprocess.check_call(["sphinx-build", "-W", "-blinkcheck", "-d",
str(doctrees), "source", str(htmldir)])
def test_build_docs(tmpdir):
doctrees = tmpdir.join(... | Python | 0.000001 | |
45a1efa21162a5f1c39d8255d13d2bbca8f6c0ca | Create 7_ten_row_abacus.py | 7_ten_row_abacus.py | 7_ten_row_abacus.py | #########################################################################
# 10-row School abacus
# by
# Michael H
#########################################################################
# Description partially extracted from from wikipedia
#
# Aroun... | Python | 0.998716 | |
9207041afb78f8d36442b7ee19b95055ebbc99cd | add test forms | app/tests/test_form.py | app/tests/test_form.py | from django.test import TestCase
from app.forms import FormAppOne
class TestForm(TestCase):
def test_invalid_name_form(self):
form = FormAppOne({'name': '1234', 'description': 'validate name'})
self.assertFalse(form.is_valid())
self.assertEquals(form.errors, {'name': [u'Name must be only ... | Python | 0 | |
a460b73861d406b14519b3e391190d1b8d7e57a9 | Add maximal margin classifier. | max_margin_classifier.py | max_margin_classifier.py | import numpy as np
import matplotlib.pylab as plt
from sklearn.svm import SVC
X = np.array([[3, 4], [2, 2], [4, 4], [1, 4], [2, 1], [4, 3], [4, 1]])
y = np.array(['Red', 'Red', 'Red', 'Red', 'Blue', 'Blue', 'Blue'])
linear_svm = SVC(kernel = 'linear', C = 2 ** 15)
linear_svm.fit(X, y)
## w0 * X_1 + w1 * X_2 + b = 0 <... | Python | 0.000007 | |
2e821ab48542c89ac41ebc17036bddc164506a22 | Backup of some unused code | combine_data/cartesianProductOfIDs.py | combine_data/cartesianProductOfIDs.py | import argparse
import itertools
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')
parser.add_argument('--idFileA',required=True,type=str,help='First file of IDs')
parser.add_argument('--idFileB',required=True,type=str,help='Second file of IDS'... | Python | 0.000001 | |
178dff5f0af375f4f49416aeb41b5d7a718d69e8 | Add python script to demystify compiler output | scripts/demystify.py | scripts/demystify.py | #!/usr/bin/env python
# This script demystifies C++ compiler output for CAF by
# replacing cryptic `typed_mpi<...>` templates with
# `replies_to<...>::with<...>` and `atom_constant<...>`
# with human-readable representation of the actual atom.
import sys
# decodes 6bit characters to ASCII
DECODING_TABLE = ' 01234567... | Python | 0.000002 | |
01e551bdfbe298cdbd30734a52305be25b65147a | add docker build.py | docker/build.py | docker/build.py | """
This script builds Docker images for various combinations of
parameters. Should be run from inside the git tree.
"""
import sys
from os import path
from argparse import ArgumentParser
from subprocess import run, PIPE, Popen
from time import time
import shutil
def parse_args(argv=None):
if argv is None:
... | Python | 0.000003 | |
d3210b3d25a2eef7c4d066878d444b9b381243eb | add roulette | modules/ruletti.py | modules/ruletti.py | # -*- coding: ISO-8859-15 -*-
from twisted.internet import reactor
from core.Uusipuu import UusipuuModule
import random
class Module(UusipuuModule):
def startup(self):
self.scheduled['unban'] = []
def cmd_ruletti(self, user, target, params):
nick = user.split('!', 1)[0]
if random... | Python | 0.000387 | |
432cbfc65ea1e6c1b9079915cce20769b88502fe | add wrapper script to run dbify module | scripts/run_dbify.py | scripts/run_dbify.py | import logging
import os
import sys
import argparse
import _mypath
from bripipetools import genlims
from bripipetools import dbify
def parse_input_args(parser=None):
parser.add_argument('-p', '--import_path',
required=True,
default=None,
hel... | Python | 0 | |
d5b3bce22aec3e84b59fad379859aa636f2d3f1a | Create ColorConvolution.py | ColorConvolution.py | ColorConvolution.py | import numpy
def ColorConvolution ( I, W ):
'''
Reconstructs a color image from the stain matrix "W" and the stain intensity
images generated by ColorDeconvolution.
*Inputs:
I (rgbimage) - an RGB image of type unsigned char.
W (matrix) - a 3x3 matrix containing the color vectors in col... | Python | 0 | |
67d4bc38778632b482d9c372efb41104ecabedfa | add test cases for aggregate.py | test/test_aggregate.py | test/test_aggregate.py | from MrBam.bam import get_reads
from MrBam.aggregate import aggregate_reads
from helper import make_bam
from argparse import Namespace
from pysam import AlignmentFile
def test_aggregate_reads_1():
"it should aggregate pairs"
o = Namespace(verbos=False, qual=20)
reads = (
("r1", 'A', 60, 2, 11, 4,... | Python | 0.000005 | |
8f718c536897711663051a613e7f50d564fb4cbc | Call repair as part of upgrade | src/sentry/management/commands/upgrade.py | src/sentry/management/commands/upgrade.py | """
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | """
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | Python | 0 |
6569d7e36693512fdaadfb22a5aaf6f11fe0e084 | migrate dataregistry repeater | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | from corehq.motech.repeaters.management.commands.migrate_caserepeater import Command as MigrateCaseRepeaters
from corehq.motech.repeaters.models import SQLDataRegistryCaseUpdateRepeater
class Command(MigrateCaseRepeaters):
@classmethod
def couch_doc_type(cls):
return 'DataRegistryCaseUpdateRepeater'
... | Python | 0 | |
5aa5ac33d2b841fa1d9c707681a9d024168672c4 | Create cdbtabledef.py | cdbtabledef.py | cdbtabledef.py | """cdbtabledef.py
Developer: Noelle Todd
Last Updated: June 5, 2014
This module will create 4 tables for the client database, using the
sqlalchemy module, and the sqlite database. This module is still in
early testing stages, and as such, is subject to many changes, and
probably contains bugs.
"""
from sqlalchemy i... | Python | 0 | |
4fd42a6fc600d0db60c074f53d299b4488f637e4 | Create pdf2txt.py | luowang/Data_Processing/pdf2txt.py | luowang/Data_Processing/pdf2txt.py | # -*- coding: utf-8 -*-
from pdfminer.pdfparser import PDFParser ### ´ÓÒ»¸öÎļþÖлñÈ¡Êý¾Ý
from pdfminer.pdfdocument import PDFDocument ### ±£´æ»ñÈ¡µÄÊý¾Ý£¬ºÍPDFParser ÊÇ»¥Ïà¹ØÁªµÄ
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFRe... | Python | 0 | |
1172811d073e544d249aeba64f2b6828ee75bd5d | test geometry | tests/test_geometry.py | tests/test_geometry.py | import numpy as np
from numpy.testing import assert_allclose
from geonet.geometry import unit_vector, angle_between
def test_unit_vector():
v1 = np.array([1, 0, 0])
assert_allclose(unit_vector(v1), v1)
v2 = np.array([1, 1, 0])
u2 = unit_vector(v2)
assert_allclose(np.linalg.norm(u2), 1.0)
def tes... | Python | 0.000002 | |
f5aab57e443e5b5a7c2507f10c0c6f608d677500 | Add simple unparser test | tests/test_unparser.py | tests/test_unparser.py | # -*- coding: utf-8 -*-
from pyrql.parser import parser
from pyrql.unparser import unparser
import pytest
@pytest.mark.parametrize('func', ['eq', 'lt', 'le', 'gt', 'ge', 'ne'])
def test_cmp_functions(func):
parsed = {'name': func, 'args': ['a', 1]}
assert unparser.unparse(parsed) == '%s(a,1)' % func
pa... | Python | 0.00003 | |
0d623e0029dc7d7d6fb0bf9634904b23f2a11732 | Add files via upload | XMLAnalyze.py | XMLAnalyze.py | # Author: Andrew Sainz
#
# Purpose: XMLParser is designed to iterate through a collection of Post data collected from Stack Overflow
# forums. Data collected to analize the code tagged information to find the language of the code
# being utilized.
#
# How to use: To run from command line input "python... | Python | 0 | |
5fb7d1912eda9d6381af3e0cfa7655ed2d6795f2 | Create Xclipboard.py | Xclipboard.py | Xclipboard.py | from tkinter import Tk
__all__=['copy','paste','clear']
__author__='Calvin(Martin)Adyezik adyezik@gmail.com'
__doc__="""simple Module to work with clipboard based on tkinter -Python 3"""
__name__='Xclipboard'
def copy(text):
"""copy text to clipboard """
try:
root=Tk()
root.withdraw()
... | Python | 0.000002 | |
bbf73c8db9a2af114beb29766d0ca2e16818175b | fix 192: failure in test_disk on linux | test/_linux.py | test/_linux.py | #!/usr/bin/env python
#
# $Id$
#
import unittest
import subprocess
import sys
from test_psutil import sh
import psutil
class LinuxSpecificTestCase(unittest.TestCase):
def test_cached_phymem(self):
# test psutil.cached_phymem against "cached" column of free
# command line utility
p = sub... | #!/usr/bin/env python
#
# $Id$
#
import unittest
import subprocess
import sys
from test_psutil import sh
import psutil
class LinuxSpecificTestCase(unittest.TestCase):
def test_cached_phymem(self):
# test psutil.cached_phymem against "cached" column of free
# command line utility
p = sub... | Python | 0.000006 |
501454e30a93b6ec706add520a6b106940b537d9 | Create card_pick.py | FiveThirtyEightRiddler/2017-04-21/card_pick.py | FiveThirtyEightRiddler/2017-04-21/card_pick.py | import random
from collections import Counter
import matplotlib.pyplot as plt
from multiprocessing import Pool
import numpy as np
import itertools
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
def simulate_single_run(num_cards, hand_perc, stop_percentage):
hand_size = int(num_cards * hand_perc... | Python | 0.000001 | |
49f5b1c0111426a3366d59ca702ce5ec307fc3a8 | add rmodel | rmodel/__init__.py | rmodel/__init__.py | from jinja2 import Environment, FileSystemLoader
import os
from subprocess import Popen, PIPE
def hi():
print('hi')
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment(
autoescape=False,
loader=FileSystemLoader(os.path.join(PATH, '../templates')),
trim_blocks=False)
... | Python | 0.000001 | |
4d44d58c91e6a4fdf9ab16acac6320dd5d1f6bb9 | Add senlin-manage service list/clean for engine status | senlin/cmd/manage.py | senlin/cmd/manage.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | Python | 0.000001 |
1730cecbc05928e93e2dec826a67139bf6765cc6 | Add a src-side script to display a summary of host info. | testing/scripts/host_info.py | testing/scripts/host_info.py | #!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import multiprocessing
import os
import platform
import subprocess
import sys
import common
def is_linux():
return sy... | Python | 0.999999 | |
ab31fea8a0d30bc4b68813ce635880d4682cfc2f | Write base classes for collection profiles. | cohydra/profile.py | cohydra/profile.py | import abc
import logging
import six
class Profile(six.with_metaclass(abc.ABCMeta)):
"""Base class for all collection profiles.
Attributes:
top_dir: Where this profile's files will be stored.
parent: The profile from which this profile is derived, or
None for a root profile.
children: List o... | Python | 0 | |
8fec4b6eef7f1f4ef5840504f6abcdf0d2f9f80d | Adding the concept of a target platform. | tools/cr/cr/base/platform.py | tools/cr/cr/base/platform.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module for the target platform support."""
from importlib import import_module
import os
import cr
DEFAULT = cr.Config.From(
DEPOT_TOOLS=os.path.jo... | Python | 0.999998 | |
c2dac9161705e6edbf5b059fd8a442c2754577ff | Add Lambda job | refusereminder.py | refusereminder.py | #!/usr/bin/env python
from __future__ import print_function
import boto3
import json
import os
from mkerefuse.refuse import RefuseQuery
from mkerefuse.refuse import RefuseQueryAddress
DEFAULT_SNS_TOPIC = 'mke-trash-pickup'
"""Default topic to notify for pickup changes"""
DEFAULT_S3_BUCKET = 'mke-trash-pickup'
"""D... | Python | 0.000046 | |
8cac10350cdbc33d243a561ba06c25f5d01e9a04 | fix for lists | Scripts/SearchIncidents_5.0/SearchIncidents.py | Scripts/SearchIncidents_5.0/SearchIncidents.py | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | Python | 0.000001 |
37bd6459bff3f9b079897b1392c04681c65fa24e | Fix #8 chat.reply doesn't work in groups | aiotg/chat.py | aiotg/chat.py | import json
import logging
from functools import partialmethod
logger = logging.getLogger("aiotg")
class Chat:
"""
Wrapper for telegram chats, passed to most callbacks
"""
def send_text(self, text, **options):
"""
Send a text message to the chat, for available options see
ht... | import json
import logging
from functools import partialmethod
logger = logging.getLogger("aiotg")
class Chat:
"""
Wrapper for telegram chats, passed to most callbacks
"""
def send_text(self, text, **options):
"""
Send a text message to the chat, for available options see
ht... | Python | 0 |
d88a473030d52529ad0abc626776bbb5d4886067 | Add tests of raw FIPS U2F commands | test/on_yubikey/test_fips_u2f_commands.py | test/on_yubikey/test_fips_u2f_commands.py | import unittest
from fido2.hid import (CTAPHID)
from ykman.util import (TRANSPORT)
from ykman.driver_fido import (FIPS_U2F_CMD)
from .util import (DestructiveYubikeyTestCase, is_fips, open_device)
HID_CMD = 0x03
@unittest.skipIf(not is_fips(), 'FIPS YubiKey required.')
class TestFipsU2fCommands(DestructiveYubikeyT... | Python | 0.000001 | |
9ca93016ffa0f3c876f19fbb9bd5edaee3f86303 | Add AntiGraph as a subclass example. | examples/subclass/antigraph.py | examples/subclass/antigraph.py | """ Complement graph class for small footprint when working on dense graphs.
This class allows you to add the edges that *do not exist* in the dense
graph. However, when applying algorithms to this complement graph data
structure, it behaves as if it were the dense version. So it can be used
directly in several Netw... | Python | 0 | |
7f1f8c53508d7cbaf3513b738dff21e6ea6e5ca1 | add script to generate multiple instance catalogs in different bands | twinkles/InstcatGenerator.py | twinkles/InstcatGenerator.py | """
Based upon examples by Scott Daniel (scottvalscott@gmail.com) found here:
https://stash.lsstcorp.org/projects/SIM/repos/sims_catutils/browse/python/lsst/sims/
catUtils/exampleCatalogDefinitions/phoSimCatalogExamples.py
"""
from lsst.sims.catalogs.measures.instance import CompoundInstanceCatalog
from lsst.s... | Python | 0 | |
1675ecd5ea2d4aaf8d8b6aa76d007d081f92eba6 | add context processor for static | nurseconnect/context_processors.py | nurseconnect/context_processors.py | from django.conf import settings
def compress_settings(request):
return {
'STATIC_URL': settings.STATIC_URL,
'ENV': settings.ENV
}
| Python | 0.000002 | |
a1820a0e5f9bd891b20f70ab68dfd4bb385047a0 | Add utils to allow multiclass classification. | utils/multiclassification.py | utils/multiclassification.py | from __future__ import division
import numpy as np
from sklearn.multiclass import OneVsOneClassifier
from sklearn.multiclass import _fit_binary
from sklearn.externals.joblib import Parallel, delayed
from unbalanced_dataset import SMOTE
def _fit_ovo_binary(estimator, X, y, i, j, sampling=None):
"""Fit a single b... | Python | 0 | |
175554c4af88e4ba634976e893510f04b43442b7 | Add tool for plotting a connection box lookahead delay matrix. | utils/plot_connection_box.py | utils/plot_connection_box.py | import argparse
import capnp
import os.path
import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
import numpy as np
def get_connection_box(cost_map, segment, connection_box):
assert cost_map.costMap.dims[0] == cost_map.offset.dims[0]
assert cost... | Python | 0 | |
83f0e2ae541b6b08b3eb6d5d8097bdfd85ccbd3c | Create ROUSE_simulation.py | ROUSE_simulation.py | ROUSE_simulation.py | import numpy as np
from scipy.linalg import toeplitz
from scipy.optimize import curve_fit
import scipy.linalg as sla
from matplotlib import pyplot as plt
from numba import jit
from sys import argv
from tqdm import tqdm
from numba import guvectorize, float64, jit
def rouse_mat(n):
ret = np.array([[-1,1] + [0] * (n-2... | Python | 0 | |
18d11a06e1e84ece32277e0860229555aae321f0 | Add a snippet (Python). | python/cross-platform_home_directory.py | python/cross-platform_home_directory.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
print(os.path.expanduser("~"))
| Python | 0.000035 | |
c8b78cab7a32a300e418033185595fd79a290823 | add bmf study | qlcoder/image_processing/bmp_python3.py | qlcoder/image_processing/bmp_python3.py | import binascii
fi = open("aaa.bmp", "rb")
header = fi.read(1078)
line = fi.read()
fi.close()
binline = ''
for i in range(0,len(line)):
binline += bin(line[i])[2:].zfill(8)
newbinline = ''
for i in range(len(binline)):
if(i%7 == 0):
newbinline+='0'
newbinline+=binline[i]
newhexline = hex(int(newb... | Python | 0.000001 | |
c9b3bd8309d3d1448823787160021a8688e8f3c1 | Add python to make vv h5 file | vv_h5_setup.py | vv_h5_setup.py | import tables
vv_desc = dict(
obsid=tables.IntCol(pos=0),
revision=tables.IntCol(pos=1),
most_recent=tables.IntCol(pos=2),
slot=tables.IntCol(pos=3),
type=tables.StringCol(10,pos=4),
n_pts=tables.IntCol(pos=5),
rad_off=tables.FloatCol(pos=6),
frac_dy_big=tables.FloatCol(pos=7),
frac_dz_big=tables.FloatCol(pos=8),
frac... | Python | 0.000001 | |
836c7aa92cd9d35e7d54046e835f285410780b84 | Create nodejs.py | wigs/nodejs.py | wigs/nodejs.py | class nodejs(Wig):
git_uri = 'https://github.com/nodejs/node'
tarball_uri = 'https://github.com/nodejs/node/archive/v$RELEASE_VERSION$.tar.gz'
last_release_version = 'v4.7.2'
| Python | 0.000032 | |
1edf0898422c74173a9b6526c789b140938664b5 | add main module | server/__main__.py | server/__main__.py | import server | Python | 0.000001 | |
d48035b06b952b9ac4d95897d08de50d5977bf9f | Add basic test for OrderedDict. | tests/basics/ordereddict1.py | tests/basics/ordereddict1.py | try:
from collections import OrderedDict
except ImportError:
try:
from _collections import OrderedDict
except ImportError:
print("SKIP")
import sys
sys.exit()
d = OrderedDict([(10, 20), ("b", 100), (1, 2)])
print(list(d.keys()))
print(list(d.values()))
del d["b"]
print(list(... | Python | 0 | |
45ccdce362694f50c43828e3923fc9e3fa32c8bb | Add list_callbacks.py | scripts/list_callbacks.py | scripts/list_callbacks.py | #!/usr/bin/env python2
import sys
from parse_header import *
def main(argv):
for type, name, args, attrs in get_callbacks(sys.stdin.read()):
print name
if __name__ == "__main__":
main(sys.argv)
| Python | 0.000003 | |
f075f21b53e13d53fc26e38bcf995d55ea44df67 | Patch bump for pypi | exa/__init__.py | exa/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
Exa
#########
This package creates a systematic infrastructure for an ecosystem of packages,
tailored to specific industry or academic displines, for organizing, processin... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
Exa
#########
This package creates a systematic infrastructure for an ecosystem of packages,
tailored to specific industry or academic displines, for organizing, processin... | Python | 0 |
ec91d5106bfab93e0540e5dc4a0bbd9b7cea151b | add script to update old .h5 files to support normalization | scripts/update_data_h5.py | scripts/update_data_h5.py | # update h5 files created by old versions of pyannote-speaker-embedding
# estimate mu/sigma and save it back to the file
# usage: update_data_h5.py /path/to/file.h5
import sys
import h5py
import numpy as np
from tqdm import tqdm
data_h5 = sys.argv[1]
with h5py.File(data_h5, mode='r') as fp:
X = fp['X']
weigh... | Python | 0 | |
e63eb3f4dd194e98622d614a18a6f7bb21d839c9 | Add generic image service tests. | nova/tests/test_image.py | nova/tests/test_image.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Linux2Go
# Author: Soren Hansen
#
# 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/... | Python | 0 | |
651628a3f9d89a9365b6ba869db72400c3a6a63f | add one file I forgot | simulation_test.py | simulation_test.py | #!/usr/bin/env python
import unittest
import simulation
def state(visitors_per_bucket, baseline_conversions, treatment_conversions):
return simulation.ExperimentState(
baseline_conversions,
visitors_per_bucket - baseline_conversions,
treatment_conversions,
visitors_per_bucket - tr... | Python | 0.000001 | |
50ba17b46c7fcc7eb42a48a5ec82e295fdbeae13 | Add missing migration | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | """Introduce DeployKey entity
Revision ID: 25ecf1c9b3fb
Revises: 1c314d48261a
Create Date: 2014-02-08 02:56:34.174597
"""
# revision identifiers, used by Alembic.
revision = '25ecf1c9b3fb'
down_revision = '1c314d48261a'
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
from kozm... | Python | 0.0002 | |
e9d2730e69228f458b6743515226b3060bf0012a | Create linode2do.py | linode2do.py | linode2do.py | from linode.api import Api
import requests
class APIError(Exception):
pass
class DigitalOceanEndpoint(object):
def __init__(self, client_id, api_key):
self.client_id = client_id
self.api_key = api_key
def credentials(self, params={}):
params.update({
"client_id": self.... | Python | 0.000001 | |
0e833de83903c26fb3ca04c10b140c712350a12f | Create tests.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | import unittest
class ConvertTemperatureTestCase(unittest.TestCase):
def test_fahrenheit_to_celsius(self):
self.assertEqual(convert_temperature(32, to='celsius'), 0)
def test_celsius_to_fahrenheit(self):
self.assertEqual(convert_temperature(40, to='fahrenheit'), 104)
def test_default_par... | Python | 0.000001 | |
6c6d3d365e021918fe88450136a75bbac7a21d5c | add .percol.d | .percol.d/rc.py | .percol.d/rc.py | # Emacs like
percol.import_keymap({
"C-h" : lambda percol: percol.command.delete_backward_char(),
"C-d" : lambda percol: percol.command.delete_forward_char(),
"C-k" : lambda percol: percol.command.kill_end_of_line(),
"C-y" : lambda percol: percol.command.yank(),
"C-t" : lambda percol: percol.command... | Python | 0.000005 | |
d7595d6d80468ec5f0e4bde86db8a431c4384ad3 | Solve 41. | 041/solution.py | 041/solution.py | # coding: utf-8
""" Project Euler problem #41. """
import math as mt
def problem():
u""" Solve the problem.
We shall say that an n-digit number is pandigital if it makes use of all
the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital
and is also prime.
What is the largest ... | Python | 0.998706 | |
7b381e309f6ea6b4dde3526c455f3f5bf88d6bf3 | Add check_https.py | check_https.py | check_https.py | #!/usr/bin/env python
""" @todo docstring me """
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals
)
import fnmatch
import glob
import io
import json
import re
import os
import sys
import pprint
import requests
from jsoncomment import JsonComment
from jsonschema imp... | Python | 0.000003 | |
b395239526a4246193aa9ce0e541538e5690f408 | Return change | python/reddit/least_bills.py | python/reddit/least_bills.py | def bills_needed(money):
"""Determine optimal numbers of each bill denomination for amount.
Args:
money, int: Amount of money to figure bills for
Returns:
cash, dict: Count of each type of bill needed for sum
"""
denominations = [1, 2, 5, 10, 20, 50, 100]
cash = {}
balance =... | Python | 0.000015 | |
9bcb2566afa8191e24fb4f66b3fb882724ba4083 | Test ragged getitem | thinc/tests/test_indexing.py | thinc/tests/test_indexing.py | import pytest
import numpy
from numpy.testing import assert_allclose
from thinc.types import Ragged
@pytest.fixture
def ragged():
data = numpy.zeros((20, 4), dtype="f")
lengths = numpy.array([4, 2, 8, 1, 4], dtype="i")
data[0] = 0
data[1] = 1
data[2] = 2
data[3] = 3
data[4] = 4
data[5]... | Python | 0 | |
f433cdb41f33a7b9daeaf276bf19d2617534e781 | Add Tensor Flow | python/src/fft/fourier_nd.py | python/src/fft/fourier_nd.py | import numpy as np
import pylab as plt
import pandas as pd
from numpy import fft
import src.mylib.mfile as mfile
def bandpass_filter(x, freq, frequency_of_signal=0, band=0.1):
if (frequency_of_signal - band) < abs(freq) < (frequency_of_signal + band):
return x
else:
return 0
d1 = mfile.loadClo... | Python | 0.000019 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.