file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
validate-header.hook.ts
// FoalTS import { ValidateFunction } from 'ajv'; import { ApiParameter, ApiResponse, Context, Hook, HookDecorator, HttpResponseBadRequest, IApiHeaderParameter, OpenApi, ServiceManager } from '../../core'; import { getAjvInstance } from '../utils'; import { isFunction } from './is-function.util'; /**...
( name: string, schema: object | ((controller: any) => object) = { type: 'string' }, options: { openapi?: boolean, required?: boolean } = {} ): HookDecorator { // tslint:disable-next-line const required = options.required ?? true; name = name.toLowerCase(); let validateSchema: ValidateFunction|undefined;...
ValidateHeader
identifier_name
validate-header.hook.ts
// FoalTS import { ValidateFunction } from 'ajv'; import { ApiParameter, ApiResponse, Context, Hook, HookDecorator, HttpResponseBadRequest, IApiHeaderParameter, OpenApi, ServiceManager } from '../../core'; import { getAjvInstance } from '../utils'; import { isFunction } from './is-function.util'; /**...
const openapi = [ ApiParameter((c: any) => ({ ...param, schema: isFunction(schema) ? schema(c) : schema })), ApiResponse(400, { description: 'Bad request.' }) ]; return Hook(validate, openapi, options); }
param.required = required; }
random_line_split
bb8c39173631_rename_a3_manifest.py
"""rename a3 manifest Revision ID: bb8c39173631 Revises: 98595efd597e Create Date: 2020-04-07 08:44:55.893170 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = 'bb8c39173631' down_revision = '98595efd597e' branch_labels = None...
def upgrade_metrics(): # ### commands auto generated by Alembic - please adjust! ### pass # ### end Alembic commands ### def downgrade_metrics(): # ### commands auto generated by Alembic - please adjust! ### pass # ### end Alembic commands ###
op.add_column('genomic_set_member', sa.Column('gem_a2d_manifest_job_run_id', mysql.INTEGER( display_width=11), autoincrement=False, nullable=True)) op.drop_constraint(None, 'genomic_set_member', type_='foreignkey') op.create_foreign_key('genomic_set_member_ibfk_15', 'genomic_set_member', 'genomic_job_ru...
identifier_body
bb8c39173631_rename_a3_manifest.py
"""rename a3 manifest Revision ID: bb8c39173631 Revises: 98595efd597e Create Date: 2020-04-07 08:44:55.893170 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = 'bb8c39173631' down_revision = '98595efd597e' branch_labels = None...
op.drop_constraint(None, 'genomic_set_member', type_='foreignkey') op.create_foreign_key('genomic_set_member_ibfk_15', 'genomic_set_member', 'genomic_job_run', ['gem_a2d_manifest_job_run_id'], ['id']) op.drop_column('genomic_set_member', 'gem_a3_manifest_job_run_id') op.drop_column('genomic_set_member_h...
# ### commands auto generated by Alembic - please adjust! ### op.add_column('genomic_set_member', sa.Column('gem_a2d_manifest_job_run_id', mysql.INTEGER( display_width=11), autoincrement=False, nullable=True))
random_line_split
bb8c39173631_rename_a3_manifest.py
"""rename a3 manifest Revision ID: bb8c39173631 Revises: 98595efd597e Create Date: 2020-04-07 08:44:55.893170 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = 'bb8c39173631' down_revision = '98595efd597e' branch_labels = None...
(): # ### commands auto generated by Alembic - please adjust! ### pass # ### end Alembic commands ### def downgrade_metrics(): # ### commands auto generated by Alembic - please adjust! ### pass # ### end Alembic commands ###
upgrade_metrics
identifier_name
customer_acquisition_and_loyalty.js
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
"filters": [ { "fieldname":"company", "label": __("Company"), "fieldtype": "Link", "options": "Company", "default": frappe.defaults.get_user_default("Company"), "reqd": 1 }, { "fieldname":"from_date", "label": __("From Date"), "fieldtype": "Date", "default": frappe.defaults.get_user...
// License: GNU General Public License v3. See license.txt frappe.query_reports["Customer Acquisition and Loyalty"] = {
random_line_split
bin-uninstall.ts
import chalk = require('chalk') import { uninstallDependencies } from 'typings-core' import { logError, spinner } from './support/cli' export function help () { return ` typings uninstall <name> [--save|--save-dev|--save-peer] [--global] Options: [--save|-S] Remove from "dependencies" [--save-dev|-D] Re...
}
random_line_split
bin-uninstall.ts
import chalk = require('chalk') import { uninstallDependencies } from 'typings-core' import { logError, spinner } from './support/cli' export function help () { return ` typings uninstall <name> [--save|--save-dev|--save-peer] [--global] Options: [--save|-S] Remove from "dependencies" [--save-dev|-D] Re...
{ if (args.length === 0) { logError(help()) return } return spinner(uninstallDependencies(args, options)) .then((result) => { Object.keys(result.resolutions).forEach((name) => { args.forEach((arg) => { console.log(`- ${arg} ${chalk.grey(`(${name})`)}`) }) }) ...
identifier_body
bin-uninstall.ts
import chalk = require('chalk') import { uninstallDependencies } from 'typings-core' import { logError, spinner } from './support/cli' export function help () { return ` typings uninstall <name> [--save|--save-dev|--save-peer] [--global] Options: [--save|-S] Remove from "dependencies" [--save-dev|-D] Re...
return spinner(uninstallDependencies(args, options)) .then((result) => { Object.keys(result.resolutions).forEach((name) => { args.forEach((arg) => { console.log(`- ${arg} ${chalk.grey(`(${name})`)}`) }) }) }) }
{ logError(help()) return }
conditional_block
bin-uninstall.ts
import chalk = require('chalk') import { uninstallDependencies } from 'typings-core' import { logError, spinner } from './support/cli' export function help () { return ` typings uninstall <name> [--save|--save-dev|--save-peer] [--global] Options: [--save|-S] Remove from "dependencies" [--save-dev|-D] Re...
(args: string[], options: Options): Promise<void> { if (args.length === 0) { logError(help()) return } return spinner(uninstallDependencies(args, options)) .then((result) => { Object.keys(result.resolutions).forEach((name) => { args.forEach((arg) => { console.log(`- ${arg} ${...
exec
identifier_name
one_device_strategy.py
Using this strategy will place any variables created in its scope on the specified device. Input distributed through this strategy will be prefetched to the specified device. Moreover, any functions called via `strategy.run` will also be placed on the specified device as well. Typical usage of this strateg...
@tf_export("distribute.OneDeviceStrategy", v1=[]) class OneDeviceStrategy(distribute_lib.Strategy): """A distribution strategy for running on a single device.
random_line_split
one_device_strategy.py
OneDeviceStrategy`, `fn` is simply called within a device scope for the given device, with the provided arguments. Args: fn: The function to run. The output must be a `tf.nest` of `Tensor`s. args: (Optional) Positional arguments to `fn`. kwargs: (Optional) Keyword arguments to `fn`. opt...
_call_for_each_replica
identifier_name
one_device_strategy.py
=0).numpy() # result: 45 ``` Args: reduce_op: A `tf.distribute.ReduceOp` value specifying how values should be combined. value: A "per replica" value, e.g. returned by `run` to be combined into a single tensor. axis: Specifies the dimension to reduce along within each ...
return value
identifier_body
one_device_strategy.py
_distribute_dataset( dataset, options) def distribute_datasets_from_function( self, dataset_fn, # pylint: disable=useless-super-delegation options=None): """Distributes `tf.data.Dataset` instances created by calls to `dataset_fn`. `dataset_fn` will be called once for each worker i...
raise NotImplementedError( "InputReplicationMode.PER_REPLICA " "is only supported in " "`experimental_distribute_datasets_from_function` " "of tf.distribute.MirroredStrategy")
conditional_block
core.py
import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def ...
@property def max_ping_time(self): if self._ping is None: return 0 return self._ping.max_ping_time @max_ping_time.setter def max_ping_time(self, value): if self._ping is not None: self._ping.max_ping_time = value @property def stats(self): ...
self._ping_interval = value if self._ping_timer_running: self._stop_ping_timer() self._start_ping_timer()
identifier_body
core.py
import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def ...
return set(self._servers) @property def reachable_servers(self): with self._server_lock: servers = set() for s in self._servers: if s.is_alive: servers.add(s) return servers def choose_server(self): # choose ...
@property def servers(self): with self._server_lock:
random_line_split
core.py
import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def ...
@property def stats(self): return self._stats @property def servers(self): with self._server_lock: return set(self._servers) @property def reachable_servers(self): with self._server_lock: servers = set() for s in self._servers: ...
self._ping.max_ping_time = value
conditional_block
core.py
import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def ...
(self): with self._server_lock: return set(self._servers) @property def reachable_servers(self): with self._server_lock: servers = set() for s in self._servers: if s.is_alive: servers.add(s) return servers def...
servers
identifier_name
appengine_v1_generated_services_get_service_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
(): # Create a client client = appengine_admin_v1.ServicesClient() # Initialize request argument(s) request = appengine_admin_v1.GetServiceRequest( ) # Make the request response = client.get_service(request=request) # Handle the response print(response) # [END appengine_v1_genera...
sample_get_service
identifier_name
appengine_v1_generated_services_get_service_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# [END appengine_v1_generated_Services_GetService_sync]
random_line_split
appengine_v1_generated_services_get_service_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# [END appengine_v1_generated_Services_GetService_sync]
client = appengine_admin_v1.ServicesClient() # Initialize request argument(s) request = appengine_admin_v1.GetServiceRequest( ) # Make the request response = client.get_service(request=request) # Handle the response print(response)
identifier_body
toArray.js
'use strict'; var convert = require('./convert'),
module.exports = func; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2NsaWVudC9saWIvbG9kYXNoL2ZwL3RvQXJyYXkuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxJQUFJLFVBQVUsUUFBUSxXQUFSLENBQWQ7SUFDSSxPQUFPLFFBQVEsU0FBUixFQUFtQixRQUFRLFlBQVIsQ0FBbkIsRUFBMEMsUUFBUSxpQkF...
func = convert('toArray', require('../toArray'), require('./_falseOptions')); func.placeholder = require('./placeholder');
random_line_split
status.rs
// Copyright (C) 2016 Stefan Luecke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ...
impl StatusHandler { pub fn new() -> StatusHandler { StatusHandler {} } } impl Handler for StatusHandler { fn msg_type() -> telegram_bot::MessageType { telegram_bot::MessageType::Text("".to_string()) } fn command() -> Vec<String> { vec![String::from_str("/status").unwrap()...
random_line_split
status.rs
// Copyright (C) 2016 Stefan Luecke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ...
} impl Handler for StatusHandler { fn msg_type() -> telegram_bot::MessageType { telegram_bot::MessageType::Text("".to_string()) } fn command() -> Vec<String> { vec![String::from_str("/status").unwrap()] } fn process(&self, m: telegram_bot::Message, ...
{ StatusHandler {} }
identifier_body
status.rs
// Copyright (C) 2016 Stefan Luecke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ...
() -> StatusHandler { StatusHandler {} } } impl Handler for StatusHandler { fn msg_type() -> telegram_bot::MessageType { telegram_bot::MessageType::Text("".to_string()) } fn command() -> Vec<String> { vec![String::from_str("/status").unwrap()] } fn process(&self, ...
new
identifier_name
OverLoadMe.py
# -*- coding: utf-8 -*- from ..internal.misc import json from ..internal.MultiAccount import MultiAccount class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" __version__ = "0.13" __status__ = "testing" __config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to u...
def signin(self, user, password, data): html = self.load("https://api.over-load.me/account.php", get={'user': user, 'auth': password}).strip() data = json.loads(html) if data['err'] == 1: self.fail_login()
html = self.load("https://api.over-load.me/account.php", get={'user': user, 'auth': password}).strip() data = json.loads(html) self.log_debug(data) #: Check for premium if data['membership'] == "Free": return {'premium'...
identifier_body
OverLoadMe.py
# -*- coding: utf-8 -*- from ..internal.misc import json from ..internal.MultiAccount import MultiAccount class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" __version__ = "0.13" __status__ = "testing"
("mh_list", "str", "Hoster list (comma separated)", ""), ("mh_interval", "int", "Reload interval in hours", 12)] __description__ = """Over-Load.me account plugin""" __license__ = "GPLv3" __authors__ = [("marley", "marley@over-load.me")] def grab_hosters(self, user, ...
__config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to use", "all"),
random_line_split
OverLoadMe.py
# -*- coding: utf-8 -*- from ..internal.misc import json from ..internal.MultiAccount import MultiAccount class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" __version__ = "0.13" __status__ = "testing" __config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to u...
def signin(self, user, password, data): html = self.load("https://api.over-load.me/account.php", get={'user': user, 'auth': password}).strip() data = json.loads(html) if data['err'] == 1: self.fail_login()
return {'premium': True, 'validuntil': data['expirationunix'], 'trafficleft': -1}
conditional_block
OverLoadMe.py
# -*- coding: utf-8 -*- from ..internal.misc import json from ..internal.MultiAccount import MultiAccount class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" __version__ = "0.13" __status__ = "testing" __config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to u...
(self, user, password, data): html = self.load("https://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}) return [x for x in map( str.strip, html.replace("\"", "").split(",")) if x] def grab_...
grab_hosters
identifier_name
render.rs
use smithay::{ backend::renderer::{Frame, ImportAll, Renderer}, desktop::{ draw_window, space::{DynamicRenderElements, RenderError, Space}, }, utils::{Logical, Rectangle}, wayland::output::Output, }; use crate::{drawing::*, shell::FullscreenSurface}; pub fn render_output<R>( ou...
}
{ space.render_output(&mut *renderer, output, age as usize, CLEAR_COLOR, &*elements) }
conditional_block
render.rs
use smithay::{ backend::renderer::{Frame, ImportAll, Renderer}, desktop::{ draw_window, space::{DynamicRenderElements, RenderError, Space}, }, utils::{Logical, Rectangle}, wayland::output::Output, }; use crate::{drawing::*, shell::FullscreenSurface}; pub fn render_output<R>( ou...
scale, (0, 0), &[Rectangle::from_loc_and_size( (0, 0), mode.size.to_f64().to_logical(scale).to_i32_round(), )], log, )?; for elem in element...
{ if let Some(window) = output .user_data() .get::<FullscreenSurface>() .and_then(|f| f.get()) { let transform = output.current_transform().into(); let mode = output.current_mode().unwrap(); let scale = space.output_scale(output).unwrap(); let output_geo =...
identifier_body
render.rs
use smithay::{ backend::renderer::{Frame, ImportAll, Renderer}, desktop::{ draw_window, space::{DynamicRenderElements, RenderError, Space}, }, utils::{Logical, Rectangle}, wayland::output::Output, }; use crate::{drawing::*, shell::FullscreenSurface}; pub fn
<R>( output: &Output, space: &mut Space, renderer: &mut R, age: usize, elements: &[DynamicRenderElements<R>], log: &slog::Logger, ) -> Result<Option<Vec<Rectangle<i32, Logical>>>, RenderError<R>> where R: Renderer + ImportAll + 'static, R::Frame: 'static, R::TextureId: 'static, R...
render_output
identifier_name
render.rs
use smithay::{ backend::renderer::{Frame, ImportAll, Renderer}, desktop::{ draw_window, space::{DynamicRenderElements, RenderError, Space}, }, utils::{Logical, Rectangle}, wayland::output::Output, }; use crate::{drawing::*, shell::FullscreenSurface}; pub fn render_output<R>( ou...
{ if let Some(window) = output .user_data() .get::<FullscreenSurface>() .and_then(|f| f.get()) { let transform = output.current_transform().into(); let mode = output.current_mode().unwrap(); let scale = space.output_scale(output).unwrap(); let output_geo =...
R::TextureId: 'static, R::Error: 'static,
random_line_split
test_navigation.py
# Copyright 2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type from zope.component import ( ComponentLookupError, getMultiAdapter, ) from zope.configuration import xmlconfig from zope.interface import ( im...
class DefaultBrowserLayer: implements(IDefaultBrowserLayer) class IThing(Interface): pass class Thing(object): implements(IThing) class ThingNavigation(Navigation): usedfor = IThing class OtherThingNavigation(Navigation): usedfor = IThing class IOtherLayer(Interface): pass class O...
TestCase.tearDown(self) cleanUp()
identifier_body
test_navigation.py
# Copyright 2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type from zope.component import ( ComponentLookupError, getMultiAdapter, ) from zope.configuration import xmlconfig from zope.interface import ( im...
# It is possible to have multiple navigation classes for a given # context class as long as they are registered for different layers. directive = """ <browser:navigation module="%(this)s" classes="ThingNavigation"/> <browser:navigation mod...
(Thing(), OtherLayer()), IBrowserPublisher, name='') self.assertIsInstance(navigation, OtherThingNavigation) def test_multiple_navigations_for_single_context(self):
random_line_split
test_navigation.py
# Copyright 2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type from zope.component import ( ComponentLookupError, getMultiAdapter, ) from zope.configuration import xmlconfig from zope.interface import ( im...
(Interface): pass class Thing(object): implements(IThing) class ThingNavigation(Navigation): usedfor = IThing class OtherThingNavigation(Navigation): usedfor = IThing class IOtherLayer(Interface): pass class OtherLayer: implements(IOtherLayer) this = "lp.services.webapp.tests.test_na...
IThing
identifier_name
JunctionAppViewModel.ts
/// <reference path="../tsdef/jquery.d.ts"/> /// <reference path="../tsdef/knockout-3.3.d.ts"/> /// <reference path="../tsdef/google.maps.d.ts"/> /// <reference path="../extensions.ts"/> /// <reference path="../stopbystop-interfaces.ts"/> /// <reference path="../Init.ts"/> /// <reference path="RouteViewModel.ts"/> ///...
var junctionLocationViewModel = this.routeJunction.junction.location; this._poiLocations = LocationViewModel.getGridLocations({ a: junctionLocationViewModel.lat, o: junctionLocationViewModel.lon }); this.loadFullPoiData(); th...
this.filter.showRestaurants(false); }
random_line_split
JunctionAppViewModel.ts
/// <reference path="../tsdef/jquery.d.ts"/> /// <reference path="../tsdef/knockout-3.3.d.ts"/> /// <reference path="../tsdef/google.maps.d.ts"/> /// <reference path="../extensions.ts"/> /// <reference path="../stopbystop-interfaces.ts"/> /// <reference path="../Init.ts"/> /// <reference path="RouteViewModel.ts"/> ///...
{ if (this._locationToLoadIndex < this._poiLocations.length) { var locationToLoad = this._poiLocations[this._locationToLoadIndex++]; var latStr = locationToLoad.lat.toFixed(1); var lonStr = locationToLoad.lon.toFixed(1); $.ajax(AppState.curr...
adFullPoiData()
identifier_name
JunctionAppViewModel.ts
/// <reference path="../tsdef/jquery.d.ts"/> /// <reference path="../tsdef/knockout-3.3.d.ts"/> /// <reference path="../tsdef/google.maps.d.ts"/> /// <reference path="../extensions.ts"/> /// <reference path="../stopbystop-interfaces.ts"/> /// <reference path="../Init.ts"/> /// <reference path="RouteViewModel.ts"/> ///...
$.each(this.filter.foodCategoriesEnablement(), (index: number, item: ICategoryEnablement) => { item.visible(parentFilter.foodCategoriesEnablementLookup[item.category.sbsid].visible()); }); if (poiTypeToShow === PoiType.Food) { this.filter.showGasStati...
(<KnockoutObservable<boolean>>mdarr[i][0])(mdarr[i][1] === parentFilter.maxDistanceFromJunction()); }
conditional_block
JunctionAppViewModel.ts
/// <reference path="../tsdef/jquery.d.ts"/> /// <reference path="../tsdef/knockout-3.3.d.ts"/> /// <reference path="../tsdef/google.maps.d.ts"/> /// <reference path="../extensions.ts"/> /// <reference path="../stopbystop-interfaces.ts"/> /// <reference path="../Init.ts"/> /// <reference path="RouteViewModel.ts"/> ///...
}; export class JunctionSPAAppViewModel extends JunctionAppBaseViewModel { constructor( route: IRoute, routeJunctionViewModel: RouteJunctionViewModel, parentFilter: FilterViewModel, routePlan: RoutePlanViewModel, poiTypeToShow: PoiType = PoiT...
if (this._locationToLoadIndex < this._poiLocations.length) { var locationToLoad = this._poiLocations[this._locationToLoadIndex++]; var latStr = locationToLoad.lat.toFixed(1); var lonStr = locationToLoad.lon.toFixed(1); $.ajax(AppState.current...
identifier_body
advent20.rs
// advent20.rs // factorizing // Used the first crate I found that did what I needed; turned out to be quite slow, oh well extern crate tcorp_math_mods; use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input) .ok() .expect("Failed to read line"); let pr...
() { assert_eq!(10, count_presents(1)); assert_eq!(30, count_presents(2)); assert_eq!(40, count_presents(3)); assert_eq!(70, count_presents(4)); assert_eq!(60, count_presents(5)); assert_eq!(120, count_presents(6)); assert_eq!(80, count_presents(7)); assert_eq!(150, count_presents(8)); ...
test_count_presents
identifier_name
advent20.rs
// advent20.rs // factorizing // Used the first crate I found that did what I needed; turned out to be quite slow, oh well extern crate tcorp_math_mods; use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input) .ok() .expect("Failed to read line"); let pr...
fn count_presents2(house: u32) -> u32 { assert!(house > 0); let v = tcorp_math_mods::factors::factors_for(house); // skip the factors that are less than house/50 let mut split_idx = 0; for x in v.iter() { if *x * 50 >= house { break; } split_idx += 1; } ...
{ (1u32..).find(|x| count_presents2(*x) >= min_presents).unwrap() }
identifier_body
advent20.rs
// advent20.rs // factorizing // Used the first crate I found that did what I needed; turned out to be quite slow, oh well extern crate tcorp_math_mods; use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input) .ok() .expect("Failed to read line"); let pr...
split_idx += 1; } let (_, factors) = v.split_at(split_idx); 11 * factors.iter().fold(0, |acc, x| acc + x) } #[test] fn test_count_presents2() { assert_eq!(11, count_presents2(1)); assert_eq!(33, count_presents2(2)); assert_eq!(44, count_presents2(3)); assert_eq!(77, count_presents...
{ break; }
conditional_block
advent20.rs
// advent20.rs // factorizing // Used the first crate I found that did what I needed; turned out to be quite slow, oh well extern crate tcorp_math_mods; use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input) .ok() .expect("Failed to read line"); let pr...
fn find_lowest_house2(min_presents: u32) -> u32 { (1u32..).find(|x| count_presents2(*x) >= min_presents).unwrap() } fn count_presents2(house: u32) -> u32 { assert!(house > 0); let v = tcorp_math_mods::factors::factors_for(house); // skip the factors that are less than house/50 let mut split_idx =...
assert_eq!(8, find_lowest_house(121)); } // part 2
random_line_split
transform.rs
// Copyright (C) 2011 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
if (rsIsObject(data->children)) { rs_allocation nullAlloc; rsForEach(gTransformScript, data->children, nullAlloc, &toChild, sizeof(toChild)); } data->isDirty = 0; }
{ toChild.changed = 1; data->timestamp ++; }
conditional_block
transform.rs
// Copyright (C) 2011 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applic...
rsMatrixLoadRotate(&temp, data.w, data.x, data.y, data.z); break; case TRANSFORM_SCALE: rsMatrixLoadScale(&temp, data.x, data.y, data.z); break; } rsMatrixMultiply(mat, &temp); } void root(const rs_allocation *v_in, rs_allocation *v_out, const void *usrData) { SgTransfo...
case TRANSFORM_TRANSLATE: rsMatrixLoadTranslate(&temp, data.x, data.y, data.z); break; case TRANSFORM_ROTATE:
random_line_split
regions-infer-invariance-due-to-mutability-4.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { }
random_line_split
regions-infer-invariance-due-to-mutability-4.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { }
{ bi //~ ERROR mismatched types }
identifier_body
regions-infer-invariance-due-to-mutability-4.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'r>(bi: Invariant<'r>) -> Invariant<'static> { bi //~ ERROR mismatched types } fn main() { }
to_longer_lifetime
identifier_name
lint.rs
ast::MetaItemKind; use syntax::ast::{Attribute, FloatTy}; use wait_timeout::ChildExt; #[derive(Debug, Default)] pub struct Herbie { conf: Option<conf::Conf>, initialized: bool, subs: Vec<(LispExpr, LispExpr)>, } #[derive(Debug)] pub enum InitError { Conf { error: conf::ConfError, }, SQ...
ttr: &Attribute) -> bool { if let MetaItemKind::Word(ref word) = attr.node.value.node { word == &"herbie_ignore" } else { false } } let attrs = match cx.tcx.map.find(cx.tcx.map.get_parent(expr.id)) { Some(Node::...
_herbie_ignore(a
identifier_name
lint.rs
::ast::MetaItemKind; use syntax::ast::{Attribute, FloatTy}; use wait_timeout::ChildExt; #[derive(Debug, Default)] pub struct Herbie { conf: Option<conf::Conf>, initialized: bool, subs: Vec<(LispExpr, LispExpr)>, } #[derive(Debug)] pub enum InitError { Conf { error: conf::ConfError, }, ...
} let mut output = output.lines(); let parse_error = |s: Option<&str>| -> Option<f64> { match s { Some(s) => { match s.split(' ').last().map(str::parse::<f64>) { Some(Ok(f)) => Some(f), _ => None, } } ...
if let Err(err) = stdout.read_to_string(&mut output) { return Err(format!("cannot read output: {}", err).into());
random_line_split
lint.rs
ast::MetaItemKind; use syntax::ast::{Attribute, FloatTy}; use wait_timeout::ChildExt; #[derive(Debug, Default)] pub struct Herbie { conf: Option<conf::Conf>, initialized: bool, subs: Vec<(LispExpr, LispExpr)>, } #[derive(Debug)] pub enum InitError { Conf { error: conf::ConfError, }, SQ...
} impl Herbie { pub fn new() -> Herbie { Herbie::default() } pub fn init(&mut self) -> Result<(), InitError> { if self.initialized { return Ok(()) } self.initialized = true; let conf = try!(conf::read_conf()); let connection = try!(sql::Connec...
{ match *self { InitError::Conf { ref error } => write!(f, "Configuration error: {}", error), InitError::SQL { ref error } => write!(f, "Got SQL error: {}", error), } }
identifier_body
recipe-577484.py
# PRNG (Pseudo-Random Number Generator) Test # PRNG info: # http://en.wikipedia.org/wiki/Pseudorandom_number_generator # FB - 201012046 # Compares output distribution of any given PRNG # w/ an hypothetical True-Random Number Generator (TRNG) import math import time global x x = time.clock() # seed for the PRNG # PRNG ...
# combination by recursive method def c(n, k): if k == 0: return 1 if n == 0: return 0 return c(n - 1, k - 1) + c(n - 1, k) ### combination by multiplicative method ##def c_(n, k): ## mul = 1.0 ## for i in range(k): ## mul = mul * (n - k + i + 1) / (i + 1) ## return mul # MAIN n = 20 # n...
global x x = math.fmod((x + math.pi) ** 2.0, 1.0) return x
identifier_body
recipe-577484.py
# PRNG (Pseudo-Random Number Generator) Test # PRNG info: # http://en.wikipedia.org/wiki/Pseudorandom_number_generator # FB - 201012046 # Compares output distribution of any given PRNG # w/ an hypothetical True-Random Number Generator (TRNG) import math import time global x x = time.clock() # seed for the PRNG # PRNG ...
return c(n - 1, k - 1) + c(n - 1, k) ### combination by multiplicative method ##def c_(n, k): ## mul = 1.0 ## for i in range(k): ## mul = mul * (n - k + i + 1) / (i + 1) ## return mul # MAIN n = 20 # number of bits in each trial print 'Test in progress...' print cnk = [] # array to hold bit count...
return 0
conditional_block
recipe-577484.py
# PRNG (Pseudo-Random Number Generator) Test # PRNG info: # http://en.wikipedia.org/wiki/Pseudorandom_number_generator # FB - 201012046 # Compares output distribution of any given PRNG # w/ an hypothetical True-Random Number Generator (TRNG) import math import time global x x = time.clock() # seed for the PRNG # PRNG ...
# generate 2**n n-bit pseudo-random numbers for j in range(2 ** n): # generate n-bit pseudo-random number and count the 0's in it # num = '' ctr = 0 for i in range(n): b = int(round(prng())) # generate 1 pseudo-random bit # num += str(b) if b == 0: ctr += 1 # print num #...
cnk.append(0)
random_line_split
recipe-577484.py
# PRNG (Pseudo-Random Number Generator) Test # PRNG info: # http://en.wikipedia.org/wiki/Pseudorandom_number_generator # FB - 201012046 # Compares output distribution of any given PRNG # w/ an hypothetical True-Random Number Generator (TRNG) import math import time global x x = time.clock() # seed for the PRNG # PRNG ...
(n, k): if k == 0: return 1 if n == 0: return 0 return c(n - 1, k - 1) + c(n - 1, k) ### combination by multiplicative method ##def c_(n, k): ## mul = 1.0 ## for i in range(k): ## mul = mul * (n - k + i + 1) / (i + 1) ## return mul # MAIN n = 20 # number of bits in each trial print 'Test i...
c
identifier_name
FileDropZoneView.js
//============================================================================== // // File drop zone view // //============================================================================== (function(app, config, $) { app.FileDropZoneView = Marionette.ItemView.extend({ events : { 'drop' : '...
}, _isFileTransfer : function(e) { if(e.dataTransfer.types) { for(var i = 0; i < e.dataTransfer.types.length; i++) { if(e.dataTransfer.types[i] === 'Files') return true; } return false; ...
if(files && files.length > 0) { this.trigger('drop', files); }
random_line_split
Isolate_stack_ROI2.py
from ij import IJ from ij.gui import NonBlockingGenericDialog from ij import WindowManager from ij.gui import WaitForUserDialog from ij import ImageStack from ij import ImagePlus theImage = IJ.getImage() sourceImages = [] if theImage.getNChannels() == 1: IJ.run("8-bit") sourceImages.append(theImage) else: sourceIm...
for i in range(startSlice,endSlice+1): procImage.setSliceWithoutUpdate(i) bp = procImage.getProcessor().duplicate() bp.fillOutside(roiArray[i-startSlice]) ns.addSlice(bp) castImages.append(ImagePlus(procImage.getShortTitle()+"_cast",ns)) ## Displays the output for castImage in castImages: castImage...
castImages = [] for procImage in sourceImages: newStacks.append(ImageStack(width,height)) ns = newStacks[-1]
random_line_split
Isolate_stack_ROI2.py
from ij import IJ from ij.gui import NonBlockingGenericDialog from ij import WindowManager from ij.gui import WaitForUserDialog from ij import ImageStack from ij import ImagePlus theImage = IJ.getImage() sourceImages = [] if theImage.getNChannels() == 1: IJ.run("8-bit") sourceImages.append(theImage) else: sourceIm...
else: doStaySlice = False roiArray.append(roi) ## Applying the ROI to each channel newStacks = [] castImages = [] for procImage in sourceImages: newStacks.append(ImageStack(width,height)) ns = newStacks[-1] for i in range(startSlice,endSlice+1): procImage.setSliceWithoutUpdate(i) bp = procI...
doStaySlice = True
conditional_block
coerce-bare-fn-to-closure-and-proc.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let f = foo; let f_closure: || = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consider embedding the function in a closure let f_proc: proc() = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consider embedding the ...
identifier_body
coerce-bare-fn-to-closure-and-proc.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consider embedding the function in a closure let f_proc: proc() = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consider embedding the function in a closure }
fn main() { let f = foo; let f_closure: || = f;
random_line_split
coerce-bare-fn-to-closure-and-proc.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {} fn main() { let f = foo; let f_closure: || = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consider embedding the function in a closure let f_proc: proc() = f; //~^ ERROR: cannot coerce non-statically resolved bare fn to closure //~^^ HELP: consid...
foo
identifier_name
file.rs
use std::io::{Read, Write}; use std::io::BufReader; use std::io::BufRead; use std::path::{PathBuf, Path}; use std::fs::{File, DirBuilder, OpenOptions}; pub fn read_file<P: AsRef<Path>>(file: P) -> Result<String, String> { let mut file = File::open(file) .map_err(error_err!()) .map_err(|_| "Can't re...
let mut file = OpenOptions::new() .write(true) .create(true) .open(path) .map_err(error_err!()) .map_err(|err| format!("Can't open the file: {}", err))?; file .write_all(content.as_bytes()) .map_err(error_err!()) .map_err(|err| format!("Can't wr...
{ DirBuilder::new() .recursive(true) .create(parent_path) .map_err(error_err!()) .map_err(|err| format!("Can't create the file: {}", err))?; }
conditional_block
file.rs
use std::io::{Read, Write}; use std::io::BufReader; use std::io::BufRead; use std::path::{PathBuf, Path}; use std::fs::{File, DirBuilder, OpenOptions}; pub fn read_file<P: AsRef<Path>>(file: P) -> Result<String, String> { let mut file = File::open(file) .map_err(error_err!()) .map_err(|_| "Can't re...
.map_err(|err| format!("Can't read the file: {}", err))?; s }; Ok(content) } pub fn read_lines_from_file<P: AsRef<Path>>(file: P) -> Result<impl Iterator<Item=Result<String, ::std::io::Error>>, String> { let file = File::open(file) .map_err(error_err!()) .map_err(|_| "C...
let mut s = String::new(); file.read_to_string(&mut s) .map_err(error_err!())
random_line_split
file.rs
use std::io::{Read, Write}; use std::io::BufReader; use std::io::BufRead; use std::path::{PathBuf, Path}; use std::fs::{File, DirBuilder, OpenOptions}; pub fn read_file<P: AsRef<Path>>(file: P) -> Result<String, String> { let mut file = File::open(file) .map_err(error_err!()) .map_err(|_| "Can't re...
<P: AsRef<Path>>(file: P, content: &str) -> Result<(), String> where P: std::convert::AsRef<std::ffi::OsStr> { let path = PathBuf::from(&file); if let Some(parent_path) = path.parent() { DirBuilder::new() .recursive(true) .create(parent_path) .map_err(error_err!()) ...
write_file
identifier_name
file.rs
use std::io::{Read, Write}; use std::io::BufReader; use std::io::BufRead; use std::path::{PathBuf, Path}; use std::fs::{File, DirBuilder, OpenOptions}; pub fn read_file<P: AsRef<Path>>(file: P) -> Result<String, String>
pub fn read_lines_from_file<P: AsRef<Path>>(file: P) -> Result<impl Iterator<Item=Result<String, ::std::io::Error>>, String> { let file = File::open(file) .map_err(error_err!()) .map_err(|_| "Can't read the file".to_string())?; let lines = BufReader::new(file).lines(); Ok(lines) } pub fn...
{ let mut file = File::open(file) .map_err(error_err!()) .map_err(|_| "Can't read the file".to_string())?; let content = { let mut s = String::new(); file.read_to_string(&mut s) .map_err(error_err!()) .map_err(|err| format!("Can't read the file: {}", err)...
identifier_body
App.py
# -*- coding: UTF-8 -*- # # Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com> # # This file is part of Wammu <https://wammu.eu/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
frame.PostInit(self) self.SetTopWindow(frame) # Return a success flag return True def R un(): ''' Wrapper to execute Wammu. Installs graphical error handler and launches WammuApp. ''' try: sys.excepthook = Wammu.Error.Handler except: print(_('Fai...
Wammu appliction class, it initializes wx and creates main Wammu window. ''' def OnInit(self): ''' wxWindows call this method to initialize the application. ''' self.locale = wx.Locale(wx.LANGUAGE_DEFAULT) self.SetAppName('Wammu') vendor = StrConv('Michal Č...
identifier_body
App.py
# -*- coding: UTF-8 -*- # # Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com> # # This file is part of Wammu <https://wammu.eu/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
''' Wrapper to execute Wammu. Installs graphical error handler and launches WammuApp. ''' try: sys.excepthook = Wammu.Error.Handler except: print(_('Failed to set exception handler.')) app = WammuApp() app.MainLoop()
identifier_name
App.py
# -*- coding: UTF-8 -*- # # Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com> # # This file is part of Wammu <https://wammu.eu/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
self.SetVendorName(vendor) frame = Wammu.Main.WammuFrame(None, -1) Wammu.Error.HANDLER_PARENT = frame frame.Show(True) frame.PostInit(self) self.SetTopWindow(frame) # Return a success flag return True def Run(): ''' Wrapper to execute Wammu. Installs...
r = 'Michal Čihař'
conditional_block
App.py
# -*- coding: UTF-8 -*- # # Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com> # # This file is part of Wammu <https://wammu.eu/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
# You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # ''' Wammu - Phone manager Main Wammu application ''' from __future__ import unicode_literals from __future__ import print_function import wx import sys import Wammu.Main import...
# GNU General Public License for more details. #
random_line_split
death-reason.ts
_EXHAUSTION = 910830060, WEAPON_FIRE = 3750660587, WEAPON_HELI_CRASH = 341774354, WEAPON_VEHICLE_ROCKET = 3204302209, VEHICLE_WEAPON_AKULA_BARRAGE = 2282558706, VEHICLE_WEAPON_AKULA_MINIGUN = 431576697, VEHICLE_WEAPON_AKULA_MISSILE = 2092838988, VEHICLE_WEAPON_AKULA_TURRET_DUAL = 476907586, VEHICLE_WEAP...
VEHICLE_WEAPON_SPEEDO4_MG = 3355244860, VEHICLE_WEAPON_SPEEDO4_TURRET_MG = 3595964737, VEHICLE_WEAPON_SPEEDO4_TURRET_MINI = 2667462330, VEHICLE_WEAPON_STRIKEFORCE_BARRAGE = 968648323, VEHICLE_WEAPON_STRIKEFORCE_CANNON = 955522731, V
VEHICLE_WEAPON_SEABREEZE_MG = 1371067624, VEHICLE_WEAPON_SEARCHLIGHT = 3450622333, VEHICLE_WEAPON_SPACE_ROCKET = 4171469727,
random_line_split
death-reason.ts
ER = 1566990507, VEHICLE_WEAPON_HACKER_MISSILE = 1987049393, VEHICLE_WEAPON_HACKER_MISSILE_HOMING = 2011877270, VEHICLE_WEAPON_HALFTRACK_DUALMG = 1331922171, VEHICLE_WEAPON_HALFTRACK_QUADMG = 1226518132, VEHICLE_WEAPON_HAVOK_MINIGUN = 855547631, VEHICLE_WEAPON_HUNTER_BARRAGE = 785467445, VEHICLE_WEAPON_HU...
{ return Object.keys(razaoMorte)[0]; }
conditional_block
death-reason.ts
3393648765, VEHICLE_WEAPON_DUNE_GRENADELAUNCHER = 2700898573, VEHICLE_WEAPON_DUNE_MG = 3507816399, VEHICLE_WEAPON_DUNE_MINIGUN = 1416047217, VEHICLE_WEAPON_ENEMY_LASER = 1566990507, VEHICLE_WEAPON_HACKER_MISSILE = 1987049393, VEHICLE_WEAPON_HACKER_MISSILE_HOMING = 2011877270, VEHICLE_WEAPON_HALFTRACK_DUA...
razaoMorte
identifier_name
death-reason.ts
= 1566990507, VEHICLE_WEAPON_HACKER_MISSILE = 1987049393, VEHICLE_WEAPON_HACKER_MISSILE_HOMING = 2011877270, VEHICLE_WEAPON_HALFTRACK_DUALMG = 1331922171, VEHICLE_WEAPON_HALFTRACK_QUADMG = 1226518132, VEHICLE_WEAPON_HAVOK_MINIGUN = 855547631, VEHICLE_WEAPON_HUNTER_BARRAGE = 785467445, VEHICLE_WEAPON_HUNT...
{ console.log('>>>> razaoMorte ', razaoHash); const deathReason = EnumToArray(DeathReason); const razaoMorte = deathReason.find((reason) => reason === razaoHash); if (!razaoMorte) { return 'Desconhecido'; } else { return Object.keys(razaoMorte)[0]; } }
identifier_body
App.tsx
import React from 'react'; import FBEmitter from "fbemitter"; import GreetingStore from '../stores/GreetingStore'; import GreetingState from '../types/GreetingState'; import WhoToGreet from './WhoToGreet'; import Greeting from './Greeting'; class App extends React.Component<{}, GreetingState> { eventSubscription: F...
() { this.eventSubscription = GreetingStore.addChangeListener(this.onChange); } public componentWillUnmount() { this.eventSubscription.remove(); } render() { const { greetings, newGreeting } = this.state; return ( <div className="container-fluid"> <h1>Hello People!</h1> ...
componentWillMount
identifier_name
App.tsx
import React from 'react'; import FBEmitter from "fbemitter"; import GreetingStore from '../stores/GreetingStore'; import GreetingState from '../types/GreetingState'; import WhoToGreet from './WhoToGreet'; import Greeting from './Greeting'; class App extends React.Component<{}, GreetingState> { eventSubscription: F...
render() { const { greetings, newGreeting } = this.state; return ( <div className="container-fluid"> <h1>Hello People!</h1> <WhoToGreet newGreeting={ newGreeting } /> { greetings.map((g, index) => <Greeting key={ index } targetOfGreeting={ g } />) } </div> ); } ...
{ this.eventSubscription.remove(); }
identifier_body
App.tsx
import React from 'react'; import FBEmitter from "fbemitter"; import GreetingStore from '../stores/GreetingStore'; import GreetingState from '../types/GreetingState'; import WhoToGreet from './WhoToGreet'; import Greeting from './Greeting'; class App extends React.Component<{}, GreetingState> { eventSubscription: F...
<WhoToGreet newGreeting={ newGreeting } /> { greetings.map((g, index) => <Greeting key={ index } targetOfGreeting={ g } />) } </div> ); } private getStateFromStores() { return GreetingStore.getState(); } } export default App;
random_line_split
MainLayout.tsx
import React, { FC, Suspense } from 'react'; import { Col, Layout, Menu, Row, Space } from 'antd'; import { Link, Outlet, useLocation } from 'react-router-dom'; import classNames from 'classnames'; import { useIntl } from 'react-intl'; // import './MainLayout.scss'; import images from '@commons/utils/images'; import { ...
</Col> </Row> </Layout.Header> <Layout.Content> <Suspense fallback={<Loading />}> <Outlet /> </Suspense> </Layout.Content> <Layout.Footer id="footer"> {intl.formatMessa...
</Menu> </div>
random_line_split
webgl_robustness.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.page import page from telemetry.page import page_test from telemetry.story import story_set as story_set_module...
ps = story_set_module.StorySet( base_dir=conformance_path, serving_dirs=['']) ps.AddStory(WebglRobustnessPage(ps, ps.base_dir)) return ps
identifier_body
webgl_robustness.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.page import page from telemetry.page import page_test from telemetry.story import story_set as story_set_module...
class WebglRobustnessPage(page.Page): def __init__(self, story_set, base_dir): super(WebglRobustnessPage, self).__init__( url='file://extra/lots-of-polys-example.html', page_set=story_set, base_dir=base_dir) self.script_to_evaluate_on_commit = robustness_harness_script def RunNavigateSte...
return false; } window.webglRobustnessTestHarness = robustnessTestHarness; """
random_line_split
webgl_robustness.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.page import page from telemetry.page import page_test from telemetry.story import story_set as story_set_module...
(page.Page): def __init__(self, story_set, base_dir): super(WebglRobustnessPage, self).__init__( url='file://extra/lots-of-polys-example.html', page_set=story_set, base_dir=base_dir) self.script_to_evaluate_on_commit = robustness_harness_script def RunNavigateSteps(self, action_runner): ...
WebglRobustnessPage
identifier_name
winModeReducer.ts
// ==LICENSE-BEGIN== // Copyright 2017 European Digital Reading Lab. All rights reserved. // Licensed to the Readium Foundation under one or more contributor license agreements. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file exposed on Github (readium) in the proj...
return ReaderMode.Detached; case readerActions.attachModeRequest.ID: return ReaderMode.Attached; default: return state; } }
readerActions.attachModeRequest.TAction, ): ReaderMode { switch (action.type) { case readerActions.detachModeRequest.ID:
random_line_split
winModeReducer.ts
// ==LICENSE-BEGIN== // Copyright 2017 European Digital Reading Lab. All rights reserved. // Licensed to the Readium Foundation under one or more contributor license agreements. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file exposed on Github (readium) in the proj...
{ switch (action.type) { case readerActions.detachModeRequest.ID: return ReaderMode.Detached; case readerActions.attachModeRequest.ID: return ReaderMode.Attached; default: return state; } }
identifier_body
winModeReducer.ts
// ==LICENSE-BEGIN== // Copyright 2017 European Digital Reading Lab. All rights reserved. // Licensed to the Readium Foundation under one or more contributor license agreements. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file exposed on Github (readium) in the proj...
( state: ReaderMode = initialState, action: readerActions.detachModeRequest.TAction | readerActions.attachModeRequest.TAction, ): ReaderMode { switch (action.type) { case readerActions.detachModeRequest.ID: return ReaderMode.Detached; case readerActions.attachModeReques...
winModeReducer
identifier_name
resolver.js
define("resolver", [], function() { "use strict"; /* * This module defines a subclass of Ember.DefaultResolver that adds two * important features: * * 1) The resolver makes the container aware of es6 modules via the AMD * output. The loader's _seen is consulted so that classes can be *...
if (seen[moduleName]) { return moduleName; } else if (seen[underscoredModuleName]) { return underscoredModuleName; } else { return moduleName; } } function resolveOther(parsedName) { var prefix = this.namespace.modulePrefix; Ember.assert('module prefix must be defined', ...
{ throw new TypeError("Ambigous module names: `" + moduleName + "` and `" + underscoredModuleName + "`"); }
conditional_block
resolver.js
define("resolver", [], function() { "use strict"; /* * This module defines a subclass of Ember.DefaultResolver that adds two * important features: * * 1) The resolver makes the container aware of es6 modules via the AMD * output. The loader's _seen is consulted so that classes can be *...
(parsedName) { var prefix = this.namespace.modulePrefix; Ember.assert('module prefix must be defined', prefix); var pluralizedType = parsedName.type + 's'; var name = parsedName.fullNameWithoutType; var moduleName = prefix + '/' + pluralizedType + '/' + name; // allow treat all dashed and al...
resolveOther
identifier_name
resolver.js
define("resolver", [], function() { "use strict"; /* * This module defines a subclass of Ember.DefaultResolver that adds two * important features: * * 1) The resolver makes the container aware of es6 modules via the AMD * output. The loader's _seen is consulted so that classes can be *...
if (Ember.ENV.LOG_MODULE_RESOLVER) { Ember.Logger.info('hit', moduleName); } return module; } else { if (Ember.ENV.LOG_MODULE_RESOLVER) { Ember.Logger.info('miss', moduleName); } return this._super(parsedName); } } function resolveTemplate(parsedName) {...
{ var prefix = this.namespace.modulePrefix; Ember.assert('module prefix must be defined', prefix); var pluralizedType = parsedName.type + 's'; var name = parsedName.fullNameWithoutType; var moduleName = prefix + '/' + pluralizedType + '/' + name; // allow treat all dashed and all underscored...
identifier_body
resolver.js
define("resolver", [], function() { "use strict"; /* * This module defines a subclass of Ember.DefaultResolver that adds two * important features: * * 1) The resolver makes the container aware of es6 modules via the AMD * output. The loader's _seen is consulted so that classes can be *...
function resolveOther(parsedName) { var prefix = this.namespace.modulePrefix; Ember.assert('module prefix must be defined', prefix); var pluralizedType = parsedName.type + 's'; var name = parsedName.fullNameWithoutType; var moduleName = prefix + '/' + pluralizedType + '/' + name; // allow...
}
random_line_split
sensor.py
"""Sensor platform for local_ip.""" from homeassistant.components.network import async_get_source_ip from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from homeassistant.he...
(SensorEntity): """A simple sensor.""" _attr_unique_id = SENSOR _attr_icon = "mdi:ip" def __init__(self, name: str) -> None: """Initialize the sensor.""" self._attr_name = name async def async_update(self) -> None: """Fetch new state data for the sensor.""" self._a...
IPSensor
identifier_name
sensor.py
"""Sensor platform for local_ip.""" from homeassistant.components.network import async_get_source_ip from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from homeassistant.he...
async def async_update(self) -> None: """Fetch new state data for the sensor.""" self._attr_native_value = await async_get_source_ip(self.hass)
"""Initialize the sensor.""" self._attr_name = name
identifier_body
sensor.py
"""Sensor platform for local_ip.""" from homeassistant.components.network import async_get_source_ip from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from homeassistant.he...
_attr_unique_id = SENSOR _attr_icon = "mdi:ip" def __init__(self, name: str) -> None: """Initialize the sensor.""" self._attr_name = name async def async_update(self) -> None: """Fetch new state data for the sensor.""" self._attr_native_value = await async_get_source_i...
class IPSensor(SensorEntity): """A simple sensor."""
random_line_split
iostat.rs
use alloc::string::String; use alloc::vec::Vec; use core::fmt::Write; use core::str; use crate::context; use crate::scheme; use crate::syscall::error::Result; pub fn
() -> Result<Vec<u8>> { let mut string = String::new(); { let mut rows = Vec::new(); { let contexts = context::contexts(); for (id, context_lock) in contexts.iter() { let context = context_lock.read(); rows.push((*id, context.name.read().c...
resource
identifier_name
iostat.rs
use alloc::string::String; use alloc::vec::Vec; use core::fmt::Write; use core::str; use crate::context;
let mut string = String::new(); { let mut rows = Vec::new(); { let contexts = context::contexts(); for (id, context_lock) in contexts.iter() { let context = context_lock.read(); rows.push((*id, context.name.read().clone(), context.files.re...
use crate::scheme; use crate::syscall::error::Result; pub fn resource() -> Result<Vec<u8>> {
random_line_split
iostat.rs
use alloc::string::String; use alloc::vec::Vec; use core::fmt::Write; use core::str; use crate::context; use crate::scheme; use crate::syscall::error::Result; pub fn resource() -> Result<Vec<u8>>
None => continue, Some(ref file) => file.clone() }; let description = file.description.read(); let scheme = { let schemes = scheme::schemes(); match schemes.get(description.scheme) { ...
{ let mut string = String::new(); { let mut rows = Vec::new(); { let contexts = context::contexts(); for (id, context_lock) in contexts.iter() { let context = context_lock.read(); rows.push((*id, context.name.read().clone(), context.files....
identifier_body
resource_files.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::fs::File; use std::io::{self, Read}; use std::path::PathBuf; use std::sync::{Arc, Mutex}; lazy_static! {...
path } } } pub fn read_resource_file(relative_path_components: &[&str]) -> io::Result<Vec<u8>> { let mut path = resources_dir_path(); for component in relative_path_components { path.push(component); } let mut file = try!(File::open(&path)); let mut data = Vec::new(...
{ // resources dir not in same dir as exe? // exe is probably in target/{debug,release} so we need to go back to topdir path.pop(); path.pop(); path.pop(); path.push("resources"); if !path.is_dir() { //...
conditional_block
resource_files.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::fs::File; use std::io::{self, Read}; use std::path::PathBuf; use std::sync::{Arc, Mutex}; lazy_static! {...
} #[cfg(target_os = "android")] pub fn resources_dir_path() -> PathBuf { PathBuf::from("/sdcard/servo/") } #[cfg(not(target_os = "android"))] pub fn resources_dir_path() -> PathBuf { use std::env; match *CMD_RESOURCE_DIR.lock().unwrap() { Some(ref path) => PathBuf::from(path), None => { ...
random_line_split
resource_files.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::fs::File; use std::io::{self, Read}; use std::path::PathBuf; use std::sync::{Arc, Mutex}; lazy_static! {...
() -> PathBuf { use std::env; match *CMD_RESOURCE_DIR.lock().unwrap() { Some(ref path) => PathBuf::from(path), None => { // FIXME: Find a way to not rely on the executable being // under `<servo source>[/$target_triple]/target/debug` // or `<servo source>[/$t...
resources_dir_path
identifier_name
resource_files.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::fs::File; use std::io::{self, Read}; use std::path::PathBuf; use std::sync::{Arc, Mutex}; lazy_static! {...
{ let mut path = resources_dir_path(); for component in relative_path_components { path.push(component); } let mut file = try!(File::open(&path)); let mut data = Vec::new(); try!(file.read_to_end(&mut data)); Ok(data) }
identifier_body
structDCERPC__.js
var structDCERPC__ = [ [ "bytesprocessed", "structDCERPC__.html#a31f7f47275fc94f2370c88f495db913b", null ], [ "dcerpcbindbindack", "structDCERPC__.html#ab1c8ba6432fb59e46dcdb6d98a80a1c1", null ], [ "dcerpchdr", "structDCERPC__.html#acba75761717afe7a6a5bb0a64480b45f", null ], [ "dcerpcrequest", "structDC...
];
random_line_split
where.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} pub struct Echo<E>(E); // @has foo/struct.Echo.html '//*[@class="impl"]//code' \ // "impl<E> MyTrait for Echo<E> where E: MyTrait" // @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//code' \ // "impl<E> MyTrait for Echo<E> where E: MyTrait" impl<E> MyTrait for Echo<E> where E: MyTrait {...
{}
identifier_body