<commit_before>#
# This file is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, 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.

from smv import SmvApp
from pyspark.sql import DataFrame

from smv import CsvAttributes

jvmShellCmd = SmvApp.getInstance()._jvm.org.tresamigos.smv.shell.ShellCmd

def df(name, forceRun = False):
    return SmvApp.getInstance().runModuleByName(name, forceRun)

def ddf(fqn):
    print "ddf has been removed. df now runs modules dynamically. Use df instead of ddf."

def pdf(fqn):
    print "pdf has been removed. Run modules dynamically with df instead."

openHive = lambda tableName: DataFrame(jvmShellCmd.openHive(tableName), SmvApp.getInstance().sqlContext)
openCsv = lambda path: DataFrame(jvmShellCmd.openCsv(path), SmvApp.getInstance().sqlContext)

def help():
    import re
    strip_margin = lambda text: re.sub('\n[ \t]*\|', '\n', text)

    print strip_margin(
     """Here is a list of SMV-shell command
       |
       |Please refer to the API doc for details:
       |https://github.com/TresAmigosSD/SMV/blob/master/docs/user/run_shell.md
       |
       |  * lsStage()
       |  * ls()
       |  * ls(stageName)
       |  * lsDead()
       |  * lsDead(stageName)
       |  * lsDeadLead()
       |  * lsDeadLead(stageName)
       |  * graph()
       |  * graph(stageName)
       |  * ancestors(datasetName)
       |  * descendants(datasetName)
       |  * now()<commit_msg>remove deprecated ddf and pdf smv-pyshell functions<commit_after>#
# This file is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, 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.

from smv import SmvApp
from pyspark.sql import DataFrame

from smv import CsvAttributes

jvmShellCmd = SmvApp.getInstance()._jvm.org.tresamigos.smv.shell.ShellCmd

def df(name, forceRun = False):
    return SmvApp.getInstance().runModuleByName(name, forceRun)

openHive = lambda tableName: DataFrame(jvmShellCmd.openHive(tableName), SmvApp.getInstance().sqlContext)
openCsv = lambda path: DataFrame(jvmShellCmd.openCsv(path), SmvApp.getInstance().sqlContext)

def help():
    import re
    strip_margin = lambda text: re.sub('\n[ \t]*\|', '\n', text)

    print strip_margin(
     """Here is a list of SMV-shell command
       |
       |Please refer to the API doc for details:
       |https://github.com/TresAmigosSD/SMV/blob/master/docs/user/run_shell.md
       |
       |  * lsStage()
       |  * ls()
       |  * ls(stageName)
       |  * lsDead()
       |  * lsDead(stageName)
       |  * lsDeadLead()
       |  * lsDeadLead(stageName)
       |  * graph()
       |  * graph(stageName)
       |  * ancestors(datasetName)
       |  * descendants(datasetName)
       |  * now()
{'fraction_non_alphanumeric': 0.10434782608695652, 'fraction_numerical': 0.002244039270687237, 'mean_word_length': 3.2201183431952662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5654207', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1088, 'n_words': 343}