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
29b3402ef9339971005c36057512b2d9916947cb
challenges/01-Intro/test_data_and_variables.py
challenges/01-Intro/test_data_and_variables.py
# This first example lifted from http://pytest.org/latest/getting-started.html def func(x): return x + 1 def test_answer(): assert func(3) == 5
Set up our first exmample challenge
Set up our first exmample challenge Works with py.test or nose, py.test is prettier
Python
apache-2.0
marwahaha/python-fundamentals,marwahaha/python-fundamentals,Destaneon/python-fundamentals,RaoUmer/python-fundamentals,RaoUmer/python-fundamentals,RaoUmer/python-fundamentals,Destaneon/python-fundamentals,marwahaha/python-fundamentals,Destaneon/python-fundamentals
--- +++ @@ -0,0 +1,6 @@ +# This first example lifted from http://pytest.org/latest/getting-started.html +def func(x): + return x + 1 + +def test_answer(): + assert func(3) == 5
53288a2e49e468ced457b821691207565e739118
CodeFights/memoryPills.py
CodeFights/memoryPills.py
#!/usr/local/bin/python # Code Fights Mirror Bits (Core) Problem from itertools import dropwhile def memoryPills(pills): gen = dropwhile(lambda p: len(p) % 2 == 1, pills + [""] * 3) next(gen) return [next(gen) for _ in range(3)] def main(): tests = [ [["Notforgetan", "Antimoron", "Rememberi...
Solve Code Fights memory pills problem
Solve Code Fights memory pills problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,37 @@ +#!/usr/local/bin/python +# Code Fights Mirror Bits (Core) Problem + +from itertools import dropwhile + + +def memoryPills(pills): + gen = dropwhile(lambda p: len(p) % 2 == 1, pills + [""] * 3) + next(gen) + return [next(gen) for _ in range(3)] + + +def main(): + tests = [ + ...
7dcba6a8be7bd87dd377bd3f99e8e2293bb6632d
django/santropolFeast/member/migrations/0008_auto_20160727_2251.py
django/santropolFeast/member/migrations/0008_auto_20160727_2251.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-27 22:51 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('member', '0007_auto_20160726_1703'), ] operations = [ migrations.RenameField( ...
Add missing migration file for latitude and longitude
Add missing migration file for latitude and longitude
Python
agpl-3.0
madmath/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,madmath/sous-chef,savoirfairelinux/sous-chef,savoirfairelinux/santropol-feast,savoirfairelinux/sous-chef
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-27 22:51 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('member', '0007_auto_20160726_1703'), + ] + + operations =...
cec23490209e952d1b9b764714cf950108443d2c
ovp_users/migrations/0013_auto_20170208_2118.py
ovp_users/migrations/0013_auto_20170208_2118.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-08 21:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ovp_users', '0012_merge_20170112_2144'), ] operations = [ migrations.AlterF...
Add missing migration for last commit
Add missing migration for last commit
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-users,OpenVolunteeringPlatform/django-ovp-users
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-02-08 21:18 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ovp_users', '0012_merge_20170112_2144'), + ] + + ...
3517787a7e9c18ec2088bf0a58913ea99ce94fb1
tests/test_template_newrequest.py
tests/test_template_newrequest.py
import testing as T class NewRequestTemplateTest(T.TemplateTestCase): authenticated = True newrequest_page = 'modules/newrequest.html' form_elements = ['title', 'tags', 'review', 'repo', 'branch', 'description', 'comments', 'watchers'] def test_request_form_labels(self): tree = self.render_e...
Add test for labels/inputs in newrequest form
Add test for labels/inputs in newrequest form
Python
apache-2.0
bis12/pushmanager,asottile/pushmanager,imbstack/pushmanager,asottile/pushmanager,bchess/pushmanager,bis12/pushmanager,imbstack/pushmanager,Yelp/pushmanager,bis12/pushmanager,bchess/pushmanager,imbstack/pushmanager,YelpArchive/pushmanager,Yelp/pushmanager,YelpArchive/pushmanager,Yelp/pushmanager,asottile/pushmanager,Yel...
--- +++ @@ -0,0 +1,42 @@ +import testing as T + +class NewRequestTemplateTest(T.TemplateTestCase): + + authenticated = True + newrequest_page = 'modules/newrequest.html' + + form_elements = ['title', 'tags', 'review', 'repo', 'branch', 'description', 'comments', 'watchers'] + + def test_request_form_label...
3133469874da37afcbf6e75d9afec4daae7a4c9e
scikits/learn/benchmarks/bench_plot_balltree.py
scikits/learn/benchmarks/bench_plot_balltree.py
from scikits.learn.BallTree import BallTree, knn_brute import numpy as np from time import time from scipy.spatial import cKDTree import sys import pylab as pl def compare_nbrs(nbrs1,nbrs2): assert nbrs1.shape == nbrs2.shape if(nbrs1.ndim == 2): N,k = nbrs1.shape for i in range(N): ...
Add another balltree benchmark, this time with plot interface.
Add another balltree benchmark, this time with plot interface. git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@598 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
Python
bsd-3-clause
YinongLong/scikit-learn,Barmaley-exe/scikit-learn,larsmans/scikit-learn,maheshakya/scikit-learn,marcocaccin/scikit-learn,jblackburne/scikit-learn,xwolf12/scikit-learn,alvarofierroclavero/scikit-learn,mikebenfield/scikit-learn,jakobworldpeace/scikit-learn,yyjiang/scikit-learn,jorge2703/scikit-learn,trungnt13/scikit-lear...
--- +++ @@ -0,0 +1,58 @@ + +from scikits.learn.BallTree import BallTree, knn_brute +import numpy as np +from time import time + +from scipy.spatial import cKDTree +import sys +import pylab as pl + +def compare_nbrs(nbrs1,nbrs2): + assert nbrs1.shape == nbrs2.shape + if(nbrs1.ndim == 2): + N,k = nbrs1.sha...
ce9434314fb4851e1573270d9b6a07d88d521ca1
awx/main/management/commands/tower_version.py
awx/main/management/commands/tower_version.py
# Copyright (c) 2014 Ansible, Inc. # All Rights Reserved from django.core.management.base import BaseCommand from awx import __version__ as tower_version class Command(BaseCommand): help = 'Emit the Tower version and exit' def handle(self, *args, **options): self.stdout.write(tower_version)
Add a metadata file to the tower home directory that lists the version of Tower
Add a metadata file to the tower home directory that lists the version of Tower
Python
apache-2.0
wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx
--- +++ @@ -0,0 +1,13 @@ +# Copyright (c) 2014 Ansible, Inc. +# All Rights Reserved + +from django.core.management.base import BaseCommand + +from awx import __version__ as tower_version + +class Command(BaseCommand): + + help = 'Emit the Tower version and exit' + + def handle(self, *args, **options): + ...
53eec0789a13014a65fd3151f17f4dead1ef1684
{{cookiecutter.repo_name}}/tests/test_i18n.py
{{cookiecutter.repo_name}}/tests/test_i18n.py
# -*- coding: utf-8 -*- def test_switch_language(app): test_label = app.carousel.slides[1].children[1] english_text = ( "This app uses Kivy, a Python Framework for NUI Development." ) assert test_label.text == english_text app.on_config_change(app.config, 'user_settings', 'language', 'de...
Add another test for switching the language of the app
Add another test for switching the language of the app
Python
mit
hackebrot/cookiedozer,hackebrot/cookiedozer
--- +++ @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + + +def test_switch_language(app): + test_label = app.carousel.slides[1].children[1] + + english_text = ( + "This app uses Kivy, a Python Framework for NUI Development." + ) + assert test_label.text == english_text + + app.on_config_change(app.c...
07289743a6324b76c94b423720d5b12944078d81
tests/test_irc_formatter.py
tests/test_irc_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import print_function import io import os import re import unittest import tempfile fr...
Add basic test for irc formatter
Add basic test for irc formatter
Python
bsd-2-clause
aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygmen...
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" + Pygments HTML formatter tests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from __future__ import print_function + +import io +import os +imp...
873f21b6ef730d3367bb8ccf5624693d1c6b5a64
bin/jshelper.py
bin/jshelper.py
#!/usr/bin/env python from __future__ import print_function, unicode_literals import os import sys import uuid from datetime import timedelta from aspen.utils import utcnow import gratipay from gratipay import wireup from gratipay.models.participant import Participant if len(sys.argv) < 2: sys.exit('Usage: ...
Add helper for JS tests
Add helper for JS tests
Python
mit
gratipay/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,studio666/gratipay.com,eXcomm/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,eXcomm/gratipay.com,eXcomm/gratipay.com,mccolgst/ww...
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +from __future__ import print_function, unicode_literals + +import os +import sys +import uuid + +from datetime import timedelta + +from aspen.utils import utcnow + +import gratipay + +from gratipay import wireup +from gratipay.models.participant import Participant + ...
ff626b328043ec4df86366bc65cf73901529d9d8
bin/json2gpx.py
bin/json2gpx.py
#!/usr/bin/env python """Convert JSON from Google Takeout to GPX""" import json import os import time import argparse def write_gpx(filep, locations): """Write locations as GPX to filep.""" filep.write( '<?xml version="1.0" encoding="UTF-8"?>\n' '<gpx creator="json2gpx" version="0.1" xmlns="htt...
Add script to convert JSON from Google to GPX
Add script to convert JSON from Google to GPX
Python
mit
jaantoots/dotfiles,jaantoots/dotfiles,jaantoots/dotfiles
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +"""Convert JSON from Google Takeout to GPX""" +import json +import os +import time +import argparse + +def write_gpx(filep, locations): + """Write locations as GPX to filep.""" + filep.write( + '<?xml version="1.0" encoding="UTF-8"?>\n' + '<gpx crea...
6e46df3721137df511801e12178174ecc8566230
python/strip_trailing_whitespace.py
python/strip_trailing_whitespace.py
#!/usr/bin/python from convert_line_endings import convert_line_endings import os import re import sys def strip_trailing_whitespace(file): with open(file, mode='rt') as infile: lines = infile.readlines() with open(file, mode='wt') as outfile: for line in lines: stripped = re.sub('[ \t]+$', '', line...
Add Python utility function to strip trailing whitespace from .cs files. On Windows, this will also convert line endings, because of the way that Python will always write a text file with platform line endings
[trunk] Add Python utility function to strip trailing whitespace from .cs files. On Windows, this will also convert line endings, because of the way that Python will always write a text file with platform line endings
Python
bsd-3-clause
markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation,markfinal/BuildAMation
--- +++ @@ -0,0 +1,29 @@ +#!/usr/bin/python + +from convert_line_endings import convert_line_endings +import os +import re +import sys + +def strip_trailing_whitespace(file): + with open(file, mode='rt') as infile: + lines = infile.readlines() + with open(file, mode='wt') as outfile: + for line in lines: + ...
7b994e73816b1d2ff08a4eb26f06404d7851e5bb
profiling/replay_buffers.py
profiling/replay_buffers.py
from unittest.mock import Mock import time from os.path import expanduser from tqdm import tqdm from avalanche.benchmarks import fixed_size_experience_split, SplitMNIST from avalanche.training import ReservoirSamplingBuffer from avalanche.training import ParametricBuffer benchmark = SplitMNIST( n_experiences=5,...
ADD profiling script for replay buffer (OCL benchmarking)
ADD profiling script for replay buffer (OCL benchmarking)
Python
mit
ContinualAI/avalanche,ContinualAI/avalanche
--- +++ @@ -0,0 +1,37 @@ +from unittest.mock import Mock + +import time +from os.path import expanduser + +from tqdm import tqdm + +from avalanche.benchmarks import fixed_size_experience_split, SplitMNIST +from avalanche.training import ReservoirSamplingBuffer +from avalanche.training import ParametricBuffer + +bench...
62601372edf68882bd2a868d2ac3c1fb19dbc75b
comics/crawler/crawlers/gws.py
comics/crawler/crawlers/gws.py
from comics.crawler.base import BaseComicCrawler from comics.crawler.meta import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Girls With Slingshots' language = 'en' url = 'http://www.girlswithslingshot.com/' start_date = '2004-09-30' history_capable_days = 1 schedule = 'Mo,Tu,We,Th,Fr'...
Add crawler for 'Girls With Slingshots'
Add crawler for 'Girls With Slingshots'
Python
agpl-3.0
datagutten/comics,klette/comics,klette/comics,klette/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics
--- +++ @@ -0,0 +1,22 @@ +from comics.crawler.base import BaseComicCrawler +from comics.crawler.meta import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Girls With Slingshots' + language = 'en' + url = 'http://www.girlswithslingshot.com/' + start_date = '2004-09-30' + history_capable_days...
4ca0db457ea9d38d0d151470b53f729978c95fa8
sli/config/scripts/sharding/binary-to-string.py
sli/config/scripts/sharding/binary-to-string.py
import sys import re import json import base64 from binascii import a2b_base64,hexlify # cd sli/acceptance-tests # find . -name *.json | xargs -I file python ~/wgen/SLI/sli/config/scripts/sharding/binary-to-string.py file fixture_lines = [] if len(sys.argv) == 2: fixture_file = open(sys.argv[1]) fixture_line...
Add script to convert binary UUIDs in fixture data to strings.
Add script to convert binary UUIDs in fixture data to strings.
Python
apache-2.0
inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service,inbloom/secure-data-service
--- +++ @@ -0,0 +1,40 @@ +import sys +import re +import json +import base64 +from binascii import a2b_base64,hexlify + +# cd sli/acceptance-tests +# find . -name *.json | xargs -I file python ~/wgen/SLI/sli/config/scripts/sharding/binary-to-string.py file + +fixture_lines = [] + +if len(sys.argv) == 2: + fixture_f...
adab4c914d759f84731bc736fc9afe9862f8222e
tests/backends/gstreamer.py
tests/backends/gstreamer.py
import unittest from mopidy.backends.gstreamer import GStreamerBackend from tests.backends import (BasePlaybackControllerTest, BaseCurrentPlaylistControllerTest) class GStreamerCurrentPlaylistHandlerTest(BaseCurrentPlaylistControllerTest, unittest.TestCase): uri = ['file://data/song1....
import unittest from mopidy.backends.gstreamer import GStreamerBackend from tests.backends import (BasePlaybackControllerTest, BaseCurrentPlaylistControllerTest) class GStreamerCurrentPlaylistHandlerTest(BaseCurrentPlaylistControllerTest, unittest.TestCase): uris = ['file://data/song1...
Fix typo in GStreamer test
Fix typo in GStreamer test
Python
apache-2.0
woutervanwijk/mopidy,hkariti/mopidy,quartz55/mopidy,woutervanwijk/mopidy,swak/mopidy,vrs01/mopidy,vrs01/mopidy,tkem/mopidy,jmarsik/mopidy,kingosticks/mopidy,swak/mopidy,mokieyue/mopidy,kingosticks/mopidy,bacontext/mopidy,glogiotatidis/mopidy,priestd09/mopidy,mokieyue/mopidy,ali/mopidy,hkariti/mopidy,mokieyue/mopidy,tke...
--- +++ @@ -6,7 +6,7 @@ BaseCurrentPlaylistControllerTest) class GStreamerCurrentPlaylistHandlerTest(BaseCurrentPlaylistControllerTest, unittest.TestCase): - uri = ['file://data/song1.mp3', + uris = ['file://data/song1.mp3', 'file://data/song2.mp3', 'file:...
afd7ca3f2ac5bdbda088e8fefd334bfde102ee55
soccerway/concat_matches.py
soccerway/concat_matches.py
# -*- coding: utf-8 -*- import glob, os, sys import pandas as pd d = '/home/tvl/dev/scrapy-soccerway/soccerway/data/h/' frames = [] os.chdir(d) print('Read csv files:') for f in glob.glob("matches*.csv"): print(f) frames.append(pd.read_csv(d+f)) df = pd.concat(frames) df.set_index('id', inplace=True) d...
Concatenate historical matches csv files
Concatenate historical matches csv files
Python
apache-2.0
tvl/scrapy-soccerway
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +import glob, os, sys +import pandas as pd +d = '/home/tvl/dev/scrapy-soccerway/soccerway/data/h/' +frames = [] +os.chdir(d) +print('Read csv files:') +for f in glob.glob("matches*.csv"): + print(f) + frames.append(pd.read_csv(d+f)) +df = pd.concat(fra...
afb4e246e904c4586ef3df13eca019350b481b35
utils/auth/backends/ldap.py
utils/auth/backends/ldap.py
from django_auth_ldap.backend import LDAPBackend from utils.auth.backends import get_or_create_user class MultiLDAPBackend(LDAPBackend): def get_or_create_user(self, username, ldap_user): backend = self.__module__ + "." + self.__class__.__name__ return get_or_create_user(backend, username)
Add an LDAP backend using the authentication data table
auth: Add an LDAP backend using the authentication data table
Python
bsd-3-clause
Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia,Inter-Actief/alexia
--- +++ @@ -0,0 +1,8 @@ +from django_auth_ldap.backend import LDAPBackend +from utils.auth.backends import get_or_create_user + + +class MultiLDAPBackend(LDAPBackend): + def get_or_create_user(self, username, ldap_user): + backend = self.__module__ + "." + self.__class__.__name__ + return get_or_crea...
d808b1188da8f3bcfb01738677a18d6b0c386a37
percept-proto/workflows/commands/list_tasks.py
percept-proto/workflows/commands/list_tasks.py
""" List all available tasks """ from management.commands import BaseCommand from utils.registry import registry, find_in_registry from utils.models import get_task_name import logging log = logging.getLogger(__name__) class Command(BaseCommand): args = '' def command(self, *args, **options): print ...
Add command to list available tasks and help
Add command to list available tasks and help
Python
apache-2.0
VikParuchuri/percept,VikParuchuri/percept
--- +++ @@ -0,0 +1,24 @@ +""" +List all available tasks +""" + +from management.commands import BaseCommand +from utils.registry import registry, find_in_registry +from utils.models import get_task_name + +import logging +log = logging.getLogger(__name__) + +class Command(BaseCommand): + args = '' + + def comma...
672027dce8a452f15847963bfa36df035bca2d14
vrtracking.py
vrtracking.py
import sys import time import openvr openvr.init(openvr.VRApplication_Scene) poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount poses = poses_t() while True: openvr.VRCompositor().waitGetPoses(poses, len(poses), None, 0) hmd_pose = poses[openvr.k_unTrackedDeviceIndex_Hmd] #print(hmd_...
Add file for tracking Vive data
Add file for tracking Vive data The data includes position, pitch, yaw and roll for the HMD and controllers
Python
mit
EiT-VR-2017-Gruppe-2/EV3-code
--- +++ @@ -0,0 +1,30 @@ +import sys +import time +import openvr + +openvr.init(openvr.VRApplication_Scene) + +poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount +poses = poses_t() + +while True: + openvr.VRCompositor().waitGetPoses(poses, len(poses), None, 0) + hmd_pose = poses[openvr.k_un...
f1a27644e32291d24171f97e3b8dae6b7490966d
94/Solution.py
94/Solution.py
class Solution: def inorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ if root is None: return [] else: return list(self.inorderTraversalGen(root)) def inorderTraversalGen(self, node): if node.left is not ...
Add binary tree inorder traversal
Add binary tree inorder traversal
Python
mit
xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode,xliiauo/leetcode,xiao0720/leetcode
--- +++ @@ -0,0 +1,21 @@ +class Solution: + def inorderTraversal(self, root): + """ + :type root: TreeNode + :rtype: List[int] + """ + if root is None: + return [] + else: + return list(self.inorderTraversalGen(root)) + + def inorderTraversalGen(se...
58ab8c317c71aa2c5fc8d47d2bb9e4778290482e
bayespy/inference/vmp/nodes/tests/test_beta.py
bayespy/inference/vmp/nodes/tests/test_beta.py
###################################################################### # Copyright (C) 2014 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ####################...
Add unit tests for Beta node
TST: Add unit tests for Beta node
Python
mit
fivejjs/bayespy,SalemAmeen/bayespy,bayespy/bayespy,jluttine/bayespy
--- +++ @@ -0,0 +1,106 @@ +###################################################################### +# Copyright (C) 2014 Jaakko Luttinen +# +# This file is licensed under Version 3.0 of the GNU General Public +# License. See LICENSE for a text of the license. +##########################################################...
82345a988dfcfe468f1624ac12252cf1136cf8b1
core/templatetags/canedit.py
core/templatetags/canedit.py
import datetime from django import template register = template.Library() @register.filter() def can_edit(vote_or_vs, user): return vote_or_vs.canEdit(user)
Add template tag to check edit permission on votes and voting systems
Add template tag to check edit permission on votes and voting systems
Python
mit
kuboschek/jay,kuboschek/jay,OpenJUB/jay,OpenJUB/jay,kuboschek/jay,OpenJUB/jay
--- +++ @@ -0,0 +1,8 @@ +import datetime +from django import template + +register = template.Library() + +@register.filter() +def can_edit(vote_or_vs, user): + return vote_or_vs.canEdit(user)
daa110457cf11d8b6f6d0d30dd656388bf942509
clear-all-rate-limits/clear_all_rate_limits.py
clear-all-rate-limits/clear_all_rate_limits.py
""" Clears all user-defined rate limits for all projects in an account Use with an account access token that has scopes 'read' and 'write' Usage: python clear_all_rate_limits.py YOUR_ACCOUNT_ACCESS_TOKEN """ from __future__ import print_function import sys from pprint import pprint import requests def main(): ...
Add script to clear all user-defined rate limits within an account
Add script to clear all user-defined rate limits within an account
Python
mit
rollbar/api-examples,rollbar/api-examples,rollbar/api-examples
--- +++ @@ -0,0 +1,69 @@ +""" +Clears all user-defined rate limits for all projects in an account + +Use with an account access token that has scopes 'read' and 'write' + +Usage: + +python clear_all_rate_limits.py YOUR_ACCOUNT_ACCESS_TOKEN +""" + +from __future__ import print_function + +import sys +from pprint impor...
4f7af6fc11e529ffd2dd81690797a913163bea5f
warehouse/database/types.py
warehouse/database/types.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import re from sqlalchemy.types import SchemaType, TypeDecorator from sqlalchemy.types import Enum as SQLAEnum class EnumSymbol(object): """ Define a fixed symbol tied to a parent class. """ ...
Add an Enum type that is in Python as well as SQL
Add an Enum type that is in Python as well as SQL
Python
bsd-2-clause
davidfischer/warehouse
--- +++ @@ -0,0 +1,103 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import unicode_literals + +import re + +from sqlalchemy.types import SchemaType, TypeDecorator +from sqlalchemy.types import Enum as SQLAEnum + + +class EnumSymbol(object): + """ + Define a fixed ...
e46e512fad9bc92c1725711e2800e44bb699d281
deploy/mirrors/greasyfork.py
deploy/mirrors/greasyfork.py
from mechanize import Browser def exec_(config, summary, script): USERNAME = config['USERNAME'] PASSWORD = config['PASSWORD'] SCRIPT_ID = config['SCRIPT_ID'] LOGIN_URL = 'https://greasyfork.org/users/sign_in' EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID) b = ...
from mechanize import Browser def exec_(config, summary, script): USERNAME = config['USERNAME'] PASSWORD = config['PASSWORD'] SCRIPT_ID = config['SCRIPT_ID'] LOGIN_URL = 'https://greasyfork.org/users/sign_in' EDIT_URL = 'https://greasyfork.org/scripts/{0}/versions/new'.format(SCRIPT_ID) b = ...
Fix Greasy Fork deploy script.
Fix Greasy Fork deploy script.
Python
bsd-2-clause
MNBuyskih/adsbypasser,tablesmit/adsbypasser,xor10/adsbypasser,kehugter/adsbypasser,tosunkaya/adsbypasser,xor10/adsbypasser,MNBuyskih/adsbypasser,tablesmit/adsbypasser,kehugter/adsbypasser,kehugter/adsbypasser,tablesmit/adsbypasser,xor10/adsbypasser,tosunkaya/adsbypasser,MNBuyskih/adsbypasser,tosunkaya/adsbypasser
--- +++ @@ -13,15 +13,16 @@ # login b.open(LOGIN_URL) - b.select_form(nr=1) + b.select_form(nr=2) b['user[email]'] = USERNAME b['user[password]'] = PASSWORD b.submit() # edit source b.open(EDIT_URL) - b.select_form(nr=1) + b.select_form(nr=2) b['script_version[a...
4d0725218ad613451917ee34849f646982bcae59
tools/metrics/histograms/histogram_ownership.py
tools/metrics/histograms/histogram_ownership.py
#!/usr/bin/env python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A simple tool to go through histograms.xml and print out the owners for histograms. """ import xml.etree.ElementTree DUMMY_OWNER =...
Add a script to print out histogram ownership.
Metrics: Add a script to print out histogram ownership. NOTRY=true Review URL: https://codereview.chromium.org/456943002 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@288484 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
bright-sparks/chromium-spacewalk,ondra-novak/chromium.src,littlstar/chromium.src,ondra-novak/chromium.src,ondra-novak/chromium.src,bright-sparks/chromium-spacewalk,bright-sparks/chromium-spacewalk,littlstar/chromium.src,ondra-novak/chromium.src,littlstar/chromium.src,ondra-novak/chromium.src,ondra-novak/chromium.src,on...
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A simple tool to go through histograms.xml and print out the owners for +histograms. +""" + +import...
7c95f3ec58751b71d10b96621ec401a9549b3216
data_log/migrations/0018_auto_20190909_2004.py
data_log/migrations/0018_auto_20190909_2004.py
# Generated by Django 2.1.11 on 2019-09-10 03:04 from django.db import migrations from django.db.models import F def delete_unowned_raid_drops(apps, schema_editor): RiftRaidItemDrop = apps.get_model('data_log', 'RiftRaidItemDrop') RiftRaidMonsterDrop = apps.get_model('data_log', 'RiftRaidMonsterDrop') Ri...
Remove drops from raid logs that are not owned by the user submitting the logs
Remove drops from raid logs that are not owned by the user submitting the logs
Python
apache-2.0
porksmash/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm,porksmash/swarfarm,porksmash/swarfarm,PeteAndersen/swarfarm,PeteAndersen/swarfarm,PeteAndersen/swarfarm
--- +++ @@ -0,0 +1,28 @@ +# Generated by Django 2.1.11 on 2019-09-10 03:04 + +from django.db import migrations +from django.db.models import F + + +def delete_unowned_raid_drops(apps, schema_editor): + RiftRaidItemDrop = apps.get_model('data_log', 'RiftRaidItemDrop') + RiftRaidMonsterDrop = apps.get_model('data...
56396f980236f6d909f63d7faaddd357f5fe235b
stock_quant_merge/models/stock.py
stock_quant_merge/models/stock.py
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, api class StockQuant(model...
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, api class StockQuant(model...
Use browse record instead of ids
[MOD] Use browse record instead of ids
Python
agpl-3.0
InakiZabala/odoomrp-wip,Eficent/odoomrp-wip,diagramsoftware/odoomrp-wip,jobiols/odoomrp-wip,Antiun/odoomrp-wip,factorlibre/odoomrp-wip,raycarnes/odoomrp-wip,Daniel-CA/odoomrp-wip-public,esthermm/odoomrp-wip,odoomrp/odoomrp-wip,Daniel-CA/odoomrp-wip-public,odoomrp/odoomrp-wip,oihane/odoomrp-wip,jobiols/odoomrp-wip,odooc...
--- +++ @@ -11,9 +11,9 @@ @api.multi def merge_stock_quants(self): - pending_quants_ids = self.ids + pending_quants = self.filtered(lambda x: True) for quant2merge in self: - if (quant2merge.id in pending_quants_ids and + if (quant2merge in pending_quants and ...
8ab1e018319fc7fc3837f1d8d1dd59a0dc3f2eb5
tests/compiler/test_conditional_compilation.py
tests/compiler/test_conditional_compilation.py
from tests.compiler import compile_snippet, STATIC_START, internal_call from thinglang.compiler.opcodes import OpcodePushStatic, OpcodeJumpConditional, OpcodeJump PREFIX = [ OpcodePushStatic(STATIC_START), OpcodePushStatic(STATIC_START + 1), internal_call('text.__equals__'), ] def test_simple_conditional(...
Add test for conditional compilation
Add test for conditional compilation
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -0,0 +1,22 @@ +from tests.compiler import compile_snippet, STATIC_START, internal_call +from thinglang.compiler.opcodes import OpcodePushStatic, OpcodeJumpConditional, OpcodeJump + +PREFIX = [ + OpcodePushStatic(STATIC_START), + OpcodePushStatic(STATIC_START + 1), + internal_call('text.__equals__'...
60dd5e0c333b4631db392745ddcdab23b95f4da0
tensor2tensor/data_generators/genetics_test.py
tensor2tensor/data_generators/genetics_test.py
# Copyright 2017 The Tensor2Tensor 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 applicable law or agreed ...
Add tests for genetics problems
Add tests for genetics problems PiperOrigin-RevId: 162569505
Python
apache-2.0
waterblue13/tensor2tensor,rsepassi/tensor2tensor,waterblue13/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,vthorsteinsson/tensor2tensor,rsepassi/tensor2tensor,tensorflow/tensor2tensor,waterblue13/tensor2tensor,vthorsteinsson/tensor2tensor,rsepassi/tensor2tensor,vthorsteinsson/...
--- +++ @@ -0,0 +1,65 @@ +# Copyright 2017 The Tensor2Tensor 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 r...
7ebd68fab54ae697bd3da04704102ed77b387460
testapp/testapp/testmain/tests/test_parsers.py
testapp/testapp/testmain/tests/test_parsers.py
from datetime import date, datetime import pytz from django.test import TestCase from django_afip import parsers class ParseDatetimeTestCase(TestCase): def test_parse_null(self): self.assertEqual(parsers.parse_datetime('NULL'), None) def test_parse_none(self): self.assertEqual(parsers.parse...
Add tests for parse_date and parse_datetime
Add tests for parse_date and parse_datetime
Python
isc
hobarrera/django-afip,hobarrera/django-afip
--- +++ @@ -0,0 +1,35 @@ +from datetime import date, datetime + +import pytz +from django.test import TestCase + +from django_afip import parsers + + +class ParseDatetimeTestCase(TestCase): + def test_parse_null(self): + self.assertEqual(parsers.parse_datetime('NULL'), None) + + def test_parse_none(self)...
790230b4a1ad5f2550def7762c723abbd69d743d
data/migrations/0002_auto_20170413_1553.py
data/migrations/0002_auto_20170413_1553.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-13 13:53 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('data', '0001_initial'), ] operations = [ migrations.AlterField( ...
Increase limit on data log model for larger urls
Increase limit on data log model for larger urls
Python
agpl-3.0
MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-04-13 13:53 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('data', '0001_initial'), + ] + + operations = [ +...
f5ce04adcce0de23fb156e8dc410379a29467a10
api-reader/smartvel_tests.py
api-reader/smartvel_tests.py
from threading import Thread from rx import Observable from APIReaderSmartvel import APIReaderSmartvel events = Observable.from_(APIReaderSmartvel().get_iterable()) # Verify that all the following regions have events REGIONS = ( 'Barcelona', 'Málaga', 'Palma de Mallorca' ) # Filters def has_place(elem...
Implement one of Smartvel's tests using APIReaderSmartvel.
Implement one of Smartvel's tests using APIReaderSmartvel.
Python
mit
Pysellus/streaming-api-test,Pysellus/streaming-api-test
--- +++ @@ -0,0 +1,44 @@ +from threading import Thread + +from rx import Observable + +from APIReaderSmartvel import APIReaderSmartvel + +events = Observable.from_(APIReaderSmartvel().get_iterable()) + + +# Verify that all the following regions have events +REGIONS = ( + 'Barcelona', + 'Málaga', + 'Palma de ...
16c95be97c55e1c678d7b47f401fbe499faaccf7
all-domains/tutorials/cracking-the-coding-interview/hash-tables-ransom-note/solution.py
all-domains/tutorials/cracking-the-coding-interview/hash-tables-ransom-note/solution.py
# https://www.hackerrank.com/challenges/ctci-ransom-note # Python 3 def create_word_dictionary(word_list): word_dictionary = {} for word in word_list: if word not in word_dictionary: word_dictionary[word] = 1 else: word_dictionary[word] += 1 return word_dictionary d...
Implement code to determine if a ransom note can be constructed from a magazine
Implement code to determine if a ransom note can be constructed from a magazine https://www.hackerrank.com/challenges/ctci-ransom-note
Python
mit
arvinsim/hackerrank-solutions
--- +++ @@ -0,0 +1,38 @@ +# https://www.hackerrank.com/challenges/ctci-ransom-note +# Python 3 + +def create_word_dictionary(word_list): + word_dictionary = {} + for word in word_list: + if word not in word_dictionary: + word_dictionary[word] = 1 + else: + word_dictionary[wor...
f553451358eca914afa45abb6e6a3a02669df6ec
unicornclient/mock/explorerhat.py
unicornclient/mock/explorerhat.py
# pylint: disable=W1201,C0103 import logging class _Motor: def __init__(self, name=None): self.name = name if not name: self.name = 'all' self.one = _Motor('one') self.two = _Motor('two') def invert(self): logging.debug(self.name + ' invert') d...
Add explorer phat motor functions mock
Add explorer phat motor functions mock
Python
mit
amm0nite/unicornclient,amm0nite/unicornclient
--- +++ @@ -0,0 +1,28 @@ +# pylint: disable=W1201,C0103 + +import logging + +class _Motor: + def __init__(self, name=None): + self.name = name + if not name: + self.name = 'all' + self.one = _Motor('one') + self.two = _Motor('two') + + def invert(self): + lo...
1aa64e9d29cd191e5790afca4852e96678d3845e
raiden/tests/integration/test_snapshotting.py
raiden/tests/integration/test_snapshotting.py
# -*- coding: utf-8 -*- import pytest from ethereum import slogging from raiden.api.python import RaidenAPI log = slogging.get_logger(__name__) @pytest.mark.parametrize('number_of_nodes', [3]) @pytest.mark.parametrize('number_of_tokens', [1]) @pytest.mark.parametrize('channels_per_node', [1]) @pytest.mark.parametr...
Add test for restart restore behavior
Add test for restart restore behavior
Python
mit
hackaugusto/raiden,tomashaber/raiden,tomashaber/raiden,tomashaber/raiden,tomashaber/raiden,tomashaber/raiden,hackaugusto/raiden
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +import pytest + +from ethereum import slogging + +from raiden.api.python import RaidenAPI + +log = slogging.get_logger(__name__) + + +@pytest.mark.parametrize('number_of_nodes', [3]) +@pytest.mark.parametrize('number_of_tokens', [1]) +@pytest.mark.parametrize('channe...
c56b012547a17bd61e67fa0c14444dd31c9a0b44
scripts/set_pokemon_order.py
scripts/set_pokemon_order.py
#!/usr/bin/env python2 import sqlite3 conn = sqlite3.connect("pokedex/data/pokedex.sqlite") cur = conn.execute( """select p.id, p.name, pf.name from pokemon p join evolution_chains ec on p.evolution_chain_id = ec.id left join pokemon_forms pf on p.id = pf.unique_pokemon_id order by ec.id, is_baby...
Add a script for setting pokemon.order
Add a script for setting pokemon.order
Python
mit
veekun/pokedex,RK905/pokedex-1,veekun/pokedex,xfix/pokedex,DaMouse404/pokedex,mschex1/pokedex
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python2 + +import sqlite3 + +conn = sqlite3.connect("pokedex/data/pokedex.sqlite") + +cur = conn.execute( + """select p.id, p.name, pf.name + from pokemon p + join evolution_chains ec on p.evolution_chain_id = ec.id + left join pokemon_forms pf on p.id = pf.unique_...
93fc93dd99af3ae2595096babc60291299826f4b
ALE/build_gene_fams_from_eggnogmapper_output.py
ALE/build_gene_fams_from_eggnogmapper_output.py
import os, re, sys fams = {} #read in the output of EggNOG mapper, then make protein families out of sequences which map to the same set of COG/KOG functional categories inh = open("Para_sacc.fasta.emapper.annotations") for line in inh: fields = re.split("\t", line.rstrip()) #print fields[-4] cogs = re.sp...
Create gene families based on eggNOG 5 annotation
Create gene families based on eggNOG 5 annotation
Python
mit
Tancata/phylo,Tancata/phylo
--- +++ @@ -0,0 +1,43 @@ +import os, re, sys + +fams = {} + +#read in the output of EggNOG mapper, then make protein families out of sequences which map to the same set of COG/KOG functional categories +inh = open("Para_sacc.fasta.emapper.annotations") +for line in inh: + fields = re.split("\t", line.rstrip()) + ...
add67e63dd30a633bcd89db5c7908a6c9eefc059
qtpy/tests/test_qdesktopservice_split.py
qtpy/tests/test_qdesktopservice_split.py
from __future__ import absolute_import import pytest from qtpy.QtCore import QStandardPaths from qtpy.QtGui import QDesktopServices """Test QDesktopServices split in Qt5.""" def test_qstandarpath(): """Test the qtpy.QStandardPaths namespace""" assert QStandardPaths.StandardLocation is not None # Attrib...
Add test for QDesktopServices split.
Add test for QDesktopServices split.
Python
mit
goanpeca/qtpy,davvid/qtpy,davvid/qtpy,spyder-ide/qtpy,goanpeca/qtpy
--- +++ @@ -0,0 +1,25 @@ +from __future__ import absolute_import + +import pytest +from qtpy.QtCore import QStandardPaths +from qtpy.QtGui import QDesktopServices + +"""Test QDesktopServices split in Qt5.""" + +def test_qstandarpath(): + """Test the qtpy.QStandardPaths namespace""" + + assert QStandardPaths.Sta...
919f28ee01aeea4dc25f5c4dbb344ac6d1831526
src/utils/xdsinp_to_dict.py
src/utils/xdsinp_to_dict.py
#!/usr/bin/env python import json import sys class INP2DICT(object): def __init__(self, xdsinp, xdsdict): self.xdsinp = xdsinp self.xdsdict = xdsdict self.run() def run(self): temp = open(self.xdsinp, 'r').readlines() inp=[] for line in temp: inp.a...
Add DN's tool for XDS.INP parsing
Add DN's tool for XDS.INP parsing
Python
agpl-3.0
RAPD/RAPD,RAPD/RAPD,RAPD/RAPD,RAPD/RAPD,RAPD/RAPD
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import json +import sys + +class INP2DICT(object): + def __init__(self, xdsinp, xdsdict): + self.xdsinp = xdsinp + self.xdsdict = xdsdict + self.run() + + def run(self): + + temp = open(self.xdsinp, 'r').readlines() + inp=[] +...
b272193ed589edf301bf97f9896fc819f6c142c3
library/migrations/0013_upgrade_to_fts5.py
library/migrations/0013_upgrade_to_fts5.py
# Generated by Django 2.1.11 on 2019-08-07 21:43 from django.db import migrations FORWARDS = [ """DROP TABLE piece_search""", """ CREATE VIRTUAL TABLE piece_search USING fts5 (id unindexed, body, tokenize = 'porter unicode61') """, """ CREATE TRIGGER library_piece_search_insert AFTER I...
Update sqlite fts to fts5
[WIP] Update sqlite fts to fts5 I think this will provide better stemming, e.g. searching for "star" will match "Stars and Strips Forever", which it currently doesn't.
Python
agpl-3.0
cellofellow/symphony,cellofellow/symphony,cellofellow/symphony
--- +++ @@ -0,0 +1,46 @@ +# Generated by Django 2.1.11 on 2019-08-07 21:43 + +from django.db import migrations + +FORWARDS = [ + """DROP TABLE piece_search""", + """ + CREATE VIRTUAL TABLE piece_search + USING fts5 (id unindexed, body, tokenize = 'porter unicode61') + """, + """ + CREATE TRIGGER ...
9f0c286f3118236aa760208cf60b2bcc19b3185e
projects/migrations/0003_auto_20151120_2037.py
projects/migrations/0003_auto_20151120_2037.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0002_auto_20151117_1710'), ] operations = [ migrations.AlterModelOptions( name='inlistitem', ...
Add migration to go with 331ce5f
Add migration to go with 331ce5f
Python
mit
XeryusTC/projman,XeryusTC/projman,XeryusTC/projman
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0002_auto_20151117_1710'), + ] + + operations = [ + migrations.AlterModelOption...
1eb9d6cbed7c8f2c9a216e8618dadee571a2cdf2
pyconcz_2016/speakers/views.py
pyconcz_2016/speakers/views.py
from django.template import RequestContext from django.template.response import TemplateResponse from pyconcz_2016.speakers.models import Speaker, Slot def speakers_list(request, type): speakers = (Speaker.objects.all() .exclude(**{type: None}) .prefetch_related(type) ...
from django.template import RequestContext from django.template.response import TemplateResponse from pyconcz_2016.speakers.models import Speaker, Slot def speakers_list(request, type): speakers = (Speaker.objects.all() .exclude(**{type: None}) .prefetch_related(type) ...
Fix template name in view
Fix template name in view
Python
mit
pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2017,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2016,pyvec/cz.pycon.org-2017,benabraham/cz.pycon.org-2017,pyvec/cz.pycon.org-2016
--- +++ @@ -12,7 +12,7 @@ return TemplateResponse( request, - template='speakers/speakers_list_{}.html'.format(type), + template='speakers/{}_list.html'.format(type), context={'speakers': speakers} )
20ef91b51230811cab0e4edb426993cfb1c63a1a
osf/management/commands/checkmigrations.py
osf/management/commands/checkmigrations.py
""" Return a non-zero exit code if there are unapplied migrations. """ import sys from django.db import connections, DEFAULT_DB_ALIAS from django.db.migrations.executor import MigrationExecutor from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): ...
Add a management command to check for unapplied migrations.
Add a management command to check for unapplied migrations. [PLAT-972]
Python
apache-2.0
brianjgeiger/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,aaxelb/osf.io,erinspace/osf.io,Johnetordoff/osf.io,adlius/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,felliott/osf.io,aax...
--- +++ @@ -0,0 +1,23 @@ +""" +Return a non-zero exit code if there are unapplied migrations. +""" +import sys + +from django.db import connections, DEFAULT_DB_ALIAS +from django.db.migrations.executor import MigrationExecutor +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + + ...
f8e2e26600694d5a1d9c20da4dcf2bb188269011
tests/test_ticketed_features.py
tests/test_ticketed_features.py
"""A growing set of tests designed to ensure when isort implements a feature described in a ticket it fully works as defined in the associated ticket. """ import isort def test_semicolon_ignored_for_dynamic_lines_after_import_issue_1178(): """Test to ensure even if a semicolon is in the decorator in the line foll...
Add ticketed features test file
Add ticketed features test file
Python
mit
PyCQA/isort,PyCQA/isort
--- +++ @@ -0,0 +1,21 @@ +"""A growing set of tests designed to ensure when isort implements a feature described in a ticket +it fully works as defined in the associated ticket. +""" +import isort + + +def test_semicolon_ignored_for_dynamic_lines_after_import_issue_1178(): + """Test to ensure even if a semicolon i...
a27ced2b6dc5ff7a48cdb1e3c63c2caa340733a7
plugins/CoD_BO.py
plugins/CoD_BO.py
import os from lib.base_plugin import BasePlugin from lib.paths import SteamGamesPath class CoDBOPlugin(BasePlugin): Name = "Call of Duty: Black Ops" support_os = ["Windows"] def backup(self, _): _.add_folder('Profiles', os.path.join(SteamGamesPath, 'call of duty black ops'), 'players') def ...
Call of Duty: Black Ops plugin
Call of Duty: Black Ops plugin
Python
mit
Pr0Ger/SGSB
--- +++ @@ -0,0 +1,19 @@ +import os +from lib.base_plugin import BasePlugin +from lib.paths import SteamGamesPath + + +class CoDBOPlugin(BasePlugin): + Name = "Call of Duty: Black Ops" + support_os = ["Windows"] + + def backup(self, _): + _.add_folder('Profiles', os.path.join(SteamGamesPath, 'call of ...
c864253b9e7341d65e34eba8a9f7a7ea7c85c053
scripts/print_view_controller_hierarchy.py
scripts/print_view_controller_hierarchy.py
"""Prints the current view controller hierarchy. Usage: pvc """ def print_view_controller_hierarchy(debugger, command, result, internal_dict): debugger.HandleCommand('po [[[UIWindow keyWindow] rootViewController] _printHierarchy]') def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand('command ...
Add print view controller hierarchy command.
Add print view controller hierarchy command.
Python
mit
mrhappyasthma/happydebugging,mrhappyasthma/HappyDebugging
--- +++ @@ -0,0 +1,10 @@ +"""Prints the current view controller hierarchy. + +Usage: pvc +""" +def print_view_controller_hierarchy(debugger, command, result, internal_dict): + debugger.HandleCommand('po [[[UIWindow keyWindow] rootViewController] _printHierarchy]') + + +def __lldb_init_module(debugger, internal_dict)...
a0b5b0c50335241be1d3ce1db53aa7113ddde81b
queries-limits.py
queries-limits.py
#!/usr/bin/env python from avocado import main from sdcm.tester import ClusterTester from sdcm.tester import clean_aws_resources class QueriesLimitsTest(ClusterTester): """ Test scylla cluster growth (adding nodes after an initial cluster size). :avocado: enable """ @clean_aws_resources d...
Add the queries limits test.
limits: Add the queries limits test. Use a C++ payload to check if the queries limitation works. Fixes #180. Signed-off-by: Benoît Canet <ecd1f14f7c1c6dc7a40210bdcc3810e0107ecbc8@scylladb.com>
Python
agpl-3.0
amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scylla-longevity-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-...
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +from avocado import main + +from sdcm.tester import ClusterTester +from sdcm.tester import clean_aws_resources + + +class QueriesLimitsTest(ClusterTester): + + """ + Test scylla cluster growth (adding nodes after an initial cluster size). + + :avocado: enabl...
f065bd7933a79055b140ffd973042d62eb31d4e0
blue-tether.py
blue-tether.py
#!/usr/bin/env python import dbus import subprocess import sys # Replace this with the bluetooth address of the Bluetooth Network Access Point dev_bdaddr = '12_34_56_AB_CD_EF' # dhcp_client = ['/sbin/dhclient', '-v'] dhcp_client = ['/sbin/udhcpc', '-i'] def main(): bus = dbus.SystemBus() bluez_proxy = bus.get_o...
Add script to bring up bluetooth network
Add script to bring up bluetooth network <rant> I haven't managed to find any good documentation on this (or pretty much anything bluez 4.x related) at all (the blueman source implements this, but it's not the easiest source in the world to follow) - this was created after a lot of trial and error staring at the bluez...
Python
mit
DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk,DarkStarSword/junk
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import dbus +import subprocess +import sys + +# Replace this with the bluetooth address of the Bluetooth Network Access Point +dev_bdaddr = '12_34_56_AB_CD_EF' + +# dhcp_client = ['/sbin/dhclient', '-v'] +dhcp_client = ['/sbin/udhcpc', '-i'] + +def main(): + bus = d...
395d534e44a5318e221f41d1fefbea3c10dc73f5
in-class-code/2017-03-06-simulatingKinematics.py
in-class-code/2017-03-06-simulatingKinematics.py
### Import our stuff import matplotlib.pyplot as plt import numpy as np import pandas as pd ### Set up initial values position = 555 # feet velocity = 0 # feet/second acceleration = -32.17 # feet / second^2 time_steps = np.linspace(0, 5, 501) # creates two entries at time zero time_step_size = time_steps[1] - time_ste...
Add in-class code for simulating motion
Add in-class code for simulating motion
Python
agpl-3.0
ComputationalModeling/spring-2017-danielak,ComputationalModeling/spring-2017-danielak,ComputationalModeling/spring-2017-danielak,ComputationalModeling/spring-2017-danielak
--- +++ @@ -0,0 +1,46 @@ +### Import our stuff +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +### Set up initial values +position = 555 # feet +velocity = 0 # feet/second +acceleration = -32.17 # feet / second^2 +time_steps = np.linspace(0, 5, 501) # creates two entries at time zero +tim...
21388952e9cd7e9d4259d63843a7ff782aa09ca2
tests/func/test_version.py
tests/func/test_version.py
from dvc.main import main from dvc.command.version import CmdVersion from dvc.cli import parse_args from tests.basic_env import TestDvc class TestVersion(TestDvc): def test_run(self): ret = main(["version"]) self.assertEqual(ret, 0) def test_info(dvc, mocker, caplog): cmd = CmdVersion(parse...
Write tests for `dvc version`
Write tests for `dvc version`
Python
apache-2.0
dmpetrov/dataversioncontrol,efiop/dvc,dmpetrov/dataversioncontrol,efiop/dvc
--- +++ @@ -0,0 +1,20 @@ +from dvc.main import main +from dvc.command.version import CmdVersion +from dvc.cli import parse_args + +from tests.basic_env import TestDvc + + +class TestVersion(TestDvc): + def test_run(self): + ret = main(["version"]) + self.assertEqual(ret, 0) + + +def test_info(dvc, mo...
beba0e2c9a80ce8b2bddf2e8470ad7161be097d1
bloatfinder.py
bloatfinder.py
#!/usr/bin/python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # This prints out the tests that open the most windows. import sys test = None count = 0 counts =...
Add script to find tests that open a lot of windows
Add script to find tests that open a lot of windows
Python
mpl-2.0
amccreight/mochitest-logs
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/python + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# This prints out the tests that open the most windows. + +import s...
143e09c5e62435c91a4c7e20a963bfc26451f517
tests/app/soc/modules/gci/views/test_org_home.py
tests/app/soc/modules/gci/views/test_org_home.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 tests for org_home view.
Add tests for org_home view.
Python
apache-2.0
rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son
--- +++ @@ -0,0 +1,68 @@ +#!/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...
b958f2b327d54b55073cafa7f733b950f64ee075
tohu/custom_generator_v2.py
tohu/custom_generator_v2.py
import logging logger = logging.getLogger('tohu') class CustomGeneratorMetaV2(type): def __new__(metacls, cg_name, bases, clsdict): logger.debug('[DDD] CustomGeneratorMetaV2.__new__') logger.debug(f' - metacls={metacls}') logger.debug(f' - cg_name={cg_name}') logg...
Add stub for CustomGeneratorMetaV2 class (which will be a fresh and decluttered implementation of CustomGeneratorMeta)
Add stub for CustomGeneratorMetaV2 class (which will be a fresh and decluttered implementation of CustomGeneratorMeta)
Python
mit
maxalbert/tohu
--- +++ @@ -0,0 +1,23 @@ +import logging + +logger = logging.getLogger('tohu') + + +class CustomGeneratorMetaV2(type): + + def __new__(metacls, cg_name, bases, clsdict): + logger.debug('[DDD] CustomGeneratorMetaV2.__new__') + logger.debug(f' - metacls={metacls}') + logger.debug(f' ...
3359e4325fe30f883476cdeed6411a063de925af
filters/lerp.py
filters/lerp.py
import matplotlib.pyplot as plt import numpy as np from scipy import signal f, (ax1, ax2) = plt.subplots(2, sharex=True) for i in np.linspace(0.0, 1.0, 11): # A linear interpolation filter with a factor of `i`. w, h = signal.freqz([(1.0 - i), i]) # Scale x-axis to Hz. x = w * 44100 / (2 * np.pi) ...
Add exploration of linear interp filter freq response
Add exploration of linear interp filter freq response
Python
mit
nick-thompson/dsp,nick-thompson/wavetable
--- +++ @@ -0,0 +1,34 @@ +import matplotlib.pyplot as plt +import numpy as np + +from scipy import signal + +f, (ax1, ax2) = plt.subplots(2, sharex=True) + +for i in np.linspace(0.0, 1.0, 11): + # A linear interpolation filter with a factor of `i`. + w, h = signal.freqz([(1.0 - i), i]) + + # Scale x-axis to ...
4ba0e32ca02567204cf8d219c212f6f14e36ad9c
src/methods.py
src/methods.py
""" Integration methods """ import numpy as np import matplotlib.pyplot as plt def euler(at, vt, xt, dt): vtpdt = vt + at * dt xtpdt = xt + vt * dt return vtpdt, xtpdt def test_euler(): # test with a spring force F = -kx x0 = 0 v0 = 1 k = 100 dt = .01 t = np.arange(0, 5, dt) ...
Create Euler method, test it on a spring
Create Euler method, test it on a spring
Python
mit
mancaf/planetarium
--- +++ @@ -0,0 +1,38 @@ +""" +Integration methods +""" + +import numpy as np +import matplotlib.pyplot as plt + + +def euler(at, vt, xt, dt): + vtpdt = vt + at * dt + xtpdt = xt + vt * dt + return vtpdt, xtpdt + + +def test_euler(): + # test with a spring force F = -kx + x0 = 0 + v0 = 1 + k = 10...
cb28b07062c817d76f40bb5956316dabae907eb4
remove_duplicates_from_sorted_array_ii/solution.py
remove_duplicates_from_sorted_array_ii/solution.py
class Solution: # @param A a list of integers # @return an integer def removeDuplicates(self, A): if not A: return 0 if len(A) == 1: return 1 j = 0 # Position of last processed non-duplicate n = len(A) twice = False # Whether last processed n...
Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array II
Python
bsd-2-clause
quietcoolwu/leetcode-python,huanqi/leetcode-python,JiaminXuan/leetcode-python,shichao-an/leetcode-python,jamesblunt/leetcode-python,ibadguy/leetcode-python,jamesblunt/leetcode-python,shichao-an/leetcode-python,ibadguy/leetcode-python,beni55/leetcode-python,beni55/leetcode-python,huanqi/leetcode-python,quietcoolwu/leetc...
--- +++ @@ -0,0 +1,22 @@ +class Solution: + # @param A a list of integers + # @return an integer + def removeDuplicates(self, A): + if not A: + return 0 + if len(A) == 1: + return 1 + j = 0 # Position of last processed non-duplicate + n = len(A) + twi...
01e8d98a7de2ac07942355bd41b88ea0cee14f1e
bluebottle/activities/migrations/0012_auto_20191108_1317.py
bluebottle/activities/migrations/0012_auto_20191108_1317.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-11-08 12:17 from __future__ import unicode_literals from django.db import migrations def correct_activity_status(apps, schema_editor): Activity = apps.get_model('activities', 'Activity') Activity.objects.filter( review_status__in=('draft'...
Add migration that fixes status for activities that are not approved
Add migration that fixes status for activities that are not approved
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2019-11-08 12:17 +from __future__ import unicode_literals + +from django.db import migrations + + +def correct_activity_status(apps, schema_editor): + Activity = apps.get_model('activities', 'Activity') + + Activity.objects.filt...
e3272905eeb91d26e9603f682b4d485a1176d06a
14B-088/HI/HI_output_fits.py
14B-088/HI/HI_output_fits.py
# Convert the CASA cube into FITS import os from spectral_cube import SpectralCube import astropy.units as u from casa_tools import myexportfits path = "/srv/astro/erickoch/M33/" myexportfits(imagename=os.path.join(path, "M33_14B-088_HI.clean.image"), fitsimage=os.path.join(path, "M33_14B-088_HI.clean...
Convert to FITS and K
Convert to FITS and K
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
--- +++ @@ -0,0 +1,22 @@ + +# Convert the CASA cube into FITS + +import os +from spectral_cube import SpectralCube +import astropy.units as u + +from casa_tools import myexportfits + +path = "/srv/astro/erickoch/M33/" + +myexportfits(imagename=os.path.join(path, "M33_14B-088_HI.clean.image"), + fitsimage=...
5aa8ce2b603a200b4d5ddf59b95f916645051af7
migrations/20141130-eliminate-duplicate-tags.py
migrations/20141130-eliminate-duplicate-tags.py
""" """ import os import json from sqlalchemy import (create_engine, Table, Column, String, Integer, Float, Text, MetaData, select, ForeignKey, bindparam, delete, and_) from config import Configuration engine = create_engine(Configuration.SQLALCHEMY_DATABASE_URI, echo=Tr...
Add migrations to compile duplicate tags
Add migrations to compile duplicate tags
Python
bsd-2-clause
Lancey6/redwind,Lancey6/redwind,thedod/redwind,Lancey6/redwind,thedod/redwind
--- +++ @@ -0,0 +1,80 @@ +""" +""" +import os +import json +from sqlalchemy import (create_engine, Table, Column, String, Integer, + Float, Text, MetaData, select, ForeignKey, + bindparam, delete, and_) +from config import Configuration + +engine = create_engine(Configura...
d411a3cdc16b68647059c007cff3091ecf3ed9dc
gaia_tools/query/__init__.py
gaia_tools/query/__init__.py
# gaia_tools.query: some helper functions for querying the Gaia database import numpy from astropy.table import Table from astroquery.gaia import Gaia import psycopg2 def query(sql_query,local=False,dbname='catalogs',user='postgres'): """ NAME: query PURPOSE: perform a query, either on a loca...
Add function to run a local or remote query
Add function to run a local or remote query
Python
mit
jobovy/gaia_tools
--- +++ @@ -0,0 +1,37 @@ +# gaia_tools.query: some helper functions for querying the Gaia database +import numpy +from astropy.table import Table +from astroquery.gaia import Gaia +import psycopg2 + +def query(sql_query,local=False,dbname='catalogs',user='postgres'): + """ + NAME: + query + PURPOSE: + ...
d13e9ab0875844bddc1f455935a48091544c6937
apps/people/migrations/0004_people_per_page.py
apps/people/migrations/0004_people_per_page.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('people', '0003_people_standfirst'), ] operations = [ migrations.AddField( model_name='people', name=...
Add missing migration file for `per_page` field.
Add missing migration file for `per_page` field.
Python
mit
onespacemedia/cms-people,onespacemedia/cms-people
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('people', '0003_people_standfirst'), + ] + + operations = [ + migrations.AddField( + ...
ade82c81d43473eaef4fb3db668353f76c0daf91
messaging/synonyms.py
messaging/synonyms.py
import os from threading import RLock from weavelib.exceptions import ObjectAlreadyExists class SynonymRegistry(object): def __init__(self): self.synonym_lock = RLock() self.synonyms = {} def register(self, synonym, target): synonym = os.path.join("/synonyms", synonym.lstrip('/')) ...
Add a simple synonym-map class.
Add a simple synonym-map class.
Python
mit
supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer
--- +++ @@ -0,0 +1,24 @@ +import os +from threading import RLock + +from weavelib.exceptions import ObjectAlreadyExists + + +class SynonymRegistry(object): + def __init__(self): + self.synonym_lock = RLock() + self.synonyms = {} + + def register(self, synonym, target): + synonym = os.path.j...
4190937c741f56bb4bb8b81621a711bba03fe705
imhotep/shas.py
imhotep/shas.py
from collections import namedtuple Remote = namedtuple('Remote', ('name', 'url')) CommitInfo = namedtuple("CommitInfo", ('commit', 'origin', 'remote_repo')) class PRInfo(object): def __init__(self, json): self.json = json @property def base_sha(self): return self.json['base']['sha'] ...
from collections import namedtuple Remote = namedtuple('Remote', ('name', 'url')) CommitInfo = namedtuple("CommitInfo", ('commit', 'origin', 'remote_repo')) class PRInfo(object): def __init__(self, json): self.json = json @property def base_sha(self): return self.json['base']['sha'] ...
Refactor remote_repo, to return None if there is no remote.
Refactor remote_repo, to return None if there is no remote.
Python
mit
richtier/imhotep,justinabrahms/imhotep,justinabrahms/imhotep,Appdynamics/imhotep
--- +++ @@ -23,14 +23,14 @@ @property def remote_repo(self): - return Remote(name=self.json['head']['repo']['owner']['login'], - url=self.json['head']['repo']['clone_url']) + remote = None + if self.has_remote_repo: + remote = Remote(name=self.json['hea...
75a8f8e7181188e174fc707875117f49c461ee97
open_spiel/python/examples/uniform_policy_exploitability.py
open_spiel/python/examples/uniform_policy_exploitability.py
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Add a simple example of computing exploitability of uniform policy.
Add a simple example of computing exploitability of uniform policy.
Python
apache-2.0
deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel
--- +++ @@ -0,0 +1,36 @@ +# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICEN...
42b5369a1608417b6503d914b90d14945514bff8
contrib/examples/tests/test_action_isprime.py
contrib/examples/tests/test_action_isprime.py
from st2tests.base import BaseActionTestCase from pythonactions.isprime import PrimeCheckerAction class PrimeCheckerActionTestCase(BaseActionTestCase): action_cls = PrimeCheckerAction def test_run(self): action = self.get_action_instance() result = action.run(value=1) self.assertFals...
Add tests for example is prime action.
Add tests for example is prime action.
Python
apache-2.0
nzlosh/st2,punalpatel/st2,dennybaa/st2,pixelrebel/st2,StackStorm/st2,emedvedev/st2,punalpatel/st2,dennybaa/st2,lakshmi-kannan/st2,emedvedev/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,punalpatel/st2,lakshmi-kannan/st2,Plexxi/st2,lakshmi-kannan/st2,peak6/st2,peak6/st2,StackStorm/st2,emedvedev/st2,Plexxi/st2,tonybaloney/st2...
--- +++ @@ -0,0 +1,15 @@ +from st2tests.base import BaseActionTestCase + +from pythonactions.isprime import PrimeCheckerAction + + +class PrimeCheckerActionTestCase(BaseActionTestCase): + action_cls = PrimeCheckerAction + + def test_run(self): + action = self.get_action_instance() + result = actio...
9ec01f7d01d77aaf7ee934725b9d7994b8157bcf
drftest/shop/tests/test_models.py
drftest/shop/tests/test_models.py
from django.test import TestCase from shop.models import Order from .factories import UserFactory, OrderFactory class ShopModelsTestCase(TestCase): def setUp(self): pass def test_order_add(self): order = OrderFactory.create() self.assertEquals(Order.objects.count(), 1)
Add initial tests for models and factories
Add initial tests for models and factories
Python
mit
andreagrandi/drf3-test,andreagrandi/drf3-test,andreagrandi/drf3-test
--- +++ @@ -0,0 +1,11 @@ +from django.test import TestCase +from shop.models import Order +from .factories import UserFactory, OrderFactory + +class ShopModelsTestCase(TestCase): + def setUp(self): + pass + + def test_order_add(self): + order = OrderFactory.create() + self.assertEquals(Orde...
5b3218ef7d824df3aa61d7e4bceecb566ecf8ccf
examples/c4_ql_tabular_selfplay.py
examples/c4_ql_tabular_selfplay.py
''' Q-learning via self-play is used to learn the state-action values, Q(s, a), for the legal moves of a Connect 4 position. ''' from capstone.environment import Environment from capstone.game import Connect4 from capstone.mdp import GameMDP from capstone.rl import QLearningSelfPlay from capstone.util import c42pdf b...
Add Connect4 Q-learning tabular self-play example
Add Connect4 Q-learning tabular self-play example
Python
mit
davidrobles/mlnd-capstone-code
--- +++ @@ -0,0 +1,33 @@ +''' +Q-learning via self-play is used to learn the state-action values, Q(s, a), +for the legal moves of a Connect 4 position. +''' + +from capstone.environment import Environment +from capstone.game import Connect4 +from capstone.mdp import GameMDP +from capstone.rl import QLearningSelfPlay...
912c03ddbb533ddcc7e3d256f8c7871f2a04698e
apps/core/migrations/0007_auto_20171106_1318.py
apps/core/migrations/0007_auto_20171106_1318.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-11-06 13:18 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0006_auto_20171017_1257'), ] operations = [ migrations.AlterModelOptions( ...
Add missing migration for Pixeler verbose name(s)
Add missing migration for Pixeler verbose name(s)
Python
bsd-3-clause
Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2017-11-06 13:18 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0006_auto_20171017_1257'), + ] + + operations = ...
142cd3a29155dadc3ed2e7bc0def7a63632f0ebb
ooni/nettests/manipulation/parasitictraceroute.py
ooni/nettests/manipulation/parasitictraceroute.py
from twisted.python import usage from twisted.internet import defer, reactor from ooni.templates import scapyt from ooni.utils import log from ooni.utils.txscapy import ParasiticTraceroute from ooni.settings import config from scapy.all import TCPerror, IPerror class ParasiticTracerouteTest(scapyt.BaseScapyTest): ...
Add a Parasitic Traceroute NetTest
Add a Parasitic Traceroute NetTest
Python
bsd-2-clause
kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/...
--- +++ @@ -0,0 +1,48 @@ +from twisted.python import usage +from twisted.internet import defer, reactor +from ooni.templates import scapyt +from ooni.utils import log +from ooni.utils.txscapy import ParasiticTraceroute +from ooni.settings import config + +from scapy.all import TCPerror, IPerror + +class ParasiticTrac...
ac2c526fbe2a19c71b2500e98813b9adc554d147
tests/test_add_language/test_save_bible_data.py
tests/test_add_language/test_save_bible_data.py
# tests.test_add_language.test_save_bible_data # coding=utf-8 from __future__ import unicode_literals import copy import json import os import os.path import nose.tools as nose import yvs.shared as yvs import utilities.add_language as add_lang from tests.test_add_language import set_up, tear_down LANGUAGE_ID = 'swe...
Add tests for save_bible_data function
Add tests for save_bible_data function
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
--- +++ @@ -0,0 +1,50 @@ +# tests.test_add_language.test_save_bible_data +# coding=utf-8 + +from __future__ import unicode_literals +import copy +import json +import os +import os.path + +import nose.tools as nose + +import yvs.shared as yvs +import utilities.add_language as add_lang +from tests.test_add_language imp...
753e9f58d9e02db3a3daeb584c43f2b76c731542
geotrek/infrastructure/migrations/0025_auto_20210721_1540.py
geotrek/infrastructure/migrations/0025_auto_20210721_1540.py
# Generated by Django 3.1.13 on 2021-07-21 15:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('authent', '0005_remove_userprofile_language'), ('infrastructure', '0024_auto_20210716_1043'), ] operations...
Add migration for infrastructure model
Add migration for infrastructure model
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
--- +++ @@ -0,0 +1,38 @@ +# Generated by Django 3.1.13 on 2021-07-21 15:40 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('authent', '0005_remove_userprofile_language'), + ('infrastructure', '0024_auto_...
4affba629c94d4cdd12ff3aae6bb06f6a6ed215c
dp/longest_increasing_subsequence/python/lis.py
dp/longest_increasing_subsequence/python/lis.py
def lis(a): dp = [1] * len(a) for i in range(len(a)): for j in range(i): if a[j] < a[i]: dp[i] = max(dp[i], dp[j] + 1) return max(dp) n = int(input("Enter number of elements: ")) a = input().split(' ') for i in range(len(a)): a[i] = int(a[i]) print(lis(a))
Add longest increasing subsequence algorithm in Python.
Add longest increasing subsequence algorithm in Python.
Python
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
--- +++ @@ -0,0 +1,13 @@ +def lis(a): + dp = [1] * len(a) + for i in range(len(a)): + for j in range(i): + if a[j] < a[i]: + dp[i] = max(dp[i], dp[j] + 1) + return max(dp) + +n = int(input("Enter number of elements: ")) +a = input().split(' ') +for i in range(len(a)): + a[i] = int(a[i]) +print(lis(a))
22e0e894bdfb457f00bad1016ae28884ef94256c
okupy/otp/__init__.py
okupy/otp/__init__.py
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python from django_otp import login as otp_login from django_otp.middleware import OTPMiddleware from .sotp.models import SOTPDevice from .totp.models import TOTPDevice def init_otp(request): """ Initialize OTP after login. This sets up OTP devices for django...
# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python from django.db import IntegrityError from django_otp import login as otp_login from django_otp.middleware import OTPMiddleware from .sotp.models import SOTPDevice from .totp.models import TOTPDevice def init_otp(request): """ Initialize OTP after login. Th...
Make otp_init() race condition safe.
Make otp_init() race condition safe. A race condition in get_or_create() may have resulted in two devices created per user. Now we guarantee only one. Not that it matters real much...
Python
agpl-3.0
gentoo/identity.gentoo.org,gentoo/identity.gentoo.org,dastergon/identity.gentoo.org,dastergon/identity.gentoo.org
--- +++ @@ -1,5 +1,6 @@ # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python +from django.db import IntegrityError from django_otp import login as otp_login from django_otp.middleware import OTPMiddleware @@ -13,21 +14,19 @@ request.user.is_verified(). """ - tdev, created = TOTPDevice.objects.ge...
1cc92f4b61841c43395c988712f98574cd2b1dc0
app/test/test_resultsets.py
app/test/test_resultsets.py
from app.logic import resultsets from sympy import sympify, Derivative, Integral, I, sqrt def test_predicates(): assert resultsets.is_approximatable_constant(sqrt(2)) assert not resultsets.is_approximatable_constant(sympify('2')) assert resultsets.is_complex(2*I + 3) assert not resultsets.is_complex(3)...
Add basic test for resultsets
Add basic test for resultsets
Python
bsd-3-clause
kaichogami/sympy_gamma,kaichogami/sympy_gamma,iScienceLuvr/sympy_gamma,github4ry/sympy_gamma,bolshoibooze/sympy_gamma,kaichogami/sympy_gamma,iScienceLuvr/sympy_gamma,github4ry/sympy_gamma,iScienceLuvr/sympy_gamma,bolshoibooze/sympy_gamma,github4ry/sympy_gamma,bolshoibooze/sympy_gamma
--- +++ @@ -0,0 +1,8 @@ +from app.logic import resultsets +from sympy import sympify, Derivative, Integral, I, sqrt + +def test_predicates(): + assert resultsets.is_approximatable_constant(sqrt(2)) + assert not resultsets.is_approximatable_constant(sympify('2')) + assert resultsets.is_complex(2*I + 3) + a...
851eece6127b623fcb49ad5ed6738120ea0168c2
docs/deploy.py
docs/deploy.py
#!/usr/bin/env python from __future__ import print_function from contextlib import contextmanager from glob import glob from path import path import os from os.path import abspath, basename, dirname, exists, isfile from shutil import move, rmtree from subprocess import check_call HERE = dirname(abspath(__file__)) ZIPL...
Add script for generating docs.
MAINT: Add script for generating docs.
Python
apache-2.0
magne-max/zipline-ja,nborggren/zipline,wilsonkichoi/zipline,umuzungu/zipline,Scapogo/zipline,alphaBenj/zipline,florentchandelier/zipline,magne-max/zipline-ja,quantopian/zipline,humdings/zipline,enigmampc/catalyst,umuzungu/zipline,bartosh/zipline,grundgruen/zipline,grundgruen/zipline,quantopian/zipline,humdings/zipline,...
--- +++ @@ -0,0 +1,73 @@ +#!/usr/bin/env python +from __future__ import print_function +from contextlib import contextmanager +from glob import glob +from path import path +import os +from os.path import abspath, basename, dirname, exists, isfile +from shutil import move, rmtree +from subprocess import check_call + +...
fa09dd08cd7b462f2b9f9b860aa11cd64f00c913
Arrays/arrange_numbers_to_form_biggest_number.py
Arrays/arrange_numbers_to_form_biggest_number.py
import unittest """ Given an array of numbers, arrange them in a way that yields the maximum value. Input: 54 546 548 60 Output: 6054854654 Input: 1 34 3 98 9 76 45 4 Output: 998764543431 """ """ Approach: 1. Sort the numbers using a custom comparator. 2. The comparator works as follows: suppose it takes two numbers X...
Rearrange array numbers to form biggest number
Rearrange array numbers to form biggest number
Python
mit
prathamtandon/g4gproblems
--- +++ @@ -0,0 +1,43 @@ +import unittest +""" +Given an array of numbers, arrange them in a way that yields the maximum value. +Input: 54 546 548 60 +Output: 6054854654 +Input: 1 34 3 98 9 76 45 4 +Output: 998764543431 +""" + +""" +Approach: +1. Sort the numbers using a custom comparator. +2. The comparator works as...
ec0b4994decd7daf532a8adc7f1c5eed5e3df812
development/importMaven/import_maven_artifacts.py
development/importMaven/import_maven_artifacts.py
#!/usr/bin/python """ Copyright 2018 The Android Open Source Project 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 ...
Add the helper script to import packages from Maven.
Add the helper script to import packages from Maven. Test: Tested the script locally. Change-Id: I0b3bf330d340a30f14ddbe5704668e9666577d8d
Python
apache-2.0
androidx/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/andro...
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/python + +""" +Copyright 2018 The Android Open Source Project + +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/LICENS...
c5296f0246c3e2cbf50ca7cad0c7f1130b0dd611
analysis_10x10.py
analysis_10x10.py
# -*- coding:utf-8 -*- from pylab import * import tables """ TODO - Faire tous les MPS - Faire tous les STS - Faire le déphasage """ DB = tables.openFile('db.h5') # Get data DATA = [] for g in DB.walkGroups(): try: pset = g.paramset._v_attrs res = g.results._v_attrs except tables.NoSuchNode...
Add an analysis file for 10x10 simulations
Add an analysis file for 10x10 simulations Not finished, MPS Whole figure is quite ok.
Python
mit
neuro-lyon/multiglom-model,neuro-lyon/multiglom-model
--- +++ @@ -0,0 +1,68 @@ +# -*- coding:utf-8 -*- +from pylab import * +import tables + +""" +TODO +- Faire tous les MPS +- Faire tous les STS + +- Faire le déphasage + +""" + +DB = tables.openFile('db.h5') + +# Get data +DATA = [] +for g in DB.walkGroups(): + try: + pset = g.paramset._v_attrs + res =...
2a98676fc3de7cc8c7f335143aaecbe1f4ed5dc3
examples/comp/set_backgrounds_to_1920x1080_32bit.py
examples/comp/set_backgrounds_to_1920x1080_32bit.py
"""Sets all Backgrounds in the currently active comp to 1920x1080 (32 bit). This example shows how to list tool of a specific type and set some of its inputs. Additionally this shows off how `fusionless` is able to automatically interpret an enum value (like "float32" for image depth) to the corresponding float value ...
Add set background resolution and bit depth example
Add set background resolution and bit depth example
Python
bsd-3-clause
BigRoy/fusionscript,BigRoy/fusionless
--- +++ @@ -0,0 +1,32 @@ +"""Sets all Backgrounds in the currently active comp to 1920x1080 (32 bit). + +This example shows how to list tool of a specific type and set some of its +inputs. Additionally this shows off how `fusionless` is able to automatically +interpret an enum value (like "float32" for image depth) t...
44452f46ac991307755a778d9057b30c80e74078
gem/management/commands/add_images_to_articles.py
gem/management/commands/add_images_to_articles.py
from __future__ import absolute_import, unicode_literals import csv from babel import Locale from django.core.management.base import BaseCommand from wagtail.wagtailimages.tests.utils import Image from molo.core.models import ( Languages, Tag, ArticlePage, ArticlePageTags, Main, SectionIndexPage, TagIndexPage)...
Add management command for adding images to articles
Add management command for adding images to articles
Python
bsd-2-clause
praekelt/molo-gem,praekelt/molo-gem,praekelt/molo-gem
--- +++ @@ -0,0 +1,63 @@ +from __future__ import absolute_import, unicode_literals + +import csv +from babel import Locale +from django.core.management.base import BaseCommand +from wagtail.wagtailimages.tests.utils import Image +from molo.core.models import ( + Languages, Tag, ArticlePage, ArticlePageTags, Main, ...
cddc7881b40ae9f9acdc42102185cf7930ccd73b
astropy/modeling/tests/test_functional_models.py
astropy/modeling/tests/test_functional_models.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np from numpy.testing import assert_allclose from .. import models try: from scipy import optimize HAS_SCIPY = True except ImportError: HAS_SCIPY = False def test_Trapezoid1DModel(): """Regr...
Add test for Trapezoid1D model
Add test for Trapezoid1D model
Python
bsd-3-clause
AustereCuriosity/astropy,astropy/astropy,pllim/astropy,mhvk/astropy,larrybradley/astropy,tbabej/astropy,StuartLittlefair/astropy,astropy/astropy,aleksandr-bakanov/astropy,stargaser/astropy,pllim/astropy,joergdietrich/astropy,astropy/astropy,lpsinger/astropy,lpsinger/astropy,mhvk/astropy,saimn/astropy,kelle/astropy,larr...
--- +++ @@ -0,0 +1,21 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +from __future__ import division +import numpy as np +from numpy.testing import assert_allclose +from .. import models + +try: + from scipy import optimize + HAS_SCIPY = True +except ImportError: + HAS_SCIPY = False + +...
f1e1cc28ff00ed3b54d6eb1f4a77290c8ee7f7b2
demo/guide-python/sklearn_evals_result.py
demo/guide-python/sklearn_evals_result.py
## # This script demonstrate how to access the xgboost eval metrics by using sklearn ## import xgboost as xgb import numpy as np from sklearn.datasets import make_hastie_10_2 X, y = make_hastie_10_2(n_samples=2000, random_state=42) # Map labels from {-1, 1} to {0, 1} labels, y = np.unique(y, return_inverse=True) X...
Access xgboost eval metrics by using sklearn
Access xgboost eval metrics by using sklearn
Python
apache-2.0
dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost,dmlc/xgboost
--- +++ @@ -0,0 +1,43 @@ +## +# This script demonstrate how to access the xgboost eval metrics by using sklearn +## + +import xgboost as xgb +import numpy as np +from sklearn.datasets import make_hastie_10_2 + +X, y = make_hastie_10_2(n_samples=2000, random_state=42) + +# Map labels from {-1, 1} to {0, 1} +labels, y...
7ab7e276654860a7e79fda95313fffa82f4e8fee
integration-test/473-landuse-tier.py
integration-test/473-landuse-tier.py
# http://www.openstreetmap.org/way/167274589 # area 300363008 assert_has_feature( 16, 10818, 21900, 'landuse', { 'kind': 'national_park', 'id': 167274589, 'tier': 1, 'min_zoom': 3 }) # http://www.openstreetmap.org/relation/921675 # area 30089300 assert_has_feature( 16, 14579, 29651, 'landuse', { ...
Add test for landuse tiers.
Add test for landuse tiers.
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -0,0 +1,24 @@ +# http://www.openstreetmap.org/way/167274589 +# area 300363008 +assert_has_feature( + 16, 10818, 21900, 'landuse', + { 'kind': 'national_park', 'id': 167274589, 'tier': 1, + 'min_zoom': 3 }) + +# http://www.openstreetmap.org/relation/921675 +# area 30089300 +assert_has_feature( + ...
02f4211fa09e8bd9f4a54d296e1f9bc7dadd5452
dynd/tests/test_nd_groupby.py
dynd/tests/test_nd_groupby.py
import sys import unittest from dynd import nd, ndt class TestGroupBy(unittest.TestCase): def test_immutable(self): a = nd.ndobject([ ('x', 0), ('y', 1), ('x', 2), ('x', 3), ('y', 4)], udtype='{A: string; B: int...
Add test of groupby with immutable 'by'
Add test of groupby with immutable 'by'
Python
bsd-2-clause
pombredanne/dynd-python,mwiebe/dynd-python,izaid/dynd-python,aterrel/dynd-python,pombredanne/dynd-python,michaelpacer/dynd-python,aterrel/dynd-python,izaid/dynd-python,mwiebe/dynd-python,aterrel/dynd-python,insertinterestingnamehere/dynd-python,ContinuumIO/dynd-python,insertinterestingnamehere/dynd-python,cpcloud/dynd-...
--- +++ @@ -0,0 +1,24 @@ +import sys +import unittest +from dynd import nd, ndt + +class TestGroupBy(unittest.TestCase): + def test_immutable(self): + a = nd.ndobject([ + ('x', 0), + ('y', 1), + ('x', 2), + ('x', 3), + ('y', 4)], + ...
9d9d46589852cb67b1cee3810d04ea88f8775f06
kboard/board/templatetags/hide_ip.py
kboard/board/templatetags/hide_ip.py
import re from django import template register = template.Library() @register.simple_tag def hide_ip(ip): m = re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', str(ip)) if m is not None: ip_arr = str(ip).split('.') ip_arr[2] = 'xxx' return '.'.join(ip_arr) else: return str(i...
Add hide ip template tag
Add hide ip template tag
Python
mit
cjh5414/kboard,kboard/kboard,guswnsxodlf/k-board,cjh5414/kboard,hyesun03/k-board,guswnsxodlf/k-board,cjh5414/kboard,kboard/kboard,kboard/kboard,hyesun03/k-board,hyesun03/k-board,darjeeling/k-board,guswnsxodlf/k-board
--- +++ @@ -0,0 +1,16 @@ +import re + +from django import template + +register = template.Library() + + +@register.simple_tag +def hide_ip(ip): + m = re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', str(ip)) + if m is not None: + ip_arr = str(ip).split('.') + ip_arr[2] = 'xxx' + return '.'.jo...
5d8cc197251ec4d19028e36ea400d4d6354d09ad
pythran/tests/cases/rosen.py
pythran/tests/cases/rosen.py
import numpy as np #runas import numpy as np; r = np.arange(1000000); rosen(r) #pythran export rosen(float[]) def rosen(x): t0 = 100 * (x[1:] - x[:-1] ** 2) ** 2 t1 = (1 - x[:-1]) ** 2 return np.sum(t0 + t1)
Add good code for lazy analysis
Add good code for lazy analysis
Python
bsd-3-clause
serge-sans-paille/pythran,pbrunet/pythran,pbrunet/pythran,pombredanne/pythran,pombredanne/pythran,hainm/pythran,serge-sans-paille/pythran,artas360/pythran,artas360/pythran,artas360/pythran,pbrunet/pythran,pombredanne/pythran,hainm/pythran,hainm/pythran
--- +++ @@ -0,0 +1,9 @@ +import numpy as np + +#runas import numpy as np; r = np.arange(1000000); rosen(r) +#pythran export rosen(float[]) + +def rosen(x): + t0 = 100 * (x[1:] - x[:-1] ** 2) ** 2 + t1 = (1 - x[:-1]) ** 2 + return np.sum(t0 + t1)
03d1deca42c9ee2a3d2b51d37e0e6b41485faa10
tools/convert-url-history.py
tools/convert-url-history.py
#!/usr/bin/env python # Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
Add initial URL history importer
Add initial URL history importer
Python
apache-2.0
erasilva/namebench,MANICX100/namebench,kevinxw/namebench,hashem78/namebench,deeb230/namebench,omerhasan/namebench,somehume/namebench,crocleco/namebench,watchamakulit02/namebench,ItsAGeekThing/namebench,bluemask2001/namebench,chosen1/namebench,Forgen/namebench,kristi29091988/namebench,LavyshAlexander/namebench,antsant/n...
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# Copyright 2009 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licen...
43c1b3976625a99fe67cae11ff162324aabc915f
numba/annotate/ir_capture.py
numba/annotate/ir_capture.py
# -*- coding: UTF-8 -*- """ Capture IR emissions. """ from __future__ import print_function, division, absolute_import import collections from .annotate import SourceIntermediate, Source # ______________________________________________________________________ class LLVMIRBuilder(object): def __init__(self, bui...
Add some code to capture IR for annotation
Add some code to capture IR for annotation
Python
bsd-2-clause
ssarangi/numba,seibert/numba,sklam/numba,stonebig/numba,seibert/numba,jriehl/numba,cpcloud/numba,stefanseefeld/numba,pitrou/numba,GaZ3ll3/numba,seibert/numba,sklam/numba,stefanseefeld/numba,numba/numba,IntelLabs/numba,jriehl/numba,numba/numba,GaZ3ll3/numba,ssarangi/numba,gmarkall/numba,pitrou/numba,jriehl/numba,sklam/n...
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: UTF-8 -*- + +""" +Capture IR emissions. +""" + +from __future__ import print_function, division, absolute_import + +import collections +from .annotate import SourceIntermediate, Source + +# ______________________________________________________________________ + +class LLVMIRBu...
c3836bb9528c8dd45486ef0078f15e358a6e3977
ask_api_examples/list_all_c_and_fortran_models.py
ask_api_examples/list_all_c_and_fortran_models.py
"""Queries the CSDMS model repository for all models written in C, C++, Fortran 77, or Fortran 90.""" from ask_api_examples import make_query query = '[[Programming language::C||C++||Fortran77||Fortran90]]|limit=10000' def main(): r = make_query(query, __file__) return r if __name__ == '__main__': pri...
Add example to list all models written in Fortran or C/C++
Add example to list all models written in Fortran or C/C++
Python
mit
mdpiper/csdms-wiki-api-examples
--- +++ @@ -0,0 +1,15 @@ +"""Queries the CSDMS model repository for all models written in C, +C++, Fortran 77, or Fortran 90.""" +from ask_api_examples import make_query + + +query = '[[Programming language::C||C++||Fortran77||Fortran90]]|limit=10000' + + +def main(): + r = make_query(query, __file__) + return ...
9c767eba6236a6130f5985557aeb47d977079737
test/469-transit-features.py
test/469-transit-features.py
# way 91806504 assert_has_feature( 16, 10470, 25316, 'transit', { 'kind': 'bus_stop' }) # node 1241518350 assert_has_feature( 16, 10480, 25332, 'transit', { 'kind': 'bus_stop' }) # way 196670577 assert_has_feature( 16, 10486, 25326, 'transit', { 'kind': 'platform' })
Add tests for transit features
Add tests for transit features
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -0,0 +1,14 @@ +# way 91806504 +assert_has_feature( + 16, 10470, 25316, 'transit', + { 'kind': 'bus_stop' }) + +# node 1241518350 +assert_has_feature( + 16, 10480, 25332, 'transit', + { 'kind': 'bus_stop' }) + +# way 196670577 +assert_has_feature( + 16, 10486, 25326, 'transit', + { 'kind':...
b504b7316ab53a8cf87d2a7c0d23d1fd43208727
cartridge/shop/management/commands/expirecarts.py
cartridge/shop/management/commands/expirecarts.py
from django.core.management.base import BaseCommand from django.core.management.base import CommandError from mezzanine.conf import settings from cartridge.shop.models import * from datetime import timedelta class Command(BaseCommand): help = 'Expire carts' def handle(self, *args, **options): old_ca...
Add management command expire carts to expire carts [upstreamcand]. Well of course this should probably happen automatically, but a workaround for now to cronjob this every few minutes
Add management command expire carts to expire carts [upstreamcand]. Well of course this should probably happen automatically, but a workaround for now to cronjob this every few minutes
Python
bsd-2-clause
jaywink/cartridge-reservable,jaywink/cartridge-reservable,jaywink/cartridge-reservable
--- +++ @@ -0,0 +1,17 @@ +from django.core.management.base import BaseCommand +from django.core.management.base import CommandError +from mezzanine.conf import settings + +from cartridge.shop.models import * + +from datetime import timedelta + +class Command(BaseCommand): + help = 'Expire carts' + + def handle(...
b34e80b1bb387ba833622009a99d8b7301bb649f
tests/compiler/test_method_call_compilation.py
tests/compiler/test_method_call_compilation.py
from tests.compiler import compile_local, SELF_ID, LST_ID, VAL1_ID from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushIndexImmediate, OpcodeCallInternal, OpcodePushMember, \ OpcodePushIndex def test_access_in_method_args(): assert compile_local('self.action(lst[123])') == [ OpcodePushLo...
Add test for method call compilation
Add test for method call compilation
Python
mit
ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang
--- +++ @@ -0,0 +1,20 @@ +from tests.compiler import compile_local, SELF_ID, LST_ID, VAL1_ID +from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushIndexImmediate, OpcodeCallInternal, OpcodePushMember, \ + OpcodePushIndex + + +def test_access_in_method_args(): + assert compile_local('self.action(lst...
b38f7748c2bf51bf99d187d2b7952af0def893d1
pylinks/links/migrations/0002_auto_20170703_1843.py
pylinks/links/migrations/0002_auto_20170703_1843.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import pylinks.links.utils class Migration(migrations.Migration): dependencies = [ ('links', '0001_initial'), ] operations = [ migrations.AlterField( model_name='link', ...
Add migration to switch to Uploadcare
Add migration to switch to Uploadcare
Python
mit
michaelmior/pylinks,michaelmior/pylinks,michaelmior/pylinks
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import pylinks.links.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('links', '0001_initial'), + ] + + operations = [ + migrations.Al...
b6c2c53a73397637c8852187315b74cd8e52c908
scripts/migration/migrate_unregistered_user_emails.py
scripts/migration/migrate_unregistered_user_emails.py
"""Removes User.username from User.emails for unregistered users. """ import logging import sys from modularodm import Q from nose.tools import * from website import models from website.app import init_app from scripts import utils as scripts_utils from tests import factories from tests.base import OsfTestCase lo...
Add migration script for users with unconfirmed emails
Add migration script for users with unconfirmed emails
Python
apache-2.0
Johnetordoff/osf.io,monikagrabowska/osf.io,kch8qx/osf.io,reinaH/osf.io,KAsante95/osf.io,caneruguz/osf.io,KAsante95/osf.io,emetsger/osf.io,TomBaxter/osf.io,acshi/osf.io,sbt9uc/osf.io,doublebits/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,njantrania/osf.io,kch8qx/osf.io,MerlinZhang/osf.io,acshi/osf.io,GageGaskins/o...
--- +++ @@ -0,0 +1,76 @@ +"""Removes User.username from User.emails for unregistered users. + +""" + +import logging +import sys + +from modularodm import Q +from nose.tools import * + +from website import models +from website.app import init_app +from scripts import utils as scripts_utils +from tests import factorie...
c56aef2c927290732dfb8ed65f173f7d8bb58439
git_externals/gitlab_utils.py
git_externals/gitlab_utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time import click import gitlab def iter_projects(gl): page = 0 while True: projects = gl.projects.list(page=page, per_page=10) if len(projects) == 0: break else: page = page + 1 for projec...
Add gittify-gitlab to detete projects by path
Add gittify-gitlab to detete projects by path
Python
mit
develersrl/git-externals,develersrl/git-externals,develersrl/git-externals
--- +++ @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import time + +import click +import gitlab + + +def iter_projects(gl): + page = 0 + while True: + projects = gl.projects.list(page=page, per_page=10) + if len(projects) == 0: + break + else: + ...
4b59c70eb8ea0610f50217a2d9ffaa439be88041
migrations/versions/144_update_calendar_index.py
migrations/versions/144_update_calendar_index.py
"""Update Calendar index. Revision ID: 1c73ca99c03b Revises: 1d7a72222b7c Create Date: 2015-02-26 00:50:52.322510 """ # revision identifiers, used by Alembic. revision = '1c73ca99c03b' down_revision = '1d7a72222b7c' from alembic import op def upgrade(): op.drop_constraint('calendar_ibfk_1', 'calendar', type_=...
Revert "forgot to remove migration"
Revert "forgot to remove migration" This reverts commit 41c9fa093909eced94c18acd03a68a3843fb359f. Reason for rollback: Assuming original commit was a mistake.
Python
agpl-3.0
Eagles2F/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,PriviPK/privipk-sync-engine,ErinCall/sync-engine,PriviPK/privipk-sync-engine,gale320/sync-engine,Eagles2F/sync-engine,Eagles2F/sync-engine,EthanBlackburn/sync-engine,gale320/sync-engine,wakermahmud/sync-engine,Eagles2F/sync-engine,nylas/sync-engine,gale320/s...
--- +++ @@ -0,0 +1,33 @@ +"""Update Calendar index. + +Revision ID: 1c73ca99c03b +Revises: 1d7a72222b7c +Create Date: 2015-02-26 00:50:52.322510 + +""" + +# revision identifiers, used by Alembic. +revision = '1c73ca99c03b' +down_revision = '1d7a72222b7c' + +from alembic import op + + +def upgrade(): + op.drop_cons...
3a7611f6bebc592c1999af996b96d9a812c33ad5
imap_cli/tests/test_config.py
imap_cli/tests/test_config.py
# -*- coding: utf-8 -*- """Test config""" import unittest from imap_cli import config class HelpersTest(unittest.TestCase): def setUp(self): self.config_filename = 'config-example.ini' def test_config_file(self): self.ctx = config.new_context_from_file(self.config_filename) asse...
Add basic test for config module
Add basic test for config module
Python
mit
Gentux/imap-cli,Gentux/imap-cli
--- +++ @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + + +"""Test config""" + + +import unittest + +from imap_cli import config + + +class HelpersTest(unittest.TestCase): + def setUp(self): + self.config_filename = 'config-example.ini' + + def test_config_file(self): + self.ctx = config.new_context_f...
2d342bba72637dcc3191aa2eab34b824e20fe10a
FEMur/solver2D.py
FEMur/solver2D.py
from FEMur import * import sympy as sy import numpy as np import scipy as sc import matplotlib.pyplot as plt import matplotlib.tri as tri import scipy.interpolate from math import ceil class Solver(object): ''' 2-dimensional solver top class. Provides common initialization to all child solver classes. ...
Add skeleton of all 2D solver classes
Add skeleton of all 2D solver classes 3 new classes have been added. Solver class - Top class for all solver child classes SteadyHeatSolver class - Steady state heat transfer solver SteadyStructureSolver class - Steady state structure solver
Python
mit
MrJarv1s/FEMur
--- +++ @@ -0,0 +1,36 @@ +from FEMur import * +import sympy as sy +import numpy as np +import scipy as sc +import matplotlib.pyplot as plt +import matplotlib.tri as tri +import scipy.interpolate +from math import ceil + + +class Solver(object): + ''' + 2-dimensional solver top class. + + Provides common init...