Commit 429eeb8c authored by Tiago Peixoto's avatar Tiago Peixoto

Remove deprecated run_action module

parent e9ab02cf
......@@ -24,7 +24,6 @@ nobase_dist_graphtooldoc_DATA = \
doc/quickstart.rst \
doc/generation.rst \
doc/mathjax.py \
doc/run_action.rst \
doc/stats.rst \
doc/graph_tool.rst \
doc/modules.rst \
......
.. automodule:: graph_tool.run_action
:members:
:undoc-members:
......@@ -9,14 +9,6 @@ graph_tool_PYTHON = \
graph_tooldir = $(MOD_DIR)
graph_tool_run_action_PYTHON = \
run_action/__init__.py \
run_action/inline.py \
run_action/run_action_support.hh \
run_action/run_action_template.hh
graph_tool_run_actiondir = $(MOD_DIR)/run_action
graph_tool_generation_PYTHON = \
generation/__init__.py
graph_tool_generationdir = $(MOD_DIR)/generation
......
......@@ -49,8 +49,6 @@ from graph_tool.clustering import *
import graph_tool.clustering
from graph_tool.community import *
import graph_tool.community
from graph_tool.run_action import *
import graph_tool.run_action
from graph_tool.topology import *
import graph_tool.topology
from graph_tool.flow import *
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# graph_tool -- a general graph manipulation python module
#
# Copyright (C) 2006-2015 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
``graph_tool.run_action`` - Inline C++ code embedding
-----------------------------------------------------
This module implements support for automatic ad-hoc code embedding into
graph-tool.
Summary
+++++++
.. autosummary::
:nosignatures:
inline
Contents
++++++++
"""
from __future__ import division, absolute_import, print_function
__all__ = ["inline"]
from .inline import inline
This diff is collapsed.
// graph-tool -- a general graph modification and manipulation thingy
//
// Copyright (C) 2006-2015 Tiago de Paula Peixoto <tiago@skewed.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <map>
#include <set>
#include <list>
#include <tr1/unordered_set>
#include <tr1/unordered_map>
#include <tr1/tuple>
#include "graph.hh"
#include "graph_filtering.hh"
#include "graph_properties.hh"
#include "histogram.hh"
#include <boost/bind.hpp>
#include <boost/python.hpp>
using namespace boost;
using namespace std;
using namespace graph_tool;
namespace graph_tool
{
// metafunction to get the correct property map
template <class IndexMap>
struct prop_bind_t
{
template <class Value>
struct as
{
typedef typename mpl::if_<std::is_same<Value,bool>,
uint8_t, Value>::type val_t;
typedef typename property_map_type::apply<val_t,IndexMap>::type type;
};
};
// utility template function to extract the correct property map
template <class PropertyMap>
PropertyMap get_prop(py::object& map)
{
try
{
python::object pmap(python::handle<>
(python::borrowed((PyObject*)(map))));
python::object opmap = pmap.attr("_PropertyMap__map").attr("get_map")();
return any_cast<PropertyMap>(python::extract<boost::any>(opmap)());
}
catch (bad_any_cast&)
{
throw GraphException("could not convert property map as requested");
}
}
}
bool __exception_thrown = false;
string __exception_error;
//variable definitions
${var_defs}
try
{
//variable extraction
${var_extract}
// where the actual code is included
${code}
}
catch (const GraphException& e)
{
__exception_error = e.what();
__exception_thrown = true;
}
catch (const bad_any_cast& e)
{
__exception_error = e.what();
__exception_error += " (wrong property map type?)";
__exception_thrown = true;
}
catch (const std::exception& e)
{
__exception_error = "unknown exception thrown: ";
__exception_error += e.what();
__exception_thrown = true;
}
python::dict return_vals;
return_vals["__exception_error"] = __exception_error;
return_vals["__exception_thrown"] = __exception_thrown;
// updated values will be inserted in return_vals below
${return_vals}
return_val = py::object(return_vals.ptr());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment