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 |
|---|---|---|---|---|---|---|---|---|---|---|
3e51c57a8611a8ebfb4f2eb045510c50587bd781 | api/radar_api/tests/test_users.py | api/radar_api/tests/test_users.py | import json
from radar_api.tests.fixtures import get_user
def test_serialization(app):
admin = get_user('admin')
client = app.test_client()
client.login(admin)
response = client.get('/users')
assert response.status_code == 200
data = json.loads(response.data)
for user in data['data']... | Test password tokens not in response | Test password tokens not in response
| Python | agpl-3.0 | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | ---
+++
@@ -0,0 +1,21 @@
+import json
+
+from radar_api.tests.fixtures import get_user
+
+
+def test_serialization(app):
+ admin = get_user('admin')
+
+ client = app.test_client()
+ client.login(admin)
+
+ response = client.get('/users')
+
+ assert response.status_code == 200
+
+ data = json.loads(r... | |
dfe3f7fd7775ce13a670e1d27beddba5c1254a4a | hyper/http20/hpack_structures.py | hyper/http20/hpack_structures.py | # -*- coding: utf-8 -*-
"""
hyper/http20/hpack_structures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains data structures used in hyper's HPACK implementation.
"""
class Reference(object):
"""
The reference object is essentially an object that 'points to' another
object, not unlike a pointer in C or similar languag... | Define the HPACK reference structure. | Define the HPACK reference structure.
| Python | mit | irvind/hyper,fredthomsen/hyper,lawnmowerlatte/hyper,masaori335/hyper,fredthomsen/hyper,masaori335/hyper,plucury/hyper,Lukasa/hyper,irvind/hyper,jdecuyper/hyper,Lukasa/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,plucury/hyper | ---
+++
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+"""
+hyper/http20/hpack_structures
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Contains data structures used in hyper's HPACK implementation.
+"""
+class Reference(object):
+ """
+ The reference object is essentially an object that 'points to' another
+ object, not un... | |
78aaccb71fc64e52497abf0d0c768f3767a3d932 | fellowms/migrations/0020_auto_20160602_1607.py | fellowms/migrations/0020_auto_20160602_1607.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0019_auto_20160601_1512'),
]
operations = [
migrations.AlterFiel... | Update expenses status on database | Update expenses status on database
| Python | bsd-3-clause | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.6 on 2016-06-02 16:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('fellowms', '0019_auto_20160601_1512'),
+ ]
+
+ op... | |
9c70a5d65b1c06f62751dfb4fcdd4d6a60a5eb71 | kivy/tests/test_widget_walk.py | kivy/tests/test_widget_walk.py | import unittest
class FileWidgetWalk(unittest.TestCase):
def test_walk_large_tree(self):
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.widget import walk, walk_reverse
''' the tree
BoxLayout
BoxLayout
Label
... | Add unit tests for testing the widget tree iterators. | Add unit tests for testing the widget tree iterators.
| Python | mit | eHealthAfrica/kivy,xpndlabs/kivy,vipulroxx/kivy,rafalo1333/kivy,CuriousLearner/kivy,Farkal/kivy,rafalo1333/kivy,Cheaterman/kivy,bionoid/kivy,bliz937/kivy,vipulroxx/kivy,habibmasuro/kivy,xiaoyanit/kivy,dirkjot/kivy,Farkal/kivy,rafalo1333/kivy,manashmndl/kivy,KeyWeeUsr/kivy,darkopevec/kivy,viralpandey/kivy,matham/kivy,cb... | ---
+++
@@ -0,0 +1,70 @@
+import unittest
+
+
+class FileWidgetWalk(unittest.TestCase):
+
+ def test_walk_large_tree(self):
+ from kivy.uix.boxlayout import BoxLayout
+ from kivy.uix.label import Label
+ from kivy.uix.widget import walk, walk_reverse
+ ''' the tree
+ BoxLayout
+ ... | |
3a4de870ebefd0e3e32b8c1b9facee6c98ce8b7f | ltk2to3.py | ltk2to3.py | import os
import shutil
import fnmatch
def get_files(patterns):
""" gets all files matching pattern from root
pattern supports any unix shell-style wildcards (not same as RE) """
cwd = os.getcwd()
if isinstance(patterns,str):
patterns = [patterns]
matched_files = []
for pattern in... | Convert python 2 version to python 3 | Convert python 2 version to python 3
| Python | mit | Lingotek/filesystem-connector,Lingotek/translation-utility,Lingotek/client,Lingotek/client,Lingotek/translation-utility,Lingotek/filesystem-connector | ---
+++
@@ -0,0 +1,66 @@
+import os
+import shutil
+import fnmatch
+
+def get_files(patterns):
+ """ gets all files matching pattern from root
+ pattern supports any unix shell-style wildcards (not same as RE) """
+
+ cwd = os.getcwd()
+ if isinstance(patterns,str):
+ patterns = [patterns]
+
+ ... | |
fa1223c661d60033b7d7aba2a27151d6ee18a299 | tests/ci_checks/test_circle.py | tests/ci_checks/test_circle.py | import pytest
from semantic_release import ci_checks
from semantic_release.errors import CiVerificationError
def test_circle_should_pass_if_branch_is_master_and_no_pr(monkeypatch):
monkeypatch.setenv('CIRCLE_BRANCH', 'master')
monkeypatch.setenv('CI_PULL_REQUEST', '')
assert ci_checks.circle('master')
... | Add tests for circle ci checks | test: Add tests for circle ci checks
| Python | mit | relekang/python-semantic-release,wlonk/python-semantic-release,relekang/python-semantic-release,riddlesio/python-semantic-release | ---
+++
@@ -0,0 +1,34 @@
+import pytest
+
+from semantic_release import ci_checks
+from semantic_release.errors import CiVerificationError
+
+
+def test_circle_should_pass_if_branch_is_master_and_no_pr(monkeypatch):
+ monkeypatch.setenv('CIRCLE_BRANCH', 'master')
+ monkeypatch.setenv('CI_PULL_REQUEST', '')
+
+ ... | |
f29dab9a82b44fac483d71c432a40a0bb2ca51b1 | examples/dbus_client.py | examples/dbus_client.py |
import dbus
bus = dbus.SystemBus()
# This adds a signal match so that the client gets signals sent by Blivet1's
# ObjectManager. These signals are used to notify clients of changes to the
# managed objects (for blivet, this will be devices, formats, and actions).
bus.add_match_string("type='signal',sender='com.redha... | Add the beginnings of an example client. | Add the beginnings of an example client.
| Python | lgpl-2.1 | rvykydal/blivet,AdamWill/blivet,jkonecny12/blivet,vpodzime/blivet,vojtechtrefny/blivet,vpodzime/blivet,vojtechtrefny/blivet,jkonecny12/blivet,AdamWill/blivet,rvykydal/blivet | ---
+++
@@ -0,0 +1,18 @@
+
+import dbus
+
+bus = dbus.SystemBus()
+
+# This adds a signal match so that the client gets signals sent by Blivet1's
+# ObjectManager. These signals are used to notify clients of changes to the
+# managed objects (for blivet, this will be devices, formats, and actions).
+bus.add_match_str... | |
ebf4d87390307dcf735c53f18a18f3466a4ee5e4 | tools/standalonewavetrigger.py | tools/standalonewavetrigger.py | #!/usr/bin/env python
# Standard library imports
import argparse
import collections
import logging
import os
import time
# Additional library imports
import requests
# Named logger for this module
_logger = logging.getLogger(__name__)
# Parse the command line arguments
_parser = argparse.ArgumentParser('')
_parser... | Add standalone wave trigger tool. | Add standalone wave trigger tool.
| Python | apache-2.0 | lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# Standard library imports
+import argparse
+import collections
+import logging
+import os
+import time
+
+# Additional library imports
+import requests
+
+
+# Named logger for this module
+_logger = logging.getLogger(__name__)
+
+# Parse the command line arguments
+... | |
a86852fe908bb0a44ef267a75b9446ddcaf03f6e | homeassistant/components/light/limitlessled.py | homeassistant/components/light/limitlessled.py | """
homeassistant.components.light.limitlessled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for LimitlessLED bulbs, also known as...
EasyBulb
AppLight
AppLamp
MiLight
LEDme
dekolight
iLight
"""
import random
import logging
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import STATE_O... | Add basic support for LimitlessLED | Add basic support for LimitlessLED
| Python | mit | Duoxilian/home-assistant,betrisey/home-assistant,CCOSTAN/home-assistant,open-homeautomation/home-assistant,Smart-Torvy/torvy-home-assistant,pschmitt/home-assistant,hexxter/home-assistant,srcLurker/home-assistant,postlund/home-assistant,alexmogavero/home-assistant,MungoRae/home-assistant,srcLurker/home-assistant,turboko... | ---
+++
@@ -0,0 +1,102 @@
+"""
+homeassistant.components.light.limitlessled
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Support for LimitlessLED bulbs, also known as...
+
+EasyBulb
+AppLight
+AppLamp
+MiLight
+LEDme
+dekolight
+iLight
+
+"""
+import random
+import logging
+
+from homeassistant.helpers.entity import Toggl... | |
37f286812bea7429bea67172a40d26ad435d6f67 | test/examples/hole_in_square.py | test/examples/hole_in_square.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pygmsh as pg
import numpy as np
def generate():
# Characteristic length
lcar = 1e-1
# Coordinates of lower-left and upper-right vertices of a square domain
xmin = 0.0
xmax = 5.0
ymin = 0.0
ymax = 5.0
# Vertices of a square hole
squ... | Add test for 'holes' argument in add_polygon | Add test for 'holes' argument in add_polygon
| Python | bsd-3-clause | nschloe/python4gmsh | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import pygmsh as pg
+import numpy as np
+
+def generate():
+ # Characteristic length
+ lcar = 1e-1
+
+ # Coordinates of lower-left and upper-right vertices of a square domain
+ xmin = 0.0
+ xmax = 5.0
+ ymin = 0.0
+ ymax = 5.... | |
db4bc200f9a48edf9e160c2134293df0313183a7 | conditional_prefix.py | conditional_prefix.py | from cloudbot import hook
import re
@hook.sieve
def conditional_prefix(bot, event, plugin):
if plugin.type == 'command':
if event.chan in event.conn.config['prefix_blocked_channels']:
command_prefix = event.conn.config['command_prefix']
if not event.chan.lower() == event.nick.lowe... | Add conditional command prefix plugin | Add conditional command prefix plugin
| Python | mit | Aaron1011/CloudBotPlugins | ---
+++
@@ -0,0 +1,16 @@
+from cloudbot import hook
+
+import re
+
+@hook.sieve
+def conditional_prefix(bot, event, plugin):
+ if plugin.type == 'command':
+ if event.chan in event.conn.config['prefix_blocked_channels']:
+ command_prefix = event.conn.config['command_prefix']
+
+ if not... | |
b80e52ecf09f96e84625eb6fff9aa7a20059c0f8 | test_single.py | test_single.py |
import sys
import unittest
from toast.mpirunner import MPITestRunner
file = sys.argv[1]
loader = unittest.TestLoader()
runner = MPITestRunner(verbosity=2)
suite = loader.discover('tests', pattern='{}'.format(file), top_level_dir='.')
runner.run(suite)
| Add new top level script to ease running of individual unittests. | Add new top level script to ease running of individual unittests.
| Python | bsd-2-clause | tskisner/pytoast,tskisner/pytoast | ---
+++
@@ -0,0 +1,12 @@
+
+import sys
+import unittest
+
+from toast.mpirunner import MPITestRunner
+
+file = sys.argv[1]
+
+loader = unittest.TestLoader()
+runner = MPITestRunner(verbosity=2)
+suite = loader.discover('tests', pattern='{}'.format(file), top_level_dir='.')
+runner.run(suite) | |
2e6c7235c555799cc9dbb9d1fa7faeab4557ac13 | db.py | db.py | import sqlite3
connection = sqlite3.connect('data.db')
class SavedRoll:
@staticmethod
def save(user, name, args):
pass
@staticmethod
def get(user, name):
pass
@staticmethod
def delete(user, name):
pass
| Add stubby saved roll class | Add stubby saved roll class
| Python | mit | foxscotch/foxrollbot | ---
+++
@@ -0,0 +1,18 @@
+import sqlite3
+
+
+connection = sqlite3.connect('data.db')
+
+
+class SavedRoll:
+ @staticmethod
+ def save(user, name, args):
+ pass
+
+ @staticmethod
+ def get(user, name):
+ pass
+
+ @staticmethod
+ def delete(user, name):
+ pass | |
4f08f057c7e4cc8230a996d853892ab3eef36065 | rps.py | rps.py | from random import choice
class RPSGame:
shapes = ['rock', 'paper', 'scissors']
draws = [('rock', 'rock'), ('paper', 'paper'), ('scissors', 'scissors')]
first_wins = [('rock', 'scissors'), ('scissors', 'paper'), ('paper', 'rock')]
def _evaluate(self, player_move, computer_move):
if (player... | Add simple terminal-based version of rock-paper-scissors. | Add simple terminal-based version of rock-paper-scissors.
| Python | mit | kubkon/ee106-additional-material | ---
+++
@@ -0,0 +1,30 @@
+from random import choice
+
+class RPSGame:
+ shapes = ['rock', 'paper', 'scissors']
+ draws = [('rock', 'rock'), ('paper', 'paper'), ('scissors', 'scissors')]
+ first_wins = [('rock', 'scissors'), ('scissors', 'paper'), ('paper', 'rock')]
+
+ def _evaluate(self, player_move,... | |
a193f1d9b1816f72661254bba69c2c4a1e2c1b30 | tests/extensions/functional/tests/test_google_menu.py | tests/extensions/functional/tests/test_google_menu.py | """
Google Menu tests
"""
from base import BaseTouchscreenTest
import time
from base import MAPS_URL, ZOOMED_IN_MAPS_URL, Pose
from base import screenshot_on_error, make_screenshot
import re
class TestGoogleMenu(BaseTouchscreenTest):
@screenshot_on_error
def test_google_menu_is_visible(self):
self.b... | Add tests for google menu | Add tests for google menu
| Python | apache-2.0 | EndPointCorp/appctl,EndPointCorp/appctl | ---
+++
@@ -0,0 +1,48 @@
+"""
+Google Menu tests
+"""
+
+
+from base import BaseTouchscreenTest
+import time
+from base import MAPS_URL, ZOOMED_IN_MAPS_URL, Pose
+from base import screenshot_on_error, make_screenshot
+import re
+
+class TestGoogleMenu(BaseTouchscreenTest):
+
+ @screenshot_on_error
+ def test_go... | |
26df96a0c772c70013cc7a027022e84383ccaee2 | utils/chunk-print-before-all.py | utils/chunk-print-before-all.py | #!/usr/bin/env python
# Given a -print-before-all -print-module-scope log from an opt invocation,
# chunk it into a series of individual IR files, one for each pass invocation.
# If the log ends with an obvious stack trace, try to split off a separate
# "crashinfo.txt" file leaving only the valid input IR in the last c... | Add a helper script for converting -print-before-all output into a file based equivelent | [Util] Add a helper script for converting -print-before-all output into a file based equivelent
Simple little utility which takes a opt logfile generated with "opt -print-before-all -print-module-scope -o /dev/null <args> 2&>1", and splits into a series of individual "chunk-X.ll" files. The intended purpose is to help... | Python | apache-2.0 | llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# Given a -print-before-all -print-module-scope log from an opt invocation,
+# chunk it into a series of individual IR files, one for each pass invocation.
+# If the log ends with an obvious stack trace, try to split off a separate
+# "crashinfo.txt" file leaving only ... | |
45e86e49e845ef25df6e1db3bcb336809ffb5f5f | ipv6_Checker.py | ipv6_Checker.py | #!/usr/bin/python
#Copyright 2014 Quam Sodji
import subprocess
def getinfo(hardware): #Return network info on select interface
info = subprocess.check_output(["networksetup", "-getinfo", hardware])
return info
wireless = ["Airport", "Wi-Fi"] #The two type of interfaces that refers to wireless
list_network... | Disable IPv6 on wireless (Extension Attribute for Casper) | Disable IPv6 on wireless (Extension Attribute for Casper)
| Python | mit | killahquam/JAMF,killahquam/JAMF | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+#Copyright 2014 Quam Sodji
+
+import subprocess
+
+def getinfo(hardware): #Return network info on select interface
+ info = subprocess.check_output(["networksetup", "-getinfo", hardware])
+ return info
+
+wireless = ["Airport", "Wi-Fi"] #The two type of interfaces... | |
0aaed7764d743afe46af503fe5938fa718fe3abc | teamworkApp/lib/dbCalls.py | teamworkApp/lib/dbCalls.py | # muddersOnRails()
# Sara McAllister November 5, 2-17
# Last updated: 11-5-2017
# library for SQLite database calls for teamwork analysis app
import contextlib
import sqlite3
DB = 'db/development.sqlite3'
def connect(sqlite_file):
""" Make connection to an SQLite database file """
conn = sqlite3.connect(sql... | Set up contextmanager for db cals | Set up contextmanager for db cals
| Python | mit | nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis | ---
+++
@@ -0,0 +1,35 @@
+# muddersOnRails()
+# Sara McAllister November 5, 2-17
+# Last updated: 11-5-2017
+
+# library for SQLite database calls for teamwork analysis app
+
+import contextlib
+import sqlite3
+
+DB = 'db/development.sqlite3'
+
+def connect(sqlite_file):
+ """ Make connection to an SQLite database... | |
dac5f9e406f3c205d6ed212d4414ca55c94b8f15 | tests/local/test_search.py | tests/local/test_search.py | from __future__ import unicode_literals
import unittest
from mopidy.local import search
from mopidy.models import Album, Track
class LocalLibrarySearchTest(unittest.TestCase):
def test_find_exact_with_album_query(self):
expected_tracks = [Track(album=Album(name='foo'))]
tracks = [Track(), Track(... | Add test for exact search with album query | Add test for exact search with album query
| Python | apache-2.0 | pacificIT/mopidy,hkariti/mopidy,bencevans/mopidy,jmarsik/mopidy,swak/mopidy,swak/mopidy,diandiankan/mopidy,vrs01/mopidy,dbrgn/mopidy,jodal/mopidy,tkem/mopidy,quartz55/mopidy,hkariti/mopidy,ali/mopidy,swak/mopidy,mokieyue/mopidy,mokieyue/mopidy,swak/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,kingosticks/mopidy,tkem/mopidy,g... | ---
+++
@@ -0,0 +1,16 @@
+from __future__ import unicode_literals
+
+import unittest
+
+from mopidy.local import search
+from mopidy.models import Album, Track
+
+
+class LocalLibrarySearchTest(unittest.TestCase):
+ def test_find_exact_with_album_query(self):
+ expected_tracks = [Track(album=Album(name='foo... | |
0ca298f6706706637dccd4f27c56eed6e91c98ba | tests/runners.py | tests/runners.py | from spec import Spec
class Runner_(Spec):
class run:
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
def err_stream_defaults_to_sys_stderr(self):
"err_stream defaults to sys.stderr"
def out_stream_can_be_overridden(self):
... | import sys
from spec import Spec, trap, eq_
from invoke import Local, Context
from _utils import mock_subprocess
class Local_(Spec):
class run:
@trap
@mock_subprocess(out="sup")
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
Loca... | Rename new test class correctly and flesh out first passing tests | Rename new test class correctly and flesh out first passing tests
| Python | bsd-2-clause | mattrobenolt/invoke,pyinvoke/invoke,mattrobenolt/invoke,pyinvoke/invoke,kejbaly2/invoke,frol/invoke,tyewang/invoke,pfmoore/invoke,mkusz/invoke,mkusz/invoke,pfmoore/invoke,singingwolfboy/invoke,kejbaly2/invoke,frol/invoke | ---
+++
@@ -1,13 +1,27 @@
-from spec import Spec
+import sys
+
+from spec import Spec, trap, eq_
+
+from invoke import Local, Context
+
+from _utils import mock_subprocess
-class Runner_(Spec):
+class Local_(Spec):
class run:
+ @trap
+ @mock_subprocess(out="sup")
def out_stream_default... |
4ebfc2e6ffb21fd55ef1fc4f1fd836153b2da545 | tests/unit/test_exceptions.py | tests/unit/test_exceptions.py | # coding: utf-8
import pytest
import responses
import kiteconnect.exceptions as ex
@responses.activate
def test_wrong_json_response(kiteconnect):
responses.add(
responses.GET,
"%s%s" % (kiteconnect.root, kiteconnect._routes["portfolio.positions"]),
body="{a:b}",
content_type="appl... | Add tests for all exceptions | Add tests for all exceptions
| Python | mit | rainmattertech/pykiteconnect | ---
+++
@@ -0,0 +1,56 @@
+# coding: utf-8
+
+import pytest
+import responses
+import kiteconnect.exceptions as ex
+
+
+@responses.activate
+def test_wrong_json_response(kiteconnect):
+ responses.add(
+ responses.GET,
+ "%s%s" % (kiteconnect.root, kiteconnect._routes["portfolio.positions"]),
+ ... | |
f131cd221b2ce6fc144b2aa9882cb0ad1b116675 | tests/views/test_dashboard.py | tests/views/test_dashboard.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Add (failing) tests for the dashboard | Add (failing) tests for the dashboard
| Python | apache-2.0 | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python2.5
+#
+# Copyright 2011 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICEN... | |
226c2f36b9cc8257ce99bd15648be4aba2ccb606 | cla_public/apps/checker/utils.py | cla_public/apps/checker/utils.py | from cla_public.apps.checker.constants import PASSPORTED_BENEFITS, \
NASS_BENEFITS
def passported(benefits):
return bool(set(benefits).intersection(PASSPORTED_BENEFITS))
def nass(benefits):
return bool(set(benefits).intersection(NASS_BENEFITS))
| Move utility functions for checking passported benefits into separate module | Move utility functions for checking passported benefits into separate module
| Python | mit | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | ---
+++
@@ -0,0 +1,10 @@
+from cla_public.apps.checker.constants import PASSPORTED_BENEFITS, \
+ NASS_BENEFITS
+
+
+def passported(benefits):
+ return bool(set(benefits).intersection(PASSPORTED_BENEFITS))
+
+
+def nass(benefits):
+ return bool(set(benefits).intersection(NASS_BENEFITS)) | |
b2dd561322f6f277f470eae425028412a209da93 | morenines/repository.py | morenines/repository.py | import os
from morenines import output
from morenines import util
from morenines.index import Index
from morenines.ignores import Ignores
NAMES = {
'repo_dir': '.morenines',
'index': 'index',
'ignore': 'ignore',
}
class Repository(object):
def __init__(self):
self.path = None
self.... | Add Repository class and module | Add Repository class and module
| Python | mit | mcgid/morenines,mcgid/morenines | ---
+++
@@ -0,0 +1,48 @@
+import os
+
+from morenines import output
+from morenines import util
+
+from morenines.index import Index
+from morenines.ignores import Ignores
+
+
+NAMES = {
+ 'repo_dir': '.morenines',
+ 'index': 'index',
+ 'ignore': 'ignore',
+}
+
+
+class Repository(object):
+ def __init__(... | |
af2a0a851be91931f96a7e9d44a1e8c460d70918 | web/main/migrations/0052_migrate_casebook_dates.py | web/main/migrations/0052_migrate_casebook_dates.py | # Generated by Django 2.2.10 on 2020-04-14 11:38
from django.db import migrations
from main.models import Casebook
def copy_old_dates(app, schema):
update_cbs = []
for casebook in Casebook.objects.select_related('old_casebook').all():
if casebook.old_casebook:
casebook.created_at = caseboo... | Migrate creation date to new casebooks | Migrate creation date to new casebooks
| Python | agpl-3.0 | harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o | ---
+++
@@ -0,0 +1,22 @@
+# Generated by Django 2.2.10 on 2020-04-14 11:38
+
+from django.db import migrations
+from main.models import Casebook
+
+def copy_old_dates(app, schema):
+ update_cbs = []
+ for casebook in Casebook.objects.select_related('old_casebook').all():
+ if casebook.old_casebook:
+ ... | |
0cad5e1673069d0fb8f2abb4eb6b062e3461fb70 | scipy/linalg/tests/test_build.py | scipy/linalg/tests/test_build.py | from subprocess import call, PIPE, Popen
import sys
import re
import numpy as np
from numpy.testing import TestCase, dec
from scipy.linalg import flapack
# XXX: this is copied from numpy trunk. Can be removed when we will depend on
# numpy 1.3
class FindDependenciesLdd:
def __init__(self):
self.cmd = ['l... | Add fortran ABI mismatch test for scipy.linalg. | Add fortran ABI mismatch test for scipy.linalg.
| Python | bsd-3-clause | mikebenfield/scipy,ChanderG/scipy,chatcannon/scipy,juliantaylor/scipy,newemailjdm/scipy,sonnyhu/scipy,WarrenWeckesser/scipy,mhogg/scipy,arokem/scipy,newemailjdm/scipy,FRidh/scipy,Eric89GXL/scipy,mgaitan/scipy,pschella/scipy,larsmans/scipy,anntzer/scipy,pizzathief/scipy,chatcannon/scipy,mortonjt/scipy,vigna/scipy,sriki1... | ---
+++
@@ -0,0 +1,51 @@
+from subprocess import call, PIPE, Popen
+import sys
+import re
+
+import numpy as np
+from numpy.testing import TestCase, dec
+
+from scipy.linalg import flapack
+
+# XXX: this is copied from numpy trunk. Can be removed when we will depend on
+# numpy 1.3
+class FindDependenciesLdd:
+ de... | |
e61dbf66d6f73e4999a5ff9f732a8df0637fdbf2 | server/models.py | server/models.py | from flask.ext.sqlalchemy import SQLAlchemy
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
email = db.Column(db.String(120), unique=True)
def __in... | Add an example of SQLalchemy model | Add an example of SQLalchemy model
| Python | bsd-3-clause | raspberrywhite/raspberrywhite,raspberrywhite/raspberrywhite,raspberrywhite/raspberrywhite,raspberrywhite/raspberrywhite | ---
+++
@@ -0,0 +1,16 @@
+from flask.ext.sqlalchemy import SQLAlchemy
+
+app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
+db = SQLAlchemy(app)
+
+class User(db.Model):
+ id = db.Column(db.Integer, primary_key=True)
+ username = db.Column(db.String(80), unique=True)
+ email = db.Column(db.Str... | |
b01c602f156b5a72db1ea4f27989aa5b1afdada8 | src/behavior/features/terrain.py | src/behavior/features/terrain.py | from lettuce import *
import requests
TARGET_URL='http://localhost:8080'
tenantList = [ "511", "615", "634", "515" ]
@before.each_scenario
def cleanContext(feature):
for tenant in tenantList:
url = TARGET_URL + '/pap/v1/' + tenant
r = requests.delete(url)
| ADD Cleaning before each test | ADD Cleaning before each test
| Python | apache-2.0 | telefonicaid/fiware-keypass,telefonicaid/fiware-keypass,telefonicaid/fiware-keypass | ---
+++
@@ -0,0 +1,14 @@
+from lettuce import *
+import requests
+
+TARGET_URL='http://localhost:8080'
+
+tenantList = [ "511", "615", "634", "515" ]
+
+@before.each_scenario
+def cleanContext(feature):
+ for tenant in tenantList:
+ url = TARGET_URL + '/pap/v1/' + tenant
+ r = requests.delete(url)
+
+ | |
1ece8c8640214d69a224f94f1b1ac93ec53d7699 | chunsabot/modules/images.py | chunsabot/modules/images.py | from chunsabot.botlogic import brain
@brain.route("@image")
def add_image_description(msg, extras):
attachment = extras['attachment']
if not attachment:
return None
return "asdf"
| Add image processing system (dummy) | Add image processing system (dummy)
| Python | mit | susemeee/Chunsabot-framework | ---
+++
@@ -0,0 +1,9 @@
+from chunsabot.botlogic import brain
+
+@brain.route("@image")
+def add_image_description(msg, extras):
+ attachment = extras['attachment']
+ if not attachment:
+ return None
+
+ return "asdf" | |
6274ee8d776c829998dfaa56cb419d1263242a48 | Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py | Algorithms/Sort_Algorithms/Topological_Sort/TopologicalSort.py | '''
Topological sort.
Taken from :
http://stackoverflow.com/questions/15038876/topological-sort-python
'''
from collections import defaultdict
from itertools import takewhile, count
def sort_topologically(graph):
levels_by_name = {}
names_by_level = defaultdict(set)
def walk_depth_first(name):
i... | Add topological sorting in Python | Add topological sorting in Python
Issue #57
| Python | mit | salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook,salman-bhai/DS-Algo-Handbook | ---
+++
@@ -0,0 +1,38 @@
+'''
+Topological sort.
+Taken from :
+http://stackoverflow.com/questions/15038876/topological-sort-python
+'''
+
+from collections import defaultdict
+from itertools import takewhile, count
+
+def sort_topologically(graph):
+ levels_by_name = {}
+ names_by_level = defaultdict(set)
+
+... | |
3d1cef9e56d7fac8a1b89861b7443e4ca660e4a8 | nova/ipv6/api.py | nova/ipv6/api.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Openstack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Openstack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | Reduce indentation to avoid PEP8 failures | Reduce indentation to avoid PEP8 failures
| Python | apache-2.0 | vmturbo/nova,fnordahl/nova,cloudbau/nova,CEG-FYP-OpenStack/scheduler,vladikr/nova_drafts,yrobla/nova,bigswitch/nova,eharney/nova,KarimAllah/nova,Stavitsky/nova,TwinkleChawla/nova,zzicewind/nova,klmitch/nova,rickerc/nova_audit,belmiromoreira/nova,cloudbase/nova-virtualbox,luogangyi/bcec-nova,Yusuke1987/openstack_templat... | ---
+++
@@ -27,8 +27,8 @@
def reset_backend():
global IMPL
IMPL = utils.LazyPluggable(FLAGS['ipv6_backend'],
- rfc2462='nova.ipv6.rfc2462',
- account_identifier='nova.ipv6.account_identifier')
+ rfc2462='nova.ipv6.rfc2462',
+ ... |
72678c437f1b1110fb8a14c78dcdd4c3c8b64157 | rtm.py | rtm.py | import time
from slackclient import SlackClient
token = 'kekmao'
sc = SlackClient(token)
team_join_event = 'team_join'
def send_welcome_message(user):
user_id = user['id']
response = sc.api_call('im.open', user=user_id)
try:
dm_channel_id = response['channel']['id']
except (KeyError, ValueErr... | Add initial version of bot script | Add initial version of bot script
| Python | mit | devupin/allie | ---
+++
@@ -0,0 +1,33 @@
+import time
+from slackclient import SlackClient
+
+token = 'kekmao'
+sc = SlackClient(token)
+team_join_event = 'team_join'
+
+
+def send_welcome_message(user):
+ user_id = user['id']
+ response = sc.api_call('im.open', user=user_id)
+ try:
+ dm_channel_id = response['channe... | |
41631175c7aae124f7504f068d9c2f8cf1c9e617 | plugins/configuration/configurationtype/configuration_error.py | plugins/configuration/configurationtype/configuration_error.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | Add exception to describe errors in configuration processing | Add exception to describe errors in configuration processing
Mostly just a marker, but with some extra debug information.
| Python | cc0-1.0 | Ghostkeeper/Luna | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#-*- coding: utf-8 -*-
+
+#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
+#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1... | |
c7987bde28992ef0ae8cae9fca500730b2fcea15 | flexget/plugins/urlrewrite_eztv.py | flexget/plugins/urlrewrite_eztv.py | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from urlparse import urlparse, urlunparse
from requests import RequestException
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils imp... | Add url rewriter for eztv | Add url rewriter for eztv
| Python | mit | jawilson/Flexget,crawln45/Flexget,ZefQ/Flexget,crawln45/Flexget,crawln45/Flexget,grrr2/Flexget,poulpito/Flexget,tobinjt/Flexget,ianstalk/Flexget,dsemi/Flexget,Flexget/Flexget,Flexget/Flexget,OmgOhnoes/Flexget,qk4l/Flexget,jacobmetrick/Flexget,JorisDeRieck/Flexget,ZefQ/Flexget,tsnoam/Flexget,Danfocus/Flexget,antivirtel/... | ---
+++
@@ -0,0 +1,57 @@
+from __future__ import unicode_literals, division, absolute_import
+import re
+import logging
+from urlparse import urlparse, urlunparse
+from requests import RequestException
+
+from flexget import plugin
+from flexget.event import event
+from flexget.plugins.plugin_urlrewriting import UrlR... | |
d3f556b6d7da2c67fc9dcc6b7d73a0d1b76d278c | tests/functional_tests/test_valid_recipes.py | tests/functional_tests/test_valid_recipes.py | import os
import pytest
from conda_verify import utils
from conda_verify.exceptions import RecipeError
from conda_verify.verify import Verify
@pytest.fixture
def recipe_dir():
return os.path.join(os.path.dirname(__file__), 'test-recipes')
@pytest.fixture
def verifier():
recipe_verifier = Verify()
retu... | Add tests for valid recipes | Add tests for valid recipes
| Python | bsd-3-clause | mandeep/conda-verify | ---
+++
@@ -0,0 +1,40 @@
+import os
+
+import pytest
+
+from conda_verify import utils
+from conda_verify.exceptions import RecipeError
+from conda_verify.verify import Verify
+
+
+@pytest.fixture
+def recipe_dir():
+ return os.path.join(os.path.dirname(__file__), 'test-recipes')
+
+
+@pytest.fixture
+def verifier... | |
58c604a8574ade75aecbd80314004a9539e80c84 | plugins/volunteers.py | plugins/volunteers.py | __commands__ = '''
?wv [name] - congratulates people on their public sprited gesture
'''
def plugin(bot):
bot.hear(r'^\?wv$', "Well volunteered!")
bot.hear(r'^\?wv\s(.+)$', lambda response: "Well volunteered %s!" % response.match.group(1).strip())
| Add ?wv command for encouraging action | Add ?wv command for encouraging action
Reviewed-by: Zi Li
| Python | mit | smarkets/hal | ---
+++
@@ -0,0 +1,8 @@
+__commands__ = '''
+ ?wv [name] - congratulates people on their public sprited gesture
+'''
+
+
+def plugin(bot):
+ bot.hear(r'^\?wv$', "Well volunteered!")
+ bot.hear(r'^\?wv\s(.+)$', lambda response: "Well volunteered %s!" % response.match.group(1).strip()) | |
40ad674ae170347ed69b19434241438bb09e473d | app/decorators.py | app/decorators.py | from functools import wraps
from flask import redirect, session, url_for
def login_required(f):
@wraps(f)
def wrapper(*args, **kwargs):
if session.get('logged_in', False):
return f(*args, **kwargs)
return redirect(url_for('public.login'))
return wrapper
| Define decorator for requiring login | Define decorator for requiring login
| Python | apache-2.0 | ueg1990/customer-info,ueg1990/customer-info | ---
+++
@@ -0,0 +1,11 @@
+from functools import wraps
+
+from flask import redirect, session, url_for
+
+def login_required(f):
+ @wraps(f)
+ def wrapper(*args, **kwargs):
+ if session.get('logged_in', False):
+ return f(*args, **kwargs)
+ return redirect(url_for('public.login'))
+ r... | |
722b11eab90c6d532ea96209f7632e17181c0b3e | tests/test_inpoly.py | tests/test_inpoly.py | import unittest
import pcl
import numpy as np
from patty_registration.conversions import loadLas, loadCsvPolygon
from numpy.testing import assert_array_equal, assert_array_almost_equal
from matplotlib import path
class TestInPoly(unittest.TestCase):
def testInPoly(self):
fileLas = 'data/footprints/162.las'... | Test if points are in footprint | Test if points are in footprint
| Python | apache-2.0 | NLeSC/PattyAnalytics | ---
+++
@@ -0,0 +1,22 @@
+import unittest
+import pcl
+import numpy as np
+from patty_registration.conversions import loadLas, loadCsvPolygon
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+from matplotlib import path
+
+class TestInPoly(unittest.TestCase):
+ def testInPoly(self):
+ ... | |
7115d25c57404a42bc29513eb514073747d876ce | src/rez/utils/platform_mapped.py | src/rez/utils/platform_mapped.py | import re
def platform_mapped(func):
"""
Decorates functions for lookups within a config.platform_map dictionary.
The first level key is mapped to the func.__name__ of the decorated function.
Regular expressions are used on the second level key, values.
Note that there is no guaranteed order withi... | Add platform_map to remap Platform.os and arch based on config | Add platform_map to remap Platform.os and arch based on config
| Python | apache-2.0 | nerdvegas/rez,instinct-vfx/rez,nerdvegas/rez,instinct-vfx/rez | ---
+++
@@ -0,0 +1,42 @@
+import re
+
+
+def platform_mapped(func):
+ """
+ Decorates functions for lookups within a config.platform_map dictionary.
+ The first level key is mapped to the func.__name__ of the decorated function.
+ Regular expressions are used on the second level key, values.
+ Note tha... | |
8a1448ed3bd426d11f6222d63f77604ec132b2da | examples/signed_url_auth.py | examples/signed_url_auth.py | # Copyright 2016 Catalyst IT Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | Add an example for pre signed URL | Add an example for pre signed URL
Change-Id: I6abb998cee022e5cf3e83df4600dc027bc537d32
| Python | apache-2.0 | openstack/python-zaqarclient | ---
+++
@@ -0,0 +1,52 @@
+# Copyright 2016 Catalyst IT Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unl... | |
59f37975bb06edd38bbcdea6f0ea031f079ba2c3 | lib/hawaiibuildbot/common/utils.py | lib/hawaiibuildbot/common/utils.py | #
# This file is part of Hawaii.
#
# Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (... | Add an utility function to load YAML | common: Add an utility function to load YAML
| Python | agpl-3.0 | hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder,hawaii-desktop/builder | ---
+++
@@ -0,0 +1,27 @@
+#
+# This file is part of Hawaii.
+#
+# Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, eith... | |
62b2c69482d36a7afcdb732dd70a037d2513ba51 | bh_sshcmd.py | bh_sshcmd.py | import paramiko # pip install paramiko
import os
def ssh_command(ip, user, command):
# you can run this script as
# SSH_PRIV_KEY=[your private key path] python bh_sshcmd.py
key = paramiko.RSAKey.from_private_key_file(os.getenv('SSH_PRIV_KEY'))
client = paramiko.SSHClient()
client.set_missing_hos... | Add script to execute a simple command in a remote server over SSH | Add script to execute a simple command in a remote server over SSH
| Python | mit | inakidelamadrid/bhp_exercises | ---
+++
@@ -0,0 +1,22 @@
+import paramiko # pip install paramiko
+import os
+
+
+def ssh_command(ip, user, command):
+ # you can run this script as
+ # SSH_PRIV_KEY=[your private key path] python bh_sshcmd.py
+ key = paramiko.RSAKey.from_private_key_file(os.getenv('SSH_PRIV_KEY'))
+
+ client = paramiko.S... | |
7c6077e107f40a3fcc3e1414f26071ceab0e0cf6 | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | taiga/projects/notifications/migrations/0006_auto_20151103_0954.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notifications', '0005_auto_20151005_1357'),
]
operations = [
migrations.AlterField(
model_name='notifypolicy',
... | Create missing migration in taiga.projects.notifications | Create missing migration in taiga.projects.notifications
| Python | agpl-3.0 | Rademade/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,Rademade/taiga-back,dayatz/taiga-back,Rademade/taiga-back,Rademade/taiga-back,gam-phon/taiga-back,taigaio/taiga-back,taigaio/taiga-back,taigaio/taiga-back,gam-phon/taiga-back,dayatz/taiga-back,xdevelsistemas/taiga-back-community,gam-phon/taiga-ba... | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('notifications', '0005_auto_20151005_1357'),
+ ]
+
+ operations = [
+ migrations.AlterField(... | |
3b29a94a7009c0b652e8eca0b175bb97250e1b33 | feature_extraction/extraction.py | feature_extraction/extraction.py | import numpy as np
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
def extract_features(image, measurements):
# TODO(liam): parallelize multiple measurements on an image by using Celery
return np.rave... | Add an extract_features(image, measurements) function returning a feature vector | Add an extract_features(image, measurements) function returning a feature vector
| Python | apache-2.0 | widoptimization-willett/feature-extraction | ---
+++
@@ -0,0 +1,11 @@
+import numpy as np
+
+"""
+Given an image as a Numpy array and a set of measurement objects
+implementing a compute method returning a feature vector, return a combined
+feature vector.
+"""
+def extract_features(image, measurements):
+ # TODO(liam): parallelize multiple measurements on an i... | |
d11491d30a2fb418dd40bf7e97d4d35cc84d6f3f | pyjokes/chuck.py | pyjokes/chuck.py | # -*- coding: utf-8 -*-
import json
try:
from urllib2 import urlopen
except:
from urllib.request import urlopen
def get_chuck_nerd_jokes():
url = 'http://api.icndb.com/jokes/random?limitTo=[nerdy]'
response = urlopen(url).readall().decode('utf-8')
data = json.loads(response)
d = data['value'... | Move Chuck database query function to another file | Move Chuck database query function to another file
| Python | bsd-3-clause | trojjer/pyjokes,gmarkall/pyjokes,Wren6991/pyjokes,bennuttall/pyjokes,borjaayerdi/pyjokes,ElectronicsGeek/pyjokes,pyjokes/pyjokes,martinohanlon/pyjokes,birdsarah/pyjokes | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+import json
+
+try:
+ from urllib2 import urlopen
+except:
+ from urllib.request import urlopen
+
+
+def get_chuck_nerd_jokes():
+ url = 'http://api.icndb.com/jokes/random?limitTo=[nerdy]'
+ response = urlopen(url).readall().decode('utf-8')
+ data = ... | |
2f268173e25bee5d671583bb905829e0ffd4f631 | match/management/commands/reset-matches.py | match/management/commands/reset-matches.py | from django.core.management.base import BaseCommand, CommandError
from match.models import Match
import sys
class Command(BaseCommand):
help = 'Reset all match data'
def handle(self, *args, **options):
Match.objects.all().delete()
| Add management command to clear all matches mostly useful with heroku | Add management command to clear all matches
mostly useful with heroku
| Python | mit | maxf/address-matcher,maxf/address-matcher,maxf/address-matcher,maxf/address-matcher | ---
+++
@@ -0,0 +1,10 @@
+from django.core.management.base import BaseCommand, CommandError
+from match.models import Match
+
+import sys
+
+class Command(BaseCommand):
+ help = 'Reset all match data'
+
+ def handle(self, *args, **options):
+ Match.objects.all().delete() | |
8c4833dbf9f4ae32afbfbe6a3cb8e4630abc3d25 | test/requests/test_login_local.py | test/requests/test_login_local.py | import requests
from wqflask import user_manager
from parametrized_test import ParametrizedTest
class TestLoginLocal(ParametrizedTest):
def setUp(self):
super(TestLoginLocal, self).setUp()
self.login_url = self.gn2_url +"/n/login"
data = {
"es_connection": self.es,
... | Add test for local login | Add test for local login
* Add an integration test to test that the login process for users
registered locally to genenetwork2 works as expected.
| Python | agpl-3.0 | DannyArends/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,... | ---
+++
@@ -0,0 +1,56 @@
+import requests
+from wqflask import user_manager
+from parametrized_test import ParametrizedTest
+
+class TestLoginLocal(ParametrizedTest):
+
+ def setUp(self):
+ super(TestLoginLocal, self).setUp()
+ self.login_url = self.gn2_url +"/n/login"
+ data = {
+ ... | |
5af36bbe29a8a7a7418fc535c5647c9be511f0b4 | scripts/userCounts.py | scripts/userCounts.py | """
Script to write user counts for each region to CSV.
"""
import twitterproj
def main():
db = twitterproj.connect()
filenames = ['grids/counties.user_counts.bot_filtered.csv',
'grids/states.user_counts.bot_filtered.csv',
'grids/squares.user_counts.bot_filtered.csv']
... | Add script to write user counts to csv. | Add script to write user counts to csv.
| Python | unlicense | chebee7i/twitter,chebee7i/twitter,chebee7i/twitter | ---
+++
@@ -0,0 +1,28 @@
+"""
+Script to write user counts for each region to CSV.
+
+"""
+
+import twitterproj
+
+def main():
+
+ db = twitterproj.connect()
+ filenames = ['grids/counties.user_counts.bot_filtered.csv',
+ 'grids/states.user_counts.bot_filtered.csv',
+ 'grids/squa... | |
0c18bb0993be77059aa75015cc5433eaacbe8999 | rfc.py | rfc.py | import pydoc
import sys
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
def get_rfc(rfc):
url = "http://www.ietf.org/rfc/rfc{0}.txt".format(rfc)
f = urlopen(url)
data = f.read()
if isinstance(data, bytes):
data = data.decode('utf-8')
return... | Add barebones RFC downloader and renderer. | Add barebones RFC downloader and renderer.
| Python | lgpl-2.1 | StefanKopieczek/rfc | ---
+++
@@ -0,0 +1,25 @@
+import pydoc
+import sys
+
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+
+def get_rfc(rfc):
+ url = "http://www.ietf.org/rfc/rfc{0}.txt".format(rfc)
+ f = urlopen(url)
+ data = f.read()
+ if isinstance(data, bytes):
+ ... | |
681c21a5fbf3bc713468e33bb10dfa9bf6d62850 | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | corehq/apps/users/migrations/0004_rm_role_id_from_admins.py | from django.db import migrations
from corehq.apps.es import UserES
from corehq.apps.users.models import WebUser
from corehq.util.couch import DocUpdate, iter_update
from corehq.util.django_migrations import skip_on_fresh_install
from corehq.util.log import with_progress_bar
@skip_on_fresh_install
def fix_users(apps,... | Add migration to fix admin users with roles | Add migration to fix admin users with roles
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,46 @@
+from django.db import migrations
+
+from corehq.apps.es import UserES
+from corehq.apps.users.models import WebUser
+from corehq.util.couch import DocUpdate, iter_update
+from corehq.util.django_migrations import skip_on_fresh_install
+from corehq.util.log import with_progress_bar
+
+
+@skip... | |
3134e22eb5da9bd7104c199f788288e0fc823db2 | app.py | app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
from bottle import route, run, template, request, response
import os
import uuid
@route('/')
def get_simple_form():
"""
Returns simple images upload form
:return:
"""
return ('<form action="/imgs" method="post" enctype="multipart/form-da... | Add basic endopoints powered by bottle | Add basic endopoints powered by bottle
| Python | mit | ciela/chainer-gogh | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import bottle
+from bottle import route, run, template, request, response
+
+import os
+import uuid
+
+@route('/')
+def get_simple_form():
+ """
+ Returns simple images upload form
+ :return:
+ """
+ return ('<form action="/img... | |
07442bd7ddd07635002493bafb6ac16a24fd5d82 | hls.py | hls.py | var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
var zlib = require('zlib');
PORT = 8000;
http.createServer(function (req, res) {
var uri = url.parse(req.url).pathname;
if (uri == '/player.html') {
res.writeHead(200, { 'Content-Type': 'text/htm... | Add script for http live streaming | Add script for http live streaming | Python | mit | voidabhi/node-scripts,voidabhi/node-scripts,voidabhi/node-scripts | ---
+++
@@ -0,0 +1,75 @@
+var http = require('http');
+var fs = require('fs');
+var url = require('url');
+var path = require('path');
+var zlib = require('zlib');
+
+PORT = 8000;
+
+http.createServer(function (req, res) {
+ var uri = url.parse(req.url).pathname;
+
+ if (uri == '/player.html') {
+ res.wr... | |
03f46b0d6867bcb8a88e53b26089705cb1667bbd | tools/create_from_sample_texts.py | tools/create_from_sample_texts.py | #!/usr/bin/env python
import teetime
import os
def main():
with open('samples/sample-texts.txt') as fh:
for line in fh:
print line.strip()
path = teetime.create_typography(line.strip(), colors=False)
os.rename(path, os.path.join('samples', os.path.basename(path)))
if... | Add script to generate images from all samples | Add script to generate images from all samples
| Python | mit | megacool/teetime | ---
+++
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+import teetime
+import os
+
+
+def main():
+ with open('samples/sample-texts.txt') as fh:
+ for line in fh:
+ print line.strip()
+ path = teetime.create_typography(line.strip(), colors=False)
+ os.rename(path, os.path.join('... | |
9ba0ff62572dcfd7912c9b58091b59844f8e1753 | results/sccg-table.py | results/sccg-table.py | import os
import sys
import pandas as pd
p4_data = "helmholtz-results/helmholtz_conv-d-4.csv"
p5_data = "helmholtz-results/helmholtz_conv-d-5.csv"
p6_data = "helmholtz-results/helmholtz_conv-d-6.csv"
p7_data = "helmholtz-results/helmholtz_conv-d-7.csv"
data_set = [p4_data, p5_data, p6_data, p7_data]
for data in data... | Add script for Helmholtz rates | Add script for Helmholtz rates
| Python | mit | thomasgibson/tabula-rasa | ---
+++
@@ -0,0 +1,56 @@
+import os
+import sys
+import pandas as pd
+
+
+p4_data = "helmholtz-results/helmholtz_conv-d-4.csv"
+p5_data = "helmholtz-results/helmholtz_conv-d-5.csv"
+p6_data = "helmholtz-results/helmholtz_conv-d-6.csv"
+p7_data = "helmholtz-results/helmholtz_conv-d-7.csv"
+data_set = [p4_data, p5_data... | |
5d1da267791456f6c5e386d6e7204d02371c2eb2 | readthedocs/rtd_tests/tests/test_gold.py | readthedocs/rtd_tests/tests/test_gold.py | from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django_dynamic_fixture import get
from django_dynamic_fixture import new
from readthedocs.gold.models import GoldUser, LEVEL_CHOICES
from readthedocs.projects.models import Project
def crea... | Add tests for gold projects | Add tests for gold projects
| Python | mit | emawind84/readthedocs.org,kenshinthebattosai/readthedocs.org,Tazer/readthedocs.org,SteveViss/readthedocs.org,atsuyim/readthedocs.org,clarkperkins/readthedocs.org,safwanrahman/readthedocs.org,kenwang76/readthedocs.org,SteveViss/readthedocs.org,sunnyzwh/readthedocs.org,mhils/readthedocs.org,attakei/readthedocs-oauth,rtfd... | ---
+++
@@ -0,0 +1,58 @@
+from django.contrib.auth.models import User
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+
+from django_dynamic_fixture import get
+from django_dynamic_fixture import new
+
+from readthedocs.gold.models import GoldUser, LEVEL_CHOICES
+from readthedocs.proje... | |
00c8c165e3f9a136a8950ca1fb0f2d9ade6731d6 | pybtex/tests/bibtex_parser_test.py | pybtex/tests/bibtex_parser_test.py | from pybtex.database import BibliographyData
from pybtex.core import Entry
from pybtex.database.input.bibtex import Parser
from cStringIO import StringIO
test_data = [
(
'''
''',
BibliographyData(),
),
(
'''@ARTICLE{
test,
title={Polluted
... | Add a regression test for whitespace normalization in the BibTeX parser. | Add a regression test for whitespace normalization in the BibTeX parser.
| Python | mit | chbrown/pybtex,andreas-h/pybtex,andreas-h/pybtex,chbrown/pybtex | ---
+++
@@ -0,0 +1,32 @@
+from pybtex.database import BibliographyData
+from pybtex.core import Entry
+from pybtex.database.input.bibtex import Parser
+from cStringIO import StringIO
+
+test_data = [
+ (
+ '''
+ ''',
+ BibliographyData(),
+ ),
+ (
+ '''@ARTICLE{
+ t... | |
1e82283cc85b2eb449969849d23c4ffa2c090426 | scripts/directory_batch_convert.py | scripts/directory_batch_convert.py | import os
import sys
import re
from pathlib import Path
import argparse
from convert2netcdf4 import parseandconvert
parser = argparse.ArgumentParser(description='Recursively batch convert Vaisala old-binary format to NetCDF files. Keeps directory structure.')
parser.add_argument('--from', dest='fromdir', help='Input... | Add script to batch convert a directory recursively | Add script to batch convert a directory recursively
| Python | mit | kinow/pccora | ---
+++
@@ -0,0 +1,45 @@
+import os
+import sys
+import re
+from pathlib import Path
+
+import argparse
+
+from convert2netcdf4 import parseandconvert
+
+parser = argparse.ArgumentParser(description='Recursively batch convert Vaisala old-binary format to NetCDF files. Keeps directory structure.')
+parser.add_argument... | |
860f8224bf8ef2f1553a17842d1389491f43bfa5 | wagtail/tests/migrations/0008_auto_20141113_2125.py | wagtail/tests/migrations/0008_auto_20141113_2125.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tests', '0007_registerdecorator'),
]
operations = [
migrations.AlterField(
model_name='pagechoosermodel',
... | Add missing migration for wagtail.tests | Add missing migration for wagtail.tests
It only appears in Python 3.x for some reason.
| Python | bsd-3-clause | inonit/wagtail,janusnic/wagtail,chrxr/wagtail,FlipperPA/wagtail,nrsimha/wagtail,benjaoming/wagtail,jordij/wagtail,taedori81/wagtail,takeshineshiro/wagtail,mephizzle/wagtail,hanpama/wagtail,darith27/wagtail,gogobook/wagtail,gasman/wagtail,wagtail/wagtail,timorieber/wagtail,rsalmaso/wagtail,FlipperPA/wagtail,mjec/wagtail... | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('tests', '0007_registerdecorator'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
d8ad74b80f214ca313d01533ea6f15082cbb3af2 | srttools/core/tests/test_calibration.py | srttools/core/tests/test_calibration.py | from ..calibration import CalibratorTable
from ..read_config import read_config
from ..scan import list_scans
import numpy as np
import matplotlib.pyplot as plt
import unittest
from astropy.table import Table
from ..imager import ScanSet
import os
import glob
class Test2_Calibration(unittest.TestCase):
@classmeth... | Add tests for calibration procedure (draft) | Add tests for calibration procedure (draft)
| Python | bsd-3-clause | matteobachetti/srt-single-dish-tools | ---
+++
@@ -0,0 +1,54 @@
+from ..calibration import CalibratorTable
+from ..read_config import read_config
+from ..scan import list_scans
+import numpy as np
+import matplotlib.pyplot as plt
+import unittest
+from astropy.table import Table
+from ..imager import ScanSet
+import os
+import glob
+
+
+class Test2_Calibr... | |
e39290b71299843eff858fb51543b99a06178a1d | ice40/picorv32_benchmark.py | ice40/picorv32_benchmark.py | #!/usr/bin/env python3
import os, sys, threading
from os import path
import subprocess
import re
num_runs = 8
if not path.exists("picorv32.json"):
os.remove("picorv32.json")
subprocess.run(["wget", "https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v"], check=True)
subprocess.run(["y... | Add a simple 8x benchmark script | Add a simple 8x benchmark script
Signed-off-by: David Shah <4be9b043912c80de45ffb490ebd07e45bc0fcd34@gmail.com>
| Python | isc | YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+import os, sys, threading
+from os import path
+import subprocess
+import re
+
+num_runs = 8
+
+if not path.exists("picorv32.json"):
+ os.remove("picorv32.json")
+ subprocess.run(["wget", "https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v... | |
0af447c0371bd157c03fc5097ac8c0e0a5873ff7 | examples/satellites_analyze.py | examples/satellites_analyze.py | assert __name__ == '__main__'
import bayeslite.bql as bql
import bayeslite.core as core
import bayeslite.parse as parse
import crosscat.LocalEngine as localengine
import getopt
import sys
# XXX This is wrong -- should be part of bayesdb proper. But it, and
# copypasta of it, will do for now until internals are restr... | Add temporary satellites analysis example. | Add temporary satellites analysis example.
| Python | apache-2.0 | probcomp/bayeslite,probcomp/bayeslite | ---
+++
@@ -0,0 +1,59 @@
+assert __name__ == '__main__'
+
+import bayeslite.bql as bql
+import bayeslite.core as core
+import bayeslite.parse as parse
+import crosscat.LocalEngine as localengine
+import getopt
+import sys
+
+# XXX This is wrong -- should be part of bayesdb proper. But it, and
+# copypasta of it, wil... | |
069a5758b16624ac2b547ede44123b64c89baf96 | map_ytids_to_ka_urls.py | map_ytids_to_ka_urls.py | #!/usr/bin/env python3
from kapi import *
from utils import *
import argparse, sys
import time
def read_cmd():
"""Function for reading command line options."""
desc = "Program for mapping YouTube IDs to KA URLs to Crowdin WYSIWYG editor."
parser = argparse.ArgumentParser(description=desc)
parser.add_argu... | Add simple script mapping YTID to KA URLs. | Add simple script mapping YTID to KA URLs.
| Python | mit | danielhollas/AmaraUpload,danielhollas/AmaraUpload | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+from kapi import *
+from utils import *
+import argparse, sys
+import time
+
+
+def read_cmd():
+ """Function for reading command line options."""
+ desc = "Program for mapping YouTube IDs to KA URLs to Crowdin WYSIWYG editor."
+ parser = argparse.ArgumentParse... | |
e50dc18525e0e4cbbef56cd16ba4e2d9690464f1 | euler034.py | euler034.py | #!/usr/bin/python
from math import factorial, log
values = [0]*10
for i in range(10):
values[i] = factorial(i)
total = 0
for i in range(10, factorial(9) * 7):
target = 0
test = i
while test != 0:
x = test % 10
target += values[x]
test = test // 10
if i == target:
t... | Add solution for problem 34 | Add solution for problem 34
Slow and brute force solution...
| Python | mit | cifvts/PyEuler | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+from math import factorial, log
+values = [0]*10
+
+for i in range(10):
+ values[i] = factorial(i)
+
+total = 0
+for i in range(10, factorial(9) * 7):
+ target = 0
+ test = i
+ while test != 0:
+ x = test % 10
+ target += values[x]
+ test... | |
943e162eee203f05b5a2d5b19bcb4a9c371cc93b | plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py | plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py | # @Float(label="Time Interval (s)", value=1) dt
# @Float(label="Pixel Length (um)", value=1) pixel_length
# @Boolean(label="Do you want to save results files ?", required=False) save_results
# @Boolean(label="Do you want to save ROI files ?", required=False) save_roi
# @ImageJ ij
# @ImagePlus img
# @Dataset data
# @Sta... | Add new script to get comet velocity from kymograph | Add new script to get comet velocity from kymograph
| Python | bsd-3-clause | hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools | ---
+++
@@ -0,0 +1,63 @@
+# @Float(label="Time Interval (s)", value=1) dt
+# @Float(label="Pixel Length (um)", value=1) pixel_length
+# @Boolean(label="Do you want to save results files ?", required=False) save_results
+# @Boolean(label="Do you want to save ROI files ?", required=False) save_roi
+# @ImageJ ij
+# @Ima... | |
96bbf25be25482a7edfd92ec9b956b0bbeab39c4 | src/traffic/__init__.py | src/traffic/__init__.py | from datetime import datetime
import zmq
from messages import common_pb2, replies_pb2, requests_pb2
class Connection(object):
def __init__(self, uri, context=None):
self._uri = uri
if context is None:
context = zmq.Context()
self._context = context
self._socket = self.... | Add a basic summary query implementation | Add a basic summary query implementation
Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
| Python | bsd-3-clause | agdsn/traffic-service-client,agdsn/traffic-service-client | ---
+++
@@ -0,0 +1,70 @@
+from datetime import datetime
+import zmq
+
+from messages import common_pb2, replies_pb2, requests_pb2
+
+
+class Connection(object):
+ def __init__(self, uri, context=None):
+ self._uri = uri
+ if context is None:
+ context = zmq.Context()
+ self._context... | |
e9f88f1c43189fe429730c488f4514bf78edea4e | mistune/__main__.py | mistune/__main__.py | import sys
import argparse
from . import (
create_markdown,
__version__ as version
)
def _md(args):
if args.plugin:
plugins = args.plugin
else:
# default plugins
plugins = ['strikethrough', 'footnotes', 'table', 'speedup']
return create_markdown(
escape=args.escape,... | Add python -m mistune cli | Add python -m mistune cli
| Python | bsd-3-clause | lepture/mistune | ---
+++
@@ -0,0 +1,101 @@
+import sys
+import argparse
+from . import (
+ create_markdown,
+ __version__ as version
+)
+
+
+def _md(args):
+ if args.plugin:
+ plugins = args.plugin
+ else:
+ # default plugins
+ plugins = ['strikethrough', 'footnotes', 'table', 'speedup']
+ return c... | |
3e345bc4a17cf53c40ef51cd2ae1732744be7e60 | cardbox/deck_forms.py | cardbox/deck_forms.py | from django.forms import ModelForm
from django.forms.widgets import Textarea, TextInput
from deck_model import Deck
class DeckForm(ModelForm):
"""The basic form for updating or editing decks"""
class Meta:
model = Deck
fields = ('title', 'description')
widgets = {
'title': ... | Add custom form for editing and updating of decks | Add custom form for editing and updating of decks
| Python | mit | DummyDivision/Tsune,DummyDivision/Tsune,DummyDivision/Tsune | ---
+++
@@ -0,0 +1,14 @@
+from django.forms import ModelForm
+from django.forms.widgets import Textarea, TextInput
+from deck_model import Deck
+
+class DeckForm(ModelForm):
+ """The basic form for updating or editing decks"""
+
+ class Meta:
+ model = Deck
+ fields = ('title', 'description')
+ ... | |
fa8b40b8ebc088f087ff76c36068fea67dae0824 | rnacentral/portal/management/commands/update_coordinate_names.py | rnacentral/portal/management/commands/update_coordinate_names.py | """
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 a... | Add management command for updating genome coordinate names using Ensembl-INSDC mapping | Add management command for updating genome coordinate names using Ensembl-INSDC mapping
| Python | apache-2.0 | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | ---
+++
@@ -0,0 +1,39 @@
+"""
+Copyright [2009-2017] EMBL-European Bioinformatics Institute
+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
+Unle... | |
6418807dbba9fb946ffeb05aee525c51c2e71f75 | tests/fixtures.py | tests/fixtures.py | """Defines fixtures that can be used to streamline tests and / or define dependencies"""
from random import randint
import pytest
import hug
@pytest.fixture
def hug_api():
"""Defines a dependency for and then includes a uniquely identified hug API for a single test case"""
return hug.API('fake_api_{}'.forma... | Fix fixture, add doc string | Fix fixture, add doc string
| Python | mit | MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug | ---
+++
@@ -0,0 +1,12 @@
+"""Defines fixtures that can be used to streamline tests and / or define dependencies"""
+from random import randint
+
+import pytest
+
+import hug
+
+
+@pytest.fixture
+def hug_api():
+ """Defines a dependency for and then includes a uniquely identified hug API for a single test case"""
... | |
47c1dfd602281c56973de0d8afe64b923eb29592 | test/test_env.py | test/test_env.py | from _ebcf_alexa import env
from unittest.mock import patch, call
import pytest
@pytest.yield_fixture
def mock_now():
with patch.object(env, 'now') as now:
yield now
@patch('datetime.datetime')
def test_now_is_utc(fake_datetime):
assert env.now()
assert fake_datetime.now.call_args == call(tz=env... | Add unit tests for env module. | Add unit tests for env module.
These are pretty simple - just tests wiring to datetime and pytz
| Python | mit | dmotles/ebcf-alexa | ---
+++
@@ -0,0 +1,30 @@
+from _ebcf_alexa import env
+from unittest.mock import patch, call
+import pytest
+
+
+@pytest.yield_fixture
+def mock_now():
+ with patch.object(env, 'now') as now:
+ yield now
+
+
+@patch('datetime.datetime')
+def test_now_is_utc(fake_datetime):
+ assert env.now()
+ assert ... | |
fc9e9b4b9bdee1bd1f6b112c90772702cf60ad2d | test_converge.py | test_converge.py | #!/usr/bin/env python
import functools
import logging
import unittest
import converge
import converge.processes
from converge.framework import datastore
from converge.framework import scenario
def with_scenarios(TestCase):
loader = unittest.defaultTestLoader
def create_test_func(generic_test, params):
... | Add a unittest-based test suite for scenarios | Add a unittest-based test suite for scenarios
This can be run directly using:
./test_converge.py
or (equivalently):
python -m unittest test_converge
or with a test runner such as nose:
nosetests test_converge
| Python | apache-2.0 | zaneb/heat-convergence-prototype | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+import functools
+import logging
+import unittest
+
+import converge
+import converge.processes
+
+from converge.framework import datastore
+from converge.framework import scenario
+
+
+def with_scenarios(TestCase):
+ loader = unittest.defaultTestLoader
+
+ def... | |
f65c6f3939c50326eea14bd0dadc77b7c9364dd2 | gssapi/creds.py | gssapi/creds.py | from __future__ import absolute_import
from ctypes import cast, byref, c_char_p, c_void_p, string_at
from .gssapi_h import (
GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_BOTH,
GSS_S_COMPLETE,
OM_uint32, gss_cred_id_t,
gss_init_sec_context, gss_accept_sec_context, gss_d... | Add a module to deal with credentials | Add a module to deal with credentials
| Python | mit | sigmaris/python-gssapi,sigmaris/python-gssapi,sigmaris/python-gssapi,sigmaris/python-gssapi | ---
+++
@@ -0,0 +1,21 @@
+from __future__ import absolute_import
+
+from ctypes import cast, byref, c_char_p, c_void_p, string_at
+
+from .gssapi_h import (
+ GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_BOTH,
+ GSS_S_COMPLETE,
+ OM_uint32, gss_cred_id_t,
+ gss_init_sec_co... | |
8e8c14446a0089ee7fa57cfd5520c7d6d6e2711e | usercustomize.py | usercustomize.py | """ Customize Python Interpreter.
Link your user customizing file to this file.
For more info see: https://docs.python.org/3/library/site.html
"Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and
non-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/site-packages
for Mac framework builds, and... | Add Python user customization file. | Add Python user customization file.
| Python | mit | fossilet/dotfiles,fossilet/dotfiles,fossilet/dotfiles | ---
+++
@@ -0,0 +1,16 @@
+""" Customize Python Interpreter.
+
+Link your user customizing file to this file.
+
+For more info see: https://docs.python.org/3/library/site.html
+
+"Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and
+non-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/site-pac... | |
13be4749aef2415ab84ffbd090c5b24d8ed98af5 | tests/TestBloArticle.py | tests/TestBloArticle.py | import unittest
from blo.BloArticle import BloArticle
class TestBloArticle(unittest.TestCase):
def setUp(self):
self.blo_article = BloArticle()
def test_failed_load_from_file(self):
file_path = ""
with self.assertRaises(FileNotFoundError):
self.blo_article.load_from_file(f... | Add test case of BloArticle class | Add test case of BloArticle class
Implement basic test setup, test case of load_from_file method.
| Python | mit | 10nin/blo,10nin/blo | ---
+++
@@ -0,0 +1,23 @@
+import unittest
+from blo.BloArticle import BloArticle
+
+
+class TestBloArticle(unittest.TestCase):
+ def setUp(self):
+ self.blo_article = BloArticle()
+
+ def test_failed_load_from_file(self):
+ file_path = ""
+ with self.assertRaises(FileNotFoundError):
+ ... | |
4442fabf9292efa44a82f420e2d3e807d7d15b04 | tests/test_cli.py | tests/test_cli.py | from click.testing import CliRunner
from tinydb import TinyDB, where
from tinydb.storages import MemoryStorage
import pytest
try:
import mock
except ImportError:
from unittest import mock
from passpie import cli
@pytest.fixture
def mock_db(mocker):
credentials = [
{'login': 'foo', 'name': 'bar', ... | Add more tests to cli | Add more tests to cli
| Python | mit | eiginn/passpie,eiginn/passpie,scorphus/passpie,scorphus/passpie,marcwebbie/passpie,marcwebbie/passpie | ---
+++
@@ -0,0 +1,70 @@
+from click.testing import CliRunner
+from tinydb import TinyDB, where
+from tinydb.storages import MemoryStorage
+import pytest
+try:
+ import mock
+except ImportError:
+ from unittest import mock
+
+from passpie import cli
+
+
+@pytest.fixture
+def mock_db(mocker):
+ credentials = ... | |
436719050ada475d840004a49c693d08c3f92034 | greatbigcrane/project/widgets.py | greatbigcrane/project/widgets.py | from django.forms.widgets import Textarea
from django.utils.safestring import mark_safe
class LineEditorWidget(Textarea):
class Media:
js = ('js/jquery-1.4.2.min.js' ,'js/jquery.lineeditor.js')
def render(self, name, value, attrs=None):
if isinstance(value,list):
value = "\n".join(... | Add a widget for line editors. | Add a widget for line editors.
| Python | apache-2.0 | pnomolos/greatbigcrane,pnomolos/greatbigcrane | ---
+++
@@ -0,0 +1,17 @@
+from django.forms.widgets import Textarea
+from django.utils.safestring import mark_safe
+
+class LineEditorWidget(Textarea):
+ class Media:
+ js = ('js/jquery-1.4.2.min.js' ,'js/jquery.lineeditor.js')
+
+ def render(self, name, value, attrs=None):
+ if isinstance(value,l... | |
6f9d02510ad861bf8ae5ad8f1ae335a4e565756d | tests/test_io.py | tests/test_io.py | from unittest.mock import MagicMock, patch
import pytest
from isort import io
class TestFile:
def test_read(self, tmpdir):
test_file_content = """# -*- encoding: ascii -*-
import ☺
"""
test_file = tmpdir.join("file.py")
test_file.write(test_file_content)
# able to read file eve... | Add initial unit tests for io module | Add initial unit tests for io module
| Python | mit | PyCQA/isort,PyCQA/isort | ---
+++
@@ -0,0 +1,23 @@
+from unittest.mock import MagicMock, patch
+
+import pytest
+
+from isort import io
+
+
+class TestFile:
+ def test_read(self, tmpdir):
+ test_file_content = """# -*- encoding: ascii -*-
+
+import ☺
+"""
+ test_file = tmpdir.join("file.py")
+ test_file.write(test_file... | |
0f32a1e193a0064e5d5313cdc205d15cea71f1e7 | tests/graphics/hipposcalability.py | tests/graphics/hipposcalability.py | import hippo
import gtk
import gobject
from sugar.graphics.icon import CanvasIcon
from sugar.graphics.roundbox import CanvasRoundBox
import common
test = common.Test()
canvas = hippo.Canvas()
test.pack_start(canvas)
canvas.show()
scrollbars = hippo.CanvasScrollbars()
canvas.set_root(scrollbars)
box = hippo.Canvas... | Test for a long hippo scrolling view. | Test for a long hippo scrolling view.
| Python | lgpl-2.1 | sugarlabs/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,tchx84/debian-pkg-sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,sugarlabs/sugar-toolkit,samdroid-apps/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit-gtk3,manuq/sugar-toolkit-gtk3,tchx84/debian-pkg-... | ---
+++
@@ -0,0 +1,48 @@
+import hippo
+import gtk
+import gobject
+
+from sugar.graphics.icon import CanvasIcon
+from sugar.graphics.roundbox import CanvasRoundBox
+
+import common
+
+test = common.Test()
+
+canvas = hippo.Canvas()
+test.pack_start(canvas)
+canvas.show()
+
+scrollbars = hippo.CanvasScrollbars()
+can... | |
288a59cfeade739260a1f76cf632d735677022be | src/test_scores_db.py | src/test_scores_db.py | import scores_db
import mock
import redis_client
import control
from twisted.internet import defer
def test_set_scores():
fake_connection = mock.Mock()
fake_connection.set = mock.Mock()
with mock.patch('redis_client.connection', fake_connection):
scores_db.scores.set_match_score(1, 'ABC', 12)
... | Add the start of some test for the scoring stuff. | Add the start of some test for the scoring stuff.
Change-Id: I7eb7b9176eb9a259d8fac0a99610f4bb3b938a51
| Python | mit | prophile/compd,prophile/compd | ---
+++
@@ -0,0 +1,12 @@
+import scores_db
+import mock
+import redis_client
+import control
+from twisted.internet import defer
+
+def test_set_scores():
+ fake_connection = mock.Mock()
+ fake_connection.set = mock.Mock()
+ with mock.patch('redis_client.connection', fake_connection):
+ scores_db.scor... | |
4fd051fd6d048e64f574097a3ca314111087ee45 | theanets/convolution.py | theanets/convolution.py | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.
A convolutional regression model takes the following inputs during training:
- ``x``: A three-dimensi... | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.'''
INPUT_NDIM = 4
'''Number of dimensions for holding input data arrays.'''
class Classifier(feedfor... | Fix up conv models to match current master. | Fix up conv models to match current master.
| Python | mit | chrinide/theanets,lmjohns3/theanets | ---
+++
@@ -6,47 +6,14 @@
class Regressor(feedforward.Regressor):
- '''A regressor attempts to produce a target output.
+ '''A regressor attempts to produce a target output.'''
- A convolutional regression model takes the following inputs during training:
-
- - ``x``: A three-dimensional array of i... |
457ba730a6541ab27ce8cbe06cbb6bfe246bba74 | towel/api/decorators.py | towel/api/decorators.py | from functools import wraps
import httplib
from django.contrib.auth import authenticate
from django.utils.cache import patch_vary_headers
def http_basic_auth(func):
@wraps(func)
@vary_on_headers('Authorization')
def _decorator(request, *args, **kwargs):
if 'HTTP_AUTHORIZATION' in request.META:
... | Add a simple HTTP Basic Authentication decorator for the API | Add a simple HTTP Basic Authentication decorator for the API
| Python | bsd-3-clause | matthiask/towel,matthiask/towel,matthiask/towel,matthiask/towel | ---
+++
@@ -0,0 +1,27 @@
+from functools import wraps
+import httplib
+
+from django.contrib.auth import authenticate
+from django.utils.cache import patch_vary_headers
+
+
+def http_basic_auth(func):
+ @wraps(func)
+ @vary_on_headers('Authorization')
+ def _decorator(request, *args, **kwargs):
+ if '... | |
b1316b3db89fbee6e6c1ad807e2e36b8b4dd1874 | Attic/act-fixup.py | Attic/act-fixup.py | from parliament.models import *
from django.db import transaction, reset_queries
if True:
with transaction.atomic():
print("Documents %d" % Document.objects.count())
for idx, doc in enumerate(Document.objects.all()):
if idx % 1000 == 0:
reset_queries()
p... | Add a script to fix garbled activities | Add a script to fix garbled activities
| Python | agpl-3.0 | kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu | ---
+++
@@ -0,0 +1,35 @@
+from parliament.models import *
+from django.db import transaction, reset_queries
+
+if True:
+ with transaction.atomic():
+ print("Documents %d" % Document.objects.count())
+
+ for idx, doc in enumerate(Document.objects.all()):
+ if idx % 1000 == 0:
+ ... | |
8bf521bf26af93f13043ee6e0d70070d49f76f68 | Home/cipherMap.py | Home/cipherMap.py | import operator
def checkio(arr):
index = convertMapToTuples(arr[0])
cube = convertCubeToList(arr[1])
output = ''
dimension = len(arr[0])
for i in range(0, 4):
index.sort(key=operator.itemgetter(0, 1))
for idx in index:
output = '{0}{1}'.format(output, cube[idx[0]][idx[1... | Implement the cipher map problem. | Implement the cipher map problem.
| Python | mit | edwardzhu/checkio-solution | ---
+++
@@ -0,0 +1,59 @@
+import operator
+def checkio(arr):
+ index = convertMapToTuples(arr[0])
+ cube = convertCubeToList(arr[1])
+ output = ''
+
+ dimension = len(arr[0])
+ for i in range(0, 4):
+ index.sort(key=operator.itemgetter(0, 1))
+ for idx in index:
+ output = '{0}... | |
e583d977c7089f21841890b7eb50c824db153202 | tests/functional/test_unicode.py | tests/functional/test_unicode.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from textx.metamodel import metamodel_from_str
def test_unicode_grammar_from_string():
"""
Test grammar with unicode char given in grammar string.
"""
grammar = """
First:
'first' a = Second
;
Second:
... | Test for unicode characters in grammars. | Test for unicode characters in grammars.
| Python | mit | igordejanovic/textX,igordejanovic/textX,igordejanovic/textX | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import pytest
+from textx.metamodel import metamodel_from_str
+
+
+def test_unicode_grammar_from_string():
+ """
+ Test grammar with unicode char given in grammar string.
+ """
+
+ grammar = """
+ First:
+ ... | |
dcc64e9fd8bb3cb407959a30a2054fc180596bae | tests/test_pandas_integration.py | tests/test_pandas_integration.py | from unittest import TestCase
import numpy as np
import pandas as pd
import numpy.testing as npt
from nimble import Events
class TestAsPandasCondition(TestCase):
def setUp(self):
conditional_series = pd.Series([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1])
condition = (conditional_series > 0)
sel... | Add Pandas integration unit tests | Add Pandas integration unit tests
| Python | mit | rwhitt2049/nimble,rwhitt2049/trouve | ---
+++
@@ -0,0 +1,39 @@
+from unittest import TestCase
+
+import numpy as np
+import pandas as pd
+import numpy.testing as npt
+
+from nimble import Events
+
+
+class TestAsPandasCondition(TestCase):
+ def setUp(self):
+ conditional_series = pd.Series([0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1])
+ conditio... | |
1696ca33e644d3cb1138d7ee4c48239b7a757cfd | python_scripts/gpio_test.py | python_scripts/gpio_test.py | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
for x in range(0,10):
GPIO.output(7,True)
time.sleep(1)
GPIO.output(7,False)
time.sleep(1)
GPIO.cleanup()
| Add the first script to try a led light | Add the first script to try a led light
| Python | mit | mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp,mirontoli/tolle-rasp | ---
+++
@@ -0,0 +1,10 @@
+import RPi.GPIO as GPIO
+import time
+GPIO.setmode(GPIO.BOARD)
+GPIO.setup(7,GPIO.OUT)
+for x in range(0,10):
+ GPIO.output(7,True)
+ time.sleep(1)
+ GPIO.output(7,False)
+ time.sleep(1)
+GPIO.cleanup() | |
655bf4b4159e70b4a99185a1735ac63c3ee951dc | analysis/filter-by-result-type.py | analysis/filter-by-result-type.py | #!/usr/bin/env python
import argparse
import os
import logging
import pprint
import sys
import yaml
# HACK
_file = os.path.abspath(__file__)
_dir = os.path.dirname(os.path.dirname(_file))
sys.path.insert(0, _dir)
from BoogieRunner.ResultType import ResultType
def main(args):
resultTypes = [ r.name for r in list(R... | Add script to filter result by result type. | Add script to filter result by result type.
| Python | bsd-3-clause | symbooglix/boogie-runner,symbooglix/boogie-runner | ---
+++
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+import argparse
+import os
+import logging
+import pprint
+import sys
+import yaml
+
+# HACK
+_file = os.path.abspath(__file__)
+_dir = os.path.dirname(os.path.dirname(_file))
+sys.path.insert(0, _dir)
+from BoogieRunner.ResultType import ResultType
+
+def main(args):
... | |
bf93b3b4c8965e31e5b9b8ebdbf3f1b1d258e15e | tools/cvs2svn/profile-cvs2svn.py | tools/cvs2svn/profile-cvs2svn.py | #!/usr/bin/env python
#
# Use this script to profile cvs2svn.py using Python's hotshot profiler.
#
# The profile data is stored in cvs2svn.hotshot. To view the data using
# hotshot, run the following in python:
#
# import hotshot.stats
# stats = hotshot.stats.load('cvs2svn.hotshot')
# stats.strip_dirs(... | Add a new script to simplify profiling of cvs2svn.py. Document in the script how to use kcachegrind to view the results. | Add a new script to simplify profiling of cvs2svn.py. Document in the
script how to use kcachegrind to view the results.
* tools/cvs2svn/profile-cvs2svn.py: New script.
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@848715 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,YueLinHo/Subversion,wbond/subversion,wbond/subversion,wbond/subversion,wbond/subversion | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+#
+# Use this script to profile cvs2svn.py using Python's hotshot profiler.
+#
+# The profile data is stored in cvs2svn.hotshot. To view the data using
+# hotshot, run the following in python:
+#
+# import hotshot.stats
+# stats = hotshot.stats.load('cvs2sv... | |
71a6d0a032896f4ef2e9a4cda541d142f2c48171 | typhon/tests/test_environment.py | typhon/tests/test_environment.py | # -*- coding: utf-8 -*-
"""Testing the environment/configuration handler.
"""
import os
from copy import copy
import pytest
from typhon import environment
class TestEnvironment:
"""Testing the environment handler."""
def setup_method(self):
"""Run all test methods with an empty environment."""
... | Add unittests for environment handler. | Add unittests for environment handler.
| Python | mit | atmtools/typhon,atmtools/typhon | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+"""Testing the environment/configuration handler.
+"""
+import os
+from copy import copy
+
+import pytest
+
+from typhon import environment
+
+
+class TestEnvironment:
+ """Testing the environment handler."""
+ def setup_method(self):
+ """Run all test m... | |
d84a0b0d50fb4d01b2a2354d5317afd181f1053c | Regression/RandomForestRegression/regularRandomForestRegression.py | Regression/RandomForestRegression/regularRandomForestRegression.py | # -*- coding: utf-8 -*-
"""Random Forest Regression for machine learning.
Random forest algorithm is a supervised classification algorithm. As the name
suggest, this algorithm creates the forest with a number of decision trees.
In general, the more trees in the forest the more robust the forest looks like.
In the sam... | Add Random Forest Regression in Python | Add Random Forest Regression in Python
| Python | mit | a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms | ---
+++
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+"""Random Forest Regression for machine learning.
+
+Random forest algorithm is a supervised classification algorithm. As the name
+suggest, this algorithm creates the forest with a number of decision trees.
+
+In general, the more trees in the forest the more robust... | |
a152c7c48baa0f1c82e7d84bebbee674eb4f2761 | tilequeue/commands.py | tilequeue/commands.py | from tilequeue.queues import make_sqs_queue
from tilequeue.tile import explode_with_parents
from tilequeue.tile import parse_expired_coord_string
import argparse
import os
def add_aws_cred_options(arg_parser):
arg_parser.add_argument('--aws_access_key_id')
arg_parser.add_argument('--aws_secret_access_key')
... | Add command to queue expired tiles | Add command to queue expired tiles
| Python | mit | tilezen/tilequeue,mapzen/tilequeue | ---
+++
@@ -0,0 +1,76 @@
+from tilequeue.queues import make_sqs_queue
+from tilequeue.tile import explode_with_parents
+from tilequeue.tile import parse_expired_coord_string
+import argparse
+import os
+
+def add_aws_cred_options(arg_parser):
+ arg_parser.add_argument('--aws_access_key_id')
+ arg_parser.add_arg... | |
3e0903ba2f74d5f73241d1ffc5056f2a77c709e0 | tests/test_exports.py | tests/test_exports.py | #!/usr/bin/env python
from django_prometheus.exports import SetupPrometheusEndpointOnPortRange
import unittest
class ExportTest(unittest.TestCase):
def testPortRange(self):
port_range = [8000, 8001]
SetupPrometheusEndpointOnPortRange(port_range)
SetupPrometheusEndpointOnPortRange(port_rang... | Add a simple test for SetupPrometheusEndpointOnPortRange | Add a simple test for SetupPrometheusEndpointOnPortRange
| Python | apache-2.0 | obytes/django-prometheus,korfuri/django-prometheus,obytes/django-prometheus,korfuri/django-prometheus | ---
+++
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+from django_prometheus.exports import SetupPrometheusEndpointOnPortRange
+import unittest
+
+
+class ExportTest(unittest.TestCase):
+ def testPortRange(self):
+ port_range = [8000, 8001]
+ SetupPrometheusEndpointOnPortRange(port_range)
+ SetupPr... | |
7039e4f25d8eecdf2d5d2b4a4a769e05c5075222 | bluebottle/members/migrations/0020_auto_20171031_1048.py | bluebottle/members/migrations/0020_auto_20171031_1048.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-10-31 09:48
from __future__ import unicode_literals
from django.db import migrations
def rename_full_member_permission(apps, schema_editor):
Permission = apps.get_model('auth', 'Permission')
perm = Permission.objects.get(codename='api_read_full_me... | Fix description of 'api_read_full_member' permission | Fix description of 'api_read_full_member' permission
BB-11023 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2017-10-31 09:48
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def rename_full_member_permission(apps, schema_editor):
+ Permission = apps.get_model('auth', 'Permission')
+
+ perm = Permission.... | |
30be74075e761f932a10ea0806a08991b8fd9cb4 | code/python/find-nodes-without-external-id.py | code/python/find-nodes-without-external-id.py | #!/usr/bin/env python
import httplib
import urllib
import json
import ssl
import argparse
import re
parser = argparse.ArgumentParser(description='Find any node that does not have an external ID set.')
parser.add_argument('--target-url', required=True, help='URL for the UpGuard instance. This should be the hostname on... | Add script to list nodes without an external ID | Add script to list nodes without an external ID
| Python | mit | ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content | ---
+++
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+import httplib
+import urllib
+import json
+import ssl
+import argparse
+import re
+
+parser = argparse.ArgumentParser(description='Find any node that does not have an external ID set.')
+parser.add_argument('--target-url', required=True, help='URL for the UpGuard in... | |
14aba0695514866439164f48fe1f66390719431f | scripts/select_gamma.py | scripts/select_gamma.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 18 10:13:48 2013
@author: amnon
### 80 char max please
Look at all the gammaproteobacteria and select candidate contamination sequence
OTUs
output: a list of sorted gammaproteobacteria (or other) otuids, according to
mean frequency
"""
import... | Add selcet_gamma.py (authored by Amnon) | Add selcet_gamma.py (authored by Amnon)
Used in the filtering notebook.
| Python | bsd-3-clause | EmbrietteH/American-Gut,wasade/American-Gut,JWDebelius/American-Gut,mortonjt/American-Gut,wasade/American-Gut,biocore/American-Gut,EmbrietteH/American-Gut,biocore/American-Gut,JWDebelius/American-Gut | ---
+++
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+Created on Fri Oct 18 10:13:48 2013
+
+@author: amnon
+
+### 80 char max please
+
+Look at all the gammaproteobacteria and select candidate contamination sequence
+ OTUs
+output: a list of sorted gammaproteobacteria (or other) otuids, accor... | |
6119f7998d918d3b38f129b7afd720f9a35e35c1 | audio-metadata.py | audio-metadata.py | #! /usr/bin/env python
import os
import sys
import re
import tempfile
def getVideoDetails(filepath):
tmpf = tempfile.NamedTemporaryFile()
os.system("ffmpe... | Add script for fetching metadata from audio file | Add script for fetching metadata from audio file | Python | mit | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | ---
+++
@@ -0,0 +1,36 @@
+#! /usr/bin/env python
+import os
+import sys
+import re
+import tempfile
+
+def getVideoDetails(filepath):
+ tmpf = tempfile.NamedT... | |
98398398f590c3a98733193fc0ea45a1948edd0e | examples/recurrent-text.py | examples/recurrent-text.py | #!/usr/bin/env python
import climate
import matplotlib.pyplot as plt
import numpy as np
import theanets
import utils
climate.enable_default_logging()
COLORS = ['#d62728', '#1f77b4', '#2ca02c', '#9467bd', '#ff7f0e',
'#e377c2', '#8c564b', '#bcbd22', '#7f7f7f', '#17becf']
URL = 'http://www.gutenberg.org/cac... | Add example to compare layers in a char-rnn task. | Add example to compare layers in a char-rnn task.
| Python | mit | lmjohns3/theanets,chrinide/theanets | ---
+++
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+import climate
+import matplotlib.pyplot as plt
+import numpy as np
+import theanets
+
+import utils
+
+climate.enable_default_logging()
+
+COLORS = ['#d62728', '#1f77b4', '#2ca02c', '#9467bd', '#ff7f0e',
+ '#e377c2', '#8c564b', '#bcbd22', '#7f7f7f', '#17bec... | |
248023106d4e881110a646e9d078ecad4f58e24d | pipelogger.py | pipelogger.py | #!/usr/bin/env python
#
import argparse
import os
import syslog
parser = argparse.ArgumentParser(
description='Syslog messages as read from a pipe')
parser.add_argument('-i', '--ident',
help='Use the given identifier for syslogging',
required=True)
parser.add_argument('pipe', help='Pipe file to read log records f... | Add a Python program which reads from a pipe and writes the data it gets to syslog. | Add a Python program which reads from a pipe and writes the data it gets
to syslog.
| Python | bsd-3-clause | tonnerre/pipelogger | ---
+++
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#
+
+import argparse
+import os
+import syslog
+
+parser = argparse.ArgumentParser(
+ description='Syslog messages as read from a pipe')
+
+parser.add_argument('-i', '--ident',
+ help='Use the given identifier for syslogging',
+ required=True)
+parser.add_argument('pip... | |
a61d37449f8000a83942513f2ad71151ef26822d | synapse/tests/test_cells.py | synapse/tests/test_cells.py | import synapse.axon as s_axon
import synapse.cells as s_cells
import synapse.cryotank as s_cryotank
from synapse.tests.common import *
class CellTest(SynTest):
def test_cell_cryo(self):
with self.getTestDir() as dirn:
with s_cells.cryo(dirn) as cryo:
self.isinstance(cryo, s_cr... | Add unit tests for synapse.cells | Add unit tests for synapse.cells
| Python | apache-2.0 | vertexproject/synapse,vivisect/synapse,vertexproject/synapse,vertexproject/synapse | ---
+++
@@ -0,0 +1,17 @@
+import synapse.axon as s_axon
+import synapse.cells as s_cells
+import synapse.cryotank as s_cryotank
+
+from synapse.tests.common import *
+
+class CellTest(SynTest):
+
+ def test_cell_cryo(self):
+ with self.getTestDir() as dirn:
+ with s_cells.cryo(dirn) as cryo:
+ ... | |
a17efdceeeec0932ff403ebeb6f787ea8b08a3a4 | Problems/printLists.py | Problems/printLists.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
test_list_1 = ["puppy", "kitten", "lion cub"]
test_list_2 = ["lettuce",
"bacon",
"turkey",
"mayonnaise",
"tomato",
"white bread"]
pret... | Add print lists function practice problem | Add print lists function practice problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,32 @@
+#!/Applications/anaconda/envs/Python3/bin
+
+
+def main():
+ # Test suite
+ test_list_1 = ["puppy", "kitten", "lion cub"]
+ test_list_2 = ["lettuce",
+ "bacon",
+ "turkey",
+ "mayonnaise",
+ "tomato",
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.