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
range_expansion.rs
// http://rosettacode.org/wiki/Range_expansion extern crate regex; #[cfg(not(test))] fn main() { let range = "-6,-3-1,3-5,7-11,14,15,17-20"; println!("Expanded range: {:?}", expand_range(range)); } // Expand a string containing numbers and ranges, into a vector of numbers fn expand_range(range: &str) -> Vec<i...
assert!(expand_range(range) == vec![1, 2, 3, 4, 5, 6]); }
let range = "one-five,six";
random_line_split
range_expansion.rs
// http://rosettacode.org/wiki/Range_expansion extern crate regex; #[cfg(not(test))] fn main() { let range = "-6,-3-1,3-5,7-11,14,15,17-20"; println!("Expanded range: {:?}", expand_range(range)); } // Expand a string containing numbers and ranges, into a vector of numbers fn expand_range(range: &str) -> Vec<i...
(item: &str) -> Vec<isize> { use regex::Regex; // Handle the case of a single number for cap in Regex::new(r"^(-?\d+)$").unwrap().captures_iter(item) { return vec![cap.at(0).and_then(|s| s.parse().ok()).unwrap()] } // Handle the case of a range for cap in Regex::new(r"^(-?\d+)-(-?\d+)$"...
expand_item
identifier_name
range_expansion.rs
// http://rosettacode.org/wiki/Range_expansion extern crate regex; #[cfg(not(test))] fn main() { let range = "-6,-3-1,3-5,7-11,14,15,17-20"; println!("Expanded range: {:?}", expand_range(range)); } // Expand a string containing numbers and ranges, into a vector of numbers fn expand_range(range: &str) -> Vec<i...
// Expand a single element, which can be a number or a range. fn expand_item(item: &str) -> Vec<isize> { use regex::Regex; // Handle the case of a single number for cap in Regex::new(r"^(-?\d+)$").unwrap().captures_iter(item) { return vec![cap.at(0).and_then(|s| s.parse().ok()).unwrap()] } ...
{ let mut result = vec![]; for item in range.split(',') { result.extend(expand_item(item).into_iter()); } result }
identifier_body
index.js
/** * @fileOverview router * @name index.js<f/socket/router> * @author Masaki Sueda <sueda_masaki@cyberagent.co.jp> */ var fs = require('fs'); var url = require('url'); var path = require('path'); var _ = require('underscore'); var beezlib = require('beezlib'); var bootstrap = require('../../bootstrap'); var con...
if (!config.app.socket.use) { beezlib.logger.debug("<< Socket Server is not running. application/javascript error"); return callback(req); } if (!store.socket) { beezlib.logger.debug("<< Socket Data is not set. application/javascript error"); return callback(req); } ...
{ beezlib.logger.debug("<< request should be string.") return callback(req); }
conditional_block
index.js
/** * @fileOverview router * @name index.js<f/socket/router> * @author Masaki Sueda <sueda_masaki@cyberagent.co.jp> */ var fs = require('fs'); var url = require('url'); var path = require('path'); var _ = require('underscore'); var beezlib = require('beezlib'); var bootstrap = require('../../bootstrap'); var con...
var match = req.match(regexp); if (!match) { beezlib.logger.debug('data format is illegal'); return callback && callback('data format is illegal'); } var service = match[1]; var method = match[2]; var body = match[3]; try { body = JSON.parse(body); var dat...
format = format || '%s.%s:%s'; var regexp = format && formatRegexp(format);
random_line_split
swf.js
YUI.add('swf', function (Y, NAME) { /** * Embed a Flash applications in a standard manner and communicate with it * via External Interface. * @module swf */ var Event = Y.Event, SWFDetect = Y.SWFDetect, Lang = Y.Lang, uA = Y.UA, Node = Y.Node, Escape = Y.Escape, ...
(p_oElement /*:String*/, swfURL /*:String*/, p_oAttributes /*:Object*/ ) { this._id = Y.guid("yuiswf"); var _id = this._id; var oElement = Node.one(p_oElement); var p_oAttributes = p_oAttributes || {}; var flashVersion = p_oAttributes.version || FLASH_VER; var flashVersionSplit = (fla...
SWF
identifier_name
swf.js
YUI.add('swf', function (Y, NAME) { /** * Embed a Flash applications in a standard manner and communicate with it * via External Interface. * @module swf */ var Event = Y.Event, SWFDetect = Y.SWFDetect, Lang = Y.Lang, uA = Y.UA, Node = Y.Node, Escape = Y.Escape, ...
* @private * Propagates a specific event from Flash to JS. * @method _eventHandler * @param event {Object} The event to be propagated from Flash. */ _eventHandler: function(event) { if (event.type === "swfReady") { this.publish("swfReady", {fireOnce:true}); t...
SWF.prototype = { /**
random_line_split
swf.js
YUI.add('swf', function (Y, NAME) { /** * Embed a Flash applications in a standard manner and communicate with it * via External Interface. * @module swf */ var Event = Y.Event, SWFDetect = Y.SWFDetect, Lang = Y.Lang, uA = Y.UA, Node = Y.Node, Escape = Y.Escape, ...
objstring += "</object>"; //using innerHTML as setHTML/setContent causes some issues with ExternalInterface for IE versions of the player oElement.set("innerHTML", objstring); this._swf = Node.one("#" + _id); } else { /** * Fired when the Flash player vers...
{ objstring += '<param name="flashVars" value="' + flashvarstring + '"/>'; }
conditional_block
swf.js
YUI.add('swf', function (Y, NAME) { /** * Embed a Flash applications in a standard manner and communicate with it * via External Interface. * @module swf */ var Event = Y.Event, SWFDetect = Y.SWFDetect, Lang = Y.Lang, uA = Y.UA, Node = Y.Node, Escape = Y.Escape, ...
Y.SWF._instances[_id] = this; if (oElement && (isFlashVersionRight || shouldExpressInstall) && flashURL) { objstring += 'id="' + _id + '" '; if (uA.ie) { objstring += 'classid="' + FLASH_CID + '" '; } else { objstring += 'type="' + FLASH_TYPE + '" data="' + Escap...
{ this._id = Y.guid("yuiswf"); var _id = this._id; var oElement = Node.one(p_oElement); var p_oAttributes = p_oAttributes || {}; var flashVersion = p_oAttributes.version || FLASH_VER; var flashVersionSplit = (flashVersion + '').split("."); var isFlashVersionRight = SWFDetect.isFlas...
identifier_body
vapid-details-model.d.ts
import { DBInterface } from './db-interface'; export declare class
extends DBInterface { protected readonly dbName: string; protected readonly dbVersion: number; protected readonly objectStoreName: string; protected onDbUpgrade(request: IDBOpenDBRequest): void; /** * Given a service worker scope, this method will look up the vapid key * in indexedDB. ...
VapidDetailsModel
identifier_name
vapid-details-model.d.ts
import { DBInterface } from './db-interface'; export declare class VapidDetailsModel extends DBInterface { protected readonly dbName: string; protected readonly dbVersion: number; protected readonly objectStoreName: string; protected onDbUpgrade(request: IDBOpenDBRequest): void; /** * Given a s...
* Resolves once the scope/vapid details have been deleted and returns the * deleted vapid key. */ deleteVapidDetails(swScope: string): Promise<Uint8Array>; }
* This method deletes details of the current FCM VAPID key for a SW scope.
random_line_split
ioreg.rs
annotated with docstrings with the typical Rust doc comment syntax. Both outer (`/// comment`) and inner (`//! comment`) comments are accepted. Inner comments apply to the item to which the current block belongs whereas outer comments apply to the item that follows. In addition, trailing comments are supported with th...
sult+'static> { Box
conditional_block
ioreg.rs
follows. In addition, trailing comments are supported with the `//=` syntax. These apply to the preceding item, allowing definitions and associated comments to inhabit the same line. Multiple successive comments of the same type will be concatenated together into a single doc comment. For instance, we might document ...
>> { Some(SmallVector::many(self.items.cl
identifier_body
ioreg.rs
, some optional modifiers (e.g. `ro` in the case of `rxne`), and an optional list of values. This register definition will produce a variety of types, along with associated accessor methods for convenient, safe manipulation of the described registers. In the process of generating these, `ioregs!` will perform a variet...
enTree])
identifier_name
ioreg.rs
comment syntax. Both outer (`/// comment`) and inner (`//! comment`) comments are accepted. Inner comments apply to the item to which the current block belongs whereas outer comments apply to the item that follows. In addition, trailing comments are supported with the `//=` syntax. These apply to the preceding item, a...
pub fn new(items: Vec<P<ast::Item>>) -> Box<MacResult+'static> { Box::new(MacItems { items: items }) }
random_line_split
RenewTheFaith.js
import React from 'react'; import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox'; import SpellIcon from 'common/SpellIcon'; import { formatPercentage, formatNumber } from 'common/format';
// dependencies import Combatants from 'Parser/Core/Modules/Combatants'; import DivineHymn from '../Spells/DivineHymn'; class RenewTheFaith extends Module { static dependencies = { combatants: Combatants, divineHymn: DivineHymn, } _validPoMBefore = 0; poms = 0; healing = 0; overhealing = 0; on...
import SPELLS from 'common/SPELLS'; import Module from 'Parser/Core/Module';
random_line_split
RenewTheFaith.js
import React from 'react'; import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox'; import SpellIcon from 'common/SpellIcon'; import { formatPercentage, formatNumber } from 'common/format'; import SPELLS from 'common/SPELLS'; import Module from 'Parser/Core/Module'; // dependencies import Combatants from '...
statistic() { const rtfPercHPS = formatPercentage(this.owner.getPercentageOfTotalHealingDone(this.healing)); const rtfPercOH = formatPercentage(this.overhealing / (this.healing + this.overhealing)); const rtfRelPercHPS = formatPercentage(this.healing / this.divineHymn.healing); // return this.a...
{ const spellId = event.ability.guid; if (spellId !== SPELLS.PRAYER_OF_MENDING_HEAL.id && spellId !== SPELLS.HOLY_MENDING_TRAIT.id) { return; } if (event.timestamp < this._validPoMBefore) { if (spellId === SPELLS.PRAYER_OF_MENDING_HEAL.id) { this.poms += 1; } this.healing += event.amount; ...
identifier_body
RenewTheFaith.js
import React from 'react'; import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox'; import SpellIcon from 'common/SpellIcon'; import { formatPercentage, formatNumber } from 'common/format'; import SPELLS from 'common/SPELLS'; import Module from 'Parser/Core/Module'; // dependencies import Combatants from '...
() { const rtfPercHPS = formatPercentage(this.owner.getPercentageOfTotalHealingDone(this.healing)); const rtfPercOH = formatPercentage(this.overhealing / (this.healing + this.overhealing)); const rtfRelPercHPS = formatPercentage(this.healing / this.divineHymn.healing); // return this.active && ( ...
statistic
identifier_name
RenewTheFaith.js
import React from 'react'; import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox'; import SpellIcon from 'common/SpellIcon'; import { formatPercentage, formatNumber } from 'common/format'; import SPELLS from 'common/SPELLS'; import Module from 'Parser/Core/Module'; // dependencies import Combatants from '...
this.healing += event.amount; this.overhealing += event.overheal || 0; } } statistic() { const rtfPercHPS = formatPercentage(this.owner.getPercentageOfTotalHealingDone(this.healing)); const rtfPercOH = formatPercentage(this.overhealing / (this.healing + this.overhealing)); const rtfRel...
{ this.poms += 1; }
conditional_block
encoder.py
#!/usr/bin/python # # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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...
if FLAGS.iteration < 0 or FLAGS.iteration > 15: print('\n--iteration must be between 0 and 15 inclusive.\n') return with tf.gfile.FastGFile(FLAGS.input_image) as input_image: input_image_str = input_image.read() with tf.Graph().as_default() as graph: # Load the inference model for encoding. ...
print('\nUsage: python encoder.py --input_image=/your/image/here.png ' '--output_codes=output_codes.pkl --iteration=15 ' '--model=residual_gru.pb\n\n') return
conditional_block
encoder.py
#!/usr/bin/python # # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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...
def main(_): if (FLAGS.input_image is None or FLAGS.output_codes is None or FLAGS.model is None): print('\nUsage: python encoder.py --input_image=/your/image/here.png ' '--output_codes=output_codes.pkl --iteration=15 ' '--model=residual_gru.pb\n\n') return if FLAGS.iteration < ...
name_list = ['GruBinarizer/SignBinarizer/Sign:0'] for i in range(1, 16): name_list.append('GruBinarizer/SignBinarizer/Sign_{}:0'.format(i)) return name_list
identifier_body
encoder.py
#!/usr/bin/python # # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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...
int_codes = (int_codes + 1)//2 export = np.packbits(int_codes.reshape(-1)) output = io.BytesIO() np.savez_compressed(output, shape=int_codes.shape, codes=export) with tf.gfile.FastGFile(FLAGS.output_codes, 'w') as code_file: code_file.write(output.getvalue()) if __name__ == '__main__': tf.app.run()
results = results[0:FLAGS.iteration + 1] int_codes = np.asarray([x.astype(np.int8) for x in results]) # Convert int codes to binary.
random_line_split
encoder.py
#!/usr/bin/python # # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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...
(): name_list = ['GruBinarizer/SignBinarizer/Sign:0'] for i in range(1, 16): name_list.append('GruBinarizer/SignBinarizer/Sign_{}:0'.format(i)) return name_list def main(_): if (FLAGS.input_image is None or FLAGS.output_codes is None or FLAGS.model is None): print('\nUsage: python encoder.py --i...
get_output_tensor_names
identifier_name
urls.py
"""schmankerl URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, incl...
1. Add an import: from my_app import views
random_line_split
Tab1.tsx
import * as React from 'react'; import {ContentBlock} from 'framework7-react'; export const Tab1 = () => { return ( <ContentBlock> <p>Tab 1</p> <p><a href="/nested-routes/tabs/tab-2/">Go to tab 2</a></p> <p><a href="/nested-routes/tabs/tab-3/">Go to tab 3</a></p> ...
<p>Autem ullam tempore suscipit consectetur, odit soluta. Neque quasi mollitia culpa autem, quis ab nostrum non distinctio illo magni perspiciatis et consequuntur possimus aliquam reprehenderit reiciendis praesentium consectetur, voluptas obcaecati?</p> <p>Quae repellendus aut iste provident con...
<p>Quibusdam repellendus, repudiandae nulla commodi ut nemo eum, quia dolorum dicta voluptate reprehenderit. Omnis, temporibus iure quia ad sit incidunt similique et quaerat dicta delectus aspernatur, unde illo cum ipsam?</p> <p>Officia alias inventore soluta illo, omnis tempore obcaecati at, ha...
random_line_split
S15.10.2.3_A1_T6.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * The | regular expression operator separates two alternatives. * The pattern first tries to match the left Alternative (followed by the sequel of the regular expression). * If it ...
//CHECK#2 if (__executed.index !== __expected.index) { $ERROR('#2: __executed = /ab|cd|ef/i.exec("AEKFCD"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index); } //CHECK#3 if (__executed.input !== __expected.input) { $ERROR('#3: __executed = /ab|cd|ef/i.exec("AEKFCD"); __executed.input ==...
{ $ERROR('#1: __executed = /ab|cd|ef/i.exec("AEKFCD"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length); }
conditional_block
S15.10.2.3_A1_T6.js
// Copyright 2009 the Sputnik authors. All rights reserved.
/** * The | regular expression operator separates two alternatives. * The pattern first tries to match the left Alternative (followed by the sequel of the regular expression). * If it fails, it tries to match the right Disjunction (followed by the sequel of the regular expression) * * @path ch15/15.10/15.10.2/15....
// This code is governed by the BSD license found in the LICENSE file.
random_line_split
math.rs
inline(always)] pub fn separation<T>(ray: Ray<T>, v: Vec2d<T>) -> Vec2d<T> where T: Float, { // Get the directional vector. let (dir_x, dir_y) = (ray[2], ray[3]); // Get displacement vector from point. let (dx, dy) = (ray[0] - v[0], ray[1] - v[1]); // Compute the component of position in ray dir...
{
random_line_split
math.rs
let len = len.sqrt(); let c = x / len; let s = y / len; [[c, -s, _0], [s, c, _0]] } /// Create a scale matrix. #[inline(always)] pub fn scale<T>(sx: T, sy: T) -> Matrix2d<T> where T: Float, { use vecmath::traits::Zero; let _0: T = Zero::zero(); [[sx, _0, _0], [_0, sy, _0]] } /// Cre...
{ return identity(); }
conditional_block
math.rs
inline(always)] fn max<T: Float>(a: T, b: T) -> T { if a > b { a } else { b } } if a[0] < b[0] + b[2] && a[1] < b[1] + b[3] && b[0] < a[0] + a[2] && b[1] < a[1] + a[3] { let x = max(a[0], b[0]); let y = max(a[1], b[1]); let w = min(a[0...
{ use vecmath::traits::Zero; let _0 = Zero::zero(); let ax = triangle[0][0]; let ay = triangle[0][1]; let bx = triangle[1][0]; let by = triangle[1][1]; let cx = triangle[2][0]; let cy = triangle[2][1]; let ab_side = line_side([ax, ay, bx, by], [cx, cy]); ab_side <= _0 }
identifier_body
math.rs
* sep2[1]; let dot3 = sep3[0] * sep3[0] + sep3[1] * sep3[1]; let dot4 = sep4[0] * sep4[0] + sep4[1] * sep4[1]; // Search for the smallest dot product. if dot1 < dot2 { if dot3 < dot4 { if dot1 < dot3 { sep1 } else { sep3 } ...
centroid
identifier_name
qa_rail_ff.py
#!/usr/bin/env python # # Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # ...
gr_unittest.run(test_rail, "test_rail.xml")
conditional_block
qa_rail_ff.py
#!/usr/bin/env python # # Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # ...
class test_rail(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() def tearDown(self): self.tb = None def test_rail_001(self): # Test set/gets hi1 = 1 hi2 = 2 lo1 = -1 lo2 = -2 op = analog.rail_ff(lo1, hi1) ...
if(x < lo): return lo elif(x > hi): return hi else: return x
identifier_body
qa_rail_ff.py
#!/usr/bin/env python # # Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # ...
(self): self.tb = None def test_rail_001(self): # Test set/gets hi1 = 1 hi2 = 2 lo1 = -1 lo2 = -2 op = analog.rail_ff(lo1, hi1) op.set_hi(hi2) h = op.hi() self.assertEqual(hi2, h) op.set_lo(lo2) l = op.lo() ...
tearDown
identifier_name
qa_rail_ff.py
#!/usr/bin/env python # # Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # ...
# the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from gnuradio import gr, gr_unittest import analog_swig as analog def clip(x, lo, hi): if(x < lo): return lo elif(x > hi): return hi else: return x class test_rail(gr_unittest.TestCase): ...
# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to
random_line_split
scoping_rules_lifetimes_structs.rs
// A type `Borrowed` which houses a reference to an // `i32`. The reference to `i32` must outlive `Borrowed`. #[derive(Debug)] struct Borrowed<'a>(&'a i32); // Similarly, both references here must outlive this structure. #[derive(Debug)] struct NamedBorrowed<'a> { x: &'a i32, y: &'a i32, } // An enum which is...
println!("x is borrowed in {:?}", single); println!("x and y are borrowed in {:?}", double); println!("x is borrowed in {:?}", reference); println!("y is *not* borrowed in {:?}", number); }
let reference = Either::Ref(&x); let number = Either::Num(y);
random_line_split
scoping_rules_lifetimes_structs.rs
// A type `Borrowed` which houses a reference to an // `i32`. The reference to `i32` must outlive `Borrowed`. #[derive(Debug)] struct Borrowed<'a>(&'a i32); // Similarly, both references here must outlive this structure. #[derive(Debug)] struct NamedBorrowed<'a> { x: &'a i32, y: &'a i32, } // An enum which is...
<'a> { Num(i32), Ref(&'a i32), } pub fn main() { let x = 18; let y = 15; let single = Borrowed(&x); let double = NamedBorrowed { x: &x, y: &y }; let reference = Either::Ref(&x); let number = Either::Num(y); println!("x is borrowed in {:?}", single); println!("x and y are bo...
Either
identifier_name
report.rs
use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ReportContent { pub domains: Option<Vec<String>>, pub definitions: Option<Vec<String>>, } #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct
{ pub report: super::MetadataObjectBody<ReportContent>, } impl Report { pub fn object(&self) -> &super::MetadataObjectBody<ReportContent> { &self.report } } impl super::MetadataObjectGetter<ReportContent> for Report { fn object(&self) -> &super::MetadataObjectBody<ReportContent> { &se...
Report
identifier_name
report.rs
use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ReportContent { pub domains: Option<Vec<String>>, pub definitions: Option<Vec<String>>, } #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct Report { pub report: super::MetadataObjectBody<ReportCo...
i += 1; } (0, None) } }
{ return (i, Some(item.clone())); }
conditional_block
report.rs
use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ReportContent { pub domains: Option<Vec<String>>, pub definitions: Option<Vec<String>>, } #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct Report { pub report: super::MetadataObjectBody<ReportCo...
impl super::MetadataQuery<super::MetadataQueryBody<Report>> { pub fn find_by_identifier(&self, identifier: &String) -> (u32, Option<Report>) { let mut i: u32 = 0; for item in self.objects().items().into_iter() { if item.object().meta().identifier().as_ref().unwrap() == identifier { ...
random_line_split
report.rs
use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct ReportContent { pub domains: Option<Vec<String>>, pub definitions: Option<Vec<String>>, } #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] pub struct Report { pub report: super::MetadataObjectBody<ReportCo...
} impl super::MetadataObjectGetter<ReportContent> for Report { fn object(&self) -> &super::MetadataObjectBody<ReportContent> { &self.object() } } impl Into<String> for Report { fn into(self) -> String { format!("{}\n", json::as_pretty_json(&self).to_string()) } } pub const NAME: &'st...
{ &self.report }
identifier_body
version.rs
/* automatically generated by rust-bindgen */ pub const R_VERSION: u32 = 197635;
pub const R_MINOR: &'static [u8; 4usize] = b"4.3\0"; pub const R_STATUS: &'static [u8; 1usize] = b"\0"; pub const R_YEAR: &'static [u8; 5usize] = b"2017\0"; pub const R_MONTH: &'static [u8; 3usize] = b"11\0"; pub const R_DAY: &'static [u8; 3usize] = b"30\0"; pub const R_SVN_REVISION: u32 = 73796;
pub const R_NICK: &'static [u8; 17usize] = b"Kite-Eating Tree\0"; pub const R_MAJOR: &'static [u8; 2usize] = b"3\0";
random_line_split
context.rs
use ::handle::{Handle,HandleMut}; /// A `libgphoto2` library context. pub struct Context { context: *mut ::gphoto2::GPContext, } impl Context { /// Creates a new context. pub fn new() -> ::Result<Context> { let ptr = unsafe { ::gphoto2::gp_context_new() }; if !ptr.is_null() { ...
} } impl Drop for Context { fn drop(&mut self) { unsafe { ::gphoto2::gp_context_unref(self.context); } } } #[doc(hidden)] impl Handle<::gphoto2::GPContext> for Context { unsafe fn as_ptr(&self) -> *const ::gphoto2::GPContext { self.context } } #[doc(hidden)] i...
{ Err(::error::from_libgphoto2(::gphoto2::GP_ERROR_NO_MEMORY)) }
conditional_block
context.rs
use ::handle::{Handle,HandleMut}; /// A `libgphoto2` library context. pub struct Context { context: *mut ::gphoto2::GPContext, } impl Context { /// Creates a new context. pub fn new() -> ::Result<Context> { let ptr = unsafe { ::gphoto2::gp_context_new() }; if !ptr.is_null() { ...
} #[doc(hidden)] impl Handle<::gphoto2::GPContext> for Context { unsafe fn as_ptr(&self) -> *const ::gphoto2::GPContext { self.context } } #[doc(hidden)] impl HandleMut<::gphoto2::GPContext> for Context { unsafe fn as_mut_ptr(&mut self) -> *mut ::gphoto2::GPContext { self.context } }
{ unsafe { ::gphoto2::gp_context_unref(self.context); } }
identifier_body
context.rs
use ::handle::{Handle,HandleMut}; /// A `libgphoto2` library context. pub struct Context { context: *mut ::gphoto2::GPContext, } impl Context { /// Creates a new context. pub fn new() -> ::Result<Context> { let ptr = unsafe { ::gphoto2::gp_context_new() }; if !ptr.is_null() { ...
(&self) -> *const ::gphoto2::GPContext { self.context } } #[doc(hidden)] impl HandleMut<::gphoto2::GPContext> for Context { unsafe fn as_mut_ptr(&mut self) -> *mut ::gphoto2::GPContext { self.context } }
as_ptr
identifier_name
context.rs
use ::handle::{Handle,HandleMut}; /// A `libgphoto2` library context. pub struct Context { context: *mut ::gphoto2::GPContext, } impl Context { /// Creates a new context. pub fn new() -> ::Result<Context> { let ptr = unsafe { ::gphoto2::gp_context_new() }; if !ptr.is_null() { ...
unsafe { ::gphoto2::gp_context_unref(self.context); } } } #[doc(hidden)] impl Handle<::gphoto2::GPContext> for Context { unsafe fn as_ptr(&self) -> *const ::gphoto2::GPContext { self.context } } #[doc(hidden)] impl HandleMut<::gphoto2::GPContext> for Context { unsaf...
fn drop(&mut self) {
random_line_split
fallback.ts
import { request } from '../../utils/http'; import { killAllProcesses } from '../../utils/process'; import { ngServe } from '../../utils/project'; import { updateJsonFile } from '../../utils/project'; import { moveFile } from '../../utils/fs'; export default function () { // should fallback to config.app[0].index (...
throw new Error('Response does not match expected value.'); } }) .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); }
random_line_split
fallback.ts
import { request } from '../../utils/http'; import { killAllProcesses } from '../../utils/process'; import { ngServe } from '../../utils/project'; import { updateJsonFile } from '../../utils/project'; import { moveFile } from '../../utils/fs'; export default function () { // should fallback to config.app[0].index (...
}) .then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }) // should correctly fallback to a changed index .then(() => moveFile('src/index.html', 'src/not-index.html')) .then(() => updateJsonFile('angular-cli.json', configJson => { const app = configJson['apps'][0]; ...
{ throw new Error('Response does not match expected value.'); }
conditional_block
Action-test.js
'use strict'; import Application from '../../core/Application.js'; import Action from '../../core/Action.js'; describe('Action', () => { var app; var action; class
extends Action { get name() { return 'ChildAction'; } } beforeEach(() => { app = new Application(); action = new ChildAction(app); }); it('has to be defined, be a function and can be instantiated', () => { expect(ChildAction).toBeDefined(); ...
ChildAction
identifier_name
Action-test.js
'use strict'; import Application from '../../core/Application.js'; import Action from '../../core/Action.js'; describe('Action', () => { var app; var action; class ChildAction extends Action { get name() { return 'ChildAction'; } } beforeEach(() => { app = new...
it('holds an app instance', () => { var myApp = action.app; expect(myApp).toEqual(jasmine.any(Application)); expect(myApp).toBe(app); }); it('has an execute function that throws an error if it is not implemented', () => { expect(action.execute).toEqual(jasmine.any(Function)...
});
random_line_split
test_sequence_unpad_op.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
(self): self.length = [5, 2, 3, 4] self.x_shape = (4, 5, 3, 3, 6) self.dtype = "float64" if __name__ == '__main__': unittest.main()
init
identifier_name
test_sequence_unpad_op.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
def test_check_output(self): self.check_output() def test_check_grad(self): self.check_grad(["X"], "Out") class TestSequenceUnpadOp2(TestSequenceUnpadOp): def init(self): self.length = [2, 3, 4] self.x_shape = (3, 5, 4, 3) self.dtype = "float32" class TestSeque...
self.op_type = 'sequence_unpad' self.init() self.compute()
identifier_body
test_sequence_unpad_op.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
'Length': np.array(self.length).astype('int64').reshape(-1, 1) } self.outputs = {'Out': (out.reshape(out_shape), out_lod)} def setUp(self): self.op_type = 'sequence_unpad' self.init() self.compute() def test_check_output(self): self.check_output() ...
out_shape = out_shape + self.x_shape[2:] self.inputs = { 'X': x,
random_line_split
test_sequence_unpad_op.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
else: out_shape = out_shape + self.x_shape[2:] self.inputs = { 'X': x, 'Length': np.array(self.length).astype('int64').reshape(-1, 1) } self.outputs = {'Out': (out.reshape(out_shape), out_lod)} def setUp(self): self.op_type = 'sequence_u...
out_shape = out_shape + (1, )
conditional_block
resource.rs
", target_os = "ios", target_os = "android", target_os = "dragonfly", all(target_os = "linux", not(target_env = "gnu")) ))]{ use libc::{c_int, rlimit, RLIM_INFINITY}; } } libc_enum! { /// Types of process resources. /// /// The Resource enum is platform depen...
#[cfg_attr(docsrs, doc(cfg(all())))] /// The maximum size (in bytes) of the swap space that may be reserved /// or used by all of this user id's processes. RLIMIT_SWAP, #[cfg(target_os = "freebsd")] #[cfg_attr(docsrs, doc(cfg(all())))] /// An alias for RLIMIT_AS....
/// The maximum size (in bytes) of socket buffer usage for this user. RLIMIT_SBSIZE, #[cfg(target_os = "freebsd")]
random_line_split
resource.rs
/man-pages/man2/getrlimit.2.html) /// * [FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=setrlimit) /// * [NetBSD](https://man.netbsd.org/setrlimit.2) // linux-gnu uses u_int as resource enum, which is implemented in libc as // well. // // https://gcc.gnu.org/legacy-ml/gcc/2015-08/msg00441.h...
limit(
identifier_name
resource.rs
", target_os = "ios", target_os = "android", target_os = "dragonfly", all(target_os = "linux", not(target_env = "gnu")) ))]{ use libc::{c_int, rlimit, RLIM_INFINITY}; } } libc_enum! { /// Types of process resources. /// /// The Resource enum is platform depen...
/ Set the current processes resource limits /// /// # Parameters /// /// * `resource`: The [`Resource`] that we want to set the limits of. /// * `soft_limit`: The value that the kernel enforces for the corresponding /// resource. Note: `None` input will be replaced by constant `RLIM_INFINITY`. /// * `hard_limit`: The...
let mut old_rlim = mem::MaybeUninit::<rlimit>::uninit(); cfg_if! { if #[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "uclibc")))]{ let res = unsafe { libc::getrlimit(resource as __rlimit_resource_t, old_rlim.as_mut_ptr()) }; } else { let res = unsafe {...
identifier_body
combination.py
# # Copyright 2013 eNovance <licensing@enovance.com> # # Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com> # # 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/l...
self._transition(alarm, states)
conditional_block
combination.py
# # Copyright 2013 eNovance <licensing@enovance.com> # # Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com> # # 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/l...
# if operator is 'or' and there is one alarm, then the combinated # alarm's state should be 'alarm' sufficient = bool([alarm_id for alarm_id, state in states if state == evaluator.ALARM]) if not sufficient and alarm.state != evaluator.UNKNOWN: ...
def _get_alarm_state(self, alarm_id): try: alarm = self._client.alarms.get(alarm_id) except Exception: LOG.exception(_('alarm retrieval failed')) return None return alarm.state def _sufficient_states(self, alarm, states): """Check for the sufficie...
identifier_body
combination.py
# # Copyright 2013 eNovance <licensing@enovance.com> # # Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com> # # 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/l...
for __, s in underlying_states): state = evaluator.ALARM else: state = evaluator.OK continuous = alarm.repeat_actions reason, reason_data = self._reason(alarm, state, underlying_states) if alarm.state != state or continuous: ...
if COMPARATORS[op](s == evaluator.ALARM
random_line_split
combination.py
# # Copyright 2013 eNovance <licensing@enovance.com> # # Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com> # # 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/l...
(self, alarm_id): try: alarm = self._client.alarms.get(alarm_id) except Exception: LOG.exception(_('alarm retrieval failed')) return None return alarm.state def _sufficient_states(self, alarm, states): """Check for the sufficiency of the data for ...
_get_alarm_state
identifier_name
PageHeader.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
componentWillUnmount() { this.mounted = false; } handleApplyTemplate = () => { this.setState({ applyTemplateModal: true }); }; handleApplyTemplateClose = () => { if (this.mounted) { this.setState({ applyTemplateModal: false }); } }; render() { const { component } = this.prop...
{ this.mounted = true; }
identifier_body
PageHeader.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
}; render() { const { component } = this.props; const { configuration } = component; const canApplyPermissionTemplate = configuration != null && configuration.canApplyPermissionTemplate; let description = translate('roles.page.description2'); if (isPortfolioLike(component.qualifier)) { ...
{ this.setState({ applyTemplateModal: false }); }
conditional_block
PageHeader.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
); } }
</div> </header>
random_line_split
PageHeader.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
() { this.mounted = false; } handleApplyTemplate = () => { this.setState({ applyTemplateModal: true }); }; handleApplyTemplateClose = () => { if (this.mounted) { this.setState({ applyTemplateModal: false }); } }; render() { const { component } = this.props; const { configura...
componentWillUnmount
identifier_name
table_cell.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::{BlockFlow, MarginsMayNotCollapse, WidthAnd...
/// Minimum/preferred widths set by this function are used in automatic table layout calculation. fn bubble_widths(&mut self, ctx: &mut LayoutContext) { self.block_flow.bubble_widths(ctx); let specified_width = MaybeAuto::from_style(self.block_flow.fragment.style().get_box().width, ...
{ &mut self.block_flow }
identifier_body
table_cell.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::{BlockFlow, MarginsMayNotCollapse, WidthAnd...
<'a>(&'a mut self) -> &'a Fragment { &self.block_flow.fragment } pub fn mut_fragment<'a>(&'a mut self) -> &'a mut Fragment { &mut self.block_flow.fragment } /// Assign height for table-cell flow. /// /// TODO(#2015, pcwalton): This doesn't handle floats right. /// /// i...
fragment
identifier_name
table_cell.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::{BlockFlow, MarginsMayNotCollapse, WidthAnd...
} /// Recursively (top-down) determines the actual width of child contexts and fragments. When /// called on this context, the context has had its width set by the parent table row. fn assign_widths(&mut self, ctx: &mut LayoutContext) { debug!("assign_widths({}): assigning width for flow", "ta...
{ self.block_flow.base.intrinsic_widths.preferred_width = self.block_flow.base.intrinsic_widths.minimum_width; }
conditional_block
table_cell.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::{BlockFlow, MarginsMayNotCollapse, WidthAnd...
}
}
random_line_split
lib.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(warnings)] #![deny(rust_2018_idioms)] #![deny(clippy::all)] #![allow(clippy::large_enum_variant)] mod char_constants; mod ...
(source: &str, file: FileKey) -> SyntaxResult<TypeAnnotation> { let parser = Parser::new(source, file); parser.parse_type() }
parse_type
identifier_name
lib.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(warnings)] #![deny(rust_2018_idioms)] #![deny(clippy::all)] #![allow(clippy::large_enum_variant)] mod char_constants; mod ...
mod token_kind; pub use source::GraphQLSource; pub use syntax_error::{SyntaxError, SyntaxErrorKind, SyntaxErrorWithSource}; pub use syntax_node::*; use crate::parser::Parser; use common::FileKey; pub fn parse(source: &str, file: FileKey) -> SyntaxResult<Document> { let parser = Parser::new(source, file); pars...
mod parser; mod source; mod syntax_error; mod syntax_node;
random_line_split
lib.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #![deny(warnings)] #![deny(rust_2018_idioms)] #![deny(clippy::all)] #![allow(clippy::large_enum_variant)] mod char_constants; mod ...
pub fn parse_type(source: &str, file: FileKey) -> SyntaxResult<TypeAnnotation> { let parser = Parser::new(source, file); parser.parse_type() }
{ let parser = Parser::new(source, file); parser.parse_document() }
identifier_body
errorhandler.py
# Copyright 2010 WebDriver committers # Copyright 2010 Google Inc. # # 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 ap...
exception_class = NoSuchFrameException elif status == ErrorCode.NO_SUCH_WINDOW: exception_class = NoSuchWindowException elif status == ErrorCode.STALE_ELEMENT_REFERENCE: exception_class = StaleElementReferenceException elif status == ErrorCode.ELEMENT_NOT_VISI...
""" Handles errors returned by the WebDriver server. """ def check_response(self, response): """ Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object....
identifier_body
errorhandler.py
# Copyright 2010 WebDriver committers # Copyright 2010 Google Inc. # # 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 ap...
from selenium.common.exceptions import InvalidSelectorException from selenium.common.exceptions import ImeNotAvailableException from selenium.common.exceptions import ImeActivationFailedException from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchFrameException fr...
from selenium.common.exceptions import ElementNotSelectableException from selenium.common.exceptions import ElementNotVisibleException from selenium.common.exceptions import InvalidCookieDomainException from selenium.common.exceptions import InvalidElementStateException
random_line_split
errorhandler.py
# Copyright 2010 WebDriver committers # Copyright 2010 Google Inc. # # 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 ap...
elif status == ErrorCode.UNEXPECTED_ALERT_OPEN: exception_class = UnexpectedAlertPresentException elif status == ErrorCode.NO_ALERT_OPEN: exception_class = NoAlertPresentException elif status == ErrorCode.IME_NOT_AVAILABLE: exception_class = ImeNotAvailableEx...
exception_class = WebDriverException
conditional_block
errorhandler.py
# Copyright 2010 WebDriver committers # Copyright 2010 Google Inc. # # 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 ap...
(object): """ Handles errors returned by the WebDriver server. """ def check_response(self, response): """ Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary ...
ErrorHandler
identifier_name
index.js
/* * Routes handlers */ var exec = require('child_process').exec, child_process = require('child_process'), fs = require('fs'), child_processes = []; // Basic routing module.exports = function(app) { app.get("/", getHomePage); app.post("/add", postAddScraper); } function getHomePage(req, res) { var port...
(req, res) { var url = req.body.url, auth_user = req.body.auth_user, auth_pass = req.body.auth_pass, depth = parseInt(req.body.create_crawler_depth), create_sitemap = req.body.create_crawler_sitemap == 1, clean = req.body.clean_crawl == 1, config = res.app.settings.config; var child = child_process.fork(...
postAddScraper
identifier_name
index.js
/* * Routes handlers */ var exec = require('child_process').exec, child_process = require('child_process'), fs = require('fs'), child_processes = []; // Basic routing module.exports = function(app) { app.get("/", getHomePage); app.post("/add", postAddScraper); } function getHomePage(req, res) { var port...
res.render("partials/scraper-stats-row", {data: data, layout: false}, function(err, html) { if (err != null) { return; } data.html = html; io.sockets.emit('general-stats', data); }); break; case "done-crawling": case "stop-crawling": if (create_sitemap) { child.sen...
random_line_split
index.js
/* * Routes handlers */ var exec = require('child_process').exec, child_process = require('child_process'), fs = require('fs'), child_processes = []; // Basic routing module.exports = function(app) { app.get("/", getHomePage); app.post("/add", postAddScraper); } function getHomePage(req, res)
function postAddScraper(req, res) { var url = req.body.url, auth_user = req.body.auth_user, auth_pass = req.body.auth_pass, depth = parseInt(req.body.create_crawler_depth), create_sitemap = req.body.create_crawler_sitemap == 1, clean = req.body.clean_crawl == 1, config = res.app.settings.config; var ch...
{ var port = res.app.settings.config.server.port; res.render('index', { port: port }); }
identifier_body
index.js
/* * Routes handlers */ var exec = require('child_process').exec, child_process = require('child_process'), fs = require('fs'), child_processes = []; // Basic routing module.exports = function(app) { app.get("/", getHomePage); app.post("/add", postAddScraper); } function getHomePage(req, res) { var port...
else { child.kill(); // Terminate crawling daemon } io.sockets.emit(data.message, data); // done-crawling | stop-crawling break; // @TODO: Implement case "recrawl": break; case "sitemap-created": var sitemap_path = "public/sitemaps/"; fs.exists(sitemap_path, function(exists) {...
{ child.send({ action: "createSitemap" }); }
conditional_block
shatterview.d.ts
/** * Contains the ShatterView class, which represents a FrameLayout that can be shattered like glass. */ declare module "shatterview" { import view = require("ui/core/view"); /** * Represents a standard ShatterView widget. */ export class Sh
xtends view.View implements view.AddChildFromBuilder { /** * Gets the native [android widget](http://developer.android.com/reference/android/support/v7/widget/CardView.html) that represents the user interface for this component. Valid only when running on Android OS. */ android: any; /* com....
atterView e
identifier_name
shatterview.d.ts
/** * Contains the ShatterView class, which represents a FrameLayout that can be shattered like glass. */ declare module "shatterview" { import view = require("ui/core/view"); /** * Represents a standard ShatterView widget. */ export class ShatterView extends view.View implements view.AddChildFromB...
* This method will add a child element (value) to current element. * @param name - Name of the element. * @param value - Value of the element. */ _addChildFromBuilder(name: string, value: any): void; } }
random_line_split
perf_profiler.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. import logging import os import re import signal import subprocess import sys import tempfile from telemetry.core import platform from telemetry.core import...
class PerfProfiler(profiler.Profiler): def __init__(self, browser_backend, platform_backend, output_path, state): super(PerfProfiler, self).__init__( browser_backend, platform_backend, output_path, state) process_output_file_map = self._GetProcessOutputFileMap() self._process_profilers = [] ...
self._tmp_output_file.flush() try: with open(self._tmp_output_file.name) as f: return f.read() except IOError: return ''
identifier_body
perf_profiler.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. import logging import os import re import signal import subprocess import sys import tempfile from telemetry.core import platform from telemetry.core import...
continue period = int(fields[1]) function = fields[4].partition(' ')[2] function = re.sub('<.*>', '', function) # Strip template params. function = re.sub('[(].*[)]', '', function) # Strip function params. period_by_function[function] = period if len(period_by_function) == ...
if not line or line.startswith('#'): continue fields = line.split('^') if len(fields) != 5:
random_line_split
perf_profiler.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. import logging import os import re import signal import subprocess import sys import tempfile from telemetry.core import platform from telemetry.core import...
return period_by_function
break
conditional_block
perf_profiler.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. import logging import os import re import signal import subprocess import sys import tempfile from telemetry.core import platform from telemetry.core import...
(self, browser_backend, platform_backend, output_path, state): super(PerfProfiler, self).__init__( browser_backend, platform_backend, output_path, state) process_output_file_map = self._GetProcessOutputFileMap() self._process_profilers = [] self._is_android = platform_backend.GetOSName() == 'and...
__init__
identifier_name
download.ts
import * as archiver from 'archiver'; import * as fs from 'fs-extra'; import * as mio from '../'; import * as path from 'path'; import * as imageSize from 'image-size'; import shared = mio.shared; export async function downloadAsync() { await mio.usingAsync(mio.Browser.createAsync(), async browser => { let fileN...
} async function archiveAsync(chapter: archiver.Archiver, iterator: mio.IScraperIterator) { let currentPageNumber = 1; while (await iterator.moveAsync()) { let buffer = await iterator.currentAsync(); let imageInfo = imageSize(buffer); let name = `${String(currentPageNumber).padStart(3, '0')}.${imageIn...
{ console.log(`Fetching ${seriesChapter.name}`); let chapter = archiver.create('zip', {store: true}); let timer = new mio.Timer(); await fs.ensureDir(path.dirname(chapterPath)); chapter.pipe(fs.createWriteStream(chapterPath + shared.extension.tmp)); await mio.usingAsync(seriesChapter.iteratorAsy...
conditional_block
download.ts
import * as archiver from 'archiver'; import * as fs from 'fs-extra'; import * as mio from '../'; import * as path from 'path'; import * as imageSize from 'image-size'; import shared = mio.shared; export async function downloadAsync() { await mio.usingAsync(mio.Browser.createAsync(), async browser => { let fileN...
export async function downloadSeriesItemAsync(series: mio.IScraperSeries, seriesChapter: mio.IScraperSeriesChapter) { let chapterPath = shared.path.normal(series.providerName, series.title, seriesChapter.name + shared.extension.cbz); let chapterExists = await fs.pathExists(chapterPath); if (!chapterExists) { ...
{ await series.chapters.reduce((p, c) => p.then(() => downloadSeriesItemAsync(series, c)), Promise.resolve()); await cleanAsync(series); }
identifier_body
download.ts
import * as archiver from 'archiver'; import * as fs from 'fs-extra'; import * as mio from '../'; import * as path from 'path'; import * as imageSize from 'image-size'; import shared = mio.shared; export async function downloadAsync() { await mio.usingAsync(mio.Browser.createAsync(), async browser => { let fileN...
(chapter: archiver.Archiver, iterator: mio.IScraperIterator) { let currentPageNumber = 1; while (await iterator.moveAsync()) { let buffer = await iterator.currentAsync(); let imageInfo = imageSize(buffer); let name = `${String(currentPageNumber).padStart(3, '0')}.${imageInfo.type}`; chapter.append(b...
archiveAsync
identifier_name
download.ts
import * as fs from 'fs-extra'; import * as mio from '../'; import * as path from 'path'; import * as imageSize from 'image-size'; import shared = mio.shared; export async function downloadAsync() { await mio.usingAsync(mio.Browser.createAsync(), async browser => { let fileNames = await fs.readdir(shared.path.no...
import * as archiver from 'archiver';
random_line_split
color_matrix.rs
SetAttributes}; use crate::error::*; use crate::node::{CascadedValues, Node}; use crate::parsers::{NumberList, Parse, ParseValue}; use crate::properties::ColorInterpolationFilters; use crate::rect::IRect; use crate::surface_utils::{ iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pix...
}; self.params.matrix = new_matrix; } } Ok(()) } } impl ColorMatrix { pub fn render( &self, bounds_builder: BoundsBuilder, ctx: &FilterContext, acquired_nodes: &mut AcquiredNodes<'_>, draw_ctx: &mut DrawingCt...
{ let degrees: f64 = attr.parse(value)?; ColorMatrix::hue_rotate_matrix(degrees.to_radians()) }
conditional_block
color_matrix.rs
bounds::BoundsBuilder; use super::context::{FilterContext, FilterOutput}; use super::{ FilterEffect, FilterError, FilterResolveError, Input, Primitive, PrimitiveParams, ResolvedPrimitive, }; /// Color matrix operation types. #[derive(Debug, Clone, Copy, Eq, PartialEq)] enum OperationType { Matrix, Satu...
parser,
random_line_split
color_matrix.rs
SetAttributes}; use crate::error::*; use crate::node::{CascadedValues, Node}; use crate::parsers::{NumberList, Parse, ParseValue}; use crate::properties::ColorInterpolationFilters; use crate::rect::IRect; use crate::surface_utils::{ iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pix...
(&mut self, attrs: &Attributes) -> ElementResult { self.params.in1 = self.base.parse_one_input(attrs)?; // First, determine the operation type. let mut operation_type = Default::default(); for (attr, value) in attrs .iter() .filter(|(attr, _)| attr.expanded() == ...
set_attributes
identifier_name
color_matrix.rs
SetAttributes}; use crate::error::*; use crate::node::{CascadedValues, Node}; use crate::parsers::{NumberList, Parse, ParseValue}; use crate::properties::ColorInterpolationFilters; use crate::rect::IRect; use crate::surface_utils::{ iterators::Pixels, shared_surface::ExclusiveImageSurface, ImageSurfaceDataExt, Pix...
} #[rustfmt::skip] impl SetAttributes for FeColorMatrix { fn set_attributes(&mut self, attrs: &Attributes) -> ElementResult { self.params.in1 = self.base.parse_one_input(attrs)?; // First, determine the operation type. let mut operation_type = Default::default(); for (attr, value)...
{ ColorMatrix { in1: Default::default(), color_interpolation_filters: Default::default(), // nalgebra's Default for Matrix5 is all zeroes, so we actually need this :( matrix: Matrix5::identity(), } }
identifier_body
translation.js
/** * Copyright (c) 2017-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // translation object contains all translations for each string in i18n/en.json const CWD = process.cwd(); const fs = require('fs'); co...
}); module.exports = translation;
{ const match = langRegex.exec(file); const language = match[1]; translation[language] = require(file); }
conditional_block
translation.js
/** * Copyright (c) 2017-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // translation object contains all translations for each string in i18n/en.json const CWD = process.cwd(); const fs = require('fs'); co...
languages = [ { enabled: true, name: 'English', tag: 'en', }, ]; } const enabledLanguages = languages.filter(lang => lang.enabled); const translation = {languages: enabledLanguages}; const files = glob.sync(CWD + '/i18n/**'); const langRegex = /\/i18n\/(.*)\.json$/; files.forEach(file ...
let languages; if (fs.existsSync(CWD + '/languages.js')) { languages = require(CWD + '/languages.js'); } else {
random_line_split
admin.component.ts
import {Component, OnInit} from '@angular/core'; import {LoginService} from '../../services/LoginService'; import  {  Router,  ActivatedRoute  }  from  '@angular/router'; //import {SessionService} from '../../service/session.service'; //import {UserService} from '../../service/user.service'; @Component({ template...
private menuCollapse: boolean = true; private showMenu: boolean = true; private showMenu2: boolean = true; constructor(private login: LoginService, private router:Router){} showDropdown(typeMenu: string) {// Método encargado de los dropdowns del navbar if (typeMenu === "collapse") { this.menuCol...
omponent {
identifier_name
admin.component.ts
import {Component, OnInit} from '@angular/core'; import {LoginService} from '../../services/LoginService'; import  {  Router,  ActivatedRoute  }  from  '@angular/router'; //import {SessionService} from '../../service/session.service'; //import {UserService} from '../../service/user.service'; @Component({ template...
export class AdminComponent { private menuCollapse: boolean = true; private showMenu: boolean = true; private showMenu2: boolean = true; constructor(private login: LoginService, private router:Router){} showDropdown(typeMenu: string) {// Método encargado de los dropdowns del navbar if (typeMenu === ...
'../../../assets/Bootstrap-Admin-Theme/css/stats.css', '../../../assets/Bootstrap-Admin-Theme/css/styles.css', '../../js/google-code-prettify/prettify.css'] })
random_line_split
book_tracker.py
# -*- coding: utf-8 -*- ''' Column names: Name, Author, Genre, StartDate, EndDate, Pages, Progress , Finished ''' from __future__ import division import sqlite3 as sql ######################################################## # DATA VIEWING # ######################################################## def ...
titles = [i[0] for i in titles] # Change to a list of strings titles = [i.encode('UTF8') for i in titles] cursor.execute('select Progress from books where Finished = 0') progress = cursor.fetchall() # Convert progress from list of tuples to list of ints progress = [i[0] for i in progress] cursor.execute('...
cursor.execute('select Name from books where Finished = 0') # get the values out of the tuples! titles = cursor.fetchall() # Change to a list of unicodes
random_line_split
book_tracker.py
# -*- coding: utf-8 -*- ''' Column names: Name, Author, Genre, StartDate, EndDate, Pages, Progress , Finished ''' from __future__ import division import sqlite3 as sql ######################################################## # DATA VIEWING # ######################################################## def ...
for (k,v) in zip(titles, totals): v = round(v, 2) books_dict[k] = v print('Book Progress (%):') print(books_dict) def close(): try: cursor.close() db.commit() db.close() except: print('Error closing!') raise ######################################################## # DATA MANIPULATION # ##...
for j in pages: val = (i/j) * 100 totals.append(val)
conditional_block