Skip to content

Instantly share code, notes, and snippets.

schemaDict = schema.extract("*")
parentKey = schemaDict.get(self.config.parentForStarSelection, (None,))[0]
nChildKey = schemaDict.get(self.config.nChildForStarSelection, (None,))[0]
[.. etc ..]
def checkStar(checkSource):
"""
Return True if we should use this star, false otherwise.
"""
def test_gn():
yield from range(10)
def test_ls():
return list(range(10))
def test_both(gen=False):
if gen:
print("Using generator...")
x = test_gn()
scons: Reading SConscript files ...
EUPS integration: enabled
Checking who built the CC compiler...error: no result
CC is gcc version 4.9.2
Checking for C++11 support
Checking whether the C++ compiler works... yes
C++11 supported with '-std=c++11'
Mkdir(".scons")
scons: done reading SConscript files.
scons: Building targets ...
def start_pipelines(result):
pipe1 = connect(...)
pipe2 = connect(...)
pipe3 = connect(...)
return DeferredList([pipe1, pipe2, pipe3])
server.addCallback(start_pipelines)
+ cd /ssd/swinbank/stack2/EupsBuildDir/Linux64/apr_util-1.3.4.lsst3
+ . /ssd/swinbank/stack2/eups/bin/setups.sh
++ export EUPS_SHELL=sh
++ EUPS_SHELL=sh
++ export EUPS_DIR=/ssd/swinbank/stack2/eups
++ EUPS_DIR=/ssd/swinbank/stack2/eups
+++ /usr/bin/python -E -S -c '
from __future__ import print_function
import sys
pp = []
@jdswinbank
jdswinbank / curry.py
Last active January 24, 2016 18:39
Experimenting with currying.
# Attempting to understand the difference between "partial application" and "currying".
#
# Currying breaks down a function of multiple args f(x,y,z) into a series of callables
# that we can call consecutively to get the same answer: f(x,y,z) == a(x)b(y)b(z).
#
# That's what the Curry class defined below does. Thus::
#
# def multiply(a, b, c):
# return a * b * c
#
In [7]: def is_integery(i):
...: return type(i)(int(i)) == i
...:
In [8]: is_integery(2.0)
Out[8]: True
In [9]: is_integery(2.1)
Out[9]: False
[swinbank@lsst-dev ~]$ which git
/opt/rh/devtoolset-3/root/usr/bin/git
[swinbank@lsst-dev ~]$ git --version
git version 1.9.3
[swinbank@lsst-dev ~]$ git lfs version
git-lfs/1.1.0 (GitHub; linux amd64; go 1.5.1; git 258acf1)
[swinbank@lsst-dev ~]$ git config --global credential.helper 'store --file /raid/swinbank/.git-credentials'
$ git clone https://github.com/lsst/testdata_decam.git
Cloning into 'testdata_decam'...
remote: Counting objects: 58, done.
remote: Total 58 (delta 0), reused 0 (delta 0), pack-reused 58
Unpacking objects: 100% (58/58), done.
Checking connectivity... done.
Downloading calib/bpm/2013-07-16/DECam_Master_20130716_cd_01.fits (16.00 MB)
Username for 'https://git-lfs.lsst.codes': jdswinbank
Password for 'https://jdswinbank@git-lfs.lsst.codes':
Username for 'https://s3.lsst.codes':
def makeMapper(schema, target, targetPrefix=None, sourcePrefix=None):
m = SchemaMapper(schema, target)
for key, field in schema:
keyName = field.getName()
if sourcePrefix is not None:
if not keyName.startswith(sourcePrefix):
continue
else:
keyName = field.getName().replace(sourcePrefix, "", 1)
m.addMapping(key, (targetPrefix or "") + keyName)