<commit_before>import closurebuilder
import depstree
import depswriter
import glob
import jscompiler
import source
import logging
import os
import shutil
import types

from tic import loader
from tic.core import Component, implements
from tic.development.tools.api import IDirectoryWatcher, IRunServerTask, IBuildTask
from tic.web import cdp
from tic.utils import importlib

from google.appengine.ext.webapp import template

def calculate_test_deps(js_test_file_path):
    """
    Calculates the dependancy files for the test
    """
    js = js_test_file_path.replace(loader.root_path(), '/') + '.js'
    css_deps, js_deps = calculate_deps(js_test_file_path.replace('_test', '.js'))

    return css_deps, ['/%s' % path for path in js_deps] + [js]
    

def _calculate_deps(js_entrypoint_file_path):
    js_sources = set()
    source_files = set()
    logging.info('Scanning paths...')
    for js_path in loader.locate("*.js"):
        source_files.add(js_path)
    
    for js_path in source_files:
        js_sources.add(closurebuilder._PathSource(js_path))
    
    logging.info('Building dependency tree..')
    tree = depstree.DepsTree(js_sources)
    namespace = [loader._get_module_name(js_entrypoint_file_path)]
# The Closure Library base file must go first.
    base = closurebuilder._GetClosureBaseFile(js_sources)
    deps = [base] + tree.GetDependencies(namespace)
    return deps

def calculate_deps(js_entrypoint_file_path):
    """TODO Documentation"""
    <commit_msg>fixed an issue where the file path was considered part of the namespace instead of goog.provide statement<commit_after>import closurebuilder
import depstree
import depswriter
import glob
import jscompiler
import source
import logging
import os
import shutil
import types

from tic import loader
from tic.core import Component, implements
from tic.development.tools.api import IDirectoryWatcher, IRunServerTask, IBuildTask
from tic.web import cdp
from tic.utils import importlib

from google.appengine.ext.webapp import template

def calculate_test_deps(js_test_file_path):
    """
    Calculates the dependancy files for the test
    """
    logging.info(js_test_file_path)
    js = js_test_file_path.replace(loader.root_path(), '/') + '.js'
    css_deps, js_deps = calculate_deps(js_test_file_path.replace('_test', '.js'))
    return css_deps, ['/%s' % path for path in js_deps] + [js]
    

def _calculate_deps(js_entrypoint_file_path):
    js_sources = set()
    source_files = set()
    logging.info('Scanning paths for Javascript files...')
    for js_path in loader.locate("*.js"):
        source_files.add(js_path)

    for js_path in source_files:
        js_sources.add(closurebuilder._PathSource(js_path))
    
    logging.info('Done')
    logging.info('Building dependency tree..')
    tree = depstree.DepsTree(js_sources)
    
    #find the namespace of entrypoint
    namespace = [closurebuilder._PathSource(js_entrypoint_file_path).provides.pop()]
    # The Closure Library base file must go first.
    base = closurebuilder._GetClosureBaseFile(js_sources)
    deps = [base] + tree.GetDependencies(namespace)
    logging.info('Done')
    return deps

def calculate_deps(js_entrypoint_file_path):
    """TODO Documentation"""
    
{'fraction_non_alphanumeric': 0.09079640533002789, 'fraction_numerical': 0.0, 'mean_word_length': 4.2918032786885245, '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': '3734024', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1011, 'n_words': 259}