<commit_before># -*-coding:Utf-8 -*-

"""Contains functions to establish scp connections"""

# Compatibility 2.7-3.4
from __future__ import absolute_import
from __future__ import unicode_literals

import os, re

def parse(originalcmd):
    """Parse the original scp command written by the user.
       Obtain the target, create the command to pass"""
    # We wait a command like :
    # scp [option] /path/to/my/file user@bastion:targetname//path/on/destination
    # or
    # scp [option] user@bastion:targetname//path/on/destination/file /local/path
    # and we should obtain the target name a line like
    # scp -t /path/on/destination/file 
    # scp -f /path/on/destination/file /local/path
    target = re.findall("([^\s]*)//", originalcmd)
    if target:
        target = target[0]

    cmd = re.sub("\[^\s]*//", "/", originalcmd)

    return [target, cmd]
    
    

def connect(target, filelog, login, sshoptions, originalcmd):
    """ Simply launch the scp connection """

    # The final command should be like
    # ssh -q -t login@target scp -t /path/to/target
    # or to receive
    # ssh -q -t login@target scp -f /path/to/target /local/path/<commit_msg>Raphux \ pro... For real!<commit_after># -*-coding:Utf-8 -*-

"""Contains functions to establish scp connections"""

# Compatibility 2.7-3.4
from __future__ import absolute_import
from __future__ import unicode_literals

import os, re

def parse(originalcmd):
    """Parse the original scp command written by the user.
       Obtain the target, create the command to pass"""
    # We wait a command like :
    # scp [option] /path/to/my/file user@bastion:targetname//path/on/destination
    # or
    # scp [option] user@bastion:targetname//path/on/destination/file /local/path
    # and we should obtain the target name a line like
    # scp -t /path/on/destination/file 
    # scp -f /path/on/destination/file /local/path
    target = re.findall("([^\s]*)//", originalcmd)
    if target:
        target = target[0]

    cmd = re.sub("[^\s]*//", "/", originalcmd)

    return [target, cmd]
    
    

def connect(target, filelog, login, sshoptions, originalcmd):
    """ Simply launch the scp connection """

    # The final command should be like
    # ssh -q -t login@target scp -t /path/to/target
    # or to receive
    # ssh -q -t login@target scp -f /path/to/target /local/path/
{'fraction_non_alphanumeric': 0.13152312261349172, 'fraction_numerical': 0.005091217649554518, 'mean_word_length': 2.865573770491803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5696685', 'n_tokens_mistral': 768, 'n_tokens_neox': 750, 'n_words': 240}