Initialize Google Analytics if analytics id exists and environment is
production
191724
function initGA() {
  if (analyticsTrackingId) {
    ReactGA.initialize(analyticsTrackingId)
    ReactGA.set({
      appName: environment || 'Production',
      appVersion: version
    })
  }
}
692761
function (environment, options) {
    this.applicationId = options && options.applicationId;
    this.environment = environment;
    this.page = page;
    this.adManager = null;
    this.path = window.location.pathname;
    this.events = events;
    this.adManager = new AdManager(this.applicationId, this.deviceDetails, this.environment);
    appSettings.overrides = (options && options.overrides) || window.ADLIB_OVERRIDES || null;
    this.deviceDetails = deviceDetector.getDeviceDetails();

    // If the script include is placed in the <head> of the page,
    // document.body is not ready yet, and we need it to retrieve the token
    if (document.body) {
        page.preloadToken(this.environment);
    }
    page.addDomReadyListener(this.environment);

    if (options && options.setupGlobalApi) {
        //Only when this option is specified, setup the API on the global window
        this._setUpGlobalAPI();
    }
}
1186739
def initialize_api(args):
  
  global api
  api = ApiResource(server_host=args.hostname, server_port=args.port,
                    username=args.username, password=args.password,
                    version=args.api_version, use_tls=args.use_tls)
36079
function initGlobal (args) {
    // do nothing if global data already defined
    if (global.__immutable_core_model__) {
        return
    }
    // create new global object
    var GLOBAL = global.__immutable_core_model__ = {
        // number of concurrent related queries to allow per query
        concurrency: 5,
        // default to use binary columns for ids
        defaultBinaryIds: true,
        // default character set
        defaultCharset: 'utf8',
        // default compression setting
        defaultCompression: true,
        // default elastic search client
        defaultElasticsearch: undefined,
        // default database engine
        defaultEngine: 'InnoDB',
        // default insert delayed option for myisam tables
        defaultInsertDelayed: false,
        // map of models indexed by name
        models: {},
    }
    // create validator as global object so that schemas will be shared
    // between all model classes
    GLOBAL.validator = new Ajv({
        allErrors: true,
        coerceTypes: 'array',
        removeAdditional: true,
        useDefaults: true,
        v5: true,
    })
}
618810
def save_existing_iam_env_vars(self):
        """"""
        for i in ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',
                  'AWS_SESSION_TOKEN']:
            if i in self.env_vars:
                self.env_vars['OLD_' + i] = self.env_vars[i]
859426
def init(self):
        """"""
        if not self.export_enable:
            return None

        try:
            db = InfluxDBClient(host=self.host,
                                port=self.port,
                                username=self.user,
                                password=self.password,
                                database=self.db)
            get_all_db = [i['name'] for i in db.get_list_database()]
        except InfluxDBClientError as e:
            logger.critical("Cannot connect to InfluxDB database '%s' (%s)" % (self.db, e))
            sys.exit(2)

        if self.db in get_all_db:
            logger.info(
                "Stats will be exported to InfluxDB server: {}".format(db._baseurl))
        else:
            logger.critical("InfluxDB database '%s' did not exist. Please create it" % self.db)
            sys.exit(2)

        return db
55799
def init_app(self, app, env_file=None, verbose_mode=False):
        """"""
        if self.app is None:
            self.app = app
        self.verbose_mode = verbose_mode

        if env_file is None:
            env_file = os.path.join(os.getcwd(), ".env")
        if not os.path.exists(env_file):
            warnings.warn("can't read {0} - it doesn't exist".format(env_file))
        else:
            self.__import_vars(env_file)
355108
def init_worker(inpaths, g_args):
    
    global global_args
    global srcs
    global_args = g_args
    srcs = [rasterio.open(i) for i in inpaths]
253456
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        self._json_dict = json_dict
        self._json = json.dumps(self._json_dict)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]
        for k,v in json_dict.items():
            if k in attributes:
                if k == "versions" and json_dict[k]:
                    self._versions = []
                    for version in v:
                        self._versions.append(
                            Version(url=self._url + "/versions/%s" % version,
                                    securityHandler=self._securityHandler,
                                    proxy_url=self._proxy_url,
                                    proxy_port=self._proxy_port,
                                    initialize=False))
                elif k == "replicas" and json_dict[k]:
                    self._replicas = []
                    for version in v:
                        self._replicas.append(
                            Replica(url=self._url + "/replicas/%s" % version,
                                    securityHandler=self._securityHandler,
                                    proxy_url=self._proxy_url,
                                    proxy_port=self._proxy_port,
                                    initialize=False))
                else:
                    setattr(self, "_"+ k, v)
            else:
                print (k, " - attribute not implemented for GeoData Service")
1141691
def cli(env, account_id):
    """"""

    manager = SoftLayer.CDNManager(env.client)
    origins = manager.get_origins(account_id)

    table = formatting.Table(['id', 'media_type', 'cname', 'origin_url'])

    for origin in origins:
        table.add_row([origin['id'],
                       origin['mediaType'],
                       origin.get('cname', formatting.blank()),
                       origin['originUrl']])

    env.fout(table)
667969
function Analytics(phonegap) {
        "use strict";
    
        var configured;
        var ready;
        var accountID = beyond.params.analytics;
        var analytics;
    
        function success() {
            ready = true;
        }
    
        function error() {
            // nothing to do right now
        }
    
        function onPhonegapReady() {
            analytics = window.plugins.gaPlugin;
            if (!analytics) return;
    
            configured = true;
            analytics.init(success, error, accountID, 10);
        }
    
        if (accountID) {
            phonegap.done(onPhonegapReady);
        }
    
        this.trackEvent = function (category, action, label, value) {
    
            if (!configured) return;
            if (!ready) return;
    
            function success() {
                // nothing to do right now
            }
    
            function error() {
                // nothing to do right now
            }
    
            analytics.trackEvent(success, error, category, action, label, value);
    
        };
    
        this.trackPage = function (url) {
    
            if (!configured) return;
            if (!ready) return;
    
            function success() {
                // nothing to do right now
            }
    
            function error() {
                // nothing to do right now
            }
    
            analytics.trackPage(success, error, url);
    
        };
    
        this.exit = function (callback) {
    
            if (!ready) {
                if (callback) callback();
                return;
            }
    
            function success() {
                if (callback) callback();
            }
    
            function error() {
                // TODO: add an error handler
                if (callback) callback();
            }
    
            if (analytics) analytics.exit(success, error);
    
            ready = false;
    
        };
    
    }
1276319
function initApiProxy() {
  if (build.verbose)
    console.log('Proxying paths...');
  lodash.forEach(build.proxyMap, function (proxyOpts, urlPath) {
    if (build.verbose)
      console.log('  - url: "' + urlPath + '"');
    app.use(urlPath, proxy(proxyOpts));
    // e.g. `app.use('/api', proxy({target: "http://localhost:4321/api", 
    // changeOrigin: true});`
  });
}
1259783
def load(path):
        
        with open(path, "r") as fobj:
            analytics = Analytics(info=json.load(fobj))
        os.unlink(path)
        return analytics
798369
def init(self):
        """"""
        if not self.export_enable:
            return None
        # Build the RESTful URL where the stats will be posted
        url = '{}://{}:{}{}'.format(self.protocol,
                                    self.host,
                                    self.port,
                                    self.path)
        logger.info(
            "Stats will be exported to the RESTful endpoint {}".format(url))
        return url
1083422
function init(options) {
		setting = options || {};

		if (!setting.googleApiKey && !setting.yandexApiKey) {
			console.warn(constant.ERROR.MISSING_TOKEN);
			return false;
		} else if (setting.yandexApiKey) {
			serviceType = constant.YANDEX_NAME;
			translateSrv = require('./service/yandex.js');
		} else {
			serviceType = constant.GOOGLE_NAME;
			translateSrv = require('./service/google.js');
		}

		translateSrv.init(setting);
		return true;
	}
548391
def init_logger(name=None):
    """"""
    global g_logger
 
    if g_logger is None:
        g_logger = logging.getLogger(name=name)
    else:
        logging.shutdown()
        g_logger.handlers = []
 
    g_logger.setLevel(logging.DEBUG)
432773
def init_farm(farm_name):
    
    utils.check_for_cloud_server()
    utils.check_for_cloud_user()
    old_farm_name = config["cloud_server"]["farm_name"]
    if old_farm_name and old_farm_name != farm_name:
        raise click.ClickException(
            "Farm \"{}\" already initialized. Run `openag cloud deinit_farm` "
            "to deinitialize it".format(old_farm_name)
        )
    if config["local_server"]["url"]:
        utils.replicate_per_farm_dbs(farm_name=farm_name)
    config["cloud_server"]["farm_name"] = farm_name