specialize the db for the particular tab
544511
function (tabName, thePicoInp, dname, callback) {
      var eci = findEciById(thePicoInp.id)
      if (tabName === 'about') {
        var hasRID = function (pid, rid) {
          return !!get(dbDump.pico, [pid, 'ruleset', rid])
        }
        var thePicoOut = {}
        thePicoOut.pico_id = thePicoInp.id
        thePicoOut.id = thePicoInp.id
        thePicoOut.eci = eci
        var ppECI = getP(thePicoInp, 'parent_eci', undefined)
        var pp = ppECI
          ? { id: get(dbDump.channel, [ppECI, 'pico_id']), eci: ppECI }
          : undefined
        if (pp) {
          thePicoOut.parent = {}
          thePicoOut.parent.id = pp.id
          thePicoOut.parent.eci = pp.eci
          thePicoOut.parent.dname = getV(pp, 'dname', undefined)
        }
        if (thePicoInp.id === rootPico.id || (pp && pp.id === rootPico.id)) {
          var pswdAuth = hasRID(
            thePicoInp.id,
            'io.picolabs.owner_authentication'
          )
          var didAuth = hasRID(thePicoInp.id, 'io.picolabs.did_auth_only')
          thePicoOut.isOwner = pswdAuth || didAuth
          thePicoOut.pswdAuth = pswdAuth
        }
        thePicoOut.children = []
        var reportedChildren = getP(thePicoInp, 'children', [])
        var i = 0
        var cLen = reportedChildren.length
        for (; i < cLen; ++i) {
          var p = reportedChildren[i]
          var cp = {}
          cp.id = p.id
          cp.eci = p.eci
          if (dbDump.pico[p.id] === undefined) continue
          cp.dname = getV(p, 'dname', undefined)
          cp.canDel = getP(p, 'children', []).length === 0
          thePicoOut.children.push(cp)
        }
        thePicoOut.dname = getV(thePicoInp, 'dname', dname)
        thePicoOut.color = getV(
          thePicoInp,
          'color',
          thePicoOut.parent ? '#7FFFD4' : '#87CEFA'
        )
        callback(null, thePicoOut)
      } else if (tabName === 'rulesets') {
        var theRulesetInp = thePicoInp
        var installedRS = {}
        for (var rs in theRulesetInp.ruleset) {
          installedRS[rs] = theRulesetInp.ruleset[rs]
          if (
            rs !== 'io.picolabs.wrangler' &&
            rs !== 'io.picolabs.visual_params'
          ) {
            installedRS[rs].canDel = true
          }
        }
        var avail = []
        dbDump.enabledRIDs.forEach(function (rid) {
          if (installedRS[rid] === undefined) {
            avail.push(rid)
          }
        })
        var theRulesetOut = {
          pico_id: thePicoInp.id,
          eci: eci,
          installed: installedRS,
          avail: avail
        }
        callback(null, theRulesetOut)
      } else if (tabName === 'logging') {
        var theLoggingOut = {}
        theLoggingOut.eci = eci
        theLoggingOut.pico_id = thePicoInp.id
        if (get(dbDump, ['pico', thePicoInp.id, 'ruleset', 'io.picolabs.logging', 'on'])) {
          theLoggingOut.status = true
          $.getJSON('/api/pico/' + thePicoInp.id + '/logs', function (data) {
            theLoggingOut.logs = groupLogsByEpisode(data)
            callback(null, theLoggingOut)
          }).fail(function (err) {
            theLoggingOut.error = 'Failed to get data'
            callback(null, theLoggingOut)
          })
        } else {
          theLoggingOut.disabled = true
          callback(null, theLoggingOut)
        }
      } else if (tabName === 'testing') {
        var testing = []
        eci = findEciById(thePicoInp.id)
        for (rid in thePicoInp.ruleset) {
          testing.push({ rid: rid })
        }
        callback(null, { pico_id: thePicoInp.id, eci: eci, testing: testing })
      } else if (tabName === 'channels') {
        var theChannels = []
        var thePolicies = get(dbDump, ['policy'])
        Object.keys(thePicoInp.channel).forEach(function (id) {
          var aChannel = get(thePicoInp, ['channel', id], undefined)
          if (aChannel) {
            if (aChannel.type !== 'secret' || aChannel.name !== 'admin') {
              aChannel.canDel = true
            }
            var thePolicy = thePolicies[aChannel.policy_id]
            aChannel.policy_name = thePolicy.name
            aChannel.policy_text = JSON.stringify(thePolicy, undefined, 2)
            theChannels.push(aChannel)
          }
        })
        callback(null, {
          pico_id: thePicoInp.id,
          id: thePicoInp.id,
          eci: thePicoInp.admin_eci,
          channel: theChannels,
          policy: thePolicies
        })
      } else if (tabName === 'subscriptions') {
        var theSubscriptions = {}
        theSubscriptions.pico_id = thePicoInp.id
        theSubscriptions.eci = eci
        var subsRID = 'io.picolabs.subscription'
        if (get(dbDump, ['pico', thePicoInp.id, 'ruleset', subsRID, 'on'])) {
          var subscribablePicos = []
          for (var k in dbDump.channel) {
            var aChannel = dbDump.channel[k]
            if (aChannel.name === 'wellKnown_Rx') {
              if (aChannel.pico_id === thePicoInp.id) {
                theSubscriptions.wellKnown_Rx = k
              } else { // avoid offering subscription to self
                subscribablePicos.push({
                  id: aChannel.id,
                  pico_name: getV({ id: aChannel.pico_id }, 'dname')
                })
              }
            }
          }
          theSubscriptions.subscribable_picos = subscribablePicos.sort(
            function (a, b) {
              var nameA = a.pico_name.toUpperCase()
              var nameB = b.pico_name.toUpperCase()
              if (nameA < nameB) return -1
              if (nameB < nameA) return 1
              return 0
            }
          )
        } else {
          theSubscriptions.disabled = true
        }
        var theSubsVars = get(dbDump, [
          'pico',
          thePicoInp.id,
          subsRID,
          'vars'
        ])
        var recSubs = function (subsType) {
          if (theSubsVars && theSubsVars[subsType]) {
          } else return
          var someSub = {}
          var subCount = 0
          var theSubs = theSubsVars[subsType]
          Object.keys(theSubs).forEach(function (id) {
            ++subCount
            someSub[id] = theSubs[id]
            someSub[id].asString = JSON.stringify(theSubs[id], undefined, 2)
            var subsECI = theSubs[id].Tx || theSubs[id].wellKnown_Tx
            var pico = { id: get(dbDump.channel, [subsECI, 'pico_id']) }
            someSub[id].name = getV(pico, 'dname')
          })
          if (subCount) theSubscriptions[subsType] = someSub
        }
        recSubs('established')
        recSubs('outbound')
        recSubs('inbound')
        callback(null, theSubscriptions)
      } else if (tabName === 'policies') {
        var policyUI = { disabled: true, eci: eci, pico_id: thePicoInp.id }
        $.getJSON('/sky/cloud/' + eci + '/io.picolabs.policy/ui', function (ui) {
          callback(null, {
            pico_id: thePicoInp.id,
            ui: ui,
            text: JSON.stringify(ui, undefined, 2)
          })
        }).fail(function () {
          callback(null, policyUI)
        })
      } else {
        callback(null, thePicoInp)
      }
    }
767447
def select(self, db):
        """"""
        if not isinstance(db, int):
            raise TypeError("DB must be of int type, not {!r}".format(db))
        if db < 0:
            raise ValueError("DB must be greater or equal 0, got {!r}"
                             .format(db))
        fut = self.execute('SELECT', db)
        return wait_ok(fut)
1303214
@Override
    public void selectTab(final String text) {
        for (int i = 0; i < tabs.size(); i++) {
            if (text.equals(tabs.get(i).getText())) {
                selectTab(i);
                return;
            }
        }

        // not found in visible tabs, should be in off-page
        for (OffPageText opt : offPageContainer.getTexts()) {
            if (text.equals(opt.getText())) {
                if (opt.getIndex() == 0) {
                    // the first off-page needs special treatment
                    offPageContainer.selectDeck(opt.getIndex());
                    if (getSelectedIndex() == PAGE_LIMIT - 1) {
                        SelectionEvent.fire(this, PAGE_LIMIT - 1);
                    }
                    tabs.lastTab().setText(opt.getText());
                    selectTab(PAGE_LIMIT - 1);
                } else {
                    selectTab(PAGE_LIMIT - 1 + opt.getIndex());
                }
            }
        }
    }
172797
private function options_sub_tabs() {
		$current_tab = isset( $_GET['subtab'] ) ? esc_attr( $_GET['subtab'] ) : 'github_updater';
		echo '<nav class="nav-tab-wrapper" aria-label="Tertiary menu">';
		foreach ( $this->settings_sub_tabs() as $key => $name ) {
			$active = ( $current_tab === $key ) ? 'nav-tab-active' : '';
			echo '<a class="nav-tab ' . $active . '" href="?page=github-updater&tab=github_updater_settings&subtab=' . $key . '">' . $name . '</a>';
		}
		echo '</nav>';
	}
1009037
function(db) {
		return db.query('SELECT name FROM types WHERE name IS NOT NULL').then(function(db) {
			var types = db.fetch();
			debug.assert(types).is('array');

			var queries = ARRAY(types).map(function step_builder(type) {
				if(type && type.name) {
					return NoPg.createTriggerQueriesForType(type.name);
				}
				return [];
			}).reduce(function(a, b) {
				return a.concat(b);
			}, []);

			return queries.map(function(q) {
				return db.query(q);
			}).reduce(_Q.when, _Q(db));
		});
	}
806552
public void setTabs(ArrayList<String>tabs) {
        if (tabs == null || tabs.size() <= 0) return;

        if (platformSupportsTabs) {
            ArrayList<String> toAdd;
            if (tabs.size() > MAX_TABS) {
                toAdd = new ArrayList<>(tabs.subList(0, MAX_TABS));
            } else {
                toAdd = tabs;
            }
            this.tabs = toAdd.toArray(new String[0]);
        } else {
            Logger.d("Please upgrade com.android.support:design library to v28.0.0 to enable Tabs for App Inbox, dropping Tabs");
        }
    }
353759
def db(ctx):
    """"""

    from hfos import database
    database.initialize(ctx.obj['dbhost'], ctx.obj['dbname'])
    ctx.obj['db'] = database
765309
public function updateTabIndex() {
		$disabled = $this->isDisabled();
		if ( $this->tabIndex !== null ) {
			$this->tabIndexed->setAttributes( [
				// Do not index over disabled elements
				'tabindex' => $disabled ? -1 : $this->tabIndex,
				// ChromeVox and NVDA do not seem to inherit this from parent elements
				'aria-disabled' => ( $disabled ? 'true' : 'false' )
			] );
		} else {
			$this->tabIndexed->removeAttributes( [ 'tabindex', 'aria-disabled' ] );
		}
		return $this;
	}
354753
def query_all():
        '''
        
        '''
        recs = TabPost2Tag.select(
            TabPost2Tag,
            TabTag.kind.alias('tag_kind'),
        ).join(
            TabTag,
            on=(TabPost2Tag.tag_id == TabTag.uid)
        )
        return recs
14716
def set_db_application_prefix(prefix, sep=None):
    """"""
    global _APPLICATION_PREFIX, _APPLICATION_SEP
    _APPLICATION_PREFIX = prefix
    if (sep is not None):
        _APPLICATION_SEP = sep
680653
def switch_db(name):
    
    with app.app_context():
        app.extensions['pymongo'][mongo.config_prefix] = mongo.cx, mongo.cx[name]
440216
protected function NewsTab()
    {
        /** General news settings */
        return Tab::create(
            'News', _t('NewsSiteConfigExtension.NEWS', 'News'), CheckboxField::create('UseAbstract', _t('NewsSiteConfigExtension.ABSTRACT', 'Use abstract/summary')), CheckboxField::create('TweetOnPost', _t('NewsSiteConfigExtension.TWEETPOST', 'Tweet after posting a new item')), // Requires Firesphere/silverstripe-social
            NumericField::create('PostsPerPage', _t('NewsSiteConfigExtension.PPP', 'Amount of posts per page')), UploadField::create('DefaultImage', _t('NewsSiteConfigExtension.DEFAULTIMPRESSION', 'Default impression image for newsitems'))
        );
    }
375018
def _get_tab(cls):
        """"""

        if not cls._tabs['dec_cobs']:
            # Compute the COBS table for decoding
            cls._tabs['dec_cobs']['\xff'] = (255, '')
            cls._tabs['dec_cobs'].update(dict((chr(l), (l, '\0'))
                                              for l in range(1, 255)))

            # Compute the COBS table for encoding
            cls._tabs['enc_cobs'] = [(255, '\xff'),
                                     dict((l, chr(l))
                                          for l in range(1, 255)),
                                     ]

        return cls._tabs['dec_cobs'], cls._tabs['enc_cobs']
218898
function changesDb (dbName, qs0, callback0) {
    const { opts, callback } = getCallback(qs0, callback0)
    return relax({ db: dbName, path: '_changes', qs: opts }, callback)
  }
1124470
def tabify(text, options):
    
    opts = parse_options(options)
    if opts.tab_size < 1:
        return text
    else:
        tab_equiv = ' ' * opts.tab_size
        return text.replace(tab_equiv, '\t')
157718
def extend_and_specialize(items, loader):
    # type: (List[Dict[Text, Any]], Loader) -> List[Dict[Text, Any]]
    

    items = deepcopy_strip(items)
    types = {i["name"]: i for i in items}  # type: Dict[Text, Any]
    results = []

    for stype in items:
        if "extends" in stype:
            specs = {}  # type: Dict[Text, Text]
            if "specialize" in stype:
                for spec in aslist(stype["specialize"]):
                    specs[spec["specializeFrom"]] = spec["specializeTo"]

            exfields = []  # type: List[Text]
            exsym = []  # type: List[Text]
            for ex in aslist(stype["extends"]):
                if ex not in types:
                    raise Exception(
                        "Extends {} in {} refers to invalid base type.".format(
                            stype["extends"], stype["name"]))

                basetype = copy.copy(types[ex])

                if stype["type"] == "record":
                    if specs:
                        basetype["fields"] = replace_type(
                            basetype.get("fields", []), specs, loader, set())

                    for field in basetype.get("fields", []):
                        if "inherited_from" not in field:
                            field["inherited_from"] = ex

                    exfields.extend(basetype.get("fields", []))
                elif stype["type"] == "enum":
                    exsym.extend(basetype.get("symbols", []))

            if stype["type"] == "record":
                stype = copy.copy(stype)
                exfields.extend(stype.get("fields", []))
                stype["fields"] = exfields

                fieldnames = set()  # type: Set[Text]
                for field in stype["fields"]:
                    if field["name"] in fieldnames:
                        raise validate.ValidationException(
                            "Field name {} appears twice in {}".format(
                                field["name"], stype["name"]))
                    else:
                        fieldnames.add(field["name"])
            elif stype["type"] == "enum":
                stype = copy.copy(stype)
                exsym.extend(stype.get("symbols", []))
                stype["symbol"] = exsym

            types[stype["name"]] = stype

        results.append(stype)

    ex_types = {}
    for result in results:
        ex_types[result["name"]] = result

    extended_by = {}  # type: Dict[Text, Text]
    for result in results:
        if "extends" in result:
            for ex in aslist(result["extends"]):
                if ex_types[ex].get("abstract"):
                    add_dictlist(extended_by, ex, ex_types[result["name"]])
                    add_dictlist(extended_by, avro_name(ex), ex_types[ex])

    for result in results:
        if result.get("abstract") and result["name"] not in extended_by:
            raise validate.ValidationException(
                "{} is abstract but missing a concrete subtype".format(
                    result["name"]))

    for result in results:
        if "fields" in result:
            result["fields"] = replace_type(
                result["fields"], extended_by, loader, set())

    return results
133611
def edit_tab(self, index):
        """"""

        # Sets focus, shows cursor
        self.setFocus(True)

        # Updates tab index
        self.tab_index = index

        # Gets tab size and shrinks to avoid overlapping tab borders
        rect = self.main.tabRect(index)
        rect.adjust(1, 1, -2, -1)

        # Sets size
        self.setFixedSize(rect.size())

        # Places on top of the tab
        self.move(self.main.mapToGlobal(rect.topLeft()))

        # Copies tab name and selects all
        text = self.main.tabText(index)
        text = text.replace(u'&', u'')
        if self.split_char:
            text = text.split(self.split_char)[self.split_index]

        self.setText(text)
        self.selectAll()

        if not self.isVisible():
            # Makes editor visible
            self.show()