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
f622255dc2c6695b785213c8d69cb57ae5d8a5e9
waftools/pebble_sdk_version.py
waftools/pebble_sdk_version.py
from waflib.Configure import conf @conf def compare_sdk_version(ctx, platform, version): target_env = ctx.all_envs[platform] if platform in ctx.all_envs else ctx.env target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff + int(target_env.SDK_VERSION_MINOR or 0x19)) other_v...
Add pebble sdk version for detecting sdk features
Add pebble sdk version for detecting sdk features
Python
mit
jiangege/pebblejs-project,youtux/PebbleShows,bkbilly/Tvheadend-EPG,bkbilly/Tvheadend-EPG,pebble/pebblejs,fletchto99/pebblejs,sunshineyyy/CatchOneBus,fletchto99/pebblejs,pebble/pebblejs,carlo-colombo/dublin-bus-pebble,youtux/PebbleShows,jsfi/pebblejs,daduke/LMSController,jiangege/pebblejs-project,sunshineyyy/CatchOneBus...
--- +++ @@ -0,0 +1,16 @@ +from waflib.Configure import conf + + +@conf +def compare_sdk_version(ctx, platform, version): + target_env = ctx.all_envs[platform] if platform in ctx.all_envs else ctx.env + target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff + + int(target_env.SDK_...
0fa30986e1f97331f96444e0b3b0f86cbe20c68a
shadho/backend/json/tests/test_db.py
shadho/backend/json/tests/test_db.py
import pytest from shadho.backend.base.tests.test_db import TestBaseBackend from shadho.backend.json.db import JsonBackend import json import os import shutil class TestJsonBackend(object): def test_init(self): """Ensure that initialization sets up the db and filepath.""" # Test default initial...
Add tests for JsonBackend __init__ and commit methods
Add tests for JsonBackend __init__ and commit methods
Python
mit
jeffkinnison/shadho,jeffkinnison/shadho
--- +++ @@ -0,0 +1,66 @@ +import pytest + +from shadho.backend.base.tests.test_db import TestBaseBackend +from shadho.backend.json.db import JsonBackend + +import json +import os +import shutil + + +class TestJsonBackend(object): + + def test_init(self): + """Ensure that initialization sets up the db and fi...
871f79a0b2bd235df457e3a1dc502d5c18bd934a
tools/build/common_utils.py
tools/build/common_utils.py
from __future__ import print_function import os def game_root_path(): file_path = os.path.dirname(os.path.abspath(__file__)) return os.path.abspath(os.path.join(file_path, '..', '..')) def files_with_type(root, type): all_files = [os.path.join(root, filename) for filename in os.listdir(root)] typed_f...
Add some generic python utilities as a basis for scripts
Add some generic python utilities as a basis for scripts
Python
mit
Oletus/gameutils.js,Oletus/gameutils.js
--- +++ @@ -0,0 +1,54 @@ +from __future__ import print_function + +import os + +def game_root_path(): + file_path = os.path.dirname(os.path.abspath(__file__)) + return os.path.abspath(os.path.join(file_path, '..', '..')) + +def files_with_type(root, type): + all_files = [os.path.join(root, filename) for file...
9c53e59ee0c4e5418b54d47c932454b7b907dc03
seahub/profile/forms.py
seahub/profile/forms.py
# encoding: utf-8 from django import forms from django.utils.html import escape from seahub.profile.models import Profile, DetailedProfile class ProfileForm(forms.Form): nickname = forms.CharField(max_length=64, required=False) intro = forms.CharField(max_length=256, required=False) def save(self, userna...
# encoding: utf-8 from django import forms from seahub.profile.models import Profile, DetailedProfile class ProfileForm(forms.Form): nickname = forms.CharField(max_length=64, required=False) intro = forms.CharField(max_length=256, required=False) def save(self, username): nickname = self.cleaned_...
Revert escape nickname, desc, etc in user profile
Revert escape nickname, desc, etc in user profile
Python
apache-2.0
madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,miurahr/seahub,cloudcopy/seahub,Chilledheart/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,madflow/seahub,Chilledheart/seahub,cloudcopy/seahub,miurahr/seahub,Chilledheart/seahub
--- +++ @@ -1,6 +1,5 @@ # encoding: utf-8 from django import forms -from django.utils.html import escape from seahub.profile.models import Profile, DetailedProfile @@ -9,8 +8,8 @@ intro = forms.CharField(max_length=256, required=False) def save(self, username): - nickname = escape(self.clean...
8affeda715b1facf12de1dab1d445bbe54616306
oscar/core/ajax.py
oscar/core/ajax.py
import six from django.contrib import messages from six.moves import map class FlashMessages(object): """ Intermediate container for flash messages. This is useful as, at the time of creating the message, we don't know whether the response is an AJAX response or not. """ def __init__(self): ...
import six from django.contrib import messages from six.moves import map class FlashMessages(object): """ Intermediate container for flash messages. This is useful as, at the time of creating the message, we don't know whether the response is an AJAX response or not. """ def __init__(self): ...
Fix JSON serialisation problem with AJAX basket
Fix JSON serialisation problem with AJAX basket six.moves.map returns itertools.imap which won't serialize to JSON. This commit unpacks the list into a normal list of strings to circumvent the issue.
Python
bsd-3-clause
jmt4/django-oscar,jmt4/django-oscar,dongguangming/django-oscar,lijoantony/django-oscar,kapt/django-oscar,okfish/django-oscar,vovanbo/django-oscar,bnprk/django-oscar,Bogh/django-oscar,sasha0/django-oscar,ahmetdaglarbas/e-commerce,solarissmoke/django-oscar,bnprk/django-oscar,spartonia/django-oscar,WillisXChen/django-osca...
--- +++ @@ -37,7 +37,7 @@ payload = {} for level, msgs in self.msgs.items(): tag = messages.DEFAULT_TAGS.get(level, 'info') - payload[tag] = map(six.text_type, msgs) + payload[tag] = [six.text_type(msg) for msg in msgs] return payload def apply_to_r...
0c8b7fa865df535f5baa33025c184bbf4234b7b1
shp_to_csv_distances.py
shp_to_csv_distances.py
"""Create a csv matrix of distances between shapefile geometry objects. Requirements: fiona, shapely Written by: Taylor Denouden Date: November 25, 2015 """ import random import fiona from shapely.geometry import shape from scripts.printer import print_progress def main(): """Main script execution.""" outf...
Create script to transform shapefile into csv distance matrix
Create script to transform shapefile into csv distance matrix
Python
mit
tayden-hakai/Island_MST
--- +++ @@ -0,0 +1,60 @@ +"""Create a csv matrix of distances between shapefile geometry objects. + +Requirements: fiona, shapely + +Written by: Taylor Denouden +Date: November 25, 2015 +""" + +import random +import fiona +from shapely.geometry import shape +from scripts.printer import print_progress + + +def main():...
ec6dff24e3049ddaab392f0bc5b8d8b724e41e20
trending_python.py
trending_python.py
#!/usr/bin/env python3 import bs4 import requests url = 'https://github.com/trending?l=Python' soup = bs4.BeautifulSoup(requests.get(url).content, 'lxml') # or 'html5lib' repos = soup.find('ol', class_="repo-list").find_all('a', href=True) repos = (r.text.strip().replace(' ', '') for r in repos if '/' in r.text) pri...
Print the trending Python repos on GitHub
Print the trending Python repos on GitHub
Python
apache-2.0
cclauss/Ten-lines-or-less
--- +++ @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import bs4 +import requests + +url = 'https://github.com/trending?l=Python' +soup = bs4.BeautifulSoup(requests.get(url).content, 'lxml') # or 'html5lib' +repos = soup.find('ol', class_="repo-list").find_all('a', href=True) +repos = (r.text.strip().replace(' ', '') ...
f6c2d5e37685b149cfd447545c58ce1fc4d836b9
snorkel/models/views.py
snorkel/models/views.py
def create_serialized_candidate_view(session, C, verbose=True): """Creates a view in the database for a Candidate sub-class C defined over Span contexts, which are direct children of a single sentence. Creates VIEW with schema: candidate.id, candidate.split, span0.*, ..., spanK.*, sentence.* ...
Add function to create view for Span candidate subclasses
Add function to create view for Span candidate subclasses
Python
apache-2.0
jasontlam/snorkel,HazyResearch/snorkel,HazyResearch/snorkel,jasontlam/snorkel,jasontlam/snorkel,HazyResearch/snorkel
--- +++ @@ -0,0 +1,44 @@ + + +def create_serialized_candidate_view(session, C, verbose=True): + """Creates a view in the database for a Candidate sub-class C defined over + Span contexts, which are direct children of a single sentence. + + Creates VIEW with schema: + candidate.id, candidate.split, spa...
3609c5842b33ca4146ad14b74c76f8954545aaa8
loqusdb/commands/view.py
loqusdb/commands/view.py
# -*- coding: utf-8 -*- import logging import click from . import base_command logger = logging.getLogger(__name__) @base_command.command() @click.option('-c' ,'--case-id', help='Search for case' ) @click.pass_context def cases(ctx, case_id): """Display all cases in the database.""" ada...
Add commands for cases and variants
Add commands for cases and variants
Python
mit
moonso/loqusdb
--- +++ @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +import logging +import click + +from . import base_command + +logger = logging.getLogger(__name__) + +@base_command.command() +@click.option('-c' ,'--case-id', + help='Search for case' +) +@click.pass_context +def cases(ctx, case_id): + """Display ...
4a30d30b82fbdccbb0f15ebb5c094b13ce791f7f
genderator/utils.py
genderator/utils.py
from unidecode import unidecode class Normalizer: def normalize(text): text = Normalizer.remove_extra_whitespaces(text) text = Normalizer.replace_hyphens(text) # text = Normalizer.remove_accent_marks(text) return text.lower() @staticmethod def replace_hyphens(text): ...
Add a utility class to normalize input
Add a utility class to normalize input
Python
mit
davidmogar/genderator
--- +++ @@ -0,0 +1,23 @@ +from unidecode import unidecode + + +class Normalizer: + + def normalize(text): + text = Normalizer.remove_extra_whitespaces(text) + text = Normalizer.replace_hyphens(text) + # text = Normalizer.remove_accent_marks(text) + + return text.lower() + + @staticme...
23cf747a3ff24f75d3300547f4bfdecf10c4a325
scrapple/utils/config.py
scrapple/utils/config.py
""" scrapple.utils.config ~~~~~~~~~~~~~~~~~~~~~ Functions related to traversing the configuration file """ from __future__ import print_function def traverse_next(page, next, results): for link in page.extract_links(next['follow_link']): print("Loading page", link.url) r = results for at...
Add next traversal util function
Add next traversal util function
Python
mit
scrappleapp/scrapple,AlexMathew/scrapple,AlexMathew/scrapple,scrappleapp/scrapple,AlexMathew/scrapple
--- +++ @@ -0,0 +1,24 @@ +""" +scrapple.utils.config +~~~~~~~~~~~~~~~~~~~~~ + +Functions related to traversing the configuration file +""" + +from __future__ import print_function + + +def traverse_next(page, next, results): + for link in page.extract_links(next['follow_link']): + print("Loading page", link...
82b9a66ea826b4463d82c69ba1703eab213efe83
heat_integrationtests/functional/test_stack_outputs.py
heat_integrationtests/functional/test_stack_outputs.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 # d...
Add test for stack outputs
Add test for stack outputs Add test for output list and output show Depends-On: I1bc1cee1c78ecf0c9a18ecc0a871d38e4141e0f7 Change-Id: I1ee226494b5b04ec2d43edf0c03ab31e452fedf0
Python
apache-2.0
cwolferh/heat-scratch,noironetworks/heat,jasondunsmore/heat,jasondunsmore/heat,noironetworks/heat,openstack/heat,steveb/heat,dims/heat,steveb/heat,dims/heat,openstack/heat,cwolferh/heat-scratch
--- +++ @@ -0,0 +1,62 @@ +# 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 agr...
b7bf4586fea207453225a87fb85df59ccfc94e80
jarbas/core/migrations/0032_auto_20170613_0641.py
jarbas/core/migrations/0032_auto_20170613_0641.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-13 09:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0031_add_index_together_for_reimbursement'), ] operations = [ migra...
Add missing migration related to django-simple-history update
Add missing migration related to django-simple-history update
Python
mit
datasciencebr/jarbas,datasciencebr/jarbas,marcusrehm/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/jarbas,datasciencebr/serenata-de-amor,datasciencebr/serenata-de-amor,marcusrehm/serenata-de-amor,datasciencebr/jarbas,marcusrehm/serenata-de-amor
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-13 09:41 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0031_add_index_together_for_reimbursement'), +...
2cd1da31b099cbf37552b2a049c3df6619e0e64f
rma/redis_types.py
rma/redis_types.py
REDIS_ENCODING_ID_RAW = 0 REDIS_ENCODING_ID_INT = 1 REDIS_ENCODING_ID_EMBSTR = 2 REDIS_ENCODING_ID_HASHTABLE = 3 REDIS_ENCODING_ID_ZIPLIST = 4 REDIS_ENCODING_ID_LINKEDLIST = 5 REDIS_ENCODING_ID_QUICKLIST =6 REDIS_ENCODING_ID_INTSET = 7 REDIS_ENCODING_ID_SKIPLIST = 8 REDIS_ENCODING_STR_TO_ID_LIB = { b'raw': REDIS_E...
Add helper enums for type encodings
Add helper enums for type encodings
Python
mit
gamenet/redis-memory-analyzer
--- +++ @@ -0,0 +1,37 @@ +REDIS_ENCODING_ID_RAW = 0 +REDIS_ENCODING_ID_INT = 1 +REDIS_ENCODING_ID_EMBSTR = 2 +REDIS_ENCODING_ID_HASHTABLE = 3 +REDIS_ENCODING_ID_ZIPLIST = 4 +REDIS_ENCODING_ID_LINKEDLIST = 5 +REDIS_ENCODING_ID_QUICKLIST =6 +REDIS_ENCODING_ID_INTSET = 7 +REDIS_ENCODING_ID_SKIPLIST = 8 + +REDIS_ENCODING...
6ae82ecdd749b936289b496a10faa2caf1aa94c6
bibsort.py
bibsort.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from collections import OrderedDict import codecs class BibEntry: def __init__(self, **kwargs): self.data = {} for key, value in kwargs.iteritems(): self.data[key] = value def entry(self): data = OrderedDict(...
Add first version of the code
Add first version of the code
Python
mit
derherrg/pybibsort
--- +++ @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from collections import OrderedDict +import codecs + +class BibEntry: + + def __init__(self, **kwargs): + self.data = {} + for key, value in kwargs.iteritems(): + self.data[key] = value + + de...
a086e7328ca920f269812a87be095ce638467f95
crawler/youtube_dl_op_sample.py
crawler/youtube_dl_op_sample.py
#!/usr/bin/env python2 #-*- coding: utf-8 -*- import sys import youtube_dl def main(): if len(sys.argv) < 2: print("Usage: youtube_dl_op_sample.py URL") return opts = { 'forceurl': True, 'quiet': True, 'simulate': True, } url = sys.argv[1...
Add youtube-dl library sample of operation
[Crawler] Add youtube-dl library sample of operation
Python
mit
daineseh/python_code
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python2 +#-*- coding: utf-8 -*- + +import sys +import youtube_dl + + +def main(): + if len(sys.argv) < 2: + print("Usage: youtube_dl_op_sample.py URL") + return + + opts = { + 'forceurl': True, + 'quiet': True, + 'simulate'...
1058a9cb6e667c850f56b6003038496b77c359c5
website/tools/append_index_html_to_internal_links.py
website/tools/append_index_html_to_internal_links.py
"""Script to fix the links in the staged website. Finds all internal links which do not have index.html at the end and appends index.html in the appropriate place (preserving anchors, etc). Usage: From root directory, after running the jekyll build, execute 'python tools/append_index_html_to_internal_links.py'. D...
Add tool to fix links.
Add tool to fix links. Signed-off-by: Jason Kuster <68c46a606457643eab92053c1c05574abb26f861@google.com>
Python
apache-2.0
rangadi/beam,robertwb/incubator-beam,lukecwik/incubator-beam,lukecwik/incubator-beam,markflyhigh/incubator-beam,chamikaramj/beam,chamikaramj/beam,RyanSkraba/beam,rangadi/incubator-beam,lukecwik/incubator-beam,robertwb/incubator-beam,charlesccychen/incubator-beam,chamikaramj/beam,rangadi/beam,charlesccychen/beam,markfly...
--- +++ @@ -0,0 +1,76 @@ +"""Script to fix the links in the staged website. +Finds all internal links which do not have index.html at the end and appends +index.html in the appropriate place (preserving anchors, etc). + +Usage: + From root directory, after running the jekyll build, execute + 'python tools/append_in...
8d8f89c82511b86fb87cef5db3bad633283283cc
modelview/migrations/0044_auto_20191007_1227.py
modelview/migrations/0044_auto_20191007_1227.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-10-07 10:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('modelview', '0043_merge_20190425_1036'), ] operations = [ migrations.Remov...
Add missing migrations in develop branch
Add missing migrations in develop branch
Python
agpl-3.0
openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform
--- +++ @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.25 on 2019-10-07 10:27 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('modelview', '0043_merge_20190425_1036'), + ] + + ...
e5be29bc3c5a77493fe64bb3fc8b52611cc13469
zerver/tests/test_outgoing_webhook_interfaces.py
zerver/tests/test_outgoing_webhook_interfaces.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from typing import Any import mock import json from requests.models import Response from zerver.lib.test_classes import ZulipTestCase from zerver.outgoing_webhooks.generic import GenericOutgoingWebhookService class T...
Add tests for Generic Interface.
Add tests for Generic Interface.
Python
apache-2.0
rht/zulip,mahim97/zulip,rht/zulip,mahim97/zulip,brainwane/zulip,hackerkid/zulip,zulip/zulip,eeshangarg/zulip,Galexrt/zulip,vabs22/zulip,kou/zulip,rishig/zulip,amanharitsh123/zulip,punchagan/zulip,eeshangarg/zulip,andersk/zulip,shubhamdhama/zulip,showell/zulip,jackrzhang/zulip,eeshangarg/zulip,hackerkid/zulip,vabs22/zul...
--- +++ @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import +from __future__ import print_function +from typing import Any + +import mock +import json + +from requests.models import Response +from zerver.lib.test_classes import ZulipTestCase +from zerver.outgoing_webhooks.generic import ...
03fce72b60eb8cad2368447cf23f72f8084f4a4b
py/distribute-candies.py
py/distribute-candies.py
class Solution(object): def distributeCandies(self, candies): """ :type candies: List[int] :rtype: int """ return min(len(candies) / 2, len(set(candies)))
Add py solution for 575. Distribute Candies
Add py solution for 575. Distribute Candies 575. Distribute Candies: https://leetcode.com/problems/distribute-candies/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,7 @@ +class Solution(object): + def distributeCandies(self, candies): + """ + :type candies: List[int] + :rtype: int + """ + return min(len(candies) / 2, len(set(candies)))
d34dcf1179e6e5c2b864627266ae1788d10142aa
Week01/Problem02/cyu_02.py
Week01/Problem02/cyu_02.py
#!/usr/bin/env python3 """This script is written by Chuanping Yu, on Jul 24, 2017, for the Assignment#1 in IDEaS workshop""" #Problem 2 FIB = [] F = 1 S = 0 FIB.append(F) FIB.append(F) while F <= 4000000: F = FIB[-1] + FIB[-2] FIB.append(F) if F%2 == 0 and F <= 4000000: S = S + F print(S)
Add Chuanping Yu's solutions to Problem02
Add Chuanping Yu's solutions to Problem02
Python
bsd-3-clause
GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017,GT-IDEaS/SkillsWorkshop2017
--- +++ @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +"""This script is written by Chuanping Yu, on Jul 24, 2017, +for the Assignment#1 in IDEaS workshop""" + +#Problem 2 +FIB = [] +F = 1 +S = 0 +FIB.append(F) +FIB.append(F) +while F <= 4000000: + F = FIB[-1] + FIB[-2] + FIB.append(F) + if F%2 == 0 and F <= 40...
f59749db263291f481c4bdc9f6ede2f6de6cb6d4
create_input_files.py
create_input_files.py
import csv import argparse import itertools from thermo_utils import csv_row_writer, read_csv_rows # Read input/output arguments parser = argparse.ArgumentParser() parser.add_argument('-o','--output',required=True) parser.add_argument('-d','--dof',required=True) # parser.add_argument('-v','--version',required=False) ...
Create foundation for input file generation (csv for connectivity table, etc.)
Create foundation for input file generation (csv for connectivity table, etc.)
Python
mit
ndebuhr/openfea,ndebuhr/openfea
--- +++ @@ -0,0 +1,17 @@ +import csv +import argparse +import itertools + +from thermo_utils import csv_row_writer, read_csv_rows + +# Read input/output arguments +parser = argparse.ArgumentParser() +parser.add_argument('-o','--output',required=True) +parser.add_argument('-d','--dof',required=True) +# parser.add_argu...
a5d5dde8c523aa28452d790e7f0291c1cf52aacb
tests/external/py2/testfixture_test.py
tests/external/py2/testfixture_test.py
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (C) 2013 Numenta Inc. All rights reserved. # # The information and source code contained herein is the # exclusive property of Numenta Inc. No part of this software # may be used, reproduced, stored or distributed...
Make sure setUpModule is called by the test framework. We brought in pytest-2.4.0.dev8 for that specific functionality. However, one time we regressed, and our tests started misbehaving. So, this test is here to keep us honest.
Make sure setUpModule is called by the test framework. We brought in pytest-2.4.0.dev8 for that specific functionality. However, one time we regressed, and our tests started misbehaving. So, this test is here to keep us honest.
Python
agpl-3.0
breznak/nupic,breznak/nupic,breznak/nupic
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# ---------------------------------------------------------------------- +# Copyright (C) 2013 Numenta Inc. All rights reserved. +# +# The information and source code contained herein is the +# exclusive property of Numenta Inc. No part of this software +# may be used,...
f18fd5c4ad61adb56ac7524a006ce9977aa06a31
mailing/management/commands/send_queued_mails_worker.py
mailing/management/commands/send_queued_mails_worker.py
# -*- coding: utf-8 -*- # Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS from django.core.management.base import BaseCommand from ...utils import send_queued_mails import time class Command(BaseCommand): help = """Send mails with `status` Mail.STATUS_PENDING and having `scheduled_on` set on a past date. In ...
Add worker to send queue mails
Add worker to send queue mails
Python
mit
Aladom/django-mailing,Aladom/django-mailing
--- +++ @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS +from django.core.management.base import BaseCommand + +from ...utils import send_queued_mails +import time + +class Command(BaseCommand): + help = """Send mails with `status` Mail.STATUS_PENDING and having + `...
5a7081c5c46a050566477adda19d30844192ceb2
src/mmw/apps/user/migrations/0002_auth_tokens.py
src/mmw/apps/user/migrations/0002_auth_tokens.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings from django.contrib.auth.models import User from rest_framework.authtoken.models import Token def add_auth_tokens_to_users(apps, schema_editor): for user in User.objects.all()...
Add migration to add authtokens for existing users
Add migration to add authtokens for existing users * NB: Depending on how many users there are, this migration could be pretty RAM intensive...
Python
apache-2.0
WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings +from django.contrib.auth.models import User +from rest_framework.authtoken.models import Token + + +def add_auth_tokens_to_users(apps, schema_editor...
ab53993b708b3f9cf3b5762664fef58bae99ea20
recursive_remove_ltac.py
recursive_remove_ltac.py
import re __all__ = ["recursively_remove_ltac"] LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE) def recursively_remove_ltac(statements, exclude_n=3): """Removes any Ltac statement which is not used later in statements. Does not remove any code in the last exclude_n sta...
Add some code to auto-remove Ltac
Add some code to auto-remove Ltac
Python
mit
JasonGross/coq-tools,JasonGross/coq-tools
--- +++ @@ -0,0 +1,22 @@ +import re + +__all__ = ["recursively_remove_ltac"] + +LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE) + +def recursively_remove_ltac(statements, exclude_n=3): + """Removes any Ltac statement which is not used later in + statements. Does not remove an...
8d6ca433d33551cc1fe5c08edcf68ec65e5447b0
exercises/chapter_03/exercise_03_03/exercies_03_03.py
exercises/chapter_03/exercise_03_03/exercies_03_03.py
# 3-3 Your Own List transportation = ["mountainbike", "teleportation", "Citroën DS3"] print("A " + transportation[0] + " is good when exercising in the woods.\n") print("The ultimate form of trarsportation must be " + transportation[1] + ".\n") print("Should I buy a " + transportation[2] + "?\n")
Add solution to exercise 3.3.
Add solution to exercise 3.3.
Python
mit
HenrikSamuelsson/python-crash-course
--- +++ @@ -0,0 +1,6 @@ +# 3-3 Your Own List +transportation = ["mountainbike", "teleportation", "Citroën DS3"] + +print("A " + transportation[0] + " is good when exercising in the woods.\n") +print("The ultimate form of trarsportation must be " + transportation[1] + ".\n") +print("Should I buy a " + transportation[2...
c4b7bd5b74aaba210a05f946d59c98894b60b21f
tests/cli/test_pixel.py
tests/cli/test_pixel.py
""" Test ``yatsm line`` """ import os from click.testing import CliRunner import pytest from yatsm.cli.main import cli @pytest.mark.skipif("DISPLAY" not in os.environ, reason="requires display") def test_cli_pixel_pass_1(example_timeseries): """ Correctly run for one pixel """ runner = CliRunner() r...
Add test for pixel CLI
Add test for pixel CLI
Python
mit
ceholden/yatsm,c11/yatsm,ceholden/yatsm,valpasq/yatsm,c11/yatsm,valpasq/yatsm
--- +++ @@ -0,0 +1,24 @@ +""" Test ``yatsm line`` +""" +import os + +from click.testing import CliRunner +import pytest + +from yatsm.cli.main import cli + + +@pytest.mark.skipif("DISPLAY" not in os.environ, reason="requires display") +def test_cli_pixel_pass_1(example_timeseries): + """ Correctly run for one pixe...
555cfbb827532c54598cecde01ef4e6e5e07714d
test/worker_external_task_test.py
test/worker_external_task_test.py
# Copyright (c) 2015 # # 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 # d...
Create a test for re-evaluating external tasks while a workflow is running.
Create a test for re-evaluating external tasks while a workflow is running.
Python
apache-2.0
dlstadther/luigi,ViaSat/luigi,adaitche/luigi,humanlongevity/luigi,PeteW/luigi,Houzz/luigi,ZhenxingWu/luigi,springcoil/luigi,ContextLogic/luigi,ivannotes/luigi,percyfal/luigi,belevtsoff/luigi,Yoone/luigi,meyerson/luigi,tuulos/luigi,dkroy/luigi,Houzz/luigi,Dawny33/luigi,theoryno3/luigi,JackDanger/luigi,Magnetic/luigi,bow...
--- +++ @@ -0,0 +1,64 @@ +# Copyright (c) 2015 +# +# 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 o...
68e056459dd3818ebb0c5dbdc8b4f1089bec9f07
tests/selection_test.py
tests/selection_test.py
import os import pytest import yaml from photoshell.selection import Selection @pytest.fixture def sidecar(tmpdir): tmpdir.join("test.sidecar").write(yaml.dump({ 'developed_path': os.path.join(tmpdir.strpath, "test.jpeg"), 'datetime': '2014-10-10 00:00' }, default_flow_style=False)) retur...
Add a few behavior tests for selection
Add a few behavior tests for selection
Python
mit
photoshell/photoshell,SamWhited/photoshell,campaul/photoshell
--- +++ @@ -0,0 +1,58 @@ +import os +import pytest +import yaml + +from photoshell.selection import Selection + + +@pytest.fixture +def sidecar(tmpdir): + tmpdir.join("test.sidecar").write(yaml.dump({ + 'developed_path': os.path.join(tmpdir.strpath, "test.jpeg"), + 'datetime': '2014-10-10 00:00' + ...
ff2c4b68a5eace4451eeef4fd6ca84d37435c556
project/editorial/migrations/0087_auto_20180226_1409.py
project/editorial/migrations/0087_auto_20180226_1409.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-26 22:09 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('editorial', '0086_auto_20180102_2145'), ] operatio...
Add fields to privatemessage for network invitations.
Add fields to privatemessage for network invitations.
Python
mit
ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet,ProjectFacet/facet
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.9 on 2018-02-26 22:09 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('editorial', '0086_au...
50742b6e629e6f54a9f3784a3c1495eb9d82c238
brightway_projects/processing/processed_package.py
brightway_projects/processing/processed_package.py
from ..errors import InconsistentFields, NonUnique def greedy_set_cover(data, exclude=None): """Find unique set of attributes that uniquely identifies each element in ``data``. Feature selection is a well known problem, and is analogous to the `set cover problem <https://en.wikipedia.org/wiki/Set_cover_probl...
Add start of processed package
Add start of processed package
Python
bsd-3-clause
brightway-lca/brightway
--- +++ @@ -0,0 +1,85 @@ +from ..errors import InconsistentFields, NonUnique + + +def greedy_set_cover(data, exclude=None): + """Find unique set of attributes that uniquely identifies each element in ``data``. + + Feature selection is a well known problem, and is analogous to the `set cover problem <https://en....
842869063ead9b2e6a1e22d11c9901072f2319aa
docs/generate_spec.py
docs/generate_spec.py
# -*- encoding: utf-8 -*- # # This script is to be used to automagically generate the recurring data types # documentation based on the API specification. # # to run it just do: # # $ python generate_spec.py > outputfile.md # # :authors: Arturo Filastò # :licence: see LICENSE import inspect from globaleaks.rest.mes...
Add script to self generate docs for recurring data types
Add script to self generate docs for recurring data types
Python
agpl-3.0
vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks
--- +++ @@ -0,0 +1,35 @@ +# -*- encoding: utf-8 -*- +# +# This script is to be used to automagically generate the recurring data types +# documentation based on the API specification. +# +# to run it just do: +# +# $ python generate_spec.py > outputfile.md +# +# :authors: Arturo Filastò +# :licence: see LICENSE + +...
4694f6bf2405d0aae5e6c3fc393f8a839e8aac07
tests/test_converter.py
tests/test_converter.py
# coding: utf-8 # Copyright (c) 2010-2012 Raphaël Barrois import unittest from confmgr import converter class LineTestCase(unittest.TestCase): def test_repr(self): self.assertEqual("Line('foo', 'bar')", repr(converter.Line('foo', 'bar'))) def test_equality(self): self.assert...
Add tests for converter.Line and converter.Generator.
Add tests for converter.Line and converter.Generator. Signed-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polytechnique.org>
Python
bsd-2-clause
rbarrois/uconf
--- +++ @@ -0,0 +1,77 @@ +# coding: utf-8 +# Copyright (c) 2010-2012 Raphaël Barrois + +import unittest + +from confmgr import converter + + +class LineTestCase(unittest.TestCase): + def test_repr(self): + self.assertEqual("Line('foo', 'bar')", + repr(converter.Line('foo', 'bar'))) + + def...
00bfd02f921a42d4f288254d1accb7546d8df2c5
check_hbase.py
check_hbase.py
#!/usr/bin/env python # vim: ts=4:sw=4:et:sts=4:ai:tw=80 from utils import krb_wrapper,StringContext import os import argparse import nagiosplugin import re import subprocess html_auth = None def parser(): version="0.1" parser = argparse.ArgumentParser(description="Checks datanode") parser.add_argument('-...
Add hbase consistency check throw hbase hbck command, easily can be added some checks like backups servers or region servers
Add hbase consistency check throw hbase hbck command, easily can be added some checks like backups servers or region servers
Python
apache-2.0
keedio/nagios-hadoop,keedio/nagios-hadoop
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# vim: ts=4:sw=4:et:sts=4:ai:tw=80 +from utils import krb_wrapper,StringContext +import os +import argparse +import nagiosplugin +import re +import subprocess + +html_auth = None + +def parser(): + version="0.1" + parser = argparse.ArgumentParser(description="Che...
bcb6c0780aacf77069a08f8d5b44d295881d9b9d
swapOddEvenChar.py
swapOddEvenChar.py
#Python3 word = list(input().strip()) for i in range(0,len(word),2): if(i+1>=len(word)): break word[i],word[i+1] = word[i+1],word[i] print(''.join(word))
Create solution to swap odd even characters
Create solution to swap odd even characters
Python
mit
laxmena/CodeKata,laxmena/CodeKata
--- +++ @@ -0,0 +1,9 @@ +#Python3 +word = list(input().strip()) + +for i in range(0,len(word),2): + if(i+1>=len(word)): + break + word[i],word[i+1] = word[i+1],word[i] + +print(''.join(word))
7bde47d48f4e80b4449049a8b05767b30eb2c516
utilities/export-csv.py
utilities/export-csv.py
#!/usr/bin/python import os import csv import sys sys.path.append('../pynipap') import pynipap class Export: def __init__(self, xmlrpc_uri): self.xmlrpc_uri = xmlrpc_uri def write(self, output_file, schema_name): """ """ f = open(output_file, "w+") writer = csv.writer(f, quoting=csv.QUOTE_MINIMAL) p...
Add stupid CSV export example
Add stupid CSV export example Fixes #53
Python
mit
SoundGoof/NIPAP,plajjan/NIPAP,SpriteLink/NIPAP,bbaja42/NIPAP,ettrig/NIPAP,bbaja42/NIPAP,fredsod/NIPAP,SoundGoof/NIPAP,fredsod/NIPAP,ettrig/NIPAP,SpriteLink/NIPAP,ettrig/NIPAP,SoundGoof/NIPAP,bbaja42/NIPAP,fredsod/NIPAP,fredsod/NIPAP,fredsod/NIPAP,garberg/NIPAP,bbaja42/NIPAP,garberg/NIPAP,SpriteLink/NIPAP,plajjan/NIPAP,...
--- +++ @@ -0,0 +1,77 @@ +#!/usr/bin/python + +import os +import csv + +import sys +sys.path.append('../pynipap') +import pynipap + +class Export: + def __init__(self, xmlrpc_uri): + self.xmlrpc_uri = xmlrpc_uri + + + def write(self, output_file, schema_name): + """ + """ + f = open(output_file, "w+") + writer =...
e9d87a087a0f0102157d7c718a048c72f655c54a
smore/ext/marshmallow.py
smore/ext/marshmallow.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(name, schema, **kwar...
# -*- coding: utf-8 -*- from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(spec, name, schema, ...
Store registered refs as plugin metadata
Store registered refs as plugin metadata
Python
mit
marshmallow-code/apispec,Nobatek/apispec,marshmallow-code/smore,gorgias/apispec,jmcarp/smore
--- +++ @@ -8,13 +8,18 @@ from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring -def schema_definition_helper(name, schema, **kwargs): +def schema_definition_helper(spec, name, schema, **kwargs): """Definition helper that allows using a marshmallow :class:`Sc...
7b09a44c7df8b2aa28e45c5382626c2f8c4bf61b
bin/run_redpen.py
bin/run_redpen.py
#!/usr/bin/python import os import re import shutil from optparse import OptionParser def main(): parser = OptionParser(usage="usage: %prog [options]", version="%prog 1.0") parser.add_option("-i", "--inputdir", action="store", dest="indir",...
Add a script to convert from rst style files to markdown
Add a script to convert from rst style files to markdown
Python
apache-2.0
kenhys/redpen-doc,kenhys/redpen-doc
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/python + +import os +import re +import shutil +from optparse import OptionParser + +def main(): + parser = OptionParser(usage="usage: %prog [options]", + version="%prog 1.0") + parser.add_option("-i", "--inputdir", + action="stor...
419ca7099bf47ed00ede73d9de14690a643a3943
test/test_integration.py
test/test_integration.py
"""Integrations tests for EcoData Retriever""" import os import shutil from retriever import HOME_DIR simple_csv = {'name': 'simple_csv', 'raw_data': "a,b,c\n1,2,3\n4,5,6", 'script': "shortname: simple_csv\ntable: simple_csv, http://example.com/simple_csv.txt", 'expect_out': ...
Add data for integration testing of basic csv and crosstab formats
Add data for integration testing of basic csv and crosstab formats
Python
mit
henrykironde/deletedret,goelakash/retriever,henrykironde/deletedret,goelakash/retriever
--- +++ @@ -0,0 +1,17 @@ +"""Integrations tests for EcoData Retriever""" + +import os +import shutil +from retriever import HOME_DIR + +simple_csv = {'name': 'simple_csv', + 'raw_data': "a,b,c\n1,2,3\n4,5,6", + 'script': "shortname: simple_csv\ntable: simple_csv, http://example.com/simple_cs...
2af53a39096c0eab9d95c304c802281fe3c580ae
tests/pickle_test.py
tests/pickle_test.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Make JAX CompiledFunction objects pickle-able.
[XLA:Python] Make JAX CompiledFunction objects pickle-able. PiperOrigin-RevId: 388814246
Python
apache-2.0
google/jax,google/jax,google/jax,google/jax
--- +++ @@ -0,0 +1,58 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by appl...
6f00204ae2603063eafbd74a369e9da0864854ca
poll/management/commands/create_new_violence_polls.py
poll/management/commands/create_new_violence_polls.py
#!/usr/bin/python # -*- coding: utf-8 -*- from django.core.management.base import BaseCommand import traceback from poll.models import Poll from unregister.models import Blacklist from django.conf import settings from optparse import make_option from poll.forms import NewPollForm from django.contrib.sites.models impo...
Create new monthly violence polls
Create new monthly violence polls
Python
bsd-3-clause
unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac
--- +++ @@ -0,0 +1,59 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +from django.core.management.base import BaseCommand +import traceback + +from poll.models import Poll +from unregister.models import Blacklist +from django.conf import settings + +from optparse import make_option +from poll.forms import NewPollForm...
23c09555221b3f7500a4c658452c9c0cb223799c
Train_SDAE/tools/evaluate_model.py
Train_SDAE/tools/evaluate_model.py
import numpy as np # import pandas as pd # import sys from scipy.special import expit from sklearn import ensemble def get_activations(exp_data, w, b): exp_data = np.transpose(exp_data) prod = exp_data.dot(w) prod_with_bias = prod + b return( expit(prod_with_bias) ) # Order of *args: first all the wei...
Add evaluation using random forest
Add evaluation using random forest
Python
apache-2.0
glrs/StackedDAE,glrs/StackedDAE
--- +++ @@ -0,0 +1,32 @@ +import numpy as np +# import pandas as pd +# import sys +from scipy.special import expit +from sklearn import ensemble + +def get_activations(exp_data, w, b): + exp_data = np.transpose(exp_data) + prod = exp_data.dot(w) + prod_with_bias = prod + b + return( expit(prod_with_bias) ...
009df3372804fa946b7e1bd4c0827e887b964b38
convert.py
convert.py
from bs4 import BeautifulSoup import io import markdown2 import time import codecs file = io.open("Import/blog-03-03-2013.xml") file_contents = file.read(-1) #lxml xpath doesn't seem to understand blogger export soup = BeautifulSoup(file_contents) entries = soup("entry") count = 0 def formatTime(timefield): tim...
Convert blogger to simple xml
Convert blogger to simple xml
Python
mit
progrn/csb
--- +++ @@ -0,0 +1,44 @@ +from bs4 import BeautifulSoup +import io +import markdown2 +import time +import codecs + +file = io.open("Import/blog-03-03-2013.xml") +file_contents = file.read(-1) + +#lxml xpath doesn't seem to understand blogger export +soup = BeautifulSoup(file_contents) + +entries = soup("entry") +coun...
7d5dcaa0a72dbdd78e192f082bbdf261de1d8963
Codewars/DeleteOccurrencesOfElementOverNTimes.py
Codewars/DeleteOccurrencesOfElementOverNTimes.py
# implemented with list comprehension with side-effects and a global variable # there's a simpler way to do it with list appends that's probably no less efficient, since Python arrays are dynamic, but I wanted to try this out instead from collections import Counter c = Counter() # for use in list comprehensions with...
Delete occurrences of an element if it occurs more than n times
Codewars: Delete occurrences of an element if it occurs more than n times
Python
unlicense
SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive
--- +++ @@ -0,0 +1,18 @@ +# implemented with list comprehension with side-effects and a global variable +# there's a simpler way to do it with list appends that's probably no less efficient, since Python arrays are dynamic, but I wanted to try this out instead + +from collections import Counter + +c = Counter() + +# ...
096c8165ec2beacbc4897285b8fed439765d3e01
test/integration/ggrc/models/test_document.py
test/integration/ggrc/models/test_document.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Integration tests for Document""" from ggrc.models import all_models from integration.ggrc import TestCase from integration.ggrc.api_helper import Api from integration.ggrc.models import factories clas...
Add test on update document title
Add test on update document title
Python
apache-2.0
AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core
--- +++ @@ -0,0 +1,28 @@ +# Copyright (C) 2017 Google Inc. +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> + +"""Integration tests for Document""" + +from ggrc.models import all_models +from integration.ggrc import TestCase +from integration.ggrc.api_helper import Api +from integration...
864bf2bb3bdb731d0725cc33891145f2a7da17d3
db/common.py
db/common.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from contextlib import contextmanager from sqlalchemy import create_engine from sqlalchemy.orm.session import sessionmaker from sqlalchemy.schema import MetaData from sqlalchemy.ext.declarative import declarative_base from utils import get_connection_string_fr...
Add initialization functions for database connection
Add initialization functions for database connection
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os + +from contextlib import contextmanager + +from sqlalchemy import create_engine +from sqlalchemy.orm.session import sessionmaker +from sqlalchemy.schema import MetaData +from sqlalchemy.ext.declarative import declarative_base + +fr...
3fb3662e58e35ccb283074c1078e1c9e7aaf88ed
LendingClub/tests/live_session_test.py
LendingClub/tests/live_session_test.py
#!/usr/bin/env python import sys import unittest import getpass from logger import TestLogger sys.path.insert(0, '.') sys.path.insert(0, '../') sys.path.insert(0, '../../') from LendingClub import session class LiveTestSession(unittest.TestCase): http = None session = None logger = None def setUp(...
Add live test for session
Add live test for session
Python
mit
jgillick/LendingClub,carlosnasillo/LendingClub,jgillick/LendingClub,carlosnasillo/LendingClub
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +import sys +import unittest +import getpass +from logger import TestLogger + +sys.path.insert(0, '.') +sys.path.insert(0, '../') +sys.path.insert(0, '../../') + +from LendingClub import session + + +class LiveTestSession(unittest.TestCase): + http = None + sess...
9e4858e652fba57f767a9c6d921853a6487301bd
epsilon/test/test_version.py
epsilon/test/test_version.py
""" Tests for turning simple version strings into twisted.python.versions.Version objects. """ from epsilon import asTwistedVersion from twisted.trial.unittest import SynchronousTestCase class AsTwistedVersionTests(SynchronousTestCase): def test_simple(self): """ A simple version string can be tu...
Add a test for the version string parsing code
Add a test for the version string parsing code
Python
mit
twisted/epsilon
--- +++ @@ -0,0 +1,19 @@ +""" +Tests for turning simple version strings into twisted.python.versions.Version +objects. + +""" +from epsilon import asTwistedVersion +from twisted.trial.unittest import SynchronousTestCase + + +class AsTwistedVersionTests(SynchronousTestCase): + def test_simple(self): + """ + ...
9668580633a1a8baaa59030e5a52d2478222cbd2
nodeconductor/openstack/cost_tracking.py
nodeconductor/openstack/cost_tracking.py
from . import models from nodeconductor.cost_tracking import CostTrackingBackend class OpenStackCostTrackingBackend(CostTrackingBackend): @classmethod def get_monthly_cost_estimate(cls, resource): backend = resource.get_backend() return backend.get_monthly_cost_estimate()
Add cost tracking file to openstack
Add cost tracking file to openstack - saas-951
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,10 @@ +from . import models +from nodeconductor.cost_tracking import CostTrackingBackend + + +class OpenStackCostTrackingBackend(CostTrackingBackend): + + @classmethod + def get_monthly_cost_estimate(cls, resource): + backend = resource.get_backend() + return backend.get_monthly...
a12dd320df30404df8c8ec196e21067376cc1e2c
astropy/table/tests/test_pickle.py
astropy/table/tests/test_pickle.py
import cPickle as pickle import numpy as np import pytest from ...table import Table, Column, MaskedColumn @pytest.fixture(params=[0, 1, -1]) def protocol(request): """ Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced). """ return request.param def test_pickle_column(proto...
Add tests of table and column pickling
Add tests of table and column pickling
Python
bsd-3-clause
mhvk/astropy,astropy/astropy,astropy/astropy,larrybradley/astropy,funbaker/astropy,joergdietrich/astropy,joergdietrich/astropy,dhomeier/astropy,larrybradley/astropy,pllim/astropy,MSeifert04/astropy,pllim/astropy,dhomeier/astropy,StuartLittlefair/astropy,tbabej/astropy,lpsinger/astropy,saimn/astropy,tbabej/astropy,dhome...
--- +++ @@ -0,0 +1,72 @@ +import cPickle as pickle + +import numpy as np +import pytest + +from ...table import Table, Column, MaskedColumn + + +@pytest.fixture(params=[0, 1, -1]) +def protocol(request): + """ + Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced). + """ + return req...
0c6becaa179aba9408def1b3cce61d5ec1509942
python/main.py
python/main.py
from simul import * if __name__ == '__main__': # create a new simulation s = Simulation(Re=5) # initial conditions psi(0) = 0, Omega(0) = 0 s.psi.initial("null") s.omega.initial("null") # T_n(t=0) = sin(pi*k*dz) & T_0(t=0) = 1-k*dz s.T.initial(lambda n, k: T_0(n,k,s)) # main loop over...
Load the simul module and run a simulation
Load the simul module and run a simulation
Python
apache-2.0
cphyc/MHD_simulation,cphyc/MHD_simulation
--- +++ @@ -0,0 +1,20 @@ +from simul import * + +if __name__ == '__main__': + # create a new simulation + s = Simulation(Re=5) + + # initial conditions psi(0) = 0, Omega(0) = 0 + s.psi.initial("null") + s.omega.initial("null") + # T_n(t=0) = sin(pi*k*dz) & T_0(t=0) = 1-k*dz + s.T.initial(lambda n...
989a94c81f74a17707e66f126960b6bb45e9b4d5
migrations/versions/3042d0ca43bf_index_job_project_id.py
migrations/versions/3042d0ca43bf_index_job_project_id.py
"""Index Job(project_id, status, date_created) where patch_id IS NULL Revision ID: 3042d0ca43bf Revises: 3a3366fb7822 Create Date: 2014-01-03 15:24:39.947813 """ # revision identifiers, used by Alembic. revision = '3042d0ca43bf' down_revision = '3a3366fb7822' from alembic import op def upgrade(): op.execute('...
Add index to cover testgroup_details (previous runs)
Add index to cover testgroup_details (previous runs)
Python
apache-2.0
dropbox/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes
--- +++ @@ -0,0 +1,21 @@ +"""Index Job(project_id, status, date_created) where patch_id IS NULL + +Revision ID: 3042d0ca43bf +Revises: 3a3366fb7822 +Create Date: 2014-01-03 15:24:39.947813 + +""" + +# revision identifiers, used by Alembic. +revision = '3042d0ca43bf' +down_revision = '3a3366fb7822' + +from alembic imp...
8b9fe74976d77df32d73792f74ef4ddea1eb525f
config.py
config.py
#! /usr/bin/env python import os import warnings import yaml class Config(object): config_fname = "configuration.yaml" def __init__(self, config_fname=None): config_fname = config_fname or self.config_fname fo = open(config_fname, "r") blob = fo.read() fo.close() self...
#! /usr/bin/env python import os import warnings import yaml class Config(object): config_fname = "configuration.yaml" def __init__(self, config_fname=None): config_fname = config_fname or self.config_fname fo = open(config_fname, "r") blob = fo.read() fo.close() self...
Add Config.get() to skip KeyErrors
Add Config.get() to skip KeyErrors Adds common `dict.get()` pattern to our own Config class, to enable use of fallbacks or `None`, as appropriate.
Python
apache-2.0
royrapoport/destalinator,TheConnMan/destalinator,royrapoport/destalinator,underarmour/destalinator,randsleadershipslack/destalinator,randsleadershipslack/destalinator,TheConnMan/destalinator
--- +++ @@ -22,6 +22,12 @@ return self.config[attrname] + def get(self, attrname, fallback=None): + try: + return self.config[attrname] + except KeyError: + return fallback + # This deliberately isn't a `getenv` default so `.slack_name` isn't tried if there's a S...
42297354f575e2c82346cf033202c5dfad5ddd99
lib/examples/nacl_amb/utils.py
lib/examples/nacl_amb/utils.py
#!/usr/bin/env python import numpy class TrajWriter(object): ''' A class for writing out trajectory traces as an xyz file, for subsequent visualization. ''' def __init__(self, trace, w, filename='trace.xyz'): self.trace = trace self.w = w self.filename = filename sel...
Add python class for writing out xyz files of trajectory coordinates
Add python class for writing out xyz files of trajectory coordinates Former-commit-id: cecdece306ef516acf87bde03bbd04cb7f0c761b
Python
mit
westpa/westpa
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/env python +import numpy + +class TrajWriter(object): + ''' + A class for writing out trajectory traces as an xyz file, for subsequent + visualization. + ''' + def __init__(self, trace, w, filename='trace.xyz'): + self.trace = trace + self.w = w + ...
c1e801798d3b7e8d4c9ba8a11f79ffa92bf182f5
test/test_logger.py
test/test_logger.py
# encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> """ from __future__ import print_function from __future__ import unicode_literals import logbook from pingparsing import ( set_logger, set_log_level, ) import pytest class Test_set_logger(object): @pytest.mark.parame...
Add test cases for the logger
Add test cases for the logger
Python
mit
thombashi/pingparsing,thombashi/pingparsing
--- +++ @@ -0,0 +1,49 @@ +# encoding: utf-8 + +""" +.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com> +""" + +from __future__ import print_function +from __future__ import unicode_literals + +import logbook +from pingparsing import ( + set_logger, + set_log_level, +) +import pytest + + +class Test...
74e24debf55b003f1d56d35f4b040d91a0698e0a
example/under-sampling/plot_cluster_centroids.py
example/under-sampling/plot_cluster_centroids.py
""" ================= Cluster centroids ================= An illustration of the cluster centroids method. """ print(__doc__) import matplotlib.pyplot as plt import seaborn as sns sns.set() # Define some color for the plotting almost_black = '#262626' palette = sns.color_palette() from sklearn.datasets import mak...
Add example for cluster centroids method
Add example for cluster centroids method
Python
mit
dvro/UnbalancedDataset,dvro/imbalanced-learn,fmfn/UnbalancedDataset,scikit-learn-contrib/imbalanced-learn,scikit-learn-contrib/imbalanced-learn,glemaitre/UnbalancedDataset,dvro/UnbalancedDataset,dvro/imbalanced-learn,fmfn/UnbalancedDataset,glemaitre/UnbalancedDataset
--- +++ @@ -0,0 +1,58 @@ +""" +================= +Cluster centroids +================= + +An illustration of the cluster centroids method. + +""" + +print(__doc__) + +import matplotlib.pyplot as plt +import seaborn as sns +sns.set() + +# Define some color for the plotting +almost_black = '#262626' +palette = sns.colo...
8fa9a54c9a5ee683fc9e9d361a4eb7affe5e83ed
game_of_life.py
game_of_life.py
#!/usr/bin/env python from curses import wrapper from time import sleep def enumerate_lines(matrix): on = '*' off = ' ' for i, row in enumerate(matrix): yield i, ''.join(on if v else off for v in row) def paint(stdscr, matrix): stdscr.clear() for i, line in enumerate_lines(matrix): ...
Add functions to paint game of life to screen
Add functions to paint game of life to screen
Python
mit
akud/stem-club-presentation,akud/stem-club-presentation,akud/stem-club-presentation
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python +from curses import wrapper +from time import sleep + +def enumerate_lines(matrix): + on = '*' + off = ' ' + for i, row in enumerate(matrix): + yield i, ''.join(on if v else off for v in row) + +def paint(stdscr, matrix): + stdscr.clear() + for i, ...
c98a744f5f436ae2c6266a7bb5d32173cfd0e4a9
scripts/socrata_scraper.py
scripts/socrata_scraper.py
#!/usr/bin/python3 """ This is a basic script that downloads the catalog data from the smcgov.org website and pulls out information about all the datasets. This is in python3 There is an optional download_all argument that will allow you to download all of the datasets individually and in their entirety. I have incl...
Add a script that scrapes the Socrata catalog, just in case we need that in another format
Add a script that scrapes the Socrata catalog, just in case we need that in another format
Python
mit
opensmc/service-locator,opensmc/service-locator,opensmc/service-locator
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/python3 + +""" +This is a basic script that downloads the catalog data from the smcgov.org +website and pulls out information about all the datasets. + +This is in python3 + +There is an optional download_all argument that will allow you to download +all of the datasets individual...
0c11d2740e561586bb4f9d2b67bda2ccc87e146e
ixdjango/management/commands/newrelic_notify_deploy.py
ixdjango/management/commands/newrelic_notify_deploy.py
""" Management command to enable New Relic notification of deployments .. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au> """ import pwd import os from subprocess import Popen, PIPE from urllib import urlencode from httplib2 import Http from django.conf import settings from django.core...
Add new command to notify New Relic of deployment
Add new command to notify New Relic of deployment
Python
mit
infoxchange/ixdjango
--- +++ @@ -0,0 +1,66 @@ +""" +Management command to enable New Relic notification of deployments + +.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au> + +""" + +import pwd +import os +from subprocess import Popen, PIPE +from urllib import urlencode + +from httplib2 import Http + +from dj...
2e2ad49c7ada145b5a4a81bd8941cf5e72d2d81b
rst2pdf/tests/input/test_180.py
rst2pdf/tests/input/test_180.py
# -*- coding: utf-8 -*- from reportlab.platypus import SimpleDocTemplate from reportlab.platypus.paragraph import Paragraph from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.colors import Color from reportlab.platypus.flowables import _listWrapOn, _FUZZ from wordaxe.rl.NewParagraph...
Test case for wordaxe bug
Test case for wordaxe bug
Python
mit
thomaspurchas/rst2pdf,thomaspurchas/rst2pdf
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from reportlab.platypus import SimpleDocTemplate +from reportlab.platypus.paragraph import Paragraph +from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle +from reportlab.lib.colors import Color +from reportlab.platypus.flowables import _listWrapOn, _...
c851501cc8149685a9e9c023aa200b92c17a9078
pida_fields.py
pida_fields.py
def decode_name_fields(ida_fields): i = -1 stop = len(ida_fields) while True: i += 1 if i == stop: break count = ord(ida_fields[i]) - 1 if count == 0: continue i += 1 yield ida_fields[i:i + count] i += count - 1
Add decoder ida fields name
Add decoder ida fields name
Python
mit
goodwinxp/ATFGenerator,goodwinxp/ATFGenerator,goodwinxp/ATFGenerator
--- +++ @@ -0,0 +1,15 @@ +def decode_name_fields(ida_fields): + i = -1 + stop = len(ida_fields) + while True: + i += 1 + if i == stop: + break + + count = ord(ida_fields[i]) - 1 + if count == 0: + continue + + i += 1 + yield ida_fields[i:i + cou...
e869c7ef9e3d19da4c98cda57b5e22fb5a35cba5
tests/test_validators.py
tests/test_validators.py
""" test_validators ~~~~~~~~~~~~~~ Unittests for bundled validators. :copyright: 2007-2008 by James Crasta, Thomas Johansson. :license: MIT, see LICENSE.txt for details. """ from py.test import raises from wtforms.validators import ValidationError, length, url, not_empty, email, ip_addres...
Add first basic unittests using py.test
Add first basic unittests using py.test
Python
bsd-3-clause
Khan/wtforms
--- +++ @@ -0,0 +1,60 @@ +""" + test_validators + ~~~~~~~~~~~~~~ + + Unittests for bundled validators. + + :copyright: 2007-2008 by James Crasta, Thomas Johansson. + :license: MIT, see LICENSE.txt for details. +""" + +from py.test import raises +from wtforms.validators import ValidationError, l...
11efa5583bbeeee7c7823264f6f73715ea81edc0
luigi/tests/ontologies/eco_test.py
luigi/tests/ontologies/eco_test.py
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by...
Add trivial test for ECO fetching
Add trivial test for ECO fetching
Python
apache-2.0
RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +""" +Copyright [2009-2017] EMBL-European Bioinformatics Institute +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +http://www.apache.org/lice...
4fdba8a1a5a2123843cc9eefd8949fb8996f59b2
telemetry/telemetry/unittest/run_chromeos_tests.py
telemetry/telemetry/unittest/run_chromeos_tests.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import os import sys from telemetry.unittest import gtest_progress_reporter from telemetry.unittest import run_tests from telemetry.core impor...
Add a wrapper for ChromeOS to call into telemetry.
Add a wrapper for ChromeOS to call into telemetry. R=dtu@chromium.org, achuith@chromium.org BUG=402172, 388256 Review URL: https://codereview.chromium.org/682953002 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#301557}
Python
bsd-3-clause
SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult-csm,catapult-project/catapult,benschmaus/catapult,benschmaus/catapult,catapult-project/catapult-csm,catapult-project/catapult-csm,catapult-project/catapult,Su...
--- +++ @@ -0,0 +1,68 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +import logging +import os +import sys + +from telemetry.unittest import gtest_progress_reporter +from telemetry.unittest import...
2ef9618e705bb293641674ca5e7cc1f14daf3483
migrations/versions/0285_default_org_branding.py
migrations/versions/0285_default_org_branding.py
"""empty message Revision ID: 0285_default_org_branding Revises: 0284_0283_retry Create Date: 2016-10-25 17:37:27.660723 """ # revision identifiers, used by Alembic. revision = '0285_default_org_branding' down_revision = '0284_0283_retry' from alembic import op import sqlalchemy as sa BRANDING_TABLES = ('email_br...
Set default branding for all organisations
Set default branding for all organisations Currently when someone creates a service we match them to an organisation. Then if the organisation has a default branding set, their service gets that branding. However none of the organisations yet have a default branding set up. This commit migrates the data about the rel...
Python
mit
alphagov/notifications-api,alphagov/notifications-api
--- +++ @@ -0,0 +1,47 @@ +"""empty message + +Revision ID: 0285_default_org_branding +Revises: 0284_0283_retry +Create Date: 2016-10-25 17:37:27.660723 + +""" + +# revision identifiers, used by Alembic. +revision = '0285_default_org_branding' +down_revision = '0284_0283_retry' + +from alembic import op +import sqlalc...
1708eb17fb9c232414b0e162754ca31b6fd9366c
services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py
services/comprehension/main-api/comprehension/tests/management/commands/test_pre_filter_responses.py
import csv from io import StringIO from unittest.mock import call, MagicMock, patch from django.test import TestCase from ....views.plagiarism import PlagiarismFeedbackView from ....management.commands import pre_filter_responses Command = pre_filter_responses.Command class TestCommandBase(TestCase): def setU...
Add tests for plagiarism filter command
Add tests for plagiarism filter command
Python
agpl-3.0
empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core
--- +++ @@ -0,0 +1,68 @@ +import csv + +from io import StringIO +from unittest.mock import call, MagicMock, patch + +from django.test import TestCase + +from ....views.plagiarism import PlagiarismFeedbackView +from ....management.commands import pre_filter_responses + +Command = pre_filter_responses.Command + + +clas...
797114781ed4f31c265c58a76e39aa8ff6a16443
tensorpack/utils/compatible_serialize.py
tensorpack/utils/compatible_serialize.py
#!/usr/bin/env python import os from .serialize import loads_msgpack, loads_pyarrow, dumps_msgpack, dumps_pyarrow """ Serialization that has compatibility guarantee (therefore is safe to store to disk). """ __all__ = ['loads', 'dumps'] # pyarrow has no compatibility guarantee # use msgpack for persistent serializa...
Add missing file from last commit
Add missing file from last commit
Python
apache-2.0
ppwwyyxx/tensorpack,eyaler/tensorpack,eyaler/tensorpack,ppwwyyxx/tensorpack
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import os +from .serialize import loads_msgpack, loads_pyarrow, dumps_msgpack, dumps_pyarrow + +""" +Serialization that has compatibility guarantee (therefore is safe to store to disk). +""" + +__all__ = ['loads', 'dumps'] + + +# pyarrow has no compatibility guarante...
cfb39d7389d63a293dc075d420f80276a34df193
examples/pygstc/simple_pipeline.py
examples/pygstc/simple_pipeline.py
import time import sys from pygstc.gstc import * from pygstc.logger import * #Create a custom logger with loglevel=DEBUG gstd_logger = CustomLogger('simple_pipeline', loglevel='DEBUG') #Create the client with the logger gstd_client = GstdClient(logger=gstd_logger) def printError(): print("To play run: python3 si...
Add minimal pygstc example to play a video
Add minimal pygstc example to play a video
Python
lgpl-2.1
RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x,RidgeRun/gstd-1.x
--- +++ @@ -0,0 +1,50 @@ +import time +import sys +from pygstc.gstc import * +from pygstc.logger import * + +#Create a custom logger with loglevel=DEBUG +gstd_logger = CustomLogger('simple_pipeline', loglevel='DEBUG') + +#Create the client with the logger +gstd_client = GstdClient(logger=gstd_logger) + +def printErro...
f8d06f85e896c1098f58667c161d920f6d255d7b
sendmail/log_mail.py
sendmail/log_mail.py
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
Add utility for sent mail
Add utility for sent mail
Python
agpl-3.0
Micronaet/micronaet-utility,Micronaet/micronaet-utility,Micronaet/micronaet-utility,Micronaet/micronaet-utility
--- +++ @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the G...
425a8e26d371038f6ebf7c80dd7faea0f1dd906e
nodeconductor/core/tests/unittests/test_admin.py
nodeconductor/core/tests/unittests/test_admin.py
from django.contrib import admin from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse User = get_user_model() class TestAdminEndpoints(TestCase): def setUp(self): user, _ = User.objects.get_or_create(username='username', is_staff=True) ...
Add base test for admin endpoints
Add base test for admin endpoints [WAL-883]
Python
mit
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
--- +++ @@ -0,0 +1,48 @@ +from django.contrib import admin +from django.contrib.auth import get_user_model +from django.test import TestCase +from django.urls import reverse + + +User = get_user_model() + + +class TestAdminEndpoints(TestCase): + + def setUp(self): + user, _ = User.objects.get_or_create(user...
8ce2da2ed2e445480ee2e10483a5fae1c7c677a0
lib/output_view.py
lib/output_view.py
import sublime import sublime_plugin ###----------------------------------------------------------------------------- def output_to_view(window, title, content, reuse=True, syntax=None, clear=True, settin...
Include self contained method for output to a view
Include self contained method for output to a view This uses an enhanced version of the code that is currently in the override_audit command file, making it more general purpose. The new method can send output to a view, either reusing the one with the same title as is being used, or creating a new one. A syntax can ...
Python
mit
OdatNurd/OverrideAudit
--- +++ @@ -0,0 +1,70 @@ +import sublime +import sublime_plugin + +###----------------------------------------------------------------------------- + +def output_to_view(window, + title, + content, + reuse=True, + syntax=None, + ...
50e24b0445f259d975e5dd78dd34a8e760e4ed88
DB.py
DB.py
# Create a database import sqlite3 import csv from datetime import datetime import sys reload(sys) sys.setdefaultencoding('utf8') class createDB(): def readCSV(self, filename): conn = sqlite3.connect('CIUK.db') print 'DB Creation Successful!' cur = conn.cursor() # cur.execute(...
Create SQLite database and table and insert data from CSV file
Create SQLite database and table and insert data from CSV file
Python
mit
joykuotw/python-endpoints,joykuotw/python-endpoints,joykuotw/python-endpoints
--- +++ @@ -0,0 +1,33 @@ +# Create a database + +import sqlite3 +import csv +from datetime import datetime +import sys +reload(sys) +sys.setdefaultencoding('utf8') + +class createDB(): + + def readCSV(self, filename): + conn = sqlite3.connect('CIUK.db') + print 'DB Creation Successful!' + ...
874c01374397014e7c99afd67f5680ed32f1c5c6
bn.py
bn.py
import sys from time import gmtime year, mon, mday, hour, min, sec, wday, yday, isdst = gmtime() bld = ((year - 2000) * 12 + mon - 1) * 100 + mday rev = hour * 100 + min print 'Your build and revision number for today is %d.%d.' % (bld, rev)
Build and revision number script
Build and revision number script
Python
apache-2.0
atifaziz/NCrontab,atifaziz/NCrontab
--- +++ @@ -0,0 +1,6 @@ +import sys +from time import gmtime +year, mon, mday, hour, min, sec, wday, yday, isdst = gmtime() +bld = ((year - 2000) * 12 + mon - 1) * 100 + mday +rev = hour * 100 + min +print 'Your build and revision number for today is %d.%d.' % (bld, rev)
780e4eb03420d75c18d0b21b5e616f2952aeda41
test/test_basic_logic.py
test/test_basic_logic.py
# -*- coding: utf-8 -*- """ test_basic_logic ~~~~~~~~~~~~~~~~ Test the basic logic of the h2 state machines. """ import h2.connection from hyperframe import frame class TestBasicConnection(object): """ Basic connection tests. """ example_request_headers = [ (':authority', 'example.com'), ...
# -*- coding: utf-8 -*- """ test_basic_logic ~~~~~~~~~~~~~~~~ Test the basic logic of the h2 state machines. """ import h2.connection from hyperframe import frame class TestBasicConnection(object): """ Basic connection tests. """ example_request_headers = [ (':authority', 'example.com'), ...
Test sending headers with end stream.
Test sending headers with end stream.
Python
mit
python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2,vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2
--- +++ @@ -39,3 +39,11 @@ c = h2.connection.H2Connection() assert c.receive_frame(f) is None + + def test_send_headers_end_stream(self): + c = h2.connection.H2Connection() + frames = c.send_headers_on_stream( + 1, self.example_request_headers, end_stream=True + ...
3cf30bac4d20dbebf6185351ba0c10426a489de9
tools/run_tests/sanity/check_channel_arg_usage.py
tools/run_tests/sanity/check_channel_arg_usage.py
#!/usr/bin/env python # Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
Add sanity linter to catch future use
Add sanity linter to catch future use
Python
apache-2.0
Vizerai/grpc,jboeuf/grpc,vjpai/grpc,carl-mastrangelo/grpc,carl-mastrangelo/grpc,ncteisen/grpc,grpc/grpc,dgquintas/grpc,chrisdunelm/grpc,ctiller/grpc,nicolasnoble/grpc,jtattermusch/grpc,mehrdada/grpc,sreecha/grpc,chrisdunelm/grpc,firebase/grpc,ncteisen/grpc,jboeuf/grpc,jboeuf/grpc,jboeuf/grpc,pszemus/grpc,thinkerou/grpc...
--- +++ @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +#...
245879ce699b275edc3ee17e4cba1146241f25de
wizbit/xmlrpcdeferred.py
wizbit/xmlrpcdeferred.py
import gobject import xmlrpclib class XMLRPCDeferred (gobject.GObject): """Object representing the delayed result of an XML-RPC request. .is_ready: bool True when the result is received; False before then. .value : any Once is_ready=True, this attribute contains the result of the re...
Add GLib mainllop transport for xmlrpcserver
Add GLib mainllop transport for xmlrpcserver
Python
lgpl-2.1
wizbit-archive/wizbit,wizbit-archive/wizbit
--- +++ @@ -0,0 +1,90 @@ +import gobject + +import xmlrpclib + +class XMLRPCDeferred (gobject.GObject): + """Object representing the delayed result of an XML-RPC + request. + + .is_ready: bool + True when the result is received; False before then. + .value : any + Once is_ready=True, this attrib...
0880d067f478ba6474e433e620a1e48e23ed9c34
wsgi/setup_nginxuwsgi.py
wsgi/setup_nginxuwsgi.py
import subprocess import multiprocessing import os bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin') config_dir = os.path.expanduser('~/FrameworkBenchmarks/config') NCPU = multiprocessing.cpu_count() def start(args): try: subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c ' + ...
Add nginx+uWSGI for 10% perf improvement over gunicorn
wsgi: Add nginx+uWSGI for 10% perf improvement over gunicorn nginx+uWSGI can be a killer performance combination as described here: http://lists.unbit.it/pipermail/uwsgi/2013-September/006431.html
Python
bsd-3-clause
hamiltont/FrameworkBenchmarks,seem-sky/FrameworkBenchmarks,sxend/FrameworkBenchmarks,leafo/FrameworkBenchmarks,kostya-sh/FrameworkBenchmarks,steveklabnik/FrameworkBenchmarks,youprofit/FrameworkBenchmarks,mfirry/FrameworkBenchmarks,thousandsofthem/FrameworkBenchmarks,jeevatkm/FrameworkBenchmarks,valyala/FrameworkBenchma...
--- +++ @@ -0,0 +1,25 @@ +import subprocess +import multiprocessing +import os + +bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin') +config_dir = os.path.expanduser('~/FrameworkBenchmarks/config') +NCPU = multiprocessing.cpu_count() + +def start(args): + try: + subprocess.check_call('su...
3709bcbd421d82f9404ab3b054989546d95c006f
sc2reader/scripts/sc2json.py
sc2reader/scripts/sc2json.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals, division import sc2reader from sc2reader.plugins.replay import toJSON def main(): import argparse parser = argparse.ArgumentParser(description="Prints replay data to a json string.") pa...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals, division import sc2reader from sc2reader.factories.plugins.replay import toJSON def main(): import argparse parser = argparse.ArgumentParser(description="Prints replay data to a json string...
Fix another broken sc2reader.plugins reference.
Fix another broken sc2reader.plugins reference.
Python
mit
ggtracker/sc2reader,GraylinKim/sc2reader,vlaufer/sc2reader,StoicLoofah/sc2reader,GraylinKim/sc2reader,StoicLoofah/sc2reader,ggtracker/sc2reader,vlaufer/sc2reader
--- +++ @@ -3,7 +3,7 @@ from __future__ import absolute_import, print_function, unicode_literals, division import sc2reader -from sc2reader.plugins.replay import toJSON +from sc2reader.factories.plugins.replay import toJSON def main():
c3c559f893e31e728a429cf446039781cea1f25d
tests/test_tensorflow_magics.py
tests/test_tensorflow_magics.py
# Copyright 2019 Google Inc. # # 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, ...
Add unit tests for `%tensorflow_version`
Add unit tests for `%tensorflow_version` In preparation for changes to this file that will additionally configure the `PATH` and `PYTHONPATH` environment variables, which is required for proper TensorBoard support. PiperOrigin-RevId: 259611678
Python
apache-2.0
googlecolab/colabtools,googlecolab/colabtools
--- +++ @@ -0,0 +1,52 @@ +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by appl...
be01980afe4b1dbd5a1d5b07651cd7a54c771d01
tests/modules/test_disk.py
tests/modules/test_disk.py
# pylint: disable=C0103,C0111 import mock import unittest import tests.mocks as mocks from bumblebee.input import LEFT_MOUSE from bumblebee.modules.disk import Module class MockVFS(object): def __init__(self, perc): self.f_blocks = 1024*1024 self.f_frsize = 1 self.f_bavail = self.f_block...
Add unit tests for disk module
[tests] Add unit tests for disk module
Python
mit
tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status
--- +++ @@ -0,0 +1,47 @@ +# pylint: disable=C0103,C0111 + +import mock +import unittest + +import tests.mocks as mocks + +from bumblebee.input import LEFT_MOUSE +from bumblebee.modules.disk import Module + +class MockVFS(object): + def __init__(self, perc): + self.f_blocks = 1024*1024 + self.f_frsize...
76468926c1efe4d18477a70d767f91d4c6e38768
tests/test_dottedcircle.py
tests/test_dottedcircle.py
import uharfbuzz as hb import gflanguages import pytest langs = gflanguages.LoadLanguages() @pytest.fixture def hb_font(): # Persuade Harfbuzz we have a font that supports # every codepoint. face = hb.Face(b"") font = hb.Font(face) funcs = hb.FontFuncs.create() funcs.set_nominal_glyph_func((l...
Add test for dotted circles in sample text
Add test for dotted circles in sample text
Python
apache-2.0
googlefonts/lang
--- +++ @@ -0,0 +1,30 @@ +import uharfbuzz as hb +import gflanguages +import pytest + +langs = gflanguages.LoadLanguages() + + +@pytest.fixture +def hb_font(): + # Persuade Harfbuzz we have a font that supports + # every codepoint. + face = hb.Face(b"") + font = hb.Font(face) + funcs = hb.FontFuncs.cre...
17f71bfb81393241759e38fb9dce01561aeca3d5
tests/test_product_tags.py
tests/test_product_tags.py
from mock import Mock from saleor.product.templatetags.product_images import get_thumbnail, product_first_image def test_get_thumbnail(): instance = Mock() cropped_value = Mock(url='crop.jpg') thumbnail_value = Mock(url='thumb.jpg') instance.crop = {'10x10': cropped_value} instance.thumbnail = {'1...
Add tests to product tags
Add tests to product tags
Python
bsd-3-clause
car3oon/saleor,itbabu/saleor,UITools/saleor,KenMutemi/saleor,maferelo/saleor,KenMutemi/saleor,jreigel/saleor,mociepka/saleor,mociepka/saleor,itbabu/saleor,tfroehlich82/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,HyperManTT/ECommerceSaleor,jreigel/saleor,UITools/saleor,UITools/saleor,tfroehlich82/saleor,itbabu/sale...
--- +++ @@ -0,0 +1,31 @@ +from mock import Mock +from saleor.product.templatetags.product_images import get_thumbnail, product_first_image + + +def test_get_thumbnail(): + instance = Mock() + cropped_value = Mock(url='crop.jpg') + thumbnail_value = Mock(url='thumb.jpg') + instance.crop = {'10x10': cropped...
e455d459590a4f2b16b9a9360b6e33640f5ec7bf
python/allcheck.py
python/allcheck.py
#!/usr/bin/env python import sys import re import glob import phonenumbers INTERNAL_FILES = ['phonenumbers/util.py', 'phonenumbers/re_util.py', 'phonenumbers/unicode_util.py'] CLASS_RE = re.compile(r"^class +([A-Za-z][_A-Za-z0-9]+)[ \(:]") FUNCTION_RE = re.compile("^def +([A-Za-z][...
Add a script to check that __all__ in __init__.py is correct
Add a script to check that __all__ in __init__.py is correct
Python
apache-2.0
daviddrysdale/python-phonenumbers,roubert/python-phonenumbers,daodaoliang/python-phonenumbers,titansgroup/python-phonenumbers,dongguangming/python-phonenumbers,daviddrysdale/python-phonenumbers,agentr13/python-phonenumbers,gencer/python-phonenumbers,SergiuMir/python-phonenumbers,shikigit/python-phonenumbers,daviddrysda...
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +import sys +import re +import glob + +import phonenumbers + +INTERNAL_FILES = ['phonenumbers/util.py', + 'phonenumbers/re_util.py', + 'phonenumbers/unicode_util.py'] +CLASS_RE = re.compile(r"^class +([A-Za-z][_A-Za-z0-9]+)[ \(:]") +FUN...
48c844e602eaa182c4efaaa0b977765f4248d0a0
tools/network_migration.py
tools/network_migration.py
import argparse, shelve def renameDictKeys(storageDict): for key in storageDict.iterkeys(): if isinstance(storageDict[key], dict): renameDictKeys(storageDict[key]) if key == options.oldnetwork: storageDict[options.newnetwork] = storageDict[options.oldnetwork] del...
Add a data migration tool
Add a data migration tool
Python
mit
Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot
--- +++ @@ -0,0 +1,29 @@ +import argparse, shelve + +def renameDictKeys(storageDict): + for key in storageDict.iterkeys(): + if isinstance(storageDict[key], dict): + renameDictKeys(storageDict[key]) + if key == options.oldnetwork: + storageDict[options.newnetwork] = storageDict[...
d72d2e38d177476470b22ded061dd06b2be3ee88
turbustat/tests/helpers.py
turbustat/tests/helpers.py
from __future__ import print_function, absolute_import, division from astropy import units as u from numpy.testing import assert_allclose as assert_allclose_numpy, assert_array_equal def assert_allclose(q1, q2, **kwargs): """ Quantity-safe version of Numpy's assert_allclose Copyright (c) 2014, spectral...
Add the quantity-safe allclose from spectral-cube
Add the quantity-safe allclose from spectral-cube
Python
mit
e-koch/TurbuStat,Astroua/TurbuStat
--- +++ @@ -0,0 +1,50 @@ +from __future__ import print_function, absolute_import, division + +from astropy import units as u + +from numpy.testing import assert_allclose as assert_allclose_numpy, assert_array_equal + + +def assert_allclose(q1, q2, **kwargs): + """ + Quantity-safe version of Numpy's assert_allcl...
835b5f20061033b6fcf2a8b86203a42c5d4835ee
spotpy/unittests/test_parameter.py
spotpy/unittests/test_parameter.py
import unittest try: import spotpy except ImportError: import sys sys.path.append(".") import spotpy from spotpy import parameter import numpy as np #https://docs.python.org/3/library/unittest.html class TestListParameterDistribution(unittest.TestCase): def setUp(self): self.values = [1, ...
Add initial unit tests for parameter.py (List)
Add initial unit tests for parameter.py (List)
Python
mit
bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy
--- +++ @@ -0,0 +1,39 @@ +import unittest +try: + import spotpy +except ImportError: + import sys + sys.path.append(".") + import spotpy +from spotpy import parameter +import numpy as np + +#https://docs.python.org/3/library/unittest.html + +class TestListParameterDistribution(unittest.TestCase): + + d...
b1feed0ced6d1328cc39bc9bba36331ec6da7803
pre_commit_hooks/detect_private_key.py
pre_commit_hooks/detect_private_key.py
from __future__ import print_function import argparse import sys BLACKLIST = [ b'BEGIN RSA PRIVATE KEY', b'BEGIN DSA PRIVATE KEY', b'BEGIN EC PRIVATE KEY', b'BEGIN OPENSSH PRIVATE KEY', b'BEGIN PRIVATE KEY', b'PuTTY-User-Key-File-2', b'BEGIN SSH2 ENCRYPTED PRIVATE KEY', ] def detect_priv...
from __future__ import print_function import argparse import sys BLACKLIST = [ b'BEGIN RSA PRIVATE KEY', b'BEGIN DSA PRIVATE KEY', b'BEGIN EC PRIVATE KEY', b'BEGIN OPENSSH PRIVATE KEY', b'BEGIN PRIVATE KEY', b'PuTTY-User-Key-File-2', b'BEGIN SSH2 ENCRYPTED PRIVATE KEY', b'BEGIN PGP PRI...
Add ban for pgp/gpg private key blocks
Add ban for pgp/gpg private key blocks
Python
mit
pre-commit/pre-commit-hooks,Harwood/pre-commit-hooks
--- +++ @@ -11,6 +11,7 @@ b'BEGIN PRIVATE KEY', b'PuTTY-User-Key-File-2', b'BEGIN SSH2 ENCRYPTED PRIVATE KEY', + b'BEGIN PGP PRIVATE KEY BLOCK', ]
4883bd13c6e07a0568c29fd26a141888b52292b7
utils/player_draft_retriever.py
utils/player_draft_retriever.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import requests from lxml import html from db.team import Team from db.player_draft import PlayerDraft class PlayerDraftRetriever(): NHL_PLAYER_DRAFT_PREFIX = "https://www.nhl.com/player" DRAFT_INFO_REGEX = re.compile( "(\d{4})\s(.+),\s(\d+).+...
Add retriever object for player draft information
Add retriever object for player draft information
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +import requests +from lxml import html + +from db.team import Team +from db.player_draft import PlayerDraft + +class PlayerDraftRetriever(): + + NHL_PLAYER_DRAFT_PREFIX = "https://www.nhl.com/player" + DRAFT_INFO_REGEX = re...
bc34d530f4a21b5f06228d626f446c617b9c8876
examples/defconfig_oldconfig.py
examples/defconfig_oldconfig.py
# Produces exactly the same output as the following script: # # make defconfig # echo CONFIG_ETHERNET=n >> .config # make oldconfig # echo CONFIG_ETHERNET=y >> .config # yes n | make oldconfig # # This came up in https://github.com/ulfalizer/Kconfiglib/issues/15. import kconfiglib import sys conf = kconfiglib.Config(...
Add example that mirrors defconfig and oldconfig.
Add example that mirrors defconfig and oldconfig. From https://github.com/ulfalizer/Kconfiglib/issues/15. Getting the output to match up exactly requires emulating each step, due to Kconfig subtleties related to which symbols have been assigned values by the user. The output might differ with other approaches, but thi...
Python
isc
ulfalizer/Kconfiglib,ulfalizer/Kconfiglib
--- +++ @@ -0,0 +1,33 @@ +# Produces exactly the same output as the following script: +# +# make defconfig +# echo CONFIG_ETHERNET=n >> .config +# make oldconfig +# echo CONFIG_ETHERNET=y >> .config +# yes n | make oldconfig +# +# This came up in https://github.com/ulfalizer/Kconfiglib/issues/15. + +import kconfiglib...
06cd9e8e5006d68d7656b7f147442e54aaf9d7a1
clubs/migrations/0035_add_public_health_college.py
clubs/migrations/0035_add_public_health_college.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_college(apps, schema_editor): Club = apps.get_model('clubs', 'Club') College = apps.get_model('clubs', 'College') StudentClubYear = apps.get_model('core', 'StudentClubYear') year_2015_2016 ...
Add female Public Health College and Club
Add female Public Health College and Club
Python
agpl-3.0
enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,enjaz/enjaz,enjaz/enjaz
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def add_college(apps, schema_editor): + Club = apps.get_model('clubs', 'Club') + College = apps.get_model('clubs', 'College') + StudentClubYear = apps.get_model('core', 'S...
17cdae7f50a7ed15c4e8a84cdb0000a32f824c5f
examples/outh/getaccesstoken.py
examples/outh/getaccesstoken.py
import webbrowser import tweepy """ Query the user for their consumer key/secret then attempt to fetch a valid access token. """ if __name__ == "__main__": consumer_key = raw_input('Consumer key: ').strip() consumer_secret = raw_input('Consumer secret: ').strip() auth = tweepy.OAuthHandler(consu...
Add an oauth example script.
Add an oauth example script.
Python
mit
xrg/tweepy,raymondethan/tweepy,damchilly/tweepy,mlinsey/tweepy,ze-phyr-us/tweepy,obskyr/tweepy,markunsworth/tweepy,edsu/tweepy,kcompher/tweepy,yared-bezum/tweepy,tuxos/tweepy,alexhanna/tweepy,nickmalleson/tweepy,iamjakob/tweepy,cogniteev/tweepy,cinemapub/bright-response,nickmalleson/tweepy,conversocial/tweepy,cinemapub...
--- +++ @@ -0,0 +1,29 @@ +import webbrowser + +import tweepy + +""" + Query the user for their consumer key/secret + then attempt to fetch a valid access token. +""" + +if __name__ == "__main__": + + consumer_key = raw_input('Consumer key: ').strip() + consumer_secret = raw_input('Consumer secret: ').stri...
bc32b2bccc82caecea0cf936e13c3ae70d0e9486
utils/check.py
utils/check.py
from pathlib import Path from PIL import Image from concurrent.futures import ProcessPoolExecutor import os import sys def verify_or_delete(filename): try: Image.open(filename).load() except OSError: return False return True if __name__ == '__main__': if len(sys.argv) < 2: pri...
Add script to remove broken images.
Add script to remove broken images.
Python
mit
Lodour/Weibo-Album-Crawler
--- +++ @@ -0,0 +1,29 @@ +from pathlib import Path +from PIL import Image +from concurrent.futures import ProcessPoolExecutor +import os +import sys + +def verify_or_delete(filename): + try: + Image.open(filename).load() + except OSError: + return False + return True + + +if __name__ == '__main...
388bbd915a5e40a2e096eb22ab294ffcbd3db936
bananas/model.py
bananas/model.py
import numpy # FIXME: copy the functions here from sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp class GMM(object): def __init__(self, weights, means, covs): self.weights = numpy.array(weights) self.means = numpy.array(means) self.covs = numpy.array(covs) def s...
Add a gmm, currently wrapping sklearn
Add a gmm, currently wrapping sklearn
Python
apache-2.0
bccp/bananaplots,bccp/bananaplots
--- +++ @@ -0,0 +1,65 @@ +import numpy +# FIXME: copy the functions here + +from sklearn.mixture.gmm import log_multivariate_normal_density, logsumexp + +class GMM(object): + def __init__(self, weights, means, covs): + self.weights = numpy.array(weights) + self.means = numpy.array(means) + sel...
7e9794dc98a268479f0f57128effc67f88586c8f
bvspca/core/migrations/0025_auto_20180202_1214.py
bvspca/core/migrations/0025_auto_20180202_1214.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-02-02 19:14 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0024_contentindexpage_empty_message'), ] operations = [ migrations....
Add default message for list pages
Add default message for list pages
Python
mit
nfletton/bvspca,nfletton/bvspca,nfletton/bvspca,nfletton/bvspca
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.9 on 2018-02-02 19:14 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0024_contentindexpage_empty_message'), + ] ...
9ce90bc43cfcc5a56be958671f304e7929eb0446
cmsplugin_collapse/migrations/0002_auto_20160210_0651.py
cmsplugin_collapse/migrations/0002_auto_20160210_0651.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cmsplugin_collapse', '0001_initial'), ] operations = [ migrations.AlterField( model_name='accordionheader', ...
Add missing migration step dua changes in model
Add missing migration step dua changes in model This should fix #5.
Python
bsd-3-clause
nimbis/cmsplugin-collapse,nimbis/cmsplugin-collapse
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cmsplugin_collapse', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + ...
842c796a223ee9cb78c69ccb59416a2afe0fcee0
tests/permissions.py
tests/permissions.py
import unittest from permission import Permission, PERMISSION_DELIMITER class BasicPermissionTests(unittest.TestCase): def setUp(self): self.p1 = Permission("test{0}1{0}hello".format(PERMISSION_DELIMITER)) self.p2 = Permission("test{0}2{0}hello".format(PERMISSION_DELIMITER)) self.p3 = Per...
Add tests for Permission class.
Add tests for Permission class. Signed-off-by: Tyler O'Meara <c794bd35db97c1cf0b8edc21ac218cd202f68ca7@TylerOMeara.com>
Python
mit
Acidity/PyPermissions
--- +++ @@ -0,0 +1,45 @@ +import unittest +from permission import Permission, PERMISSION_DELIMITER + + +class BasicPermissionTests(unittest.TestCase): + + def setUp(self): + self.p1 = Permission("test{0}1{0}hello".format(PERMISSION_DELIMITER)) + self.p2 = Permission("test{0}2{0}hello".format(PERMISSI...
f5d2b17371dbd974820b9b8ab1fcdb11ad8fa646
backend/scripts/countdups.py
backend/scripts/countdups.py
#!/usr/bin/env python import rethinkdb as r conn = r.connect('localhost', 30815, db='materialscommons') rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size') total_bytes = 0 total_files = 0 for doc in rql.run(conn): total_bytes = total_bytes + doc['size'] total_files = total_file...
Add in script to count duplicates.
Add in script to count duplicates.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import rethinkdb as r + +conn = r.connect('localhost', 30815, db='materialscommons') +rql = r.table('datafiles').filter(r.row['usesid'].match("^[0-9a-f]")).pluck('size') +total_bytes = 0 +total_files = 0 +for doc in rql.run(conn): + total_bytes = total_bytes + doc...
8488e7c5245758e4651e6d723f93d52f3ff54d73
tools/submit_awcy.py
tools/submit_awcy.py
#!/usr/bin/env python from __future__ import print_function import requests import argparse import os import subprocess import sys if 'DAALA_ROOT' not in os.environ: print("Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) keyfile = open('secret_key','r') key = keyfile.read(...
Add tool for submitting jobs to AreWeCompressedYet
Add tool for submitting jobs to AreWeCompressedYet
Python
bsd-2-clause
luctrudeau/daala,kodabb/daala,vr000m/daala,nvoron23/daala,iankronquist/daala,kustom666/daala,kustom666/daala,jmvalin/daala,kbara/daala,xiph/daala,kbara/daala,xiph/daala,jmvalin/daala,ascent12/daala,tribouille/daala,tribouille/daala,xiph/daala,xiphmont/daala,ycho/daala,xiph/daala,HeadhunterXamd/daala,nvoron23/daala,Head...
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import requests +import argparse +import os +import subprocess +import sys + +if 'DAALA_ROOT' not in os.environ: + print("Please specify the DAALA_ROOT environment variable to use this tool.") + sys.exit(1) + +keyfile = ...
4d30756e722cafa40fa449e48c967eeebc58500a
zerver/management/commands/import_realm_filters.py
zerver/management/commands/import_realm_filters.py
from __future__ import absolute_import from django.core.management.base import BaseCommand from zerver.models import RealmFilter, get_realm import logging class Command(BaseCommand): help = """Imports realm filters to database""" def handle(self, *args, **options): realm_filters = { "zu...
Add a manage.py command to import realm filters
[manual] Add a manage.py command to import realm filters This must be run manually on staging after deployment. Once it has been run, it can be deleted. It only needs to be run on staging, not prod. (imported from commit 79252c23ba8cda93500a18aa7b02575f406dd379)
Python
apache-2.0
vabs22/zulip,calvinleenyc/zulip,sup95/zulip,deer-hope/zulip,kokoar/zulip,ryanbackman/zulip,ahmadassaf/zulip,akuseru/zulip,shaunstanislaus/zulip,Gabriel0402/zulip,souravbadami/zulip,JanzTam/zulip,ufosky-server/zulip,noroot/zulip,amallia/zulip,vikas-parashar/zulip,kaiyuanheshang/zulip,synicalsyntax/zulip,ashwinirudrappa/...
--- +++ @@ -0,0 +1,27 @@ +from __future__ import absolute_import + +from django.core.management.base import BaseCommand + +from zerver.models import RealmFilter, get_realm + +import logging + +class Command(BaseCommand): + help = """Imports realm filters to database""" + + def handle(self, *args, **options): + ...