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

## A module unified all file system related stuffs. 
# 
# @note We have read_symbolic_link() implementation, but do not have a 
# read_hard_link() implementation and related stuffs. why? Because the hard link
# just linked to the file object and do not record the original path, though 
# each hard link will be target to the same object, but it just act like a real
# file without original path we linked to. So ...
#  
# @date: 2011-11-13
# @author: starofrainnight

import rabird.compatible
import os
import sys
import shutil

# Python 2.x in win32 do not support link operations, so we use jaraco.window to
# add this support.
if ( sys.version_info.major <= 2 ) and ( sys.platform == "win32" ):
	# TODO: Temporary fix for AttributeError: function 'CreateSymbolicLinkW' not found
	try:
		import jaraco.windows.filesystem
	
		if not hasattr(os, 'symlink'):
			os.symlink = lambda from_path, to_symbolic_link_path: (
				jaraco.windows.filesystem.symlink( from_path, to_symbolic_link_path, is_directory(from_path) ) 
				)
			os.path.islink = jaraco.windows.filesystem.islink
			
		if not hasattr(os, 'readlink'):
			os.readlink = jaraco.windows.filesystem.readlink
			
		if not hasattr(os, 'link'):
			os.link = jaraco.windows.filesystem.link
			
	except AttributeError:
		if not hasattr(os, 'symlink'):
			os.symlink = lambda from_path, to_symbolic_link_path: (
				if os.path.isdir(src):
					shutil.copytree(from_path, to_symbolic_link_path, True)
				else:
					shutil.copy2(from_path, to_symbolic_link_path) 
				)
			os.path.islink = lambda path: ( return False )
			
		if not hasattr(os, 'readlink'):
			os.readlink = lambda path: ( return path)
			
		if not hasattr(os, 'link'):
			os.link = lambda from_path, to_link_path: (
				if os.path.isdir(src):
					shutil.copytree(from_path, to_link_path, True)
				else:
					shutil.copy2(from_path, to_link_path) 
				)
				
		
class option_t(object):
	NONE = 0
	
	## If we do recursive on directories? Only effect on directory operation.
	# Note : It only effect on directory remove operation.
	RECURSIVE = 1
	
	## Ignored any errors we met when we doing an operation.
	IGNORE_ERRORS = 2
	
	## Unused
	FORCE = 4
	
	## Follow symbolic links when doing copy operations
	FOLLOW_SYMBOLIC_LINKS = 8
	<commit_msg>Fixed compile errors that wrong using of lambda method<commit_after># -*- coding: UTF-8 -*-

## A module unified all file system related stuffs. 
# 
# @note We have read_symbolic_link() implementation, but do not have a 
# read_hard_link() implementation and related stuffs. why? Because the hard link
# just linked to the file object and do not record the original path, though 
# each hard link will be target to the same object, but it just act like a real
# file without original path we linked to. So ...
#  
# @date: 2011-11-13
# @author: starofrainnight

import rabird.compatible
import os
import sys
import shutil

# Python 2.x in win32 do not support link operations, so we use jaraco.window to
# add this support.
if ( sys.version_info.major <= 2 ) and ( sys.platform == "win32" ):
	# TODO: Temporary fix for AttributeError: function 'CreateSymbolicLinkW' not found
	try:
		import jaraco.windows.filesystem
	
		if not hasattr(os, 'symlink'):
			os.symlink = lambda from_path, to_symbolic_link_path: (
				jaraco.windows.filesystem.symlink( from_path, to_symbolic_link_path, is_directory(from_path) ) 
				)
			os.path.islink = jaraco.windows.filesystem.islink
			
		if not hasattr(os, 'readlink'):
			os.readlink = jaraco.windows.filesystem.readlink
			
		if not hasattr(os, 'link'):
			os.link = jaraco.windows.filesystem.link
			
	except AttributeError:
		if not hasattr(os, 'symlink'):
			os.symlink = lambda from_path, to_symbolic_link_path: (
				os.path.isdir(from_path) if	shutil.copytree(from_path, to_symbolic_link_path, True) else shutil.copy2(from_path, to_symbolic_link_path) 
				)
			os.path.islink = lambda path: False
			
		if not hasattr(os, 'readlink'):
			os.readlink = lambda path: path
			
		if not hasattr(os, 'link'):
			os.link = lambda from_path, to_link_path: (
					os.path.isdir(from_path) if	shutil.copytree(from_path, to_link_path, True) else shutil.copy2(from_path, to_link_path)
				)
				
		
class option_t(object):
	NONE = 0
	
	## If we do recursive on directories? Only effect on directory operation.
	# Note : It only effect on directory remove operation.
	RECURSIVE = 1
	
	## Ignored any errors we met when we doing an operation.
	IGNORE_ERRORS = 2
	
	## Unused
	FORCE = 4
	
	## Follow symbolic links when doing copy operations
	FOLLOW_SYMBOLIC_LINKS = 8
	
{'fraction_non_alphanumeric': 0.09205384281372124, 'fraction_numerical': 0.009552757273122015, 'mean_word_length': 3.7202868852459017, 'pattern_counts': {'":': 0, '<': 5, '<?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': '73695', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1522, 'n_words': 486}