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
b0c54c2d88db58a56e05f5da7d0d069a16c2b852
fabfile.py
fabfile.py
# # Edit `config` line to fit in your environemnt. # To install fabric and cuisne, # # # update setuptools # $ sudo pip install -U setuptools # $ sudo pip install setuptools # # $ sudo pip install fabric # $ sudo pip install cuisine # # You may need to speicfy ARCHFLAGFS on MacOSX environemnt. # (https://lan...
Add build script using python fabric.
Add build script using python fabric.
Python
bsd-2-clause
avr-aics-riken/SURFACE,avr-aics-riken/SURFACE,avr-aics-riken/SURFACE,avr-aics-riken/SURFACE
--- +++ @@ -0,0 +1,78 @@ +# +# Edit `config` line to fit in your environemnt. + +# To install fabric and cuisne, +# +# # update setuptools +# $ sudo pip install -U setuptools +# $ sudo pip install setuptools +# +# $ sudo pip install fabric +# $ sudo pip install cuisine +# +# You may need to speicfy ARCHFLAG...
ddb514e470502160385731d6e01d8b6831a36079
test/skills/intent_service.py
test/skills/intent_service.py
import unittest from mycroft.skills.intent_service import IntentService, ContextManager class MockEmitter(object): def __init__(self): self.reset() def emit(self, message): self.types.append(message.type) self.results.append(message.data) def get_types(self): return self....
Add basic tests for context manager
Add basic tests for context manager
Python
apache-2.0
linuxipho/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core,Dark5ide/mycroft-core,MycroftAI/mycroft-core,aatchison/mycroft-core
--- +++ @@ -0,0 +1,59 @@ +import unittest +from mycroft.skills.intent_service import IntentService, ContextManager + + +class MockEmitter(object): + def __init__(self): + self.reset() + + def emit(self, message): + self.types.append(message.type) + self.results.append(message.data) + + d...
170a4ecbca4624fba1207b297cd41e17e7b1a8c7
fedmsg.d/fasclient-example-config.py
fedmsg.d/fasclient-example-config.py
config = { 'fasclient.consumer.enabled': True, 'fasclient.consumer.delay': 10, # 10 seconds 'fasclient.consumer.serial': 3, # 3 hosts at a time }
Add the example fedmsg consumer configuration file
Add the example fedmsg consumer configuration file
Python
lgpl-2.1
fedora-infra/fedmsg-fasclient
--- +++ @@ -0,0 +1,5 @@ +config = { + 'fasclient.consumer.enabled': True, + 'fasclient.consumer.delay': 10, # 10 seconds + 'fasclient.consumer.serial': 3, # 3 hosts at a time +}
65dea8930509eee7b35af8876b15edda032aa368
example/tests/test_views.py
example/tests/test_views.py
from django.core.urlresolvers import reverse from django.test import TestCase import json from myshop.models.polymorphic.product import Product from myshop.models.manufacturer import Manufacturer class ProductSelectViewTest(TestCase): def setUp(self): manufacturer = Manufacturer.objects.create(name="te...
Add a test for ProductSelectView
Add a test for ProductSelectView
Python
bsd-3-clause
awesto/django-shop,nimbis/django-shop,awesto/django-shop,jrief/django-shop,jrief/django-shop,jrief/django-shop,khchine5/django-shop,nimbis/django-shop,divio/django-shop,khchine5/django-shop,khchine5/django-shop,nimbis/django-shop,divio/django-shop,divio/django-shop,jrief/django-shop,nimbis/django-shop,awesto/django-sho...
--- +++ @@ -0,0 +1,25 @@ +from django.core.urlresolvers import reverse +from django.test import TestCase + +import json + +from myshop.models.polymorphic.product import Product +from myshop.models.manufacturer import Manufacturer + + +class ProductSelectViewTest(TestCase): + + def setUp(self): + manufacture...
4f46ab95f012c67d6bf6188987c618e3150cb63a
tests/statusbar_test.py
tests/statusbar_test.py
#!/usr/bin/env python # encoding: utf-8 """Statusbar tests for vimiv's test suite.""" from unittest import main from vimiv_testcase import VimivTestCase class StatusbarTest(VimivTestCase): """Statusbar Tests.""" @classmethod def setUpClass(cls): cls.init_test(cls) cls.statusbar = cls.vim...
Add test for the statusbar
Add test for the statusbar
Python
mit
karlch/vimiv,karlch/vimiv,karlch/vimiv
--- +++ @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# encoding: utf-8 +"""Statusbar tests for vimiv's test suite.""" + +from unittest import main +from vimiv_testcase import VimivTestCase + + +class StatusbarTest(VimivTestCase): + """Statusbar Tests.""" + + @classmethod + def setUpClass(cls): + cls.init_...
14cedb385e8345b11d9c9dfe5903f416e5d56780
src/models/separate_train_y.py
src/models/separate_train_y.py
# Built-in modules from os import path, pardir import sys import logging # not used in this stub but often useful for finding various files PROJECT_ROOT_DIRPATH = path.join(path.dirname(__file__), pardir, pardir) sys.path.append(PROJECT_ROOT_DIRPATH) # Third-party modules import click from dotenv import find_dotenv, ...
Add a code of train y separation
Add a code of train y separation
Python
mit
gciteam6/xgboost,gciteam6/xgboost
--- +++ @@ -0,0 +1,64 @@ +# Built-in modules +from os import path, pardir +import sys +import logging + +# not used in this stub but often useful for finding various files +PROJECT_ROOT_DIRPATH = path.join(path.dirname(__file__), pardir, pardir) +sys.path.append(PROJECT_ROOT_DIRPATH) + +# Third-party modules +import ...
b489eded170200dcc90d04cf7382c5592edefd46
zerver/tests/test_migrations_0145.py
zerver/tests/test_migrations_0145.py
from zerver.lib.test_classes import MigrationsTestCase from zerver.lib.test_helpers import use_db_models, make_client from django.utils.timezone import now as timezone_now from django.db.migrations.state import StateApps from django.db.models.base import ModelBase from zerver.models import get_stream class EmojiName2...
Add test for 0145 migration.
migration_test: Add test for 0145 migration.
Python
apache-2.0
kou/zulip,hackerkid/zulip,jackrzhang/zulip,hackerkid/zulip,tommyip/zulip,punchagan/zulip,eeshangarg/zulip,punchagan/zulip,kou/zulip,eeshangarg/zulip,punchagan/zulip,tommyip/zulip,tommyip/zulip,shubhamdhama/zulip,kou/zulip,synicalsyntax/zulip,brainwane/zulip,tommyip/zulip,eeshangarg/zulip,zulip/zulip,zulip/zulip,zulip/z...
--- +++ @@ -0,0 +1,58 @@ +from zerver.lib.test_classes import MigrationsTestCase +from zerver.lib.test_helpers import use_db_models, make_client +from django.utils.timezone import now as timezone_now +from django.db.migrations.state import StateApps +from django.db.models.base import ModelBase + +from zerver.models i...
9c7e73bb778ca8cdc60353dbfec484b965d11e4c
examples/download_full.py
examples/download_full.py
from __future__ import print_function from openload import OpenLoad def solve_captcha(captcha_url): """Return solved captcha string""" pass username = 'FTP Username/API Login' key = 'FTP Password/API Key' file_id = 'Id of the file will be downloaded' openload = OpenLoad(username, key) # Get a download tick...
Add full example to download file
Add full example to download file
Python
mit
mohan3d/PyOpenload
--- +++ @@ -0,0 +1,32 @@ +from __future__ import print_function + +from openload import OpenLoad + +def solve_captcha(captcha_url): + """Return solved captcha string""" + pass + +username = 'FTP Username/API Login' +key = 'FTP Password/API Key' +file_id = 'Id of the file will be downloaded' + +openload = OpenLo...
dabd96a85f15c7f9c198fa49982250d5cbad8b6b
newtype-annotated-experiments.py
newtype-annotated-experiments.py
# IPython log file import numpy as np import typing as t ImageData = t.Annotated[np.ndarray, 'image'] x : ImageData = np.random.random((512, 512)) print(__annotations__) def gaussian(image: ImageData, sigma: int = 1) -> ImageData: return image print(gaussian.__annotations__) print(gaussian.__annotations__['ima...
Add brief experiments with creating types with newtype and annottated
Add brief experiments with creating types with newtype and annottated
Python
bsd-3-clause
jni/useful-histories
--- +++ @@ -0,0 +1,40 @@ +# IPython log file +import numpy as np + + +import typing as t +ImageData = t.Annotated[np.ndarray, 'image'] +x : ImageData = np.random.random((512, 512)) + +print(__annotations__) + +def gaussian(image: ImageData, sigma: int = 1) -> ImageData: + return image + +print(gaussian.__annotatio...
5f69110a4a343a8ab6d3cc6b6efc6ca145897d94
ibmcnx/doc/Documentation.py
ibmcnx/doc/Documentation.py
###### # Create a file (html or markdown) with the output of # - JVMHeap # - LogFiles # - Ports # - Variables # # Author: Christoph Stoettner # Mail: christoph.stoettner@stoeps.de # Documentation: http://scripting101.stoeps.de # # Version: 2.0 # Date: 2014-06-08 ...
Create script to save documentation to a file
4: Create script to save documentation to a file Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4
Python
apache-2.0
stoeps13/ibmcnx2,stoeps13/ibmcnx2
--- +++ @@ -0,0 +1,35 @@ +###### +# Create a file (html or markdown) with the output of +# - JVMHeap +# - LogFiles +# - Ports +# - Variables +# +# Author: Christoph Stoettner +# Mail: christoph.stoettner@stoeps.de +# Documentation: http://scripting101.stoeps.de +# +# Version: ...
550cda891d53dce79466687a694f7be2eb6e4d9d
upnpy/utils.py
upnpy/utils.py
# -*- coding: utf-8 -*- """ utils.py ~~~~~~~~ Defines utility functions used by UPnPy. """ def camelcase_to_underscore(text): """ Convert a camelCasedString to one separated_by_underscores. Treats neighbouring capitals as acronyms and doesn't separated them, e.g. URL does not become u_r_l. That would...
Add camelCase to snake_case function.
Add camelCase to snake_case function.
Python
mit
Lukasa/upnpy,WenhaoYu/upnpy
--- +++ @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" +utils.py +~~~~~~~~ + +Defines utility functions used by UPnPy. +""" + + +def camelcase_to_underscore(text): + """ + Convert a camelCasedString to one separated_by_underscores. Treats + neighbouring capitals as acronyms and doesn't separated them, e.g. U...
4f6a577df1c40fcc5d26107f71b3fa7eb3ca85e1
find_classes.py
find_classes.py
"""find_classes.py Find the emergent classes from the exposure matrix averaged over all MSAs in the US """ import csv import marble as mb # # Import exposure data # ## List of MSA msa = {} with open('data/names/msa.csv', 'r') as source: reader = csv.reader(source, delimiter='\t') reader.next() for rows ...
Add script to extract the linkage matrix from the average US exposure matrix
Add script to extract the linkage matrix from the average US exposure matrix
Python
bsd-3-clause
rlouf/patterns-of-segregation
--- +++ @@ -0,0 +1,69 @@ +"""find_classes.py + +Find the emergent classes from the exposure matrix averaged over all MSAs in the +US +""" +import csv +import marble as mb + + +# +# Import exposure data +# + +## List of MSA +msa = {} +with open('data/names/msa.csv', 'r') as source: + reader = csv.reader(source, del...
75290add3f338abb6542c2b1981fdde7c1117626
indra/statements/delta.py
indra/statements/delta.py
class Delta(object): """The parent class of all delta types.""" pass class QualitativeDelta(Delta): """Qualitative delta defining an Event. Parameters ---------- polarity : 1, -1 or None Polarity of an Event. adjectives : list[str] Adjectives describing an Event. """ ...
Define Delta and QualitativeDelta classes
Define Delta and QualitativeDelta classes
Python
bsd-2-clause
johnbachman/belpy,bgyori/indra,bgyori/indra,johnbachman/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/indra
--- +++ @@ -0,0 +1,29 @@ +class Delta(object): + """The parent class of all delta types.""" + pass + + +class QualitativeDelta(Delta): + """Qualitative delta defining an Event. + + Parameters + ---------- + polarity : 1, -1 or None + Polarity of an Event. + adjectives : list[str] + ...
9031a8def9b797cbd8280a29e62c436e168f4096
txircd/modules/rfc/cmd_nick.py
txircd/modules/rfc/cmd_nick.py
from twisted.plugin import IPlugin from twisted.words.protocols import irc from txircd.module_interface import Command, ICommand, IModuleData, ModuleData from txircd.utils import ircLower, isValidNick from zope.interface import implements from datetime import datetime class NickCommand(ModuleData): implements(IPlu...
Implement NICK command for both users and servers
Implement NICK command for both users and servers
Python
bsd-3-clause
ElementalAlchemist/txircd,Heufneutje/txircd
--- +++ @@ -0,0 +1,100 @@ +from twisted.plugin import IPlugin +from twisted.words.protocols import irc +from txircd.module_interface import Command, ICommand, IModuleData, ModuleData +from txircd.utils import ircLower, isValidNick +from zope.interface import implements +from datetime import datetime + +class NickComm...
0f9b7486d7f396598f32148422588da66c23477e
backend/breach/migrations/0008_auto_20160314_2049.py
backend/breach/migrations/0008_auto_20160314_2049.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-03-14 20:49 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('breach', '0007_auto_20160309_1802'), ] operations = [ migrations.AlterField(...
Allow unstarted/incomplete samplesets in db
Allow unstarted/incomplete samplesets in db
Python
mit
dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,dimriou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,dionyziz/rupture,esarafianou/rupture,dionyziz/rupture,dionyziz/rupture,e...
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-03-14 20:49 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('breach', '0007_auto_20160309_1802'), + ] + + oper...
0b44d2f2f99426cd2385b881c721f64979fb3d92
src/collectors/users/test/testusers.py
src/collectors/users/test/testusers.py
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from users import Us...
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from users import Us...
Set the docs no matter if we run the test on this platform or not
Set the docs no matter if we run the test on this platform or not
Python
mit
jumping/Diamond,krbaker/Diamond,sebbrandt87/Diamond,Clever/Diamond,codepython/Diamond,CYBERBUGJR/Diamond,szibis/Diamond,gg7/diamond,zoidbergwill/Diamond,bmhatfield/Diamond,TAKEALOT/Diamond,TinLe/Diamond,Ormod/Diamond,tuenti/Diamond,dcsquared13/Diamond,szibis/Diamond,ceph/Diamond,jaingaurav/Diamond,tusharmakkar08/Diamon...
--- +++ @@ -28,19 +28,20 @@ @patch.object(Collector, 'publish') def test_should_work_with_real_data(self, publish_mock): + metrics = { + 'kormoc': 2, + 'root': 3, + 'total': 5, + } + + self.setDocExample(self.collector.__class__.__...
6c1d1c0662a0ae05dcfbb55484164a302bf5e0d3
tests/test_cl_json.py
tests/test_cl_json.py
from kqml import cl_json, KQMLList def test_parse(): json_dict = {'a': 1, 'b': 2, 'c': ['foo', {'bar': None, 'done': False}], 'this is json': True} res = cl_json.parse_json(json_dict) assert isinstance(res, KQMLList) assert len(res) == 2*len(json_dict.keys())
Add a test of the parser.
Add a test of the parser.
Python
bsd-2-clause
bgyori/pykqml
--- +++ @@ -0,0 +1,10 @@ +from kqml import cl_json, KQMLList + + +def test_parse(): + json_dict = {'a': 1, 'b': 2, + 'c': ['foo', {'bar': None, 'done': False}], + 'this is json': True} + res = cl_json.parse_json(json_dict) + assert isinstance(res, KQMLList) + assert len(res...
74837658fc50dc26278e3a2a56ddb0645c5fde2c
lexgen/utils.py
lexgen/utils.py
import math def percentile(values, percent, key=lambda x: x): """ Find the percentile of a list of values. Params: values (list): Sorted list of values. percent (float): A value from 0.0 to 1.0. key (function): Optional key function to compute value from each value on list. R...
Add two functions to calculate percentiles and filter a dict using IQR
Add two functions to calculate percentiles and filter a dict using IQR The idea is to get a dictionary with a tweets count for each user and filter that users whose number of tweets is not inside the interquartile range.
Python
mit
davidmogar/lexgen,davidmogar/lexgen
--- +++ @@ -0,0 +1,51 @@ +import math + + +def percentile(values, percent, key=lambda x: x): + """ + Find the percentile of a list of values. + + Params: + values (list): Sorted list of values. + percent (float): A value from 0.0 to 1.0. + key (function): Optional key function to compute...
8d19727e44d961d6bba263990cca954893782613
client/file_logging.py
client/file_logging.py
import logging import os import king_phisher.client.application as application import king_phisher.client.plugins as plugins import king_phisher.client.gui_utilities as gui_utilities # logger name value LOGGER_NAME = '' # log file size, in MB LOG_FILE_SIZE = 10 class Plugin(plugins.ClientPlugin): authors = ['Zach ...
Add a client plugin to log to files
Add a client plugin to log to files Using logging.VALUE instead of fixed value for levels Updated logger name value with root logger name Added basis for RotatingFileHandler with logger Added description of plugin Updated comment, attached components. Ready for initial testing? UNTESTED: Added file directory and ...
Python
bsd-3-clause
securestate/king-phisher-plugins,zeroSteiner/king-phisher-plugins,zeroSteiner/king-phisher-plugins,securestate/king-phisher-plugins,wolfthefallen/king-phisher-plugins,wolfthefallen/king-phisher-plugins
--- +++ @@ -0,0 +1,54 @@ +import logging +import os + +import king_phisher.client.application as application +import king_phisher.client.plugins as plugins +import king_phisher.client.gui_utilities as gui_utilities + +# logger name value +LOGGER_NAME = '' + +# log file size, in MB +LOG_FILE_SIZE = 10 + +class Plugin(...
3bdf1e98b3379fde17107fcdb1e32d9273a826b4
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
import zipfile, os srcname = "junk9630.tmp" zipname = "junk9708.tmp" try: fp = open(srcname, "w") # Make a source file with some lines for i in range(0, 1000): fp.write("Test of zipfile line %d.\n" % i) fp.close() zip = zipfile.ZipFile(zipname, "w") # Create the ZIP archive zip.write(srcname, srcname)...
Test for zipfile.py, by Jim Ahlstrom.
Test for zipfile.py, by Jim Ahlstrom.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,26 @@ +import zipfile, os + +srcname = "junk9630.tmp" +zipname = "junk9708.tmp" + +try: + fp = open(srcname, "w") # Make a source file with some lines + for i in range(0, 1000): + fp.write("Test of zipfile line %d.\n" % i) + fp.close() + + zip = zipfile.ZipFile(zipname, "w") # Create the ZI...
4bd4e7f459eee610d5cf19f845299ca942ff4b64
python/datetime_timezone.py
python/datetime_timezone.py
#!/usr/bin/env python # coding: utf-8 import datetime # UTC ################################# # Naive print(datetime.datetime.utcnow()) # Aware print(datetime.datetime.now().astimezone(datetime.timezone.utc)) # Local ############################### # Naive print(datetime.datetime.now()) # Aware print(datetime.d...
Add a snippet (python datetime timezones).
Add a snippet (python datetime timezones).
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,24 @@ +#!/usr/bin/env python +# coding: utf-8 + +import datetime + + +# UTC ################################# + +# Naive +print(datetime.datetime.utcnow()) + +# Aware +print(datetime.datetime.now().astimezone(datetime.timezone.utc)) + +# Local ############################### + +# Naive +print(datet...
888beffa2ab3362c23d85b73b388f67f534e29a0
skeleton/plugins/sprites.disabled.py
skeleton/plugins/sprites.disabled.py
import os import pipes import shutil import subprocess """ This plugin uses glue to sprite images: http://glue.readthedocs.org/en/latest/quickstart.html Install: (Only if you want to sprite jpg too) brew install libjpeg (Only if you want to optimize pngs with optipng) brew install optipng sudo easy_install pip sud...
Add spriting plugin based on glue
Add spriting plugin based on glue
Python
bsd-3-clause
danielmorosan/Cactus,dreadatour/Cactus,PegasusWang/Cactus,page-io/Cactus,andyzsf/Cactus-,fjxhkj/Cactus,juvham/Cactus,Knownly/Cactus,Knownly/Cactus,fjxhkj/Cactus,Knownly/Cactus,koobs/Cactus,koenbok/Cactus,chaudum/Cactus,eudicots/Cactus,dreadatour/Cactus,chaudum/Cactus,eudicots/Cactus,ibarria0/Cactus,andyzsf/Cactus-,koen...
--- +++ @@ -0,0 +1,47 @@ +import os +import pipes +import shutil +import subprocess + +""" +This plugin uses glue to sprite images: +http://glue.readthedocs.org/en/latest/quickstart.html + +Install: + +(Only if you want to sprite jpg too) +brew install libjpeg + +(Only if you want to optimize pngs with optipng) +brew...
a31d112ab188755a6d843599c1472334abcefd3b
src/zeit/workflow/tests/test_timebased.py
src/zeit/workflow/tests/test_timebased.py
import datetime import mock import pytz import transaction import zeit.content.article.cds import zeit.content.article.testing class TimeBasedWorkflowTest(zeit.cms.testing.FunctionalTestCase): layer = zeit.cms.testing.ZCML_LAYER def test_add_job_calls_async_celery_task_with_delay_for_future_execution( ...
Add test to ensure timebased jobs are called with delay.
ZON-3409: Add test to ensure timebased jobs are called with delay.
Python
bsd-3-clause
ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms,ZeitOnline/zeit.cms
--- +++ @@ -0,0 +1,26 @@ +import datetime +import mock +import pytz +import transaction +import zeit.content.article.cds +import zeit.content.article.testing + + +class TimeBasedWorkflowTest(zeit.cms.testing.FunctionalTestCase): + + layer = zeit.cms.testing.ZCML_LAYER + + def test_add_job_calls_async_celery_tas...
1ddec2ec4cae3d200f56a58f2de48334ab3d4af2
CodeFights/correctLineup.py
CodeFights/correctLineup.py
#!/usr/local/bin/python # Code Fights Correct Lineup Problem def correctLineup(athletes): return [a for t in zip(athletes[1::2], athletes[::2]) for a in t] def main(): tests = [ [[1, 2, 3, 4, 5, 6], [2, 1, 4, 3, 6, 5]], [[13, 42], [42, 13]], [[2, 3, 1, 100, 99, 45, 22, 28], [3, 2, 10...
Solve Code Fights correct lineup problem
Solve Code Fights correct lineup problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,30 @@ +#!/usr/local/bin/python +# Code Fights Correct Lineup Problem + + +def correctLineup(athletes): + return [a for t in zip(athletes[1::2], athletes[::2]) for a in t] + + +def main(): + tests = [ + [[1, 2, 3, 4, 5, 6], [2, 1, 4, 3, 6, 5]], + [[13, 42], [42, 13]], + [[...
cd0e32e21c315e888e351c5266c38195294450a3
drivers.py
drivers.py
import readers import filtering import writers def merge_multiple_fractions(fns): """Performs the work to merge parallelized percolator fractions. Target/decoy split, filtering unique peptides, running qvality on resulting score distributions for psms and peptides and setting values.""" pass def spl...
Put writing code in own module
Put writing code in own module
Python
mit
glormph/msstitch
--- +++ @@ -0,0 +1,34 @@ +import readers +import filtering +import writers + + +def merge_multiple_fractions(fns): + """Performs the work to merge parallelized percolator fractions. + Target/decoy split, filtering unique peptides, running qvality on resulting + score distributions for psms and peptides and s...
3c15b0ab1a7b3b8dd3df124bd687c024e8ee28a5
taiga/projects/migrations/0044_merge.py
taiga/projects/migrations/0044_merge.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-05-30 16:36 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('projects', '0043_auto_20160530_1004'), ('projects', '0042_auto_20160525_0911'), ] op...
Create a merge migration to fix the problem between master and stable branches
Create a merge migration to fix the problem between master and stable branches
Python
agpl-3.0
dayatz/taiga-back,taigaio/taiga-back,taigaio/taiga-back,dayatz/taiga-back,taigaio/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,xdevelsistemas/taiga-back-community,xdevelsistemas/taiga-back-community
--- +++ @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-05-30 16:36 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('projects', '0043_auto_20160530_1004'), + ('projects', '0...
8d000ebe16657f5cbe7fdf06ddd91322f141fb11
accounting/apps/books/models.py
accounting/apps/books/models.py
from django.conf import settings from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): pass class Organization(models.Model): display_name = models.CharField(max_length=150, help_text="Name that you communicate") legal_name = models.CharField(...
from django.conf import settings from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): pass class Organization(models.Model): display_name = models.CharField(max_length=150, help_text="Name that you communicate") legal_name = models.CharField(...
Allow no members for creating an organization
Allow no members for creating an organization
Python
mit
kenjhim/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting
--- +++ @@ -14,4 +14,5 @@ help_text="Official name to appear on your reports, sales " "invoices and bills") - members = models.ManyToManyField(settings.AUTH_USER_MODEL) + members = models.ManyToManyField(settings.AUTH_USER_MODEL, + blank=True, nu...
100f4dc9f81728db3ae3a1c73ace92e52d46a4d4
django_afip/migrations/0014_no_partially_validated_receiptvalidations.py
django_afip/migrations/0014_no_partially_validated_receiptvalidations.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-06-04 17:17 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('afip', '0013_taxpayer_is_sandboxed'), ] operations = [ migrations.AlterField...
Add missing validation (see 58227d2)
Add missing validation (see 58227d2)
Python
isc
hobarrera/django-afip,hobarrera/django-afip
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-06-04 17:17 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('afip', '0013_taxpayer_is_sandboxed'), + ] + + ope...
68dfe9c86ec1d2042b3f1eef21738300a3c6caf2
arxiv_vanity/papers/management/commands/mark_failed_renders_as_expired.py
arxiv_vanity/papers/management/commands/mark_failed_renders_as_expired.py
from django.core.management.base import BaseCommand, CommandError from ...models import Render class Command(BaseCommand): help = 'Marks all renders as expired so they will be rerendered' def handle(self, *args, **options): qs = Render.objects.defer("container_inspect", "container_logs").failed().not...
Add command to mark failed renders as expired
Add command to mark failed renders as expired
Python
apache-2.0
arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity,arxiv-vanity/arxiv-vanity
--- +++ @@ -0,0 +1,11 @@ +from django.core.management.base import BaseCommand, CommandError +from ...models import Render + + +class Command(BaseCommand): + help = 'Marks all renders as expired so they will be rerendered' + + def handle(self, *args, **options): + qs = Render.objects.defer("container_insp...
0ca93d94d224b5cdf926de584ee9512bc084dc4f
examples/visualization/show_2d_complex.py
examples/visualization/show_2d_complex.py
# Copyright 2014-2016 The ODL development group # # This file is part of ODL. # # ODL 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. #...
Add 2d visualization example with complex data
ENH: Add 2d visualization example with complex data
Python
mpl-2.0
kohr-h/odl,odlgroup/odl,aringh/odl,odlgroup/odl,aringh/odl,kohr-h/odl
--- +++ @@ -0,0 +1,32 @@ +# Copyright 2014-2016 The ODL development group +# +# This file is part of ODL. +# +# ODL is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (a...
bd23cb0214ce0a3eb14b069599f4bded8bd2b26a
analysis/compress-jacobians.py
analysis/compress-jacobians.py
#!/usr/bin/env python import climate import joblib import lmj.pca import database def jac(trial): trial.load() cols = [c for c in trial.df.columns if c.startswith('jac-fwd')] return trial.df[cols].values def main(root, pattern='*'): trials = database.Experiment(root).trials_matching(pattern) p...
Add script for pca-ing jacobians.
Add script for pca-ing jacobians.
Python
mit
lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment
--- +++ @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +import climate +import joblib +import lmj.pca + +import database + + +def jac(trial): + trial.load() + cols = [c for c in trial.df.columns if c.startswith('jac-fwd')] + return trial.df[cols].values + + +def main(root, pattern='*'): + trials = database.Exp...
d619307b77851e014cabc3e864e4c11dfea7764d
integration-test/977-min-zoom-from-ne-join.py
integration-test/977-min-zoom-from-ne-join.py
# -*- coding: utf-8 -*- from . import FixtureTest class MinZoomFromNETest(FixtureTest): def setUp(self): import dsl super(MinZoomFromNETest, self).setUp() self.lon, self.lat = (-3.2765753, 54.7023545) self.generate_fixtures( # https://www.openstreetmap.org/node/8380...
Add test for NE data min/max zoom join to places.
Add test for NE data min/max zoom join to places.
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +from . import FixtureTest + + +class MinZoomFromNETest(FixtureTest): + + def setUp(self): + import dsl + + super(MinZoomFromNETest, self).setUp() + + self.lon, self.lat = (-3.2765753, 54.7023545) + + self.generate_fixtures( + ...
7c8c6fb26dbf22e9fa09b1121683957123d9b903
14B-088/HI/imaging/HI_dirty_cube.py
14B-088/HI/imaging/HI_dirty_cube.py
''' Create a dirty HI cube for comparison and use in feathering. *Note*: Ran with casa-prerelease-5.0.0-187.el7 to take advantage of tclean's read-only mode, which speeds things up considerably. ''' import os from tasks import tclean, impbcor # CASA init should have the VLA_Lband repo appended to the path from pat...
Create a dirty cubes of the whole HI 14B-088 data
Create a dirty cubes of the whole HI 14B-088 data
Python
mit
e-koch/VLA_Lband,e-koch/VLA_Lband
--- +++ @@ -0,0 +1,57 @@ + +''' +Create a dirty HI cube for comparison and use in feathering. + +*Note*: Ran with casa-prerelease-5.0.0-187.el7 to take advantage of tclean's +read-only mode, which speeds things up considerably. +''' + +import os + +from tasks import tclean, impbcor + +# CASA init should have the VLA_...
6ce83f65f12fe02c4f9417c610322f21ef6c02c6
apps/plea/tests/test_timeout.py
apps/plea/tests/test_timeout.py
from django.test import TestCase from django.test.client import Client from django.conf import settings from importlib import import_module from ..views import PleaOnlineForms class TestTimeout(TestCase): def setUp(self): self.client = Client() # http://code.djangoproject.com/ticket/10899 ...
Add unit tests for session timeout http headers
Add unit tests for session timeout http headers These tests check for the absence or presence of the session timeout redirect headers. [MAPDEV326]
Python
mit
ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas,ministryofjustice/manchester_traffic_offences_pleas
--- +++ @@ -0,0 +1,35 @@ +from django.test import TestCase +from django.test.client import Client +from django.conf import settings +from importlib import import_module + +from ..views import PleaOnlineForms + +class TestTimeout(TestCase): + + def setUp(self): + self.client = Client() + # http://code...
d3ab0989bdeaf1aefb287b5bf6ae511c0441d370
printurls.py
printurls.py
# printurls.py - returns command for downloading CalISO "renewables watch" data. import datetime URL_FORMAT = "http://content.caiso.com/green/renewrpt/%Y%m%d_DailyRenewablesWatch.txt" START="2014/05/20" END="2014/05/30" DATEFORMAT="%Y/%m/%d" def daterange(s, e): for i in range((e - s).days): yield s + da...
Add a script for downloading all CalISO 30min generation data.
Add a script for downloading all CalISO 30min generation data.
Python
mit
gonzojive/cal-iso-daily-renewables
--- +++ @@ -0,0 +1,21 @@ +# printurls.py - returns command for downloading CalISO "renewables watch" data. + +import datetime + +URL_FORMAT = "http://content.caiso.com/green/renewrpt/%Y%m%d_DailyRenewablesWatch.txt" +START="2014/05/20" +END="2014/05/30" +DATEFORMAT="%Y/%m/%d" + +def daterange(s, e): + for i in ran...
eebb736bf83c572b797931c571e7416223436461
homeassistant/components/light/insteon.py
homeassistant/components/light/insteon.py
""" homeassistant.components.light.insteon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for Insteon Hub lights. """ from homeassistant.components.insteon import (INSTEON, InsteonToggleDevice) def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Insteon Hub light platform. """ d...
""" homeassistant.components.light.insteon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support for Insteon Hub lights. """ from homeassistant.components.insteon import (INSTEON, InsteonToggleDevice) def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Insteon Hub light platform. """ d...
Add ability to control dimmable sources
Add ability to control dimmable sources
Python
mit
emilhetty/home-assistant,Duoxilian/home-assistant,rohitranjan1991/home-assistant,toddeye/home-assistant,ct-23/home-assistant,florianholzapfel/home-assistant,kennedyshead/home-assistant,keerts/home-assistant,lukas-hetzenecker/home-assistant,jabesq/home-assistant,JshWright/home-assistant,open-homeautomation/home-assistan...
--- +++ @@ -13,4 +13,6 @@ for device in INSTEON.devices: if device.DeviceCategory == "Switched Lighting Control": devs.append(InsteonToggleDevice(device)) + if device.DeviceCategory == "Dimmable Lighting Control": + devs.append(InsteonToggleDevice(device)) add_devices...
cbc4269b78e3ce2edb116323353f92c9b2a4d15b
test/unit/ggrc/models/base_mixins.py
test/unit/ggrc/models/base_mixins.py
# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: anze@reciprocitylabs.com # Maintained By: anze@reciprocitylabs.com """Base class for testing mixins on models""" import unittest class BaseMixin...
Add base class for testing mixins and attributes
Add base class for testing mixins and attributes
Python
apache-2.0
NejcZupec/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-co...
--- +++ @@ -0,0 +1,35 @@ +# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file> +# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> +# Created By: anze@reciprocitylabs.com +# Maintained By: anze@reciprocitylabs.com + +"""Base class for testing mixins on models""" +...
ad37a8cf39e79c0988bd76e11615873993c394b6
randomXKCDPassword.py
randomXKCDPassword.py
#!/usr/bin/env python """ See https://xkcd.com/936/ for why you might want to generate these passphrases. Does require /usr/share/dict/words to be a file with words on multiple lines. On Debian derived OS like Ubuntu install wbritish-insane package and `sudo select-default-wordlist` to set it as th...
Add script to generate XKCD password.
Add script to generate XKCD password.
Python
mit
ddryden/legendary-octo-engine,ddryden/legendary-octo-engine
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python +""" + See https://xkcd.com/936/ for why you might want to generate these + passphrases. + + Does require /usr/share/dict/words to be a file with words on + multiple lines. On Debian derived OS like Ubuntu install wbritish-insane + package and `sudo selec...
fd3f0ab94beb19181636f190c79d3cd17ee03b36
test/interface/conflict-util.py
test/interface/conflict-util.py
#!/usr/bin/env python # Copyright 2010-2012 RethinkDB, all rights reserved. import sys, os, time sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) import driver, http_admin, scenario_common from vcoptparse import * op = OptParser() scenario_common.prepare_option_parser...
Create conflict in a more user-friendly way
Create conflict in a more user-friendly way
Python
apache-2.0
marshall007/rethinkdb,grandquista/rethinkdb,pap/rethinkdb,nviennot/rethinkdb,spblightadv/rethinkdb,rrampage/rethinkdb,jmptrader/rethinkdb,bpradipt/rethinkdb,grandquista/rethinkdb,sebadiaz/rethinkdb,niieani/rethinkdb,elkingtonmcb/rethinkdb,lenstr/rethinkdb,yaolinz/rethinkdb,scripni/rethinkdb,lenstr/rethinkdb,gavioto/ret...
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Copyright 2010-2012 RethinkDB, all rights reserved. +import sys, os, time +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))) +import driver, http_admin, scenario_common +from vcoptparse import * + +op = OptParser() +s...
b555659518097db41a02d505ebfaf88e828b2f30
tests/functional/test_endpoints.py
tests/functional/test_endpoints.py
# Copyright 2016 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 accompa...
Verify endpoint prefix matches service name
Verify endpoint prefix matches service name This protects us from cases where we mis-name the artifacts that we base our service names on. Generally these should be named based on the endpoint prefix, except in a handful of special cases.
Python
apache-2.0
boto/botocore,pplu/botocore
--- +++ @@ -0,0 +1,60 @@ +# Copyright 2016 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/ +#...
f54c8f3b40bf44c4ba0f9fd1d1b6187991c327d5
tests/lints/check-external-size.py
tests/lints/check-external-size.py
#!/usr/bin/env python # -*- coding: utf8 -*- """ This script checks that all the external archive included in the repository are as small as they can be. """ from __future__ import print_function import os import sys import glob ROOT = os.path.join(os.path.dirname(__file__), "..", "..") ERRORS = 0 # when adding new ...
Add a test checking the external archive size
Add a test checking the external archive size This should prevent size regressions
Python
bsd-3-clause
Luthaf/Chemharp,chemfiles/chemfiles,chemfiles/chemfiles,chemfiles/chemfiles,Luthaf/Chemharp,Luthaf/Chemharp,chemfiles/chemfiles
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- +""" +This script checks that all the external archive included in the repository are +as small as they can be. +""" +from __future__ import print_function +import os +import sys +import glob + +ROOT = os.path.join(os.path.dirname(__file__), ".."...
9893af1b94fc460d017d7bdc9306bb00660bd408
circle_fit/circle_fit.py
circle_fit/circle_fit.py
import numpy as np import matplotlib.pyplot as plt def func(w, wr, nr, c): return c / (wr**2 - w**2 + 1j * nr * wr**2) def circle_fit(data): # Take the real and imaginary parts x = data.real y = data.imag # Use the method from "Theoretical and Experimental Modal Analysis" p221 # Set up t...
Write simple least-squares fit, from "Theoretical and Experimental Modal Analysis"
Write simple least-squares fit, from "Theoretical and Experimental Modal Analysis"
Python
bsd-3-clause
torebutlin/cued_datalogger
--- +++ @@ -0,0 +1,67 @@ +import numpy as np + +import matplotlib.pyplot as plt + +def func(w, wr, nr, c): + return c / (wr**2 - w**2 + 1j * nr * wr**2) + +def circle_fit(data): + # Take the real and imaginary parts + x = data.real + y = data.imag + + # Use the method from "Theoretical and Experime...
9aef590c097f0544ff0e3f116a5d8547b5d4adc2
tools/filldb.py
tools/filldb.py
#!/usr/bin/env python from cli import * # directory of ukwords w = [x.replace('\n', '') for x in open('../ukwords_small')] essence = Variable('Essence', 1) coal = Variable('Coal', 1) iron = Variable('Iron', 1) oak = Variable('Oak', 1) yew = Variable('Yew', 1) tuna = Variable('Tuna', 1) salmon = Variable('Salmon', 1)...
Add FillDB; script to set up a test db.
Tools: Add FillDB; script to set up a test db.
Python
agpl-3.0
MerlijnWajer/SRL-Stats
--- +++ @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +from cli import * + +# directory of ukwords +w = [x.replace('\n', '') for x in open('../ukwords_small')] + +essence = Variable('Essence', 1) +coal = Variable('Coal', 1) +iron = Variable('Iron', 1) +oak = Variable('Oak', 1) +yew = Variable('Yew', 1) +tuna = Variable('...
07d2cb651903545d38a7e12f656d0fde920e7102
find-in-balanced-by-username.py
find-in-balanced-by-username.py
#!./env/bin/python """This is a workaround for https://github.com/balanced/balanced-api/issues/141 Usage (tested on Mac OS): [gittip] $ open `heroku config | swaddle - ./find-in-balanced-by-username.py foobar 2> /dev/null` The script will search for the user and print out the URI of their page in the Balanced da...
Add a script to workaround lack of account search
Add a script to workaround lack of account search Discovered the need for this in the course of #312. See also: https://github.com/balanced/balanced-api/issues/141
Python
cc0-1.0
mccolgst/www.gittip.com,bountysource/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,MikeFair/www.gittip.com,mccolgst/www.gittip.com,bountysource/www.gittip.com,MikeFair/www.gittip.com,eXcomm/gratipay.com,gratipay/gratipay.com,bountysource/www.gittip.com,gratipay/gratipay.com,eXcomm/gratipay.com,MikeFair/...
--- +++ @@ -0,0 +1,24 @@ +#!./env/bin/python +"""This is a workaround for https://github.com/balanced/balanced-api/issues/141 + +Usage (tested on Mac OS): + + [gittip] $ open `heroku config | swaddle - ./find-in-balanced-by-username.py foobar 2> /dev/null` + +The script will search for the user and print out the U...
f824dc45b49ab6fdac14ddea81fcca470253fd1f
open511/scripts/mtl_kml_to_open511.py
open511/scripts/mtl_kml_to_open511.py
import hashlib import sys import tempfile from django.contrib.gis.gdal import DataSource from lxml import etree import lxml.html from open511.serialization import roadevent_to_xml_element, get_base_open511_element JURISDICTION = 'converted.ville.montreal.qc.ca' ids_seen = set() class DummyRoadEvent(object): pa...
Add preliminary script to convert Ville de Montreal KML
Add preliminary script to convert Ville de Montreal KML
Python
mit
Open511/open511-server,Open511/open511-server,Open511/open511-server
--- +++ @@ -0,0 +1,75 @@ +import hashlib +import sys +import tempfile + +from django.contrib.gis.gdal import DataSource +from lxml import etree +import lxml.html + +from open511.serialization import roadevent_to_xml_element, get_base_open511_element + +JURISDICTION = 'converted.ville.montreal.qc.ca' + +ids_seen = set...
d4b3b0d9560ecf059c73d7c2e4395bb955575a78
CodeFights/messageFromBinaryCode.py
CodeFights/messageFromBinaryCode.py
#!/usr/local/bin/python # Code Fights Message from Binary Code Problem def messageFromBinaryCode(code): sz = 8 return ''.join([chr(int(code[i:i + sz], 2)) for i in range(0, len(code), sz)]) def main(): tests = [ ["010010000110010101101100011011000110111100100001", "Hello!"], ...
Solve Code Fights message from binary code problem
Solve Code Fights message from binary code problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,36 @@ +#!/usr/local/bin/python +# Code Fights Message from Binary Code Problem + + +def messageFromBinaryCode(code): + sz = 8 + return ''.join([chr(int(code[i:i + sz], 2)) for i in + range(0, len(code), sz)]) + + +def main(): + tests = [ + ["0100100001100101011011...
b20a8a86675c931c033600669b3909cb3c4e010d
examples/__init__.py
examples/__init__.py
import os import ujson HERE = os.path.abspath(os.path.dirname(__file__)) def load_api(filename): ''' Helper to load api specifications in the examples folder. Returns a nested dict appropriate for unpacking into Client or Service ''' api_filename = os.path.join(HERE, filename) with open(api_...
Add examples folder for small service demos
Add examples folder for small service demos
Python
mit
numberoverzero/pyservice
--- +++ @@ -0,0 +1,16 @@ +import os +import ujson + +HERE = os.path.abspath(os.path.dirname(__file__)) + + +def load_api(filename): + ''' + Helper to load api specifications in the examples folder. + + Returns a nested dict appropriate for unpacking into Client or Service + ''' + api_filename = os.path...
0d38954e4c595920fa707333835d043959c71d71
sqlinit.py
sqlinit.py
import sys sys.path.append('./sqlbase') from sqlalchemy import create_engine from sqlbase import Base, WeatherData DB_Connection = 'postgresql://weather:weather@localhost:5432/weather' engine = create_engine(DB_Connection) Base.metadata.create_all(engine)
Add script to populate the database
Add script to populate the database
Python
apache-2.0
josecastroleon/GroveWeatherPi
--- +++ @@ -0,0 +1,11 @@ +import sys + +sys.path.append('./sqlbase') + +from sqlalchemy import create_engine +from sqlbase import Base, WeatherData + +DB_Connection = 'postgresql://weather:weather@localhost:5432/weather' + +engine = create_engine(DB_Connection) +Base.metadata.create_all(engine)
9e23f0a0546c80cb348de5faad351b0ceb0b4837
Arrays/different_func.py
Arrays/different_func.py
""" Apply different function over an array """ def square(num): return num ** 2 def cube(num): return num ** 3 def is_pair(num): return num % 2 functions = [square, cube, is_pair] array = range(0,20) for elemn in array: value = map(lambda x: x(elemn), functions) print (elemn, value)
Add an awesome way to apply different functions over an array.
Add an awesome way to apply different functions over an array.
Python
mit
xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book,xdanielsb/Marathon-book
--- +++ @@ -0,0 +1,20 @@ +""" + Apply different function over an array +""" + +def square(num): + return num ** 2 + +def cube(num): + return num ** 3 + +def is_pair(num): + return num % 2 + +functions = [square, cube, is_pair] + +array = range(0,20) + +for elemn in array: + value = map(lambda x: x(elem...
2e72dcb52c23690c6f1b41cfff1948f18506293b
exercises/chapter_03/exercise_03_04/exercise_04_04.py
exercises/chapter_03/exercise_03_04/exercise_04_04.py
# 3-4 Guest List guest_list = ["Albert Einstein", "Isac Newton", "Marie Curie", "Galileo Galilei"] message = "Hi " + guest_list[0] + " you are invited to dinner at 7 on saturday." print(message) message = "Hi " + guest_list[1] + " you are invited to dinner at 7 on saturday." print(message) message = "Hi " + guest_l...
Add solution to exercise 4.4.
Add solution to exercise 4.4.
Python
mit
HenrikSamuelsson/python-crash-course
--- +++ @@ -0,0 +1,15 @@ +# 3-4 Guest List + +guest_list = ["Albert Einstein", "Isac Newton", "Marie Curie", "Galileo Galilei"] + +message = "Hi " + guest_list[0] + " you are invited to dinner at 7 on saturday." +print(message) + +message = "Hi " + guest_list[1] + " you are invited to dinner at 7 on saturday." +print...
a5f591a71e460130055aafd16b248f7f61d0c541
snippets/python/nested.py
snippets/python/nested.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest # To test this module: # python -m unittest -v nested def string_maxlen(txt,max_len=12): n = len(txt)...
Add subroutine to print a dictionary tree
Add subroutine to print a dictionary tree
Python
apache-2.0
nathanielng/code-templates,nathanielng/code-templates,nathanielng/code-templates
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import unittest + +# To test this module: +# python -m unittest -v nested + +def string...
cc764d3101324bc10e64664e7aac7af6a9fee85b
Core/communication_controller.py
Core/communication_controller.py
import socket import httplib class CommunicationControl(): def sendTCPMessage(self, ipAddress, port, message): BUFFER_SIZE = 1024 port = int(port) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ipAddress, port)) s.send(message) data = s.recv(BUFFER_SIZE) s.close() return data def se...
Move communication controller to the core
Move communication controller to the core
Python
mit
Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation
--- +++ @@ -0,0 +1,22 @@ +import socket +import httplib + +class CommunicationControl(): + def sendTCPMessage(self, ipAddress, port, message): + BUFFER_SIZE = 1024 + port = int(port) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((ipAddress, port)) + s.send(message) + data = s.recv(BUFFER_S...
5109ced931692a0c09efcd2dfc5131537b32e4cc
catalogue_api/get_api_versions.py
catalogue_api/get_api_versions.py
#!/usr/bin/env python # -*- encoding: utf-8 """ Prints information about which version of the API is currently running, so you can create a new set of pins. """ import os import boto3 import hcl API_DIR = os.path.dirname(os.path.realpath(__file__)) API_TF = os.path.join(API_DIR, 'terraform') def bold(message): ...
Add a script for getting the current versions of the API
Add a script for getting the current versions of the API
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
--- +++ @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 +""" +Prints information about which version of the API is currently running, +so you can create a new set of pins. +""" + +import os + +import boto3 +import hcl + + +API_DIR = os.path.dirname(os.path.realpath(__file__)) +API_TF = os.path.join(API...
f294b11f68787bd1a8424bb68229acdb1049e03b
parsetree_to_triple.py
parsetree_to_triple.py
import sys class Tag: # based on http://nlp.stanford.edu:8080/ner/process with classifier english.muc.7class.distsim.crf.ser.gz nill = 0 location = 1 time = 2 person = 3 organization = 4 money = 5 percent = 6 date = 7 class Node: """ One node of the parse tree. It is a group of words of ...
Create class for tree nodes.
Create class for tree nodes.
Python
agpl-3.0
ProjetPP/PPP-QuestionParsing-Grammatical,ProjetPP/PPP-QuestionParsing-Grammatical
--- +++ @@ -0,0 +1,40 @@ +import sys + +class Tag: # based on http://nlp.stanford.edu:8080/ner/process with classifier english.muc.7class.distsim.crf.ser.gz + nill = 0 + location = 1 + time = 2 + person = 3 + organization = 4 + money = 5 + percent = 6 + date = 7 + + +class Node: + """ + One node of the...
a3c1a83a44764564e8110cc0668a8ba463759d9b
indra/preassembler/make_wm_ontmap.py
indra/preassembler/make_wm_ontmap.py
from indra.sources import eidos from indra.sources.hume.make_hume_tsv import make_file from indra.java_vm import autoclass eidos_package = 'org.clulab.wm.eidos' if __name__ == '__main__': bbn_path = 'hume_examaples.tsv' make_file(bbn_path) sofia_path = 'sofia_examples.tsv' om = autoclass(eidos_packag...
Implement generating the ontology map
Implement generating the ontology map
Python
bsd-2-clause
pvtodorov/indra,johnbachman/belpy,bgyori/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,bgyori/indra,bgyori/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,pvtodorov/indra
--- +++ @@ -0,0 +1,20 @@ +from indra.sources import eidos +from indra.sources.hume.make_hume_tsv import make_file +from indra.java_vm import autoclass + +eidos_package = 'org.clulab.wm.eidos' + +if __name__ == '__main__': + bbn_path = 'hume_examaples.tsv' + make_file(bbn_path) + sofia_path = 'sofia_examples....
6187cb81c7d80dc05f25fb399a9d01ee61fa93d6
distarray/tests/test_odin_local.py
distarray/tests/test_odin_local.py
import numpy as np from distarray.client import DistArrayContext, DistArrayProxy from IPython.parallel import Client c = Client() dv = c[:] dac = DistArrayContext(dv) da = dac.empty((1024, 1024)) da.fill(2 * np.pi) def local(context): def wrap(fn): func_key = context._generate_key() context.vi...
Add a simple decorator for local evaluation of functions.
Add a simple decorator for local evaluation of functions.
Python
bsd-3-clause
RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray
--- +++ @@ -0,0 +1,52 @@ +import numpy as np +from distarray.client import DistArrayContext, DistArrayProxy +from IPython.parallel import Client + +c = Client() +dv = c[:] +dac = DistArrayContext(dv) + +da = dac.empty((1024, 1024)) +da.fill(2 * np.pi) + + +def local(context): + + def wrap(fn): + + func_key ...
6e4e5cb5d32ac650d5ae08b47fe8e1c9d7e2ec04
tests/test_cfg_thumb_firmware.py
tests/test_cfg_thumb_firmware.py
import os import angr from nose.tools import assert_equal, assert_true test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')) def test_thumb_firmware_cfg(): """ Test an ARM firmware sample. This tests CFG, but also the Gym (the ThumbSpotter, etc...
Add a new test using an ARM firmware
Add a new test using an ARM firmware
Python
bsd-2-clause
schieb/angr,schieb/angr,schieb/angr,angr/angr,angr/angr,angr/angr,iamahuman/angr,iamahuman/angr,iamahuman/angr
--- +++ @@ -0,0 +1,40 @@ + +import os + +import angr +from nose.tools import assert_equal, assert_true + +test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')) + + +def test_thumb_firmware_cfg(): + """ + Test an ARM firmware sample. + + This tests CFG...
841a84d940ff1dc8e4751ef31acb25bc3e1497da
tests/test_ppc64_initial_rtoc.py
tests/test_ppc64_initial_rtoc.py
#!/usr/bin/env python import nose import logging import cle import os test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.join('..', '..', 'binaries', 'tests')) def test_ppc64el_abiv2(): # ABIv2: 'TOC pointer register typically points to ...
Add test case for ppc64 initial rtoc value
Add test case for ppc64 initial rtoc value
Python
bsd-2-clause
angr/cle
--- +++ @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import nose +import logging +import cle + +import os +test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), + os.path.join('..', '..', 'binaries', 'tests')) + +def test_ppc64el_abiv2(): + # ABIv2: 'TO...
e7534c6d5fd5c7d76c56d48be12302b596b35d29
skyfield/tests/test_strs_and_reprs.py
skyfield/tests/test_strs_and_reprs.py
import textwrap from ..api import Topos, load from ..sgp4lib import EarthSatellite def dedent(s): return textwrap.dedent(s.rstrip()) def eph(): yield load('de421.bsp') def test_jpl_segment(eph): e = eph['mercury barycenter'] expected = dedent("""\ Segment 'de421.bsp' 0 SOLAR SYSTEM BARYCENTER...
Add test suite for str()'s and repr()'s
Add test suite for str()'s and repr()'s Before I jump into improvements to how the strings and reprs work, I really should have something in the unit tests about them. The clunky reporting from Sphinx's `make doctest`, which are the current tests that worry about strings and reprs, makes them awkward for development ...
Python
mit
skyfielders/python-skyfield,skyfielders/python-skyfield
--- +++ @@ -0,0 +1,60 @@ +import textwrap +from ..api import Topos, load +from ..sgp4lib import EarthSatellite + +def dedent(s): + return textwrap.dedent(s.rstrip()) + +def eph(): + yield load('de421.bsp') + +def test_jpl_segment(eph): + e = eph['mercury barycenter'] + expected = dedent("""\ + Segm...
63a98b84709c4e981ea3fcf5493849948146e21d
thecut/forms/tests/test_utils.py
thecut/forms/tests/test_utils.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.test import TestCase from mock import MagicMock from thecut.forms.utils import add_css_class class TestAddCssClass(TestCase): def test_add_new_css_class(self): widget = MagicMock() widget.attrs = {'class':...
Add unit test for add_css_class util function
Add unit test for add_css_class util function
Python
apache-2.0
thecut/thecut-forms,thecut/thecut-forms
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, unicode_literals +from django.test import TestCase +from mock import MagicMock +from thecut.forms.utils import add_css_class + + +class TestAddCssClass(TestCase): + def test_add_new_css_class(self): + widget = MagicMo...
4b3443d5cccf9a62ffceb7ea795ad0ef69811908
src/fft.py
src/fft.py
import cmath def fft0(xs): n, ys = len(xs), [] for i in range(n): yi = complex(0, 0) for j in range(n): yi += complex(xs[j]) * cmath.exp(complex(0, -2 * cmath.pi / n * i * j)) ys.append(yi) return ys if __name__ == '__main__': print(fft0([1, 2, 3]))
Add simple and untested FFT transform
Add simple and untested FFT transform
Python
mit
all3fox/algos-py
--- +++ @@ -0,0 +1,17 @@ +import cmath + +def fft0(xs): + n, ys = len(xs), [] + + for i in range(n): + yi = complex(0, 0) + + for j in range(n): + yi += complex(xs[j]) * cmath.exp(complex(0, -2 * cmath.pi / n * i * j)) + + ys.append(yi) + + return ys + +if __name__ == '__main_...
90ac14b61066f6039df5d1522b7ac6bd76779b7b
tests.py
tests.py
from tfidf_lsa import calculate_corpus_var import json import os import shutil import subprocess import unittest class TestMoviePepper(unittest.TestCase): def test_crawl(self): try: shutil.rmtree('./movie_scrape/crawls') os.remove('./movie_scrape/imdb.json') os.remove('...
Add a basic crawler and tfidf_lsa creation test
Add a basic crawler and tfidf_lsa creation test
Python
mit
hugo19941994/movie-pepper-back,hugo19941994/movie-pepper-back
--- +++ @@ -0,0 +1,38 @@ +from tfidf_lsa import calculate_corpus_var +import json +import os +import shutil +import subprocess +import unittest + +class TestMoviePepper(unittest.TestCase): + + def test_crawl(self): + try: + shutil.rmtree('./movie_scrape/crawls') + os.remove('./movie_sc...
d180b780487b81b06beb24e809cfb17fd2320e3f
tests/test_get_user_config.py
tests/test_get_user_config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_get_user_config -------------------- Tests formerly known from a unittest residing in test_config.py named """ import pytest @pytest.fixture(scope='function') def back_up_rc(request): """ Back up an existing cookiecutter rc and restore it after the tes...
Create new module for TestGetUserConfig with setup/teardown
Create new module for TestGetUserConfig with setup/teardown
Python
bsd-3-clause
audreyr/cookiecutter,jhermann/cookiecutter,drgarcia1986/cookiecutter,willingc/cookiecutter,stevepiercy/cookiecutter,0k/cookiecutter,benthomasson/cookiecutter,venumech/cookiecutter,benthomasson/cookiecutter,terryjbates/cookiecutter,dajose/cookiecutter,vincentbernat/cookiecutter,atlassian/cookiecutter,cguardia/cookiecutt...
--- +++ @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +test_get_user_config +-------------------- + +Tests formerly known from a unittest residing in test_config.py named +""" + +import pytest + + +@pytest.fixture(scope='function') +def back_up_rc(request): + """ + Back up an existing ...
bd5537414ed5d05eeab2c41b22af9d665823ccaf
api_v3/migrations/0008_v1_to_v2_attachments.py
api_v3/migrations/0008_v1_to_v2_attachments.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-08-26 13:12 from __future__ import unicode_literals import os.path from django.db import migrations from settings.settings import MEDIA_ROOT from ticket.models import TicketAttachment from api_v3.models import Attachment def generate_and_copy_old_file_nam...
Migrate v1 attachment file names.
Migrate v1 attachment file names.
Python
mit
occrp/id-backend
--- +++ @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.1 on 2017-08-26 13:12 +from __future__ import unicode_literals +import os.path + +from django.db import migrations + +from settings.settings import MEDIA_ROOT +from ticket.models import TicketAttachment +from api_v3.models import Attachment...
d89d783e9b4555eadf17467a9022fec2c73b3943
fdp-api/python/tests/dump_metadata.py
fdp-api/python/tests/dump_metadata.py
# # This script creates dump files of metadata in different formats upon requests to FDP. # from os import path, makedirs from urllib2 import urlopen, urlparse, Request from rdflib import Graph from logging import getLogger, StreamHandler, INFO from myglobals import * logger = getLogger(__name__) logger.setLevel(INF...
Add script to dump FDP metadata into files in different formats.
Add script to dump FDP metadata into files in different formats.
Python
apache-2.0
DTL-FAIRData/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,DTL-FAIRData/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint,NLeSC/ODEX-FAIRDataPoint
--- +++ @@ -0,0 +1,39 @@ +# +# This script creates dump files of metadata in different formats upon requests to FDP. +# + +from os import path, makedirs +from urllib2 import urlopen, urlparse, Request +from rdflib import Graph +from logging import getLogger, StreamHandler, INFO +from myglobals import * + + +logger = ...
8994ca798a9cc2971954ce2b30bb6b5284c6e927
twinkles/PostageStampMaker.py
twinkles/PostageStampMaker.py
import lsst.afw.geom as afwGeom import lsst.afw.image as afwImage class PostageStampMaker(object): def __init__(self, expfile): self.exposure = afwImage.ExposureF(expfile) def getScienceArray(self): return self.exposure.getMaskedImage().getImage().getArray() def getBBox(self, ra, dec, arcs...
Use Stack to create postage stamps from Exposure (specifically CoaddTempExp) images
Use Stack to create postage stamps from Exposure (specifically CoaddTempExp) images
Python
mit
LSSTDESC/Twinkles,DarkEnergyScienceCollaboration/Twinkles,DarkEnergyScienceCollaboration/Twinkles,LSSTDESC/Twinkles
--- +++ @@ -0,0 +1,36 @@ +import lsst.afw.geom as afwGeom +import lsst.afw.image as afwImage + + +class PostageStampMaker(object): + def __init__(self, expfile): + self.exposure = afwImage.ExposureF(expfile) + def getScienceArray(self): + return self.exposure.getMaskedImage().getImage().getArray()...
87460f7ff5d5079cffb7f1c02930fea2f891d3f0
wafer/management/commands/pycon_speaker_contact_details.py
wafer/management/commands/pycon_speaker_contact_details.py
import sys import csv from optparse import make_option from django.core.management.base import BaseCommand from django.contrib.auth.models import User from wafer.conf_registration.models import RegisteredAttendee from wafer.talks.models import ACCEPTED class Command(BaseCommand): help = "List contact details fo...
Add a query command for easily finding people without contact info
Add a query command for easily finding people without contact info
Python
isc
CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer
--- +++ @@ -0,0 +1,46 @@ +import sys +import csv +from optparse import make_option + +from django.core.management.base import BaseCommand + +from django.contrib.auth.models import User +from wafer.conf_registration.models import RegisteredAttendee +from wafer.talks.models import ACCEPTED + + +class Command(BaseComman...
a06796003e72cee518e66c7250afc3e4aec6ab7a
codingame/medium/dwarfs_standing.py
codingame/medium/dwarfs_standing.py
from collections import defaultdict def traverseRelations(relations, children, length): if len(children) == 0: return length lengths = [] for child in children: lengths.append(traverseRelations(relations, relations[child], length + 1)) return max(lengths) # The number of relationshi...
Add exercise Dwarfs standing on the shoulders of giants
Add exercise Dwarfs standing on the shoulders of giants
Python
mit
AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas
--- +++ @@ -0,0 +1,27 @@ +from collections import defaultdict + + +def traverseRelations(relations, children, length): + if len(children) == 0: + return length + + lengths = [] + for child in children: + lengths.append(traverseRelations(relations, relations[child], length + 1)) + + return ma...
c7e45b8f5eb06b2bd1934b357ae44b968375ed6f
geotrek/infrastructure/migrations/0024_auto_20210716_1043.py
geotrek/infrastructure/migrations/0024_auto_20210716_1043.py
# Generated by Django 3.1.13 on 2021-07-16 10:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('infrastructure', '0023_auto_20210716_0738'), ] operations = [ migrations.AlterField( model_nam...
Fix add help text on forms with migration
Fix add help text on forms with migration
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
--- +++ @@ -0,0 +1,24 @@ +# Generated by Django 3.1.13 on 2021-07-16 10:43 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('infrastructure', '0023_auto_20210716_0738'), + ] + + operations = [ + mig...
a6b92bba1c92a2d324b6c1f1602dae0559859356
graffiti/descriptor.py
graffiti/descriptor.py
import copy from itertools import chain from graffiti import util example = { "a": lambda b: 1, "b": lambda c: 2, "c": lambda: 3 } def mapkv(fn, d): return dict(fn(k, v) for k, v in d.iteritems()) def map_keys(fn, d): return mapkv(lambda k, v: (fn(k), v), d) def map_vals(fn, d): return mapk...
Add graph compile with topological sort
Add graph compile with topological sort
Python
mit
SegFaultAX/graffiti
--- +++ @@ -0,0 +1,58 @@ +import copy +from itertools import chain + +from graffiti import util + +example = { + "a": lambda b: 1, + "b": lambda c: 2, + "c": lambda: 3 +} + +def mapkv(fn, d): + return dict(fn(k, v) for k, v in d.iteritems()) + +def map_keys(fn, d): + return mapkv(lambda k, v: (fn(k), v...
ad425b73ab396532b042e8b01be00af6024ef910
apps/meetup/tests/test_models.py
apps/meetup/tests/test_models.py
# coding: utf-8 import datetime from django.test import TestCase, override_settings from unittest.mock import patch from embedly import Embedly from apps.meetup.models import Talk, Event, Speaker class FakeOembed(): _data = {"key": "value"} class TalkTestCase(TestCase): def setUp(self): self.event ...
Test for Embedly in Talk
Test for Embedly in Talk
Python
bsd-3-clause
moscowpython/moscowpython,VladimirFilonov/moscowdjango,VladimirFilonov/moscowdjango,moscowpython/moscowpython,moscowpython/moscowpython,VladimirFilonov/moscowdjango,moscowdjango/moscowdjango,moscowdjango/moscowdjango,moscowdjango/moscowdjango
--- +++ @@ -0,0 +1,57 @@ +# coding: utf-8 +import datetime +from django.test import TestCase, override_settings +from unittest.mock import patch +from embedly import Embedly +from apps.meetup.models import Talk, Event, Speaker + + +class FakeOembed(): + _data = {"key": "value"} + + +class TalkTestCase(TestCase): +...
1a12130c7be8b36a905de7000661d1ff91ed808c
osf/management/commands/checkmigrations.py
osf/management/commands/checkmigrations.py
""" Return a non-zero exit code if there are unapplied migrations. """ import sys from django.db import connections, DEFAULT_DB_ALIAS from django.db.migrations.executor import MigrationExecutor from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): ...
Add a management command to check for unapplied migrations.
Add a management command to check for unapplied migrations. [PLAT-972]
Python
apache-2.0
mfraezz/osf.io,brianjgeiger/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,CenterForOpenScience/osf.io,sloria/osf.io,adlius/osf.io,HalcyonChimera/osf.io,cslzchen/osf.io,mattclark/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io...
--- +++ @@ -0,0 +1,23 @@ +""" +Return a non-zero exit code if there are unapplied migrations. +""" +import sys + +from django.db import connections, DEFAULT_DB_ALIAS +from django.db.migrations.executor import MigrationExecutor +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + + ...
097464150228c3b5ba7cfb94619363cfea1fba1d
user-scripts/katia/code-LUI-secmin-isl.py
user-scripts/katia/code-LUI-secmin-isl.py
#!/usr/bin/env python3 import os import sys import rasterio from projections.rasterset import RasterSet import projections.predicts as predicts import projections.utils as utils # Import standard PREDICTS rasters rasters = predicts.rasterset('1km', 'medium', year = 2005) for suffix in ('islands', 'mainland'): # O...
Add script to generate LUI rasters for Katia
Add script to generate LUI rasters for Katia This script iterates through every land-use x intensity and writes out the raster for the LUI.
Python
apache-2.0
ricardog/raster-project,ricardog/raster-project,ricardog/raster-project,ricardog/raster-project,ricardog/raster-project
--- +++ @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +import os +import sys + +import rasterio +from projections.rasterset import RasterSet +import projections.predicts as predicts +import projections.utils as utils + +# Import standard PREDICTS rasters +rasters = predicts.rasterset('1km', 'medium', year = 2005) + +for...
ebf89478f7c841ee7d61a4081d4d6ba2f2cabe05
app/main/auth.py
app/main/auth.py
from functools import wraps from flask import abort from flask_login import current_user def role_required(*roles): """Ensure that logged in user has one of the required roles. Return 403 if the user doesn't have a required role. Should be applied before the `@login_required` decorator: @login...
Add `role_required` view decorator to check current_user role
Add `role_required` view decorator to check current_user role Returns 403 if user has none of the roles listed in the decorator arguments.
Python
mit
alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend,alphagov/digitalmarketplace-admin-frontend
--- +++ @@ -0,0 +1,30 @@ +from functools import wraps + +from flask import abort +from flask_login import current_user + + +def role_required(*roles): + """Ensure that logged in user has one of the required roles. + + Return 403 if the user doesn't have a required role. + + Should be applied before the `@log...
ff5587bc44bde955e456ed87e7ed5822ec3e500a
tests/webcam_framerate.py
tests/webcam_framerate.py
#!/usr/bin/env python import qrtools, gi, os gi.require_version('Gtk', '3.0') gi.require_version('Gst', '1.0') from gi.repository import Gtk, Gst from avocado import Test from utils import webcam class WebcamReadQR(Test): """ Uses the camera selected by v4l2src by default (/dev/video0) to get the framerat...
Add initial framerate webcam test structure
Add initial framerate webcam test structure
Python
mit
daveol/Fedora-Test-Laptop,daveol/Fedora-Test-Laptop
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +import qrtools, gi, os +gi.require_version('Gtk', '3.0') +gi.require_version('Gst', '1.0') +from gi.repository import Gtk, Gst +from avocado import Test +from utils import webcam + +class WebcamReadQR(Test): + """ + Uses the camera selected by v4l2src by defaul...
13a02d424fadd4401d393b2443dc97183c933221
simple-client-api/request-workflow-exec/python2_3/src/request-workflow-exec.py
simple-client-api/request-workflow-exec/python2_3/src/request-workflow-exec.py
#!/usr/bin/python from boto3.session import Session import sys import os import uuid import time def get_env(name): if name in os.environ: return os.environ[name] return None aws_args = { 'aws_access_key_id': get_env('AWS_ACCESS_KEY'), 'aws_secret_access_key': get_env('AWS_...
Add python (boto3-based) simple api workflow request script.
Add python (boto3-based) simple api workflow request script.
Python
apache-2.0
groboclown/whimbrel,groboclown/whimbrel,groboclown/whimbrel,groboclown/whimbrel
--- +++ @@ -0,0 +1,81 @@ +#!/usr/bin/python + +from boto3.session import Session +import sys +import os +import uuid +import time + + +def get_env(name): + if name in os.environ: + return os.environ[name] + return None + + +aws_args = { + 'aws_access_key_id': get_env('AWS_ACCESS_KEY'), + 'aws_secre...
5cdfbce122ec0248104049760dadc1c83a01f7fb
tests/frontends/mpd/regression_test.py
tests/frontends/mpd/regression_test.py
import unittest from mopidy.backends.dummy import DummyBackend from mopidy.frontends.mpd import dispatcher from mopidy.mixers.dummy import DummyMixer from mopidy.models import Track class IssueGH18RegressionTest(unittest.TestCase): """ The issue: http://github.com/jodal/mopidy/issues#issue/18 How to repr...
Add regression test for GH-18
Add regression test for GH-18
Python
apache-2.0
ZenithDK/mopidy,mopidy/mopidy,kingosticks/mopidy,vrs01/mopidy,vrs01/mopidy,jcass77/mopidy,jodal/mopidy,mokieyue/mopidy,adamcik/mopidy,tkem/mopidy,glogiotatidis/mopidy,rawdlite/mopidy,mokieyue/mopidy,pacificIT/mopidy,bacontext/mopidy,bacontext/mopidy,mopidy/mopidy,bencevans/mopidy,liamw9534/mopidy,ZenithDK/mopidy,SuperS...
--- +++ @@ -0,0 +1,41 @@ +import unittest + +from mopidy.backends.dummy import DummyBackend +from mopidy.frontends.mpd import dispatcher +from mopidy.mixers.dummy import DummyMixer +from mopidy.models import Track + +class IssueGH18RegressionTest(unittest.TestCase): + """ + The issue: http://github.com/jodal/mo...
7cfc6abb8e573b0dd996f5849480a72652201279
consolidate_stats.py
consolidate_stats.py
### # Call this with 4 parameters: the file to read data from, the file to read # extradata from, the file to write the combined data to, the slack interval # to match data and extradata timestamps. # # IMPORTANT: You need to manually sort -g the data file, because torperf # might screw up ordering and this s...
Add a script to combine data and extradata
Add a script to combine data and extradata
Python
bsd-3-clause
meejah/torperf,meejah/torperf,meejah/torperf,aaronsw/torperf,aaronsw/torperf,mrphs/torperf,mrphs/torperf,aaronsw/torperf,mrphs/torperf,meejah/torperf
--- +++ @@ -0,0 +1,88 @@ +### +# Call this with 4 parameters: the file to read data from, the file to read +# extradata from, the file to write the combined data to, the slack interval +# to match data and extradata timestamps. +# +# IMPORTANT: You need to manually sort -g the data file, because torperf +# ...
821ae1f40c643d0ee2f9cbdfbce83c6f75196895
quantum/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py
quantum/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 OpenStack LLC # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
Add migration for network bindings in NVP plugin
Add migration for network bindings in NVP plugin Bug 1099895 Ensures the table nvp_network_bindings is created when upgrading database to head, by adding an appropriate alembic migration Change-Id: I4a794ed0ec6866d657cb2470d5aa67828e81aa75
Python
apache-2.0
gkotton/vmware-nsx,gkotton/vmware-nsx
--- +++ @@ -0,0 +1,63 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# Copyright 2013 OpenStack LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://ww...
9bdf597477d513b84de84a6872e15833c25efa19
src/location_fetch.py
src/location_fetch.py
#!env python import database as db from database.model import Team, RouteDistance from geotools import simple_distance from geotools.routing import MapPoint from webapp.cfg.config import DB_CONNECTION print "init db..." db.init_session(connection_string=DB_CONNECTION) print "fetch teams..." teams = db.session.query(...
Add a helper script for initial distance fetch.
Add a helper script for initial distance fetch.
Python
bsd-3-clause
janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system
--- +++ @@ -0,0 +1,30 @@ +#!env python + +import database as db +from database.model import Team, RouteDistance +from geotools import simple_distance +from geotools.routing import MapPoint +from webapp.cfg.config import DB_CONNECTION + +print "init db..." +db.init_session(connection_string=DB_CONNECTION) + +print "fe...
ed8add068ef8cdbbe8bed412272a8a608e003bb9
tests/integration/modules/mac_service.py
tests/integration/modules/mac_service.py
# -*- coding: utf-8 -*- ''' integration tests for mac_service ''' # Import python libs from __future__ import absolute_import, print_function # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath, destructiveTest ensure_in_syspath('../../') # Import salt libs import integration import salt.uti...
Add integration tests basic framework
Add integration tests basic framework
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
--- +++ @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +''' +integration tests for mac_service +''' + +# Import python libs +from __future__ import absolute_import, print_function + +# Import Salt Testing libs +from salttesting.helpers import ensure_in_syspath, destructiveTest +ensure_in_syspath('../../') + +# Import salt...
3b9a79e20bc3e48b44087c8c78e519e7085bce92
backend/scripts/conversion/addprojs.py
backend/scripts/conversion/addprojs.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser def main(conn): groups = list(r.table('usergroups').run(conn)) for group in groups: owner = group['owner'] projects = list(r.table('projects').filter({'owner': owner}) .pluck('id', 'name').ru...
Add projects field to samples and usergroups.
Add projects field to samples and usergroups.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import rethinkdb as r +from optparse import OptionParser + + +def main(conn): + groups = list(r.table('usergroups').run(conn)) + for group in groups: + owner = group['owner'] + projects = list(r.table('projects').filter({'owner': owner}) + ...
d4eb11f846da5b38a56599ca18d68fd2344dec7c
DilipadCorpus.py
DilipadCorpus.py
"""Class to access dilipad corpus.""" import gensim import glob import codecs class DilipadCorpus(gensim.corpora.TextCorpus): def get_texts(self): for txt in self.input: with codecs.open(txt, 'rb', 'utf8') as f: words = f.read().split() yield words def __l...
Add class to access dilipad text data
Add class to access dilipad text data Currently only the nouns (topic words) are accessed. This class must be updated to also return the opinion words of a text. The idea is to have such a corpus per perspective for cross perspective topic modeling.
Python
apache-2.0
NLeSC/cptm,NLeSC/cptm
--- +++ @@ -0,0 +1,39 @@ +"""Class to access dilipad corpus.""" + +import gensim +import glob +import codecs + + +class DilipadCorpus(gensim.corpora.TextCorpus): + def get_texts(self): + for txt in self.input: + with codecs.open(txt, 'rb', 'utf8') as f: + words = f.read().split() +...
e850ab188e73f91bb4d85954d5f957ceb90d069a
cloudaux/tests/gcp/test_integration.py
cloudaux/tests/gcp/test_integration.py
import pytest import os from cloudaux.gcp.iam import get_project_iam_policy from cloudaux.gcp.gce.project import get_project from cloudaux.gcp.crm import get_iam_policy from cloudaux.gcp.gce.address import ( list_addresses, list_global_addresses, ) from cloudaux.gcp.gce.disk import ( list_disks, ) from clo...
Add an integration test (disabled by default).
Add an integration test (disabled by default). This gives a way to check the Cloudaux GCP resource retrieval against a GCP test project. They are disabled unless the CLOUDAUX_GCP_TEST_PROJECT environment variable is defined.
Python
apache-2.0
Netflix-Skunkworks/cloudaux
--- +++ @@ -0,0 +1,58 @@ +import pytest +import os + +from cloudaux.gcp.iam import get_project_iam_policy +from cloudaux.gcp.gce.project import get_project +from cloudaux.gcp.crm import get_iam_policy +from cloudaux.gcp.gce.address import ( + list_addresses, + list_global_addresses, +) +from cloudaux.gcp.gce.di...
915364b232bfa5a433962bd474074d985a39d7fa
2_basic/recursion/recursion_examples.py
2_basic/recursion/recursion_examples.py
# -*- coding: utf-8 -*- """ A function is recursive when it calls itself (on a smaller piece of the problem). We need to provide a 'stopping criterion' or else the function will call itself indefinitely (therefore hanging the program). http://en.wikipedia.org/wiki/Recursion_(computer_science) ...
Add some simple recursion examples
Add some simple recursion examples
Python
mit
nightmarebadger/tutorials-python-basic
--- +++ @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +""" + A function is recursive when it calls itself (on a smaller piece of the + problem). We need to provide a 'stopping criterion' or else the function + will call itself indefinitely (therefore hanging the program). + http://en.wikipedia.org/wiki/...
f79edb442849785f3180756973a30eaff72d9821
freertos.py
freertos.py
import os.path def sources(base, port, mem_mang=None): core_src_names = [ 'croutine.c', 'event_groups.c', 'list.c', 'queue.c', 'stream_buffer.c', 'tasks.c', 'timers.c'] core_srcs = [os.path.join(base, 'Source', f) for f in core_src_names] port_path ...
Add utility module for compiling FreeRTOS
Add utility module for compiling FreeRTOS
Python
apache-2.0
google/cortex-demos,google/cortex-demos,google/cortex-demos,google/cortex-demos
--- +++ @@ -0,0 +1,47 @@ +import os.path + +def sources(base, port, mem_mang=None): + core_src_names = [ + 'croutine.c', + 'event_groups.c', + 'list.c', + 'queue.c', + 'stream_buffer.c', + 'tasks.c', + 'timers.c'] + + core_srcs = [os.path.join(base, 'Source', f) ...
df21b1d8e16dd2c1893b46b95608f85b62fe2081
src/stratisd_client_dbus/_implementation.py
src/stratisd_client_dbus/_implementation.py
# Copyright 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
Add a simple super-class for interface definitions.
Add a simple super-class for interface definitions. Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
Python
mpl-2.0
stratis-storage/stratisd,trgill/stratisd,mulkieran/stratisd,stratis-storage/stratisd-client-dbus,trgill/stratisd,stratis-storage/stratisd,mulkieran/stratisd,stratis-storage/stratisd
--- +++ @@ -0,0 +1,72 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by ap...
9d1e404eaf8e78efd6117266baf86ff3228915da
src/img2line.py
src/img2line.py
# -*- coding: utf-8 -*- import numpy as np from PIL import Image from pylab import * import types from skimage import io, data # 读取图片,灰度化,并转为数组 im0 = Image.open("test.jpeg").convert('L') im = array(im0) # print(type(im[1, 1])) x = y = 0 m = im.shape[0] n = im.shape[1] h = range(m - 2) k = range(n - 2) matrix = np.ar...
Convert a image to many lines.
Convert a image to many lines.
Python
apache-2.0
xpeng2333/robodraw,xpeng2333/robodraw,xpeng2333/robodraw,xpeng2333/robodraw
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +import numpy as np +from PIL import Image +from pylab import * +import types +from skimage import io, data + +# 读取图片,灰度化,并转为数组 +im0 = Image.open("test.jpeg").convert('L') +im = array(im0) + +# print(type(im[1, 1])) + +x = y = 0 +m = im.shape[0] +n = im.shape[1] +h = ...
291538ca1de9605865d35cd8e30e4cd2f8a74cd3
wagtail/admin/tests/ui/test_side_panels.py
wagtail/admin/tests/ui/test_side_panels.py
from unittest import TestCase from wagtail.admin.ui.side_panels import BaseSidePanel, BaseSidePanels class SidePanelA(BaseSidePanel): order = 300 class SidePanelB(BaseSidePanel): order = 200 class SidePanelC(BaseSidePanel): order = 400 class MySidePanels(BaseSidePanels): def __init__(self, requ...
Add test for ensuring side panel ordering
Add test for ensuring side panel ordering
Python
bsd-3-clause
zerolab/wagtail,thenewguy/wagtail,zerolab/wagtail,thenewguy/wagtail,wagtail/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,thenewguy/wagtail,wagtail/wagtail,wagtail/wagtail,wagtail/wagtail,zerolab/wagtail,wagtail/wagtail,thenewguy/wagtail,zerolab/wagtail,zerolab/wagtail,rsalmaso/wagtail,rsalmaso/wagtail,thenewguy/wagtail,rs...
--- +++ @@ -0,0 +1,34 @@ +from unittest import TestCase + +from wagtail.admin.ui.side_panels import BaseSidePanel, BaseSidePanels + + +class SidePanelA(BaseSidePanel): + order = 300 + + +class SidePanelB(BaseSidePanel): + order = 200 + + +class SidePanelC(BaseSidePanel): + order = 400 + + +class MySidePanels...
a52001442a4cb18734fff98a01f175c57c9dbf81
fedimg/services/ec2/ec2imgpublisher.py
fedimg/services/ec2/ec2imgpublisher.py
# This file is part of fedimg. # Copyright (C) 2014-2017 Red Hat, Inc. # # fedimg is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version...
Write a publisher that would make the images & the snapshot public
ec2: Write a publisher that would make the images & the snapshot public Signed-off-by: Sayan Chowdhury <5f0367a2b3b757615b57f51d912cf16f2c0ad827@gmail.com>
Python
agpl-3.0
fedora-infra/fedimg,fedora-infra/fedimg
--- +++ @@ -0,0 +1,64 @@ +# This file is part of fedimg. +# Copyright (C) 2014-2017 Red Hat, Inc. +# +# fedimg is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or ...
a617c4bd3b38b2d364a3f12a0cb066559f8c8ae3
tests/test_alchemy.py
tests/test_alchemy.py
import unittest import sqlalchemy as sa from pga.alchemy import sa_column_dict_to_column class TestAlchemySchema(unittest.TestCase): def test_sa_column_dict_to_column(self): column_name = 'my_mock_column' column_type = sa.CHAR(length=2) nullable = False attributes = { ...
Add specification for alchemy schema.
Add specification for alchemy schema.
Python
mit
portfoliome/pgawedge
--- +++ @@ -0,0 +1,24 @@ +import unittest + +import sqlalchemy as sa + +from pga.alchemy import sa_column_dict_to_column + + +class TestAlchemySchema(unittest.TestCase): + + def test_sa_column_dict_to_column(self): + column_name = 'my_mock_column' + column_type = sa.CHAR(length=2) + nullable =...
0cd94c71db19c0a53d1d97f353116e271884a336
utils/sort_includes.py
utils/sort_includes.py
#!/usr/bin/env python """Script to sort the top-most block of #include lines. Assumes the LLVM coding conventions. Currently, this script only bothers sorting the llvm/... headers. Patches welcome for more functionality, and sorting other header groups. """ import argparse import os import re import sys import temp...
Add a completely hack-ish tool to sort includes according to the coding standards.
Add a completely hack-ish tool to sort includes according to the coding standards. I am a terrible Python programmer. Patches more the welcome. Please tell me how this should look if it should look differently. It's just a tiny little script so it didn't make sense to go through pre-commit review, especially as someon...
Python
bsd-2-clause
dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,chubbymaggie/asap,apple/swift-llvm,apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,chubbymaggie/asap,app...
--- +++ @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +"""Script to sort the top-most block of #include lines. + +Assumes the LLVM coding conventions. + +Currently, this script only bothers sorting the llvm/... headers. Patches +welcome for more functionality, and sorting other header groups. +""" + +import argparse +imp...
8e5617d8c0279c871c0d78bc3ad5d3676d35cbce
setup.py
setup.py
#from distutils.core import setup from setuptools import setup filename = 'tweetfeels/version.py' exec(compile(open(filename, "rb").read(), filename, 'exec')) setup(name='tweetfeels', version=__version__, description='Real-time sentiment analysis for twitter.', author='Thomas Chen', author_ema...
#from distutils.core import setup from setuptools import setup import os try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') except(IOError, ImportError): long_description = 'Real-time sentiment analysis for twitter.' filename = 'tweetfeels/version.py' exec(compile(open(filename, ...
Use pandoc to convert read to rst and supply that as long_description to pypi.
Use pandoc to convert read to rst and supply that as long_description to pypi.
Python
bsd-3-clause
uclatommy/tweetfeels
--- +++ @@ -1,5 +1,12 @@ #from distutils.core import setup from setuptools import setup +import os + +try: + import pypandoc + long_description = pypandoc.convert('README.md', 'rst') +except(IOError, ImportError): + long_description = 'Real-time sentiment analysis for twitter.' filename = 'tweetfeels/ve...
ed48ce514c40e0f4e68e691091ed5bad91f273a6
python/runRoot2json.py
python/runRoot2json.py
""" 1 July 2017 Dan Marley daniel.edison.marley@cernSPAMNOT.ch Texas A&M University ----- Execute the root2json class to convert ROOT data into JSON format for neural network training/testing/etc. in python. """ from info import VERBOSE from root2json import Root2json vb = VERBOSE() vb.level = "INFO" vb.INFO("RUN >...
Add missing script to use the root2json class
Add missing script to use the root2json class
Python
mit
cms-ttbarAC/CyMiniAna,cms-ttbarAC/CyMiniAna,cms-ttbarAC/CyMiniAna
--- +++ @@ -0,0 +1,53 @@ +""" +1 July 2017 + +Dan Marley +daniel.edison.marley@cernSPAMNOT.ch +Texas A&M University +----- + +Execute the root2json class to convert +ROOT data into JSON format for neural network +training/testing/etc. in python. +""" +from info import VERBOSE +from root2json import Root2json + +vb = ...
ea63340282b7eba0d4b4f357808b8e374a3fcdf8
usr/examples/14-WiFi-Shield/fw_update.py
usr/examples/14-WiFi-Shield/fw_update.py
''' Firmware update examples Note: copy the WINC1500/firmware folder to uSD ''' import time, network # Init wlan module in Download mode wlan = network.WINC(True) #print("Firmware version:", wlan.fw_version()) # Start the firmware update process. wlan.fw_update() #print("Firmware version:", wlan.fw_version())
Add WINC1500 fw update script.
Add WINC1500 fw update script.
Python
mit
kwagyeman/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv
--- +++ @@ -0,0 +1,13 @@ +''' + Firmware update examples + Note: copy the WINC1500/firmware folder to uSD +''' +import time, network + +# Init wlan module in Download mode +wlan = network.WINC(True) +#print("Firmware version:", wlan.fw_version()) + +# Start the firmware update process. +wlan.fw_update() +#print...
8ac4de6438488f3a24b13959e4effa644474609b
cocktails/drinks/migrations/0003_drink_owner.py
cocktails/drinks/migrations/0003_drink_owner.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-02 23:00 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependen...
Fix default value for owner
Fix default value for owner
Python
mit
jake-jake-jake/cocktails,jake-jake-jake/cocktails,jake-jake-jake/cocktails,jake-jake-jake/cocktails
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-02 23:00 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = ...
3465cd435547444d16c6ce479f22371b6fa00c4d
printjson.py
printjson.py
#!/usr/bin/env python3 import json from pprint import pprint with open('data.json') as data_file: data = json.load(data_file) pprint(data)
Read and print json data test.
Read and print json data test.
Python
mit
magnetmagnate/daily-grind,magnetmagnate/daily-grind
--- +++ @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import json +from pprint import pprint + +with open('data.json') as data_file: + data = json.load(data_file) + +pprint(data) +
c59d27223af702a55a603cfab5e06a4579a4435b
scipy/interpolate/tests/test_gil.py
scipy/interpolate/tests/test_gil.py
from __future__ import division, print_function, absolute_import import itertools import threading import time import numpy as np from numpy.testing import TestCase, assert_equal, run_module_suite from numpy.testing.decorators import slow import scipy.interpolate from scipy._lib._testutils import knownfailure_overrid...
Add a test for GIL release in scipy.interpolate.RectBivariateSpline.
TST: Add a test for GIL release in scipy.interpolate.RectBivariateSpline.
Python
bsd-3-clause
perimosocordiae/scipy,pizzathief/scipy,niknow/scipy,Shaswat27/scipy,Newman101/scipy,Gillu13/scipy,tylerjereddy/scipy,fernand/scipy,ortylp/scipy,newemailjdm/scipy,jjhelmus/scipy,vanpact/scipy,giorgiop/scipy,mortada/scipy,surhudm/scipy,felipebetancur/scipy,jseabold/scipy,endolith/scipy,futurulus/scipy,vanpact/scipy,rgomm...
--- +++ @@ -0,0 +1,71 @@ +from __future__ import division, print_function, absolute_import + +import itertools +import threading +import time + +import numpy as np +from numpy.testing import TestCase, assert_equal, run_module_suite +from numpy.testing.decorators import slow +import scipy.interpolate +from scipy._lib....
1d67482432ec56ee66d6fd7f6604d73f6d1a495f
ipplan2sqlite/tests/TestParser.py
ipplan2sqlite/tests/TestParser.py
import os import sqlite3 import sys import unittest path = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '../lib' ) ) sys.path.insert( 1, path ) import parser class TestParser(unittest.TestCase): def setUp(self): self.conn = sqlite3.connect(':memory:') def testParseIPv4(self): self.assertE...
Add first couple of unit tests for ipplan2sqlite
Add first couple of unit tests for ipplan2sqlite
Python
bsd-3-clause
nlindblad/ipplan2sqlite,nlindblad/ipplan2sqlite,nlindblad/ipplan2sqlite,nlindblad/ipplan2sqlite,nlindblad/ipplan2sqlite
--- +++ @@ -0,0 +1,28 @@ +import os +import sqlite3 +import sys +import unittest + +path = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '../lib' ) ) +sys.path.insert( 1, path ) +import parser + +class TestParser(unittest.TestCase): + + def setUp(self): + self.conn = sqlite3.connect(':memory:') + + ...
051d00f65d4f5a8f03c7a91dcd1a74b454fd7943
test-CijUtil.py
test-CijUtil.py
import CijUtil import numpy as np import unittest class TestInvertCijFunctions(unittest.TestCase): def setUp(self): self.inmatrix = np.matrix([[0.700, 0.200],[0.400, 0.600]]) self.inerrors = np.matrix([[0.007, 0.002],[0.004, 0.006]]) self.true_inv = np.matrix([[1.765, -0.588],[-1.177, 2.05...
Test harness and tests for the invert function
Test harness and tests for the invert function
Python
bsd-3-clause
andreww/elastic-constants,duyuan11/elastic-constants
--- +++ @@ -0,0 +1,37 @@ +import CijUtil +import numpy as np +import unittest + +class TestInvertCijFunctions(unittest.TestCase): + + def setUp(self): + self.inmatrix = np.matrix([[0.700, 0.200],[0.400, 0.600]]) + self.inerrors = np.matrix([[0.007, 0.002],[0.004, 0.006]]) + self.true_inv = np....