[START list_findings_at_time]
979273
static ImmutableList<ListFindingsResult> listFindingsAtTime(SourceName sourceName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // SourceName sourceName = SourceName.of(/*organizationId=*/"123234324",
      // /*sourceId=*/"423432321");

      // 5 days ago
      Instant fiveDaysAgo = Instant.now().minus(Duration.ofDays(5));

      ListFindingsRequest.Builder request =
          ListFindingsRequest.newBuilder()
              .setParent(sourceName.toString())
              .setReadTime(
                  Timestamp.newBuilder()
                      .setSeconds(fiveDaysAgo.getEpochSecond())
                      .setNanos(fiveDaysAgo.getNano()));

      // Call the API.
      ListFindingsPagedResponse response = client.listFindings(request.build());

      // This creates one list for all findings.  If your organization has a large number of
      // findings this can cause out of memory issues.  You can process them in incrementally
      // by returning the Iterable returned response.iterateAll() directly.
      ImmutableList<ListFindingsResult> results = ImmutableList.copyOf(response.iterateAll());
      System.out.println("Findings:");
      System.out.println(results);
      return results;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
1238733
def find(self, chrom, start, end):
        """"""

        tree = self._trees.get( chrom, None )
        if tree:
            return tree.find( start, end )
        #return always a list
        return []
1219520
def viewTs(ts):
    
    _ts = ts
    if isinstance(ts, list):
        _ts = ts[0]
        print("It looks like you input a full time series. It's best to view one entry at a time.\n"
              "I'll show you the first entry...")
    _tmp_sort = OrderedDict()
    _tmp_sort["ROOT"] = {}
    _tmp_sort["PUBLICATION"] = {}
    _tmp_sort["GEO"] = {}
    _tmp_sort["OTHERS"] = {}
    _tmp_sort["DATA"] = {}

    # Organize the data by section
    for k,v in _ts.items():
        if not any(i == k for i in ["paleoData", "chronData", "mode", "@context"]):
            if k in ["archiveType", "dataSetName", "googleSpreadSheetKey", "metadataMD5", "tagMD5", "googleMetadataWorksheet", "lipdVersion"]:
                _tmp_sort["ROOT"][k] = v
            elif "pub" in k:
                _tmp_sort["PUBLICATION"][k] = v
            elif "geo" in k:
                _tmp_sort["GEO"][k] = v
            elif "paleoData_" in k or "chronData_" in k:
                if isinstance(v, list) and len(v) > 2:
                    _tmp_sort["DATA"][k] = "[{}, {}, {}, ...]".format(v[0], v[1], v[2])
                else:
                    _tmp_sort["DATA"][k] = v
            else:
                if isinstance(v, list) and len(v) > 2:
                    _tmp_sort["OTHERS"][k] = "[{}, {}, {}, ...]".format(v[0], v[1], v[2])
                else:
                    _tmp_sort["OTHERS"][k] = v

    # Start printing the data to console
    for k1, v1 in _tmp_sort.items():
        print("\n{}\n===============".format(k1))
        for k2, v2 in v1.items():
            print("{} : {}".format(k2, v2))

    return
1157109
def items(self):
        """"""
        sql = """
            SELECT
                app_name,
                next_run,
                first_run,
                last_run,
                last_success,
                depends_on,
                error_count,
                last_error
            FROM crontabber"""
        columns = (
            'app_name',
            'next_run', 'first_run', 'last_run', 'last_success',
            'depends_on', 'error_count', 'last_error'
        )
        items = []
        for record in self.transaction_executor(execute_query_fetchall, sql):
            row = dict(zip(columns, record))
            items.append((row.pop('app_name'), row))
        return items
16555
def discover(timeout=5):
    
    devices = {}
    for entry in scan(timeout):
        if entry.location in devices:
            continue
        try:
            devices[entry.location] = Device(entry.location)
        except Exception as exc:
            log = _getLogger("ssdp")
            log.error('Error \'%s\' for %s', exc, entry.location)
    return list(devices.values())
123818
def list(self, cur_p=''):
        '''
        
        '''

        if cur_p == '':
            current_page_number = 1
        else:
            current_page_number = int(cur_p)

        current_page_number = 1 if current_page_number < 1 else current_page_number

        pager_num = int(MLog.total_number() / CMS_CFG['list_num'])
        kwd = {
            'pager': '',
            'title': '',
            'current_page': current_page_number,
        }

        if self.is_p:
            self.render('admin/log_ajax/user_list.html',
                        kwd=kwd,
                        user_list=MLog.query_all_user(),
                        no_user_list=MLog.query_all(current_page_num=current_page_number),
                        format_date=tools.format_date,
                        userinfo=self.userinfo)
        else:
            self.render('misc/log/user_list.html',
                        kwd=kwd,
                        user_list=MLog.query_all_user(),
                        no_user_list=MLog.query_all(current_page_num=current_page_number),
                        format_date=tools.format_date,
                        userinfo=self.userinfo)
587061
def doFind(self, WHAT={}, SORT=[], SKIP=None, MAX=None, LOP='AND', **params):
		""""""

		self._preFind(WHAT, SORT, SKIP, MAX, LOP)

		for key in params:
			self._addDBParam(key, params[key])

		try:
			return self._doAction('-find')
		except FMServerError as e:
			if e.args[0] in [401, 8]:
				return []
903757
def item_lister(command, _connection, page_size, page_number, sort_by,
    sort_order, item_class, result_set, **kwargs):
    
    # pylint: disable=R0913
    page = page_number
    while True:
        item_collection = _connection.get_list(command,
                                             page_size=page_size,
                                             page_number=page,
                                             sort_by=sort_by,
                                             sort_order=sort_order,
                                             item_class=item_class,
                                             **kwargs)
        result_set.total_count = item_collection.total_count
        result_set.page_number = page
        for item in item_collection.items:
            yield item
        if item_collection.total_count < 0 or item_collection.page_size == 0:
            break
        if len(item_collection.items) > 0:
            page += 1
        else:
            break
937194
async def discover(ctx):
    """"""
    TIMEOUT = 5

    async def print_discovered(dev):
        pretty_name = "%s - %s" % (dev.name, dev.model_number)

        click.echo(click.style("\nFound %s" % pretty_name, bold=True))
        click.echo("* API version: %s" % dev.version)
        click.echo("* Endpoint: %s" % dev.endpoint)
        click.echo("  Services:")
        for serv in dev.services:
            click.echo("    - Service: %s" % serv)
        click.echo("\n[UPnP]")
        click.echo("* URL: %s" % dev.upnp_location)
        click.echo("* UDN: %s" % dev.udn)
        click.echo("  Services:")
        for serv in dev.upnp_services:
            click.echo("    - Service: %s" % serv)

    click.echo("Discovering for %s seconds" % TIMEOUT)
    await Discover.discover(TIMEOUT, ctx.obj["debug"] or 0, callback=print_discovered)
39008
def on_discovery_add(self, discovery):
        
        discovery.connect()

        for cluster in self.configurables[Cluster].values():
            if cluster.discovery != discovery.name:
                continue

            self.launch_thread(
                cluster.name, discovery.start_watching,
                cluster, self.sync_balancer_files
            )

        self.sync_balancer_files()
698707
public void setFindings(java.util.Collection<Finding> findings) {
        if (findings == null) {
            this.findings = null;
            return;
        }

        this.findings = new java.util.ArrayList<Finding>(findings);
    }
492745
def __check_index(self, start_date, end_date):
        """"""
        index_query = """SELECT id
                           FROM facts
                          WHERE (end_time >= ? OR end_time IS NULL)
                            AND start_time <= ?
                            AND id not in(select id from fact_index)"""

        rebuild_ids = ",".join([str(res[0]) for res in self.fetchall(index_query, (start_date, end_date))])

        if rebuild_ids:
            query = """
                       SELECT a.id AS id,
                              a.start_time AS start_time,
                              a.end_time AS end_time,
                              a.description as description,
                              b.name AS name, b.id as activity_id,
                              coalesce(c.name, ?) as category,
                              e.name as tag
                         FROM facts a
                    LEFT JOIN activities b ON a.activity_id = b.id
                    LEFT JOIN categories c ON b.category_id = c.id
                    LEFT JOIN fact_tags d ON d.fact_id = a.id
                    LEFT JOIN tags e ON e.id = d.tag_id
                        WHERE a.id in (%s)
                     ORDER BY a.id
            """ % rebuild_ids

            facts = self.__group_tags(self.fetchall(query, (self._unsorted_localized, )))

            insert = """INSERT INTO fact_index (id, name, category, description, tag)
                             VALUES (?, ?, ?, ?, ?)"""
            params = [(fact['id'], fact['name'], fact['category'], fact['description'], " ".join(fact['tags'])) for fact in facts]

            self.executemany(insert, params)
880861
def continue_list_folder(cursor)
      resp = request('/files/list_folder/continue', cursor: cursor)
      resp['entries'].map { |e| parse_tagged_response(e) }
    end
728217
def createLists(self):
        ''''''

        self.beforeAssemblyList = {
        'Confirm batteries charged':2,
        'No physical damage to airframe':2,
        'All electronics present and connected':2,
        'Bottle loaded':2,
        'Ground station operational':2
        }

        self.beforeEngineList = {
        'Avionics Power ON':2,
        'Pixhawk Booted':0,
        'Odroid Booted':2,
        'Cameras calibrated and capturing':2,
        'GPS lock':0,
        'Airspeed check':2,
        'Barometer check':2,
        'Compass check':2,
        'Flight mode MANUAL':0,
        'Avionics Power':0,
        'Servo Power':0,
        'IMU Check':0,
        'Aircraft Params Loaded':2,
        'Waypoints Loaded':0,
        'Servo and clevis check':2,
        'Geofence loaded':2,
        'Ignition circuit and battery check':2,
        'Check stabilisation in FBWA mode':2
        }

        self.beforeTakeoffList = {
        'Engine throttle responsive':2,
        'Runway clear':2,
        'Radio links > 6db margin':0,
        'Antenna tracker check':2,
        'GCS stable':2,
        }

        self.beforeCruiseList = {
        'Airspeed > 10 m/s':0,
        'Altitude > 30 m':0,
        '< 100 degrees to 1st Waypoint':2,
        'Airspeed and climb rate nominal':2
        }

        self.bottleDropList = {
        'Joe found':2,
        'Joe waypoint laid in':2,
        '< 100m to Joe waypoint':2,
        'Bottle drop mechanism activated':2
        }

        self.beforeLandingList = {
        'Runway clear':2,
        'APM set to FBWA mode':2,
        '< 100m from airfield home':2
        }

        self.beforeShutdownList = {
        'Taxi to parking':2,
        'Engine cutoff':2,
        'Data downloaded':2,
        'Ignition power off':2,
        'Avionics power off':2
        }
80343
function () {
				var oView = this.getView(),
					// Collect all possible items from all lists
					aItems = [].concat(
						oView.byId("allList").getItems(),
						oView.byId("apiList").getItems(),
						oView.byId("documentationList").getItems(),
						oView.byId("samplesList").getItems()
					),
					iLen = aItems.length,
					oItem;

				while (iLen--) {
					oItem = aItems[iLen];
					// Access control lazy loading method if available
					if (oItem._getLinkSender) {
						// Set link href to allow open in new window functionality
						oItem._getLinkSender().setHref("#/" + oItem.getCustomData()[0].getValue());
					}
				}
			}
1370909
def read_bplist(data, start, length):
    """"""
    # TODO: pylint doesn't find FMT_BINARY, why?
    # pylint: disable=no-member
    return plistlib.loads(data[start:start+length],
                          fmt=plistlib.FMT_BINARY)
1052850
def __begin_of_list(self, ast_token):
        """"""
        self.list_level += 1
        if self.list_level == 1:
            self.final_ast_tokens.append(ast_token)