<commit_before>"""
Commonly used utilities
"""

import os
import re
import sys
import platform
import pkgutil
import inspect
from re import escape
from path import path
#-----------------------------------------------
#  Pymel Internals
#-----------------------------------------------

#===============================================================================
# Strings
#===============================================================================

def capitalize(s):
    """
    Python's string 'capitalize' method is NOT equiv. to mel's capitalize, which preserves
    capital letters.<commit_msg>util.common: add inMaya() func<commit_after>"""
Commonly used utilities
"""

import os
import re
import sys
import platform
import pkgutil
import inspect
from re import escape
from path import path
#-----------------------------------------------
#  Pymel Internals
#-----------------------------------------------

def inMaya():
    """
    Returns True if called from a fully initialized Maya session.
    """
    try:
        # can't do:
        #   import maya.cmds
        #   maya.cmds.about
        # ... unless we also check for AttributeError, as a non-initialized maya
        # will import maya.cmds, but won't find maya.cmds.about
        from maya.cmds import about
        if about(api=True) is None:
            return False
    except ImportError:
        return False
    return True


#===============================================================================
# Strings
#===============================================================================

def capitalize(s):
    """
    Python's string 'capitalize' method is NOT equiv. to mel's capitalize, which preserves
    capital letters.
{'fraction_non_alphanumeric': 0.3486078886310905, 'fraction_numerical': 0.0, 'mean_word_length': 2.409090909090909, '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': '3996855', 'n_tokens_mistral': 404, 'n_tokens_neox': 370, 'n_words': 139}