<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pathvalidate\n",
    "\n",
    "name = \"_a*b:c<d>e%f/(g)h+i_0.txt\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid filename!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_filename(name)\n",
    "except ValueError:\n",
    "    print(\"invalid filename!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid file path!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_file_path(name)\n",
    "except ValueError:\n",
    "    print(\"invalid file path!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid variable name!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_python_var_name(name)\n",
    "except ValueError:\n",
    "    print(\"invalid variable name!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_abcde%f(g)h+i_0.txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_filename(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_abcde%f/(g)h+i_0.txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_file_path(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "abcdefghi_0txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_python_var_name(name))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {<commit_msg>Update IPython Notebook<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pathvalidate\n",
    "\n",
    "name = \"_a*b:c<d>e%f/(g)h+i_0.txt\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid filename!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_filename(name)\n",
    "except ValueError:\n",
    "    print(\"invalid filename!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid file path!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_file_path(name)\n",
    "except ValueError:\n",
    "    print(\"invalid file path!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "invalid variable name!\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    pathvalidate.validate_python_var_name(name)\n",
    "except ValueError:\n",
    "    print(\"invalid variable name!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_abcde%f(g)h+i_0.txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_filename(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_abcde%f/(g)h+i_0.txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_file_path(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "abcdefghi_0txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.sanitize_python_var_name(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "abcdefghi0txt\n"
     ]
    }
   ],
   "source": [
    "print(pathvalidate.replace_symbol(name))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
{'fraction_non_alphanumeric': 0.21139776665383134, 'fraction_numerical': 0.004620716211012707, 'mean_word_length': 2.12012012012012, 'pattern_counts': {'":': 135, '<': 5, '<?xml version=': 0, '>': 5, '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': '3361056', 'n_tokens_mistral': 2051, 'n_tokens_neox': 2030, 'n_words': 290}