<commit_before>package com.tapad.adserving;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.webkit.WebView;
import com.tapad.tracking.Tracking;

/**
 * Main entry point for ad serving API users. Provides API initialization as well
 * as access to the ad serving service which allows for fetching raw HTML markup.
 *
 * The init method must be invoked regardless of whether the managed ad views
 * are used or if the API user want to access the markup directly.
 */
public class AdServing {
    private static AdServingService service;

    /**
     * Initializes the ad serving API with publisher and property ids as specified in
     * AndroidManifest.xml:
     *
     * <application>
     *  <meta-data android:name="swappit.PUBLISHER_ID" android:value="INSERT_PUBLISHER_ID_HERE"/>
     *  <meta-data android:name="swappit.PROPERTY_ID" android:value="INSERT_PROPERTY_ID_HERE"/>
     *  ...
     * </application>
     *
     * @param context     a context reference
     */
    public static void init(Context context) {
        try {
            ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            String publisherId = ai.metaData.getString("swappit.PUBLISHER_ID");
            if (publisherId == null) throw new RuntimeException("swappit.PUBLISHER_ID is not set in AndroidManifest.xml");

            String propertyId = ai.metaData.getString("swappit.PROPERTY_ID");
            if (propertyId== null) throw new RuntimeException("swappit.PROPERTY_ID is not set in AndroidManifest.xml");

            init(context, publisherId, propertyId);<commit_msg>reading the property and publisher id as an object so it handles numeric and string looking values<commit_after>package com.tapad.adserving;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.webkit.WebView;
import com.tapad.tracking.Tracking;

/**
 * Main entry point for ad serving API users. Provides API initialization as well
 * as access to the ad serving service which allows for fetching raw HTML markup.
 *
 * The init method must be invoked regardless of whether the managed ad views
 * are used or if the API user want to access the markup directly.
 */
public class AdServing {
    private static AdServingService service;

    /**
     * Initializes the ad serving API with publisher and property ids as specified in
     * AndroidManifest.xml:
     *
     * <application>
     *  <meta-data android:name="swappit.PUBLISHER_ID" android:value="INSERT_PUBLISHER_ID_HERE"/>
     *  <meta-data android:name="swappit.PROPERTY_ID" android:value="INSERT_PROPERTY_ID_HERE"/>
     *  ...
     * </application>
     *
     * @param context     a context reference
     */
    public static void init(Context context) {
        try {
            ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            Object publisherId = ai.metaData.get("swappit.PUBLISHER_ID");
            if (publisherId == null) throw new RuntimeException("swappit.PUBLISHER_ID is not set in AndroidManifest.xml");

            Object propertyId = ai.metaData.get("swappit.PROPERTY_ID");
            if (propertyId== null) throw new RuntimeException("swappit.PROPERTY_ID is not set in AndroidManifest.xml");

            init(context, publisherId.toString(), propertyId.toString());
{'fraction_non_alphanumeric': 0.08806096528365792, 'fraction_numerical': 0.0, 'mean_word_length': 3.5729032258064515, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6718117', 'n_tokens_mistral': 973, 'n_tokens_neox': 952, 'n_words': 295}