Given the parsed args, initialize the dbt tracking code.

    It would be nice to re-use this profile later on instead of parsing it
    twice, but dbt's intialization is not structured in a way that makes that
    easy.
12003
def initialize_config_values(parsed):
    
    try:
        cfg = UserConfig.from_directory(parsed.profiles_dir)
    except RuntimeException:
        cfg = UserConfig.from_dict(None)

    if cfg.send_anonymous_usage_stats:
        dbt.tracking.initialize_tracking(parsed.profiles_dir)
    else:
        dbt.tracking.do_not_track()

    if cfg.use_colors:
        dbt.ui.printer.use_colors()
1248117
def init (self, base_ref, base_url, parent_url, recursion_level,
              aggregate, line, column, page, name, url_encoding, extern):
        
        self.base_ref = base_ref
        if self.base_ref is not None:
            assert isinstance(self.base_ref, unicode), repr(self.base_ref)
        self.base_url = base_url.strip() if base_url else base_url
        if self.base_url is not None:
            assert isinstance(self.base_url, unicode), repr(self.base_url)
        self.parent_url = parent_url
        if self.parent_url is not None:
            assert isinstance(self.parent_url, unicode), repr(self.parent_url)
        self.recursion_level = recursion_level
        self.aggregate = aggregate
        self.line = line
        self.column = column
        self.page = page
        self.name = name
        assert isinstance(self.name, unicode), repr(self.name)
        self.encoding = url_encoding
        self.charset = None
        self.extern = extern
        if self.base_ref:
            assert not urlutil.url_needs_quoting(self.base_ref), \
                   "unquoted base reference URL %r" % self.base_ref
        if self.parent_url:
            assert not urlutil.url_needs_quoting(self.parent_url), \
                   "unquoted parent URL %r" % self.parent_url
        url = absolute_url(self.base_url, base_ref, parent_url)
        # assume file link if no scheme is found
        self.scheme = url.split(":", 1)[0].lower() or "file"
        if self.base_url != base_url:
            self.add_warning(_("Leading or trailing whitespace in URL `%(url)s'.") %
                               {"url": base_url}, tag=WARN_URL_WHITESPACE)
1019282
public function initialize()
    {
        if (true == $this->initialized) {
            return;
        }
        $this->initialized = true;
        
        if (null !== $this->trackingId) {
            $trackerId = $this->trackingId;
            $inlineScript = $this->getView()->plugin('inlineScript');
            $inlineScript->appendScript(<<<HDOC
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '$trackerId', 'auto');
ga('send', 'pageview');
HDOC
            );
        }
    }
236310
def init_argparser(self, argparser):
        

        super(PackageManagerRuntime, self).init_argparser(argparser)

        # Ideally, we could use more subparsers for each action (i.e.
        # init and install).  However, this is complicated by the fact
        # that setuptools has its own calling conventions through the
        # setup.py file, and to present a consistent cli to end-users
        # from both calmjs entry point and setuptools using effectively
        # the same codebase will require a bit of creative handling.

        # provide this for the setuptools command class.
        actions = argparser.add_argument_group('action arguments')
        count = 0

        for full, short, desc in self.pkg_manager_options:
            args = [
                dash + key
                for dash, key in zip(('-', '--'), (short, full))
                if key
            ]
            # default is singular, but for the argparsed version in our
            # runtime permits multiple packages.
            desc = desc.replace('Python package', 'Python package(s)')
            if not short:
                f = getattr(self.cli_driver, '%s_%s' % (
                    self.cli_driver.binary, full), None)
                if callable(f):
                    count += 1
                    actions.add_argument(
                        *args, help=desc, action=PackageManagerAction,
                        dest=self.action_key, const=(count, f)
                    )
                    if self.default_action is None:
                        self.default_action = f
                    continue  # pragma: no cover
            argparser.add_argument(*args, help=desc, action='store_true')

        argparser.add_argument(
            'package_names', metavar=metavar('package'), nargs='+',
            help="python packages to be used for the generation of '%s'" % (
                self.cli_driver.pkgdef_filename,
            ),
        )
517206
protected function initCounters()
    {
        $pos = 0;
        while ($pos < strlen($this->pattern)) {
            $char = $this->pattern[$pos];
            if ($char == "{") {
                $this->uriVars++;
                $pos++;
            } else if ($char == "*") {
                if (($pos + 1) < strlen($this->pattern) && $this->pattern[$pos + 1] == "*") {
                    $this->doubleWildcards++;
                    $pos += 2;
                } else if (!substr($this->pattern, $pos - 1) == ".*") {
                    $this->singleWildcards++;
                    $pos++;
                } else {
                    $pos++;
                }
            } else {
                $pos++;
            }
        }
    }
440797
public static void main(String args[]) {
        String deviceName = "tango/admin/corvus/hoststate";
        try {
            AttributeProxy att = new AttributeProxy(deviceName);
            att.ping();
            System.out.println(att.name() + " is alive");
            DbAttribute db_att = att.get_property();
            for (int i = 0; i < db_att.size(); i++) {
                DbDatum datum = db_att.datum(i);
                System.out.println(datum.name + " : " + datum.extractString());
            }

            DeviceAttribute da = att.read();
            System.out.println(att.name() + " : " + da.extractShort());
            System.out.println(att.name() + " state  : " + ApiUtil.stateName(att.state()));
            System.out.println(att.name() + " status : " + att.status());
        } catch (DevFailed e) {
            Except.print_exception(e);
        }
    }
192431
public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget)
    {
        super.init(field);
        m_screenField = screenField;
        m_fldTarget = fldTarget;

        m_bScreenMove = true;   // Only respond to user change
        m_bInitMove = false;
        m_bReadMove = false;
        if (screenField == null)
            this.lookupSField();
    }
96816
def start_tracker(self, id_, **kwargs):
        
        data = None
        if kwargs:
            data = self._wrap_dict("tracker",
                self._wrap_dict("tracking_time_entry", kwargs))
        return self.patch("/tracker/{}.json".format(id_), data=data)
600422
def tracer_config(__init__, app, args, kwargs):
    
    __init__(*args, **kwargs)

    tracing = app.settings.get('opentracing_tracing')
    tracer_callable = app.settings.get('opentracing_tracer_callable')
    tracer_parameters = app.settings.get('opentracing_tracer_parameters', {})

    if tracer_callable is not None:
        if not callable(tracer_callable):
            tracer_callable = _get_callable_from_name(tracer_callable)

        tracer = tracer_callable(**tracer_parameters)
        tracing = TornadoTracing(tracer)

    if tracing is None:
        tracing = TornadoTracing()  # fallback to the global tracer

    app.settings['opentracing_tracing'] = tracing

    tracing._trace_all = app.settings.get('opentracing_trace_all',
                                          DEFAULT_TRACE_ALL)
    tracing._trace_client = app.settings.get('opentracing_trace_client',
                                             DEFAULT_TRACE_CLIENT)
    tracing._start_span_cb = app.settings.get('opentracing_start_span_cb',
                                              None)

    httpclient._set_tracing_enabled(tracing._trace_client)
    if tracing._trace_client:
        httpclient._set_tracing_info(tracing._tracer_obj,
                                     tracing._start_span_cb)
1243452
def p_InUseTraitDef(p):
    '''
    
    '''
    if p[2] == 'insteadof':
        p[0] = InUseTraitDef(p[1], p[2], None, p[3], p[4])
    elif len(p) <= 5:
        p[0] = InUseTraitDef(p[1], p[2], p[3], None, p[4])
    else:
        p[0] = InUseTraitDef(p[1], p[2], p[3], p[4], p[5])
1134989
def create(self, datapath, tracker_urls, comment=None, root_name=None,
                     created_by=None, private=False, no_date=False, progress=None,
                     callback=None):
        
        if datapath:
            self.datapath = datapath

        try:
            tracker_urls = ['' + tracker_urls]
        except TypeError:
            tracker_urls = list(tracker_urls)
        multi_mode = len(tracker_urls) > 1

        # TODO add optimization so the hashing happens only once for multiple URLs!
        for tracker_url in tracker_urls:
            # Lookup announce URLs from config file
            try:
                if urlparse.urlparse(tracker_url).scheme:
                    tracker_alias = urlparse.urlparse(tracker_url).netloc.split(':')[0].split('.')
                    tracker_alias = tracker_alias[-2 if len(tracker_alias) > 1 else 0]
                else:
                    tracker_alias, tracker_url = config.lookup_announce_alias(tracker_url)
                    tracker_url = tracker_url[0]
            except (KeyError, IndexError):
                raise error.UserError("Bad tracker URL %r, or unknown alias!" % (tracker_url,))

            # Determine metafile name
            output_name = self.filename
            if multi_mode:
                # Add 2nd level of announce URL domain to metafile name
                output_name = list(os.path.splitext(output_name))
                try:
                    output_name[1:1] = '-' + tracker_alias
                except (IndexError,):
                    self.LOG.error("Malformed announce URL %r, skipping!" % (tracker_url,))
                    continue
                output_name = ''.join(output_name)

            # Hash the data
            self.LOG.info("Creating %r for %s %r..." % (
                output_name, "filenames read from" if self._fifo else "data in", self.datapath,
            ))
            meta, _ = self._make_meta(tracker_url, root_name, private, progress)

            # Add optional fields
            if comment:
                meta["comment"] = comment
            if created_by:
                meta["created by"] = created_by
            if not no_date:
                meta["creation date"] = int(time.time())
            if callback:
                callback(meta)

            # Write metafile to disk
            self.LOG.debug("Writing %r..." % (output_name,))
            bencode.bwrite(output_name, meta)

        return meta
78653
def init(self):
        
        if os.path.isdir(self.path):
            raise InvalidTodoFile
        if os.path.exists(self.path):
            with open(self.path, 'r') as f:
                tls = [tl.strip() for tl in f if tl]
                todos = map(_todo_from_file, tls)
                self.todos = todos
                for todo in todos:
                    if self.current_max_idx < todo['idx']:
                        self.current_max_idx = todo['idx']
        else:
            logger.warning('No todo files found, initialization a empty todo file')
            with open(self.path, 'w') as f:
                f.flush()
1134672
def init(arg):
    

    answers = {'a': 1}
    if arg == 'interactive':
        input("""Hi There!
    DataFlows will now bootstrap a data processing flow based on your needs.

    Press any key to start...
    """)

    elif arg == 'hello-world':
        raise NotImplementedError()
    else:
        url = arg
        answers = dict(
            input='remote',
            title=os.path.basename(url),
            input_url=url,
            processing=[],
            output='print_n_pkg'
        )
        extract_format(answers, url)

    questions = [
        # Input
        inquirer.List('input_str',
                    message='What is the source of your data?',
                    choices=INPUTS.keys(),
                    ignore=lambda ctx: ctx.get('input') is not None,
                    validate=convert_input),

        # Input Parameters
        inquirer.Text('input_url',
                    message="What is the path of that file",
                    ignore=fany(lambda ctx: ctx.get('input') != 'file',
                                lambda ctx: ctx.get('input_url') is not None),
                    validate=fall(not_empty, extract_format)),
        inquirer.List('format',
                    message="We couldn't detect the file format - which is it?",
                    choices=FORMATS[:-1],
                    ignore=fany(lambda ctx: ctx.get('input') != 'file',
                                lambda ctx: ctx.get('format') in FORMATS)),

        inquirer.Text('input_url',
                    message="Where is that file located (URL)",
                    ignore=fany(lambda ctx: ctx.get('input') != 'remote',
                                lambda ctx: ctx.get('input_url') is not None),
                    validate=fall(extract_format, not_empty, valid_url)),
        inquirer.List('format',
                      message="We couldn't detect the source format - which is it",
                      choices=FORMATS,
                      ignore=fany(lambda ctx: ctx['input'] != 'remote',
                                  lambda ctx: ctx.get('format') in FORMATS)
                      ),
        inquirer.Text('sheet',
                      message="Which sheet in the spreadsheet should be processed (name or index)",
                      validate=not_empty,
                      ignore=lambda ctx: ctx.get('format') not in ('xls', 'xlsx', 'ods'),
                      ),
        inquirer.Text('input_url',
                      message="What is the connection string to the database",
                      validate=not_empty,
                      ignore=fany(lambda ctx: ctx['input'] != 'sql',
                                  lambda ctx: ctx.get('input_url') is not None),
                      ),
        inquirer.Text('input_db_table',
                      message="...and the name of the database table to extract",
                      validate=not_empty,
                      ignore=fany(lambda ctx: ctx['input'] != 'sql',
                                  lambda ctx: ctx.get('input_db_table') is not None),
                      ),

        inquirer.Text('input_url',
                      message="Describe that other source (shortly)",
                      ignore=fany(lambda ctx: ctx['input'] != 'other',
                                  lambda ctx: ctx.get('input_url') is not None),
                      ),

        # Processing
        inquirer.Checkbox('processing_str',
                        message="What kind of processing would you like to run on the data",
                        choices=PROCESSING.keys(),
                        ignore=lambda ctx: ctx.get('processing') is not None,
                        validate=convert_processing),

        # Output
        inquirer.List('output_str',
                    message="Finally, where would you like the output data",
                    choices=OUTPUTS.keys(),
                    ignore=lambda ctx: ctx.get('output') is not None,
                    validate=convert_output),
        inquirer.Text('output_url',
                      message="What is the connection string to the database",
                      validate=not_empty,
                      ignore=fany(lambda ctx: ctx['output'] != 'sql',
                                  lambda ctx: ctx.get('output_url') is not None),
                      ),
        inquirer.Text('output_db_table',
                      message="...and the name of the database table to write to",
                      validate=not_empty,
                      ignore=fany(lambda ctx: ctx['output'] != 'sql',
                                  lambda ctx: ctx.get('output_db_table') is not None),
                      ),

        # # Finalize
        inquirer.Text('title',
                    message="That's it! Now, just provide a title for your processing flow",
                    ignore=lambda ctx: ctx.get('title') is not None,
                    validate=not_empty),
    ]
    answers = inquirer.prompt(questions, answers=answers, theme=themes.GreenPassion())
    if answers is None:
        return
    answers['slug'] = slugify.slugify(answers['title'], separator='_')

    filename = '{slug}.py'.format(**answers)
    with open(filename, 'w') as out:
        print('Writing processing code into {}'.format(filename))
        out.write(render(answers))

    try:
        print('Running {}'.format(filename))
        ret = subprocess.check_output('python '+filename,
                                      stderr=subprocess.PIPE, universal_newlines=True, shell=True)
        print(ret)
        print('Done!')
    except subprocess.CalledProcessError as e:
        print("Processing failed, here's the error:")
        print(e.stderr)
        answers = inquirer.prompt([
            inquirer.Confirm('edit',
                            message='Would you like to open {} in the default editor?'.format(filename),
                            default=False)
        ])
        if answers['edit']:
            click.edit(filename=filename)
821732
public void init(BaseField field, String targetFieldName, BaseField fldTarget)
    {
        super.init(field);

        m_bDisableTarget = false;
        this.targetFieldName = targetFieldName;
        m_fldTarget = fldTarget;
    }
1331861
async function init () {
    // initialze logging
    initLogging(this.immutableApp)
    // initialize global dir config by merging module configs
    initDir(this.immutableApp)
    // initalize handlebars
    initHandlebars(this.immutableApp)
    // initalize express request handling - bodyParser, cookieParser, etc
    initExpress(this.immutableApp)
    // initialize app
    initApp(this.immutableApp)
    // add error handler after all other middleware and routers
    initErrorHandler(this.immutableApp)
    // initialize models
    await initModels(this.immutableApp)
    // intialize components after models since they may use models
    initComponents(this.immutableApp)
    // initialize services after models since they may use models
    await initServices(this.immutableApp)
    // set initialize flag to true
    this.immutableApp.initialized = true
    // debug
    debug('init', this.immutableApp)
}
591340
public synchronized void updateFromTrackParameters(TrackParameters track) {
    parameters.clear();
    for(TrackedParameter p : track.getAllParameters()) {
      Parameter<?> option = p.getParameter();
      String value = null;
      if(option.isDefined()) {
        if(option.tookDefaultValue()) {
          value = DynamicParameters.STRING_USE_DEFAULT + option.getDefaultValueAsString();
        }
        else {
          value = option.getValueAsString();
        }
      }
      if(value == null) {
        value = (option instanceof Flag) ? Flag.NOT_SET : "";
      }
      int bits = 0;
      if(option.isOptional()) {
        bits |= BIT_OPTIONAL;
      }
      if(option.hasDefaultValue() && option.tookDefaultValue()) {
        bits |= BIT_DEFAULT_VALUE;
      }
      if(value.length() <= 0) {
        if((bits & BIT_DEFAULT_VALUE) == 0 && (bits & BIT_OPTIONAL) == 0) {
          bits |= BIT_INCOMPLETE;
        }
      }
      else {
        try {
          if(!option.tookDefaultValue() && !option.isValid(value)) {
            bits |= BIT_INVALID;
          }
        }
        catch(ParameterException e) {
          bits |= BIT_INVALID;
        }
      }
      int depth = 0;
      {
        Object pos = track.getParent(option);
        while(pos != null) {
          pos = track.getParent(pos);
          depth += 1;
          if(depth > 10) {
            break;
          }
        }
      }
      parameters.add(new Node(option, value, bits, depth));
    }
  }
1081743
def init_handler(args):
    
    try:
        initialize_repository(pathlib.Path.cwd())
    except ValueError as exc:
        print(exc, file=sys.stderr)
        return ExitCode.DATAERR

    return ExitCode.OK