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
060f3d01458af237952a9081fadd523350862f2d
accounts/management/commands/clean_spammers.py
accounts/management/commands/clean_spammers.py
from django.db.models import Q, Count from django.core.management.base import BaseCommand from accounts.models import User class Command(BaseCommand): def handle(self, *args, **kwargs): users = ( User.objects .annotate(game_count=Count('gamelibrary__games')) .filter( ...
Add task to delete spam accounts
Add task to delete spam accounts
Python
agpl-3.0
Turupawn/website,lutris/website,Turupawn/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website
--- +++ @@ -0,0 +1,22 @@ +from django.db.models import Q, Count +from django.core.management.base import BaseCommand +from accounts.models import User + + +class Command(BaseCommand): + def handle(self, *args, **kwargs): + users = ( + User.objects + .annotate(game_count=Count('gamelibr...
6f148fb1bb047b4977c8fcd1d898c231bed3fc9d
indra/tests/test_dart_client.py
indra/tests/test_dart_client.py
import json from indra.literature.dart_client import jsonify_query_data def test_timestamp(): # Should ignore "after" assert jsonify_query_data(timestamp={'on': '2020-01-01', 'after': '2020-01-02'}) == \ json.dumps({"timestamp": {"on": "2020-01-01"}}) asser...
Add two tests for dart client
Add two tests for dart client
Python
bsd-2-clause
sorgerlab/belpy,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra
--- +++ @@ -0,0 +1,20 @@ +import json +from indra.literature.dart_client import jsonify_query_data + + +def test_timestamp(): + # Should ignore "after" + assert jsonify_query_data(timestamp={'on': '2020-01-01', + 'after': '2020-01-02'}) == \ + json.dumps({"timestam...
de79ece940d244d2346b45cb27840f4bfbb32b20
iscc_bench/title_length.py
iscc_bench/title_length.py
# -*- coding: utf-8 -*- """Script to measure title length statisics""" from itertools import cycle import numpy as np from iscc_bench.readers import ALL_READERS def iter_titles(): """Iterate over titles""" readers = [r() for r in ALL_READERS] for reader in cycle(readers): meta = next(reader) ...
Add script to measure title length statistics
Add script to measure title length statistics
Python
bsd-2-clause
coblo/isccbench
--- +++ @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +"""Script to measure title length statisics""" +from itertools import cycle +import numpy as np +from iscc_bench.readers import ALL_READERS + + +def iter_titles(): + """Iterate over titles""" + readers = [r() for r in ALL_READERS] + for reader in cycle(reade...
625ab38d0509d43620292f471bccee38d66d1fe6
leetcode/remove_duplicates_from_sorted_array.py
leetcode/remove_duplicates_from_sorted_array.py
""" Please read this as markdown: # Algorithm description Problem statement: https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/727/ The algorithm implemented is as follows: 1. Check for two base cases: 1. When `nums` is empty 2. When `nums` length is 1 In both cases return...
Add solution for: Remove Duplicates from Sorted Array
Add solution for: Remove Duplicates from Sorted Array
Python
mit
julianespinel/trainning,julianespinel/training,julianespinel/training,julianespinel/training,julianespinel/trainning,julianespinel/training
--- +++ @@ -0,0 +1,82 @@ +""" +Please read this as markdown: + +# Algorithm description + +Problem statement: https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/727/ + +The algorithm implemented is as follows: +1. Check for two base cases: + 1. When `nums` is empty + 2. When `nums...
5ac31a4baedc9ee6e704392e8c42dd474199fb90
examples/basics/visuals/bezier.py
examples/basics/visuals/bezier.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2015, Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # -------------------------------------------------------------------------...
Add an example how to draw Bezier curves.
Add an example how to draw Bezier curves. The vispy.geometry.curves module provides several helper functions to generate the right vertices for a nice curved line.
Python
bsd-3-clause
bollu/vispy,sbtlaarzc/vispy,QuLogic/vispy,srinathv/vispy,RebeccaWPerry/vispy,drufat/vispy,bollu/vispy,michaelaye/vispy,ghisvail/vispy,drufat/vispy,ghisvail/vispy,RebeccaWPerry/vispy,QuLogic/vispy,kkuunnddaannkk/vispy,jay3sh/vispy,inclement/vispy,julienr/vispy,dchilds7/Deysha-Star-Formation,michaelaye/vispy,srinathv/vis...
--- +++ @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# ----------------------------------------------------------------------------- +# Copyright (c) 2015, Vispy Development Team. All Rights Reserved. +# Distributed under the (new) BSD License. See LICENSE.txt for more info. +# -----------------------------------------...
880c69f0de40c4ad4ec0eddf65e10b3bbd955c6f
indico/util/caching_test.py
indico/util/caching_test.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Add unit test for memoize_request
Add unit test for memoize_request
Python
mit
ThiefMaster/indico,indico/indico,ThiefMaster/indico,OmeGak/indico,pferreir/indico,mvidalgarcia/indico,DirkHoffmann/indico,mvidalgarcia/indico,mic4ael/indico,DirkHoffmann/indico,indico/indico,OmeGak/indico,ThiefMaster/indico,pferreir/indico,mic4ael/indico,indico/indico,DirkHoffmann/indico,mvidalgarcia/indico,indico/indi...
--- +++ @@ -0,0 +1,56 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either ...
68de70260e4ad9649ada6ef283e2ec93ac732762
website/jdpages/migrations/0002_auto_orderfield_verbose_name.py
website/jdpages/migrations/0002_auto_orderfield_verbose_name.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import mezzanine.core.fields class Migration(migrations.Migration): dependencies = [ ('jdpages', '0001_initial'), ] operations = [ migrations.AlterField( model_name='colu...
Create migration after upgrading to mezzanine 4
Create migration after upgrading to mezzanine 4
Python
mit
jonge-democraten/website,jonge-democraten/website,jonge-democraten/website,jonge-democraten/website
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import mezzanine.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('jdpages', '0001_initial'), + ] + + operations = [ + migration...
1a81ef87d7d763957533f0f9e62b12834bfb38bb
tests/test_tasks.py
tests/test_tasks.py
# Copyright 2017 Codethink Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Add initial test suite for nighttrain.tasks module
tests: Add initial test suite for nighttrain.tasks module This overlaps with the main test suite so far, but will be useful once the task list format becomes more complex.
Python
apache-2.0
ssssam/nightbus,ssssam/nightbus
--- +++ @@ -0,0 +1,29 @@ +# Copyright 2017 Codethink Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by a...
3095e39499df1db93c7fd8771f44504a38986fde
src/sentry/migrations/0063_remove_bad_groupedmessage_index.py
src/sentry/migrations/0063_remove_bad_groupedmessage_index.py
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Removing unique constraint on 'GroupedMessage', fields ['logger', 'view', 'checksum'] db.delete_unique('sentry_gr...
Clean up an old index in sentry_groupedmessage
Clean up an old index in sentry_groupedmessage The original migration version 0015 was supposed to remove this, but the ordering of the index fields in the migration script didn't match the actual index. 0015 has: db.delete_unique('sentry_groupedmessage', ['checksum', 'logger', 'view']) but the order should be: ...
Python
bsd-3-clause
looker/sentry,SilentCircle/sentry,vperron/sentry,jokey2k/sentry,rdio/sentry,gencer/sentry,daevaorn/sentry,pauloschilling/sentry,SilentCircle/sentry,alexm92/sentry,songyi199111/sentry,ifduyue/sentry,mvaled/sentry,ewdurbin/sentry,alexm92/sentry,kevinlondon/sentry,Kryz/sentry,looker/sentry,BayanGroup/sentry,nicholasserra/...
--- +++ @@ -0,0 +1,15 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Removing unique constraint on 'GroupedMessage', fields ['logger', 'view', 'checksum'...
f3f7db3064afea812c47c1edd3115ce5cec2b558
modules/module_wolfram_alpha.py
modules/module_wolfram_alpha.py
import requests import urllib import logging try: from lxml import etree print("running with lxml.etree") except ImportError: print("module_wolfram_alpha requires lxml.etree for xpath support") appid = None query = "http://api.wolframalpha.com/v2/query?input=%s&appid=%s" log = logging.getLogger('wolfram_alpha'...
Add module for wolfram alpha queries via their API
Add module for wolfram alpha queries via their API git-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@330 dda364a1-ef19-0410-af65-756c83048fb2
Python
bsd-3-clause
aapa/pyfibot,aapa/pyfibot,rnyberg/pyfibot,lepinkainen/pyfibot,rnyberg/pyfibot,EArmour/pyfibot,huqa/pyfibot,huqa/pyfibot,lepinkainen/pyfibot,EArmour/pyfibot
--- +++ @@ -0,0 +1,58 @@ +import requests +import urllib +import logging + +try: + from lxml import etree + print("running with lxml.etree") +except ImportError: + print("module_wolfram_alpha requires lxml.etree for xpath support") + +appid = None +query = "http://api.wolframalpha.com/v2/query?input=%s&appid=%s" +...
2de823ae11e1337f114457bf4e49275d8d2eda99
recursive_binary_search.py
recursive_binary_search.py
def binary_search(array, low, high, item): if(low>high) : return -1 mid = (low + high)//2 if(item == array[mid]): return mid elif item < array[mid]: return binary_search(array, low, mid-1, item) elif item > array[mid]: return binary_search(array, mid+1, high, item...
Add recursive binary search implementation
Add recursive binary search implementation
Python
mit
arafat-al-mahmud/algorithms-python
--- +++ @@ -0,0 +1,18 @@ + +def binary_search(array, low, high, item): + + if(low>high) : + return -1 + + mid = (low + high)//2 + + if(item == array[mid]): + return mid + elif item < array[mid]: + return binary_search(array, low, mid-1, item) + elif item > array[mid]: + retu...
befadd8fc0482adb55f63ac51166f2330c897d7a
src/diamond/handler/httpHandler.py
src/diamond/handler/httpHandler.py
#!/usr/bin/env python # coding=utf-8 from Handler import Handler import urllib2 class HttpPostHandler(Handler): # Inititalize Handler with url and batch size def __init__(self, config=None): Handler.__init__(self, config) self.metrics = [] self.batch_size = int(self.config.get('batch', 1...
#!/usr/bin/env python # coding=utf-8 """ Send metrics to a http endpoint via POST #### Dependencies * urllib2 #### Configuration Enable this handler * handers = diamond.handler.httpHandler.HttpPostHandler * url = http://www.example.com/endpoint """ from Handler import Handler import urllib2 class HttpPo...
Add in basic HttpPostHandler docs
Add in basic HttpPostHandler docs
Python
mit
szibis/Diamond,sebbrandt87/Diamond,TinLe/Diamond,datafiniti/Diamond,Ssawa/Diamond,ramjothikumar/Diamond,signalfx/Diamond,codepython/Diamond,mfriedenhagen/Diamond,thardie/Diamond,works-mobile/Diamond,cannium/Diamond,eMerzh/Diamond-1,actmd/Diamond,Netuitive/Diamond,jriguera/Diamond,TinLe/Diamond,bmhatfield/Diamond,hvnswe...
--- +++ @@ -1,5 +1,22 @@ #!/usr/bin/env python # coding=utf-8 + +""" +Send metrics to a http endpoint via POST + +#### Dependencies + + * urllib2 + + +#### Configuration +Enable this handler + + * handers = diamond.handler.httpHandler.HttpPostHandler + + * url = http://www.example.com/endpoint + +""" from Hand...
be0d4b9e2e62490cab62a39499e570bdab1ac2f5
cmp_imgs.py
cmp_imgs.py
#!/bin/env python3 import numpy as np import matplotlib.pyplot as plt from scipy.ndimage import imread def rgb2gray(img): return np.dot(img, [0.299, 0.587, 0.114]) if __name__ == "__main__": img_name = "1920x1080.jpg" img = imread(img_name) gray_img = rgb2gray(img) plt.imshow(gray_img, cmap=plt.cm.gray) pl...
Convert an image to grayscale and resize it.
Convert an image to grayscale and resize it.
Python
mit
HKervadec/cmp_imgs
--- +++ @@ -0,0 +1,28 @@ +#!/bin/env python3 + +import numpy as np +import matplotlib.pyplot as plt +from scipy.ndimage import imread + +def rgb2gray(img): + return np.dot(img, [0.299, 0.587, 0.114]) + + + +if __name__ == "__main__": + img_name = "1920x1080.jpg" + + img = imread(img_name) + + gray_img = rgb2gray(img)...
20d7a5cff131448f1960ac8cd03550739e19d698
utest/namespace/test_retrievercontextfactory.py
utest/namespace/test_retrievercontextfactory.py
import unittest from robotide.namespace.namespace import _RetrieverContextFactory from robot.parsing.model import ResourceFile from robot.utils.asserts import assert_equals def datafileWithVariables(vars): data = ResourceFile() for var in vars: data.variable_table.add(var, vars[var]) return data ...
Add test for retriever context factory
Add test for retriever context factory
Python
apache-2.0
robotframework/RIDE,caio2k/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,fingeronthebutton/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,caio2k/RIDE,HelioGuilherme66/RIDE
--- +++ @@ -0,0 +1,24 @@ +import unittest +from robotide.namespace.namespace import _RetrieverContextFactory +from robot.parsing.model import ResourceFile +from robot.utils.asserts import assert_equals + + +def datafileWithVariables(vars): + data = ResourceFile() + for var in vars: + data.variable_table....
a809ba1af45726f8aed7ba4b079063629406c52b
st2common/tests/unit/test_service_setup.py
st2common/tests/unit/test_service_setup.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add a test case for invalid log level friendly error message during service setup.
Add a test case for invalid log level friendly error message during service setup.
Python
apache-2.0
StackStorm/st2,nzlosh/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2
--- +++ @@ -0,0 +1,74 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
447206a785b9563e82dfbd28e1cd2c5ef10a57f2
src/ggrc_risks/migrations/versions/20151029154646_2837682ad516_rename_threat_actors_to_threat.py
src/ggrc_risks/migrations/versions/20151029154646_2837682ad516_rename_threat_actors_to_threat.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: anze@reciprocitylabs.com # Maintained By: anze@reciprocitylabs.com """Rename threat actors to threat Revision ID: 2837682ad516 Revises: 39518b8ea2...
Add a migration for threat actor -> threat
Add a migration for threat actor -> threat
Python
apache-2.0
plamut/ggrc-core,andrei-karalionak/ggrc-core,josthkko/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,jmakov/ggrc-core,prasannav7/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,josthkko/g...
--- +++ @@ -0,0 +1,26 @@ +# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> +# Created By: anze@reciprocitylabs.com +# Maintained By: anze@reciprocitylabs.com + +"""Rename threat actors to threat + +Revision I...
6be193e6287a1823d6216205e5dbdbcb46895612
Lib/test/test_timing.py
Lib/test/test_timing.py
from test_support import verbose import timing r = range(100000) if verbose: print 'starting...' timing.start() for i in r: pass timing.finish() if verbose: print 'finished' secs = timing.seconds() milli = timing.milli() micro = timing.micro() if verbose: print 'seconds:', secs print 'milli :', ...
Test of the timing module
Test of the timing module
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,21 @@ +from test_support import verbose +import timing + +r = range(100000) +if verbose: + print 'starting...' +timing.start() +for i in r: + pass +timing.finish() +if verbose: + print 'finished' + +secs = timing.seconds() +milli = timing.milli() +micro = timing.micro() + +if verbose: + ...
e38211248504bb87b73775e0157a7e1d2dace6ed
lib/util/lamearecord.py
lib/util/lamearecord.py
# coding: utf-8 import os import re import shlex from subprocess import Popen, PIPE def available_devices(): devices =[] os.environ['LANG'] = 'C' command = 'arecord -l' arecord_l = Popen(shlex.split(command), stdout=PIPE, stderr=PIPE) arecord_l.wait() if arecord_l.returncode != 0: p...
Add sound recording tool with arecord and lame
Add sound recording tool with arecord and lame
Python
apache-2.0
nknytk/home-recorder,nknytk/home-recorder
--- +++ @@ -0,0 +1,35 @@ +# coding: utf-8 + +import os +import re +import shlex +from subprocess import Popen, PIPE + + +def available_devices(): + devices =[] + + os.environ['LANG'] = 'C' + command = 'arecord -l' + arecord_l = Popen(shlex.split(command), stdout=PIPE, stderr=PIPE) + arecord_l.wait() + ...
2adea388d387ff78778dc4e79045ff3d9a6780ae
tests/framework_tests/test_oauth_scopes.py
tests/framework_tests/test_oauth_scopes.py
# -*- coding: utf-8 -*- from nose.tools import assert_in from unittest import TestCase from framework.auth import oauth_scopes class TestOAuthScopes(TestCase): def test_each_public_scope_includes_ALWAYS_PUBLIC(self): for scope in oauth_scopes.public_scopes.itervalues(): assert_in(oauth_scopes...
Add test for ALWAYS_PUBLIC injection behavior
Add test for ALWAYS_PUBLIC injection behavior
Python
apache-2.0
monikagrabowska/osf.io,HalcyonChimera/osf.io,adlius/osf.io,Johnetordoff/osf.io,leb2dg/osf.io,DanielSBrown/osf.io,cwisecarver/osf.io,DanielSBrown/osf.io,monikagrabowska/osf.io,Nesiehr/osf.io,adlius/osf.io,cslzchen/osf.io,wearpants/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,hmoco/osf.io,mattclark/osf.io,alexs...
--- +++ @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from nose.tools import assert_in +from unittest import TestCase + +from framework.auth import oauth_scopes + +class TestOAuthScopes(TestCase): + + def test_each_public_scope_includes_ALWAYS_PUBLIC(self): + for scope in oauth_scopes.public_scopes.itervalues(...
7d7699bd40b84aee3d210899999c666044943814
show_samples_lfw_conditional.py
show_samples_lfw_conditional.py
from pylearn2.utils import serial import sys _, model_path = sys.argv model = serial.load(model_path) space = model.generator.get_output_space() from pylearn2.config import yaml_parse from pylearn2.datasets import dense_design_matrix from pylearn2.gui.patch_viewer import PatchViewer import numpy as np dataset = yaml_p...
Add sampler for conditional LFW(crop)
Add sampler for conditional LFW(crop)
Python
bsd-3-clause
hans/adversarial
--- +++ @@ -0,0 +1,49 @@ +from pylearn2.utils import serial +import sys +_, model_path = sys.argv +model = serial.load(model_path) +space = model.generator.get_output_space() +from pylearn2.config import yaml_parse +from pylearn2.datasets import dense_design_matrix +from pylearn2.gui.patch_viewer import PatchViewer +...
e06590cf16cbf2e52c247c6e5a518103cf4278c2
migrations/versions/780_remove_unused_cols.py
migrations/versions/780_remove_unused_cols.py
"""Remove agreement_returned_at, countersigned_at and agreement_details columns from supplier_framework table as they are no longer used Revision ID: 780 Revises: 770 Create Date: 2016-11-07 10:14:00.000000 """ # revision identifiers, used by Alembic. revision = '780' down_revision = '770' from alembic import op...
Add migration to drop now-unused supplier_framework columns
Add migration to drop now-unused supplier_framework columns The recent addition of the framework_agreement table means that these columns are no longer needed. (They are no longer referred to anywhere in the API code.)
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,30 @@ +"""Remove agreement_returned_at, countersigned_at and agreement_details + columns from supplier_framework table as they are no longer used + +Revision ID: 780 +Revises: 770 +Create Date: 2016-11-07 10:14:00.000000 + +""" + +# revision identifiers, used by Alembic. +revision = '780' +down_r...
09b35b09c5265ebff9dffbef876df1100a569339
zerver/migrations/0405_set_default_for_enable_read_receipts.py
zerver/migrations/0405_set_default_for_enable_read_receipts.py
# Generated by Django 4.0.6 on 2022-08-08 16:52 from django.db import migrations from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Q def set_default_for_enable_read_receipts( apps: StateApps, schema_editor: Base...
Add migration to set default value of enable_read_receipts.
migrations: Add migration to set default value of enable_read_receipts. This migration set default value of enable_read_receipts to True for existing realms which require an invitation to join.
Python
apache-2.0
andersk/zulip,zulip/zulip,zulip/zulip,andersk/zulip,zulip/zulip,rht/zulip,rht/zulip,andersk/zulip,rht/zulip,zulip/zulip,rht/zulip,andersk/zulip,zulip/zulip,andersk/zulip,zulip/zulip,rht/zulip,andersk/zulip,rht/zulip,andersk/zulip,zulip/zulip,rht/zulip
--- +++ @@ -0,0 +1,28 @@ +# Generated by Django 4.0.6 on 2022-08-08 16:52 + +from django.db import migrations +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor +from django.db.migrations.state import StateApps +from django.db.models import Q + + +def set_default_for_enable_read_receipts( + ...
9e0acc72cf34659c3a95a3495cfa4c5536bb15b7
senlin/tests/tempest/api/clusters/test_cluster_show_negative.py
senlin/tests/tempest/api/clusters/test_cluster_show_negative.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Add negative test for cluster show
Add negative test for cluster show The negative tests in tempest will check the exceptions raised from an invalid request, so this patch will follow. It will request a invalid cluster and check the NotFound error. Change-Id: Ib602800b6e0d184b6a0b9146d79530d8d68289d4
Python
apache-2.0
openstack/senlin,openstack/senlin,openstack/senlin,stackforge/senlin,stackforge/senlin
--- +++ @@ -0,0 +1,28 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writi...
cf8934f07b9d5a7b022d4030f8549f05e6391e35
sense/version.py
sense/version.py
VERSION = "0.0.8" # Add User-Agent and optional token encoding with sense.app_secret key. #"0.0.7": Fix a bug in Feed instance_url (case of adressing a feed by type on a retrieved feed) # 0.0.6: Allow addressing feed by node uid + feed type # 0.0.5: Enable Node update # 0.0.4: Add method to post event # 0.0.3: Allow No...
VERSION = "0.0.9" # Add parameters handling to the save method #"0.0.8" # Add User-Agent and optional token encoding with sense.app_secret key. #"0.0.7": Fix a bug in Feed instance_url (case of adressing a feed by type on a retrieved feed) # 0.0.6: Allow addressing feed by node uid + feed type # 0.0.5: Enable Node upda...
Add parameters handling to the save method
Add parameters handling to the save method
Python
mit
Sense-API/sense-python-client
--- +++ @@ -1,4 +1,5 @@ -VERSION = "0.0.8" # Add User-Agent and optional token encoding with sense.app_secret key. +VERSION = "0.0.9" # Add parameters handling to the save method +#"0.0.8" # Add User-Agent and optional token encoding with sense.app_secret key. #"0.0.7": Fix a bug in Feed instance_url (case of adress...
59835b91ee82a8d5d12d27992b6494f9487f6848
testing/schur_nullspace.py
testing/schur_nullspace.py
from firedrake import * from firedrake.slate.preconditioners import create_schur_nullspace import numpy as np mesh = UnitCubedSphereMesh(2) mesh.init_cell_orientations(SpatialCoordinate(mesh)) n = FacetNormal(mesh) V = FunctionSpace(mesh, "RTCF", 1) Q = FunctionSpace(mesh, "DG", 0) W = V*Q sigma, u = TrialFunctions...
Add test for computing nullspace of the Schur operator
Add test for computing nullspace of the Schur operator
Python
mit
thomasgibson/firedrake-hybridization
--- +++ @@ -0,0 +1,57 @@ +from firedrake import * +from firedrake.slate.preconditioners import create_schur_nullspace +import numpy as np + +mesh = UnitCubedSphereMesh(2) +mesh.init_cell_orientations(SpatialCoordinate(mesh)) + +n = FacetNormal(mesh) + +V = FunctionSpace(mesh, "RTCF", 1) +Q = FunctionSpace(mesh, "DG",...
cd003fa1d57b442d6889442d0b1815fc3312505c
toolbox/replicate_graph.py
toolbox/replicate_graph.py
import sys import commentjson as json import os import argparse import numpy as np import copy sys.path.append('../.') sys.path.append('.') from progressbar import ProgressBar if __name__ == "__main__": parser = argparse.ArgumentParser(description='Replicate nodes, links, divisions and exclusion sets N times, ' \...
Add script to artificially increase the size of graphs by replicating all nodes and their links
Add script to artificially increase the size of graphs by replicating all nodes and their links
Python
mit
chaubold/hytra,chaubold/hytra,chaubold/hytra
--- +++ @@ -0,0 +1,62 @@ +import sys +import commentjson as json +import os +import argparse +import numpy as np +import copy + +sys.path.append('../.') +sys.path.append('.') +from progressbar import ProgressBar + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Replicate nodes, links, d...
ec30e63bc7d82ab77b7951d4deec0d9c6778c243
emgapimetadata/management/commands/test-data.py
emgapimetadata/management/commands/test-data.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import csv from django.core.management.base import BaseCommand from emgapimetadata import models as m_models class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('importpath', type=str) def handle(self, *args, **optio...
Add command line tool to import metadata
Add command line tool to import metadata
Python
apache-2.0
EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi,EBI-Metagenomics/emgapi
--- +++ @@ -0,0 +1,57 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os +import csv + +from django.core.management.base import BaseCommand + +from emgapimetadata import models as m_models + + +class Command(BaseCommand): + + def add_arguments(self, parser): + parser.add_argument('importpath', type...
688fd5fb5a4dcc754ab13ccc7db7d43f56088c71
tests/test_optimizer.py
tests/test_optimizer.py
from unittest import TestCase import numpy as np from chainer import cuda, Optimizer from chainer.optimizer import _sqnorm cuda.init() class TestOptimizerUtility(TestCase): def setUp(self): # x is an arithmetic progression of length 6 # whose common difference is 0.5 self.x = np.linspace(-...
Add unittest for utility functions of optimizer
Add unittest for utility functions of optimizer
Python
mit
muupan/chainer,1986ks/chainer,kikusu/chainer,wkentaro/chainer,tscohen/chainer,ytoyama/yans_chainer_hackathon,rezoo/chainer,delta2323/chainer,AlpacaDB/chainer,hvy/chainer,jnishi/chainer,hvy/chainer,keisuke-umezawa/chainer,cupy/cupy,cupy/cupy,minhpqn/chainer,niboshi/chainer,hvy/chainer,wavelets/chainer,chainer/chainer,ke...
--- +++ @@ -0,0 +1,32 @@ +from unittest import TestCase +import numpy as np +from chainer import cuda, Optimizer +from chainer.optimizer import _sqnorm + +cuda.init() + +class TestOptimizerUtility(TestCase): + def setUp(self): + # x is an arithmetic progression of length 6 + # whose common difference...
bffbc23b730081b5cd071a50c2755ecee4adfe99
tests/test_create_simple.py
tests/test_create_simple.py
import npc import pytest import os @pytest.fixture def characters(campaign, prefs): os.mkdir(prefs.get('paths.characters')) return campaign @pytest.fixture(params=['human', 'fetch', 'goblin']) def commandline(request): return ['g', 'testmann', request.param, '-g', 'fork', 'spoon'] def test_missing_templa...
Add tests for simple char creation
Add tests for simple char creation
Python
mit
aurule/npc,aurule/npc
--- +++ @@ -0,0 +1,39 @@ +import npc +import pytest +import os + +@pytest.fixture +def characters(campaign, prefs): + os.mkdir(prefs.get('paths.characters')) + return campaign + +@pytest.fixture(params=['human', 'fetch', 'goblin']) +def commandline(request): + return ['g', 'testmann', request.param, '-g', 'f...
619dcc460dc54dc06555b6bf880ed1c50b3d5dda
scripts/two_way_temperature_conversion.py
scripts/two_way_temperature_conversion.py
# Temperature Conversion Program (Celcius-Fahrenheit / Fahrenheit-Celcius) # Display program welcome print('This program will convert temperatures (Fahrenheit/Celcius)') print('Enter (F) to convert Fahrenheit to Celcius') print('Enter (C) to convert Celcius to Fahrenheit') # Get Temperature to convert which = raw_inp...
Apply it 1 from lecture 4 added
Apply it 1 from lecture 4 added
Python
mit
NAU-CFL/Python_Learning_Source
--- +++ @@ -0,0 +1,19 @@ +# Temperature Conversion Program (Celcius-Fahrenheit / Fahrenheit-Celcius) + +# Display program welcome +print('This program will convert temperatures (Fahrenheit/Celcius)') +print('Enter (F) to convert Fahrenheit to Celcius') +print('Enter (C) to convert Celcius to Fahrenheit') + +# Get Tem...
0ef78781d0c4048f2fbe26c05cf81b3ec4f59d26
virtool/tests/test_users.py
virtool/tests/test_users.py
import hashlib from virtool.utils import random_alphanumeric from virtool.users import hash_password, check_password, check_legacy_password class TestHashPassword: def test_basic(self): assert check_password("hello_world", hash_password("hello_world")) class TestLegacyHashPassword: def test_basic...
Add tests for password hashing and checking
Add tests for password hashing and checking
Python
mit
virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool
--- +++ @@ -0,0 +1,20 @@ +import hashlib + +from virtool.utils import random_alphanumeric +from virtool.users import hash_password, check_password, check_legacy_password + + +class TestHashPassword: + + def test_basic(self): + assert check_password("hello_world", hash_password("hello_world")) + + +class Tes...
edd8ac2d77b747cffbcf702e71f2633a148d64c6
wagtail/wagtailcore/hooks.py
wagtail/wagtailcore/hooks.py
from django.conf import settings try: from importlib import import_module except ImportError: # for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7) from django.utils.importlib import import_module _hooks = {} def register(hook_name, fn=None): """ Register hook for ``...
from django.conf import settings try: from importlib import import_module except ImportError: # for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7) from django.utils.importlib import import_module _hooks = {} def register(hook_name, fn=None): """ Register hook for ``...
Return the function again from the hook decorator
Return the function again from the hook decorator The decorator variant of hook registration did not return anything, meaning that the decorated function would end up being `None`. This was not noticed, as the functions are rarely called manually, as opposed to being invoked via the hook.
Python
bsd-3-clause
kaedroho/wagtail,willcodefortea/wagtail,JoshBarr/wagtail,takeshineshiro/wagtail,torchbox/wagtail,dresiu/wagtail,m-sanders/wagtail,jnns/wagtail,bjesus/wagtail,jorge-marques/wagtail,nilnvoid/wagtail,timorieber/wagtail,rsalmaso/wagtail,Toshakins/wagtail,tangentlabs/wagtail,nimasmi/wagtail,WQuanfeng/wagtail,timorieber/wagt...
--- +++ @@ -25,7 +25,10 @@ # Pretend to be a decorator if fn is not supplied if fn is None: - return lambda fn: register(hook_name, fn) + def decorator(fn): + register(hook_name, fn) + return fn + return decorator if hook_name not in _hooks: _hook...
00bd680b7711d48b22043308871d91d560a69944
rabbitmq-req-rep-server.py
rabbitmq-req-rep-server.py
#!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) channel = connection.channel() channel.queue_declare(queue='rpc_queue') def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) def ...
Add rabbitmq request reply server
Add rabbitmq request reply server
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python +import pika + +connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) + +channel = connection.channel() + +channel.queue_declare(queue='rpc_queue') + +def fib(n): + if n == 0: + return 0 + elif n == 1: + return 1 + else...
a60968a4f75067e56e32a55539b8fe2e90e67665
2013-nov-bronze/1-combo/py/main.py
2013-nov-bronze/1-combo/py/main.py
import itertools def read_combo(file): return [int(x) - 1 for x in file.readline().split()]; def permute(combo, size): return [[x % size for x in permutation] for permutation in itertools.product(*[range(v - 2, v + 3) for v in combo])] fin = open('combo.in', 'r') size = int(fin.readline()) fout = open('combo.out'...
Add Python 2 and 3 solution for Nov. 2013 Bronze Problem 1
Add Python 2 and 3 solution for Nov. 2013 Bronze Problem 1
Python
mit
hsun324/usaco-solutions,hsun324/usaco-solutions
--- +++ @@ -0,0 +1,16 @@ +import itertools + +def read_combo(file): + return [int(x) - 1 for x in file.readline().split()]; + +def permute(combo, size): + return [[x % size for x in permutation] for permutation in itertools.product(*[range(v - 2, v + 3) for v in combo])] + +fin = open('combo.in', 'r') +size = int(fin...
6f19bb060f0cd906763cd5875227cdb6afb24c7b
tempest/tests/services/compute/test_availability_zone_client.py
tempest/tests/services/compute/test_availability_zone_client.py
# Copyright 2015 NEC Corporation. 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 unit test for availability_zone_client
Add unit test for availability_zone_client This patch adds unit test for availability_zone_client. Change-Id: I9f043f0cf864773cbd15c23f776487a729c09692
Python
apache-2.0
bigswitch/tempest,tonyli71/tempest,zsoltdudas/lis-tempest,Juniper/tempest,bigswitch/tempest,LIS/lis-tempest,vedujoshi/tempest,vedujoshi/tempest,flyingfish007/tempest,Tesora/tesora-tempest,izadorozhna/tempest,Tesora/tesora-tempest,rakeshmi/tempest,flyingfish007/tempest,pczerkas/tempest,pczerkas/tempest,tonyli71/tempest,...
--- +++ @@ -0,0 +1,61 @@ +# Copyright 2015 NEC Corporation. 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/L...
467ba634991629affc3a53bef2e93ed02d7d1ae7
trypython/py38/fstring_debug.py
trypython/py38/fstring_debug.py
""" Python 3.8 にて導入された f-string での {xxx=} 表記についてのサンプルです。 REFERENCES:: http://bit.ly/2NlJkSc """ from trypython.common.commoncls import SampleBase class Sample(SampleBase): def exec(self): # ------------------------------------------------------------ # f-string debugging specifier # ...
Add Python 3.8 f-string debugging specifier.
Add Python 3.8 f-string debugging specifier.
Python
mit
devlights/try-python
--- +++ @@ -0,0 +1,31 @@ +""" +Python 3.8 にて導入された f-string での {xxx=} 表記についてのサンプルです。 + +REFERENCES:: http://bit.ly/2NlJkSc +""" +from trypython.common.commoncls import SampleBase + + +class Sample(SampleBase): + def exec(self): + # ------------------------------------------------------------ + # f-str...
dcd053e0249b14c938d94eb749a8b4095c80be29
wqflask/utility/pillow_utils.py
wqflask/utility/pillow_utils.py
from PIL import Image, ImageColor, ImageDraw, ImageFont import utility.logger logger = utility.logger.getLogger(__name__ ) BLACK = ImageColor.getrgb("black") # def draw_rotated_text(canvas: Image, text: str, font: ImageFont, xy: tuple, fill: ImageColor=BLACK, angle: int=-90): def draw_rotated_text(canvas, text, font,...
Create new utility module for drawing
Create new utility module for drawing * wqflask/utility/pillow_utils.py: Create a module to hold some utility functions for drawing with Pillow. Initialise the module with a function to draw rotated text.
Python
agpl-3.0
zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2
--- +++ @@ -0,0 +1,16 @@ +from PIL import Image, ImageColor, ImageDraw, ImageFont + +import utility.logger +logger = utility.logger.getLogger(__name__ ) + +BLACK = ImageColor.getrgb("black") +# def draw_rotated_text(canvas: Image, text: str, font: ImageFont, xy: tuple, fill: ImageColor=BLACK, angle: int=-90): +def dr...
bc8292286bc372a58c3dca70af179536bff7c67a
tests/views/test_provincial_legislatures_page.py
tests/views/test_provincial_legislatures_page.py
from tests import PMGLiveServerTestCase from tests.fixtures import dbfixture, HouseData, CommitteeData from pmg.models import House from pmg.views import utils class TestProvincialLegislaturesPages(PMGLiveServerTestCase): def setUp(self): super(TestProvincialLegislaturesPages, self).setUp() self....
Add test for provincial legislatures page
Add test for provincial legislatures page
Python
apache-2.0
Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2
--- +++ @@ -0,0 +1,41 @@ +from tests import PMGLiveServerTestCase +from tests.fixtures import dbfixture, HouseData, CommitteeData +from pmg.models import House +from pmg.views import utils + + +class TestProvincialLegislaturesPages(PMGLiveServerTestCase): + def setUp(self): + super(TestProvincialLegislature...
ae900a60b714e76b9c3d4310b3ed9120afa780fe
conflict_minerals_data/api/migrations/0003_auto_20170704_1055.py
conflict_minerals_data/api/migrations/0003_auto_20170704_1055.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-04 17:55 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api', '0002_auto_20170704_1028'), ] operations = [ migrations.AlterModelOptions( ...
Add migration for meta names
Add migration for meta names
Python
mit
MiningTheDisclosures/conflict-minerals-data,MiningTheDisclosures/conflict-minerals-data,MiningTheDisclosures/conflict-minerals-data,MiningTheDisclosures/conflict-minerals-data
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-07-04 17:55 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0002_auto_20170704_1028'), + ] + + operations = [...
28449fe72be77c9515610e9542ab24ebf6d8b311
osf/management/commands/count_preregistrations.py
osf/management/commands/count_preregistrations.py
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand from osf.models import Registration, MetaSchema PREREG_SCHEMA_NAMES = [ 'Prereg Challenge', 'AsPredicted Preregistration', 'OSF-Standard Pre-Data Collection Registration', 'Replication Recipe (Brandt et al., 2013): Pre-Registra...
Add command to get number of preregistrations by schema
Add command to get number of preregistrations by schema
Python
apache-2.0
TomBaxter/osf.io,mattclark/osf.io,chrisseto/osf.io,caseyrollins/osf.io,leb2dg/osf.io,sloria/osf.io,brianjgeiger/osf.io,binoculars/osf.io,HalcyonChimera/osf.io,aaxelb/osf.io,laurenrevere/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,leb2dg/osf.io,crcresearch/osf.io,mattclark/osf.io,adlius/osf.io,erinspace/osf.io,fellio...
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from django.core.management.base import BaseCommand +from osf.models import Registration, MetaSchema + +PREREG_SCHEMA_NAMES = [ + 'Prereg Challenge', + 'AsPredicted Preregistration', + 'OSF-Standard Pre-Data Collection Registration', + 'Replication Recipe...
b93c75d710e75bf28bf3f007251725195ec7c945
notifications/migrations/0004_auto_20150826_1508.py
notifications/migrations/0004_auto_20150826_1508.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import notifications.models class Migration(migrations.Migration): dependencies = [ ('notifications', '0003_notification_data'), ] operations = [ migrations.AlterField( m...
Add missing migration for Notification model
Add missing migration for Notification model
Python
bsd-3-clause
alazaro/django-notifications,letolab/django-notifications,LegoStormtroopr/django-notifications,error0608/django-notifications,iberben/django-notifications,Evidlo/django-notifications,iberben/django-notifications,iberben/django-notifications,LegoStormtroopr/django-notifications,zhang-z/django-notifications,error0608/dja...
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import notifications.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('notifications', '0003_notification_data'), + ] + + operations = [ + ...
d7c07abbc50b536531a5f622a089690d5ff5faa3
examples/plot_digits_classification.py
examples/plot_digits_classification.py
""" ================================ Recognizing hand-written digits ================================ An example showing how the scikit-learn can be used to recognize images of hand-written digits. """ # Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # License: Simplified BSD # Standard scientifi...
Add an example doing classification on digits.
ENH/DOC: Add an example doing classification on digits. git-svn-id: a2d1b0e147e530765aaf3e1662d4a98e2f63c719@669 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
Python
bsd-3-clause
AlexanderFabisch/scikit-learn,sarahgrogan/scikit-learn,gotomypc/scikit-learn,jpautom/scikit-learn,cainiaocome/scikit-learn,shyamalschandra/scikit-learn,gclenaghan/scikit-learn,chrsrds/scikit-learn,rahuldhote/scikit-learn,ldirer/scikit-learn,sinhrks/scikit-learn,hdmetor/scikit-learn,lucidfrontier45/scikit-learn,cainiaoc...
--- +++ @@ -0,0 +1,52 @@ +""" +================================ +Recognizing hand-written digits +================================ + +An example showing how the scikit-learn can be used to recognize images of +hand-written digits. + +""" +# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org> +# License...
0c095cd6f1e7e04aed458f635acb3101b25d319a
umibukela/migrations/0014_auto_20170110_1019.py
umibukela/migrations/0014_auto_20170110_1019.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('umibukela', '0013_auto_20161215_1252'), ] operations = [ migrations.RemoveField( model_name='surveysource', ...
Add forgotten table delete for table we don't need
Add forgotten table delete for table we don't need
Python
mit
Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela,Code4SA/umibukela
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('umibukela', '0013_auto_20161215_1252'), + ] + + operations = [ + migrations.RemoveField( + ...
02c0c3bd4b5ff7629af35bfb8a21dba38133033e
scripts/mvf_read_benchmark.py
scripts/mvf_read_benchmark.py
#!/usr/bin/env python from __future__ import print_function, division, absolute_import from builtins import range import argparse import logging import time import katdal from katdal.lazy_indexer import DaskLazyIndexer import dask.array as da import numpy as np parser = argparse.ArgumentParser() parser.add_argument...
Add a tool for benchmarking read performance
Add a tool for benchmarking read performance It's not installed, on the assumption that it will be used by katdal developers, not users.
Python
bsd-3-clause
ska-sa/katdal
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +from __future__ import print_function, division, absolute_import +from builtins import range +import argparse +import logging +import time + +import katdal +from katdal.lazy_indexer import DaskLazyIndexer +import dask.array as da +import numpy as np + + +parser = arg...
2c3e29c78e2600b33380847352f914049f2b9f25
ynr/apps/people/migrations/0006_move_person_gfks.py
ynr/apps/people/migrations/0006_move_person_gfks.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-10-29 15:10 from __future__ import unicode_literals from django.db import migrations def move_popolo_person_gfks_to_people_person(apps, schema_editor): PeoplePerson = apps.get_model("people", "Person") PopoloPerson = apps.get_model("popolo", "Perso...
Move GenericForeignKeys from popolo.Person to people.Person
Move GenericForeignKeys from popolo.Person to people.Person This was missing from the work to move People to the person app
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2018-10-29 15:10 +from __future__ import unicode_literals + +from django.db import migrations + + +def move_popolo_person_gfks_to_people_person(apps, schema_editor): + PeoplePerson = apps.get_model("people", "Person") + PopoloPer...
8fa5871adb9b872d1ac1117810b8511a8325ad5c
openprescribing/dmd/management/commands/summarise_ncso_concessions.py
openprescribing/dmd/management/commands/summarise_ncso_concessions.py
from datetime import date from django.core.management import BaseCommand from dmd.models import NCSOConcession class Command(BaseCommand): def handle(self, *args, **kwargs): today = date.today() first_of_month = date(today.year, today.month, 1) num_concessions = NCSOConcession.objects.c...
Add task to summarise concessions
Add task to summarise concessions
Python
mit
annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc
--- +++ @@ -0,0 +1,51 @@ +from datetime import date + +from django.core.management import BaseCommand + +from dmd.models import NCSOConcession + + +class Command(BaseCommand): + def handle(self, *args, **kwargs): + today = date.today() + first_of_month = date(today.year, today.month, 1) + + nu...
149534662f865793bbff7e54027af6751039a682
code/test1/continued_fraction.py
code/test1/continued_fraction.py
#!/usr/bin/python3 import time def c_frac(n): s = 1 for i in range(0, n): s = 1.0 + 1.0 / s return s start_time = time.time() print(c_frac(1000000)) print("--- %f seconds ---" % (time.time() - start_time))
Add old code from test1.
Add old code from test1.
Python
mit
djpetti/csci2963-DanielPetti,djpetti/csci2963-DanielPetti,djpetti/csci2963-DanielPetti,djpetti/csci2963-DanielPetti
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + + +import time + + +def c_frac(n): + s = 1 + for i in range(0, n): + s = 1.0 + 1.0 / s + + return s + + +start_time = time.time() +print(c_frac(1000000)) +print("--- %f seconds ---" % (time.time() - start_time))
58ca779abe014e85509555c274ae6960e152b9ca
eche/eche_types.py
eche/eche_types.py
class Symbol(str): pass # lists class List(list): def __add__(self, rhs): return List(list.__add__(self, rhs)) def __getitem__(self, i): if type(i) == slice: return List(list.__getitem__(self, i)) elif i >= len(self): return None else: r...
Create Symbol, List, Boolean, Nil and Atom types.
Create Symbol, List, Boolean, Nil and Atom types.
Python
mit
skk/eche
--- +++ @@ -0,0 +1,54 @@ +class Symbol(str): + pass + + +# lists +class List(list): + def __add__(self, rhs): + return List(list.__add__(self, rhs)) + + def __getitem__(self, i): + if type(i) == slice: + return List(list.__getitem__(self, i)) + elif i >= len(self): + ...
a6f291a3beb7ecb7d67b81fe92e7cca6db2139dc
example_scraper.py
example_scraper.py
#!/usr/bin/env python import json import requests API = 'http://localhost:8000/api/1.0' AUTH_PARAMS = { 'email': 'panda@pandaproject.net', 'api_key': 'edfe6c5ffd1be4d3bf22f69188ac6bc0fc04c84b' } # Create dataset dataset = { 'name': 'Test Dataset from API', 'schema': [{ 'column': 'A', ...
#!/usr/bin/env python import json import requests API = 'http://localhost:8000/api/1.0' AUTH_PARAMS = { 'email': 'panda@pandaproject.net', 'api_key': 'edfe6c5ffd1be4d3bf22f69188ac6bc0fc04c84b' } DATASET_SLUG = 'test-dataset' # Check if dataset exists response = requests.get(API + '/dataset/%s/' % DATASET_SL...
Update example scraper to use known slug.
Update example scraper to use known slug.
Python
mit
PalmBeachPost/panda,pandaproject/panda,PalmBeachPost/panda,newsapps/panda,ibrahimcesar/panda,pandaproject/panda,NUKnightLab/panda,ibrahimcesar/panda,NUKnightLab/panda,datadesk/panda,PalmBeachPost/panda,PalmBeachPost/panda,NUKnightLab/panda,ibrahimcesar/panda,datadesk/panda,ibrahimcesar/panda,pandaproject/panda,newsapps...
--- +++ @@ -9,25 +9,28 @@ 'email': 'panda@pandaproject.net', 'api_key': 'edfe6c5ffd1be4d3bf22f69188ac6bc0fc04c84b' } +DATASET_SLUG = 'test-dataset' -# Create dataset -dataset = { - 'name': 'Test Dataset from API', - 'schema': [{ - 'column': 'A', - 'type': 'unicode' - }, { - ...
bf57364ed872b25bbc4864cf9171b2345a5c0e09
api/rest/resources/plugin.py
api/rest/resources/plugin.py
########################################################################### # (C) Vrije Universiteit, Amsterdam (the Netherlands) # # # # This file is part of AmCAT - The Amsterdam Content Analysis Toolkit # # ...
Fix uploader bugs and make medium text field; add textarea for entering text directly
Fix uploader bugs and make medium text field; add textarea for entering text directly
Python
agpl-3.0
amcat/amcat,amcat/amcat,tschmorleiz/amcat,amcat/amcat,amcat/amcat,amcat/amcat,tschmorleiz/amcat,tschmorleiz/amcat,tschmorleiz/amcat,tschmorleiz/amcat,amcat/amcat
--- +++ @@ -0,0 +1,33 @@ +########################################################################### +# (C) Vrije Universiteit, Amsterdam (the Netherlands) # +# # +# This file is part of AmCAT - The Amsterdam Content Analysis...
4973b0dff43f60e91af70349847b8cfc256004c5
credentials/apps/catalog/migrations/0013_drop_old_start_end_fields.py
credentials/apps/catalog/migrations/0013_drop_old_start_end_fields.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-10-31 18:08 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('catalog', '0012_courserun_copy_column_values'), ] operations = [ migrations.Remove...
Rename start and end fields (4.2/4)
Rename start and end fields (4.2/4) This is the 4.2th stage of renaming the start and end fields of CourseRun to start_date and end_date. This release ONLY removes the old columns via migration. Note that this does not include removing the django model fields corresponding to the old columns. DE-1708
Python
agpl-3.0
edx/credentials,edx/credentials,edx/credentials,edx/credentials
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.25 on 2019-10-31 18:08 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalog', '0012_courserun_copy_column_values'), + ] + + ...
5bd191920c0e0fa5bc869999473bc638030e3ba7
notifications/migrations/0003_create_default_user_created_template.py
notifications/migrations/0003_create_default_user_created_template.py
from django.db import migrations NOTIFICATION_TYPES = ('user_created',) LANGUAGES = ['fi'] DEFAULT_LANGUAGE = 'fi' FOOTER_FI = 'Tämä on automaattinen viesti Helsingin kaupungin tapahtumarajapinnasta. Viestiin ei voi vastata.\n' HTML_SEPARATOR = '\n<br/><br/>\n' USER_CREATED_SUBJECT_FI = "Uusi käyttäjätunnus luotu -...
Add migration to create "user created" template
Add migration to create "user created" template
Python
mit
City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents
--- +++ @@ -0,0 +1,71 @@ +from django.db import migrations + +NOTIFICATION_TYPES = ('user_created',) +LANGUAGES = ['fi'] +DEFAULT_LANGUAGE = 'fi' + +FOOTER_FI = 'Tämä on automaattinen viesti Helsingin kaupungin tapahtumarajapinnasta. Viestiin ei voi vastata.\n' + +HTML_SEPARATOR = '\n<br/><br/>\n' + +USER_CREATED_SUB...
1feb96590df3f10a7205f43d472ce27ec278360e
spraakbanken/s5/spr_local/reconstruct_corpus.py
spraakbanken/s5/spr_local/reconstruct_corpus.py
#!/usr/bin/env python3 import argparse import collections import random import sys def reconstruct(f_in, f_out): sentence_starts = [] contexts = {} for line in f_in: parts = line.split() words = parts[:-1] count = int(parts[-1]) if words[0] == "<s>" and words[-1] == "<...
Add reconstruct corpus as a test
Add reconstruct corpus as a test
Python
apache-2.0
psmit/kaldi-recipes,psmit/kaldi-recipes,phsmit/kaldi-recipes,phsmit/kaldi-recipes,psmit/kaldi-recipes
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +import argparse +import collections +import random + +import sys + + +def reconstruct(f_in, f_out): + sentence_starts = [] + + contexts = {} + + for line in f_in: + parts = line.split() + words = parts[:-1] + count = int(parts[-1]) + + ...
f497d51a9736cfac5ececaf1a729a04ad74ea8bd
huffman.py
huffman.py
class Node: def __init__(self): self.name = '' self.weight = 0 self.code = '' def initSet(self, name, weight): self.name = name self.weight = weight
Initialize and declare class Node
Initialize and declare class Node
Python
mit
hane1818/Algorithm_HW3_huffman_code
--- +++ @@ -0,0 +1,10 @@ +class Node: + + def __init__(self): + self.name = '' + self.weight = 0 + self.code = '' + + def initSet(self, name, weight): + self.name = name + self.weight = weight
ea8c2f9007c9356bf24f66119153c4e844e5483f
watcher.py
watcher.py
import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler class ScriptModifiedHandler(PatternMatchingEventHandler): patterns = ['*.py'] def __init__(self): super(ScriptModifiedHandler, self).__init__() # you can add some init code here def proc...
Add watchdog that monitors scripts editing
Add watchdog that monitors scripts editing
Python
mit
duboviy/misc
--- +++ @@ -0,0 +1,41 @@ +import time +from watchdog.observers import Observer +from watchdog.events import PatternMatchingEventHandler + + +class ScriptModifiedHandler(PatternMatchingEventHandler): + patterns = ['*.py'] + + def __init__(self): + super(ScriptModifiedHandler, self).__init__() + # you can...
6f28fc31a9734cc36f3e41759ce20852beb890f8
sara_flexbe_states/src/sara_flexbe_states/WonderlandPatchPerson.py
sara_flexbe_states/src/sara_flexbe_states/WonderlandPatchPerson.py
#!/usr/bin/env python # encoding=utf8 import requests from flexbe_core import EventState, Logger """ Created on 17/05/2018 @author: Lucas Maurice """ class WonderlandPatchPerson(EventState): ''' Patch (update) a person. ># entity sara_msgs/Entity <= done retur...
Add a state for patch a person in wonderland.
Add a state for patch a person in wonderland.
Python
bsd-3-clause
WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors
--- +++ @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# encoding=utf8 + +import requests +from flexbe_core import EventState, Logger + +""" +Created on 17/05/2018 + +@author: Lucas Maurice +""" + + +class WonderlandPatchPerson(EventState): + ''' + Patch (update) a person. + ># entity sara_msgs/E...
521888f703466375ac36fab8c53ddf0c242d73e8
deployment/ansible/callback_plugins/profile_tasks.py
deployment/ansible/callback_plugins/profile_tasks.py
""" Author: Jharrod LaFon See also: https://github.com/jlafon/ansible-profile """ import time class CallbackModule(object): """ A plugin for timing tasks """ def __init__(self): self.stats = {} self.current = None def playbook_on_task_start(self, name, is_conditional): ""...
Add Ansible callback plugin to profile tasks
Add Ansible callback plugin to profile tasks In order to try and speed up provisioning, this changeset adds a plugin that gives you the per task duration breakdown of a playbook. From here, we can identify the outliers and spend a little time making them faster. Example tiler output: ``` PLAY RECAP *****************...
Python
apache-2.0
lliss/model-my-watershed,mmcfarland/model-my-watershed,lewfish/model-my-watershed,mmcfarland/model-my-watershed,lliss/model-my-watershed,lliss/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed,kdeloach/model-my-watershed,kdeloach/model-my-watershed,lliss/model-my-watershed,project-icp/bee-...
--- +++ @@ -0,0 +1,58 @@ +""" +Author: Jharrod LaFon +See also: https://github.com/jlafon/ansible-profile +""" + +import time + + +class CallbackModule(object): + """ + A plugin for timing tasks + """ + def __init__(self): + self.stats = {} + self.current = None + + def playbook_on_task_s...
96777c29a8b9d27da8bc6098ee7cfc2ce9bf368f
polling_stations/apps/data_collection/management/commands/import_bromsgrove.py
polling_stations/apps/data_collection/management/commands/import_bromsgrove.py
""" Import Bromsgrove """ import sys from data_collection.management.commands import BaseShpShpImporter class Command(BaseShpShpImporter): """ Imports the Polling Station data from Bromsgrove """ council_id = 'E07000234' districts_name = 'Electoral Boundaries 2' stations_name = 'Bromsgrov...
Add an importer for Bromsgrove.
Add an importer for Bromsgrove. refs #24
Python
bsd-3-clause
andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
--- +++ @@ -0,0 +1,28 @@ +""" +Import Bromsgrove +""" +import sys + +from data_collection.management.commands import BaseShpShpImporter + +class Command(BaseShpShpImporter): + """ + Imports the Polling Station data from Bromsgrove + """ + council_id = 'E07000234' + districts_name = 'Electoral Bound...
aa554e0a67d69518da5cec8d97799497e3d996c4
fetchwikidatadata.py
fetchwikidatadata.py
# coding=utf-8 import urllib, urllib2 import json def fetch_wikidata_data(): WIKIDATA_API_URL = 'https://www.wikidata.org/w/api.php' param = {} param['action'] = 'query' param['format'] = 'json' param['generator'] = 'allpages' param['gapnamespace'] = 120 param['gaplimit'] = 'max' param['prop'] = 'pageterms' p...
Add script to download property data from Wikidata.
Add script to download property data from Wikidata.
Python
apache-2.0
jankohoener/asknow-UI,jankohoener/asknow-UI,jankohoener/asknow-UI
--- +++ @@ -0,0 +1,35 @@ +# coding=utf-8 +import urllib, urllib2 +import json + +def fetch_wikidata_data(): + WIKIDATA_API_URL = 'https://www.wikidata.org/w/api.php' + param = {} + param['action'] = 'query' + param['format'] = 'json' + param['generator'] = 'allpages' + param['gapnamespace'] = 120 + param['gaplimit'] ...
e6675dcda6721acb6ad70adc68f1e33ce8190fc4
doc/examples/plot_pyramid.py
doc/examples/plot_pyramid.py
""" ==================== Build image pyramids ==================== This example shows how to build image pyramids. """ import numpy as np import matplotlib.pyplot as plt from skimage import data from skimage import img_as_float from skimage.transform import build_gaussian_pyramid image = data.lena() rows, cols, di...
Add example script for image pyramids
Add example script for image pyramids
Python
bsd-3-clause
SamHames/scikit-image,oew1v07/scikit-image,vighneshbirodkar/scikit-image,robintw/scikit-image,paalge/scikit-image,pratapvardhan/scikit-image,emon10005/scikit-image,bsipocz/scikit-image,chintak/scikit-image,jwiggins/scikit-image,ofgulban/scikit-image,paalge/scikit-image,ClinicalGraphics/scikit-image,Midafi/scikit-image,...
--- +++ @@ -0,0 +1,32 @@ +""" +==================== +Build image pyramids +==================== + +This example shows how to build image pyramids. +""" + +import numpy as np +import matplotlib.pyplot as plt + +from skimage import data +from skimage import img_as_float +from skimage.transform import build_gaussian_pyr...
a979ae85c16fd9f6e9e3c1f4ad8fa0261d212b88
status.py
status.py
max_db_int = 4294967295 UNKNOWN_HTTP = max_db_int - 1 UNKNOWN_NON_HTTP = max_db_int - 3 BOT_TIMEOUT = 0.25 CLIENT_TIMEOUT = 2
Add file for constants and magic numbers
Add file for constants and magic numbers This is the file where things like default timeouts, statuses to write in a database and others will be stored. The code is more readable and importable from any other file.
Python
mit
Zloool/manyfaced-honeypot
--- +++ @@ -0,0 +1,5 @@ +max_db_int = 4294967295 +UNKNOWN_HTTP = max_db_int - 1 +UNKNOWN_NON_HTTP = max_db_int - 3 +BOT_TIMEOUT = 0.25 +CLIENT_TIMEOUT = 2
42415eb9bab1d4e5ac5b4c5bafe5234d0a617367
migrations/versions/770_set_submitted_at_for_old_brief_responses.py
migrations/versions/770_set_submitted_at_for_old_brief_responses.py
"""set submitted at for old brief responses Revision ID: 770 Revises: 760 Create Date: 2016-10-25 11:10:53.245586 """ # revision identifiers, used by Alembic. revision = '770' down_revision = '760' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): op.execute(...
Add migration that sets `submitted_at` for old brief responses
Add migration that sets `submitted_at` for old brief responses For any brief response that does not have a `submitted_at` time, we add one based on the `created_at` time. As we will now be looking at `submitted_at` rather than `created_at` to indicate a submitted brief response, we need to migrate all older brief resp...
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,27 @@ +"""set submitted at for old brief responses + +Revision ID: 770 +Revises: 760 +Create Date: 2016-10-25 11:10:53.245586 + +""" + +# revision identifiers, used by Alembic. +revision = '770' +down_revision = '760' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects impo...
efdb5b328ccf2597ab05ff2c225c36793199ec50
webapp/request_api.py
webapp/request_api.py
from django.db import connection import requests def get(http_url, user_id): headers = { 'Authorization': __auth_token(user_id) } r = requests.get(http_url, headers=headers) return r.json() def post(http_url, user_id, json_data): headers = { 'Authorization': __auth_token(user_id...
Implement libray to use API
Implement libray to use API
Python
apache-2.0
deka108/meas_deka,deka108/mathqa-server,deka108/meas_deka,deka108/mathqa-server,deka108/meas_deka,deka108/meas_deka,deka108/mathqa-server,deka108/mathqa-server
--- +++ @@ -0,0 +1,27 @@ +from django.db import connection +import requests + + +def get(http_url, user_id): + headers = { + 'Authorization': __auth_token(user_id) + } + r = requests.get(http_url, headers=headers) + + return r.json() + + +def post(http_url, user_id, json_data): + headers = { + ...
11f92aaee9c8f9f902ddc56203dfa2e7af94ea63
tuneme/migrations/0002_add_language_relation.py
tuneme/migrations/0002_add_language_relation.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def add_language_relation(apps, schema_editor): from molo.core.models import SiteLanguage, LanguageRelation from wagtail.wagtailcore.models import Page if not (SiteLanguage.objects.filter(is_main_language=Tr...
Add language relation to existing pages
Add language relation to existing pages
Python
bsd-2-clause
praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def add_language_relation(apps, schema_editor): + from molo.core.models import SiteLanguage, LanguageRelation + from wagtail.wagtailcore.models import Page + + if not (SiteLangu...
d3a4153edcc25b358cfe3b0f0b315cbf064266bd
lintcode/Medium/105_Copy_List_with_Random_Pointer.py
lintcode/Medium/105_Copy_List_with_Random_Pointer.py
# Definition for singly-linked list with a random pointer. # class RandomListNode: # def __init__(self, x): # self.label = x # self.next = None # self.random = None class Solution: # @param head: A RandomListNode # @return: A RandomListNode def copyRandomList(self, head): ...
Add solution to lintcode question 105
Add solution to lintcode question 105
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,51 @@ +# Definition for singly-linked list with a random pointer. +# class RandomListNode: +# def __init__(self, x): +# self.label = x +# self.next = None +# self.random = None +class Solution: + # @param head: A RandomListNode + # @return: A RandomListNode + de...
53ac7ef266899651fa9b73b402baa35cf920a31d
scripts/fix_nodes_templated_from_registration.py
scripts/fix_nodes_templated_from_registration.py
# -*- coding: utf-8 -*- import sys import logging from website.app import setup_django, init_app from scripts import utils as script_utils from django.db import transaction setup_django() from osf.models import AbstractNode logger = logging.getLogger(__name__) def do_migration(): nodes = AbstractNode.objects.f...
Add script to clean up nodes that were templated from registrations
Add script to clean up nodes that were templated from registrations [OSF-7956]
Python
apache-2.0
TomBaxter/osf.io,caneruguz/osf.io,binoculars/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,aaxelb/osf.io,cslzchen/osf.io,aaxelb/osf.io,saradbowman/osf.io,caseyrollins/osf.io,mfraezz/osf.io,pattisdr/osf.io,felliott/osf.io,chrisseto/osf.io,leb2dg/osf.io,mattclark/osf.io,TomBaxter/osf.io,cslzchen/osf...
--- +++ @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +import sys +import logging +from website.app import setup_django, init_app +from scripts import utils as script_utils +from django.db import transaction + +setup_django() +from osf.models import AbstractNode + + +logger = logging.getLogger(__name__) + + +def do_migra...
79aa5fb22c71590f367ee4b0e8906df2a8693c27
saleor/core/tests/test_anonymize.py
saleor/core/tests/test_anonymize.py
from ..anonymize import obfuscate_address, obfuscate_email, obfuscate_string def test_obfuscate_email(): # given email = "abc@gmail.com" # when result = obfuscate_email(email) # then assert result == "a...@example.com" def test_obfuscate_email_example_email(): # given email = "abc@...
Add tests for anpnymize methods
Add tests for anpnymize methods
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
--- +++ @@ -0,0 +1,89 @@ +from ..anonymize import obfuscate_address, obfuscate_email, obfuscate_string + + +def test_obfuscate_email(): + # given + email = "abc@gmail.com" + + # when + result = obfuscate_email(email) + + # then + assert result == "a...@example.com" + + +def test_obfuscate_email_exam...
7bf86f0ef0572e86370726ff25479d051b3fbd3e
scripts/check_dataset_integrity.py
scripts/check_dataset_integrity.py
import os from collections import defaultdict import click import dtoolcore @click.command() @click.argument('dataset_path') def main(dataset_path): uri = "disk:{}".format(dataset_path) proto_dataset = dtoolcore.ProtoDataSet.from_uri(uri) overlays = defaultdict(dict) for handle in proto_dataset....
Add script to check dataset integrity
Add script to check dataset integrity
Python
mit
JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field,JIC-Image-Analysis/senescence-in-field
--- +++ @@ -0,0 +1,34 @@ +import os + +from collections import defaultdict + +import click + +import dtoolcore + + +@click.command() +@click.argument('dataset_path') +def main(dataset_path): + + uri = "disk:{}".format(dataset_path) + + proto_dataset = dtoolcore.ProtoDataSet.from_uri(uri) + + overlays = defau...
34af85c3ed74ef40f20b22d874facbca48f89d13
adhocracy/migration/versions/029_add_user_badges.py
adhocracy/migration/versions/029_add_user_badges.py
from datetime import datetime from sqlalchemy import MetaData, Column, ForeignKey, Table from sqlalchemy import DateTime, Integer, Unicode metadata = MetaData() badge_table = Table('badge', metadata, Column('id', Integer, primary_key=True), Column('create_time', DateTime, default=datetime.utcnow), Colum...
Add migration script for user badges
Add migration script for user badges
Python
agpl-3.0
DanielNeugebauer/adhocracy,SysTheron/adhocracy,alkadis/vcv,SysTheron/adhocracy,liqd/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,phihag/adhocracy,alkadis/vcv,liqd/adhocracy,phihag/adhocracy,phihag/adhocracy,liqd/adhocracy,SysTheron/adhocracy,phihag/adhocracy,phihag/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,a...
--- +++ @@ -0,0 +1,33 @@ +from datetime import datetime + +from sqlalchemy import MetaData, Column, ForeignKey, Table +from sqlalchemy import DateTime, Integer, Unicode + +metadata = MetaData() + + +badge_table = Table('badge', metadata, + Column('id', Integer, primary_key=True), + Column('create_time', DateTim...
a388af55a88602318159b8a52150a6a49e1be6f7
requests_oauth2/services.py
requests_oauth2/services.py
from requests_oauth2 import OAuth2 class GoogleClient(OAuth2): site = "https://accounts.google.com" authorization_url = "/o/oauth2/auth" token_url = "/o/oauth2/token" scope_sep = " " class FacebookClient(OAuth2): site = "https://www.facebook.com/" authorization_url = "/dialog/oauth" toke...
Add some shortcuts for Google, Facebook, Instagram
Add some shortcuts for Google, Facebook, Instagram
Python
bsd-3-clause
maraujop/requests-oauth2
--- +++ @@ -0,0 +1,22 @@ +from requests_oauth2 import OAuth2 + + +class GoogleClient(OAuth2): + site = "https://accounts.google.com" + authorization_url = "/o/oauth2/auth" + token_url = "/o/oauth2/token" + scope_sep = " " + + +class FacebookClient(OAuth2): + site = "https://www.facebook.com/" + auth...
0816398dae4fd7f35a4eba3b4a6545798703ca44
hacker-rank/fb-hack-2018/degenerate_triangle.py
hacker-rank/fb-hack-2018/degenerate_triangle.py
def triangleOrNot(a, b, c): n = len(a) result = [] for i in range(n): side_a = a[i] side_b = b[i] side_c = c[i] print(side_a,side_b,side_c) sort_arr = qsort([side_a,side_b,side_c]) print(sort_arr) result.append('No' if (sort_arr[0] + sort_arr[1] <= sor...
Add solution for FB Melbourne 2018 Hackahton Pre-eliminary Challenge
Add solution for FB Melbourne 2018 Hackahton Pre-eliminary Challenge
Python
mit
martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox,martindavid/code-sandbox
--- +++ @@ -0,0 +1,25 @@ +def triangleOrNot(a, b, c): + n = len(a) + result = [] + for i in range(n): + side_a = a[i] + side_b = b[i] + side_c = c[i] + print(side_a,side_b,side_c) + sort_arr = qsort([side_a,side_b,side_c]) + print(sort_arr) + result.append('No...
fae8889ae24ab5dcb8ea28af1664fb5a54fdbdfb
junction/schedule/migrations/0004_auto_20150917_2017.py
junction/schedule/migrations/0004_auto_20150917_2017.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('schedule', '0003_scheduleitemtype'), ] operations = [ migrations.AlterField( model_name='scheduleitem', ...
Add migration for session choices
Add migration for session choices
Python
mit
ChillarAnand/junction,farhaanbukhsh/junction,nava45/junction,pythonindia/junction,ChillarAnand/junction,nava45/junction,ChillarAnand/junction,pythonindia/junction,pythonindia/junction,farhaanbukhsh/junction,farhaanbukhsh/junction,pythonindia/junction,ChillarAnand/junction,nava45/junction,farhaanbukhsh/junction,nava45/j...
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('schedule', '0003_scheduleitemtype'), + ] + + operations = [ + migrations.AlterField( + ...
2a198df61a420e97b746d1a27a0f622be56e386c
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}.py
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}.py
# -*- coding: utf-8 -*- """ {{cookiecutter.repo_name}} ============================ The root of :class:`{{cookiecutter.app_class_name}}` is created from the kv file. """ import kivy kivy.require('{{cookiecutter.kivy_version}}') from kivy.app import App class {{cookiecutter.app_class_name}}(App): """Basic Kivy...
Implement a basic kivy application
Implement a basic kivy application
Python
mit
hackebrot/cookiedozer,hackebrot/cookiedozer
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +""" +{{cookiecutter.repo_name}} +============================ + +The root of :class:`{{cookiecutter.app_class_name}}` is created from the kv file. +""" + +import kivy +kivy.require('{{cookiecutter.kivy_version}}') + +from kivy.app import App + + +class {{cookiecutt...
0c79848797b5bbe89579144f16845daf3cee5da6
server/crashmanager/urls.py
server/crashmanager/urls.py
from django.conf.urls import patterns, include, url from rest_framework import routers from crashmanager import views router = routers.DefaultRouter() router.register(r'signatures', views.BucketViewSet) router.register(r'crashes', views.CrashEntryViewSet) urlpatterns = patterns('', url(r'^rest/api-auth/', include...
from django.conf.urls import patterns, include, url from rest_framework import routers from crashmanager import views router = routers.DefaultRouter() router.register(r'signatures', views.BucketViewSet) router.register(r'crashes', views.CrashEntryViewSet) urlpatterns = patterns('', url(r'^rest/api-auth/', include...
Remove the "view/" part for viewing signatures
Remove the "view/" part for viewing signatures
Python
mpl-2.0
lazyparser/FuzzManager,cihatix/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,sigma-random/FuzzManager,MozillaSecurity/FuzzManager,cihatix/FuzzManager,sigma-random/FuzzManager,MozillaSecurity/FuzzManager,sigma-random/FuzzManager,cihatix/FuzzManager,lazyparser/FuzzManager,lazyparser/FuzzManager,MozillaSecurity...
--- +++ @@ -14,7 +14,7 @@ url(r'^signatures/new/$', views.newSignature, name='signew'), url(r'^signatures/(?P<sigid>\d+)/edit/$', views.editSignature, name='sigedit'), url(r'^signatures/(?P<sigid>\d+)/linkextbug/$', views.editSignature, name='linkextbug'), - url(r'^signatures/(?P<sigid>\d+)/view/$',...
21e02b839b058fbc8069d9140278b9a2ffc7d6d6
tests/services/playlists_service.py
tests/services/playlists_service.py
from tests.base import ApiDBTestCase from zou.app.models.playlist import Playlist from zou.app.services import ( files_service, playlists_service, tasks_service ) class PlaylistsServiceTestCase(ApiDBTestCase): def setUp(self): super(PlaylistsServiceTestCase, self).setUp() self.gener...
Add some tests to playlists service
Add some tests to playlists service
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,78 @@ +from tests.base import ApiDBTestCase + +from zou.app.models.playlist import Playlist +from zou.app.services import ( + files_service, + playlists_service, + tasks_service +) + + +class PlaylistsServiceTestCase(ApiDBTestCase): + + def setUp(self): + super(PlaylistsServiceTe...
6ab9f5c047c5cb0d76ed5115fa4307e436696699
tests/test_composite_association.py
tests/test_composite_association.py
# flake8: noqa F401,F811 from gaphor import UML from gaphor.core.modeling import Diagram from gaphor.diagram.tests.fixtures import ( connect, create, diagram, element_factory, event_manager, ) from gaphor.UML.classes import AssociationItem, ClassItem from gaphor.UML.classes.classespropertypages impo...
Add test for composite association with property pages
Add test for composite association with property pages
Python
lgpl-2.1
amolenaar/gaphor,amolenaar/gaphor
--- +++ @@ -0,0 +1,26 @@ +# flake8: noqa F401,F811 +from gaphor import UML +from gaphor.core.modeling import Diagram +from gaphor.diagram.tests.fixtures import ( + connect, + create, + diagram, + element_factory, + event_manager, +) +from gaphor.UML.classes import AssociationItem, ClassItem +from gapho...
7435cf43180e32fe0b17f3ca839c030d09ab09d5
skyfield/tests/test_topos.py
skyfield/tests/test_topos.py
from skyfield.api import load from skyfield.positionlib import Geocentric from skyfield.toposlib import Topos def ts(): yield load.timescale() def test_beneath(ts): t = ts.utc(2018, 1, 19, 14, 37, 55) def f(xyz): return str(Topos.beneath(Geocentric(xyz, None, t))) assert f([1, 0, 0]) == 'Topos 00deg 0...
Add basic test of Topos.beneath()
Add basic test of Topos.beneath()
Python
mit
skyfielders/python-skyfield,skyfielders/python-skyfield
--- +++ @@ -0,0 +1,13 @@ +from skyfield.api import load +from skyfield.positionlib import Geocentric +from skyfield.toposlib import Topos + +def ts(): + yield load.timescale() + +def test_beneath(ts): + t = ts.utc(2018, 1, 19, 14, 37, 55) + def f(xyz): return str(Topos.beneath(Geocentric(xyz, None, t))) + ...
9e067b8f53c8ee8afae63996e725614e5766059f
tests/aggregate/test_many_to_many_relationships.py
tests/aggregate/test_many_to_many_relationships.py
import sqlalchemy as sa from sqlalchemy_utils.aggregates import aggregated from tests import TestCase class TestAggregatesWithManyToManyRelationships(TestCase): dns = 'postgres://postgres@localhost/sqlalchemy_utils_test' def create_models(self): user_group = sa.Table('user_group', self.Base.metadata,...
Add tests for many to many aggregates
Add tests for many to many aggregates
Python
bsd-3-clause
JackWink/sqlalchemy-utils,rmoorman/sqlalchemy-utils,marrybird/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,cheungpat/sqlalchemy-utils,joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,spoqa/sqlalchemy-utils
--- +++ @@ -0,0 +1,69 @@ +import sqlalchemy as sa +from sqlalchemy_utils.aggregates import aggregated +from tests import TestCase + + +class TestAggregatesWithManyToManyRelationships(TestCase): + dns = 'postgres://postgres@localhost/sqlalchemy_utils_test' + + def create_models(self): + user_group = sa.Ta...
06d6f989abacb048e54585847dec37cb55064685
benchmark/datasets/musicbrainz/extract-random-queries.py
benchmark/datasets/musicbrainz/extract-random-queries.py
#!/usr/bin/env python """ Script to extract and then generate random queries for fuzzy searching. Usage: ./extract-random-queries.py <infile> <outfile> """ import os from random import choice, randint, random import string from subprocess import call import sys from tempfile import mkstemp __author__ = "Uwe L. K...
Add script to generate random Levenshtein queries from a set of strings
Add script to generate random Levenshtein queries from a set of strings
Python
mit
xhochy/libfuzzymatch,xhochy/libfuzzymatch
--- +++ @@ -0,0 +1,40 @@ +#!/usr/bin/env python +""" +Script to extract and then generate random queries for fuzzy searching. + +Usage: + ./extract-random-queries.py <infile> <outfile> +""" + +import os +from random import choice, randint, random +import string +from subprocess import call +import sys +from tempfi...
02568861b778728f53fbec3a2d06875add0861de
csunplugged/tests/general/urls/test_health_check.py
csunplugged/tests/general/urls/test_health_check.py
from tests.BaseTestWithDB import BaseTestWithDB from django.urls import reverse class HealthCheckURLTest(BaseTestWithDB): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.language = 'en' def test_valid_health_check_request(self): response = self.client.get(...
Test health check URL response
Test health check URL response
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -0,0 +1,13 @@ +from tests.BaseTestWithDB import BaseTestWithDB +from django.urls import reverse + + +class HealthCheckURLTest(BaseTestWithDB): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.language = 'en' + + def test_valid_health_check_request(self...
fa77d7d83ed9150670ac374f1494b38f2338217a
migrations/versions/0028_add_default_permissions.py
migrations/versions/0028_add_default_permissions.py
"""empty message Revision ID: 0028_add_default_permissions Revises: 0027_add_service_permission Create Date: 2016-02-26 10:33:20.536362 """ # revision identifiers, used by Alembic. revision = '0028_add_default_permissions' down_revision = '0027_add_service_permission' import uuid from datetime import datetime from a...
Add default permissions for existing services.
Add default permissions for existing services.
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,44 @@ +"""empty message + +Revision ID: 0028_add_default_permissions +Revises: 0027_add_service_permission +Create Date: 2016-02-26 10:33:20.536362 + +""" + +# revision identifiers, used by Alembic. +revision = '0028_add_default_permissions' +down_revision = '0027_add_service_permission' +import uu...
8c84bbc10a08c783fed22209402ead4672754f57
tests/test_iati_standard.py
tests/test_iati_standard.py
from web_test_base import * class TestIATIStandard(WebTestBase): requests_to_load = { 'IATI Standard Homepage - no www': { 'url': 'http://iatistandard.org' }, 'IATI Standard Homepage - with www': { 'url': 'http://www.iatistandard.org' } } def test_co...
Add basic tests for expected links on main site homepage
Add basic tests for expected links on main site homepage
Python
mit
IATI/IATI-Website-Tests
--- +++ @@ -0,0 +1,30 @@ +from web_test_base import * + +class TestIATIStandard(WebTestBase): + requests_to_load = { + 'IATI Standard Homepage - no www': { + 'url': 'http://iatistandard.org' + }, + 'IATI Standard Homepage - with www': { + 'url': 'http://www.iatistandard.o...
7961d4f6b37c8cb40d46793b8016706340779825
zerver/lib/push_notifications.py
zerver/lib/push_notifications.py
from __future__ import absolute_import from zerver.models import UserProfile, AppleDeviceToken from zerver.lib.timestamp import timestamp_to_datetime from zerver.decorator import statsd_increment from apnsclient import Session, Connection, Message, APNs from django.conf import settings import base64, binascii, logg...
Add a push notification module to handle mobile client notifications
Add a push notification module to handle mobile client notifications (imported from commit 3061a6e2d845226d3dce5bb262deb3a896e54f07)
Python
apache-2.0
deer-hope/zulip,susansls/zulip,ashwinirudrappa/zulip,wangdeshui/zulip,zachallaun/zulip,johnny9/zulip,bluesea/zulip,paxapy/zulip,vikas-parashar/zulip,deer-hope/zulip,nicholasbs/zulip,saitodisse/zulip,jeffcao/zulip,dawran6/zulip,zorojean/zulip,wdaher/zulip,Cheppers/zulip,jimmy54/zulip,sharmaeklavya2/zulip,krtkmj/zulip,Ph...
--- +++ @@ -0,0 +1,70 @@ +from __future__ import absolute_import + +from zerver.models import UserProfile, AppleDeviceToken +from zerver.lib.timestamp import timestamp_to_datetime +from zerver.decorator import statsd_increment + +from apnsclient import Session, Connection, Message, APNs + +from django.conf import set...
4cb217e56b9c65d8411fc1e315922ac7c7c6848c
edx_proctoring/migrations/0010_update_backend.py
edx_proctoring/migrations/0010_update_backend.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-04-29 15:44 from __future__ import unicode_literals import logging from django.db import migrations def update_backend(apps, schema_editor): from django.conf import settings log = logging.getLogger(__name__) ProctoredExam = apps.get_model('edx...
Add migration for missing backend data
Add migration for missing backend data
Python
agpl-3.0
edx/edx-proctoring,edx/edx-proctoring,edx/edx-proctoring
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-04-29 15:44 +from __future__ import unicode_literals + +import logging +from django.db import migrations + + +def update_backend(apps, schema_editor): + from django.conf import settings + log = logging.getLogger(__name__) +...
26213446116ffef0ee8d528a1a58aab918b16aa7
nettests/myip.py
nettests/myip.py
# -*- encoding: utf-8 -*- # # :authors: Arturo Filastò # :licence: see LICENSE from ooni.templates import httpt class MyIP(httpt.HTTPTest): inputs = ['https://check.torproject.org'] def processResponseBody(self, body): print "FOOOO" import re regexp = "Your IP address appears to be: <b>...
Add test to obtain the clients IP address via check.tpo
Add test to obtain the clients IP address via check.tpo
Python
bsd-2-clause
lordappsec/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,hackerberry/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,hackerberry/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,lord...
--- +++ @@ -0,0 +1,18 @@ +# -*- encoding: utf-8 -*- +# +# :authors: Arturo Filastò +# :licence: see LICENSE + +from ooni.templates import httpt +class MyIP(httpt.HTTPTest): + inputs = ['https://check.torproject.org'] + def processResponseBody(self, body): + print "FOOOO" + import re + regex...
6149a527c34b29713028ad0be4dcbe39f5ee0457
test/test_rpc.py
test/test_rpc.py
# -*- coding: utf8 -*- # Low-resource message queue framework # Do RPC # Copyright (c) 2016 Roman Kharin <romiq.kh@gmail.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restric...
Add test for calling rpc from command line
Add test for calling rpc from command line
Python
mit
RomanKharin/lrmq
--- +++ @@ -0,0 +1,67 @@ +# -*- coding: utf8 -*- + +# Low-resource message queue framework +# Do RPC +# Copyright (c) 2016 Roman Kharin <romiq.kh@gmail.com> + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to dea...
777d01e82a63a2480d8ae2f53096d4a4c338409a
tests/unit/modules/test_mandrill.py
tests/unit/modules/test_mandrill.py
# -*- coding: utf-8 -*- ''' Tests for the Mandrill execution module. ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipIf from tests.support.mock import ( patch, MagicMo...
Add tests for the mandrill execution module
Add tests for the mandrill execution module
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +''' +Tests for the Mandrill execution module. +''' + +# Import Python Libs +from __future__ import absolute_import + +# Import Salt Testing Libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support.unit import TestCase, skipIf +from tests.suppo...
2b02519f521f9e3cf177ed9970e9958a0eeb43c3
tests/framework/test_setup.py
tests/framework/test_setup.py
import pytest from pymt.framework.bmi_setup import _parse_author_info @pytest.mark.parametrize("key", ("author", "authors")) def test_author(key): assert _parse_author_info({key: "John Cleese"}) == ("John Cleese",) def test_author_empty_list(): assert _parse_author_info({}) == ("",) @pytest.mark.parametr...
Add unit tests for _parse_author_info.
Add unit tests for _parse_author_info.
Python
mit
csdms/coupling,csdms/pymt,csdms/coupling
--- +++ @@ -0,0 +1,24 @@ +import pytest + +from pymt.framework.bmi_setup import _parse_author_info + + +@pytest.mark.parametrize("key", ("author", "authors")) +def test_author(key): + assert _parse_author_info({key: "John Cleese"}) == ("John Cleese",) + + +def test_author_empty_list(): + assert _parse_author_in...
2b5930ad60c091bef5bb92683b73542b89ab5845
viewer_examples/plugins/lineprofile_rgb.py
viewer_examples/plugins/lineprofile_rgb.py
from skimage import data from skimage.viewer import ImageViewer from skimage.viewer.plugins.lineprofile import LineProfile image = data.chelsea() viewer = ImageViewer(image) viewer += LineProfile() viewer.show()
Add viewer example for RGB line profile
DOC: Add viewer example for RGB line profile
Python
bsd-3-clause
vighneshbirodkar/scikit-image,michaelpacer/scikit-image,vighneshbirodkar/scikit-image,jwiggins/scikit-image,SamHames/scikit-image,michaelaye/scikit-image,robintw/scikit-image,paalge/scikit-image,pratapvardhan/scikit-image,bsipocz/scikit-image,juliusbierk/scikit-image,ofgulban/scikit-image,warmspringwinds/scikit-image,c...
--- +++ @@ -0,0 +1,9 @@ +from skimage import data +from skimage.viewer import ImageViewer +from skimage.viewer.plugins.lineprofile import LineProfile + + +image = data.chelsea() +viewer = ImageViewer(image) +viewer += LineProfile() +viewer.show()
3d86c45c74f71dfcc3aede082ba966f677beb934
tests/test_notification_messages.py
tests/test_notification_messages.py
from . import TheInternetTestCase from helium.api import Text, click class NotificationMessagesTest(TheInternetTestCase): def get_page(self): return "http://the-internet.herokuapp.com/notification_message_rendered" def test_load_new_message(self): success = False while not success: click("Click here") fa...
Add test case for notification messages.
Add test case for notification messages.
Python
mit
bugfree-software/the-internet-solution-python
--- +++ @@ -0,0 +1,14 @@ +from . import TheInternetTestCase +from helium.api import Text, click + +class NotificationMessagesTest(TheInternetTestCase): + def get_page(self): + return "http://the-internet.herokuapp.com/notification_message_rendered" + def test_load_new_message(self): + success = False + while not s...
4a1c0ab4e1425b1bfe2ff2843f6ae1ce242997e9
st2api/tests/unit/controllers/v1/test_pack_configs.py
st2api/tests/unit/controllers/v1/test_pack_configs.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add some initial tests for pack configs API endpoints.
Add some initial tests for pack configs API endpoints.
Python
apache-2.0
nzlosh/st2,peak6/st2,Plexxi/st2,pixelrebel/st2,StackStorm/st2,emedvedev/st2,pixelrebel/st2,lakshmi-kannan/st2,lakshmi-kannan/st2,punalpatel/st2,lakshmi-kannan/st2,nzlosh/st2,pixelrebel/st2,StackStorm/st2,nzlosh/st2,emedvedev/st2,Plexxi/st2,emedvedev/st2,tonybaloney/st2,StackStorm/st2,StackStorm/st2,punalpatel/st2,tonyb...
--- +++ @@ -0,0 +1,48 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
21d9df797f04cfc2aad4e79d5845486414cffb63
tests/astroplpython/data/test_PowerFreqMeasurement.py
tests/astroplpython/data/test_PowerFreqMeasurement.py
''' Created on Jul 16, 2014 @author: thomas ''' import unittest class TestPowerFrequency (unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_strToXTArray (self): import astroplpython.data.PowerFrequencyMeasurement as PF # tes...
Add unit tests for PowerFreqMeasurement and increase
Add unit tests for PowerFreqMeasurement and increase coverage
Python
mit
brianthomas/astroplpython,brianthomas/astroplpython
--- +++ @@ -0,0 +1,45 @@ +''' +Created on Jul 16, 2014 + +@author: thomas +''' +import unittest + +class TestPowerFrequency (unittest.TestCase): + + + def setUp(self): + pass + + + def tearDown(self): + pass + + + def test_strToXTArray (self): + + import astroplpython.data.PowerF...
9cfff243c95490ea09a9ac1eeec47d7089d40d59
packages/syft/src/syft/core/node/common/node_manager/ledger_manager.py
packages/syft/src/syft/core/node/common/node_manager/ledger_manager.py
# stdlib from typing import Any from typing import List # third party from sqlalchemy.engine import Engine from sqlalchemy.orm import sessionmaker # relative from ..node_table.ledger import Ledger # from ..exceptions import SetupNotFoundError from .database_manager import DatabaseManager class LedgerManager(Databa...
Create new node manager: LedgerManager
Create new node manager: LedgerManager
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,32 @@ +# stdlib +from typing import Any +from typing import List + +# third party +from sqlalchemy.engine import Engine +from sqlalchemy.orm import sessionmaker + +# relative +from ..node_table.ledger import Ledger + +# from ..exceptions import SetupNotFoundError +from .database_manager import Data...
da287a8dd661405b97abefbd209b98dea89388cb
temba/flows/migrations/0024_advance_stuck_runs.py
temba/flows/migrations/0024_advance_stuck_runs.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def advance_stuck_runs(apps, schema_editor): # this data migration is not forward-compatible from temba.flows.models import Flow, FlowStep, FlowRun, RuleSet from temba.msgs.models import Msg flow...
Add migration for stuck runs
Add migration for stuck runs
Python
agpl-3.0
tsotetsi/textily-web,ewheeler/rapidpro,tsotetsi/textily-web,reyrodrigues/EU-SMS,praekelt/rapidpro,pulilab/rapidpro,pulilab/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,praekelt/rapidpro,ewheeler/rapidpro,pulilab/rapidpro,pulilab/rapidpro,reyrodrigues/EU-SMS,tsotetsi/textily-web,reyrodrigues/EU-SMS,praekelt/rapidpro,...
--- +++ @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def advance_stuck_runs(apps, schema_editor): + + # this data migration is not forward-compatible + from temba.flows.models import Flow, FlowStep, FlowRun, RuleSet + from t...
fe5a5e4a601a332a2067b8cfe080c6e5cea25dae
quilt/cli/meta.py
quilt/cli/meta.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as ...
Introduce new quilt cli Command class
Introduce new quilt cli Command class All cli commands should derive from this new class to simplyfy the registration of new commands. The registration is done in the Command class via a Meta class automatically.
Python
mit
bjoernricks/python-quilt,vadmium/python-quilt
--- +++ @@ -0,0 +1,87 @@ +# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: + +# python-quilt - A Python implementation of the quilt patch system +# +# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU ...
7bda769dc62c7621a7606c5de060852b33cd7595
bookmarks/core/migrations/0004_auto_20160901_2322.py
bookmarks/core/migrations/0004_auto_20160901_2322.py
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-09-01 11:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0003_auto_20160901_2303'), ] operations = [ migrations.AlterField( ...
Increase max length of url field.
Increase max length of url field.
Python
mit
tom-henderson/bookmarks,tom-henderson/bookmarks,tom-henderson/bookmarks
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-09-01 11:22 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0003_auto_20160901_2303'), + ] + + operati...
c120dccb5ca78b7601a1606fef1b25f1b18b3f8c
xgds_core/sse-test/test-data-gen.py
xgds_core/sse-test/test-data-gen.py
#! /usr/bin/env python import time from redis import StrictRedis from flask_sse import Message import json count = 0 redis=StrictRedis.from_url("redis://localhost") print "Sending SSE events..." while True: msgBody = {"message":"I can count to %s" % count} messageObj = Message(msgBody, type='greeting') ...
Add test data generator script
Add test data generator script
Python
apache-2.0
xgds/xgds_core,xgds/xgds_core,xgds/xgds_core
--- +++ @@ -0,0 +1,19 @@ +#! /usr/bin/env python + +import time +from redis import StrictRedis +from flask_sse import Message +import json + +count = 0 +redis=StrictRedis.from_url("redis://localhost") + +print "Sending SSE events..." + +while True: + msgBody = {"message":"I can count to %s" % count} + messageOb...
5dee79a170c02c2d2b17899538d5d41c3cf0ef49
tests/test_mailparsers_bug_submitted.py
tests/test_mailparsers_bug_submitted.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from DebianChangesBot.mailparsers import BugSubmittedParser as p class TestMailParserBugSubmitted(unittest.TestCase): def setUp(self): self.headers =...
Add some simple tests for bug_submitted
Add some simple tests for bug_submitted Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk>
Python
agpl-3.0
lamby/debian-devel-changes-bot,sebastinas/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import unittest + +import os, sys +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +from DebianChangesBot.mailparsers import BugSubmittedParser as p + +class TestMailParserBugSubmitted(unittest.TestCase): + + ...
6de47a88a1c8a1a17e92958683bf7d6240b4dc0f
platforms/m3/programming/snsv7_par_csv_callback.py
platforms/m3/programming/snsv7_par_csv_callback.py
import csv from datetime import datetime import sys logfile = open('mbus_snoop_log.txt','w') wr = csv.writer(open('snsv7_snoop.txt','w'), delimiter=',', lineterminator='\n') wr.writerow(['DATE','TIME','C_MEAS','C_REF','C_REV','C_PAR']) count = 0 cdc_cmeas = 0 cdc_crev = 0 cdc_cpar = 0 cdc_cref = 0 cdc_date = 0 cdc_...
Add example for m3_ice + callback
Add example for m3_ice + callback Usage: $ m3_ice snoop -c snsv7_par_csv_callback.py
Python
apache-2.0
lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator
--- +++ @@ -0,0 +1,48 @@ +import csv +from datetime import datetime +import sys + +logfile = open('mbus_snoop_log.txt','w') + +wr = csv.writer(open('snsv7_snoop.txt','w'), delimiter=',', lineterminator='\n') +wr.writerow(['DATE','TIME','C_MEAS','C_REF','C_REV','C_PAR']) + +count = 0 + +cdc_cmeas = 0 +cdc_crev = 0 +cd...
377526392b3f4a01c3f307c3d30af9f3368ebc47
lintcode/Hard/087_Remove_Node_in_Binary_Search_Tree.py
lintcode/Hard/087_Remove_Node_in_Binary_Search_Tree.py
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: The root of the binary search tree. @param value: Remove the node with given value. @return: The root of the binary search tree ...
Add solution to lintcode question 87
Add solution to lintcode question 87
Python
mit
Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode
--- +++ @@ -0,0 +1,87 @@ +""" +Definition of TreeNode: +class TreeNode: + def __init__(self, val): + self.val = val + self.left, self.right = None, None +""" +class Solution: + """ + @param root: The root of the binary search tree. + @param value: Remove the node with given value. + @retu...