<commit_before>################################################################################
# Copyright (c) 2011-2016, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at
#
#   https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

"""Create MS compatible data and write this data into a template MeasurementSet.

This can use either casapy (the default) or pyrap to create the MS.

"""
#
# <NAME>
# 25 March 2008
#

import sys
import os
import os.path
from copy import deepcopy

import numpy as np

# Look for a casacore library binding that will provide Table tools
try:
    # Try to use the casapy table tool first
    import casac
    tb = casac.homefinder.find_home_by_name('tableHome').create()
    casacore_binding = 'casapy'
except:
    try:
        # Otherwise fall back to pyrap
        from pyrap import tables
        casacore_binding = 'pyrap'
    except ImportError:
        casacore_binding = ''


def std_scalar(comment, valueType='integer', option=0, **kwargs):
    """Description for standard scalar column."""
    return dict(comment=comment, valueType=valueType, dataManagerType='StandardStMan',
                dataManagerGroup='StandardStMan', option=option, maxlen=0, **kwargs)


def std_array(comment, valueType, ndim, **kwargs):
    """Description for standard array column with variable shape (used for smaller arrays)."""
    return dict(comment=comment, valueType=valueType, ndim=ndim, dataManagerType='StandardStMan',
                dataManagerGroup='StandardStMan', _c_order=True, option=0, maxlen=0, **kwargs)


def fixed_array(comment, valueType, shape, **kwargs):
    """Description for direct array column with fixed shape (used for smaller arrays)."""
    return dict(comment=comment, valueType=valueType, shape=np.asarray(shape, dtype=np.int32), ndim=len(shape),<commit_msg>Require python-casacore 2.2.1 when importing<commit_after>################################################################################
# Copyright (c) 2011-2016, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at
#
#   https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

"""Create MS compatible data and write this data into a template MeasurementSet.

This can use either casapy (the default) or pyrap to create the MS.

"""
#
# <NAME>
# 25 March 2008
#

import sys
import os
import os.path
from copy import deepcopy

import numpy as np

# Look for a casacore library binding that will provide Table tools
try:
    # Try to use the casapy table tool first
    import casac
    tb = casac.homefinder.find_home_by_name('tableHome').create()
    casacore_binding = 'casapy'
except:
    try:
        # Otherwise fall back to pyrap
        from pyrap import tables
        casacore_binding = 'pyrap'
    except ImportError:
        casacore_binding = ''
    else:
        # Perform python-casacore version checks
        import pkg_resources
        pyc_dist = pkg_resources.get_distribution('python-casacore')
        pyc_ver = pkg_resources.parse_version(pyc_dist.version)
        req_ver = pkg_resources.parse_version("2.2.1")

        if not pyc_ver >= req_ver:
            raise ImportError("python-casacore '%s' is required, "
                              "but the current version is '%s'"
                                              % (req_ver, pyc_ver))



def std_scalar(comment, valueType='integer', option=0, **kwargs):
    """Description for standard scalar column."""
    return dict(comment=comment, valueType=valueType, dataManagerType='StandardStMan',
                dataManagerGroup='StandardStMan', option=option, maxlen=0, **kwargs)


def std_array(comment, valueType, ndim, **kwargs):
    """Description for standard array column with variable shape (used for smaller arrays)."""
    return dict(comment=comment, valueType=valueType, ndim=ndim, dataManagerType='StandardStMan',
                dataManagerGroup='StandardStMan', _c_order=True, option=0, maxlen=0, **kwargs)


def fixed_array(comment, valueType, shape, **kwargs):
    """Description for direct array column with fixed shape (used for smaller arrays)."""
    return dict(comment=comment, valueType=valueType, shape=np.asarray(shape, dtype=np.int32), ndim=len(shape),
{'fraction_non_alphanumeric': 0.14517651500849538, 'fraction_numerical': 0.009439305267132339, 'mean_word_length': 4.16374269005848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1258886', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1372, 'n_words': 513}