diff options
Diffstat (limited to 'sca-cpp/trunk/components/logic/nuvem')
123 files changed, 3098 insertions, 0 deletions
diff --git a/sca-cpp/trunk/components/logic/nuvem/__init__.py b/sca-cpp/trunk/components/logic/nuvem/__init__.py new file mode 100644 index 0000000000..de5c2d1b1e --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/__init__.py @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + diff --git a/sca-cpp/trunk/components/logic/nuvem/add.py b/sca-cpp/trunk/components/logic/nuvem/add.py new file mode 100644 index 0000000000..b302a07143 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/add.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return float(0 if va is None else va) + float(0 if vb is None else vb) + diff --git a/sca-cpp/trunk/components/logic/nuvem/and_.py b/sca-cpp/trunk/components/logic/nuvem/and_.py new file mode 100644 index 0000000000..048d6c22b6 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/and_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return (False if va is None else bool(va)) and (False if vb is None else bool(vb)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/animation.py b/sca-cpp/trunk/components/logic/nuvem/animation.py new file mode 100644 index 0000000000..3dac880023 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/animation.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, msec, loop, content): + if r[0:1] == ('setup',): + ms = msec.get(r) + if ms is None or ms == 0: + return '' + l = loop.get(r) + lv = -1 if l is True else 0 if l is None or l is False else int(l) + return 'setupAnimationHandler(' + str(int(ms)) + ', ' + str(lv) + ');' + + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/app.py b/sca-cpp/trunk/components/logic/nuvem/app.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/app.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/append.py b/sca-cpp/trunk/components/logic/nuvem/append.py new file mode 100644 index 0000000000..20e1c8547e --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/append.py @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + va = a.get(r) + la = () if va is None else va if isList(va) else (va,) + vb = b.get(r) + lb = () if vb is None else vb if isList(vb) else (vb,) + return la + lb + diff --git a/sca-cpp/trunk/components/logic/nuvem/bsearch.py b/sca-cpp/trunk/components/logic/nuvem/bsearch.py new file mode 100644 index 0000000000..9ead197351 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/bsearch.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, q, s): + return s.get((("'q", q.get(r)), ("'format", 'rss'))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/bzprofile.py b/sca-cpp/trunk/components/logic/nuvem/bzprofile.py new file mode 100644 index 0000000000..b91cff2963 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/bzprofile.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, bzid, bz): + bid = bzid.get(r) + return bz.get((bid, '@self', ("'alt", 'json'))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/call.py b/sca-cpp/trunk/components/logic/nuvem/call.py new file mode 100644 index 0000000000..ed02ad07be --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/call.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, name, proxy): + nv = name.get(r) + return proxy.get("'start" if nv is None else nv if nv[0:1] == "'" else "'" + nv, r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/ceil_.py b/sca-cpp/trunk/components/logic/nuvem/ceil_.py new file mode 100644 index 0000000000..ca63726c5b --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/ceil_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x): + import math + vx = x.get(r) + return math.ceil(float(0.0 if vx is None else vx)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/comment.py b/sca-cpp/trunk/components/logic/nuvem/comment.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/comment.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/contains.py b/sca-cpp/trunk/components/logic/nuvem/contains.py new file mode 100644 index 0000000000..d8f442446f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/contains.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, sub, s): + vsub = sub.get(r) + vs = s.get(r) + return ('' if vs is None else str(vs)).find('' if vsub is None else str(vsub)) != -1 + diff --git a/sca-cpp/trunk/components/logic/nuvem/cos_.py b/sca-cpp/trunk/components/logic/nuvem/cos_.py new file mode 100644 index 0000000000..fb3213037b --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/cos_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x): + from math import cos + vx = x.get(r) + return cos(float(0.0 if vx is None else vx)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/delete.py b/sca-cpp/trunk/components/logic/nuvem/delete.py new file mode 100644 index 0000000000..a9a22768ae --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/delete.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, coll, id): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + idv = id.get(r) + return coll.delete(() if idv is None else idv if isList(idv) else (idv,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/divide.py b/sca-cpp/trunk/components/logic/nuvem/divide.py new file mode 100644 index 0000000000..83f02b105b --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/divide.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return float(0 if va is None else va) / float(1 if vb is None else vb) + diff --git a/sca-cpp/trunk/components/logic/nuvem/email.py b/sca-cpp/trunk/components/logic/nuvem/email.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/email.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/empty.py b/sca-cpp/trunk/components/logic/nuvem/empty.py new file mode 100644 index 0000000000..6b3d6f8b83 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/empty.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r): + return () + diff --git a/sca-cpp/trunk/components/logic/nuvem/equals.py b/sca-cpp/trunk/components/logic/nuvem/equals.py new file mode 100644 index 0000000000..7c777ae4f4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/equals.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return (() if va is None else va) == (() if vb is None else vb) + diff --git a/sca-cpp/trunk/components/logic/nuvem/eval_.py b/sca-cpp/trunk/components/logic/nuvem/eval_.py new file mode 100644 index 0000000000..97ba1f9068 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/eval_.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, py, ref): + pye = py.get(r) + return eval('' if pye is None else pye if isinstance(pye, basestring) else pye[1][0]) diff --git a/sca-cpp/trunk/components/logic/nuvem/exec_.py b/sca-cpp/trunk/components/logic/nuvem/exec_.py new file mode 100644 index 0000000000..00cab81405 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/exec_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, py, ref): + val = None + pys = py.get(r) + exec('' if pys is None else pys if isinstance(pys, basestring) else pys[1][0]) + return val diff --git a/sca-cpp/trunk/components/logic/nuvem/false_.py b/sca-cpp/trunk/components/logic/nuvem/false_.py new file mode 100644 index 0000000000..8cd3528b15 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/false_.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r): + return False + diff --git a/sca-cpp/trunk/components/logic/nuvem/fbalbums.py b/sca-cpp/trunk/components/logic/nuvem/fbalbums.py new file mode 100644 index 0000000000..64a81a091e --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/fbalbums.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fbid, fb): + fid = fbid.get(r) + return fb.get((fid, 'albums')) + diff --git a/sca-cpp/trunk/components/logic/nuvem/fbfriends.py b/sca-cpp/trunk/components/logic/nuvem/fbfriends.py new file mode 100644 index 0000000000..960e422bc6 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/fbfriends.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fbid, fb): + fid = fbid.get(r) + return fb.get((fid, 'friends')) + diff --git a/sca-cpp/trunk/components/logic/nuvem/fbgroups.py b/sca-cpp/trunk/components/logic/nuvem/fbgroups.py new file mode 100644 index 0000000000..cf0fe9ce0d --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/fbgroups.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fbid, fb): + fid = fbid.get(r) + return fb.get((fid, 'groups')) + diff --git a/sca-cpp/trunk/components/logic/nuvem/fbprofile.py b/sca-cpp/trunk/components/logic/nuvem/fbprofile.py new file mode 100644 index 0000000000..c1d2166bb9 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/fbprofile.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fbid, fb): + fid = fbid.get(r) + return fb.get((fid,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/filedb.py b/sca-cpp/trunk/components/logic/nuvem/filedb.py new file mode 100644 index 0000000000..8b69665e84 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/filedb.py @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(id, db, appname): + return db.get(("'filedb", appname.eval()) + id) + +def post(id, val, db, appname): + return db.post(("'filedb", appname.eval()) + id, val) + +def put(id, val, db, appname): + return db.put(("'filedb", appname.eval()) + id, val) + +def delete(id, db, appname): + return db.delete(("'filedb", appname.eval()) + id) + diff --git a/sca-cpp/trunk/components/logic/nuvem/filter_.py b/sca-cpp/trunk/components/logic/nuvem/filter_.py new file mode 100644 index 0000000000..343abcbe2a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/filter_.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, item, cond, l): + iv = item.get(r) + + def cfun(i): + return cond.get(((iv, i),) + r) + + vl = l.get(r) + return tuple(filter(cfun, () if vl is None else vl)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/first.py b/sca-cpp/trunk/components/logic/nuvem/first.py new file mode 100644 index 0000000000..6a10d5e74a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/first.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + if lv is None: + return None + if len(lv) == 0: + return None + return lv[0] + diff --git a/sca-cpp/trunk/components/logic/nuvem/flkalbum.py b/sca-cpp/trunk/components/logic/nuvem/flkalbum.py new file mode 100644 index 0000000000..81044c49d1 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/flkalbum.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, id, flk): + idv = id.get(r) + return flk.get((("'id", idv), ("'lang", 'en-us'), ("'format", 'json'))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/floor_.py b/sca-cpp/trunk/components/logic/nuvem/floor_.py new file mode 100644 index 0000000000..313e29e789 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/floor_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x): + import math + vx = x.get(r) + return math.floor(float(0 if vx is None else vx)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/format_.py b/sca-cpp/trunk/components/logic/nuvem/format_.py new file mode 100644 index 0000000000..eb276925da --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/format_.py @@ -0,0 +1,47 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fmt, args): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + def trimq(x): + if not isinstance(x, basestring): + return x + return x[1:] if x[0:1] == "'" else x + + l = args.get(r) + lv = () if l is None else l + la = map(trimq, filter(lambda x: not isAssoc(x), lv)) + ka = dict(map(lambda x: (x[0][1:], x[1]), filter(lambda x: isAssoc(x), lv))) + + vfmt = fmt.get(r) + return ('' if vfmt is None else str(vfmt)).format(*la, **ka) + diff --git a/sca-cpp/trunk/components/logic/nuvem/frames.py b/sca-cpp/trunk/components/logic/nuvem/frames.py new file mode 100644 index 0000000000..fa446e7e82 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/frames.py @@ -0,0 +1,56 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, msec, loop, content): + import string + + ms = msec.get(r) + if ms is None or ms == 0: + return '' + l = loop.get(r) + lv = 'infinite' if l is True else '1' if l is None or l is False else '{0:g}'.format(l) + + def keyframe(f): + t = f[0] + v = f[1] + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + if isList(v): + return '{0:g}% {{ {1} }}'.format(t, string.join(map(lambda x: (x[0][1:] + ': ' + str(x[1]) + ';') if isAssoc(x) else (str(x) + ';'), v), ' ')) + + return '{0:g}% {{ {1} }}'.format(t, v) + + kf = ' '.join(map(keyframe, content.get(r))) + + uid = '{id}' + return 'position: absolute; -webkit-animation: {0} {1:g}s ease 0 {2} normal; -moz-animation: {0} {1:g}s ease 0 {2} normal; <style> @-webkit-keyframes {0} {{ {3} }} @-moz-keyframes {0} {{ {3} }} </style>'.format(uid, ms / 1000.0, lv, kf) + diff --git a/sca-cpp/trunk/components/logic/nuvem/gaddress.py b/sca-cpp/trunk/components/logic/nuvem/gaddress.py new file mode 100644 index 0000000000..8a1c9f8346 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/gaddress.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, s): + return s.get((("'address", str(a.get(r))), ("'sensor", 'true'))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/get.py b/sca-cpp/trunk/components/logic/nuvem/get.py new file mode 100644 index 0000000000..fd84934e2f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/get.py @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, coll, id): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + idv = id.get(r) + res = coll.get(() if idv is None else idv if isList(idv) else (idv,)) + return res + diff --git a/sca-cpp/trunk/components/logic/nuvem/ggeopos.py b/sca-cpp/trunk/components/logic/nuvem/ggeopos.py new file mode 100644 index 0000000000..e222d12041 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/ggeopos.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, lat, lng, s): + return s.get((("'latlng", str(lat.get(r)) + ',' + str(lng.get(r))), ("'sensor", 'true'))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/gimages.py b/sca-cpp/trunk/components/logic/nuvem/gimages.py new file mode 100644 index 0000000000..089adb1b6a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/gimages.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, q, s): + return s.get((("'v", '1.0'), ("'rsz", 8), ("'q", q.get(r)))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/gmap.py b/sca-cpp/trunk/components/logic/nuvem/gmap.py new file mode 100644 index 0000000000..3642912121 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/gmap.py @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, markers, s): + + def ismarker(m): + return m[1] is not None + + def marker(m): + # expecting (label or icon url, (color, loc)) + label = m[0][1:] + deco = m[1][0] + loc = string.join(map(str, m[1][1:3]), ',') + if deco.find(':') == -1: + return ("'markers", 'color:{0}|label:{1}|{2}'.format(deco, label, loc)) + return ("'markers", 'icon:{0}|{1}'.format(deco, loc)) + + mv = markers.get(r) + return s.get((("'size", '320x320'), ("'maptype", 'roadmap'), ("'sensor", 'true')) + tuple(map(marker, filter(ismarker, () if mv is None else mv)))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/greater.py b/sca-cpp/trunk/components/logic/nuvem/greater.py new file mode 100644 index 0000000000..851eda908f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/greater.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + return a.get(r) > b.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/gsearch.py b/sca-cpp/trunk/components/logic/nuvem/gsearch.py new file mode 100644 index 0000000000..c213f0397b --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/gsearch.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, q, s): + return s.get((("'v", '1.0'), ("'q", q.get(r)))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/gweather.py b/sca-cpp/trunk/components/logic/nuvem/gweather.py new file mode 100644 index 0000000000..e02062feee --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/gweather.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, zip, w): + return w.get((("'weather", zip.get(r)),)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/host.py b/sca-cpp/trunk/components/logic/nuvem/host.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/host.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/htattrs.py b/sca-cpp/trunk/components/logic/nuvem/htattrs.py new file mode 100644 index 0000000000..d30bb4ad4a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htattrs.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, v): + return ("'htattrs", v.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htbutton.py b/sca-cpp/trunk/components/logic/nuvem/htbutton.py new file mode 100644 index 0000000000..193cab2bc9 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htbutton.py @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, value): + v = value.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + def mkbutton(v): + vl = filter(lambda x: not isAssoc(x), v) + al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1] + l = (() if len(vl) == 0 else (("'id", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'value", vl[1]))) + al + if len(l) == 0: + return '' + satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ') + batts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ') + return '<SPAN {0} class="button"><INPUT type="button" {1} class="graybutton"/></SPAN>'.format(satts, batts) + + return mkbutton(()) if v is None else mkbutton(v) if isList(v) and not isAssoc(v) else mkbutton((v,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htcheck.py b/sca-cpp/trunk/components/logic/nuvem/htcheck.py new file mode 100644 index 0000000000..5c15b936f8 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htcheck.py @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, value): + v = value.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + def mkcheck(v): + vl = filter(lambda x: not isAssoc(x), v) + al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1] + l = (() if len(vl) == 0 else (("'id", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'value", vl[1]))) + al + if len(l) == 0: + return ''; + satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ') + catts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ') + text = filter(lambda x: x[0] == "'value", l)[0][1] + return '<SPAN {0} class="checkbox"><INPUT type="checkbox" {1}/><SPAN>{2}</SPAN></SPAN>'.format(satts, catts, text) + + return mkcheck(()) if v is None else mkcheck(v) if isList(v) and not isAssoc(v) else mkcheck((v,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htimg.py b/sca-cpp/trunk/components/logic/nuvem/htimg.py new file mode 100644 index 0000000000..70c613667f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htimg.py @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, value): + v = value.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + def mkimg(v): + vl = filter(lambda x: not isAssoc(x), v) + al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1] + l = (() if len(vl) == 0 else (("'id", vl[0]), ("'src", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'src", vl[1]))) + al + if len(l) == 0: + return '' + satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ') + iatts = string.join(map(lambda x: ('style' if x[0] == "'htstyle" else x[0][1:]) + '="' + x[1] + '"', filter(lambda x: x[0] != "'id", l)), ' ') + return '<SPAN {0} class="img"><IMG {1}/></SPAN>'.format(satts, iatts) + + return mkimg(()) if v is None else mkimg(v) if isList(v) and not isAssoc(v) else mkimg((v,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htinline.py b/sca-cpp/trunk/components/logic/nuvem/htinline.py new file mode 100644 index 0000000000..6e0551a8aa --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htinline.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import base64 +import string + +def get(r, img): + v = img.get(r) + if v is None: + return '' + return 'data:' + v[0] + ';base64,' + base64.encodestring(string.join(v[1], '')) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htlink.py b/sca-cpp/trunk/components/logic/nuvem/htlink.py new file mode 100644 index 0000000000..4865591f55 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htlink.py @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, value): + v = value.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + def mklink(v): + vl = filter(lambda x: not isAssoc(x), v) + al = (filter(lambda x: isAssoc(x) and x[0] == "'htattrs", v) + (("'htattrs",()),))[0][1] + l = (() if len(vl) == 0 else (("'id", vl[0]), ("'href", vl[0]), ("'value", vl[0])) if len(vl) == 1 else (("'id", vl[0]), ("'href", vl[0]), ("'value", vl[1])) if len(vl) == 2 else (("'id", vl[0]), ("'href", vl[1]), ("'value", vl[2]))) + al + if len(l) == 0: + return '' + satts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] == "'id", l)), ' ') + hatts = string.join(map(lambda x: x[0][1:] + '="' + x[1] + '"', filter(lambda x: x[0] != "'id" and x[0] != "'value", l)), ' ') + text = filter(lambda x: x[0] == "'value", l)[0][1] + return '<SPAN {0} class="link"><A {1}><SPAN>{2}</SPAN></A></SPAN>'.format(satts, hatts, text) + + return mklink(()) if v is None else mklink(v) if isList(v) and not isAssoc(v) else mklink((v,)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/htstyle.py b/sca-cpp/trunk/components/logic/nuvem/htstyle.py new file mode 100644 index 0000000000..5e52b33080 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/htstyle.py @@ -0,0 +1,47 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, value): + v = value.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + if v is None: + return ("'htstyle", '') + + if isList(v): + lv = (v,) if isAssoc(v) else v + return ("'htstyle", string.join(map(lambda x: (x[0][1:] + ': ' + str(x[1]) + ';') if isAssoc(x) else (str(x) + ';'), lv), ' ')) + + return ("'htstyle", v + ';') + diff --git a/sca-cpp/trunk/components/logic/nuvem/if_.py b/sca-cpp/trunk/components/logic/nuvem/if_.py new file mode 100644 index 0000000000..17a261b0a4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/if_.py @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, cond, then, els): + vc = cond.get(r) + if vc: + return then.get(r) + else: + return els.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/insert.py b/sca-cpp/trunk/components/logic/nuvem/insert.py new file mode 100644 index 0000000000..6a78a816eb --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/insert.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, first, rest): + vf = first.get(r) + vr = rest.get(r) + return (vf,) + (() if vr is None else vr) + diff --git a/sca-cpp/trunk/components/logic/nuvem/item.py b/sca-cpp/trunk/components/logic/nuvem/item.py new file mode 100644 index 0000000000..19e565a9c8 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/item.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, v, prop): + return ("'" + prop.eval(), v.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/itemnb.py b/sca-cpp/trunk/components/logic/nuvem/itemnb.py new file mode 100644 index 0000000000..25d4cd6ce8 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/itemnb.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, i, l): + lv = l.get(r) + vi = i.get(r) + return (() if lv is None else lv)[0 if vi is None else int(vi)] + diff --git a/sca-cpp/trunk/components/logic/nuvem/join.py b/sca-cpp/trunk/components/logic/nuvem/join.py new file mode 100644 index 0000000000..d3bfd86eb7 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/join.py @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import string + +def get(r, sep, l): + s = sep.get(r) + lv = l.get(r) + return string.join(() if lv is None else lv, '' if s is None else s) + diff --git a/sca-cpp/trunk/components/logic/nuvem/keychain.py b/sca-cpp/trunk/components/logic/nuvem/keychain.py new file mode 100644 index 0000000000..44e6653e93 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/keychain.py @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n, a): + nv = n.get(r) + ntv = nv[1:] if nv[0:1] == "'" else nv + av = a.get(r) + + content = filter(lambda e: e[0] == "'content", av[0]) + account = filter(lambda e: e[0] == "'account", () if len(content) == 0 else content[0]) + keys = filter(lambda e: e[0] == "'keys", () if len(account) == 0 else account[0]) + key = filter(lambda e: e[0] == "'key", () if len(keys) == 0 else keys[0]) + ekey = () if len(key) == 0 else key[0] + akey = () if len(ekey) < 2 else ekey[1] + + def namedkey(k): + return len(filter(lambda e: e[0] == "'@name" and e[1] == ntv, k)) != 0 + + def keyvalue(k): + return filter(lambda e: e[0] == "'@value", k) + + kv = map(keyvalue, filter(namedkey, akey)) + return None if len(kv) == 0 else kv[0][0][1] + diff --git a/sca-cpp/trunk/components/logic/nuvem/last.py b/sca-cpp/trunk/components/logic/nuvem/last.py new file mode 100644 index 0000000000..81613ae60a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/last.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + if lv is None: + return None + if len(lv) == 0: + return None + return lv[len(lv) - 1] + diff --git a/sca-cpp/trunk/components/logic/nuvem/left.py b/sca-cpp/trunk/components/logic/nuvem/left.py new file mode 100644 index 0000000000..1daee3907d --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/left.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n): + vn = n.get(r) + return 'left: {0:g}px'.format(round(0 if vn is None else float(vn), 0)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/lesser.py b/sca-cpp/trunk/components/logic/nuvem/lesser.py new file mode 100644 index 0000000000..622dd36922 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/lesser.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + return a.get(r) < b.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/list_.py b/sca-cpp/trunk/components/logic/nuvem/list_.py new file mode 100644 index 0000000000..0b6114c8e1 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/list_.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(*args): + r = args[0] + return tuple(map(lambda x: x.get(r), args[1:len(args) - 1])) + diff --git a/sca-cpp/trunk/components/logic/nuvem/location.py b/sca-cpp/trunk/components/logic/nuvem/location.py new file mode 100644 index 0000000000..2f45687bc3 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/location.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, content): + if r[0:1] == ('setup',): + return 'setupLocationHandler();' + + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/lookup.py b/sca-cpp/trunk/components/logic/nuvem/lookup.py new file mode 100644 index 0000000000..d61d032636 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/lookup.py @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Return a list of name value pairs that match a name +def get(r, n, l): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + return isList(v) and len(v) == 2 and isinstance(v[0], basestring) and v[0][0:1] == "'" + + def lookup(nv, lv): + if lv == (): + return () + + # Check if list element is a name value pair assoc + a = lv[0] + if not isAssoc(a): + return lookup(nv, lv[1:]) + + # Got a match, return it and lookup rest of the list + an = "'" + a[0][2:] if a[0][0:2] == "'@" else a[0] + if an == nv: + return (a,) + lookup(nv, lv[1:]) + + # No match, lookup rest of the list + return lookup(nv, lv[1:]) + + def qsymbol(x): + if not isinstance(x, basestring): + return x + return x if x[0:1] == "'" else "'" + x + + nv = n.get(r) + lv = l.get(r) + return lookup(qsymbol(nv), () if lv is None else lv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/lowercase.py b/sca-cpp/trunk/components/logic/nuvem/lowercase.py new file mode 100644 index 0000000000..461e3ed450 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/lowercase.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, s): + vs = s.get(r) + return ('' if vs is None else str(vs)).lower() + diff --git a/sca-cpp/trunk/components/logic/nuvem/map_.py b/sca-cpp/trunk/components/logic/nuvem/map_.py new file mode 100644 index 0000000000..4194d627bb --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/map_.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, item, transform, l): + iv = item.get(r) + + def tfun(i): + return transform.get(((iv, i),) + r) + + lv = l.get(r) + return tuple(map(tfun, () if lv is None else lv)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/max_.py b/sca-cpp/trunk/components/logic/nuvem/max_.py new file mode 100644 index 0000000000..74534fc076 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/max_.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + return max(() if lv is None else lv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/min_.py b/sca-cpp/trunk/components/logic/nuvem/min_.py new file mode 100644 index 0000000000..bb0c0bca5e --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/min_.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + return min(() if lv is None else lv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/mod.py b/sca-cpp/trunk/components/logic/nuvem/mod.py new file mode 100644 index 0000000000..3f0fc05e46 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/mod.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n, x): + vx = x.get(r) + vn = n.get(r) + return float(0 if vx is None else vx) % float(1 if vn is None else vn) + diff --git a/sca-cpp/trunk/components/logic/nuvem/multiply.py b/sca-cpp/trunk/components/logic/nuvem/multiply.py new file mode 100644 index 0000000000..ad60c351c0 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/multiply.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return float(0 if va is None else va) * float(0 if vb is None else vb) + diff --git a/sca-cpp/trunk/components/logic/nuvem/name.py b/sca-cpp/trunk/components/logic/nuvem/name.py new file mode 100644 index 0000000000..f5582dc097 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/name.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return "'" + prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/names.py b/sca-cpp/trunk/components/logic/nuvem/names.py new file mode 100644 index 0000000000..f30f5d1a0c --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/names.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + if lv is None: + return lv + return tuple(map(lambda p: p[0], lv)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/nosqldb.py b/sca-cpp/trunk/components/logic/nuvem/nosqldb.py new file mode 100644 index 0000000000..6458940a8d --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/nosqldb.py @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(id, db, appname): + return db.get(("'nosqldb", appname.eval()) + id); + +def post(id, val, db, appname): + return db.post(("'nosqldb", appname.eval()) + id, val); + +def put(id, val, db, appname): + return db.put(("'nosqldb", appname.eval()) + id, val); + +def delete(id, db, appname): + return db.delete(("'nosqldb", appname.eval()) + id); + diff --git a/sca-cpp/trunk/components/logic/nuvem/not_.py b/sca-cpp/trunk/components/logic/nuvem/not_.py new file mode 100644 index 0000000000..fd20a95ea2 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/not_.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, expr): + return not expr.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/nothing.py b/sca-cpp/trunk/components/logic/nuvem/nothing.py new file mode 100644 index 0000000000..5b144cb0d0 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/nothing.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r): + return None + diff --git a/sca-cpp/trunk/components/logic/nuvem/now.py b/sca-cpp/trunk/components/logic/nuvem/now.py new file mode 100644 index 0000000000..b0015117cb --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/now.py @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, f): + from datetime import datetime + fv = f.get(r) + if fv is None: + return datetime.now().ctime() + return datetime.now().strftime(fv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/number.py b/sca-cpp/trunk/components/logic/nuvem/number.py new file mode 100644 index 0000000000..85484317f3 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/number.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return float(prop.eval()) + diff --git a/sca-cpp/trunk/components/logic/nuvem/or_.py b/sca-cpp/trunk/components/logic/nuvem/or_.py new file mode 100644 index 0000000000..eea7aa9915 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/or_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return (False if va is None else bool(va)) or (False if vb is None else bool(vb)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/pair.py b/sca-cpp/trunk/components/logic/nuvem/pair.py new file mode 100644 index 0000000000..dbfd41c06f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/pair.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + return (a.get(r), b.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/param.py b/sca-cpp/trunk/components/logic/nuvem/param.py new file mode 100644 index 0000000000..c67ab5a8fd --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/param.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, name, params): + def lookup(nv, lv): + if lv == (): + return None + a = lv[0] + if a[0] == nv: + return a[1] + return lookup(nv, lv[1:]) + + return lookup("'" + name.eval(), params.eval()) + diff --git a/sca-cpp/trunk/components/logic/nuvem/params.py b/sca-cpp/trunk/components/logic/nuvem/params.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/params.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/parse.py b/sca-cpp/trunk/components/logic/nuvem/parse.py new file mode 100644 index 0000000000..d019813c5f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/parse.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import re + +def get(r, expr, s): + ev = expr.get(r) + sv = s.get(r) + m = re.search('' if ev is None else ev, '' if sv is None else sv) + return () if m is None else m.groups() + diff --git a/sca-cpp/trunk/components/logic/nuvem/path.py b/sca-cpp/trunk/components/logic/nuvem/path.py new file mode 100644 index 0000000000..0df2a298ea --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/path.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + p = prop.eval() + return p[2:] if p[0:1] == ('components',) else p + diff --git a/sca-cpp/trunk/components/logic/nuvem/pi_.py b/sca-cpp/trunk/components/logic/nuvem/pi_.py new file mode 100644 index 0000000000..9a76a0c470 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/pi_.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r): + from math import pi + return pi + diff --git a/sca-cpp/trunk/components/logic/nuvem/picalbum.py b/sca-cpp/trunk/components/logic/nuvem/picalbum.py new file mode 100644 index 0000000000..d970ff0c8a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/picalbum.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, id, pic): + idv = id.get(r) + return pic.get((idv, ("'kind", 'photo'), ("'max-results", 20))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/pixels.py b/sca-cpp/trunk/components/logic/nuvem/pixels.py new file mode 100644 index 0000000000..f65fcc7fdd --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/pixels.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n): + vn = n.get(r) + return '{0:g}px'.format(round(0 if vn is None else float(vn), 0)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/post.py b/sca-cpp/trunk/components/logic/nuvem/post.py new file mode 100644 index 0000000000..cf774695a4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/post.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, coll, id, val): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + idv = id.get(r) + return coll.post(() if idv is None else idv if isList(idv) else (idv,), val.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/put.py b/sca-cpp/trunk/components/logic/nuvem/put.py new file mode 100644 index 0000000000..f7c9eea098 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/put.py @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, coll, id, val): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + idv = id.get(r) + return coll.put(() if idv is None else idv if isList(idv) else (idv,), val.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/random_.py b/sca-cpp/trunk/components/logic/nuvem/random_.py new file mode 100644 index 0000000000..d76e88caaf --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/random_.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, m): + import random + mv = m.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + if isList(mv): + return random.choice(mv) + + return random.random() * (1.0 if mv is None else mv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/randoms.py b/sca-cpp/trunk/components/logic/nuvem/randoms.py new file mode 100644 index 0000000000..de99b05ffa --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/randoms.py @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n, m): + import random + mv = m.get(r) + nv = n.get(r) + + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + if isList(mv): + return tuple(map(lambda i: random.choice(mv), tuple(range(0, int(0 if nv is None else nv))))) + + return tuple(map(lambda i: random.random() * (1.0 if mv is None else mv), tuple(range(0, int(0 if nv is None else nv))))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/range_.py b/sca-cpp/trunk/components/logic/nuvem/range_.py new file mode 100644 index 0000000000..cdc7c24204 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/range_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return tuple(range(int(0 if va is None else va), int(0 if vb is None else vb))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/realm.py b/sca-cpp/trunk/components/logic/nuvem/realm.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/realm.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/reduce_.py b/sca-cpp/trunk/components/logic/nuvem/reduce_.py new file mode 100644 index 0000000000..ed5e9490ce --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/reduce_.py @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, item, accum, transform, init, l): + iv = item.get(r) + av = accum.get(r) + + def tfun(a, i): + return transform.get(((av, a), (iv, i)) + r) + + lv = l.get(r) + return reduce(tfun, () if lv is None else lv, init.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/replace.py b/sca-cpp/trunk/components/logic/nuvem/replace.py new file mode 100644 index 0000000000..5ce41fd3df --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/replace.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, fr, to, s): + vfr = fr.get(r) + vto = to.get(r) + vs = s.get(r) + return ('' if vs is None else str(vs)).replace('' if vfr is None else str(vfr), '' if vto is None else str(vto)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/rest.py b/sca-cpp/trunk/components/logic/nuvem/rest.py new file mode 100644 index 0000000000..cd23115d1c --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/rest.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + vl = l.get(r) + if vl is None: + return () + return vl[1:] + diff --git a/sca-cpp/trunk/components/logic/nuvem/reverse.py b/sca-cpp/trunk/components/logic/nuvem/reverse.py new file mode 100644 index 0000000000..61361e233f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/reverse.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + vl = l.get(r) + if vl is None: + return () + rl = list(vl) + rl.reverse() + return tuple(rl) + diff --git a/sca-cpp/trunk/components/logic/nuvem/round_.py b/sca-cpp/trunk/components/logic/nuvem/round_.py new file mode 100644 index 0000000000..f2bbe0de75 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/round_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n, x): + vx = x.get(r) + vn = n.get(r) + return round(float(0 if vx is None else vx), int(0 if vn is None else vn)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/second.py b/sca-cpp/trunk/components/logic/nuvem/second.py new file mode 100644 index 0000000000..79acf79e3a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/second.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + if lv is None: + return lv + if len(lv) < 2: + return None + return lv[1] + diff --git a/sca-cpp/trunk/components/logic/nuvem/select.py b/sca-cpp/trunk/components/logic/nuvem/select.py new file mode 100644 index 0000000000..bf10a756a4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/select.py @@ -0,0 +1,72 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Return a list of name value pairs that match a name +# Search through nested lists of name value pairs +def get(r, p, l): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + return isList(v) and len(v) >= 2 and isinstance(v[0], basestring) and v[0][0:1] == "'" + + def lookup(pv, lv): + if lv == (): + return () + if isAssoc(lv): + lv = (lv,) + + # Check if list element is a name value pair assoc + a = lv[0] + if not isAssoc(a): + # Lookup children if any and rest of list + if isList(a): + return lookup(pv, a) + lookup(pv, lv[1:]) + return lookup(pv, lv[1:]) + + # Path segment match + an = "'" + a[0][2:] if a[0][0:2] == "'@" else a[0] + if an == pv[0]: + # Found leaf, return it and lookup rest of the list + if len(pv) == 1: + return (a,) + lookup(pv, lv[1:]) + # Continue to lookup children if any plus rest of the list + return lookup(pv[1:], a[1:]) + lookup(pv, lv[1:]) + + # No match, lookup any children and rest of the list + if (isList(a[1])): + return lookup(pv, a[1]) + lookup(pv, a[2:]) + lookup(pv, lv[1:]) + return lookup(pv, a[2:]) + lookup(pv, lv[1:]) + + def qsymbol(x): + if not isinstance(x, basestring): + return x + return x if x[0:1] == "'" else "'" + x + + # Support path as a list or a dot separated string + lv = l.get(r) + pv = p.get(r) + if (isList(pv)): + return lookup(map(qsymbol, pv), () if lv is None else lv) + + spv = map(qsymbol, qsymbol(pv)[1:].split('.')) + return lookup(spv, () if lv is None else lv) + diff --git a/sca-cpp/trunk/components/logic/nuvem/service.py b/sca-cpp/trunk/components/logic/nuvem/service.py new file mode 100644 index 0000000000..80b0529213 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/service.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, content): + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/shuffle_.py b/sca-cpp/trunk/components/logic/nuvem/shuffle_.py new file mode 100644 index 0000000000..7b55c45a51 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/shuffle_.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + from random import shuffle + vl = l.get(r) + if vl is None: + return () + rl = list(vl) + shuffle(rl) + return tuple(rl) + diff --git a/sca-cpp/trunk/components/logic/nuvem/sin_.py b/sca-cpp/trunk/components/logic/nuvem/sin_.py new file mode 100644 index 0000000000..1bbefc7a75 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/sin_.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x): + from math import sin + vx = x.get(r) + return sin(float(0 if vx is None else vx)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/single.py b/sca-cpp/trunk/components/logic/nuvem/single.py new file mode 100644 index 0000000000..29e237ef74 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/single.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x): + return (x.get(r),) + diff --git a/sca-cpp/trunk/components/logic/nuvem/split.py b/sca-cpp/trunk/components/logic/nuvem/split.py new file mode 100644 index 0000000000..2ff98075cd --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/split.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, sep, s): + vsep = sep.get(r) + vs = s.get(r) + return tuple(('' if vs is None else str(vs)).split('' if vsep is None else str(vsep))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/sqldb.py b/sca-cpp/trunk/components/logic/nuvem/sqldb.py new file mode 100644 index 0000000000..184d83ac04 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/sqldb.py @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(id, db, appname): + return db.get(("'sqldb", appname.eval()) + id); + +def post(id, val, db, appname): + return db.post(("'sqldb", appname.eval()) + id, val); + +def put(id, val, db, appname): + return db.put(("'sqldb", appname.eval()) + id, val); + +def delete(id, db, appname): + return db.delete(("'sqldb", appname.eval()) + id); + diff --git a/sca-cpp/trunk/components/logic/nuvem/start.py b/sca-cpp/trunk/components/logic/nuvem/start.py new file mode 100644 index 0000000000..80b0529213 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/start.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, content): + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/stop.py b/sca-cpp/trunk/components/logic/nuvem/stop.py new file mode 100644 index 0000000000..80b0529213 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/stop.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, content): + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/subtract.py b/sca-cpp/trunk/components/logic/nuvem/subtract.py new file mode 100644 index 0000000000..bb791df3d8 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/subtract.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b): + va = a.get(r) + vb = b.get(r) + return float(0 if va is None else va) - float(0 if vb is None else vb) + diff --git a/sca-cpp/trunk/components/logic/nuvem/sum_.py b/sca-cpp/trunk/components/logic/nuvem/sum_.py new file mode 100644 index 0000000000..1ecfc79b0a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/sum_.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + vl = l.get(r) + return sum(() if vl is None else vl) + diff --git a/sca-cpp/trunk/components/logic/nuvem/text.py b/sca-cpp/trunk/components/logic/nuvem/text.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/text.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/timer.py b/sca-cpp/trunk/components/logic/nuvem/timer.py new file mode 100644 index 0000000000..97a2367cc3 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/timer.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, msec, content): + if r[0:1] == ('setup',): + ms = msec.get(r) + if ms is None or ms == 0: + return '' + return 'setupIntervalHandler(' + str(int(ms)) + ');' + + return content.get(r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/top.py b/sca-cpp/trunk/components/logic/nuvem/top.py new file mode 100644 index 0000000000..87b75e6ae1 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/top.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n): + vn = n.get(r) + return 'top: {0:g}px'.format(round(0 if vn is None else float(vn), 0)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/transform.py b/sca-cpp/trunk/components/logic/nuvem/transform.py new file mode 100644 index 0000000000..4973176cef --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/transform.py @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, x, y, d): + vx = x.get(r) + vy = y.get(r) + vd = d.get(r) + rx = round(float(0 if vx is None else vx), 0) + ry = round(float(0 if vy is None else vy), 0) + rd = round(float(0 if vd is None else vd), 0) + return 'position: absolute; -webkit-transform: translate3d({0:g}px,{1:g}px,0px) rotate({2:g}deg); -moz-transform: translate({0:g}px,{1:g}px) rotate({2:g}deg); -ms-transform: translate({0:g}px,{1:g}px) rotate({2:g}deg); transform: translate({0:g}px,{1:g}px) rotate({2:g}deg)'.format(rx, ry, rd) + diff --git a/sca-cpp/trunk/components/logic/nuvem/transition.py b/sca-cpp/trunk/components/logic/nuvem/transition.py new file mode 100644 index 0000000000..99c4a1a9c5 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/transition.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, n): + vn = n.get(r) + return '-webkit-transition: all {0}s'.format(float(0 if vn is None else vn) / 1000.0) + diff --git a/sca-cpp/trunk/components/logic/nuvem/triple.py b/sca-cpp/trunk/components/logic/nuvem/triple.py new file mode 100644 index 0000000000..72ba3b8b77 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/triple.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, a, b, c): + return (a.get(r), b.get(r), c.get(r)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/true_.py b/sca-cpp/trunk/components/logic/nuvem/true_.py new file mode 100644 index 0000000000..ce806cc8ed --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/true_.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r): + return True + diff --git a/sca-cpp/trunk/components/logic/nuvem/twfollowers.py b/sca-cpp/trunk/components/logic/nuvem/twfollowers.py new file mode 100644 index 0000000000..ff1dff16b4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/twfollowers.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, twid, tw): + tid = twid.get(r) + return tw.get((("'screen_name", tid),)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/twfriends.py b/sca-cpp/trunk/components/logic/nuvem/twfriends.py new file mode 100644 index 0000000000..ff1dff16b4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/twfriends.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, twid, tw): + tid = twid.get(r) + return tw.get((("'screen_name", tid),)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/twprofile.py b/sca-cpp/trunk/components/logic/nuvem/twprofile.py new file mode 100644 index 0000000000..ff1dff16b4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/twprofile.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, twid, tw): + tid = twid.get(r) + return tw.get((("'screen_name", tid),)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/twsms.py b/sca-cpp/trunk/components/logic/nuvem/twsms.py new file mode 100644 index 0000000000..a42eae3051 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/twsms.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, sid, tok, fr, to, msg, s): + return s.get('app://twsms', ('c', 'send', ("'sid", sid.get(r)), ("'token", tok.get(r)), ("'from", fr.get(r)), ("'to", to.get(r)), ("'msg", msg.get(r)))) + diff --git a/sca-cpp/trunk/components/logic/nuvem/twtimeline.py b/sca-cpp/trunk/components/logic/nuvem/twtimeline.py new file mode 100644 index 0000000000..ff1dff16b4 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/twtimeline.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, twid, tw): + tid = twid.get(r) + return tw.get((("'screen_name", tid),)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/uppercase.py b/sca-cpp/trunk/components/logic/nuvem/uppercase.py new file mode 100644 index 0000000000..82bf0dacc1 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/uppercase.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, s): + vs = s.get(r) + return ('' if vs is None else str(vs)).upper() + diff --git a/sca-cpp/trunk/components/logic/nuvem/url.py b/sca-cpp/trunk/components/logic/nuvem/url.py new file mode 100644 index 0000000000..82bad01c0f --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/url.py @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, address, args): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def isAssoc(v): + if not isList(v): + return False + if len(v) != 2: + return False + if isinstance(v[0], basestring) and v[0][0:1] == "'": + return True + return False + + l = args.get(r) + lv = () if l is None else l + la = map(lambda x: str(x), filter(lambda x: not isAssoc(x), lv)) + ka = map(lambda x: '='.join((x[0][1:], str(x[1]))), filter(lambda x: isAssoc(x), lv)) + + va = address.get(r) + return ('' if va is None else str(va)) + '/'.join(la) + ('?' if len(ka) != 0 else '') + '&'.join(ka) + diff --git a/sca-cpp/trunk/components/logic/nuvem/user.py b/sca-cpp/trunk/components/logic/nuvem/user.py new file mode 100644 index 0000000000..d17ca78b43 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/user.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, prop): + return prop.eval() + diff --git a/sca-cpp/trunk/components/logic/nuvem/valueof.py b/sca-cpp/trunk/components/logic/nuvem/valueof.py new file mode 100644 index 0000000000..60e58786b3 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/valueof.py @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, name): + def isList(v): + if getattr(v, '__iter__', False) == False: + return False + if isinstance(v, basestring) or isinstance(v, dict): + return False + return True + + def lookup(n, r): + if r == (): + return None + a = r[0] + if isList(a) and a[0] == n: + return a[1] + return lookup(n, r[1:]) + + return lookup("'" + name.eval(), r) + diff --git a/sca-cpp/trunk/components/logic/nuvem/values.py b/sca-cpp/trunk/components/logic/nuvem/values.py new file mode 100644 index 0000000000..620eab4c8a --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/values.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, l): + lv = l.get(r) + if lv is None: + return lv + return tuple(map(lambda p: p[1], lv)) + diff --git a/sca-cpp/trunk/components/logic/nuvem/ysearch.py b/sca-cpp/trunk/components/logic/nuvem/ysearch.py new file mode 100644 index 0000000000..f6d09947e6 --- /dev/null +++ b/sca-cpp/trunk/components/logic/nuvem/ysearch.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +def get(r, q, s): + return s.get((("'appid", 'YahooDemo'), ("'query", q.get(r)), ("'output", 'json'))) + |