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
query_breakdown_runner.ts
import {Progress, CancellationToken} from 'vscode'; import {exec} from 'child_process'; import {ResultJson} from './resultJson'; import * as config from './toolconfig.json'; /** * query_breakdown_runner contains the QueryBreakdownRunner class that is used to * run the backend (query_breakdown) jar file from VS code ...
else { reject(errorMessage); } }) .on('error', err => reject(err)); // adds the standard output from backend to the jsonString variable for parsing process.stdout!.on('data', result => { jsonString += result; }); // extracts the error message if th...
{ // returns the array of json objects after parsing the result resolve(JSON.parse(jsonString)); }
conditional_block
query_breakdown_runner.ts
import {Progress, CancellationToken} from 'vscode'; import {exec} from 'child_process'; import {ResultJson} from './resultJson'; import * as config from './toolconfig.json'; /** * query_breakdown_runner contains the QueryBreakdownRunner class that is used to * run the backend (query_breakdown) jar file from VS code ...
(private execPath: string) {} // method that executes the query_breakdown program. It returns a promise as it is called asynchronously execute( filepath: string, progress: Progress<{message?: string | undefined}>, token: CancellationToken ): Promise<ResultJson[]> { if (token.isCancellationRequest...
constructor
identifier_name
query_breakdown_runner.ts
import {Progress, CancellationToken} from 'vscode'; import {exec} from 'child_process'; import {ResultJson} from './resultJson'; import * as config from './toolconfig.json'; /** * query_breakdown_runner contains the QueryBreakdownRunner class that is used to * run the backend (query_breakdown) jar file from VS code ...
constructor(private execPath: string) {} // method that executes the query_breakdown program. It returns a promise as it is called asynchronously execute( filepath: string, progress: Progress<{message?: string | undefined}>, token: CancellationToken ): Promise<ResultJson[]> { if (token.isCancel...
export class QueryBreakdownRunner {
random_line_split
ir_fields_converter.py
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models _logger = logging.getLogger(__name__) class IrFieldsConverter(models.AbstractModel): _inherit = "ir.fields.converter" @api.model def text_from_html(self, html_content, max_words=None, max_chars=None, ellipsis=u"…", fail=False): """Extract text ...
import logging from lxml import etree, html
random_line_split
ir_fields_converter.py
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging from lxml import etree, html from odoo import api, models _logger = logging.getLogger(__name__) class IrFieldsConverter(models.A...
(self, html_content, max_words=None, max_chars=None, ellipsis=u"…", fail=False): """Extract text from an HTML field in a generator. :param str html_content: HTML contents from where to extract the text. :param int max_words: Maximum amount of word...
text_from_html
identifier_name
ir_fields_converter.py
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging from lxml import etree, html from odoo import api, models _logger = logging.getLogger(__name__) class IrFieldsConverter(models.A...
If ``True``, exceptions will be raised. Otherwise, an empty string will be returned on failure. """ # Parse HTML try: doc = html.fromstring(html_content) except (TypeError, etree.XMLSyntaxError, etree.ParserError): if fail: ...
"Extract text from an HTML field in a generator. :param str html_content: HTML contents from where to extract the text. :param int max_words: Maximum amount of words allowed in the resulting string. :param int max_chars: Maximum amount of characters allowed...
identifier_body
ir_fields_converter.py
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Tecnativa - Vicent Cubells # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging from lxml import etree, html from odoo import api, models _logger = logging.getLogger(__name__) class IrFieldsConverter(models.A...
# Get text text = u" ".join(words) # Truncate text suffix = suffix or max_chars and len(text) > max_chars if max_chars: text = text[:max_chars - (len(ellipsis) if suffix else 0)].strip() # Append ellipsis if needed if suffix: text += elli...
rds = words[:max_words]
conditional_block
directive_resolver_mock.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {CompileReflector, DirectiveResolver, core} from '@angular/compiler'; /** * An implementation of {@link Dire...
} }
random_line_split
directive_resolver_mock.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {CompileReflector, DirectiveResolver, core} from '@angular/compiler'; /** * An implementation of {@link Dire...
extends DirectiveResolver { private _directives = new Map<core.Type, core.Directive>(); constructor(reflector: CompileReflector) { super(reflector); } resolve(type: core.Type): core.Directive; resolve(type: core.Type, throwIfNotFound: true): core.Directive; resolve(type: core.Type, throwIfNotFound: boolean...
MockDirectiveResolver
identifier_name
directive_resolver_mock.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {CompileReflector, DirectiveResolver, core} from '@angular/compiler'; /** * An implementation of {@link Dire...
/** * Overrides the {@link core.Directive} for a directive. */ setDirective(type: core.Type, metadata: core.Directive): void { this._directives.set(type, metadata); } }
{ return this._directives.get(type) || super.resolve(type, throwIfNotFound); }
identifier_body
api.py
""" uritemplate.api =============== This module contains the very simple API provided by uritemplate. """ from uritemplate.template import URITemplate def expand(uri, var_dict=None, **kwargs): """Expand the template with the given parameters. :param str uri: The templated URI to expand :param dict var...
If all of the parameters for the template are not given, return a partially expanded template. :param dict var_dict: Optional dictionary with variables and values :param kwargs: Alternative way to pass arguments :returns: :class:`URITemplate` Example:: t = URITemplate('https://api.gi...
def partial(uri, var_dict=None, **kwargs): """Partially expand the template with the given parameters.
random_line_split
api.py
""" uritemplate.api =============== This module contains the very simple API provided by uritemplate. """ from uritemplate.template import URITemplate def expand(uri, var_dict=None, **kwargs): """Expand the template with the given parameters. :param str uri: The templated URI to expand :param dict var...
def variables(uri): """Parse the variables of the template. This returns all of the variable names in the URI Template. :returns: Set of variable names :rtype: set Example:: variables('https://api.github.com{/end}) # => {'end'} variables('https://api.github.com/repos{/...
"""Partially expand the template with the given parameters. If all of the parameters for the template are not given, return a partially expanded template. :param dict var_dict: Optional dictionary with variables and values :param kwargs: Alternative way to pass arguments :returns: :class:`URITempl...
identifier_body
api.py
""" uritemplate.api =============== This module contains the very simple API provided by uritemplate. """ from uritemplate.template import URITemplate def expand(uri, var_dict=None, **kwargs): """Expand the template with the given parameters. :param str uri: The templated URI to expand :param dict var...
(uri, var_dict=None, **kwargs): """Partially expand the template with the given parameters. If all of the parameters for the template are not given, return a partially expanded template. :param dict var_dict: Optional dictionary with variables and values :param kwargs: Alternative way to pass argu...
partial
identifier_name
__init__.py
os.mkdir(path) os.chmod(path, MODE_DIRECTORY) if args.coverage: coverage_config_path = os.path.join(path, COVERAGE_CONFIG_NAME) coverage_config = generate_coverage_config(args) write_text_file(coverage_config_path, coverage_config) os.chmod(coverage_config_path, MODE_FILE...
__init__
identifier_name
__init__.py
, ) from ..coverage_util import ( generate_coverage_config, ) from ..cache import ( CommonCache, ) from ..cloud import ( CloudEnvironmentConfig, ) from ..data import ( data_context, ) def setup_common_temp_dir(args, path): """ :type args: IntegrationConfig :type path: str """ i...
""" :type args: IntegrationConfig :type env_config: CloudEnvironmentConfig :type integration_dir: str """ if not env_config: yield None return config_vars = (env_config.ansible_vars or {}).copy() config_vars.update(dict( ansible_test=dict( environment=en...
identifier_body
__init__.py
, MODE_DIRECTORY, MODE_DIRECTORY_WRITE, MODE_FILE, to_bytes, ) from ..util_common import ( named_temporary_file, write_text_file, ResultType, ) from ..coverage_util import ( generate_coverage_config, ) from ..cache import ( CommonCache, ) from ..cloud import ( CloudEnvironmen...
""" if args.explain: return os.mkdir(path) os.chmod(path, MODE_DIRECTORY) if args.coverage: coverage_config_path = os.path.join(path, COVERAGE_CONFIG_NAME) coverage_config = generate_coverage_config(args) write_text_file(coverage_config_path, coverage_config) ...
def setup_common_temp_dir(args, path): """ :type args: IntegrationConfig :type path: str
random_line_split
__init__.py
MODE_DIRECTORY, MODE_DIRECTORY_WRITE, MODE_FILE, to_bytes, ) from ..util_common import ( named_temporary_file, write_text_file, ResultType, ) from ..coverage_util import ( generate_coverage_config, ) from ..cache import ( CommonCache, ) from ..cloud import ( CloudEnvironmentC...
yield IntegrationEnvironment(integration_dir, targets_dir, inventory_path, ansible_config, vars_file) finally: if not args.explain: shutil.rmtree(temp_dir) @contextlib.contextmanager def integration_test_config_file(args, env_config, integration_dir): """ :type args: Integrat...
display.info('Copying %s to %s' % (file_src, file_dst), verbosity=2) if not args.explain: make_dirs(os.path.dirname(file_dst)) shutil.copy2(file_src, file_dst)
conditional_block
user-md.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } }...
var FaUserMd = function FaUserMd(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm13.1 30q0 0.6-0.5 1...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
user-md.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } }...
var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FaUserMd = function FaUserMd(props) { return _react2.default.createElement( _reactIconBase2.de...
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
random_line_split
user-md.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } }...
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FaUserMd = function FaUserMd(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, ...
_interopRequireDefault
identifier_name
user-md.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++)
return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FaUserM...
{ var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } }
conditional_block
htmlfontelement.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 cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bin...
{ RelativePlus, RelativeMinus, Absolute, } let mut input_chars = input.chars().peekable(); let parse_mode = match input_chars.peek() { // Step 4 None => return AttrValue::String(original_input.into()), // Step 5 Some(&'+') => { let _ = in...
ParseMode
identifier_name
htmlfontelement.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 cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bin...
ParseMode::RelativePlus } Some(&'-') => { let _ = input_chars.next(); // consume the '-' ParseMode::RelativeMinus } Some(_) => ParseMode::Absolute, }; // Steps 6, 7, 8 let mut value = match read_numbers(input_chars) { (Some(v), _)...
{ let original_input = input; // Steps 1 & 2 are not relevant // Step 3 input = input.trim_matches(HTML_SPACE_CHARACTERS); enum ParseMode { RelativePlus, RelativeMinus, Absolute, } let mut input_chars = input.chars().peekable(); let parse_mode = match input_char...
identifier_body
htmlfontelement.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 cssparser::RGBA; use dom::bindings::codegen::Bindings::HTMLFontElementBinding; use dom::bindings::codegen::Bin...
use dom::node::Node; use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever_atoms::LocalName; use servo_atoms::Atom; use style::attr::AttrValue; use style::str::{HTML_SPACE_CHARACTERS, read_numbers}; #[dom_struct] pub struct HTMLFontElement { htmlelement: HTMLElement, } impl HTMLFontE...
use dom::bindings::js::{LayoutJS, Root}; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, RawLayoutElementHelpers}; use dom::htmlelement::HTMLElement;
random_line_split
source.js
(function($) { $.Redactor.prototype.source = function() { return { init: function() { var button = this.button.addFirst('html', 'HTML'); this.button.setIcon(button, '<i class="re-icon-html"></i>'); this.button.addCallback(button, this.source.toggle); var style = { 'width': '100%', '...
}, this)); this.marker.remove(); $(window).scrollTop(scroll); if (this.source.$textarea[0].setSelectionRange) { this.source.$textarea[0].setSelectionRange(this.source.start, this.source.end); } this.source.$textarea[0].scrollTop = 0; setTimeout($.proxy(function() { t...
{ this.core.textarea().val(this.source.$textarea.val()); }
conditional_block
source.js
(function($) { $.Redactor.prototype.source = function() { return { init: function() { var button = this.button.addFirst('html', 'HTML'); this.button.setIcon(button, '<i class="re-icon-html"></i>'); this.button.addCallback(button, this.source.toggle); var style = { 'width': '100%', '...
'line-height': '24px', 'font-family': 'Consolas, Menlo, Monaco, "Courier New", monospace' }; this.source.$textarea = $('<textarea />'); this.source.$textarea.css(style).hide(); if (this.opts.type === 'textarea') { this.core.box().append(this.source.$textarea); } else { ...
'outline': 'none', 'padding': '20px',
random_line_split
ty.rs
// Copyright 2013 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 mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifetime> { match *lt { Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))), None => None } } impl<'self> Ty<'self> { pub fn to_ty(&self, cx: @ExtCtxt, span: span, ...
{ Tuple(~[]) }
identifier_body
ty.rs
// Copyright 2013 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 ...
Tuple(~[]) } fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifetime> { match *lt { Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))), None => None } } impl<'self> Ty<'self> { pub fn to_ty(&self, cx: @ExtCtxt, span: sp...
pub fn nil_ty() -> Ty<'static> {
random_line_split
ty.rs
// Copyright 2013 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 ...
(&self, cx: @ExtCtxt, span: span, self_ty: ident, self_generics: &Generics) -> ast::Ty { match *self { Ptr(ref ty, ref ptr) => { let raw_ty = ty.to_ty(cx, span, self_ty, self_generics); ...
to_ty
identifier_name
ty.rs
// Copyright 2013 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 fn to_path(&self, cx: @ExtCtxt, span: span, self_ty: ident, self_generics: &Generics) -> ast::Path { match *self { Self => { let self_params = do self_generics.ty_...
{ let ty = if fields.is_empty() { ast::ty_nil } else { ast::ty_tup(fields.map(|f| f.to_ty(cx, span, self_ty, self_generics))) }; cx.ty(span, ty) }
conditional_block
gameTable-detail.component.ts
import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { Location } from "@angular/common"; import { GameTableService } from "./gameTable.service"; import { GameTable } from "./gameTable"; import { Common } from "./../Common"; import { TableBoardGame } from "./table...
this.save(); } save(): void { var loc = this.location; this.gameTableService.update(this.gameTable) .subscribe(errorMessage => { new Common(loc).showErrorOrGoBack(errorMessage); }); } goBack(): void { const loc = this.location; return new Common(loc)...
return; }
conditional_block
gameTable-detail.component.ts
import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { Location } from "@angular/common"; import { GameTableService } from "./gameTable.service"; import { GameTable } from "./gameTable"; import { Common } from "./../Common"; import { TableBoardGame } from "./table...
private SetMinAndMaxPlayers(): void { this.gameTable.MinPlayers = Math.min(...this.gameTable.TableBoardGameList.map(x => x.MinBoardGamePlayers)); this.gameTable.MaxPlayers = Math.max(...this.gameTable.TableBoardGameList.map(x => x.MaxBoardGamePlayers)); } deactivate(tableBoardGame: TableBoa...
this.selectedTableBoardGame = this.availableTableBoardGames.filter(x => x.BoardGameId === Number(selectedTableBoardGameId))[0]; this.gameTable.TableBoardGameList = this.gameTable.TableBoardGameList || []; this.gameTable.TableBoardGameList.push(this.selectedTableBoardGame); co...
identifier_body
gameTable-detail.component.ts
import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { Location } from "@angular/common"; import { GameTableService } from "./gameTable.service"; import { GameTable } from "./gameTable"; import { Common } from "./../Common"; import { TableBoardGame } from "./table...
ableBoardGame: TableBoardGame): void { this.gameTable.TableBoardGameList = this.gameTable.TableBoardGameList.filter(t => t !== tableBoardGame); this.availableTableBoardGames.push(tableBoardGame); if (this.selectedTableBoardGame === tableBoardGame) { this.selectedTableBoardGame = null...
activate(t
identifier_name
gameTable-detail.component.ts
import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { Location } from "@angular/common"; import { GameTableService } from "./gameTable.service"; import { GameTable } from "./gameTable"; import { Common } from "./../Common"; import { TableBoardGame } from "./table...
constructor( private gameTableService: GameTableService, private gamerService: GamerService, private route: ActivatedRoute, private location: Location ) { } ngOnInit() { this.gameTableService.getGameTable(Number(this.route.snapshot.paramMap.get("id"))) ...
gameTable: GameTable; availableTableBoardGames: TableBoardGame[]; selectedTableBoardGame: TableBoardGame; isCurrentGamer = false; //TODO: add isMember to allow edit
random_line_split
io.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This file...
if right.len() > 0 { self.buf.push_all(right); } } // Bump us forward self.pos += buf.len(); Ok(()) } } impl Seek for SeekableMemWriter { #[inline] fn tell(&self) -> IoResult<u64> { Ok(self.pos as u64) } #[inline] fn seek(&m...
{ slice::bytes::copy_memory(self.buf.slice_from_mut(self.pos), left); }
conditional_block
io.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This file...
(n: uint) -> SeekableMemWriter { SeekableMemWriter { buf: Vec::with_capacity(n), pos: 0 } } /// Acquires an immutable reference to the underlying buffer of this /// `SeekableMemWriter`. /// /// No method is exposed for acquiring a mutable reference to the buffer /// because it could cor...
with_capacity
identifier_name
io.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This file...
assert_eq!(writer.get_ref(), b); writer.seek(-1, io::SeekEnd).unwrap(); writer.write(&[1, 2]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; assert_eq!(writer.get_ref(), b); writer.seek(1, io::SeekEnd).unwrap(); writer.write(&[1]).unwrap(); let b:...
{ let mut writer = SeekableMemWriter::new(); assert_eq!(writer.tell(), Ok(0)); writer.write(&[0]).unwrap(); assert_eq!(writer.tell(), Ok(1)); writer.write(&[1, 2, 3]).unwrap(); writer.write(&[4, 5, 6, 7]).unwrap(); assert_eq!(writer.tell(), Ok(8)); let b: ...
identifier_body
io.rs
// 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 http://opensource.org/licenses/MIT>, at your // option. This fil...
let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(-1, io::SeekEnd).unwrap(); writer.write(&[1, 2]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; assert_eq!(writer.get_ref(), b); writer.seek(1, io::SeekEnd).unwrap(); ...
writer.seek(1, io::SeekCur).unwrap(); writer.write(&[0, 1]).unwrap();
random_line_split
spawner.ts
import { Level, LevelSpawnable } from "../level/level"; import { AnonymousPowerup, Apple, SPAWN_ID, SPAWN_TYPE, Spawnable } from "../level/spawnables"; import { eq, getRandomItemFrom, noop, randomRangeFloat } from "../util"; import { Snake } from "./snake"; export class Spawner { private spawnables: Spawnable[] = ...
(delay = 0) { this.timers.push( setTimeout(() => { const newSpawnLocation = this.newSpawnLocation; if (newSpawnLocation) { const spawn = new Apple(this.level.settings, newSpawnLocation); this.spawnables.push(spawn); ...
scheduleSpawnApple
identifier_name
spawner.ts
import { Level, LevelSpawnable } from "../level/level"; import { AnonymousPowerup, Apple, SPAWN_ID, SPAWN_TYPE, Spawnable } from "../level/spawnables"; import { eq, getRandomItemFrom, noop, randomRangeFloat } from "../util"; import { Snake } from "./snake"; export class Spawner { private spawnables: Spawnable[] = ...
handleSpawnHit(snake: Snake): Spawnable | undefined { const spawnable = this.spawnableAtCoordinate(snake.head); if (spawnable) { spawnable.active = false; if (spawnable.type === SPAWN_TYPE.APPLE) { this.scheduleSpawnApple(); return spawnable;...
{ for (let i = 0, m = this.timers.length; i < m; i++) { clearTimeout(this.timers[i]); } for (let i = 0, m = this.spawnables.length; i < m; i++) { this.spawnables[i].destruct(); } this.spawnables.length = 0; this.onspawn = noop; }
identifier_body
spawner.ts
import { Level, LevelSpawnable } from "../level/level"; import { AnonymousPowerup, Apple, SPAWN_ID, SPAWN_TYPE, Spawnable } from "../level/spawnables"; import { eq, getRandomItemFrom, noop, randomRangeFloat } from "../util"; import { Snake } from "./snake"; export class Spawner { private spawnables: Spawnable[] = ...
else if ((spawnable.constructor as typeof Spawnable).id === SPAWN_ID.ANONYMOUS) { return this.exchangeAnonymous( spawnable.coordinate, this.level.settings.powerupsEnabled, ); } } } exchangeAnonymous(coordinate: Coordin...
{ this.scheduleSpawnApple(); return spawnable; }
conditional_block
spawner.ts
import { Level, LevelSpawnable } from "../level/level"; import { AnonymousPowerup, Apple, SPAWN_ID, SPAWN_TYPE, Spawnable } from "../level/spawnables"; import { eq, getRandomItemFrom, noop, randomRangeFloat } from "../util"; import { Snake } from "./snake"; export class Spawner { private spawnables: Spawnable[] = ...
} } get newSpawnLocation(): Coordinate | undefined { // Try multiple times, is less logic/iterations compared to compiling a list. const maxAttempts = 50; for (let i = 0; i < maxAttempts; i++) { const tryCoordinate = this.level.data.empties.random(); if (...
for (let i = 0, m = this.snakes.length; i < m; i++) { if (this.snakes[i].hasCoordinate(coordinate)) { return this.snakes[i]; }
random_line_split
analyticsWriter.ts
import { isDevelopment, isAnyTest, onStartup } from '../lib/executionEnvironment'; import { randomId } from '../lib/random'; import { Pool } from 'pg'; import { AnalyticsUtil } from '../lib/analyticsEvents'; import { PublicInstanceSetting } from '../lib/instanceSettings'; import { DatabaseServerSetting } from './databa...
if (!analyticsConnectionPool) analyticsConnectionPool = new Pool({ connectionString }); return analyticsConnectionPool; } // If you want to capture an event, this is not the function you're looking for; // use captureEvent. // Writes an event to the analytics database. // TODO: Defer/batch so that this doesn'...
{ if (!missingConnectionStringWarned) { missingConnectionStringWarned = true; //eslint-disable-next-line no-console console.log("Analytics logging disabled: analytics.connectionString is not configured"); } return null; }
conditional_block
analyticsWriter.ts
import { isDevelopment, isAnyTest, onStartup } from '../lib/executionEnvironment'; import { randomId } from '../lib/random'; import { Pool } from 'pg'; import { AnalyticsUtil } from '../lib/analyticsEvents'; import { PublicInstanceSetting } from '../lib/instanceSettings'; import { DatabaseServerSetting } from './databa...
} return true; } , } }); addGraphQLMutation('analyticsEvent(events: [JSON!], now: Date): Boolean'); let analyticsConnectionPool:Pool|null = null; let missingConnectionStringWarned = false; // Return the Analytics database connection pool, if configured. If no // analytics DB is specified in the ser...
{ // Adjust timestamps to account for server-client clock skew // The mutation comes with a timestamp on each event from the client // clock, and a timestamp representing when events were flushed, also // from the client clock. We use these to translate from absolute time to // relative ti...
identifier_body
analyticsWriter.ts
import { isDevelopment, isAnyTest, onStartup } from '../lib/executionEnvironment'; import { randomId } from '../lib/random'; import { Pool } from 'pg'; import { AnalyticsUtil } from '../lib/analyticsEvents'; import { PublicInstanceSetting } from '../lib/instanceSettings'; import { DatabaseServerSetting } from './databa...
({type, timestamp, props}) { const queryStr = 'insert into raw(environment, event_type, timestamp, event) values ($1,$2,$3,$4)'; const environmentDescription = isDevelopment ? "development" : environmentDescriptionSetting.get() const queryValues = [environmentDescription, type, timestamp, props]; const conne...
writeEventToAnalyticsDB
identifier_name
analyticsWriter.ts
import { isDevelopment, isAnyTest, onStartup } from '../lib/executionEnvironment'; import { randomId } from '../lib/random'; import { Pool } from 'pg'; import { AnalyticsUtil } from '../lib/analyticsEvents'; import { PublicInstanceSetting } from '../lib/instanceSettings'; import { DatabaseServerSetting } from './databa...
let eventCopy = {...event, timestamp: adjustedTimestamp}; writeEventToAnalyticsDB(eventCopy); } return true; }, } }); addGraphQLMutation('analyticsEvent(events: [JSON!], now: Date): Boolean'); let analyticsConnectionPool:Pool|null = null; let missingConnectionStringWarned = ...
random_line_split
services.ts
import fs = require('fs'); import mySql = require('mysql'); import nodemailer = require('nodemailer'); // Choose config file var args = process.argv.slice(2); if (args[0] == 'dev') {
lse { var configFile = __dirname + '/config/config.json'; } // Define config interfaces interface configuationData { database: mySql.IPoolConfig, mail: { service: string, auth: { user: string, pass: string } }, senderAddress: { name: string, address: string }, installPassword: string } // Load con...
var configFile = __dirname + '/config/dev.json'; } e
conditional_block
services.ts
import fs = require('fs'); import mySql = require('mysql'); import nodemailer = require('nodemailer'); // Choose config file var args = process.argv.slice(2); if (args[0] == 'dev') { var configFile = __dirname + '/config/dev.json'; } else { var configFile = __dirname + '/config/config.json'; } // Define conf...
protected _isChanged: boolean = false; get isChanged(): boolean { return this._isChanged; } private _id: number; get id(): number { return this._id; } set id(newID: number) { this._id = newID; this._isChanged = true; } constructor() { thi...
protected objectName: string;
random_line_split
services.ts
import fs = require('fs'); import mySql = require('mysql'); import nodemailer = require('nodemailer'); // Choose config file var args = process.argv.slice(2); if (args[0] == 'dev') { var configFile = __dirname + '/config/dev.json'; } else { var configFile = __dirname + '/config/config.json'; } // Define conf...
private _id: number; get id(): number { return this._id; } set id(newID: number) { this._id = newID; this._isChanged = true; } constructor() { this.connectionPool = pool; } Save(properties: any, callback?: (err?: Error, res?: any) => void) { th...
return this._isChanged; }
identifier_body
services.ts
import fs = require('fs'); import mySql = require('mysql'); import nodemailer = require('nodemailer'); // Choose config file var args = process.argv.slice(2); if (args[0] == 'dev') { var configFile = __dirname + '/config/dev.json'; } else { var configFile = __dirname + '/config/config.json'; } // Define conf...
: number { return this._id; } set id(newID: number) { this._id = newID; this._isChanged = true; } constructor() { this.connectionPool = pool; } Save(properties: any, callback?: (err?: Error, res?: any) => void) { this.connectionPool.query('UPDATE ?? SET...
()
identifier_name
state_functions.py
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + """Set of general purpose functions which are...
def set_monitor_names(state, idf_path, invalid_monitor_names=None): if invalid_monitor_names is None: invalid_monitor_names = [] monitor_names = get_monitor_names_from_idf_file(idf_path, invalid_monitor_names) state.monitor_names = monitor_names
try: if DetectorType.from_string(detector_type) in invalid_detector_types: continue detector_name_tag = detector_names[detector_type] detector_name_short_tag = detector_names_short[detector_type] detector_name = found_detector_names[detector_name_tag] ...
conditional_block
state_functions.py
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + """Set of general purpose functions which are...
names_to_search.extend(list(detector_names_short.values())) found_detector_names = get_named_elements_from_ipf_file(ipf_path, names_to_search, str) for detector_type in state.detectors: try: if DetectorType.from_string(detector_type) in invalid_detector_types: continue ...
random_line_split
state_functions.py
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + """Set of general purpose functions which are...
(state, idf_path, invalid_monitor_names=None): if invalid_monitor_names is None: invalid_monitor_names = [] monitor_names = get_monitor_names_from_idf_file(idf_path, invalid_monitor_names) state.monitor_names = monitor_names
set_monitor_names
identifier_name
state_functions.py
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + """Set of general purpose functions which are...
def one_is_none(elements_to_check): return any(element is None for element in elements_to_check) def validation_message(error_message, instruction, variables): """ Generates a validation message for the SANSState. :param error_message: A message describing the error. :param instruction: A mess...
""" This function checks if both are not none and then checks if the first element is smaller than the second element. :param elements_to_check: a list with two entries. The first is the lower bound and the second entry is the upper bound :return: False if at least one input i...
identifier_body
Lockable.ts
/** * This base class provides an lock interface to execute exclusive operations */ export class Lockable { private isLocked: boolean; private readyPromise: Promise<this>; constructor() { /** * Indicates if there is currently an onging exclusive operation * @type boolean * @private */ ...
else { this.isLocked = false; } throw e; } } }
{ this.readyPromise = Promise.reject(e); }
conditional_block
Lockable.ts
/** * This base class provides an lock interface to execute exclusive operations */ export class
{ private isLocked: boolean; private readyPromise: Promise<this>; constructor() { /** * Indicates if there is currently an onging exclusive operation * @type boolean * @private */ this.isLocked = false; /** * A promise which represents the state of the least exclusive oper...
Lockable
identifier_name
Lockable.ts
/** * This base class provides an lock interface to execute exclusive operations */ export class Lockable { private isLocked: boolean; private readyPromise: Promise<this>; constructor() { /** * Indicates if there is currently an onging exclusive operation * @type boolean * @private */ ...
this.isLocked = true; const result = callback().then((res) => { this.isLocked = false; return res; }, (e) => { if (!critical) { this.isLocked = false; } throw e; }); this.readyPromise = result.then(() => this, (e) => { if (!critica...
if (this.isLocked) { throw new Error('Current operation has not been finished.'); } try {
random_line_split
Lockable.ts
/** * This base class provides an lock interface to execute exclusive operations */ export class Lockable { private isLocked: boolean; private readyPromise: Promise<this>; constructor()
/** * Indicates if there is currently no exclusive operation executed * <code>true</code> If no exclusive lock is hold */ get isReady(): boolean { return !this.isLocked; } /** * Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled * @param do...
{ /** * Indicates if there is currently an onging exclusive operation * @type boolean * @private */ this.isLocked = false; /** * A promise which represents the state of the least exclusive operation * @type Promise * @private */ this.readyPromise = Promise.resolv...
identifier_body
retrievers.js
"use strict"; exports.__esModule = true; exports.getBindingIdentifiers = getBindingIdentifiers; // istanbul ignore next function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key...
ids[id.name] = id; } } else if (t.isExportDeclaration(id)) { if (t.isDeclaration(node.declaration)) { search.push(node.declaration); } } else if (keys) { for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (id[key]) { search = search.co...
_ids.push(id); } else {
random_line_split
retrievers.js
"use strict"; exports.__esModule = true; exports.getBindingIdentifiers = getBindingIdentifiers; // istanbul ignore next function _interopRequireWildcard(obj)
var _index = require("./index"); var t = _interopRequireWildcard(_index); /** * Return a list of binding identifiers associated with the input `node`. */ function getBindingIdentifiers(node, duplicates) { var search = [].concat(node); var ids = Object.create(null); while (search.length) { var id = sea...
{ if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
identifier_body
retrievers.js
"use strict"; exports.__esModule = true; exports.getBindingIdentifiers = getBindingIdentifiers; // istanbul ignore next function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key...
} else if (keys) { for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (id[key]) { search = search.concat(id[key]); } } } } return ids; } /** * Mapping of types to their identifier keys. */ getBindingIdentifiers.keys = { DeclareClass: ["id"], ...
{ search.push(node.declaration); }
conditional_block
retrievers.js
"use strict"; exports.__esModule = true; exports.getBindingIdentifiers = getBindingIdentifiers; // istanbul ignore next function
(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } var _index = require("./index"); var t = _interopRequireWildcard(_index); /*...
_interopRequireWildcard
identifier_name
render-gtk3-assets.py
#!/usr/bin/python3 # Thanks to the GNOME theme nerds for the original source of this script import os import sys import xml.sax import subprocess INKSCAPE = '/usr/bin/inkscape' OPTIPNG = '/usr/bin/optipng' MAINDIR = '../EvoPop' SRC = os.path.join('.', 'gtk3') inkscape_process = None def optimize_png(png_file): ...
return elif name == "text" and ('inkscape:label' in attrs) and attrs['inkscape:label'] == 'icon-name': self.stack.append(self.TEXT) self.inside.append(self.TEXT) self.text = 'icon-name' self.chars = "" return ...
if self.inside[-1] == self.ROOT: if name == "svg": self.stack.append(self.SVG) self.inside.append(self.SVG) return elif self.inside[-1] == self.SVG: if (name == "g" and ('inkscape:groupmode' in attrs) and ('inkscape:label' in attrs) ...
identifier_body
render-gtk3-assets.py
#!/usr/bin/python3 # Thanks to the GNOME theme nerds for the original source of this script import os import sys import xml.sax import subprocess INKSCAPE = '/usr/bin/inkscape' OPTIPNG = '/usr/bin/optipng' MAINDIR = '../EvoPop' SRC = os.path.join('.', 'gtk3') inkscape_process = None def optimize_png(png_file): ...
self.state = self.ROOT self.chars = "" self.force = force self.filter = filter def endDocument(self): pass def startElement(self, name, attrs): if self.inside[-1] == self.ROOT: if name == "svg": self.stack.append(self.SVG) ...
self.inside = [self.ROOT] self.path = path self.rects = []
random_line_split
render-gtk3-assets.py
#!/usr/bin/python3 # Thanks to the GNOME theme nerds for the original source of this script import os import sys import xml.sax import subprocess INKSCAPE = '/usr/bin/inkscape' OPTIPNG = '/usr/bin/optipng' MAINDIR = '../EvoPop' SRC = os.path.join('.', 'gtk3') inkscape_process = None def optimize_png(png_file): ...
(icon_file, rect, output_file): global inkscape_process if inkscape_process is None: inkscape_process = start_inkscape() wait_for_prompt(inkscape_process, '%s -i %s -e %s' % (icon_file, rect, output_file)) optimize_png(output_file) class ContentHandler(x...
inkscape_render_rect
identifier_name
render-gtk3-assets.py
#!/usr/bin/python3 # Thanks to the GNOME theme nerds for the original source of this script import os import sys import xml.sax import subprocess INKSCAPE = '/usr/bin/inkscape' OPTIPNG = '/usr/bin/optipng' MAINDIR = '../EvoPop' SRC = os.path.join('.', 'gtk3') inkscape_process = None def optimize_png(png_file): ...
print ("Error: No such file", file) sys.exit(1)
conditional_block
logs.js
var util = require( '../../utils/util.js' ) Page( { data: { projects: [ { name: 'FinalScheduler(终极排班系统)', git: "https://github.com/giscafer/FinalScheduler" }, { name: 'MoveSite(电影狙击手)', git: "https://github.com/giscafer/moviesite" }, { name: 'Ponitor(价格监控)', git: "https://github.com/giscafer/Ponitor" ...
console.log( "##-----------------------------------------------------------------------------------------------------##" ) pros.forEach( function( item, index ) { console.log( "## ", item.name + ":" + item.git ) }) console.log( "## ...
random_line_split
2d.composite.uncovered.nocontext.destination-in.worker.js
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. // OffscreenCanvas test in a worker:2d.composite.uncovered.nocontext.destination-in // Description:drawImage() of a canvas with no context draws pixels as (0,0,0,0), and does not leave the pixels unchanged. // Note: importScripts("/resource...
var t_pass = t.done.bind(t); var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); ctx.fillStyle = 'rgba(0, 255, 255, 0.5)'; ctx.fillRect(0, 0, 100, 50); ctx.globalCompositeOperation = 'des...
random_line_split
auth.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { AngularFireAuth } from 'angularfire2/auth'; import * as firebase from 'firebase/app'; import {Ht...
login(email, pass){ this.afAuth.auth.signInWithEmailAndPassword(email, pass) .then(res => { console.log('Nice, logging you in!!!'); this.router.navigate(['/admin']); }); } checkAuth(){ this.afAuth.authState.subscribe(res => { if (res && res.uid) { console.log('us...
{ console.log("Authentication service started"); console.log(firebase.auth()); }
identifier_body
auth.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { AngularFireAuth } from 'angularfire2/auth'; import * as firebase from 'firebase/app'; import {Ht...
@Injectable() export class AuthService { submission: FirebaseListObservable<any>; constructor(public afAuth: AngularFireAuth, private db: AngularFireDatabase, private router: Router){ console.log("Authentication service started"); console.log(firebase.auth()); } login(email, pass){ this.afAuth.aut...
random_line_split
auth.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { AngularFireAuth } from 'angularfire2/auth'; import * as firebase from 'firebase/app'; import {Ht...
else { console.log('user not logged in...redirecting to welcome..'); this.router.navigate(['/login']); return false; } }); } logout() { this.afAuth.auth.signOut(); this.router.navigate(['/']); } }
{ console.log('user is logged in'); return true; }
conditional_block
auth.service.ts
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; import { Observable } from 'rxjs/Observable'; import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; import { AngularFireAuth } from 'angularfire2/auth'; import * as firebase from 'firebase/app'; import {Ht...
{ submission: FirebaseListObservable<any>; constructor(public afAuth: AngularFireAuth, private db: AngularFireDatabase, private router: Router){ console.log("Authentication service started"); console.log(firebase.auth()); } login(email, pass){ this.afAuth.auth.signInWithEmailAndPassword(email, pa...
AuthService
identifier_name
main.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
if let Err(err) = server::run(args) { println!("{}", err); process::exit(1); } }
{ core::output::set_no_color(true); }
conditional_block
main.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
// // This does, of course, rely on the option name used here staying // in sync with the name used in the Supervisor. // // There is currently no short option to check; just the long // name. if args.contains(&String::from("--no-color")) { core::output::set_no_color(true); } ...
// `--no-color` and set our global variable accordingly.
random_line_split
main.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
process::exit(1); } }
{ env_logger::init(); let args: Vec<String> = env::args().skip(1).collect(); // Since we have access to all the arguments passed to the // Supervisor here, we can simply see if the user requested // `--no-color` and set our global variable accordingly. // // This does, of course, rely on t...
identifier_body
main.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 r...
() { env_logger::init(); let args: Vec<String> = env::args().skip(1).collect(); // Since we have access to all the arguments passed to the // Supervisor here, we can simply see if the user requested // `--no-color` and set our global variable accordingly. // // This does, of course, rely o...
main
identifier_name
template.py
# (c) 2015, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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 version 3 of the License, or # (at your option) any lat...
xfered = self._transfer_data(self._connection._shell.join_path(tmp, 'source'), resultant) # fix file permissions when the copy is done as a different user if self._connection_info.become and self._connection_info.become_user != 'root': self._remote_chmod('a+r', xfere...
# else: # raise Exception("unknown encoding, failed: %s" % dest_result.result)
random_line_split
template.py
# (c) 2015, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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 version 3 of the License, or # (at your option) any lat...
new_module_args = self._task.args.copy() new_module_args.update( dict( src=xfered, dest=dest, original_basename=os.path.basename(source), follow=True, ), ) result =...
dest_contents = '' # FIXME: still need to implement diff mechanism #if self.runner.diff: # # using persist_files to keep the temp directory around to avoid needing to grab another # dest_result = self.runner._execute_module(conn, tmp, 'slurp', "path=%s" % dest, tas...
conditional_block
template.py
# (c) 2015, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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 version 3 of the License, or # (at your option) any lat...
if not os.path.exists(fnd): of = task_vars.get('_original_file', None) if of is not None: fnd = self._loader.path_dwim(self._task._role_._role_path, 'templates', of) if os.path.exists(fnd): source = fnd ...
''' handler for template operations ''' source = self._task.args.get('src', None) dest = self._task.args.get('dest', None) faf = self._task.first_available_file if (source is None and faf is not None) or dest is None: return dict(failed=True, msg="src and dest are requ...
identifier_body
template.py
# (c) 2015, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible 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 version 3 of the License, or # (at your option) any lat...
(ActionBase): TRANSFERS_FILES = True def get_checksum(self, tmp, dest, try_directory=False, source=None): remote_checksum = self._remote_checksum(tmp, dest) if remote_checksum in ('0', '2', '3', '4'): # Note: 1 means the file is not present which is fine; template # wi...
ActionModule
identifier_name
iconsdemo.component.ts
', 'megaphone', 'menu', 'mic-off', 'mic', 'microphone', 'moon', 'more', 'move', 'musical-note', 'musical-notes', 'navigate', 'notifications-off', 'notifications-outline', 'notifications', 'nuclear', 'nutrition', 'open', 'options', 'outlet', 'paper-plane', 'paper', 'partly-sunny', 'pause', 'paw', 'people...
{ if ( array.length === 0 || this.filter === undefined || this.filter.trim() === '' ) { return array; } return array.filter( (v) => v.toLowerCase().indexOf(this.filter.toLowerCase()) >= 0 ); }
identifier_body
iconsdemo.component.ts
'rainy', 'recording', 'redo', 'refresh-circle', 'refresh', 'remove-circle-outline', 'remove-circle', 'remove', 'reorder', 'repeat', 'resize', 'restaurant', 'return-left', 'return-right', 'reverse-camera', 'rewind', 'ribbon', 'rocket', 'rose', 'sad', 'save', 'school', 'search', 'send', 'settings', '...
onMouseLeave
identifier_name
iconsdemo.component.ts
'mail', 'male', 'man', 'map', 'medal', 'medical', 'medkit', 'megaphone', 'menu', 'mic-off', 'mic', 'microphone', 'moon', 'more', 'move', 'musical-note', 'musical-notes', 'navigate', 'notifications-off', 'notifications-outline', 'notifications', 'nuclear', 'nutrition', 'open', 'options', 'outlet', 'pape...
{ return array; }
conditional_block
iconsdemo.component.ts
inputCopy', {static: false}) inputCopy: ElementRef<any>; public filter; public cheatsheet = false; public copy: string; public saved: string; public interval; public outputIcon; public materialIcons = ['add-circle-outline', 'add-circle', 'add', 'airplane', 'alarm', 'albums', 'alert', 'american-...
'locate', 'lock', 'log-in', 'log-out', 'magnet', 'mail-open', 'mail-unread', 'mail', 'male', 'man', 'map', 'medal', 'medical', 'medkit', 'megaphone', 'menu', 'mic-off', 'mic', 'microphone', 'moon', 'more', 'move', 'musical-note', 'musical-notes', 'navigate', 'notifications-off', 'notifications-outli...
'help-circle-outline', 'help-circle', 'help', 'home', 'hourglass', 'ice-cream', 'image', 'images', 'infinite', 'information-circle-outline', 'information-circle', 'information', 'jet', 'journal', 'key', 'keypad', 'laptop', 'leaf', 'link', 'list-box', 'list',
random_line_split
analyze_user_sessions.py
#!/usr/bin/env python3 """ Categorize and analyze user sessions. Read in ecfs_obfuscated_filtered.gz file, output some fancy results. """ from collections import defaultdict from collections import Counter import sys import time import os import resource import json import fnmatch from pipes import Pipes impo...
def analyze_user_session(user_session_file, out_pipeline, target_file_name): with open(user_session_file, 'r') as sf: ops = list() atimes = list() for line in sf: op = Operation() op.init(line.strip()) ops.append(op) atimes.append(op.ts) ...
if abs(x - groups[-1][-1]) <= maxgap: groups[-1].append(x) else: groups.append([x]) return groups
random_line_split
analyze_user_sessions.py
#!/usr/bin/env python3 """ Categorize and analyze user sessions. Read in ecfs_obfuscated_filtered.gz file, output some fancy results. """ from collections import defaultdict from collections import Counter import sys import time import os import resource import json import fnmatch from pipes import Pipes impo...
self.num_ops = 0 self.last_ts = 0 def add_op(self, op): self.num_ops += 1 if op.ts < self.last_ts: raise Exception("Timestamp too old") else: self.last_ts = op.ts if op.optype == 'g': self.get_requests += 1 self.get...
self.user_id = user_id self.from_ts = 0 self.till_ts = 0 self.get_requests = 0 self.reget_requests = 0 self.put_requests = 0 self.get_bytes = 0 self.put_bytes = 0 self.rename_requests = 0 self.del_requests = 0 self.get_dirs = 0 self...
identifier_body
analyze_user_sessions.py
#!/usr/bin/env python3 """ Categorize and analyze user sessions. Read in ecfs_obfuscated_filtered.gz file, output some fancy results. """ from collections import defaultdict from collections import Counter import sys import time import os import resource import json import fnmatch from pipes import Pipes impo...
(self): print("closed session. gets: %r, regets: %r, puts: %r, dels: %r, renames: %r get_dirs: %r, put_dirs: %r, get_bytes: %r put_bytes: %r window_seconds: %d" % \ (self.get_requests, self.reget_requests, self.put_requests, self.del_requests, self.rename_requests, self.get_dirs, self.put_dirs, se...
announce
identifier_name
analyze_user_sessions.py
#!/usr/bin/env python3 """ Categorize and analyze user sessions. Read in ecfs_obfuscated_filtered.gz file, output some fancy results. """ from collections import defaultdict from collections import Counter import sys import time import os import resource import json import fnmatch from pipes import Pipes impo...
elif op.optype == 'r': self.rename_requests += 1 #update last time stamp in the session self.till_ts = op.ts + op.execution_time def finish(self): self.get_dirs = len(self.dir_cnt_gets) if self.get_dirs > 0: self.get_files_per_dir = float(self.get_r...
self.del_requests += 1
conditional_block
user.js
module.exports = { _id: '5731eb718dc033bc69d9660f', email: 'register_user@test.com', name: 'New Test User', password: '09a3fcee233197960eb1bafe82e20021ad2807e8b12c79e9822ba0d5addfdcb7f786a365b2e8de0419f24cf671f2bd8bac9e6aacd5ff5bece1e5e7346fc19c1741e0286659e39577aaa4a6fd4fe0eab30b95d4437f3821838e27f311bda42a70a...
};
random_line_split
SerenityBDDArguments.ts
import { AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core'; import { Argv } from '../../Argv'; /** * @package */ export class SerenityBDDArguments extends Question<string[]> { private static Allowed = [ 'destination', 'features', 'issueTrackerUrl', 'jiraProjec...
(private readonly argv: Argv) { super('Serenity BDD arguments'); } answeredBy(actor: AnswersQuestions & UsesAbilities): string[] { return flatten(Object.keys(this.argv) .filter(key => !! ~ SerenityBDDArguments.Allowed.indexOf(key) && !! this.argv[key]) .map(arg => [`--${...
constructor
identifier_name
SerenityBDDArguments.ts
import { AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core'; import { Argv } from '../../Argv'; /** * @package */ export class SerenityBDDArguments extends Question<string[]> { private static Allowed = [ 'destination', 'features', 'issueTrackerUrl', 'jiraProjec...
{ return list.reduce((acc, current) => { Array.isArray(current) ? acc.push(...flatten(current)) : acc.push(current); return acc; }, []); }
identifier_body
SerenityBDDArguments.ts
import { AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core'; import { Argv } from '../../Argv'; /** * @package */ export class SerenityBDDArguments extends Question<string[]> { private static Allowed = [ 'destination', 'features', 'issueTrackerUrl', 'jiraProjec...
} constructor(private readonly argv: Argv) { super('Serenity BDD arguments'); } answeredBy(actor: AnswersQuestions & UsesAbilities): string[] { return flatten(Object.keys(this.argv) .filter(key => !! ~ SerenityBDDArguments.Allowed.indexOf(key) && !! this.argv[key]) ...
static from(argv: Argv): SerenityBDDArguments { return new SerenityBDDArguments(argv);
random_line_split
hr_academic.py
# -*- encoding: utf-8 -*- ############################################################################## # # Odoo, Open Source Management Solution # This module copyright (C) 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or modi...
_name = 'hr.academic' _inherit = 'hr.curriculum' diploma = fields.Char(string='Diploma', translate=True) study_field = fields.Char(string='Field of study', translate=True,) activities = fields.Text(string='Activities and associations', translate=True)
identifier_body
hr_academic.py
# -*- encoding: utf-8 -*- ############################################################################## # # Odoo, Open Source Management Solution # This module copyright (C) 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or modi...
translate=True)
diploma = fields.Char(string='Diploma', translate=True) study_field = fields.Char(string='Field of study', translate=True,) activities = fields.Text(string='Activities and associations',
random_line_split
hr_academic.py
# -*- encoding: utf-8 -*- ############################################################################## # # Odoo, Open Source Management Solution # This module copyright (C) 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or modi...
(models.Model): _name = 'hr.academic' _inherit = 'hr.curriculum' diploma = fields.Char(string='Diploma', translate=True) study_field = fields.Char(string='Field of study', translate=True,) activities = fields.Text(string='Activities and associations', translate=True)
hr_academic
identifier_name
build-expo.js
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { t...
} catch (error) { console.log(error); process.exit(1); } }); } if (require.main === module) { main(process.argv.slice(2)); } //# sourceMappingURL=build-expo.js.map
yield xdl_1.Webpack.bundleAsync(projectRoot, { nonInteractive: true, mode: 'production', }); process.exit(0);
random_line_split
build-expo.js
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { t...
(args) { return __awaiter(this, void 0, void 0, function* () { const projectRoot = path_1.default.resolve(args[0]); console.log('Building', projectRoot); try { yield xdl_1.Webpack.bundleAsync(projectRoot, { nonInteractive: true, mode: 'production',...
main
identifier_name
build-expo.js
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { t...
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? ...
{ try { step(generator["throw"](value)); } catch (e) { reject(e); } }
identifier_body
build-expo.js
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { t...
//# sourceMappingURL=build-expo.js.map
{ main(process.argv.slice(2)); }
conditional_block
middleware.rs
//! Traits to implement middleware types. //! //! This module defined the middleware traits for the closures that would be used as handlers and //! middlewares in the application. This provides nice compile time guarantees of the what each //! specific middleware can do and return. If anything else is returned then it ...
<'m, 'r>(&'m self, req: &Request<'m, 'r>) { (*self)(req); } } /// The actual logic for handling the request and writing the response is a part of this /// middleware. /// /// Here you have access to both the request and response objects and you need to write the /// response for a particular request in the...
execute
identifier_name