commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
36acb0222c3b5366de148460eb858c84eec4f5a4
play.py
play.py
#! /usr/bin/env python # title :play.py # description :Decides between 2 versions of reversi # author :andresthor # date :07-02-2017 # usage :python play.py # python_version :3.5.2 # ============================================================================= # A veru crud...
Add crude way of selecting game interface/version
Add crude way of selecting game interface/version
Python
mit
andresthor/reversi
--- +++ @@ -0,0 +1,44 @@ +#! /usr/bin/env python +# title :play.py +# description :Decides between 2 versions of reversi +# author :andresthor +# date :07-02-2017 +# usage :python play.py +# python_version :3.5.2 +# =========================================================...
5d42b027d5f438bb66de70c23b8d1631cac4ddd5
array/bubble-sort.py
array/bubble-sort.py
# Bubble sort python implementation def bubble_sort(arr): length = len(arr) for i in range(length): for j in range(0, length-i-1): if arr[j] > arr[j+1]: temp = arr[j] arr[j] = arr[j+1] arr[j] = temp return arr
Add bubble sort method in python
Add bubble sort method in python
Python
mit
derekmpham/interview-prep,derekmpham/interview-prep
--- +++ @@ -0,0 +1,14 @@ +# Bubble sort python implementation + +def bubble_sort(arr): + length = len(arr) + + for i in range(length): + + for j in range(0, length-i-1): + if arr[j] > arr[j+1]: + temp = arr[j] + arr[j] = arr[j+1] + arr[j] = temp + + return arr
139936eb92ea295cae620011c93bb4a1e41a32f3
wsgi.py
wsgi.py
# Copyright (c) 2014 Matthias Klumpp <mak@debian.org> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, me...
Add simple uWSGI helper script
Add simple uWSGI helper script
Python
mit
opencollab/debile-web,opencollab/debile-web,opencollab/debile-web
--- +++ @@ -0,0 +1,28 @@ +# Copyright (c) 2014 Matthias Klumpp <mak@debian.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# th...
89f00372e1cf86c3ee48d292982cfca376010780
scripts/jenkins_plugins.py
scripts/jenkins_plugins.py
#!/usr/bin/env python3 """Fetch and format currently installed Jenkins plugins as puppet configuration. """ import json import sys from argparse import ArgumentParser from base64 import b64encode from datetime import datetime from urllib.request import Request, urlopen resource_template = """ ::jenkins::plugin {{ '...
Use current Jenkins plugin API to generate puppet class for plugins.
Use current Jenkins plugin API to generate puppet class for plugins. This script can connect to a live jenkins instance and fetch plugin data, then output a puppet class with the plugin versions and dependencies specified. This does not handle the job of configuring any plugins, that still needs to be done manually. ...
Python
apache-2.0
clearpathrobotics/buildfarm_deployment,clearpathrobotics/buildfarm_deployment,ros-infrastructure/buildfarm_deployment,clearpathrobotics/buildfarm_deployment,ros-infrastructure/buildfarm_deployment,ros-infrastructure/buildfarm_deployment,ros-infrastructure/buildfarm_deployment
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +"""Fetch and format currently installed Jenkins plugins as puppet configuration. +""" + +import json +import sys + +from argparse import ArgumentParser +from base64 import b64encode +from datetime import datetime +from urllib.request import Request, urlopen + +resourc...
8591c4eac8f90612143fe64db9a36d18f08819ad
contrib/performance/event_move.py
contrib/performance/event_move.py
from itertools import count, cycle from urllib2 import HTTPDigestAuthHandler from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, returnValue from twisted.web.client import Agent from twisted.web.http_headers import Headers from httpauth import AuthHandlerAgent from httpclient imp...
Add a benchmark for moving events between calendars
Add a benchmark for moving events between calendars git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@6294 e27351fd-9f3e-4f54-a53b-843176b1656c
Python
apache-2.0
trevor/calendarserver,trevor/calendarserver,trevor/calendarserver
--- +++ @@ -0,0 +1,59 @@ + +from itertools import count, cycle +from urllib2 import HTTPDigestAuthHandler + +from twisted.internet import reactor +from twisted.internet.defer import inlineCallbacks, returnValue +from twisted.web.client import Agent +from twisted.web.http_headers import Headers + +from httpauth import...
24e21dd5e11844e333278ba580da3814ad513c1a
src/excel_sheet_column_number.py
src/excel_sheet_column_number.py
""" Source : https://oj.leetcode.com/problems/excel-sheet-column-number/ Author : Changxi Wu Date : 2015-01-21 Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 """ def titl...
Add solution for excel sheet column number
Add solution for excel sheet column number
Python
mit
chancyWu/leetcode
--- +++ @@ -0,0 +1,42 @@ +""" +Source : https://oj.leetcode.com/problems/excel-sheet-column-number/ +Author : Changxi Wu +Date : 2015-01-21 + +Given a column title as appear in an Excel sheet, return its corresponding column number. + +For example: + A -> 1 + B -> 2 + C -> 3 + ... + Z -> 26 + ...
b91efc73046fe1df8e7678e50464daf6a36ddab1
char_map.py
char_map.py
char_map = { 'a': 3, 'b': 6, 'c': 9, 'd': 12, 'e': 15, 'f': 18, 'g': 21, 'h': 24, 'i': 27, 'j': 30, 'k': 33, 'l': 36, 'm': 39, 'n': 42, 'o': 45, 'p': 48, 'q': 51, 'r': 54, 's': 57, 't': 60, 'u': 63, 'v': 66, 'w': 69, 'x': 72...
Create mapping of characters to percentage values
Create mapping of characters to percentage values
Python
mit
eddiezane/hackpack-cloudbit,eddiezane/hackpack-cloudbit
--- +++ @@ -0,0 +1,34 @@ +char_map = { + 'a': 3, + 'b': 6, + 'c': 9, + 'd': 12, + 'e': 15, + 'f': 18, + 'g': 21, + 'h': 24, + 'i': 27, + 'j': 30, + 'k': 33, + 'l': 36, + 'm': 39, + 'n': 42, + 'o': 45, + 'p': 48, + 'q': 51, + 'r': 54, + 's': 57, + 't': 60, + ...
e291a2e117444c431d7912beaaa359b695f7ec1f
src/rosrepo/__main__.py
src/rosrepo/__main__.py
# coding=utf-8 # # ROSREPO # Manage ROS workspaces with multiple Gitlab repositories # # Author: Timo Röhling # # Copyright 2016 Fraunhofer FKIE # # 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 a...
Make module executable with `python -m rosrepo`
Make module executable with `python -m rosrepo`
Python
apache-2.0
fkie/rosrepo,fkie/rosrepo
--- +++ @@ -0,0 +1,25 @@ +# coding=utf-8 +# +# ROSREPO +# Manage ROS workspaces with multiple Gitlab repositories +# +# Author: Timo Röhling +# +# Copyright 2016 Fraunhofer FKIE +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +#...
8faf9798d2e9a2b60b70c327ddfe916a49658816
src/Route.py
src/Route.py
from .station_map import station_map class Route: def __init__(self, trip_attrs, legs): self.origin = trip_attrs['origin'] self.destination = trip_attrs['destination'] self.fare = trip_attrs['fare'] self.departs = trip_attrs['origTimeMin'] self.arrives = trip_attrs['destTi...
Add class for handling routes
Add class for handling routes
Python
mit
ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart,ganemone/SublimeBart
--- +++ @@ -0,0 +1,41 @@ +from .station_map import station_map + + +class Route: + + def __init__(self, trip_attrs, legs): + self.origin = trip_attrs['origin'] + self.destination = trip_attrs['destination'] + self.fare = trip_attrs['fare'] + self.departs = trip_attrs['origTimeMin'] + ...
89349fbf73b3377c73bcd5c6c44e24c3a4f62809
show_usbcamera_undistort.py
show_usbcamera_undistort.py
#! /usr/bin/env python # -*- coding:utf-8 -*- # # Show the images from a USB camera # # External dependencies import pickle import cv2 # Load calibration file with open( 'calibration.pkl', 'rb' ) as calibration_file : calibration = pickle.load( calibration_file ) # Get the camera camera = cv2.VideoCapture( 0 ) #...
Add a script to show undistorted images from the USB camera.
Add a script to show undistorted images from the USB camera.
Python
mit
microy/RobotVision,microy/RobotVision
--- +++ @@ -0,0 +1,34 @@ +#! /usr/bin/env python +# -*- coding:utf-8 -*- + +# +# Show the images from a USB camera +# + +# External dependencies +import pickle +import cv2 + +# Load calibration file +with open( 'calibration.pkl', 'rb' ) as calibration_file : + calibration = pickle.load( calibration_file ) +# Get t...
eb7dc7690ecd9f6fad5928057b1ec078a799dda4
icekit_events/migrations/0025_auto_20170519_1327.py
icekit_events/migrations/0025_auto_20170519_1327.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icekit_events', '0024_auto_20170320_1824'), ] operations = [ migrations.AddField( model_name='eventbase', ...
Update DB migrations following upstream change in ICEkit
Update DB migrations following upstream change in ICEkit The `WorkflowStateMixin` model in django-icekit -- which is used as a basis for the `EventBase` model -- was updated with two new fields: `brief`, and `admin_notes`. This change updates the model in this project to comply with the upstream changes. And will ho...
Python
mit
ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/django-icekit
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('icekit_events', '0024_auto_20170320_1824'), + ] + + operations = [ + migrations.AddField( +...
19280f953b3eac8231466b4cceae7160737ae0e1
tests/test_text.py
tests/test_text.py
"""Unit tests for straight text output.""" import unittest import utils class TestText(utils.TestCase): def test_short_string(self): self.assertEqual(self.render('{% template %}short'), 'short') self.assertEqual(self.render('{% template %}short\n2'), 'short\n2') self.assertEqual(self.rend...
Add unit tests for straight text output
Add unit tests for straight text output
Python
bsd-3-clause
benhoyt/symplate
--- +++ @@ -0,0 +1,29 @@ +"""Unit tests for straight text output.""" + +import unittest + +import utils + +class TestText(utils.TestCase): + def test_short_string(self): + self.assertEqual(self.render('{% template %}short'), 'short') + self.assertEqual(self.render('{% template %}short\n2'), 'short\n2...
1f142cf73a14e50e11f26d6be2b8ac101504f1b9
tests/test_extended_functionality.py
tests/test_extended_functionality.py
"""Tests for non-core functionality in sandman2.""" from pytest_flask.fixtures import client exclude_tables = ('Invoice') def test_pagination(client): """Do we return paginated results when a 'page' parameter is provided?""" response = client.get('/artist?page=2') assert response.status_code == 200 a...
Clean up tests; add tests for user-defined models and pagination
Clean up tests; add tests for user-defined models and pagination
Python
apache-2.0
jeffknupp/sandman2,jeffknupp/sandman2,jeffknupp/sandman2
--- +++ @@ -0,0 +1,12 @@ +"""Tests for non-core functionality in sandman2.""" + +from pytest_flask.fixtures import client + +exclude_tables = ('Invoice') + +def test_pagination(client): + """Do we return paginated results when a 'page' parameter is provided?""" + response = client.get('/artist?page=2') + ass...
361f62bbdbcf475a65c3e6e6b04b4c896c58b9bf
traffic-monitor.py
traffic-monitor.py
#!/usr/bin/env python3 import json import requests # Configuration # To create an authentication key, see # https://msdn.microsoft.com/en-ca/library/ff701720.aspx bing_maps_auth_key = "" # Coordinates of the bounding box where traffic incidents are to be monitored # See https://msdn.microsoft.com/en-us/library/ff70...
Add script with basic traffic data retrieval
Add script with basic traffic data retrieval
Python
mit
jleung51/scripts,jleung51/scripts,jleung51/scripts
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import json +import requests + +# Configuration + +# To create an authentication key, see +# https://msdn.microsoft.com/en-ca/library/ff701720.aspx +bing_maps_auth_key = "" + +# Coordinates of the bounding box where traffic incidents are to be monitored +# See https...
a7b9860538c50e58a06f751b5f9eecde575fae2a
example/quickstart/show_time_2.py
example/quickstart/show_time_2.py
#!/usr/bin/env python import asyncio import datetime import random import websockets CONNECTIONS = set() async def register(websocket): CONNECTIONS.add(websocket) try: await websocket.wait_closed() finally: CONNECTIONS.remove(websocket) async def show_time(): while True: mess...
Add file forgotten in 731ad8c.
Add file forgotten in 731ad8c.
Python
bsd-3-clause
aaugustin/websockets,aaugustin/websockets,aaugustin/websockets,aaugustin/websockets
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import asyncio +import datetime +import random +import websockets + +CONNECTIONS = set() + +async def register(websocket): + CONNECTIONS.add(websocket) + try: + await websocket.wait_closed() + finally: + CONNECTIONS.remove(websocket) + +async d...
0d31f071b5a5ba76f484ffa49e32f34381b44281
examples/continuous_recordings.py
examples/continuous_recordings.py
#!/usr/bin/env python3 # One common issue is that Saleae records traces into memory, which means that # it can't handle very long captures. This example shows how to use scripting to # do long recordings over time. There will be brief gaps every time Saleae saves # the old recording and starts a new one. import os im...
Add example for repeated / continuous recordings
Add example for repeated / continuous recordings
Python
apache-2.0
ppannuto/python-saleae
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# One common issue is that Saleae records traces into memory, which means that +# it can't handle very long captures. This example shows how to use scripting to +# do long recordings over time. There will be brief gaps every time Saleae saves +# the old recording an...
0c91b4302ca4019ab1ea7c023b592c177dddc4fe
stdnum/fi/veronumero.py
stdnum/fi/veronumero.py
# veronumero.py - functions for handling Finnish individual tax numbers # coding: utf-8 # # Copyright (C) 2017 Holvi Payment Services Oy # Copyright (C) 2017 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publish...
Implement Finnish individual tax number validation
Implement Finnish individual tax number validation
Python
lgpl-2.1
arthurdejong/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,holvi/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum
--- +++ @@ -0,0 +1,74 @@ +# veronumero.py - functions for handling Finnish individual tax numbers +# coding: utf-8 +# +# Copyright (C) 2017 Holvi Payment Services Oy +# Copyright (C) 2017 Arthur de Jong +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser ...
58a60d2380bd0a9768b1ca4eaee713c31ea8790e
tests/test_base.py
tests/test_base.py
import pytest from celery.schedules import crontab from scrapi import _Registry from scrapi.base import BaseHarvester from scrapi.base import HarvesterMeta @pytest.fixture def mock_registry(monkeypatch): registry = _Registry() monkeypatch.setattr('scrapi.base.registry', registry) return registry @pyte...
Add some tests for base.py
Add some tests for base.py
Python
apache-2.0
fabianvf/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,mehanig/scrapi,erinspace/scrapi,alexgarciac/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,mehanig/scrapi,icereval/scrapi,felliott/scrapi,fabianvf/scrapi
--- +++ @@ -0,0 +1,81 @@ +import pytest + +from celery.schedules import crontab + +from scrapi import _Registry +from scrapi.base import BaseHarvester +from scrapi.base import HarvesterMeta + + +@pytest.fixture +def mock_registry(monkeypatch): + registry = _Registry() + monkeypatch.setattr('scrapi.base.registry...
d2be813ae6e2549ad36d823e9abdcb4dc5d21d0e
tests/test_this.py
tests/test_this.py
"""tests/test_this.py. Tests the Zen of Hug Copyright (C) 2019 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights...
Add test for this module
Add test for this module
Python
mit
timothycrosley/hug,timothycrosley/hug,timothycrosley/hug
--- +++ @@ -0,0 +1,27 @@ +"""tests/test_this.py. + +Tests the Zen of Hug + +Copyright (C) 2019 Timothy Edmund Crosley + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, incl...
1ce9502f212a49b13289570bb182d65c3ffcfafe
tests/acceptance/test_commits.py
tests/acceptance/test_commits.py
#!/usr/bin/python # Copyright 2016 Mender Software AS # # 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 ...
Add checking of commits using mendertesting.
Add checking of commits using mendertesting. Changelog: None Signed-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@mender.io>
Python
apache-2.0
bboozzoo/meta-mender,bboozzoo/meta-mender,bboozzoo/meta-mender,bboozzoo/meta-mender
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/python +# Copyright 2016 Mender Software AS +# +# 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/LIC...
6c431129e64380754296b646e5e063521980b8da
test/_common.py
test/_common.py
# encoding: utf-8 ''' .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> ''' from __future__ import absolute_import, print_function, unicode_literals def print_result(expected, actual): print("[expected]\n{}\n".format(expected)) print("[actual]\n{}\n".format(actual))
Add a test helper function
Add a test helper function
Python
mit
thombashi/pytablewriter
--- +++ @@ -0,0 +1,12 @@ +# encoding: utf-8 + +''' +.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> +''' + +from __future__ import absolute_import, print_function, unicode_literals + + +def print_result(expected, actual): + print("[expected]\n{}\n".format(expected)) + print("[actual]\n{}\n".form...
488e471bc361d3754ecf4ee6072365f4f67dea2e
backend/initialize_database.py
backend/initialize_database.py
import json import os import django import logging os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') django.setup() from unichat.models import Country, City, University, School level = logging.DEBUG logger = logging.getLogger(__name__) logger.setLevel(level) logging.basicConfig(format='%(message)s'...
Add script to initialize db with schools, unis etc
Add script to initialize db with schools, unis etc
Python
mit
dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet
--- +++ @@ -0,0 +1,43 @@ +import json +import os +import django +import logging + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') +django.setup() + +from unichat.models import Country, City, University, School + +level = logging.DEBUG +logger = logging.getLogger(__name__) +logger.setLevel(level) ...
36a9950e81cfa273a6782cc0377f9dfd510291d8
test_polycomp_low_level.py
test_polycomp_low_level.py
import numpy as np import pypolycomp def test_polycomp(): inv_cheby = pypolycomp.Chebyshev(samples.size, pypolycomp.PCOMP_TD_INVERSE) for alg in (pypolycomp.PCOMP_ALG_USE_CHEBYSHEV, pypolycomp.PCOMP_ALG_NO_CHEBYSHEV): max_error = 0.1 samples = np.array([1.0, 2.0, 3.0, 4.1])...
Add tests for PolycompChunk class
Add tests for PolycompChunk class
Python
bsd-3-clause
ziotom78/polycomp
--- +++ @@ -0,0 +1,16 @@ +import numpy as np +import pypolycomp + +def test_polycomp(): + inv_cheby = pypolycomp.Chebyshev(samples.size, pypolycomp.PCOMP_TD_INVERSE) + + for alg in (pypolycomp.PCOMP_ALG_USE_CHEBYSHEV, + pypolycomp.PCOMP_ALG_NO_CHEBYSHEV): + max_error = 0.1 + sam...
cb166b81a243cb1251ab9185f92b8a4734e4db55
euler012.py
euler012.py
#!/usr/bin/python from math import sqrt """ Our limit """ LIMIT = 500 """ We start from 6 """ test = 1 + 2 + 3 """ Next to add """ add = 4 div_count = 0 while div_count < LIMIT: div_count = 1 test += add add += 1 tmp = test for i in range(2, int(sqrt(test))): factor_count = 0 while...
Add solution for problem 12, really slow, need to be optimize
Add solution for problem 12, really slow, need to be optimize
Python
mit
cifvts/PyEuler
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/python + +from math import sqrt + +""" Our limit """ +LIMIT = 500 +""" We start from 6 """ +test = 1 + 2 + 3 +""" Next to add """ +add = 4 +div_count = 0 +while div_count < LIMIT: + div_count = 1 + test += add + add += 1 + tmp = test + for i in range(2, int(sqrt(tes...
25b3ad79bda44fda8b110ef183049e08765dfb18
euler017.py
euler017.py
#!/usr/bin/python values = {} values[1] = "one" values[2] = "two" values[3] = "three" values[4] = "four" values[5] = "five" values[6] = "six" values[7] = "seven" values[8] = "eight" values[9] = "nine" values[10] = "ten" values[11] = "eleven" values[12] = "twelve" values[13] = "thirteen" values[14] = "fourteen" values[...
Add solution for problem 17
Add solution for problem 17
Python
mit
cifvts/PyEuler
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/python + +values = {} +values[1] = "one" +values[2] = "two" +values[3] = "three" +values[4] = "four" +values[5] = "five" +values[6] = "six" +values[7] = "seven" +values[8] = "eight" +values[9] = "nine" +values[10] = "ten" +values[11] = "eleven" +values[12] = "twelve" +values[13] =...
10be73daab13815662871898ccfc8201e43ea3db
testifi/pypi.py
testifi/pypi.py
# -*- coding: utf-8 -*- """ testifi.pypi ~~~~~~~~~~~~ This module contains the portions of testifi code that know how to handle interacting with PyPI. """ import treq from twisted.internet.defer import inlineCallbacks, returnValue @inlineCallbacks def certifiVersions(): """ This function determines what cer...
Add basic PyPI reading logic
Add basic PyPI reading logic
Python
mit
Lukasa/testifi
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +""" +testifi.pypi +~~~~~~~~~~~~ + +This module contains the portions of testifi code that know how to handle +interacting with PyPI. +""" +import treq + +from twisted.internet.defer import inlineCallbacks, returnValue + + +@inlineCallbacks +def certifiVersions(): + ...
a160b70ced5cf5d7debcdc8cf73a94a79de275b1
tests/basics/frozenset_set.py
tests/basics/frozenset_set.py
try: frozenset except NameError: print("SKIP") import sys sys.exit() # Examples from https://docs.python.org/3/library/stdtypes.html#set # "Instances of set are compared to instances of frozenset based on their # members. For example:" print(set('abc') == frozenset('abc')) # This doesn't work in uPy #p...
Add test on set/frozenset equality.
tests: Add test on set/frozenset equality.
Python
mit
dmazzella/micropython,feilongfl/micropython,adafruit/micropython,ernesto-g/micropython,vriera/micropython,toolmacher/micropython,ahotam/micropython,ahotam/micropython,skybird6672/micropython,blazewicz/micropython,noahchense/micropython,dxxb/micropython,blazewicz/micropython,ernesto-g/micropython,lowRISC/micropython,drr...
--- +++ @@ -0,0 +1,13 @@ +try: + frozenset +except NameError: + print("SKIP") + import sys + sys.exit() + +# Examples from https://docs.python.org/3/library/stdtypes.html#set +# "Instances of set are compared to instances of frozenset based on their +# members. For example:" +print(set('abc') == frozenset...
f2474508e799a4cd37533baa9ce2acae7af1ee89
tests/HashContainerSimpleTest.py
tests/HashContainerSimpleTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import TestCase, main from grammpy.HashContainer import HashContainer class HashContainerSimpleTest(TestCase): def test_emptyCreation(self): h = HashContainer() self.asser...
Add few tests of HashContainer
Add few tests of HashContainer
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import TestCase, main +from grammpy.HashContainer import HashContainer + + +class HashContainerSimpleTest(TestCase): + def test_emptyCreation(self): + ...
67e2e29fb23e53c73655fe8df9779f7e8cc69796
alerts/proxy_drop_exfil_domains.py
alerts/proxy_drop_exfil_domains.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/. # Copyright (c) 2014 Mozilla Corporation from lib.alerttask import AlertTask from mozdef_util.qu...
Create an alert on attempts to use known exfil domains
Create an alert on attempts to use known exfil domains For example, pastebin.com
Python
mpl-2.0
mpurzynski/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,gdestuynder/MozDef,mozilla/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,jeffbryner/MozDe...
--- +++ @@ -0,0 +1,60 @@ +#!/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/. +# Copyright (c) 2014 Mozilla Corporation + + +from lib.alerttask ...
ac3e2cff6850b46d6daa38f90af276d23214c772
st2tests/st2tests/base_test_classes.py
st2tests/st2tests/base_test_classes.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add CRUD model db test cases for RBAC models.
Add CRUD model db test cases for RBAC models.
Python
apache-2.0
nzlosh/st2,nzlosh/st2,tonybaloney/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,tonybaloney/st2,StackStorm/st2,nzlosh/st2,tonybaloney/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2
--- +++ @@ -0,0 +1,30 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
254ef4c3a433bebd8a668f5516d2f2ac707e2943
isUnique.py
isUnique.py
def verifyUnique(string): if len(string) > 128: return False characterHash = [0] * 128 for character in string: hashKey = ord(character)%128 if(characterHash[hashKey] > 0): return False else: characterHash[hashKey] = characterHash[hashKey]+1 return...
Verify the given string has unique characters
Verify the given string has unique characters
Python
mit
arunkumarpalaniappan/algorithm_tryouts
--- +++ @@ -0,0 +1,15 @@ +def verifyUnique(string): + if len(string) > 128: + return False + characterHash = [0] * 128 + for character in string: + hashKey = ord(character)%128 + if(characterHash[hashKey] > 0): + return False + else: + characterHash[hashKey] ...
e151a51cc1ed634f282f69a869af6ac9f85df780
api/user_service.py
api/user_service.py
import werkzeug.security as ws from flask import Flask, request, jsonify, abort app = Flask(__name__) app.debug = True LOGIN_DIFFICULTY = '0400' SERVER_SECRET = 'SoSecret!' @app.route('/salt') def challenge(): uuid = request.args.get('uuid', '') salt = ws.hashlib.sha256(SERVER_SECRET + uuid).hexdigest() pow_cha...
import os import werkzeug.security as ws from flask import Flask, request, jsonify, abort, json app = Flask(__name__) app.debug = True LOGIN_DIFFICULTY = '0400' SERVER_SECRET = 'SoSecret!' data_dir_root = os.environ.get('DATADIR') @app.route('/salt') def challenge(): uuid = request.args.get('uuid', '') if exists...
Add wallet serialization to disk
Add wallet serialization to disk
Python
agpl-3.0
FuzzyBearBTC/omniwallet,OmniLayer/omniwallet,habibmasuro/omniwallet,VukDukic/omniwallet,VukDukic/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,achamely/omniwallet,FuzzyBearBTC/omniwallet,Nevtep/omniwallet,habibmasuro/omniwallet,dexX7/omniwallet,Nevtep/omniwallet,ripper234/omniwallet,ripper234/o...
--- +++ @@ -1,14 +1,20 @@ +import os import werkzeug.security as ws -from flask import Flask, request, jsonify, abort +from flask import Flask, request, jsonify, abort, json app = Flask(__name__) app.debug = True LOGIN_DIFFICULTY = '0400' SERVER_SECRET = 'SoSecret!' +data_dir_root = os.environ.get('DATADIR') ...
71bd24dd15295ade1b511a5dbff7d7a150ef2084
problems/problem_36.py
problems/problem_36.py
# Double-base palindromes def decimal_to_binary(n): binary = [] while n > 0: binary.append(n % 2) n /= 2 output = [] while len(binary) != 0: output.append(str(binary.pop())) return "".join(output) def is_palindrome(product): product = str(product) reverse = prod...
Add solution for problem 36
Add solution for problem 36 - Added solution for problem 36 (double-base palindromes)
Python
mit
edmondkotowski/project-euler
--- +++ @@ -0,0 +1,27 @@ +# Double-base palindromes + + +def decimal_to_binary(n): + binary = [] + while n > 0: + binary.append(n % 2) + n /= 2 + + output = [] + while len(binary) != 0: + output.append(str(binary.pop())) + + return "".join(output) + + +def is_palindrome(product): +...
ebfbe65c08ed8ee5d44c4c39f83f5e08bba8a1a7
tests/test_misc.py
tests/test_misc.py
from flask.ext.resty import Api, GenericModelView from marshmallow import fields, Schema import pytest from sqlalchemy import Column, Integer import helpers # ----------------------------------------------------------------------------- @pytest.yield_fixture def models(db): class Widget(db.Model): __tab...
Add miscellaneous tests for remaining code
Add miscellaneous tests for remaining code
Python
mit
taion/flask-jsonapiview,4Catalyzer/flask-resty,4Catalyzer/flask-jsonapiview
--- +++ @@ -0,0 +1,126 @@ +from flask.ext.resty import Api, GenericModelView +from marshmallow import fields, Schema +import pytest +from sqlalchemy import Column, Integer + +import helpers + +# ----------------------------------------------------------------------------- + + +@pytest.yield_fixture +def models(db): +...
40711777de24d30cfe771f172b221cfdf460d8eb
rng.py
rng.py
from random import randint def get_random_number(start=1, end=10): """Generates and returns random number between :start: and :end:""" return randint(start, end)
def get_random_number(start=1, end=10): """https://xkcd.com/221/""" return 4
Revert "Fix python random number generator."
Revert "Fix python random number generator."
Python
mit
1yvT0s/illacceptanything,dushmis/illacceptanything,dushmis/illacceptanything,ultranaut/illacceptanything,caioproiete/illacceptanything,triggerNZ/illacceptanything,dushmis/illacceptanything,oneminot/illacceptanything,TheWhiteLlama/illacceptanything,ds84182/illacceptanything,caioproiete/illacceptanything,paladique/illacc...
--- +++ @@ -1,5 +1,3 @@ -from random import randint - def get_random_number(start=1, end=10): - """Generates and returns random number between :start: and :end:""" - return randint(start, end) + """https://xkcd.com/221/""" + return 4
191b6cb9b772efb9c03eff36f7295c59c6dcd026
web/examples/extendcube.py
web/examples/extendcube.py
import argparse import empaths import dbconfig import dbconfighayworth5nm import numpy as np import urllib, urllib2 import cStringIO import sys import anncube import anndb import zindex def main(): parser = argparse.ArgumentParser(description='Cutout a portion of the database.') parser.add_argument('id', action=...
Move to home. Not sure that this builds.
Move to home. Not sure that this builds.
Python
apache-2.0
openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,neurodata/ndstore,openconnectome/open-connectome,openconnectome/open-connectome,openconnectome/open-connectome,neurodata/ndstore
--- +++ @@ -0,0 +1,69 @@ +import argparse +import empaths +import dbconfig +import dbconfighayworth5nm +import numpy as np +import urllib, urllib2 +import cStringIO +import sys + +import anncube +import anndb +import zindex + +def main(): + + parser = argparse.ArgumentParser(description='Cutout a portion of the data...
13c5b37377d0d937a9675d71f66865548ab1089e
sk_nb.py
sk_nb.py
import numpy as np import feature_extractor as fe from sklearn.naive_bayes import MultinomialNB # X = np.random.randint(5, size=(6, 100)) # y = np.array([1, 2, 3, 4, 5, 6]) (features, targets) = fe.extract_train() (features_test, targets_test) = fe.extract_test() # print X.shape # print y.shape # print features.shap...
Implement first version of NB classifier
Implement first version of NB classifier
Python
mit
trein/quora-classifier
--- +++ @@ -0,0 +1,22 @@ +import numpy as np +import feature_extractor as fe +from sklearn.naive_bayes import MultinomialNB + +# X = np.random.randint(5, size=(6, 100)) +# y = np.array([1, 2, 3, 4, 5, 6]) + +(features, targets) = fe.extract_train() +(features_test, targets_test) = fe.extract_test() + +# print X.shape...
0e2e6865c1ad7fb0a74ae673c405d1c6b4ef1b36
tasks.py
tasks.py
import os from invoke import task @task def docs(ctx, version=None): targets = ["latest"] if version: targets.append(version) for target in targets: try: os.makedirs("docs/{}".format(target)) except: pass ctx.run("python -m robot.libdoc -f html src/S...
Add an Invoke task for generating documentation.
Add an Invoke task for generating documentation.
Python
apache-2.0
edbrannin/Robotframework-SQLAlchemy-Library
--- +++ @@ -0,0 +1,15 @@ +import os + +from invoke import task + +@task +def docs(ctx, version=None): + targets = ["latest"] + if version: + targets.append(version) + for target in targets: + try: + os.makedirs("docs/{}".format(target)) + except: + pass + ctx...
878d5e9c1ebaa20c9eb07c865293dd500924f321
IPython/frontend.py
IPython/frontend.py
import sys import types class ShimModule(types.ModuleType): def __getattribute__(self, key): exec 'from IPython import %s' % key return eval(key) sys.modules['IPython.frontend'] = ShimModule('frontend')
Add shim module to allow flattening of namespace.
Add shim module to allow flattening of namespace.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,11 @@ +import sys +import types + + +class ShimModule(types.ModuleType): + + def __getattribute__(self, key): + exec 'from IPython import %s' % key + return eval(key) + +sys.modules['IPython.frontend'] = ShimModule('frontend')
aee1d362f52b2f3a2649669468552c2899e43bf8
openmmtools/data/alanine-dipeptide-explicit/generate-pdb.py
openmmtools/data/alanine-dipeptide-explicit/generate-pdb.py
""" Generate PDB file containing periodic box data. """ from simtk import openmm, unit from simtk.openmm import app prmtop_filename = 'alanine-dipeptide.prmtop' crd_filename = 'alanine-dipeptide.crd' pdb_filename = 'alanine-dipeptide.pdb' # Read topology and positions. prmtop = app.AmberPrmtopFile(prmtop_filename) ...
Add script to generate proper alanine-dipeptide explicit solvent PDB file with CRYST record.
Add script to generate proper alanine-dipeptide explicit solvent PDB file with CRYST record.
Python
mit
choderalab/openmmtools,choderalab/openmmtools
--- +++ @@ -0,0 +1,21 @@ +""" +Generate PDB file containing periodic box data. + +""" + +from simtk import openmm, unit +from simtk.openmm import app + +prmtop_filename = 'alanine-dipeptide.prmtop' +crd_filename = 'alanine-dipeptide.crd' +pdb_filename = 'alanine-dipeptide.pdb' + +# Read topology and positions. +prmto...
5d3cf8074bc50e5e269fab047d64db8cc60d16e6
netbox/users/migrations/0009_replicate_permissions.py
netbox/users/migrations/0009_replicate_permissions.py
from django.db import migrations ACTIONS = ['view', 'add', 'change', 'delete'] def replicate_permissions(apps, schema_editor): """ Replicate all Permission assignments as ObjectPermissions. """ Permission = apps.get_model('auth', 'Permission') ObjectPermission = apps.get_model('users', 'ObjectPe...
Add migration for replicating legact permissions to ObjectPermissions
Add migration for replicating legact permissions to ObjectPermissions
Python
apache-2.0
digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox
--- +++ @@ -0,0 +1,41 @@ +from django.db import migrations + + +ACTIONS = ['view', 'add', 'change', 'delete'] + + +def replicate_permissions(apps, schema_editor): + """ + Replicate all Permission assignments as ObjectPermissions. + """ + Permission = apps.get_model('auth', 'Permission') + ObjectPermiss...
255e8d5b32b57a851be9254052bfb9279f80f76c
alerts/ssh_password_auth_violation.py
alerts/ssh_password_auth_violation.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/. # Copyright (c) 2017 Mozilla Corporation from lib.alerttask import AlertTask from query_models im...
Add ssh password auth violation alert
Add ssh password auth violation alert
Python
mpl-2.0
mpurzynski/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mozilla/MozDef,mozilla/MozDef,gdestuynder/MozDef,Phrozyn/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,mozilla/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,jeffbryner/MozDe...
--- +++ @@ -0,0 +1,44 @@ +#!/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/. +# Copyright (c) 2017 Mozilla Corporation + +from lib.alerttask im...
f18ca1330a435765a7b06562522c80723dc24402
admin/update_sparkle_xml.py
admin/update_sparkle_xml.py
#!/usr/bin/env python # Updates a sparkle appcast xml file with a new release from optparse import OptionParser from xml.dom.minidom import parse from datetime import datetime import os parser = OptionParser(r""" %prog --f xmlfile -s "signature" -v X.X.X -l <bytelength>""") parser.add_option("-f", "--file", d...
Add a script to update our sparkle XML files
Add a script to update our sparkle XML files
Python
apache-2.0
zofuthan/zulip-desktop,zofuthan/zulip-desktop,zofuthan/zulip-desktop,zofuthan/zulip-desktop,zofuthan/zulip-desktop,zofuthan/zulip-desktop,zofuthan/zulip-desktop
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +# Updates a sparkle appcast xml file with a new release + +from optparse import OptionParser +from xml.dom.minidom import parse +from datetime import datetime + +import os + +parser = OptionParser(r""" + +%prog --f xmlfile -s "signature" -v X.X.X -l <bytelength>""") ...
3a0ffa04344df4d8e2ec124d4f4115887b1e7da8
virtual_machine.py
virtual_machine.py
class VirtualMachine: def __init__(self, ram_size=256, stack_size=32): self.data = [None]*ram_size self.stack = [None]*stack_size self.stack_size = stack_size self.stack_top = 0 def push(self, value): """Push something onto the stack.""" if self.stack_top+1 > sel...
Add a virtual machine, with a stub for the bytecode
Add a virtual machine, with a stub for the bytecode
Python
bsd-3-clause
darbaga/simple_compiler
--- +++ @@ -0,0 +1,33 @@ +class VirtualMachine: + def __init__(self, ram_size=256, stack_size=32): + self.data = [None]*ram_size + self.stack = [None]*stack_size + self.stack_size = stack_size + self.stack_top = 0 + + def push(self, value): + """Push something onto the stack."...
10b65412f477de18527bdaee5d270fae826a2161
utils/export_pixels_mask.py
utils/export_pixels_mask.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org) # This script is provided under the terms and conditions of the MIT license: # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (th...
Add a script to export pixels masks for mr_filter's -I option.
Add a script to export pixels masks for mr_filter's -I option.
Python
mit
jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/sap-cta-data-pipeline
--- +++ @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org) + +# This script is provided under the terms and conditions of the MIT license: +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and...
1eff1c6b604718414c95099f3833d58a3d2b463c
fireplace/actions.py
fireplace/actions.py
import logging from .entity import Entity class Action: # Lawsuit args = () def __init__(self, target, *args, **kwargs): self.target = target self.times = 1 self._args = args for k, v in zip(self.args, args): setattr(self, k, v) def __repr__(self): args = ["%s=%r" % (k, v) for k, v in zip(self.args, ...
Implement a basic Action class
Implement a basic Action class
Python
agpl-3.0
Meerkov/fireplace,butozerca/fireplace,NightKev/fireplace,Ragowit/fireplace,jleclanche/fireplace,Ragowit/fireplace,amw2104/fireplace,oftc-ftw/fireplace,liujimj/fireplace,smallnamespace/fireplace,beheh/fireplace,smallnamespace/fireplace,amw2104/fireplace,Meerkov/fireplace,liujimj/fireplace,butozerca/fireplace,oftc-ftw/fi...
--- +++ @@ -0,0 +1,33 @@ +import logging +from .entity import Entity + + +class Action: # Lawsuit + args = () + def __init__(self, target, *args, **kwargs): + self.target = target + self.times = 1 + self._args = args + for k, v in zip(self.args, args): + setattr(self, k, v) + + def __repr__(self): + args = ["%...
10204708652f463984c9f21e2b1bdc898049071d
zephyrus/script.py
zephyrus/script.py
import abc import json class Script(list): def __init__(self, filename=None, iterable=None): if iterable is not None: super().__init__(iterable) else: super().__init__() self.filename = filename def save(self, filename=None): if filename is not None: ...
Add module that helps to generate configuration files.
Add module that helps to generate configuration files.
Python
mit
wairton/zephyrus-mas
--- +++ @@ -0,0 +1,73 @@ +import abc +import json + + +class Script(list): + def __init__(self, filename=None, iterable=None): + if iterable is not None: + super().__init__(iterable) + else: + super().__init__() + self.filename = filename + + def save(self, filename=No...
82826f468186b737d63dffb2c79cfeff5a8d47a0
examples/python3-urllib/run.py
examples/python3-urllib/run.py
import sys import ssl import urllib.error import urllib.request host = sys.argv[1] port = sys.argv[2] cafile = sys.argv[3] if len(sys.argv) > 3 else None try: urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile) except urllib.error.URLError as exc: if not isinstance(exc.reason, ssl.SSLError):...
Add a Python3 + urllib example
Add a Python3 + urllib example
Python
mit
ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls,ouspg/trytls
--- +++ @@ -0,0 +1,17 @@ +import sys +import ssl +import urllib.error +import urllib.request + +host = sys.argv[1] +port = sys.argv[2] +cafile = sys.argv[3] if len(sys.argv) > 3 else None + +try: + urllib.request.urlopen("https://" + host + ":" + port, cafile=cafile) +except urllib.error.URLError as exc: + if n...
52fcf23a15cda393dabde53f513687ec92d03598
src/stratuslab/FileAppender.py
src/stratuslab/FileAppender.py
import os import shutil class FileAppender(object): def __init__(self, filename): self.filename = filename self.lines = [] self.newLines = [] self.foundExit = False def insertAtTheEnd(self, newLine): ''' Append at the end of the file (e.g. rc.local) the newLine...
Append intelligently at the end of a file
Append intelligently at the end of a file
Python
apache-2.0
StratusLab/client,StratusLab/client,StratusLab/client,StratusLab/client
--- +++ @@ -0,0 +1,66 @@ +import os +import shutil + +class FileAppender(object): + + def __init__(self, filename): + self.filename = filename + self.lines = [] + self.newLines = [] + self.foundExit = False + + def insertAtTheEnd(self, newLine): + ''' Append at the end...
8d35dad5fc63de919936d0407d105c36c87a1b14
tests/test_no_extra_queries.py
tests/test_no_extra_queries.py
from nose.tools import assert_false from mock import Mock, PropertyMock, patch from .models import Photo def test_dont_access_source(): """ Touching the source may trigger an unneeded query. See <https://github.com/matthewwithanm/django-imagekit/issues/295> """ pmock = PropertyMock() pmock.__...
Add test to illustrate GH-295
Add test to illustrate GH-295
Python
bsd-3-clause
FundedByMe/django-imagekit,tawanda/django-imagekit,tawanda/django-imagekit,FundedByMe/django-imagekit
--- +++ @@ -0,0 +1,16 @@ +from nose.tools import assert_false +from mock import Mock, PropertyMock, patch +from .models import Photo + + +def test_dont_access_source(): + """ + Touching the source may trigger an unneeded query. + See <https://github.com/matthewwithanm/django-imagekit/issues/295> + + """ +...
24e9f6f1f9f7d6c48715a5e57c0dbc0b0271b8e0
perftest.py
perftest.py
""" Simple peformance tests. """ import sys import time import couchdb def main(): print 'sys.version : %r' % (sys.version,) print 'sys.platform : %r' % (sys.platform,) tests = [create_doc, create_bulk_docs] if len(sys.argv) > 1: tests = [test for test in tests if test.__name__ in sys.argv...
Add a very simple performance testing tool.
Add a very simple performance testing tool.
Python
bsd-3-clause
ssaavedra/couchdb-python,hdmessaging/couchbase-mapping-python,oliora/couchdb-python
--- +++ @@ -0,0 +1,59 @@ +""" +Simple peformance tests. +""" + +import sys +import time + +import couchdb + + +def main(): + + print 'sys.version : %r' % (sys.version,) + print 'sys.platform : %r' % (sys.platform,) + + tests = [create_doc, create_bulk_docs] + if len(sys.argv) > 1: + tests = [test f...
a0173b248c7fe54534e0caed048e5f8f408d7ca1
rejected/data.py
rejected/data.py
""" Rejected data objects """ import copy class DataObject(object): """A class that will return a plain text representation of all of the attributes assigned to the object. """ def __repr__(self): """Return a string representation of the object and all of its attributes. :rt...
Move these classes into their own file
Move these classes into their own file
Python
bsd-3-clause
gmr/rejected,gmr/rejected
--- +++ @@ -0,0 +1,84 @@ +""" +Rejected data objects + +""" +import copy + + +class DataObject(object): + """A class that will return a plain text representation of all of the + attributes assigned to the object. + + """ + def __repr__(self): + """Return a string representation of the object and al...
127cf9f067ebb622d41a24fa70010cb46b111126
molly/batch_processing/migrations/0002_auto__add_field_batch_last_run_failed.py
molly/batch_processing/migrations/0002_auto__add_field_batch_last_run_failed.py
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Batch.last_run_failed' db.add_column('batch_processing_batch', 'last_run_failed', self.gf(...
Add migration for last commit
Add migration for last commit
Python
apache-2.0
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
--- +++ @@ -0,0 +1,40 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'Batch.last_run_failed' + db.add_column('batch_process...
446cb8846a221d055f7a3b121a200c0c2b5f34ba
test/example_controller_switchinghub_gevent.py
test/example_controller_switchinghub_gevent.py
import logging import twink import twink.ovs import twink.gevent import twink.ext import twink.ofp4 as ofp4 import twink.ofp4.parse as ofp4parse import twink.ofp4.build as b import twink.ofp4.oxm as oxm class TestChannel(twink.ovs.OvsChannel, twink.ext.PortMonitorChannel, twink.JackinChannel, twink.gevent.Parall...
Add gevent version of switching hub example
Add gevent version of switching hub example
Python
apache-2.0
hkwi/twink,yeardancing/twink
--- +++ @@ -0,0 +1,49 @@ +import logging +import twink +import twink.ovs +import twink.gevent +import twink.ext +import twink.ofp4 as ofp4 +import twink.ofp4.parse as ofp4parse +import twink.ofp4.build as b +import twink.ofp4.oxm as oxm + +class TestChannel(twink.ovs.OvsChannel, + twink.ext.PortMonitorChannel, + tw...
f9a1945a1ea85273074c38de7be2d3cfed3e6551
tests/test_color.py
tests/test_color.py
# import pytest import re from sdsc import printcolor @pytest.mark.parametrize("msg", ("hello",) ) @pytest.mark.parametrize("msgtype", ("error", "debug", None) ) @pytest.mark.parametrize('isatty', (True, False)) def test_printcolor(capsys, monkeypatch, msg, msgtype, isatty): """Checks p...
Add test case for printcolor() function
Add test case for printcolor() function Also adds isatty fixture and uses monkeypatch to actually test the colored output
Python
lgpl-2.1
sknorr/suse-doc-style-checker,sknorr/suse-doc-style-checker,sknorr/suse-doc-style-checker
--- +++ @@ -0,0 +1,29 @@ +# + +import pytest +import re +from sdsc import printcolor + + +@pytest.mark.parametrize("msg", ("hello",) +) +@pytest.mark.parametrize("msgtype", + ("error", "debug", None) +) +@pytest.mark.parametrize('isatty', (True, False)) +def test_printcolor(capsys, monkeypatc...
130df743b14cf329c09f0c514ec0d6991b21dd45
examples/mnist-deepautoencoder.py
examples/mnist-deepautoencoder.py
#!/usr/bin/env python import matplotlib.pyplot as plt import theanets from utils import load_mnist, plot_layers, plot_images train, valid, _ = load_mnist() e = theanets.Experiment( theanets.Autoencoder, layers=(784, 256, 64, 36, 64, 256, 784), train_batches=100, tied_weights=True, ) e.train(train, ...
#!/usr/bin/env python import matplotlib.pyplot as plt import theanets from utils import load_mnist, plot_layers, plot_images train, valid, _ = load_mnist() e = theanets.Experiment( theanets.Autoencoder, layers=(784, 256, 64, 36, 64, 256, 784), train_batches=100, tied_weights=True, ) e.train(train, ...
Decrease patience for each layerwise trainer.
Decrease patience for each layerwise trainer.
Python
mit
chrinide/theanets,lmjohns3/theanets,devdoer/theanets
--- +++ @@ -14,7 +14,7 @@ train_batches=100, tied_weights=True, ) -e.train(train, valid, optimize='layerwise') +e.train(train, valid, optimize='layerwise', patience=1, min_improvement=0.1) e.train(train, valid) plot_layers([e.network.get_weights(i) for i in (1, 2, 3)], tied_weights=True)
46493648e16ea99f2dbc86175b2fc8b134628b61
tests/test_http_api.py
tests/test_http_api.py
import json import six from twisted.trial import unittest from twisted.internet.defer import inlineCallbacks from twisted.web import server from twisted.internet.defer import succeed from twisted.web.test.test_web import DummyRequest from tests.mockserver import MockServer, PORT from autologin.http_api import Autolog...
Test http-api (only the success path)
Test http-api (only the success path)
Python
apache-2.0
TeamHG-Memex/autologin,TeamHG-Memex/autologin,TeamHG-Memex/autologin
--- +++ @@ -0,0 +1,55 @@ +import json +import six + +from twisted.trial import unittest +from twisted.internet.defer import inlineCallbacks +from twisted.web import server +from twisted.internet.defer import succeed +from twisted.web.test.test_web import DummyRequest + +from tests.mockserver import MockServer, PORT +...
5cc9cd1f3c05b1f83c4f57cfc86918135c20764f
lackawanna/datapoint/migrations/0002_datapoint_large_file.py
lackawanna/datapoint/migrations/0002_datapoint_large_file.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from s3direct.fields import S3DirectField class Migration(migrations.Migration): dependencies = [ ('datapoint', '0001_initial'), ] operations = [ migrations.AddField( mode...
Add hand written migration for large_file inclusion in datapoint model
Add hand written migration for large_file inclusion in datapoint model
Python
bsd-3-clause
allyjweir/lackawanna,allyjweir/lackawanna,allyjweir/lackawanna,allyjweir/lackawanna
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from s3direct.fields import S3DirectField + +class Migration(migrations.Migration): + + dependencies = [ + ('datapoint', '0001_initial'), + ] + + operations = [ + ...
8c2f30e6de8b4d5237d39d178a07c8a3fddc0b7f
tests/test_interface.py
tests/test_interface.py
"""tests/test_interface.py. Tests hug's defined interfaces (HTTP, CLI, & Local) Copyright (C) 2016 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, inc...
Add tests for desired automatic url creation feature
Add tests for desired automatic url creation feature
Python
mit
MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug,timothycrosley/hug
--- +++ @@ -0,0 +1,49 @@ +"""tests/test_interface.py. + +Tests hug's defined interfaces (HTTP, CLI, & Local) + +Copyright (C) 2016 Timothy Edmund Crosley + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in th...
58b6f41b7ba67ce9720e069eab8d2f78af113eb3
evennia/typeclasses/migrations/0010_delete_old_player_tables.py
evennia/typeclasses/migrations/0010_delete_old_player_tables.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-13 18:47 from __future__ import unicode_literals from django.db import migrations, OperationalError, connection def _table_exists(db_cursor, tablename): "Returns bool if table exists or not" sql_check_exists = "SELECT * from %s;" % tablename ...
Add migration to finally remove the last playerdb_ tables
Add migration to finally remove the last playerdb_ tables
Python
bsd-3-clause
jamesbeebop/evennia,feend78/evennia,feend78/evennia,feend78/evennia,feend78/evennia,jamesbeebop/evennia,jamesbeebop/evennia
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-07-13 18:47 +from __future__ import unicode_literals + +from django.db import migrations, OperationalError, connection + + +def _table_exists(db_cursor, tablename): + "Returns bool if table exists or not" + sql_check_exists ...
e8fdda66fcda2be3d002fc256abd2dcb2b55edc1
create.py
create.py
def ClassFactory(name, argnames, BaseClass=BaseClass): def __init__(self, **kwargs): for key, value in kwargs.items(): if key not in argnames: raise TypeError("Argument %s not valid for %s" % (key, self.__class__.__name__)) setattr(self, key, value...
Add the secondary ClassFactory class to generate models on the fly
Add the secondary ClassFactory class to generate models on the fly
Python
mit
mathur/modelstruct
--- +++ @@ -0,0 +1,10 @@ +def ClassFactory(name, argnames, BaseClass=BaseClass): + def __init__(self, **kwargs): + for key, value in kwargs.items(): + if key not in argnames: + raise TypeError("Argument %s not valid for %s" + % (key, self.__class__.__name__)) + ...
d9ccb59f26f0ff2d7b2d70e2d17e7f33e56e2b0b
code/ex4.2-tornado_multiple_requests.py
code/ex4.2-tornado_multiple_requests.py
from tornado.ioloop import IOLoop from tornado.httpclient import AsyncHTTPClient from tornado.gen import coroutine import time URLS = [ 'http://127.0.0.1:8000', 'http://127.0.0.1:8000', 'http://127.0.0.1:8000', ] @coroutine def get_greetings(): http_client = AsyncHTTPClient() responses = yield [...
Add ex4.2: multiple tornado requests
Add ex4.2: multiple tornado requests
Python
mit
MA3STR0/PythonAsyncWorkshop
--- +++ @@ -0,0 +1,27 @@ +from tornado.ioloop import IOLoop +from tornado.httpclient import AsyncHTTPClient +from tornado.gen import coroutine +import time + + +URLS = [ + 'http://127.0.0.1:8000', + 'http://127.0.0.1:8000', + 'http://127.0.0.1:8000', +] + + +@coroutine +def get_greetings(): + http_client ...
5b99ef78b0982c03448b967dc6c98361f0244896
examples/multiple_joint_kde.py
examples/multiple_joint_kde.py
""" Multiple bivariate KDE plots ============================ _thumb: .6, .4 """ import seaborn as sns import matplotlib.pyplot as plt sns.set(style="darkgrid") iris = sns.load_dataset("iris") # Subset the iris dataset by species setosa = iris.query("species == 'setosa'") virginica = iris.query("species == 'virginic...
Add new multiple bivariate KDE example
Add new multiple bivariate KDE example
Python
bsd-3-clause
anntzer/seaborn,nileracecrew/seaborn,bsipocz/seaborn,jat255/seaborn,mia1rab/seaborn,sinhrks/seaborn,huongttlan/seaborn,mwaskom/seaborn,mwaskom/seaborn,dimarkov/seaborn,lukauskas/seaborn,phobson/seaborn,lukauskas/seaborn,kyleam/seaborn,wrobstory/seaborn,gef756/seaborn,petebachant/seaborn,clarkfitzg/seaborn,uhjish/seabor...
--- +++ @@ -0,0 +1,31 @@ +""" +Multiple bivariate KDE plots +============================ + +_thumb: .6, .4 +""" +import seaborn as sns +import matplotlib.pyplot as plt + +sns.set(style="darkgrid") +iris = sns.load_dataset("iris") + +# Subset the iris dataset by species +setosa = iris.query("species == 'setosa'") +vi...
73ab8125e8248d22b475419c81180c7ba0bf4535
api/models/preview_email.py
api/models/preview_email.py
from django.db import models from api.models import Hackathon from django.contrib import admin from hackfsu_com.admin import hackfsu_admin class PreviewEmail(models.Model): hackathon = models.ForeignKey(to=Hackathon, on_delete=models.CASCADE) email = models.CharField(max_length=100) interest = models.Char...
Add model for preview emails
Add model for preview emails
Python
apache-2.0
andrewsosa/hackfsu_com,andrewsosa/hackfsu_com,andrewsosa/hackfsu_com,andrewsosa/hackfsu_com
--- +++ @@ -0,0 +1,24 @@ +from django.db import models +from api.models import Hackathon +from django.contrib import admin +from hackfsu_com.admin import hackfsu_admin + + +class PreviewEmail(models.Model): + hackathon = models.ForeignKey(to=Hackathon, on_delete=models.CASCADE) + email = models.CharField(max_le...
496e3ada83d3c6d41df535c5433522edaa75e085
mozillians/users/migrations/0036_auto_20180704_0634.py
mozillians/users/migrations/0036_auto_20180704_0634.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-07-04 13:34 from __future__ import unicode_literals from django.db import migrations def migrate_privacy_email(apps, schema_editor): UserProfile = apps.get_model('users', 'UserProfile') IdpProfile = apps.get_model('users', 'IdpProfile') for i...
Add data migration for email privacy field.
Add data migration for email privacy field.
Python
bsd-3-clause
akatsoulas/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,akatsoulas/mozillians,mozilla/mozillians,johngian/mozillians,mozilla/mozillians,johngian/mozillians,johngian/mozillians,mozilla/mozillians,johngian/mozillians,mozilla/mozillians
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.13 on 2018-07-04 13:34 +from __future__ import unicode_literals + +from django.db import migrations + + +def migrate_privacy_email(apps, schema_editor): + UserProfile = apps.get_model('users', 'UserProfile') + IdpProfile = apps.get_mo...
6748d60d650d0b2383c62ae076aec799c0f8fda3
numpy/core/tests/test_print.py
numpy/core/tests/test_print.py
import numpy as np from numpy.testing import * class TestPrint(TestCase): def test_float_types(self) : """ Check formatting. This is only for the str function, and only for simple types. The precision of np.float and np.longdouble aren't the same as the python float pr...
Add basic tests of number str() formatting.
Add basic tests of number str() formatting.
Python
bsd-3-clause
numpy/numpy,rherault-insa/numpy,numpy/numpy-refactor,ddasilva/numpy,bertrand-l/numpy,mattip/numpy,rajathkumarmp/numpy,sigma-random/numpy,kirillzhuravlev/numpy,madphysicist/numpy,madphysicist/numpy,cowlicks/numpy,ESSS/numpy,ChristopherHogan/numpy,felipebetancur/numpy,mwiebe/numpy,CMartelLML/numpy,NextThought/pypy-numpy,...
--- +++ @@ -0,0 +1,36 @@ +import numpy as np +from numpy.testing import * + +class TestPrint(TestCase): + + def test_float_types(self) : + """ Check formatting. + + This is only for the str function, and only for simple types. + The precision of np.float and np.longdouble aren't the sa...
ab61e71f083817f575bb6652402e62d1f949230e
opps/article/search_indexes.py
opps/article/search_indexes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from haystack.indexes import SearchIndex, CharField, DateTimeField from haystack import site from .models import Post class PostIndex(SearchIndex): text = CharField(document=True, use_template=True) date_available = DateTimeField(mo...
Create search indexes article on post models
Create search indexes article on post models
Python
mit
williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,williamroot/opps,williamroot/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,jeanmask/opps,jeanmask/opps,opps/opps
--- +++ @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from datetime import datetime + +from haystack.indexes import SearchIndex, CharField, DateTimeField +from haystack import site + +from .models import Post + + +class PostIndex(SearchIndex): + text = CharField(document=True, use_template=True...
3bbaa8c922dafcce17e522d61a4869446e6e2f70
ironic/drivers/__init__.py
ironic/drivers/__init__.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
Add new base and fake driver classes.
Add new base and fake driver classes.
Python
apache-2.0
rdo-management/tuskar,tuskar/tuskar,rdo-management/tuskar,rdo-management/tuskar
--- +++ @@ -0,0 +1,16 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# ...
390b5b7e2aa9373b94acde2364e6e19c3cb19489
bayespy/inference/vmp/nodes/pdf.py
bayespy/inference/vmp/nodes/pdf.py
###################################################################### # Copyright (C) 2015 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ####################...
Create file for the black box node
ENH: Create file for the black box node
Python
mit
SalemAmeen/bayespy,jluttine/bayespy,bayespy/bayespy,fivejjs/bayespy
--- +++ @@ -0,0 +1,44 @@ +###################################################################### +# Copyright (C) 2015 Jaakko Luttinen +# +# This file is licensed under Version 3.0 of the GNU General Public +# License. See LICENSE for a text of the license. +###########################################################...
80d10488196bb9090719e45bd17aa45f1c350455
canvas_and_schedule/course_list.py
canvas_and_schedule/course_list.py
""" Module for searching on SVSU Course Schedule website """ import bs4 import re from selenium import webdriver from selenium.webdriver.support.ui import Select from time import sleep def enter_selection(driver, id, regexp): """ Search drop-down menu options for a regexp and select the first match """ ...
Add a module for listing courses on schedule website
Add a module for listing courses on schedule website
Python
mit
lahvak/svsu-utils
--- +++ @@ -0,0 +1,68 @@ +""" +Module for searching on SVSU Course Schedule website +""" +import bs4 +import re +from selenium import webdriver +from selenium.webdriver.support.ui import Select +from time import sleep + + +def enter_selection(driver, id, regexp): + """ + Search drop-down menu options for a rege...
2477c94314acbfd7c5687b1ea0b17db812964552
python/robotics/sensors/sharp_ir_distance_sensor.py
python/robotics/sensors/sharp_ir_distance_sensor.py
class SharpIrDistanceSensor(object): def __init__(self, spi_interface, pin_id): self.spi_interface = spi_interface self.pin_id = pin_id def _voltageToMeters(self, voltage): return 67.84 / (voltage - 3) - 0.04 def readDistance(self): '''Returns distance in meters.''' ...
Add implementation for Sharp IR distance sensor
Add implementation for Sharp IR distance sensor
Python
mit
asydorchuk/robotics,asydorchuk/robotics
--- +++ @@ -0,0 +1,14 @@ +class SharpIrDistanceSensor(object): + + def __init__(self, spi_interface, pin_id): + self.spi_interface = spi_interface + self.pin_id = pin_id + + def _voltageToMeters(self, voltage): + return 67.84 / (voltage - 3) - 0.04 + + def readDistance(self): + ''...
cb4f876c7bd52f66de955c0a800a3fd0de612ead
tests/health_checks/test_per_gwas_snp_AND_disease.py
tests/health_checks/test_per_gwas_snp_AND_disease.py
# ------------------------------------------------ # built-ins import unittest # local from utils.base import TestPostgapBase # ------------------------------------------------ class TestPostgapPerGwasSnpANDDisease(TestPostgapBase): def setUp(self): self.per_gwas_snp_and_disease = self.pg.groupby(['gwas_...
Add tests per gwas_snp and disease
Add tests per gwas_snp and disease
Python
apache-2.0
Ensembl/cttv024,Ensembl/cttv024
--- +++ @@ -0,0 +1,40 @@ +# ------------------------------------------------ +# built-ins +import unittest + +# local +from utils.base import TestPostgapBase +# ------------------------------------------------ + +class TestPostgapPerGwasSnpANDDisease(TestPostgapBase): + + def setUp(self): + self.per_gwas_sn...
339790845461344ab7ea5a6f864b3bfdede0b9c0
dev-tools/get-bwc-version.py
dev-tools/get-bwc-version.py
# Licensed to Elasticsearch under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except...
Add script to grab ES version for BWC tests.
Tools: Add script to grab ES version for BWC tests. closes #7653
Python
apache-2.0
myelin/elasticsearch,gmarz/elasticsearch,andrestc/elasticsearch,vrkansagara/elasticsearch,xpandan/elasticsearch,strapdata/elassandra5-rc,sposam/elasticsearch,bestwpw/elasticsearch,PhaedrusTheGreek/elasticsearch,maddin2016/elasticsearch,kaneshin/elasticsearch,huypx1292/elasticsearch,sjohnr/elasticsearch,wittyameta/elast...
--- +++ @@ -0,0 +1,83 @@ +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you under +# the Apache License, Version 2.0 (the "License"); yo...
d0d10749c7e9bd37c5ce4eed1574390e46914b8f
sklearn/utils/tests/test_ransac.py
sklearn/utils/tests/test_ransac.py
import numpy as np from numpy.testing import assert_equal from sklearn import linear_model from sklearn.utils import ransac def test_ransac_inliers_outliers(): np.random.seed(1) # Generate coordinates of line X = np.arange(-200, 200) y = 0.2 * X + 20 data = np.column_stack([X, y]) # Add som...
Add simple RANSAC unit test
Add simple RANSAC unit test
Python
bsd-3-clause
xyguo/scikit-learn,imaculate/scikit-learn,walterreade/scikit-learn,ClimbsRocks/scikit-learn,vshtanko/scikit-learn,liangz0707/scikit-learn,sumspr/scikit-learn,DonBeo/scikit-learn,tmhm/scikit-learn,fredhusser/scikit-learn,aetilley/scikit-learn,pypot/scikit-learn,carrillo/scikit-learn,xwolf12/scikit-learn,xiaoxiamii/sciki...
--- +++ @@ -0,0 +1,36 @@ +import numpy as np +from numpy.testing import assert_equal + +from sklearn import linear_model +from sklearn.utils import ransac + + +def test_ransac_inliers_outliers(): + np.random.seed(1) + + # Generate coordinates of line + X = np.arange(-200, 200) + y = 0.2 * X + 20 + data...
7aac6f1b6407300033e5ba46b61b9b8f0ae089c3
boardinghouse/tests/test_sql.py
boardinghouse/tests/test_sql.py
""" Tests for the RAW sql functions. """ from django.conf import settings from django.test import TestCase from django.db.models import connection from boardinghouse.models import Schema class TestRejectSchemaColumnChange(TestCase): def test_exception_is_raised(self): Schema.objects.mass_create('a') ...
Add test for exception raising.
Add test for exception raising.
Python
bsd-3-clause
luzfcb/django-boardinghouse,luzfcb/django-boardinghouse,luzfcb/django-boardinghouse
--- +++ @@ -0,0 +1,16 @@ +""" +Tests for the RAW sql functions. +""" + +from django.conf import settings +from django.test import TestCase +from django.db.models import connection + +from boardinghouse.models import Schema + +class TestRejectSchemaColumnChange(TestCase): + def test_exception_is_raised(self): + ...
033bddcfc933191397e4f01cd5ce5b10b2344c92
boundary_cli/plugin_manifest.py
boundary_cli/plugin_manifest.py
#!/usr/bin/env python ### ### Copyright 2014-2015, Boundary ### ### 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 requi...
Add python class for handling the plugin manifest plugin.json
Add python class for handling the plugin manifest plugin.json
Python
apache-2.0
jdgwartney/pulse-api-cli,boundary/pulse-api-cli,boundary/boundary-api-cli,boundary/boundary-api-cli,jdgwartney/boundary-api-cli,jdgwartney/pulse-api-cli,wcainboundary/boundary-api-cli,boundary/pulse-api-cli,jdgwartney/boundary-api-cli,wcainboundary/boundary-api-cli
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/env python +### +### Copyright 2014-2015, Boundary +### +### 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/licen...
e3d54a9f85a98acd774a22281288b9224fa18b12
djangae/settings_base.py
djangae/settings_base.py
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengin...
DEFAULT_FILE_STORAGE = 'djangae.storage.BlobstoreStorage' FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 FILE_UPLOAD_HANDLERS = ( 'djangae.storage.BlobstoreFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler', ) DATABASES = { 'default': { 'ENGINE': 'djangae.db.backends.appengin...
Make sure we set the EMAIL_BACKEND by default
Make sure we set the EMAIL_BACKEND by default
Python
bsd-3-clause
armirusco/djangae,SiPiggles/djangae,nealedj/djangae,armirusco/djangae,martinogden/djangae,wangjun/djangae,nealedj/djangae,chargrizzle/djangae,SiPiggles/djangae,leekchan/djangae,trik/djangae,asendecka/djangae,martinogden/djangae,leekchan/djangae,grzes/djangae,jscissr/djangae,SiPiggles/djangae,wangjun/djangae,kirberich/d...
--- +++ @@ -46,3 +46,4 @@ TEST_RUNNER = 'djangae.test_runner.DjangaeTestSuiteRunner' +EMAIL_BACKEND = 'djangae.mail.AsyncEmailBackend'
e1e8dbaec0717a1bcbc709458da0dcfdfba03bd0
glaciercmd/command_list_vaults.py
glaciercmd/command_list_vaults.py
import boto class CommandListVaults(object): def execute(self, args, config): glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret')) for index, vault in enumerate(glacier_connection.list_vaults()):...
Add a command to list vaults
Add a command to list vaults
Python
mit
carsonmcdonald/glacier-cmd
--- +++ @@ -0,0 +1,15 @@ +import boto + +class CommandListVaults(object): + + def execute(self, args, config): + glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret')) + + for index, vault in enumerate...
e3abfebdc57d364ded08034a6f1dead556fc4b57
regscrape/regscrape_lib/commands/cancel_jobs.py
regscrape/regscrape_lib/commands/cancel_jobs.py
from regscrape_lib.util import get_db import settings def run(): query = settings.FILTER.copy() query['_job_id'] = {'$exists': True} db = get_db() db.docs.update(query, {'$unset': {'_job_id': True}}, multi=True, safe=True) print 'Canceled all currently-assigned jobs.'
Add command to cancel existing jobs to make it easier to resume failed scrapes.
Add command to cancel existing jobs to make it easier to resume failed scrapes.
Python
bsd-3-clause
sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper
--- +++ @@ -0,0 +1,11 @@ +from regscrape_lib.util import get_db +import settings + +def run(): + query = settings.FILTER.copy() + query['_job_id'] = {'$exists': True} + + db = get_db() + db.docs.update(query, {'$unset': {'_job_id': True}}, multi=True, safe=True) + + print 'Canceled all currentl...
fda37167996c1c1550ef94a033977982248add64
word2vec_convert.py
word2vec_convert.py
from flask import Flask, request from flask.ext.restful import reqparse, Api, Resource from gensim.models.word2vec import Word2Vec import json print 'loading model' MODEL = Word2Vec.load_word2vec_format( 'GoogleNews-vectors-negative300.bin.gz', binary=True) print 'model loaded' print 'dumping model' MODEL.save('Go...
Convert the word2vec to gensim format
convert: Convert the word2vec to gensim format
Python
mit
mdbecker/word2vec_demo,mdbecker/word2vec_demo
--- +++ @@ -0,0 +1,11 @@ +from flask import Flask, request +from flask.ext.restful import reqparse, Api, Resource +from gensim.models.word2vec import Word2Vec +import json + +print 'loading model' +MODEL = Word2Vec.load_word2vec_format( + 'GoogleNews-vectors-negative300.bin.gz', binary=True) +print 'model loaded' ...
e74ebce60cc1de84465b16175320aa32f4795c0a
src/pyddl/__init__.py
src/pyddl/__init__.py
from abc import abstractmethod __author__ = "Jonathan Hale" class DdlStructure: """ An OpenDDL structure. """ def __init__(self, name): self.structures = [] self.properties = dict() self.name = name class DdlDocument: """ An OpenDDL document. """ def __init...
Add initial DdlStructure, DdlDocument, DdlWriter and DdlTextWriter
Add initial DdlStructure, DdlDocument, DdlWriter and DdlTextWriter Empty classes for a general structure. Signed-off-by: Squareys <0f6a03d4883e012ba4cb2c581a68f35544703cd6@googlemail.com>
Python
mit
Squareys/PyDDL
--- +++ @@ -0,0 +1,64 @@ +from abc import abstractmethod + +__author__ = "Jonathan Hale" + + +class DdlStructure: + """ + An OpenDDL structure. + """ + + def __init__(self, name): + self.structures = [] + self.properties = dict() + self.name = name + + +class DdlDocument: + """ + ...
4bd16a83c2cc6202edd0e2a9c3fa49df46519d59
scrapi/harvesters/iowaresearch.py
scrapi/harvesters/iowaresearch.py
''' Harvester for the Iowa Research Online for the SHARE project Example API call: http://ir.uiowa.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester class IowaresearchHarvester(OAIHarvester): short_name = 'iowaresearch' long_n...
Add Iowa Research Online harvester
Add Iowa Research Online harvester
Python
apache-2.0
icereval/scrapi,felliott/scrapi,jeffreyliu3230/scrapi,ostwald/scrapi,mehanig/scrapi,mehanig/scrapi,felliott/scrapi,erinspace/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,alexgarciac/scrapi,fabianvf/scrapi
--- +++ @@ -0,0 +1,18 @@ +''' +Harvester for the Iowa Research Online for the SHARE project + +Example API call: http://ir.uiowa.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc +''' + +from __future__ import unicode_literals +from scrapi.base import OAIHarvester + + +class IowaresearchHarvester(OAIHarvester): + ...
3eb0baa7f00a3ec77cc5ebf0d43c0f6918c62161
enable/constraints_container.py
enable/constraints_container.py
#------------------------------------------------------------------------------ # Copyright (c) 2013, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ # traits imports from traits.api import Dict # local imports from container import Container ...
Add a ConstraintsContainer which doesn't do much yet.
Add a ConstraintsContainer which doesn't do much yet.
Python
bsd-3-clause
tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable
--- +++ @@ -0,0 +1,72 @@ +#------------------------------------------------------------------------------ +# Copyright (c) 2013, Enthought, Inc. +# All rights reserved. +#------------------------------------------------------------------------------ + +# traits imports +from traits.api import Dict + +# local import...
09fa9bc28d7265c013737b2c44c94991880877d1
octoprint/cura/tests/test_cura.py
octoprint/cura/tests/test_cura.py
import unittest from cura import CuraFactory from cura import CuraEngine class CuraFactoryTestCase(unittest.TestCase): def test_cura_factory(self): fake_path = 'my/temp/path' result = CuraFactory.create_slicer(fake_path) self.assertEqual(fake_path, result.cura_path) def test_cur...
import unittest from cura import CuraFactory from cura import CuraEngine class CuraFactoryTestCase(unittest.TestCase): def test_cura_factory(self): fake_path = 'my/temp/path' result = CuraFactory.create_slicer(fake_path) self.assertEqual(fake_path, result.cura_path) def test_cur...
Fix error in test path
Fix error in test path
Python
agpl-3.0
abinashk-inf/AstroBox,Mikk36/OctoPrint,EZ3-India/EZ-Remote,ymilord/OctoPrint-MrBeam,beeverycreative/BEEweb,Voxel8/OctoPrint,Catrodigious/OctoPrint-TAM,ryanneufeld/OctoPrint,ryanneufeld/OctoPrint,eddieparker/OctoPrint,mcanes/OctoPrint,Voxel8/OctoPrint,shaggythesheep/OctoPrint,nicanor-romero/OctoPrint,dansantee/OctoPrint...
--- +++ @@ -19,7 +19,7 @@ cura_engine = CuraFactory.create_slicer() - file_path = './cura/tests/test_02.stl' + file_path = './cura/tests/test.stl' config_path = './cura/tests/config' gcode_filename= './cura/tests/output.gcode'
9e38f0c54faa4b4bdfa15dd5139d562a0661a2a0
test/unit/builtins/test_version.py
test/unit/builtins/test_version.py
import unittest from bfg9000.builtins.version import bfg9000_required_version, bfg9000_version from bfg9000.versioning import bfg_version, VersionError class TestRequiredVersion(unittest.TestCase): def test_bfg_version(self): bfg9000_required_version('>=0.1.0') self.assertRaises(VersionError, bfg...
Add unit tests for versioning builtins
Add unit tests for versioning builtins
Python
bsd-3-clause
jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000
--- +++ @@ -0,0 +1,25 @@ +import unittest + +from bfg9000.builtins.version import bfg9000_required_version, bfg9000_version +from bfg9000.versioning import bfg_version, VersionError + + +class TestRequiredVersion(unittest.TestCase): + def test_bfg_version(self): + bfg9000_required_version('>=0.1.0') + ...
14759bf0a40025745c11f4110f88e5f58115d2c9
ci_helpers_usage.py
ci_helpers_usage.py
import requests from github import Github from common import get_credentials username, password = get_credentials() gh = Github(username, password) gh_search_result = gh.search_code('filename:.travis.yml "astropy/ci-helpers"') gh_repo = [] gh_name = [] for i in gh_search_result: gh_repo.append(i.repository.full...
Add script to check ci-helpers usage
Add script to check ci-helpers usage
Python
bsd-3-clause
astropy/astropy-tools,astropy/astropy-tools
--- +++ @@ -0,0 +1,27 @@ +import requests +from github import Github +from common import get_credentials + +username, password = get_credentials() +gh = Github(username, password) + +gh_search_result = gh.search_code('filename:.travis.yml "astropy/ci-helpers"') + +gh_repo = [] +gh_name = [] + +for i in gh_search_resu...
62bce0ee3ea80f41d7184c6199defba55fc257f2
tests/external/py2/testfixture_test.py
tests/external/py2/testfixture_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (C) 2013 Numenta Inc. All rights reserved. # # The information and source code contained herein is the # exclusive property of Numenta Inc. No part of this software # may be used, reproduced, stored or distributed...
Make sure setUpModule is called by the test framework. We brought in pytest-2.4.0.dev8 for that specific functionality. However, one time we regressed, and our tests started misbehaving. So, this test is here to keep us honest.
Make sure setUpModule is called by the test framework. We brought in pytest-2.4.0.dev8 for that specific functionality. However, one time we regressed, and our tests started misbehaving. So, this test is here to keep us honest.
Python
agpl-3.0
passiweinberger/nupic,lscheinkman/nupic,subutai/nupic,akhilaananthram/nupic,brev/nupic,BeiLuoShiMen/nupic,cngo-github/nupic,cngo-github/nupic,glorizen/nupic,blueburningcoder/nupic,rhyolight/nupic,rcrowder/nupic,marionleborgne/nupic,lscheinkman/nupic,alfonsokim/nupic,metaml/nupic,chanceraine/nupic,cogmission/nupic,EricS...
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# ---------------------------------------------------------------------- +# Copyright (C) 2013 Numenta Inc. All rights reserved. +# +# The information and source code contained herein is the +# exclusive property of Numenta Inc. No part of this software +# may be used,...
b9dfb22f5676226a77b89a994843a27b43823391
tests/functional/test_waiter_config.py
tests/functional/test_waiter_config.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...
Add start of basic waiter model validation
Add start of basic waiter model validation Makes it quicker to review contributions for waiter configs.
Python
apache-2.0
boto/botocore,pplu/botocore
--- +++ @@ -0,0 +1,42 @@ +# 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/ +#...
d72961536570695ec1a6a160f118aff51b9b1328
cra_helper/views.py
cra_helper/views.py
from django.views.decorators.csrf import csrf_exempt from proxy.views import proxy_view from cra_helper import CRA_URL @csrf_exempt def proxy_cra_requests(request, path): ''' Proxy various requests sent by Create-React-App projects in dev mode ("npm start"), within Django-hosted views, to the Create-React-App ...
Add a reverse-proxy view for hot-reloading
Add a reverse-proxy view for hot-reloading
Python
mit
MasterKale/django-cra-helper
--- +++ @@ -0,0 +1,20 @@ +from django.views.decorators.csrf import csrf_exempt +from proxy.views import proxy_view + +from cra_helper import CRA_URL + + +@csrf_exempt +def proxy_cra_requests(request, path): + ''' + Proxy various requests sent by Create-React-App projects in dev mode ("npm start"), within + Django-...
3a63b8986b347091be613a23a1029bb744eb20f1
tests/passthrough/test_passthrough.py
tests/passthrough/test_passthrough.py
import __builtin__ from pytest import raises from fuse import FuseOSError from mock import MagicMock, patch, call from gitfs.views import PassthroughView class TestPassthrough(object): def setup(self): def mock_super(*args, **kwargs): if args and issubclass(PassthroughView, args[0]): ...
Add test for the access method.
Add test for the access method.
Python
apache-2.0
ksmaheshkumar/gitfs,PressLabs/gitfs,rowhit/gitfs,PressLabs/gitfs,bussiere/gitfs
--- +++ @@ -0,0 +1,47 @@ +import __builtin__ +from pytest import raises +from fuse import FuseOSError +from mock import MagicMock, patch, call + +from gitfs.views import PassthroughView + + +class TestPassthrough(object): + + def setup(self): + def mock_super(*args, **kwargs): + if args and issub...
eb1ae63b247b668453b55e0622a5aa6018bb82ab
semillas_backend/users/management/commands/anonymize_all_data.py
semillas_backend/users/management/commands/anonymize_all_data.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, print_function from factory import Faker # Django imports from django.conf import settings from django.core.management.base import BaseCommand from semillas_backend.users.models import User class Command(BaseCommand): help = "Th...
Add script to anonymize all data
Add script to anonymize all data
Python
mit
Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_backend
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, unicode_literals, print_function + +from factory import Faker + +# Django imports +from django.conf import settings +from django.core.management.base import BaseCommand + +from semillas_backend.users.models import User + + + +c...
dffa63270d9bcd54fad9beb6847ad1e8aa9f86ba
hs_core/management/commands/debug_composite_resource.py
hs_core/management/commands/debug_composite_resource.py
"""This prints the state of a logical file. * By default, prints errors on stdout. * Optional argument --log: logs output to system log. """ from django.core.management.base import BaseCommand from hs_core.models import BaseResource, ResourceFile def debug_resource(short_id): """ Debug view for resource depicts...
Debug the contents of composite resources after conversion.
Debug the contents of composite resources after conversion.
Python
bsd-3-clause
hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare,hydroshare/hydroshare
--- +++ @@ -0,0 +1,55 @@ +"""This prints the state of a logical file. + +* By default, prints errors on stdout. +* Optional argument --log: logs output to system log. +""" + +from django.core.management.base import BaseCommand +from hs_core.models import BaseResource, ResourceFile + + +def debug_resource(short_id): +...
fd1062be8acbb09ca60dd0d87e657d9417d9b4d7
scripts/checkInstalledFiles.py
scripts/checkInstalledFiles.py
#!/usr/bin/env python import os import sys import stat import difflib import inspect import getopt def referenceFile(): if sys.platform.startswith('linux'): filename = 'makeinstall.linux' elif sys.platform.startswith('win'): filename = 'makeinstall.windows' elif sys.platform == 'darwin': ...
Add script that can check builds for completeness.
Add script that can check builds for completeness. It checks against os-dependent lists which will be submitted in follow-up commits. Change-Id: Ieb40b19dbd85c30b28062b46320a6ee60ba672af Reviewed-by: Bill King <2ab503764bfba23a6f2e273493fc021dc3d4cd8f@nokia.com>
Python
lgpl-2.1
xianian/qt-creator,farseerri/git_code,xianian/qt-creator,kuba1/qtcreator,kuba1/qtcreator,syntheticpp/qt-creator,richardmg/qtcreator,malikcjm/qtcreator,farseerri/git_code,duythanhphan/qt-creator,xianian/qt-creator,colede/qtcreator,danimo/qt-creator,malikcjm/qtcreator,jonnor/qt-creator,xianian/qt-creator,Distrotech/qtcre...
--- +++ @@ -0,0 +1,86 @@ +#!/usr/bin/env python +import os +import sys +import stat +import difflib +import inspect +import getopt + +def referenceFile(): + if sys.platform.startswith('linux'): + filename = 'makeinstall.linux' + elif sys.platform.startswith('win'): + filename = 'makeinstall.window...
52191143671d2d9311f978c4f3ba043807b918e8
singularity_frobenius.py
singularity_frobenius.py
# -*- coding: utf-8 -*- """ Created on Thu Aug 21 13:23:31 2014 @author: Jens von der Linden Implments Frobneius expansion around a singularity to determine the "small" solution and check the Suydam condition. """ from __future__ import print_function from __future__ import division from __future__ import absolute_i...
Add Frobenius solution methods for singular points.
Add Frobenius solution methods for singular points.
Python
mit
jensv/fluxtubestability,jensv/fluxtubestability
--- +++ @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +""" +Created on Thu Aug 21 13:23:31 2014 + +@author: Jens von der Linden + +Implments Frobneius expansion around a singularity to determine the "small" +solution and check the Suydam condition. +""" + +from __future__ import print_function +from __future__ import div...
556325cc8cb1032194c2d3739f303fe0a4cfa1a4
undercloud_heat_plugins/config.py
undercloud_heat_plugins/config.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 # ...
Add custom subclass to revert mapping
Add custom subclass to revert mapping To be able to revert the custom mappings down by config-download, let's add some tripleo specific subclasses which will be available in the registry. Change-Id: I6bd4107e8e1a6a9abc38d2dca7a91a6823f8b6c2 Related-Bug: #1758065
Python
apache-2.0
openstack/tripleo-common,openstack/tripleo-common
--- +++ @@ -0,0 +1,30 @@ +# +# 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 ...
101738323720d7f23b714d0a0b8f40c2926f9645
midterm/problem8.py
midterm/problem8.py
# Problem 8 # 20.0 points possible (graded) # Implement a function that meets the specifications below. # For example, the following functions, f, g, and test code: # def f(i): # return i + 2 # def g(i): # return i > 5 # L = [0, -10, 5, 6, -4] # print(applyF_filterG(L, f, g)) # print(L) # Should print: # 6 ...
Implement applyF_filterG function (1 test case missing)
Implement applyF_filterG function (1 test case missing)
Python
mit
Kunal57/MIT_6.00.1x
--- +++ @@ -0,0 +1,47 @@ +# Problem 8 +# 20.0 points possible (graded) +# Implement a function that meets the specifications below. + +# For example, the following functions, f, g, and test code: + +# def f(i): +# return i + 2 +# def g(i): +# return i > 5 + +# L = [0, -10, 5, 6, -4] +# print(applyF_filterG(L,...
6a42d70a9f74478ed9d650d5b96a385ea84213b7
nltk/test/unit/test_chunk.py
nltk/test/unit/test_chunk.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import unittest from nltk import RegexpParser class TestChunkRule(unittest.TestCase): def test_tag_pattern2re_pattern_quantifier(self): """Test for bug https://github.com/nltk/nltk/issues/1597 Ensures that curly...
Fix 1597. Allow for curly bracket quantifiers in nltk.chunk.regexp.CHUNK_TAG_PATTERN.
Fix 1597. Allow for curly bracket quantifiers in nltk.chunk.regexp.CHUNK_TAG_PATTERN.
Python
apache-2.0
nltk/nltk,nltk/nltk,nltk/nltk
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, unicode_literals +import unittest + +from nltk import RegexpParser + +class TestChunkRule(unittest.TestCase): + + def test_tag_pattern2re_pattern_quantifier(self): + """Test for bug https://github.com/nltk/nltk/issues...
417b95a9c95146be49feb3322d7e5f2481ea40dc
pambox/tests/test_experiment.py
pambox/tests/test_experiment.py
# -*- coding: utf-8 -*- from __future__ import division, print_function import os.path import numpy as np from numpy.testing import assert_allclose import pytest from pambox.speech import Experiment __DATA_ROOT__ = os.path.join(os.path.dirname(__file__), 'data') class TestExperiment(object): @pytest.mark.param...
Add some tests for Experiment class
Add some tests for Experiment class
Python
bsd-3-clause
achabotl/pambox
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +from __future__ import division, print_function +import os.path + +import numpy as np +from numpy.testing import assert_allclose +import pytest + +from pambox.speech import Experiment + + +__DATA_ROOT__ = os.path.join(os.path.dirname(__file__), 'data') + +class TestE...
896160f5291158132c670eae65b7e45dd4a8748f
pox/messenger/mux.py
pox/messenger/mux.py
from pox.core import core from pox.messenger.messenger import * log = pox.core.getLogger() class MuxConnection (MessengerConnection): def __init__ (self, source, channelName, con): MessengerConnection.__init__(self, source, ID=str(id(self))) self.channelName = channelName self.con = con claimed = F...
Add totally untested messenger multiplexer
Add totally untested messenger multiplexer messenger.mux theoretically lets you use a single messenger connection to talk with multiple messenger servers. Send a hello:mux message to have the muxer claim the connection. Now you can send messages that include _mux:<conID>. For every unique conID, a subconnection wil...
Python
apache-2.0
adusia/pox,adusia/pox,diogommartins/pox,noxrepo/pox,kpengboy/pox-exercise,carlye566/IoT-POX,jacobq/csci5221-viro-project,kpengboy/pox-exercise,xAKLx/pox,xAKLx/pox,diogommartins/pox,kavitshah8/SDNDeveloper,xAKLx/pox,PrincetonUniversity/pox,chenyuntc/pox,kulawczukmarcin/mypox,PrincetonUniversity/pox,adusia/pox,Vamsikrish...
--- +++ @@ -0,0 +1,96 @@ +from pox.core import core +from pox.messenger.messenger import * + +log = pox.core.getLogger() + +class MuxConnection (MessengerConnection): + def __init__ (self, source, channelName, con): + MessengerConnection.__init__(self, source, ID=str(id(self))) + self.channelName = channelName...
0a08696add6080c37e6083cedbb950f1ab19cee8
test/test_convert.py
test/test_convert.py
# This file is part of beets. # Copyright 2014, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy,...
Test convert error during import
Test convert error during import When the conversion of an audio file fails during import the original should be imported. See #659
Python
mit
Andypsamp/CODfinalJUNIT,pkess/beets,SusannaMaria/beets,sampsyo/beets,artemutin/beets,jmwatte/beets,gabrielaraujof/beets,Wen777/beets,moodboom/beets,tima/beets,mried/beets,diego-plan9/beets,YetAnotherNerd/beets,jcoady9/beets,Freso/beets,untitaker/beets,untitaker/beets,sampsyo/beets,kelvinhammond/beets,kareemallen/beets,...
--- +++ @@ -0,0 +1,48 @@ +# This file is part of beets. +# Copyright 2014, Thomas Scholtes. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without l...