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
f02f8f5a68bd26d1ece32c50482729b7774b6e2a
scripts/simple-analysis.py
scripts/simple-analysis.py
#!/usr/bin/python from __future__ import print_function, division import networkx from reddit_meatspace.models import MeetupConnections connections = MeetupConnections._byID("2013") digraph = networkx.DiGraph() for connection, timestamp in connections._values().iteritems(): left, right = connection.split(":") ...
Add a simple script for looking at connections.
Add a simple script for looking at connections.
Python
bsd-3-clause
reddit/reddit-plugin-meatspace,reddit/reddit-plugin-meatspace,reddit/reddit-plugin-meatspace
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/python + +from __future__ import print_function, division + +import networkx + +from reddit_meatspace.models import MeetupConnections + + +connections = MeetupConnections._byID("2013") +digraph = networkx.DiGraph() +for connection, timestamp in connections._values().iteritems(): +...
39b63523634801fe8ef2cca03e11b3875d84cdbd
flare/flare_io.py
flare/flare_io.py
from flare.struc import Structure from typing import List from json import dump, load from flare.util import NumpyEncoder def md_trajectory_to_file(filename, structures: List[Structure]): """ Take a list of structures and write them to a json file. :param filename: :param structures: """ f = open(filename, 'w') ...
from flare.struc import Structure from typing import List from json import dump, load from flare.util import NumpyEncoder def md_trajectory_to_file(filename: str, structures: List[Structure]): """ Take a list of structures and write them to a json file. :param filename: :param structures: """ with open(filename,...
Tweak syntax for f.close() concision, add typehints
Tweak syntax for f.close() concision, add typehints
Python
mit
mir-group/flare,mir-group/flare
--- +++ @@ -3,22 +3,21 @@ from json import dump, load from flare.util import NumpyEncoder -def md_trajectory_to_file(filename, structures: List[Structure]): +def md_trajectory_to_file(filename: str, structures: List[Structure]): """ Take a list of structures and write them to a json file. :param filename: ...
cb0d6124ea31e8fb9ff8957072a2b881b882127e
examples/hero9_timelapse_webcam.py
examples/hero9_timelapse_webcam.py
import sys import time from goprocam import GoProCamera, constants import threading import logging """ I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly. pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart This script will overrride some settings for reliability...
Add Timelapse script for sunrise timelapses
Add Timelapse script for sunrise timelapses
Python
mit
KonradIT/gopro-py-api,KonradIT/gopro-py-api
--- +++ @@ -0,0 +1,42 @@ +import sys +import time +from goprocam import GoProCamera, constants +import threading +import logging + +""" +I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly. + +pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart + +This script will ...
4651e178ddbeac9211f8170e2e20f8a35ff0e3ab
ocradmin/plugins/test_nodetree.py
ocradmin/plugins/test_nodetree.py
#!/usr/bin/python import os import sys import json sys.path.append(os.path.abspath("..")) os.environ['DJANGO_SETTINGS_MODULE'] = 'ocradmin.settings' sys.path.insert(0, "lib") from nodetree import script from nodetree.manager import ModuleManager def run(nodelist, outpath): manager = ModuleManager() manager....
Add a simple CLI script for writing out results of scripts
Add a simple CLI script for writing out results of scripts
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
--- +++ @@ -0,0 +1,44 @@ +#!/usr/bin/python + +import os +import sys +import json +sys.path.append(os.path.abspath("..")) +os.environ['DJANGO_SETTINGS_MODULE'] = 'ocradmin.settings' + +sys.path.insert(0, "lib") + +from nodetree import script +from nodetree.manager import ModuleManager + +def run(nodelist, outpath): +...
23138ab91e5ac0ecf92a0968bf8e4abfa7d0c763
removedups.py
removedups.py
import hashlib, csv, os def md5(fname): hash_md5 = hashlib.md5() with open(fname, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return hash_md5.hexdigest() def process_directory_csv(current_dir_fullpath, sub_dir_list, files, csvwriter): for file i...
Remove duplicates in all subdirectories - working raw version.
Remove duplicates in all subdirectories - working raw version.
Python
apache-2.0
alprab/utils
--- +++ @@ -0,0 +1,70 @@ +import hashlib, csv, os + +def md5(fname): + hash_md5 = hashlib.md5() + with open(fname, "rb") as f: + for chunk in iter(lambda: f.read(4096), b""): + hash_md5.update(chunk) + return hash_md5.hexdigest() + +def process_directory_csv(current_dir_fullpath, sub_dir_li...
99395e345f74bbedd29fd45eebe0738a3b5f4729
ckanext/archiver/tests/test_api.py
ckanext/archiver/tests/test_api.py
import pytest import tempfile from ckan import model from ckan import plugins from ckan.tests import factories import ckan.tests.helpers as helpers from ckanext.archiver import model as archiver_model from ckanext.archiver.tasks import update_package @pytest.mark.usefixtures('with_plugins') @pytest.mark.ckan_config...
Test api endpoint for package show
Test api endpoint for package show
Python
mit
ckan/ckanext-archiver,ckan/ckanext-archiver,ckan/ckanext-archiver
--- +++ @@ -0,0 +1,48 @@ +import pytest +import tempfile + +from ckan import model +from ckan import plugins +from ckan.tests import factories +import ckan.tests.helpers as helpers + +from ckanext.archiver import model as archiver_model +from ckanext.archiver.tasks import update_package + + +@pytest.mark.usefixtures(...
797249c42c8c1c0d6eda05dbf9e9d16d2706b373
h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py
h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater.py
from __future__ import print_function import sys, os sys.path.insert(1, os.path.join("..","..","..")) import h2o from tests import pyunit_utils from h2o.estimators.deepwater import H2ODeepWaterEstimator def deepwater_lenet(): print("Test checks if Deep Water works fine with a multiclass image dataset") frame = h2...
Add LeNet example with custom scoring and train_samples_per_iteration.
Add LeNet example with custom scoring and train_samples_per_iteration.
Python
apache-2.0
mathemage/h2o-3,h2oai/h2o-3,spennihana/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,h2oai/h2o-dev,michalkurka/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,spe...
--- +++ @@ -0,0 +1,22 @@ +from __future__ import print_function +import sys, os +sys.path.insert(1, os.path.join("..","..","..")) +import h2o +from tests import pyunit_utils +from h2o.estimators.deepwater import H2ODeepWaterEstimator + +def deepwater_lenet(): + print("Test checks if Deep Water works fine with a mult...
8cdbbbaf33cd09bc742761ce8cd5b79b185710cd
webtool/server/management/commands/timer_update.py
webtool/server/management/commands/timer_update.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function import io import datetime from django.core.management.base import BaseCommand from server.models import Instruction, Tour, Talk, Session, Season from server.views.bulletin impo...
Introduce a timer based update of activities
Introduce a timer based update of activities
Python
bsd-2-clause
wodo/WebTool3,wodo/WebTool3,wodo/WebTool3,wodo/WebTool3
--- +++ @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import +from __future__ import unicode_literals +from __future__ import print_function + +import io + +import datetime +from django.core.management.base import BaseCommand + +from server.models import Instruction, Tour, Talk, Session, ...
6693172856655329d99f038d54b1d8819fc1a9b6
scripts/examples/02-Board-Control/native_emitters.py
scripts/examples/02-Board-Control/native_emitters.py
import time @micropython.asm_thumb def asm(): movw(r0, 42) @micropython.viper def viper(a, b): return a + b @micropython.native def native(a, b): return a + b print(asm()) print(viper(1, 2)) print(native(1, 2))
Add native code emitters example.
Add native code emitters example.
Python
mit
kwagyeman/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,kwagyeman/openmv
--- +++ @@ -0,0 +1,19 @@ +import time + +@micropython.asm_thumb +def asm(): + movw(r0, 42) + +@micropython.viper +def viper(a, b): + return a + b + +@micropython.native +def native(a, b): + return a + b + + +print(asm()) +print(viper(1, 2)) +print(native(1, 2)) +
fa6060a21767a0b5b2b3a10e4301e0c1a30134cb
i8c/tests/test_opt_lit0_cmp_before_bra.py
i8c/tests/test_opt_lit0_cmp_before_bra.py
from i8c.tests import TestCase SOURCE1 = """\ define test::optimize_cmp_bra_const_const returns ptr argument ptr x dup load NULL beq return_the_null deref ptr return return_the_null: """ SOURCE2 = """\ define test::optimize_cmp_bra_const_const returns ptr argument ptr x dup load ...
Test the lit0,cmp before bra eliminator
Test the lit0,cmp before bra eliminator
Python
lgpl-2.1
gbenson/i8c
--- +++ @@ -0,0 +1,32 @@ +from i8c.tests import TestCase + +SOURCE1 = """\ +define test::optimize_cmp_bra_const_const returns ptr + argument ptr x + + dup + load NULL + beq return_the_null + deref ptr + return +return_the_null: +""" + +SOURCE2 = """\ +define test::optimize_cmp_bra_const_const return...
a3a48824b36ef62edaf128379f1baec5482166e7
src/nodeconductor_saltstack/migrations/0005_resource_error_message.py
src/nodeconductor_saltstack/migrations/0005_resource_error_message.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('nodeconductor_saltstack', '0004_remove_useless_spl_fields'), ] operations = [ migrations.AddField( model_name='d...
Save error_message for resources (SAAS-982)
Save error_message for resources (SAAS-982)
Python
mit
opennode/nodeconductor-saltstack
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('nodeconductor_saltstack', '0004_remove_useless_spl_fields'), + ] + + operations = [ + migra...
779fb015913a17fcb8fb290515845e6b47c3ae50
latex2markdown.py
latex2markdown.py
""" A Very simple tool to convert latex documents to markdown documents """ import re span_substitutions = [ (r'\\emph\{(.+)\}', r'*\1*'), (r'\\textbf\{(.+)\}', r'**\1**'), (r'\\verb;(.+);', r'`\1`'), (r'\\includegraphics\{(.+)\}', r'![](\1)'), ] def convert_span_elements(line...
Create the converter (with span-conversion functionality)
Create the converter (with span-conversion functionality)
Python
mit
jladan/latex2markdown
--- +++ @@ -0,0 +1,27 @@ +""" +A Very simple tool to convert latex documents to markdown documents +""" +import re + + +span_substitutions = [ + (r'\\emph\{(.+)\}', r'*\1*'), + (r'\\textbf\{(.+)\}', r'**\1**'), + (r'\\verb;(.+);', r'`\1`'), + (r'\\includegraphics\{(.+)\}', r'![](\1)'), + ...
6014dab06ed2275c5703ab9f9e63272656733c69
moj_utils/rest.py
moj_utils/rest.py
from django.conf import settings def retrieve_all_pages(api_endpoint, **kwargs): """ Some MTP apis are paginated, this method loads all pages into a single results list :param api_endpoint: slumber callable, e.g. `[api_client].cashbook.transactions.locked.get` :param kwargs: additional arguments to pa...
Add retrieve_all_pages util method from mtp-cashbook
Add retrieve_all_pages util method from mtp-cashbook This method is duplicated in functionality in multiple front end apps.
Python
mit
ministryofjustice/django-utils,ministryofjustice/django-utils
--- +++ @@ -0,0 +1,22 @@ +from django.conf import settings + + +def retrieve_all_pages(api_endpoint, **kwargs): + """ + Some MTP apis are paginated, this method loads all pages into a single results list + :param api_endpoint: slumber callable, e.g. `[api_client].cashbook.transactions.locked.get` + :param...
c675fe2a82733ef210bf287df277f8ae956a4295
rarbg-get.py
rarbg-get.py
#!env /usr/bin/python3 import sys import urllib.parse import urllib.request def main(): search = sys.argv[1] url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search=' url = url + search print(url) req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"}) resp = urlli...
Add beginning of main script
Add beginning of main script
Python
mit
jadams/rarbg-get
--- +++ @@ -0,0 +1,17 @@ +#!env /usr/bin/python3 + +import sys +import urllib.parse +import urllib.request + +def main(): + search = sys.argv[1] + url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search=' + url = url + search + print(url) + req = urllib.request.Request(url, headers={'User-Agen...
d2bcba204d36a8ffd1e6a1ed79b89fcb6f1c88c5
ideas/test_kmc.py
ideas/test_kmc.py
# This code will test out the idea of using kmc to # 1. quickly enumerate the k-mers # 2. intersect these with the training database, output as fasta # 3. use that reduced fasta of intersecting kmers as the query to CMash #################################################################### # First, I will need to dump...
Add file to test out kmc approach. Dump training k-mers to fasta file
Add file to test out kmc approach. Dump training k-mers to fasta file
Python
bsd-3-clause
dkoslicki/CMash,dkoslicki/CMash
--- +++ @@ -0,0 +1,41 @@ +# This code will test out the idea of using kmc to +# 1. quickly enumerate the k-mers +# 2. intersect these with the training database, output as fasta +# 3. use that reduced fasta of intersecting kmers as the query to CMash + +################################################################...
02ad029840b2e770bc802fd7f8504498cb0f756d
lib/ansible/plugins/test/mathstuff.py
lib/ansible/plugins/test/mathstuff.py
# (c) 2016, Ansible, Inc # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is di...
Add `issubset` and `issuperset` tests
Add `issubset` and `issuperset` tests
Python
mit
thaim/ansible,thaim/ansible
--- +++ @@ -0,0 +1,34 @@ +# (c) 2016, Ansible, Inc +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) a...
bf86584829f56f91b363f251d77f3157f952db0f
tests/test_cyprep.py
tests/test_cyprep.py
import unittest import numpy as np import yatsm._cyprep class TestCyPrep(unittest.TestCase): @classmethod def setUpClass(cls): # Test data n_band = 7 n_mask = 50 n_images = 1000 cls.data = np.random.randint( 0, 10000, size=(n_band, n_images)).astype(np.i...
Add tests for masking of data based on being within a range of values
Add tests for masking of data based on being within a range of values
Python
mit
ceholden/yatsm,c11/yatsm,jmorton/yatsm,valpasq/yatsm,ceholden/yatsm,valpasq/yatsm,jmorton/yatsm,c11/yatsm,jmorton/yatsm
--- +++ @@ -0,0 +1,38 @@ +import unittest + +import numpy as np + +import yatsm._cyprep + + +class TestCyPrep(unittest.TestCase): + + @classmethod + def setUpClass(cls): + # Test data + n_band = 7 + n_mask = 50 + n_images = 1000 + + cls.data = np.random.randint( + 0...
aa78a2670766b0a5e093a1876cb402ed513573bd
openfisca_france/scripts/parameters/explore_parameters_unit.py
openfisca_france/scripts/parameters/explore_parameters_unit.py
# -*- coding: utf-8 -*- from openfisca_core.parameters import ParameterNode, Scale from openfisca_france import FranceTaxBenefitSystem tax_benefit_system = FranceTaxBenefitSystem() parameters = tax_benefit_system.parameters def get_parameters_by_unit(parameter, parameters_by_unit = None): if parameters_by_uni...
Add script to explore parameters units
Add script to explore parameters units
Python
agpl-3.0
antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + + +from openfisca_core.parameters import ParameterNode, Scale +from openfisca_france import FranceTaxBenefitSystem + + +tax_benefit_system = FranceTaxBenefitSystem() +parameters = tax_benefit_system.parameters + + +def get_parameters_by_unit(parameter, parameters_by...
26ab37868e67b5b815cf8df67cc04876ff44c148
tests/rules_tests/isValid_tests/NongrammarEntitiesTest.py
tests/rules_tests/isValid_tests/NongrammarEntitiesTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule from .grammar import * class NongrammarEntitiesTest(TestCase): pass if __name__ == '__main__': main()
Add file for Nongrammar entities tests
Add file for Nongrammar entities tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import main, TestCase +from grammpy import Rule +from .grammar import * + + +class NongrammarEntitiesTest(TestCase): + pass + + +if __name__ == '__main__...
fa3a02e6660ce556defc2f2c6008c6eb24eb71c1
Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Sampler.py
Sketches/JT/Jam/library/trunk/Kamaelia/Apps/Jam/Audio/Sampler.py
import time import wave import pygame import numpy import Axon from Axon.SchedulingComponent import SchedulingComponent class WavVoice(SchedulingComponent): bufferSize = 1024 def __init__(self, fileName, **argd): super(WavVoice, self).__init__(**argd) self.on = False self.wavFile = wa...
Add a simple sampler for playing wav files triggered by note on messages
Add a simple sampler for playing wav files triggered by note on messages
Python
apache-2.0
sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia
--- +++ @@ -0,0 +1,80 @@ +import time +import wave +import pygame +import numpy +import Axon +from Axon.SchedulingComponent import SchedulingComponent + +class WavVoice(SchedulingComponent): + bufferSize = 1024 + def __init__(self, fileName, **argd): + super(WavVoice, self).__init__(**argd) + + se...
4e3644234fab9cb14a3d511b24bce3ed8a1446e0
tests/scales/test_minor.py
tests/scales/test_minor.py
# Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015 # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify,...
Add in a minor testcase.
Add in a minor testcase.
Python
mit
paultag/python-muse
--- +++ @@ -0,0 +1,41 @@ +# Copyright (c) Paul R. Tagliamonte <tag@pault.ag>, 2015 +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +#...
6f8c64ed6f99493811cab54137a1eed44d851260
scripts/GetGroupAndModuleFromClassName.py
scripts/GetGroupAndModuleFromClassName.py
#!/usr/bin/env python """ Given the path to the ITK Source Dir print group and module of a given class for instance, try: ./GetGroupAndModuleFromClassName /path/to/ITK Image """ import sys import os itk_dir = sys.argv[1] cmakefile = os.path.join( itk_dir, 'CMake', 'UseITK.cmake' ) if not os.path.exists( cmakefi...
Add python script to get group and module given a class name
Add python script to get group and module given a class name
Python
apache-2.0
InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples,InsightSoftwareConsortium/ITKExamples
--- +++ @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +""" Given the path to the ITK Source Dir +print group and module of a given class + +for instance, try: + + ./GetGroupAndModuleFromClassName /path/to/ITK Image +""" + +import sys +import os + +itk_dir = sys.argv[1] +cmakefile = os.path.join( itk_dir, 'CMake', 'UseIT...
acc5c52011db4c8edc615ae3e0cad9cea4fe58b8
spreadflow_observer_fs/test/test_source.py
spreadflow_observer_fs/test/test_source.py
# -*- coding: utf-8 -*- # pylint: disable=too-many-public-methods """ Integration tests for spreadflow filesystem observer source. """ from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import copy from bson import BSON from datetime import datetime from t...
Add basic test for filesystem observer source
Add basic test for filesystem observer source
Python
mit
znerol/spreadflow-observer-fs,spreadflow/spreadflow-observer-fs
--- +++ @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# pylint: disable=too-many-public-methods + +""" +Integration tests for spreadflow filesystem observer source. +""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import unicode_literals + +import copy + +from bson import ...
5273a97ab1da4b809573617d3fc01705c322992f
thecut/authorship/tests/test_forms.py
thecut/authorship/tests/test_forms.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.test import TestCase from django import forms from mock import patch from test_app.models import AuthorshipModel from thecut.authorship.factories import UserFactory from thecut.authorship.forms import AuthorshipMixin class Au...
Add tests for form mixin.
Add tests for form mixin.
Python
apache-2.0
thecut/thecut-authorship
--- +++ @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, unicode_literals +from django.test import TestCase +from django import forms +from mock import patch +from test_app.models import AuthorshipModel +from thecut.authorship.factories import UserFactory +from thecut.authorship.form...
e838b6d53f131badfbb7b51b4eb268ebb5d7c450
spacy/tests/matcher/test_entity_id.py
spacy/tests/matcher/test_entity_id.py
from __future__ import unicode_literals import spacy from spacy.vocab import Vocab from spacy.matcher import Matcher from spacy.tokens.doc import Doc from spacy.attrs import * import pytest @pytest.fixture def en_vocab(): return spacy.get_lang_class('en').Defaults.create_vocab() def test_init_matcher(en_vocab)...
Add tests for using the new Entity ID tracking in the rule matcher
Add tests for using the new Entity ID tracking in the rule matcher
Python
mit
banglakit/spaCy,spacy-io/spaCy,recognai/spaCy,explosion/spaCy,raphael0202/spaCy,aikramer2/spaCy,oroszgy/spaCy.hu,Gregory-Howard/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,banglakit/spaCy,raphael0202/spaCy,honnibal/spaCy,banglakit/spaCy,raphael0202/spaCy,recognai/spaCy,spacy-io/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,b...
--- +++ @@ -0,0 +1,59 @@ +from __future__ import unicode_literals +import spacy +from spacy.vocab import Vocab +from spacy.matcher import Matcher +from spacy.tokens.doc import Doc +from spacy.attrs import * + +import pytest + + +@pytest.fixture +def en_vocab(): + return spacy.get_lang_class('en').Defaults.create_v...
9a6ca54f7cca0bd5f21f0bc590a034e7e3e05b6e
src/icp/apps/user/migrations/0002_add_userprofiles_to_existing_users.py
src/icp/apps/user/migrations/0002_add_userprofiles_to_existing_users.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.contrib.postgres.fields from django.conf import settings def create_user_profiles_for_existing_users(apps, schema_editor): User = apps.get_model('auth', 'User') UserProfile = apps.get_model('...
Add migration to add userprofiles to existing users
Add migration to add userprofiles to existing users All existing users on staging/production will be users of the Pollination Mapper app. Refs #290
Python
apache-2.0
project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.contrib.postgres.fields +from django.conf import settings + +def create_user_profiles_for_existing_users(apps, schema_editor): + User = apps.get_model('auth', 'User'...
1bb1ececfcd548d52a28b713f4ee7eb4e710da85
keras_tf_multigpu/examples/fchollet_inception3_multigpu.py
keras_tf_multigpu/examples/fchollet_inception3_multigpu.py
import tensorflow as tf from keras.applications import InceptionV3 from keras.utils import multi_gpu_model import numpy as np num_samples = 1000 height = 224 width = 224 num_classes = 1000 gpu_count = 2 # Instantiate the base model # (here, we do it on CPU, which is optional). with tf.device('/cpu:0' if gpu_count > ...
Add an example of using fchollet multi_gpu_model on InceptionV3.
Add an example of using fchollet multi_gpu_model on InceptionV3. Adapted from Keras example - parameterized number of GPUs, fixed imports, different model class, fixed device placement for single GPU.
Python
mit
rossumai/keras-multi-gpu,rossumai/keras-multi-gpu
--- +++ @@ -0,0 +1,35 @@ +import tensorflow as tf +from keras.applications import InceptionV3 +from keras.utils import multi_gpu_model +import numpy as np + +num_samples = 1000 +height = 224 +width = 224 +num_classes = 1000 + +gpu_count = 2 + +# Instantiate the base model +# (here, we do it on CPU, which is optional)...
8c7fc2382db0ec9c901f6c2c2b00971f3ee7c3cc
logintokens/tests/test_backends.py
logintokens/tests/test_backends.py
"""logintokens app unittests for backends """ from time import sleep from django.test import TestCase, Client from django.contrib.auth import get_user_model, authenticate from logintokens.tokens import default_token_generator USER = get_user_model() class EmailOnlyAuthenticationBackendTest(TestCase): """Test...
Add tests for custom authentication backend
Add tests for custom authentication backend
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
--- +++ @@ -0,0 +1,60 @@ +"""logintokens app unittests for backends + +""" +from time import sleep + +from django.test import TestCase, Client +from django.contrib.auth import get_user_model, authenticate + +from logintokens.tokens import default_token_generator + + +USER = get_user_model() + + +class EmailOnlyAuthen...
54ca48a2b8cbd53cd6506fdbce47d16f03a28a7d
tests/test_sorting_and_searching/test_bubble_sort.py
tests/test_sorting_and_searching/test_bubble_sort.py
import unittest from aids.sorting_and_searching.bubble_sort import bubble_sort class BubbleSortTestCase(unittest.TestCase): ''' Unit tests for bubble sort ''' def setUp(self): self.example_1 = [2, 5, 4, 3, 1] def test_bubble_sort(self): bubble_sort(self.example_1) self.a...
Add unit tests for bubble sort
Add unit tests for bubble sort
Python
mit
ueg1990/aids
--- +++ @@ -0,0 +1,23 @@ +import unittest + +from aids.sorting_and_searching.bubble_sort import bubble_sort + +class BubbleSortTestCase(unittest.TestCase): + ''' + Unit tests for bubble sort + + ''' + + def setUp(self): + self.example_1 = [2, 5, 4, 3, 1] + + def test_bubble_sort(self): + ...
67596d081059a004e5f7ab15f7972773fdf2f15e
tests/syft/grid/messages/setup_msg_test.py
tests/syft/grid/messages/setup_msg_test.py
# syft absolute import syft as sy from syft.core.io.address import Address from syft.grid.messages.setup_messages import CreateInitialSetUpMessage from syft.grid.messages.setup_messages import CreateInitialSetUpResponse from syft.grid.messages.setup_messages import GetSetUpMessage from syft.grid.messages.setup_messages...
ADD PyGrid SetupService message tests
ADD PyGrid SetupService message tests
Python
apache-2.0
OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft
--- +++ @@ -0,0 +1,106 @@ +# syft absolute +import syft as sy +from syft.core.io.address import Address +from syft.grid.messages.setup_messages import CreateInitialSetUpMessage +from syft.grid.messages.setup_messages import CreateInitialSetUpResponse +from syft.grid.messages.setup_messages import GetSetUpMessage +fro...
478072e8350d03655364ea9147bbe21bafabbcce
geotrek/feedback/tests/test_template_tags.py
geotrek/feedback/tests/test_template_tags.py
from datetime import datetime from django.test import TestCase from geotrek.authent.tests.factories import UserFactory, UserProfileFactory from geotrek.feedback.templatetags.feedback_tags import ( predefined_emails, resolved_intervention_info, status_ids_and_colors) from geotrek.feedback.tests.factories import (P...
Add tests for template tags
Add tests for template tags
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
--- +++ @@ -0,0 +1,55 @@ +from datetime import datetime + +from django.test import TestCase + +from geotrek.authent.tests.factories import UserFactory, UserProfileFactory +from geotrek.feedback.templatetags.feedback_tags import ( + predefined_emails, resolved_intervention_info, status_ids_and_colors) +from geotrek...
8355cb358d14589a194926d37beeb5af7af2a591
falmer/events/migrations/0012_auto_20170905_1208.py
falmer/events/migrations/0012_auto_20170905_1208.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-09-05 11:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0011_auto_20170905_1028'), ] operations = [ migrations.AlterField...
Increase event image url limit from 200
Increase event image url limit from 200
Python
mit
sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-09-05 11:08 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0011_auto_20170905_1028'), + ] + + ope...
a16b4401f37f08d8cb5e1f9ec1b7d4a3221360ab
test/test_regular_extrusion.py
test/test_regular_extrusion.py
# -*- coding: utf-8 -*- """Creates regular cube mesh by extrusion. """ import pygmsh from helpers import compute_volume def test(): x = 5 y = 4 z = 3 x_layers = 10 y_layers = 5 z_layers = 3 geom = pygmsh.built_in.Geometry() p = geom.add_point([0, 0, 0], 1) _, l, _ = geom.extrude(p...
Add test case for regular extrusion
Add test case for regular extrusion
Python
bsd-3-clause
nschloe/python4gmsh
--- +++ @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +"""Creates regular cube mesh by extrusion. +""" +import pygmsh + +from helpers import compute_volume + + +def test(): + x = 5 + y = 4 + z = 3 + x_layers = 10 + y_layers = 5 + z_layers = 3 + geom = pygmsh.built_in.Geometry() + p = geom.add_poin...
7bd6f3e7751deecfc3cd555fc071d722c856802c
chips/compiler/builtins.py
chips/compiler/builtins.py
#!/usr/bin/env python """Support Library for builtin Functionality""" __author__ = "Jon Dawson" __copyright__ = "Copyright (C) 2013, Jonathan P Dawson" __version__ = "0.1" builtins=""" unsigned unsigned_divide_xxxx(unsigned dividend, unsigned divisor){ unsigned denom = divisor; unsigned bit = 1; unsigned...
Implement division using built in library function
Implement division using built in library function
Python
mit
dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0
--- +++ @@ -0,0 +1,80 @@ +#!/usr/bin/env python +"""Support Library for builtin Functionality""" + +__author__ = "Jon Dawson" +__copyright__ = "Copyright (C) 2013, Jonathan P Dawson" +__version__ = "0.1" + +builtins=""" + +unsigned unsigned_divide_xxxx(unsigned dividend, unsigned divisor){ + unsigned denom = divis...
9316bc07c77e2f51332a40bf430cef117f4d89e1
util/check_dockerfile_coverage.py
util/check_dockerfile_coverage.py
import yaml import os import pathlib2 import itertools import argparse import logging import sys TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR") CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util", "parsefiles_config.yml") LOGGER = logging.getLogger(__name__) def check_coverage(containers): # open con...
Add script to check for Dockerfile coverage
Add script to check for Dockerfile coverage
Python
agpl-3.0
rue89-tech/configuration,stvstnfrd/configuration,michaelsteiner19/open-edx-configuration,armaan/edx-configuration,hastexo/edx-configuration,armaan/edx-configuration,stvstnfrd/configuration,gsehub/configuration,stvstnfrd/configuration,hks-epod/configuration,open-craft/configuration,edx/configuration,open-craft/configura...
--- +++ @@ -0,0 +1,64 @@ +import yaml +import os +import pathlib2 +import itertools +import argparse +import logging +import sys + +TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR") +CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util", "parsefiles_config.yml") +LOGGER = logging.getLogger(__name__) + +def ch...
805708048f493ca538a9e0b8d9d40ae1d4baf2c3
keepalive-race/keep-alive-race.py
keepalive-race/keep-alive-race.py
#!/usr/bin/python3 """ This script demonstrates a race condition with HTTP/1.1 keepalive """ import decimal import json import subprocess import time import threading import requests requests.packages.urllib3.disable_warnings() CREDS = json.loads(subprocess.check_output( "openstack --os-cloud devstack token issue...
Add a tool to reproduce HTTP KeepAlive races in OpenStack gate jobs.
Add a tool to reproduce HTTP KeepAlive races in OpenStack gate jobs. Based on https://github.com/mikem23/keepalive-race Change-Id: I11f66bf39c6cc2609ee0dbff97ac7b104767ac2b
Python
apache-2.0
JordanP/openstack-snippets,JordanP/openstack-snippets
--- +++ @@ -0,0 +1,62 @@ +#!/usr/bin/python3 +""" +This script demonstrates a race condition with HTTP/1.1 keepalive +""" +import decimal +import json +import subprocess +import time +import threading + +import requests +requests.packages.urllib3.disable_warnings() + +CREDS = json.loads(subprocess.check_output( + ...
48da7ceb86387d3cb6fd53f50110232813123ecc
tests/pytests/unit/roster/test_ansible.py
tests/pytests/unit/roster/test_ansible.py
import pytest import salt.roster.ansible as ansible from tests.support.mock import patch @pytest.mark.xfail @pytest.mark.parametrize( "which_value", [False, None], ) def test_virtual_returns_False_if_ansible_inventory_doesnt_exist(which_value): with patch("salt.utils.path.which", autospec=True, return_val...
Add tests for ansible roster virtual
Add tests for ansible roster virtual
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,13 @@ +import pytest +import salt.roster.ansible as ansible +from tests.support.mock import patch + + +@pytest.mark.xfail +@pytest.mark.parametrize( + "which_value", + [False, None], +) +def test_virtual_returns_False_if_ansible_inventory_doesnt_exist(which_value): + with patch("salt.utils...
59e546ae5afe22aab967e5376c8799e29ccbd86a
directoryFileContentCmp.py
directoryFileContentCmp.py
#! /usr/env/python import os import hashlib import sys bufsize = 65536 # Path1 = '/Users/kirkchambers/Desktop' # Path2 = '/Users/kirkchambers/DataSets' def generate_file_digests_for(path): path_set = set() for item in os.walk(path): (directory, _subdirectories, files) = item for file in files: if (file[0] ==...
Add the basic version of my file comparison script
Add the basic version of my file comparison script
Python
mit
kirkchambe/random_scripts
--- +++ @@ -0,0 +1,60 @@ +#! /usr/env/python +import os +import hashlib +import sys + +bufsize = 65536 +# Path1 = '/Users/kirkchambers/Desktop' +# Path2 = '/Users/kirkchambers/DataSets' + +def generate_file_digests_for(path): + path_set = set() + for item in os.walk(path): + (directory, _subdirectories, files) = ite...
c3afc6c28530c3dfc3bd57d9a1841a60bf92ba4f
tools/perf/benchmarks/netsim_top25.py
tools/perf/benchmarks/netsim_top25.py
# Copyright 2013 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. from telemetry import test from perf_tools import page_cycler class NetsimTop25(test.Test): """Measures load time of the top 25 sites under simulated cab...
# Copyright 2013 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. from telemetry import test from perf_tools import page_cycler class NetsimTop25(test.Test): """Measures load time of the top 25 sites under simulated cab...
Fix bug which caused page cyclers to always clear cache before load.
[Telemetry] Fix bug which caused page cyclers to always clear cache before load. Previously, the cache clearing bit would apply when the netsim benchmark was imported. This fixes it so that it only applies when it is used. BUG=256492 NOTRY=True TBR=dtu@chromium.org Review URL: https://codereview.chromium.org/1855000...
Python
bsd-3-clause
mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,littlstar/chromium.src,fujunwei/chromium-crosswalk,jaruba/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/ch...
--- +++ @@ -9,7 +9,6 @@ class NetsimTop25(test.Test): """Measures load time of the top 25 sites under simulated cable network.""" test = page_cycler.PageCycler - test.clear_cache_before_each_run = True page_set = 'tools/perf/page_sets/top_25.json' options = { 'extra_wpr_args': [ @@ -18,3 +17,7 @@ ...
fe145fd87db777d9eeb361688d502b1b3ec4b2e1
Transformation.py
Transformation.py
# -*- coding:utf-8 -*- # *************************************************************************** # Transformation.py # ------------------- # update : 2013-11-13 # copyright : (C) 2013 by Michaël Roy # email :...
Add a new Model-View-Projection matrix tool.
Add a new Model-View-Projection matrix tool.
Python
mit
microy/MeshToolkit,microy/PyMeshToolkit,microy/MeshToolkit,microy/PyMeshToolkit
--- +++ @@ -0,0 +1,26 @@ +# -*- coding:utf-8 -*- + +# *************************************************************************** +# Transformation.py +# ------------------- +# update : 2013-11-13 +# copyright : (C) 2013 by Micha...
68dbfedf90fb9e6c922971deaeccad148a258a70
tests/test_dynamic_ecore_extension.py
tests/test_dynamic_ecore_extension.py
import pytest from pyecore.ecore import * import pyecore.ecore as ecore from ordered_set import OrderedSet def test__EModelElement_extension(): A = EClass('A', superclass=(EModelElement.eClass)) a = A() assert a.eAnnotations == OrderedSet() annotation = EAnnotation(source='testAnnot') annotation....
Add tests for PyEcore extension (EClass/EModelElement tests)
Add tests for PyEcore extension (EClass/EModelElement tests)
Python
bsd-3-clause
aranega/pyecore,pyecore/pyecore
--- +++ @@ -0,0 +1,39 @@ +import pytest +from pyecore.ecore import * +import pyecore.ecore as ecore +from ordered_set import OrderedSet + + +def test__EModelElement_extension(): + A = EClass('A', superclass=(EModelElement.eClass)) + a = A() + assert a.eAnnotations == OrderedSet() + + annotation = EAnnotat...
40431228c8535f325b005bb52485cae87a8be714
tests/unit/modules/test_napalm_acl.py
tests/unit/modules/test_napalm_acl.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipIf from tests.support.mock import (...
Add test module for napalm_acl
Add test module for napalm_acl
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` +''' + +# Import Python Libs +from __future__ import absolute_import + +# Import Salt Testing Libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support.unit import TestCase, s...
841fb156fff3d257d39afdc9d3d4e587427fe2cf
Source/Scm/wb_scm_project_place_holder.py
Source/Scm/wb_scm_project_place_holder.py
''' ==================================================================== Copyright (c) 2016 Barry A Scott. All rights reserved. This software is licensed as described in the file LICENSE.txt, which you should have received as part of this distribution. ===========================================================...
Add new file missed in earlier commit place holder for projects that do not load for some reason
Add new file missed in earlier commit place holder for projects that do not load for some reason
Python
apache-2.0
barry-scott/git-workbench,barry-scott/scm-workbench,barry-scott/scm-workbench,barry-scott/git-workbench,barry-scott/scm-workbench
--- +++ @@ -0,0 +1,75 @@ +''' + ==================================================================== + Copyright (c) 2016 Barry A Scott. All rights reserved. + + This software is licensed as described in the file LICENSE.txt, + which you should have received as part of this distribution. + + ========================...
5114f177741b105f33819b98415702e53b52eb01
corehq/apps/hqadmin/management/commands/update_site_setup.py
corehq/apps/hqadmin/management/commands/update_site_setup.py
from django.core.management.base import BaseCommand, CommandError from django.contrib.sites.models import Site from django.conf import settings class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'site_address', help="the new site address that should b...
Add script to update site setup which is used at places like password reset email
Add script to update site setup which is used at places like password reset email [skip ci]
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,52 @@ +from django.core.management.base import BaseCommand, CommandError +from django.contrib.sites.models import Site +from django.conf import settings + + +class Command(BaseCommand): + def add_arguments(self, parser): + parser.add_argument( + 'site_address', + hel...
8b4c34e84d306b5f9021de47bc3ae9050e2fc2b3
compare_clouds.py
compare_clouds.py
#!/usr/bin/env python3 from pathlib import Path """Code for comparing point clouds""" cloud1Path = Path("./data/reconstructions/2016_10_24__17_43_17/reference.ply") cloud2Path = Path("./data/reconstructions/2016_10_24__17_43_17/high_quality.ply") from load_ply import load_ply cloud1PointData = load_ply(cloud1Path)...
Fix loading of ply files exported by meshlab
Fix loading of ply files exported by meshlab
Python
mit
drewm1980/multi_view_stereo_benchmark,drewm1980/multi_view_stereo_benchmark,drewm1980/multi_view_stereo_benchmark
--- +++ @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +from pathlib import Path + +"""Code for comparing point clouds""" + +cloud1Path = Path("./data/reconstructions/2016_10_24__17_43_17/reference.ply") +cloud2Path = Path("./data/reconstructions/2016_10_24__17_43_17/high_quality.ply") + +from load_ply import load_ply + ...
0bf7d9fb20a3d2588ffc0e8341ec2af3df5fe300
depot/tests/test_depot_index.py
depot/tests/test_depot_index.py
from django.test import TestCase, Client from depot.models import Depot def create_depot(name, state): return Depot.objects.create(name=name, active=state) class DepotIndexTestCase(TestCase): def test_depot_index_template(self): response = self.client.get('/depots/') self.assertTemplateUsed...
Add test for depot index page
Add test for depot index page
Python
agpl-3.0
verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool
--- +++ @@ -0,0 +1,50 @@ +from django.test import TestCase, Client +from depot.models import Depot + + +def create_depot(name, state): + return Depot.objects.create(name=name, active=state) + + +class DepotIndexTestCase(TestCase): + + def test_depot_index_template(self): + response = self.client.get('/de...
cc79ee252e09ade17961d03265c61a87e270bd88
nototools/map_pua_emoji.py
nototools/map_pua_emoji.py
#!/usr/bin/python # # Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
Make color emoji use character sequences instead of PUA.
Make color emoji use character sequences instead of PUA. The bitmap emoji tools are extended to create GSUB rules for character sequences. The images are renamed to code the character sequence in their filenames. New images are created for ASCII digits and number sign. A new script is added to add cmaps to the file...
Python
apache-2.0
davelab6/nototools,anthrotype/nototools,pathumego/nototools,googlei18n/nototools,davelab6/nototools,pahans/nototools,moyogo/nototools,googlefonts/nototools,namemealrady/nototools,googlei18n/nototools,moyogo/nototools,dougfelt/nototools,googlefonts/nototools,pahans/nototools,googlei18n/nototools,googlefonts/nototools,da...
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/python +# +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/license...
3adcefcad4fc3ecb85aa4a22e8b3c4bf5ca4e6f5
test/integration/ggrc/converters/test_import_update.py
test/integration/ggrc/converters/test_import_update.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from integration.ggrc.converters import TestCase from ggrc import models class TestImportUpdates(TestCase): """ Test importing of already existing objects """ def setUp(self): TestCase.setUp(sel...
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Tests for bulk updates with CSV import.""" from integration.ggrc.converters import TestCase from ggrc import models class TestImportUpdates(TestCase): """ Test importing of already existing objects...
Add tests for revision updates via import
Add tests for revision updates via import This tests checks if new revisions were added for object updated via CSV import.
Python
apache-2.0
edofic/ggrc-core,selahssea/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,AleksNeStu/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,edofic/ggrc-core,jo...
--- +++ @@ -1,5 +1,7 @@ # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> + +"""Tests for bulk updates with CSV import.""" from integration.ggrc.converters import TestCase @@ -24,6 +26,11 @@ policy = models.Policy.query.filter_by(slug="p1").f...
e48caa4bb61cce466ad5eb9bffbfba8e33312474
python/example_code/ec2/terminate_instances.py
python/example_code/ec2/terminate_instances.py
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[terminate_instances.py demonstrates how to terminate an Amazon EC2 instance.] # snippet-service:[ec2] # snippet-keyword:[Amazon EC2] # snippet-keyword:[Python] # snippet-keyword:[AWS SDK for Python (Bot...
Add Python EC2 TerminateInstances example
Add Python EC2 TerminateInstances example Merge pull request #504 from awsdocs/scalwas_ec2
Python
apache-2.0
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a...
--- +++ @@ -0,0 +1,71 @@ +# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] +# snippet-sourcedescription:[terminate_instances.py demonstrates how to terminate an Amazon EC2 instance.] +# snippet-service:[ec2] +# snippet-keyword:[Amazon EC2] +# snippet-keyword:[Python] +# snippet...
58fee826ab5298f7de036bf320bbc109b853eec8
tendrl/commons/manager/__init__.py
tendrl/commons/manager/__init__.py
import abc import logging import six from tendrl.commons import jobs LOG = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Manager(object): def __init__( self, sds_sync_thread, central_store_thread, ): self._central_store_thread = central_store_...
import abc import logging import six from tendrl.commons import jobs LOG = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Manager(object): def __init__( self, sds_sync_thread, central_store_thread, ): self._central_store_thread = central_store_...
Add null check for sds sync thread which can be optional
Add null check for sds sync thread which can be optional Signed-off-by: anmolbabu <3d38fb1e9c5ff2662fc415254efcdfedb95b84d5@gmail.com>
Python
lgpl-2.1
Tendrl/commons,rishubhjain/commons,r0h4n/commons
--- +++ @@ -23,19 +23,21 @@ def stop(self): LOG.info("%s stopping" % self.__class__.__name__) self._job_consumer_thread.stop() - self._sds_sync_thread.stop() + if self._sds_sync_thread: + self._sds_sync_thread.stop() self._central_store_thread.stop() def...
e5a39d4e17a0555cb242731b34f0ee480367b4fe
foireminder/foireminder/reminders/tasks.py
foireminder/foireminder/reminders/tasks.py
from django.utils import timezone from .models import ReminderRequest, EmailReminder def send_todays_notifications(self): today = timezone.now() reminders = ReminderRequest.objects.filter( start__year=today.year, start__month=today.month, start__day=today.da ) for reminder in ...
Add task that sends out notifications
Add task that sends out notifications
Python
mit
stefanw/foireminder,stefanw/foireminder
--- +++ @@ -0,0 +1,15 @@ +from django.utils import timezone + +from .models import ReminderRequest, EmailReminder + + +def send_todays_notifications(self): + today = timezone.now() + reminders = ReminderRequest.objects.filter( + start__year=today.year, + start__month=today.month, + start__d...
c58c58d5bf1394e04e30f5eeb298818558be027f
tests/rules_tests/clearAfterNonTermRemove/__init__.py
tests/rules_tests/clearAfterNonTermRemove/__init__.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 17.08.2017 22:06 :Licence GNUv3 Part of grammpy """
Add directory for tests of rules removin
Add directory for tests of rules removin
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,8 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 17.08.2017 22:06 +:Licence GNUv3 +Part of grammpy + +"""
d40fb122d7083b9735728df15120ed682431be79
scripts/make_fhes_seeds.py
scripts/make_fhes_seeds.py
import yaml import sys import numpy as np from astropy.table import Table from astropy.coordinates import SkyCoord from fermipy.catalog import * from fermipy.utils import * def get_coord(name,tab): row = tab[tab['Source_Name'] == name] return SkyCoord(float(row['RAJ2000']), float(row['DEJ2000']),unit='deg') ...
Create script for generating analysis seeds.
Create script for generating analysis seeds.
Python
bsd-3-clause
woodmd/haloanalysis,woodmd/haloanalysis
--- +++ @@ -0,0 +1,72 @@ +import yaml +import sys +import numpy as np +from astropy.table import Table +from astropy.coordinates import SkyCoord +from fermipy.catalog import * +from fermipy.utils import * + + +def get_coord(name,tab): + + row = tab[tab['Source_Name'] == name] + return SkyCoord(float(row['RAJ200...
d1ee86414d45c571571d75434b8c2256b0120732
py/binary-tree-tilt.py
py/binary-tree-tilt.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTilt(self, root): """ :type root: TreeNode :rtype: int """ return self.do...
Add py solution for 563. Binary Tree Tilt
Add py solution for 563. Binary Tree Tilt 563. Binary Tree Tilt: https://leetcode.com/problems/binary-tree-tilt/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,22 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def findTilt(self, root): + """ + :type root: TreeNode + :rtype:...
925ff38344b5058ce196877e1fdcf79a1d1f6719
ue4/tests/test_messaging.py
ue4/tests/test_messaging.py
import pytest from m2u.ue4 import connection def test_send_message_size(): """Send a big message, larger than buffer size, so the server has to read multiple chunks. """ message = "TestMessageSize " + ("abcdefg" * 5000) connection.connect() result = connection.send_message(message) asser...
Add basic test for checking messages are received correctly
Add basic test for checking messages are received correctly
Python
mit
m2u/m2u
--- +++ @@ -0,0 +1,15 @@ +import pytest + +from m2u.ue4 import connection + + +def test_send_message_size(): + """Send a big message, larger than buffer size, so the server has to + read multiple chunks. + + """ + message = "TestMessageSize " + ("abcdefg" * 5000) + connection.connect() + result = co...
ff700e5d6fc5e0c5062f687110563d7f0312a3f0
server/tests/test_admin.py
server/tests/test_admin.py
"""General functional tests for the API endpoints.""" from django.test import TestCase, Client # from django.urls import reverse from rest_framework import status from server.models import ApiKey, User # from api.v2.tests.tools import SalAPITestCase class AdminTest(TestCase): """Test the admin site is configu...
Set up test suite to ensure server admin routes are added.
Set up test suite to ensure server admin routes are added.
Python
apache-2.0
sheagcraig/sal,salopensource/sal,salopensource/sal,sheagcraig/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal
--- +++ @@ -0,0 +1,61 @@ +"""General functional tests for the API endpoints.""" + + +from django.test import TestCase, Client +# from django.urls import reverse + +from rest_framework import status + +from server.models import ApiKey, User +# from api.v2.tests.tools import SalAPITestCase + + +class AdminTest(TestCase...
0c29b431a0f5ce9115d7acdcaaabbd27546949c6
chmvh_website/contact/tests/views/test_success_view.py
chmvh_website/contact/tests/views/test_success_view.py
from django.test import RequestFactory from django.urls import reverse from contact.views import SuccessView class TestSuccessView(object): """Test cases for the success view""" url = reverse('contact:success') def test_get(self, rf: RequestFactory): """Test sending a GET request to the view. ...
Add test for contact success view.
Add test for contact success view.
Python
mit
cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website
--- +++ @@ -0,0 +1,21 @@ +from django.test import RequestFactory +from django.urls import reverse + +from contact.views import SuccessView + + +class TestSuccessView(object): + """Test cases for the success view""" + url = reverse('contact:success') + + def test_get(self, rf: RequestFactory): + """Tes...
c650d64247d63d2af7a8168795e7edae5c9ef6ef
realtime-plot.py
realtime-plot.py
import time, random import math from collections import deque start = time.time() class RealtimePlot: def __init__(self, axes, max_entries = 100): self.axis_x = deque(maxlen=max_entries) self.axis_y = deque(maxlen=max_entries) self.axes = axes self.max_entries = max_entries ...
Add realtime chart plotting example
Add realtime chart plotting example
Python
mit
voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts
--- +++ @@ -0,0 +1,46 @@ +import time, random +import math +from collections import deque + +start = time.time() + +class RealtimePlot: + def __init__(self, axes, max_entries = 100): + self.axis_x = deque(maxlen=max_entries) + self.axis_y = deque(maxlen=max_entries) + self.axes = axes + ...
f7e4ca11c7bfc35bf0fd6becd2a5d5fdd2ca5ed5
src/main/python/partition_data.py
src/main/python/partition_data.py
import csv; import random; import sys; in_file = str(sys.argv[1]) out_file = str(sys.argv[2]) num_partitions = int(sys.argv[3]) header = []; partitions = []; for i in range(num_partitions): partitions.append([]) # Load all the training rows row_num = 0; with open(in_file) as file: reader = csv.reader(file); ...
Add a script to split data with partitions.
Add a script to split data with partitions.
Python
mit
juckele/ddr-grader,juckele/ddr-grader
--- +++ @@ -0,0 +1,42 @@ +import csv; +import random; +import sys; + +in_file = str(sys.argv[1]) +out_file = str(sys.argv[2]) +num_partitions = int(sys.argv[3]) + +header = []; +partitions = []; +for i in range(num_partitions): + partitions.append([]) + +# Load all the training rows +row_num = 0; +with open(in_fil...
645507ed9ec43b354880673fbc75afe169ef6697
tests/unit/test_handlers.py
tests/unit/test_handlers.py
from pmxbot import core def test_contains_always_match(): """ Contains handler should always match if no rate is specified. """ handler = core.ContainsHandler(name='#', func=None) assert handler.match('Tell me about #foo', channel='bar')
Add test capturing bad implementation of contains handler.
Add test capturing bad implementation of contains handler.
Python
bsd-3-clause
jawilson/pmxbot,jawilson/pmxbot
--- +++ @@ -0,0 +1,8 @@ +from pmxbot import core + +def test_contains_always_match(): + """ + Contains handler should always match if no rate is specified. + """ + handler = core.ContainsHandler(name='#', func=None) + assert handler.match('Tell me about #foo', channel='bar')
b3e9075e819402f93f7dc2e29b61e3e621ab7355
impy/imputations/tests/test_averaging_imputations.py
impy/imputations/tests/test_averaging_imputations.py
"""test_averaging_imputations.py""" import unittest import numpy as np from impy.imputations import mean_imputation from impy.imputations import mode_imputation from impy.imputations import median_imputation from impy.datasets import random_int class TestAveraging(unittest.TestCase): """ Tests for Averaging """ ...
Add unit tests for avging imputations
Add unit tests for avging imputations
Python
mit
eltonlaw/impyute
--- +++ @@ -0,0 +1,47 @@ +"""test_averaging_imputations.py""" +import unittest +import numpy as np +from impy.imputations import mean_imputation +from impy.imputations import mode_imputation +from impy.imputations import median_imputation +from impy.datasets import random_int + + +class TestAveraging(unittest.TestCas...
17ae9e25663d029af11236584b4c759c895ae830
util/fileIngredients.py
util/fileIngredients.py
#!/usr/bin/env python # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import with_statement import re def fileContains(f, s, isRegex): if isRege...
Improve and consolidate condition scripts of Lithium to support timeouts and regex via optparse. r=Jesse
Improve and consolidate condition scripts of Lithium to support timeouts and regex via optparse. r=Jesse
Python
mpl-2.0
nth10sd/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz
--- +++ @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +from __future__ import with_statement + +import re + +def file...
05aa314ac9b5d38bb7a30e30aced9b27b2797888
python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py
python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py
# Add taintlib to PATH so it can be imported during runtime without any hassle import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__)))) from taintlib import * # This has no runtime impact, but allows autocomplete to work from typing import TYPE_CHECKING if TYPE_CHECKING: from ..taintlib...
Add tests for non-async constructs
Python: Add tests for non-async constructs
Python
mit
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
--- +++ @@ -0,0 +1,45 @@ +# Add taintlib to PATH so it can be imported during runtime without any hassle +import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__)))) +from taintlib import * + +# This has no runtime impact, but allows autocomplete to work +from typing import TYPE_CHECKING +if ...
c1fcf54b63de95c85a9505d83062d8b320b1cbdf
python/example_code/cloudfront/update_distribution_certificate.py
python/example_code/cloudfront/update_distribution_certificate.py
# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file ac...
Add python cloudfront update_distribution example to replace ACM Certificate
Add python cloudfront update_distribution example to replace ACM Certificate Add python cloudfront update_distribution example to replace ACM Certificate
Python
apache-2.0
awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a...
--- +++ @@ -0,0 +1,59 @@ +# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2....
75a882bf38c88d73e38d13fbb8b1499ff4ae4ea6
scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py
scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py
import sys import logging import django from django.db import transaction django.setup() from osf.models import OSFUser logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) def main(): dry_run = '--dry' in sys.argv with transaction.atomic(): users = OSFUser.objects.filter(ful...
Add migration for changing users added by OSF for meetings with emails for fullnames to their guid
Add migration for changing users added by OSF for meetings with emails for fullnames to their guid
Python
apache-2.0
felliott/osf.io,adlius/osf.io,felliott/osf.io,adlius/osf.io,saradbowman/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,adlius/osf.io,felliott/osf.io,mattclark/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,pattisdr/osf.io,brianjgeiger/...
--- +++ @@ -0,0 +1,24 @@ +import sys +import logging + +import django +from django.db import transaction +django.setup() + +from osf.models import OSFUser + +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.INFO) + +def main(): + dry_run = '--dry' in sys.argv + with transaction.atomic(): ...
a6b35a9a94b2e4b32c2236258812b44e81184515
corehq/apps/users/management/commands/fix_location_user_data.py
corehq/apps/users/management/commands/fix_location_user_data.py
from corehq.apps.locations.models import Location from corehq.apps.users.models import CommCareUser from dimagi.utils.couch.database import iter_docs from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): args = "domain" help = "Fix location user data for mobile workers....
Add management command for resyncing mobile worker location user data
Add management command for resyncing mobile worker location user data
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
--- +++ @@ -0,0 +1,31 @@ +from corehq.apps.locations.models import Location +from corehq.apps.users.models import CommCareUser +from dimagi.utils.couch.database import iter_docs +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + args = "domain" + help = "Fix lo...
415717bddb00ca650bef61a5c6054a7b47575b56
jaspyx/tests/visitor/test_break.py
jaspyx/tests/visitor/test_break.py
import ast from jaspyx.ast_util import ast_store, ast_load from jaspyx.tests.visitor.v8_helper import V8Helper class TestBreak(V8Helper): def test_break(self): assert self.run( [ ast.Assign( [ast_store('i')], ast.Num(0), )...
Implement unit test for break.
Implement unit test for break.
Python
mit
iksteen/jaspyx,ztane/jaspyx
--- +++ @@ -0,0 +1,28 @@ +import ast +from jaspyx.ast_util import ast_store, ast_load +from jaspyx.tests.visitor.v8_helper import V8Helper + + +class TestBreak(V8Helper): + def test_break(self): + assert self.run( + [ + ast.Assign( + [ast_store('i')], + ...
495da73f305a2a0e79a28d251b5b93caea06656d
mediagenerator/filters/uglifier.py
mediagenerator/filters/uglifier.py
from django.conf import settings from django.utils.encoding import smart_str from mediagenerator.generators.bundles.base import Filter class Uglifier(Filter): def __init__(self, **kwargs): super(Uglifier, self).__init__(**kwargs) assert self.filetype == 'js', ( 'Uglifier only supports c...
Add UglifyJS as a filter.
Add UglifyJS as a filter.
Python
bsd-3-clause
Carlangueitor/django-mediagenerator,adieu/django-mediagenerator,Carlangueitor/django-mediagenerator,adieu/django-mediagenerator
--- +++ @@ -0,0 +1,33 @@ +from django.conf import settings +from django.utils.encoding import smart_str +from mediagenerator.generators.bundles.base import Filter + +class Uglifier(Filter): + def __init__(self, **kwargs): + super(Uglifier, self).__init__(**kwargs) + assert self.filetype == 'js', ( + ...
96ed06f1f3dab3aa9d0f8150c41a5c1b943a86b0
frappe/tests/test_config.py
frappe/tests/test_config.py
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE import unittest import frappe from frappe.config import get_modules_from_all_apps_for_user class TestConfig(unittest.TestCase): def test_get_modules(self): frappe_modules = frappe.get_all("Module Def", filters={"app_n...
Add test for config module
test: Add test for config module
Python
mit
StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe
--- +++ @@ -0,0 +1,17 @@ +# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors +# License: MIT. See LICENSE +import unittest + +import frappe +from frappe.config import get_modules_from_all_apps_for_user + + +class TestConfig(unittest.TestCase): + def test_get_modules(self): + frappe_modules = frappe...
f1ccab2168dea1b0827f4ca929f0036e84170a76
go/base/tests/test_views.py
go/base/tests/test_views.py
"""Test for go.base.utils.""" from mock import patch, Mock from django.core.urlresolvers import reverse from go.base.tests.utils import VumiGoDjangoTestCase class BaseViewsTestCase(VumiGoDjangoTestCase): def cross_domain_xhr(self, url): return self.client.post(reverse('cross_domain_xhr'), {'url': url}) ...
Add tests for cross domain xhr view
Add tests for cross domain xhr view
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
--- +++ @@ -0,0 +1,48 @@ +"""Test for go.base.utils.""" + +from mock import patch, Mock +from django.core.urlresolvers import reverse + +from go.base.tests.utils import VumiGoDjangoTestCase + + +class BaseViewsTestCase(VumiGoDjangoTestCase): + def cross_domain_xhr(self, url): + return self.client.post(rever...
5578d11f45e9c41ab9c4311f2bed48b9c24d9bf5
tests/grammar_term-nonterm_test/NonterminalHaveTest.py
tests/grammar_term-nonterm_test/NonterminalHaveTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """
Create file for Nonterminal have method
Create file for Nonterminal have method
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,8 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +"""
913c9a10b2eb3b3d9de108a82a3251b2c0de0e10
cybox/test/objects/hostname_test.py
cybox/test/objects/hostname_test.py
# Copyright (c) 2014, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import unittest from cybox.objects.hostname_object import Hostname from cybox.test.objects import ObjectTestCase class TestHostname(ObjectTestCase, unittest.TestCase): object_type = "HostnameObjectType" k...
Add test for Hostname object
Add test for Hostname object
Python
bsd-3-clause
CybOXProject/python-cybox
--- +++ @@ -0,0 +1,22 @@ +# Copyright (c) 2014, The MITRE Corporation. All rights reserved. +# See LICENSE.txt for complete terms. + +import unittest + +from cybox.objects.hostname_object import Hostname +from cybox.test.objects import ObjectTestCase + + +class TestHostname(ObjectTestCase, unittest.TestCase): + ob...
514aca20c6f076a86819d7180f36c3b2e8bcc33b
tests/integration_tests/test_tensorflow_integration.py
tests/integration_tests/test_tensorflow_integration.py
from __future__ import print_function import os import tempfile import pytest import keras from keras import layers from keras.utils.test_utils import get_test_data from keras.utils.test_utils import keras_test @pytest.mark.skipif(keras.backend.backend() != 'tensorflow', reason='Requires TF backend') @keras_test def...
Add integration test checking compatibility of Keras models with TF optimizers.
Add integration test checking compatibility of Keras models with TF optimizers.
Python
apache-2.0
keras-team/keras,keras-team/keras
--- +++ @@ -0,0 +1,51 @@ +from __future__ import print_function + +import os +import tempfile +import pytest +import keras +from keras import layers +from keras.utils.test_utils import get_test_data +from keras.utils.test_utils import keras_test + + +@pytest.mark.skipif(keras.backend.backend() != 'tensorflow', reason...
24d742e444c84df99629d8a6aff7ca7e6c90f995
scheduler/misc/detect_stuck_active_invs.py
scheduler/misc/detect_stuck_active_invs.py
#!/usr/bin/env python # Copyright 2018 The LUCI 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 ...
Add adhoc script to detect jobs with stuck ActiveInvocations list.
[scheduler] Add adhoc script to detect jobs with stuck ActiveInvocations list. R=a30c74fa30536fe7ea81ed6dec202e35e149e1fd@chromium.org BUG=852142 Change-Id: Idae7f05c5045a72ff85db8587f8bd74c0b80fb06 Reviewed-on: https://chromium-review.googlesource.com/1098463 Reviewed-by: Andrii Shyshkalov <a30c74fa30536fe7ea81ed6de...
Python
apache-2.0
luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go
--- +++ @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# Copyright 2018 The LUCI 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...
cf78037980a9345c12b1e2562bc4eda63cea95b3
test/functionalities/backticks/TestBackticksWithoutATarget.py
test/functionalities/backticks/TestBackticksWithoutATarget.py
""" Test that backticks without a target should work (not infinite looping). """ import os, time import unittest2 import lldb from lldbtest import * class BackticksWithNoTargetTestCase(TestBase): mydir = "functionalities/backticks" def test_backticks_no_target(self): """A simple test of backticks wi...
Add a simple regression test to go with r143260. CommandInterpreter::PreprocessCommand() should not infinite loop when a target has not been specified yet.
Add a simple regression test to go with r143260. CommandInterpreter::PreprocessCommand() should not infinite loop when a target has not been specified yet. git-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@143274 91177308-0d34-0410-b5e6-96231b3b80d8
Python
apache-2.0
apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb
--- +++ @@ -0,0 +1,23 @@ +""" +Test that backticks without a target should work (not infinite looping). +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class BackticksWithNoTargetTestCase(TestBase): + + mydir = "functionalities/backticks" + + def test_backticks_no_target(self):...
ff2fb40e961fe7b0c3f6dd6e91d8fb79a865a631
src/ggrc_basic_permissions/migrations/versions/20131108224846_37b63b122038_hide_the_auditorread.py
src/ggrc_basic_permissions/migrations/versions/20131108224846_37b63b122038_hide_the_auditorread.py
"""Hide the AuditorReader role by changing its scope. Revision ID: 37b63b122038 Revises: 1ff082d26157 Create Date: 2013-11-08 22:48:46.956836 """ # revision identifiers, used by Alembic. revision = '37b63b122038' down_revision = '1ff082d26157' import sqlalchemy as sa from alembic import op from datetime import dat...
Hide the AuditorReader role in the system role assignment modal by placing it in an "implied" scope.
Hide the AuditorReader role in the system role assignment modal by placing it in an "implied" scope.
Python
apache-2.0
josthkko/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,kr41/ggrc-core,vladan-m/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,hasanalom/ggrc-core,hasanalom/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,andrei-karalio...
--- +++ @@ -0,0 +1,43 @@ + +"""Hide the AuditorReader role by changing its scope. + +Revision ID: 37b63b122038 +Revises: 1ff082d26157 +Create Date: 2013-11-08 22:48:46.956836 + +""" + +# revision identifiers, used by Alembic. +revision = '37b63b122038' +down_revision = '1ff082d26157' + +import sqlalchemy as sa +from ...
6e535a2d597f172d9342fb8a547335890c474b49
src/config-sample.py
src/config-sample.py
FLASK_SECRET_KEY = 'Enter a Flask Secret Key' # OAuth Credentials. You can find them on # https://www.yelp.com/developers/v3/manage_app YELP_CLIENT_ID = 'Enter Yelp Client ID' YELP_CLIENT_SECRET = 'Enter Yelp Client Secret'
Add a sample config file
Add a sample config file
Python
mit
byanofsky/playa-vista-neighborhood,byanofsky/playa-vista-neighborhood,byanofsky/playa-vista-neighborhood
--- +++ @@ -0,0 +1,6 @@ +FLASK_SECRET_KEY = 'Enter a Flask Secret Key' + +# OAuth Credentials. You can find them on +# https://www.yelp.com/developers/v3/manage_app +YELP_CLIENT_ID = 'Enter Yelp Client ID' +YELP_CLIENT_SECRET = 'Enter Yelp Client Secret'
22298d91fff788c37395cdad9245b3e7ed20cfdf
python/opencv/opencv_2/images/display_image_with_matplotlib.py
python/opencv/opencv_2/images/display_image_with_matplotlib.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) """ OpenCV - Display image: display an image given in arguments Required: opencv library (Debian: aptitude install python-opencv) See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/...
Add a snippet (Python OpenCV).
Add a snippet (Python OpenCV).
Python
mit
jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) + +""" +OpenCV - Display image: display an image given in arguments + +Required: opencv library (Debian: aptitude install python-opencv) + +See: https://opencv-python-tutroals.readthed...
ba9e4c6b003cc002e5bc7216da960e47f9fe5424
copper_imidazole_csv_allnitrogen.py
copper_imidazole_csv_allnitrogen.py
#!/usr/bin/env python2 import orca_parser from copper_imidazole_analysis import CopperImidazoleAnalysis import argparse import csv cia = CopperImidazoleAnalysis() parser = argparse.ArgumentParser(description="Given pathnames of ORCA output files, make a dump of all nitrogen parameters to a CSV file.") parser.add_ar...
Print information about all nitrogens.
Print information about all nitrogens.
Python
mpl-2.0
berquist/orcaparse
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python2 + +import orca_parser +from copper_imidazole_analysis import CopperImidazoleAnalysis +import argparse +import csv + +cia = CopperImidazoleAnalysis() + +parser = argparse.ArgumentParser(description="Given pathnames of ORCA output files, make a dump of all nitrogen param...
eb0772fc6c30d98b83bf1c8e7d83af21066ae45b
data_structures/Stack/Python/Stack.py
data_structures/Stack/Python/Stack.py
# Author: AlexBanks97 # Purpose: LIFO Stack implementation using python array. # Date: October 15th 2017 class Stack(object): def __init__(self): # Initialize stack as empty array self.stack = [] # Return and remove the last element of the stack array. def pop(self): # If the stack...
# Author: AlexBanks97 # Purpose: LIFO Stack implementation using python array. # Date: October 15th 2017 class Stack(object): def __init__(self): # Initialize stack as empty array self.stack = [] # Return and remove the last element of the stack array. def pop(self): # If the stack...
Add peek method and implementation
Add peek method and implementation
Python
cc0-1.0
Deepak345/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-r...
--- +++ @@ -16,3 +16,7 @@ # Add an element to the end of the stack array. def push(self, element): self.stack.append(element) + + # Return the last element of the stack array (without removing it). + def peek(self): + return self.stack[-1]
825c4d613915d43aea2e6ee0bc5d5b49ed0a4500
emission/analysis/classification/segmentation/section_segmentation.py
emission/analysis/classification/segmentation/section_segmentation.py
# Standard imports import attrdict as ad import numpy as np import datetime as pydt # Our imports import emission.analysis.classification.cleaning.location_smoothing as ls import emission.analysis.point_features as pf import emission.storage.decorations.location_queries as lq def segment_into_sections(trip): poin...
Create a simple method to segment a trip into sections
Create a simple method to segment a trip into sections This is purely based on the activity detection by android. It assumes that we have all activity updates. It uses a fairly naive algorithm with a threshold of 60% confidence, ignoring STILL, TILTING and UNKNOWN movements, and segmenting every time the mode changes...
Python
bsd-3-clause
shankari/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mis...
--- +++ @@ -0,0 +1,55 @@ +# Standard imports +import attrdict as ad +import numpy as np +import datetime as pydt + +# Our imports +import emission.analysis.classification.cleaning.location_smoothing as ls +import emission.analysis.point_features as pf +import emission.storage.decorations.location_queries as lq + +def...
5f2cd26054adff5a1fbf9ba5d56766b972f46670
leakcheck/thread-key-gen.py
leakcheck/thread-key-gen.py
# Copyright (C) Jean-Paul Calderone # See LICENSE for details. # # Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and # older held the GIL during these operations. Subsequent versions release it # during them. from threading import Thread from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, PKe...
Add a multithreaded stress tester for key generation. Hopefully provides additional confidence that that code is correct with respect to threading.
Add a multithreaded stress tester for key generation. Hopefully provides additional confidence that that code is correct with respect to threading.
Python
apache-2.0
mhils/pyopenssl,kediacorporation/pyopenssl,reaperhulk/pyopenssl,r0ro/pyopenssl,mhils/pyopenssl,daodaoliang/pyopenssl,elitest/pyopenssl,kjav/pyopenssl,kediacorporation/pyopenssl,alex/pyopenssl,lvh/pyopenssl,samv/pyopenssl,Lukasa/pyopenssl,mitghi/pyopenssl,msabramo/pyOpenSSL,reaperhulk/pyopenssl,hynek/pyopenssl,pyca/pyop...
--- +++ @@ -0,0 +1,38 @@ +# Copyright (C) Jean-Paul Calderone +# See LICENSE for details. +# +# Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and +# older held the GIL during these operations. Subsequent versions release it +# during them. + +from threading import Thread + +from OpenSSL....
4820013e207947fe7ff94777cd8dcf1ed474eab1
migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py
migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py
"""Add account lockout fields to User Revision ID: fb6a6554b21 Revises: 1f9b411bf6df Create Date: 2015-10-29 01:07:27.930095 """ # revision identifiers, used by Alembic. revision = 'fb6a6554b21' down_revision = '1f9b411bf6df' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto gene...
Add migration for account lockout fields on User
Add migration for account lockout fields on User
Python
mit
richgieg/flask-now,richgieg/flask-now
--- +++ @@ -0,0 +1,30 @@ +"""Add account lockout fields to User + +Revision ID: fb6a6554b21 +Revises: 1f9b411bf6df +Create Date: 2015-10-29 01:07:27.930095 + +""" + +# revision identifiers, used by Alembic. +revision = 'fb6a6554b21' +down_revision = '1f9b411bf6df' + +from alembic import op +import sqlalchemy as sa + ...
6fabbe85bb74788641897daf8b162eac3d47b0aa
data_crunching/indonesia_timeseries/download_indonesia_prices.py
data_crunching/indonesia_timeseries/download_indonesia_prices.py
#!/usr/bin/env python2 import urllib2 import shutil import re import sys import datetime from lxml import etree usage_str = """ This scripts downloads daily food prices from http://m.pip.kementan.org/index.php (Indonesia). Provide date in DD/MM/YYYY format. Example: ./download_indonesia_prices.py 15/03/2013 ""...
Add script for downloading Indonesia price data
Add script for downloading Indonesia price data (http://m.pip.kementan.org/index.php)
Python
bsd-3-clause
FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas
--- +++ @@ -0,0 +1,78 @@ +#!/usr/bin/env python2 + +import urllib2 +import shutil +import re +import sys +import datetime +from lxml import etree + +usage_str = """ +This scripts downloads daily food prices from http://m.pip.kementan.org/index.php (Indonesia). + +Provide date in DD/MM/YYYY format. + +Example: + + ...
a795d94a9c885b97ab5bffc313524ae46626d556
tools/analyze_code_size.py
tools/analyze_code_size.py
import os import re import sys import optparse MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS" MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS" FUNCTION_CODE_RE = re.compile( r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))" ) def analyze_code_size(fileobj, opts): funcs = {} name_re = Non...
Add simple function-size analysis tool.
Add simple function-size analysis tool.
Python
mit
pypyjs/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,albertjan/pypyjs,pombredanne/pypyjs,albertjan/pypyjs,perkinslr/pypyjs,pombredanne/pypyjs,pypyjs/pypyjs,trinketapp/pypyjs,pypyjs/pypyjs,pypyjs/pypyjs,perkinslr/pypyjs,trinketapp/pypyjs,albertjan/pypyjs
--- +++ @@ -0,0 +1,76 @@ + +import os +import re +import sys +import optparse + +MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS" +MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS" + +FUNCTION_CODE_RE = re.compile( + r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))" +) + + +def analyze_code_size(fileob...
bfaeeec3f5f5582822e2918491090815a606ba44
test/test_api.py
test/test_api.py
# -*- coding: utf-8 -*- import warthog.api def test_public_exports(): exports = set([item for item in dir(warthog.api) if not item.startswith('_')]) declared = set(warthog.api.__all__) assert exports == declared, 'Exports and __all__ members should match'
Add test to make sure imports and __all__ matches
Add test to make sure imports and __all__ matches
Python
mit
smarter-travel-media/warthog
--- +++ @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +import warthog.api + + +def test_public_exports(): + exports = set([item for item in dir(warthog.api) if not item.startswith('_')]) + declared = set(warthog.api.__all__) + assert exports == declared, 'Exports and __all__ members should match'
48857638694ceca08c64d7b9c6825e2178c53279
pylearn2/utils/doc.py
pylearn2/utils/doc.py
""" Documentation-related helper classes/functions """ class soft_wraps: """ A Python decorator which concatenates two functions' docstrings: one function is defined at initialization and the other one is defined when soft_wraps is called. This helps reduce the ammount of documentation to write: ...
Add function decorator to improve functools.wraps
Add function decorator to improve functools.wraps
Python
bsd-3-clause
goodfeli/pylearn2,JesseLivezey/pylearn2,TNick/pylearn2,fulmicoton/pylearn2,pkainz/pylearn2,Refefer/pylearn2,woozzu/pylearn2,kastnerkyle/pylearn2,CIFASIS/pylearn2,mclaughlin6464/pylearn2,hyqneuron/pylearn2-maxsom,aalmah/pylearn2,bartvm/pylearn2,JesseLivezey/pylearn2,nouiz/pylearn2,lamblin/pylearn2,CIFASIS/pylearn2,junbo...
--- +++ @@ -0,0 +1,106 @@ +""" +Documentation-related helper classes/functions +""" + + +class soft_wraps: + """ + A Python decorator which concatenates two functions' docstrings: one + function is defined at initialization and the other one is defined when + soft_wraps is called. + + This helps reduce...
7ff614950163b1fb6a8fe0fef5b8de9bfa3a9d85
transmutagen/tests/test_partialfrac.py
transmutagen/tests/test_partialfrac.py
from sympy import together, expand_complex, re, im, symbols from ..partialfrac import t def test_re_form(): theta, alpha = symbols('theta, alpha') # Check that this doesn't change re_form = together(expand_complex(re(alpha/(t - theta)))) assert re_form == (t*re(alpha) - re(alpha)*re(theta) - ...
Add a test for the hard-coded re() partial frac form
Add a test for the hard-coded re() partial frac form
Python
bsd-3-clause
ergs/transmutagen,ergs/transmutagen
--- +++ @@ -0,0 +1,11 @@ +from sympy import together, expand_complex, re, im, symbols + +from ..partialfrac import t + +def test_re_form(): + theta, alpha = symbols('theta, alpha') + + # Check that this doesn't change + re_form = together(expand_complex(re(alpha/(t - theta)))) + assert re_form == (t*re(al...
8dc7a1e239dc22dd4eb69cfe1754586e3a1690dc
tests/test_run_js.py
tests/test_run_js.py
import os from py2js import JavaScript def f(x): return x def test(func, run): func_source = str(JavaScript(func)) run_file = "/tmp/run.js" with open(run_file, "w") as f: f.write(func_source) f.write("\n") f.write(run) r = os.system('js -f defs.js -f %s' % run_file) as...
Test javascript using the "js"
Test javascript using the "js"
Python
mit
qsnake/py2js,mattpap/py2js,chrivers/pyjaco,buchuki/pyjaco,mattpap/py2js,chrivers/pyjaco,chrivers/pyjaco,buchuki/pyjaco,buchuki/pyjaco,qsnake/py2js
--- +++ @@ -0,0 +1,20 @@ +import os + +from py2js import JavaScript + +def f(x): + return x + +def test(func, run): + func_source = str(JavaScript(func)) + run_file = "/tmp/run.js" + with open(run_file, "w") as f: + f.write(func_source) + f.write("\n") + f.write(run) + r = os.syste...
3dd71c02ea1fa9e39054bd82bf9e8657ec77d6b9
tools/get_chat_id.py
tools/get_chat_id.py
#! /usr/bin/python3 # -*- coding:utf-8 -*- # by antoine@2ohm.fr import sys import time import telepot def handle(msg): content_type, chat_type, chat_id = telepot.glance(msg) print("\tchat_id: {}".format(chat_id)) if content_type == 'text' and msg['text'] == '/start': ans = """ Hello <b>{first_na...
Add a script to recover the chat_id
Add a script to recover the chat_id
Python
apache-2.0
a2ohm/ProgressBot
--- +++ @@ -0,0 +1,37 @@ +#! /usr/bin/python3 +# -*- coding:utf-8 -*- + +# by antoine@2ohm.fr + +import sys +import time +import telepot + +def handle(msg): + content_type, chat_type, chat_id = telepot.glance(msg) + print("\tchat_id: {}".format(chat_id)) + + if content_type == 'text' and msg['text'] == '/sta...
fed2e3f9bdb3a00b077b5e7df1aed4d927b77b6c
tests/clifford_test.py
tests/clifford_test.py
"""Test for the Clifford algebra drudge.""" from drudge import CliffordDrudge, Vec, inner_by_delta def test_clifford_drudge_by_quaternions(spark_ctx): """Test basic functionality of Clifford drudge by quaternions. """ dr = CliffordDrudge( spark_ctx, inner=lambda v1, v2: -inner_by_delta(v1, v2) ...
Add test for Clifford drudge by quaternions
Add test for Clifford drudge by quaternions
Python
mit
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
--- +++ @@ -0,0 +1,26 @@ +"""Test for the Clifford algebra drudge.""" + +from drudge import CliffordDrudge, Vec, inner_by_delta + + +def test_clifford_drudge_by_quaternions(spark_ctx): + """Test basic functionality of Clifford drudge by quaternions. + """ + + dr = CliffordDrudge( + spark_ctx, inner=la...
09a0689b8e521c1d5c0ea68ac448dc9ae7abcff5
fitsHeader.py
fitsHeader.py
#!/usr/bin/env python # -*- coding: utf8 -*- # My imports from __future__ import division from astropy.io import fits from pydoc import pager import argparse def _parser(): parser = argparse.ArgumentParser(description='View the header of a fits file') parser.add_argument('input', help='File name of fits file...
Read the header of a fits file and/or look up a single key (case insensitive).
Read the header of a fits file and/or look up a single key (case insensitive).
Python
mit
DanielAndreasen/astro_scripts
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- + +# My imports +from __future__ import division +from astropy.io import fits +from pydoc import pager +import argparse + + +def _parser(): + parser = argparse.ArgumentParser(description='View the header of a fits file') + parser.add_argume...
b674f921a8e5cffb2d3e320f564c61ca01455a9f
wafer/management/commands/wafer_talk_video_reviewers.py
wafer/management/commands/wafer_talk_video_reviewers.py
import sys import csv from django.core.management.base import BaseCommand from django.contrib.auth import get_user_model from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL class Command(BaseCommand): help = ("List talks and the associated video_reviewer emails." " Only reviewers for accepted...
Add command to generate a csv of talk titles and video reviewers
Add command to generate a csv of talk titles and video reviewers
Python
isc
CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer
--- +++ @@ -0,0 +1,29 @@ +import sys +import csv + +from django.core.management.base import BaseCommand + +from django.contrib.auth import get_user_model +from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL + + +class Command(BaseCommand): + help = ("List talks and the associated video_reviewer emails." + ...
3db3c22d83071550d8bbd70062f957cf43c5e54a
cart/_compatibility.py
cart/_compatibility.py
import sys is_py3 = sys.version_info[0] >= 3 def utf8(string): """Cast to unicode DAMMIT! Written because Python2 repr always implicitly casts to a string, so we have to cast back to a unicode (and we now that we always deal with valid unicode, because we check that in the beginning). """ if ...
Add a compatibility module, because of Python 2/3 compatibility issues.
Add a compatibility module, because of Python 2/3 compatibility issues.
Python
mit
davidhalter-archive/shopping_cart_example
--- +++ @@ -0,0 +1,16 @@ +import sys + +is_py3 = sys.version_info[0] >= 3 + + +def utf8(string): + """Cast to unicode DAMMIT! + Written because Python2 repr always implicitly casts to a string, so we + have to cast back to a unicode (and we now that we always deal with valid + unicode, because we check th...
156b7dfc11f24a7d77d2280e8ddade3cb7a474b7
misc/list_all_es_indexes.py
misc/list_all_es_indexes.py
#!/usr/bin/env python # -*- encoding: utf-8 import boto3 import hcl import requests def get_terraform_vars(): s3_client = boto3.client("s3") tfvars_body = s3_client.get_object( Bucket="wellcomecollection-platform-infra", Key="terraform.tfvars" )["Body"] return hcl.load(tfvars_body) ...
Add a script for listing all Elasticsearch indexes
Add a script for listing all Elasticsearch indexes
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 + +import boto3 +import hcl +import requests + + +def get_terraform_vars(): + s3_client = boto3.client("s3") + tfvars_body = s3_client.get_object( + Bucket="wellcomecollection-platform-infra", + Key="terraform.tfvars" + )["B...
006a921f19f6c4f64d694c86346ad85ada2c8bb8
tests/subclass_test.py
tests/subclass_test.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vi:ts=4:et try: import unittest2 as unittest except ImportError: import unittest import pycurl CLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare) class SubclassTest(unittest.TestCase): def test_baseclass_init(self): # base classes do not a...
Add tests for subclass support
Add tests for subclass support
Python
lgpl-2.1
pycurl/pycurl,pycurl/pycurl,pycurl/pycurl
--- +++ @@ -0,0 +1,88 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# vi:ts=4:et + +try: + import unittest2 as unittest +except ImportError: + import unittest +import pycurl + +CLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare) + +class SubclassTest(unittest.TestCase): + def test_baseclass_in...
d764a483497afc5d029a82db14cc5cc88f45f4c0
nova/api/openstack/contrib/multinic.py
nova/api/openstack/contrib/multinic.py
# Copyright 2011 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
Add an extension to allow for an addFixedIp action on instances
Add an extension to allow for an addFixedIp action on instances
Python
apache-2.0
saleemjaveds/https-github.com-openstack-nova,bigswitch/nova,virtualopensystems/nova,leilihh/nova,cyx1231st/nova,rajalokan/nova,whitepages/nova,eneabio/nova,devendermishrajio/nova,virtualopensystems/nova,luogangyi/bcec-nova,tanglei528/nova,cloudbau/nova,sileht/deb-openstack-nova,tianweizhang/nova,mandeepdhami/nova,salv-...
--- +++ @@ -0,0 +1,83 @@ +# Copyright 2011 OpenStack LLC. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/L...
fe479bf2a8ec547922c6643bbdf0ba768eb79c9d
ludo/simulator.py
ludo/simulator.py
#!/usr/bin/env python3 from game import Game print("Welcome to a game of ludo!") average_throw_counter = 0 min_throws_per_game = 10000000 max_throws_per_game = 0 NUM_GAMES = 100 for i in range(0, NUM_GAMES): game = Game() throw_counter = 0 while game.next_move(): throw_counter += 1 average...
Add script to simulate multiple games
Add script to simulate multiple games
Python
mit
risteon/ludo_python
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +from game import Game + +print("Welcome to a game of ludo!") + +average_throw_counter = 0 +min_throws_per_game = 10000000 +max_throws_per_game = 0 +NUM_GAMES = 100 + +for i in range(0, NUM_GAMES): + + game = Game() + throw_counter = 0 + + while game.next_move...
c89cce1a47c1e379958d7cced624ec0317cd3407
examples/demo3.py
examples/demo3.py
import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) import logging import threading import xmpp2 import time import select from xmpp2 import XML # non-blocking, poll example. USERNAME = 'yourusername' PASSWORD = 'yourpassword' SERVER = 'example.com' logging.basicConfig(level=logging...
Add demo for non-blocking with poll().
Add demo for non-blocking with poll().
Python
mit
easies/xmpp2
--- +++ @@ -0,0 +1,32 @@ +import os +import sys +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) +import logging +import threading +import xmpp2 +import time +import select +from xmpp2 import XML + +# non-blocking, poll example. +USERNAME = 'yourusername' +PASSWORD = 'yourpassword' +SERVER = 'exampl...
1e65555a08ff3ee1a06e92d9dd054abf3cfaf711
media_tree/migrations/0003_alter_tree_fields.py
media_tree/migrations/0003_alter_tree_fields.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('media_tree', '0002_mptt_to_treebeard'), ] operations = [ migrations.AlterField( model_name='filenode', ...
Add a migration to update to final tree fields
Add a migration to update to final tree fields
Python
bsd-3-clause
samluescher/django-media-tree,samluescher/django-media-tree,samluescher/django-media-tree
--- +++ @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('media_tree', '0002_mptt_to_treebeard'), + ] + + operations = [ + migrations.AlterField( + ...