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
cell.rs
//! ``` //! // FIXME: Explain difference between Cell and RefCell // FIXME: Downsides to interior mutability // FIXME: Can't be shared between threads. Dynamic borrows // FIXME: Relationship to Atomic types and RWLock use clone::Clone; use cmp::PartialEq; use default::Default; use kinds::{marker, Copy}; use ops::{Dere...
{ self._value }
identifier_body
cell.rs
insert("piccadilly", 11826i); //! shared_map.borrow_mut().insert("marbles", 38i); //! } //! ``` //! //! ## Implementation details of logically-immutable methods //! //! Occasionally it may be desirable not to expose in an API that //! there is mutation happening "under the hood". This may be because //! logically t...
/// Mutably borrows the wrapped value. /// /// The borrow lasts until the returned `RefMut` exits scope. The value /// cannot be borrowed while this borrow is active. /// /// # Panics /// /// Panics if the value is currently borrowed. #[unstable] pub fn borrow_mut<'a>(&'a self) ...
} }
random_line_split
cell.rs
Ref::new(&self.borrow) { Some(b) => Some(Ref { _value: unsafe { &*self.value.get() }, _borrow: b }), None => None, } } /// Immutably borrows the wrapped value. /// /// The borrow lasts until the returned `Ref` exits scope. Multiple /// immutable borrows can be taken ...
new
identifier_name
animation_player.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 {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
/** @internal */ triggerMicrotask() { scheduleMicroTask(() => this._onFinish()); } private _onStart() { this._onStartFns.forEach(fn => fn()); this._onStartFns = []; } pause(): void {} restart(): void {} finish(): void { this._onFinish(); } destroy(): void { if (!this._destroy...
{ if (!this.hasStarted()) { this._onStart(); this.triggerMicrotask(); } this._started = true; }
identifier_body
animation_player.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 {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
this.finish(); this._onDestroyFns.forEach(fn => fn()); this._onDestroyFns = []; } } reset(): void {} setPosition(position: number): void {} getPosition(): number { return 0; } /** @internal */ triggerCallback(phaseName: string): void { const methods = phaseName == 'start' ?...
{ this._onStart(); }
conditional_block
animation_player.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 {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
triggerCallback?: (phaseName: string) => void; /** * @internal * Internal */ disabled?: boolean; } /** * An empty programmatic controller for reusable animations. * Used internally when animations are disabled, to avoid * checking for the null case when an animation player is expected. * * @see `an...
random_line_split
animation_player.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 {scheduleMicroTask} from '../util'; /** * Provides programmatic control of a reusable animation sequence, *...
implements AnimationPlayer { private _onDoneFns: Function[] = []; private _onStartFns: Function[] = []; private _onDestroyFns: Function[] = []; private _started = false; private _destroyed = false; private _finished = false; public parentPlayer: AnimationPlayer|null = null; public readonly totalTime: n...
NoopAnimationPlayer
identifier_name
unpack1.py
# unpack sequences a, = 1, ; print(a) a, b = 2, 3 ; print(a, b) a, b, c = 1, 2, 3; print(a, b, c) a, = range(1); print(a) a, b = range(2); print(a, b) a, b, c = range(3); print(a, b, c) (a) = range(1); print(a)
(a, b) = range(2); print(a, b) (a, b, c) = range(3); print(a, b, c) (a, (b, c)) = [-1, range(2)]; print(a, b, c) # lists [] = [] [a] = range(1); print(a) [a, b] = range(2); print(a, b) [a, b, c] = range(3); print(a, b, c) # with star *a, = () ; print(a) *a, = 4, ; print(a) *a, = 5, 6 ; print(a) *a, b = 7, ...
(a,) = range(1); print(a)
random_line_split
release_vcs.py
from rez.exceptions import ReleaseVCSError from rez.packages_ import get_developer_package from rez.util import which from rez.utils.system import popen from rez.utils.logging_ import print_debug from rez.utils.filesystem import walk_up_dirs from pipes import quote import subprocess def get_release_vcs_types(): "...
@classmethod def is_valid_root(cls, path): """Return True if the given path is a valid root directory for this version control system. Note that this is different than whether the path is under the control of this type of vcs; to answer that question, use find_vcs_root...
exe = which(name) if not exe: raise ReleaseVCSError("Couldn't find executable '%s' for VCS '%s'" % (name, cls.name())) return exe
identifier_body
release_vcs.py
from rez.exceptions import ReleaseVCSError from rez.packages_ import get_developer_package from rez.util import which from rez.utils.system import popen from rez.utils.logging_ import print_debug from rez.utils.filesystem import walk_up_dirs from pipes import quote import subprocess def get_release_vcs_types(): "...
(cls, path): """Try to find a version control root directory of this type for the given path. If successful, returns (vcs_root, levels_up), where vcs_root is the path to the version control root directory it found, and levels_up is an integer indicating how many parent directori...
find_vcs_root
identifier_name
release_vcs.py
from rez.exceptions import ReleaseVCSError from rez.packages_ import get_developer_package from rez.util import which from rez.utils.system import popen from rez.utils.logging_ import print_debug from rez.utils.filesystem import walk_up_dirs from pipes import quote import subprocess def get_release_vcs_types(): "...
# Copyright 2013-2016 Allan Johns. # # This library 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, or (at your option) any later version. # # This library is distr...
return []
conditional_block
release_vcs.py
from rez.exceptions import ReleaseVCSError from rez.packages_ import get_developer_package from rez.util import which from rez.utils.system import popen from rez.utils.logging_ import print_debug from rez.utils.filesystem import walk_up_dirs from pipes import quote import subprocess def get_release_vcs_types(): "...
print_debug("command stderr:") print_debug(err) raise ReleaseVCSError("command failed: %s\n%s" % (cmd_str, err)) out = out.strip() if out: return [x.rstrip() for x in out.split('\n')] else: return [] # Copyright 2013-2016 Allan Johns....
random_line_split
uart.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.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.o...
Forced1, /// Partity bit forced to 0. Forced0, }
random_line_split
uart.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.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.o...
{ /// Partity disabled. Disabled, /// Partity bit added to make number of 1s odd. Odd, /// Partity bit added to make number of 1s even. Even, /// Partity bit forced to 1. Forced1, /// Partity bit forced to 0. Forced0, }
Parity
identifier_name
gridbounds.ts
/** * Copyright 2019 Google LLC. 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...
/** * * @param bounds * @param z */ constructor(bounds: google.maps.Point[], z: number) { // [sw, ne] this.z = z; this.minX = Math.min(bounds[0].x, bounds[1].x); this.maxX = Math.max(bounds[0].x, bounds[1].x); this.minY = Math.min(bounds[0].y, bounds[1].y); this.maxY = Math.max(b...
public maxX: number; public minY: number; public maxY: number;
random_line_split
gridbounds.ts
/** * Copyright 2019 Google LLC. 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...
} /** * Returns true if this bounds (inclusively) contains the given point. * @param {Point} point The point to test. * @return {Boolean} This Bounds contains the given Point. */ containsPoint(point: google.maps.Point): boolean { return ( this.minX <= point.x && this.maxX >= point.x...
{ return false; }
conditional_block
gridbounds.ts
/** * Copyright 2019 Google LLC. 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...
(gridBounds: GridBounds): boolean { if ( this.maxX === gridBounds.maxX && this.maxY === gridBounds.maxY && this.minX === gridBounds.minX && this.minY === gridBounds.minY ) { return true; } else { return false; } } /** * Returns true if this bounds (inclusively...
equals
identifier_name
legacy.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use super::super::NameDag; use super::IdStaticSet; use super::NameSet; use crate::IdSet; /// A legacy token that enables conversion betwee...
(value: (LegacyCodeNeedIdAccess, IdSet, &'a NameDag)) -> NameSet { NameSet::from_spans_dag(value.1, value.2).unwrap() } } #[cfg(test)] mod tests { use nonblocking::non_blocking_result as r; use super::super::id_static::tests::with_dag; use super::*; use crate::DagAlgorithm; use crate::...
from
identifier_name
legacy.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use super::super::NameDag; use super::IdStaticSet;
/// A legacy token that enables conversion between IdSet (id-based) /// and NameSet (hash-based). It should not be used for new Rust code. #[derive(Copy, Clone)] pub struct LegacyCodeNeedIdAccess; // This is ideally not provided. However revision numbers in revset still have // large use-cases in Python and for now w...
use super::NameSet; use crate::IdSet;
random_line_split
ffi.rs
// The MIT License (MIT) // // Copyright (c) 2016 Vladislav Nikonov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to us...
{ pub sum: c_double, pub delay: [c_double; DC_FILTER_SIZE], } impl Clone for DCFilter { fn clone(&self) -> Self { *self } } impl Default for DCFilter { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy)] pub struct Ayumi { pub channels: [ToneChann...
DCFilter
identifier_name
ffi.rs
// The MIT License (MIT) // // Copyright (c) 2016 Vladislav Nikonov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to us...
} #[repr(C)] #[derive(Copy)] pub struct DCFilter { pub sum: c_double, pub delay: [c_double; DC_FILTER_SIZE], } impl Clone for DCFilter { fn clone(&self) -> Self { *self } } impl Default for DCFilter { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy...
{ unsafe { mem::zeroed() } }
identifier_body
ffi.rs
// The MIT License (MIT) // // Copyright (c) 2016 Vladislav Nikonov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to us...
unsafe { mem::zeroed() } } } extern "C" { pub fn ayumi_configure(ay: *mut Ayumi, is_ym: c_int, clock_rate: c_double, sr: c_int); pub fn ayumi_set_pan(ay: *mut Ayumi, index: c_int, pan: c_double, is_eqp: c_int); pub fn ayumi_set_tone(ay: *mut Ayumi, index: c_int, period: c_int); pub fn ayumi_...
*self } } impl Default for Ayumi { fn default() -> Self {
random_line_split
add-collaborators.tsx
] ); function reset(): void { set_search(""); set_results([]); set_num_matching_already(0); set_selected_entries([]); set_state("input"); set_err(""); set_email_to(""); set_email_body(""); set_email_body_error(""); set_email_body_editing(false); } async function do_sear...
if (!email_body_error) { return; } return <ErrorDisplay error={email_body_error} />; }
identifier_body
add-collaborators.tsx
= useState<string>(""); // if set, adding user via email to this address const [email_to, set_email_to] = useState<string>(""); // with this body. const [email_body, set_email_body] = useState<string>(""); const [email_body_error, set_email_body_error] = useState<string>(""); const [email_body_editing, set...
} if (extra.length > 0) { name += ` (${extra.join(", ")})`; } r.label = name.toLowerCase(); r.tag = tag; r.name = name; } const x = r.account_id ?? r.email_address; options.push( <Select.Option key={x} value={x} label={r.label} tag={r.ta...
if (r.email_address_verified?.[r.email_address]) { extra.push(`${r.email_address} -- verified`); } else { extra.push(`${r.email_address} -- not verified`); } }
conditional_block
add-collaborators.tsx
] = useState<string>(""); // if set, adding user via email to this address const [email_to, set_email_to] = useState<string>(""); // with this body. const [email_body, set_email_body] = useState<string>(""); const [email_body_error, set_email_body_error] = useState<string>(""); const [email_body_editing, se...
{ subject: string; replyto?: string; replyto_name: string; } { const replyto = redux.getStore("account").get_email_address(); const replyto_name = redux.getStore("account").get_fullname(); const SiteName = redux.getStore("customize").get("site_name") ?? SITE_NAME; let subject; if (rep...
der_info():
identifier_name
add-collaborators.tsx
] = useState<string>(""); // if set, adding user via email to this address const [email_to, set_email_to] = useState<string>(""); // with this body. const [email_body, set_email_body] = useState<string>(""); const [email_body_error, set_email_body_error] = useState<string>(""); const [email_body_editing, se...
if (project == null) return; const name = redux.getStore("account").get_fullname(); const title = project.get("title"); const target = `project '${title}'`; const SiteName = redux.getStore("customize").get("site_name") ?? SITE_NAME; const body = `Hello!\n\nPlease collaborate with me using ${Sit...
function write_email_invite(): void {
random_line_split
fmt.rs
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![warn(rust_2018_idioms, unused_lifetimes)] use std::path::PathBuf; use std::process::Command; #[test] fn fmt()
.output() .unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); assert!( output.status.success(), "Formatting check failed. Run `cargo dev fmt` ...
{ if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { return; } // Skip this test if nightly rustfmt is unavailable let rustup_output = Command::new("rustup") .args(&["component", "list", "--toolchain", "nightly"]) .output() .unwrap(); ...
identifier_body
fmt.rs
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![warn(rust_2018_idioms, unused_lifetimes)] use std::path::PathBuf; use std::process::Command; #[test] fn fmt() { if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { return; } // Skip this test if nightly ...
assert!( output.status.success(), "Formatting check failed. Run `cargo dev fmt` to update formatting." ); }
.unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
random_line_split
fmt.rs
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![warn(rust_2018_idioms, unused_lifetimes)] use std::path::PathBuf; use std::process::Command; #[test] fn fmt() { if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some()
// Skip this test if nightly rustfmt is unavailable let rustup_output = Command::new("rustup") .args(&["component", "list", "--toolchain", "nightly"]) .output() .unwrap(); assert!(rustup_output.status.success()); let component_output = String::from_utf8_lossy(&rustup_output.std...
{ return; }
conditional_block
fmt.rs
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![warn(rust_2018_idioms, unused_lifetimes)] use std::path::PathBuf; use std::process::Command; #[test] fn
() { if option_env!("RUSTC_TEST_SUITE").is_some() || option_env!("NO_FMT_TEST").is_some() { return; } // Skip this test if nightly rustfmt is unavailable let rustup_output = Command::new("rustup") .args(&["component", "list", "--toolchain", "nightly"]) .output() .unwrap(...
fmt
identifier_name
menu-panel.d.ts
/** * @license * Copyright Google LLC 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 { EventEmitter, TemplateRef } from '@angular/core'; import { MenuPositionX, MenuPositionY } from './menu-positi...
direction?: Direction; focusFirstItem: () => void; resetActiveItem: () => void; setPositionClasses: (x: MenuPositionX, y: MenuPositionY) => void; setElevation?(depth: number): void; }
yPosition: MenuPositionY; overlapTrigger: boolean; templateRef: TemplateRef<any>; close: EventEmitter<void | 'click' | 'keydown'>; parentMenu?: MatMenuPanel | undefined;
random_line_split
py_idpapa_sam2gpd.py
#!/usr/bin/env python import sys,re,time,argparse def main(args): # print >>sys.stdout, "Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") convert(args.input,args.output) # print >>sys.stdout, "Finish analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") def extract_exon_length_from_cigar(cigar): cigar_m = ["...
(sam_file,gpd_file): for line in sam_file: if line[0] != "@": qname,flag,rname,pos,mapq,cigar,rnext,pnext,tlen,seq = line.strip().split("\t")[:10] tag = "\t".join(line.strip().split("\t")[11:]) if rname != "*" and re.search(r"XS:A:(\S)",tag): s5,s3 = extract_soft_clip_from_cigar(cigar) sf = str(s5)+...
convert
identifier_name
py_idpapa_sam2gpd.py
#!/usr/bin/env python import sys,re,time,argparse def main(args): # print >>sys.stdout, "Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") convert(args.input,args.output) # print >>sys.stdout, "Finish analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") def extract_exon_length_from_cigar(cigar): cigar_m = ["...
9. exon count 10. exon start set 11. exon end set''' parser = argparse.ArgumentParser(description="Function: convert sam to gpd.",formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-i','--input',type=argparse.FileType('r'),required=True,help="Input: sam file") parser.add_argument('-o','--ou...
4. strand 5. start site of alignment 6. end site of alignment 7. MAPQ 8. Number of nucleotides that are softly-clipped by aligner; left_right
random_line_split
py_idpapa_sam2gpd.py
#!/usr/bin/env python import sys,re,time,argparse def main(args): # print >>sys.stdout, "Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") convert(args.input,args.output) # print >>sys.stdout, "Finish analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") def extract_exon_length_from_cigar(cigar): cigar_m = ["...
exon_start = exon_start exon_length = extract_exon_length_from_cigar(cigar) exon_end = exon_start + exon_length exon_start_list.append(str(exon_start)) exon_end_list.append(str(exon_end)) exon_start_list.append("") exon_end_list.append("") print >>gpd_file, "%s\t%s\t%s\t%s\t%s\t%s...
s5,s3 = extract_soft_clip_from_cigar(cigar) sf = str(s5)+"_"+str(s3) strand = (re.search(r"XS:A:(\S)",tag)).group(1) cigar_n_l = 0 exon_length = 0 exon_start = int(pos)-1 exon_end = 0 exon_start_list = [] exon_end_list = [] if "N" in cigar: for exon in cigar.split("N"): ex...
conditional_block
py_idpapa_sam2gpd.py
#!/usr/bin/env python import sys,re,time,argparse def main(args): # print >>sys.stdout, "Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") convert(args.input,args.output) # print >>sys.stdout, "Finish analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S") def extract_exon_length_from_cigar(cigar):
def extract_soft_clip_from_cigar(cigar): cigar_5 = ["0"] + re.findall(r"^(\d+)S",cigar) cigar_3 = ["0"] + re.findall(r"(\d+)S$",cigar) cigar_5_s,cigar_3_s = [0,0] for s5 in cigar_5: cigar_5_s += int(s5) for s3 in cigar_3: cigar_3_s += int(s3) return cigar_5_s,cigar_3_s def convert(sam_file,gpd_file): for ...
cigar_m = ["0"] + re.findall(r"(\d+)M",cigar) cigar_d = ["0"] + re.findall(r"(\d+)D",cigar) cigar_m_s,cigar_d_s = [0,0] for m in cigar_m: cigar_m_s += int(m) for d in cigar_d: cigar_d_s += int(d) exon_length = cigar_m_s+cigar_d_s return exon_length
identifier_body
feed.py
#!/usr/bin/env python # coding=utf-8 import os import datetime from google.appengine.ext import webapp from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext.webapp import util from google.appengine.ext.webapp import template from v2ex.babel import Member from v2ex.ba...
def main(): application = webapp.WSGIApplication([ ('/index.xml', FeedHomeHandler), ('/feed/v2ex.rss', FeedHomeHandler) ], debug=True) util.run_wsgi_app(application) if __name__ == '__main__': main()
def head(self): self.response.out.write('') def get(self): site = GetSite() output = memcache.get('feed_index') if output is None: template_values = {} template_values['site'] = site template_values['site_domain'] = site.domain ...
identifier_body
feed.py
#!/usr/bin/env python # coding=utf-8 import os import datetime from google.appengine.ext import webapp from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext.webapp import util from google.appengine.ext.webapp import template from v2ex.babel import Member from v2ex.ba...
template_values['site_name'] = site.title template_values['site_slogan'] = site.slogan template_values['feed_url'] = 'http://' + template_values['site_domain'] + '/index.xml' template_values['site_updated'] = datetime.datetime.now() q = db.GqlQuery("SELECT * F...
output = memcache.get('feed_index') if output is None: template_values = {} template_values['site'] = site template_values['site_domain'] = site.domain
random_line_split
feed.py
#!/usr/bin/env python # coding=utf-8 import os import datetime from google.appengine.ext import webapp from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext.webapp import util from google.appengine.ext.webapp import template from v2ex.babel import Member from v2ex.ba...
(self): self.response.out.write('') def get(self): site = GetSite() output = memcache.get('feed_index') if output is None: template_values = {} template_values['site'] = site template_values['site_domain'] = site.domain templat...
head
identifier_name
feed.py
#!/usr/bin/env python # coding=utf-8 import os import datetime from google.appengine.ext import webapp from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext.webapp import util from google.appengine.ext.webapp import template from v2ex.babel import Member from v2ex.ba...
self.response.out.write(output) def main(): application = webapp.WSGIApplication([ ('/index.xml', FeedHomeHandler), ('/feed/v2ex.rss', FeedHomeHandler) ], debug=True) util.run_wsgi_app(application) if __name__ == '__main__': main()
template_values = {} template_values['site'] = site template_values['site_domain'] = site.domain template_values['site_name'] = site.title template_values['site_slogan'] = site.slogan template_values['feed_url'] = 'http://' + template_values['site_domain'] + '...
conditional_block
AbstractComponent.js
/* This file is part of Ext JS 4.2 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in...
if (myRtl !== undefined) { // restore this component's original hierarchyState rtl property hierarchyState.rtl = myRtl; } return isRtl; }, setLocalX: function(x) { return this.isLocalRtl() ? this.el.rtlSetLocalX(x) : this.el.setLocalX(x); }, s...
{ isRtl = true; }
conditional_block
AbstractComponent.js
/* This file is part of Ext JS 4.2 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in...
var me = this, rtl, offsetParent, doc; if (me.floating) { if (me._isOffsetParentRtl === undefined) { // position:fixed elements do not report an offsetParent, so fall back to parentNode offsetParent = this.el.dom.offsetParent || t...
random_line_split
systrace.d.ts
/** * @license * Copyright 2020 Google LLC. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * Code distributed by Google as part of this project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ declare ...
* e.g. class Foo extends makeSystemTraceable(Base) {...} */ export declare function makeSystemTraceable<T extends Constructor<{}>>(cls: T): { new (...args: any[]): {}; } & T; export {};
}; /** * Used at sources that cannot decorate class by @SystemTrace. * Extends makeSystemTraceable(Base) to inherit from a system-traceable Base,
random_line_split
MigrationsPage.tsx
GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import styled from 'styled-components' import { observer } from 'mobx-react' import MainTempl...
() { this.state.selectedMigrations.forEach(migration => { migrationStore.delete(migration.id) }) this.setState({ showDeleteMigrationModal: false }) } cancelSelectedMigrations() { this.state.selectedMigrations.forEach(migration => { const status = this.getStatus(migration.id) if (s...
deleteSelectedMigrations
identifier_name
MigrationsPage.tsx
GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import styled from 'styled-components' import { observer } from 'mobx-react' import MainTempl...
})) migrationStore.getMigrations() } handleEmptyListButtonClick() { this.props.history.push('/wizard/migration') } handleModalOpen() { this.setState({ modalIsOpen: true }) } handleModalClose() { this.setState({ modalIsOpen: false }, () => { this.pollData() }) } search...
{ await migrationStore.recreateFullCopy(migration as any) }
conditional_block
MigrationsPage.tsx
GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import styled from 'styled-components' import { observer } from 'mobx-react' import MainTempl...
getEndpoint(endpointId: string) { return endpointStore.endpoints.find(endpoint => endpoint.id === endpointId) } getFilterItems() { return [ { label: 'All', value: 'all' }, { label: 'Running', value: 'RUNNING' }, { label: 'Error', value: 'ERROR' }, { label: 'Completed', value: 'C...
{ clearTimeout(this.pollTimeout) this.stopPolling = true }
identifier_body
MigrationsPage.tsx
the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import styled from 'styled-components' import { observer } from 'mobx-react' import MainT...
{ label: 'Cancel', disabled: !atLeaseOneIsRunning, action: () => { this.setState({ showCancelMigrationModal: true }) }, }, { label: 'Recreate Migrations', disabled: atLeaseOneIsRunning, color: ThemePalette.primary, action: () => { this.setState({...
this.state.selectedMigrations.forEach(migration => { const status = this.getStatus(migration.id) atLeaseOneIsRunning = atLeaseOneIsRunning || status === 'RUNNING' || status === 'AWAITING_MINION_ALLOCATIONS' }) const BulkActions = [
random_line_split
formdata.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 dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::FormDataBinding;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::str::{DOMString, USVString}; use dom::blob::{Blob, BlobImpl}; use dom::file::File; use dom::htmlformelement::HTMLFormElement; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use strin...
use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::codegen::UnionTypes::BlobOrUSVString; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, Root};
random_line_split
formdata.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 dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::FormDataBinding; use dom::bindings::cod...
pub fn Constructor(global: GlobalRef, form: Option<&HTMLFormElement>) -> Fallible<Root<FormData>> { // TODO: Construct form data set for form if it is supplied Ok(FormData::new(form, global)) } } impl FormDataMethods for FormData { // https://xhr.spec.whatwg.org/#dom-formdata-append f...
{ reflect_dom_object(box FormData::new_inherited(form), global, FormDataBinding::Wrap) }
identifier_body
formdata.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 dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::FormDataBinding; use dom::bindings::cod...
{ reflector_: Reflector, data: DOMRefCell<HashMap<Atom, Vec<FormDatum>>>, form: Option<JS<HTMLFormElement>> } impl FormData { fn new_inherited(form: Option<&HTMLFormElement>) -> FormData { FormData { reflector_: Reflector::new(), data: DOMRefCell::new(HashMap::new()), ...
FormData
identifier_name
no-renderer.rs
extern crate sdl2; use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::video::Window; use sdl2::rect::Rect; use std::time::Duration; const WINDOW_WIDTH : u32 = 800; const WINDOW_HEIGHT : u32 = 600; #[derive(Clone, Copy)] enum Gradient {
} fn set_window_gradient(window: &mut Window, event_pump: &sdl2::EventPump, gradient: Gradient) -> Result<(), String> { let mut surface = window.surface(event_pump)?; for i in 0 .. (WINDOW_WIDTH / 4) { let c : u8 = 255 - (i as u8); let i = i as i32; let color = match gradient { ...
Red, Cyan, Green, Blue, White
random_line_split
no-renderer.rs
extern crate sdl2; use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::video::Window; use sdl2::rect::Rect; use std::time::Duration; const WINDOW_WIDTH : u32 = 800; const WINDOW_HEIGHT : u32 = 600; #[derive(Clone, Copy)] enum
{ Red, Cyan, Green, Blue, White } fn set_window_gradient(window: &mut Window, event_pump: &sdl2::EventPump, gradient: Gradient) -> Result<(), String> { let mut surface = window.surface(event_pump)?; for i in 0 .. (WINDOW_WIDTH / 4) { let c : u8 = 255 - (i as u8); let i = i ...
Gradient
identifier_name
no-renderer.rs
extern crate sdl2; use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::video::Window; use sdl2::rect::Rect; use std::time::Duration; const WINDOW_WIDTH : u32 = 800; const WINDOW_HEIGHT : u32 = 600; #[derive(Clone, Copy)] enum Gradient { Red, Cyan, Green, Blue, ...
pub fn main() -> Result<(), String> { let sdl_context = sdl2::init()?; let video_subsystem = sdl_context.video()?; let mut window = video_subsystem.window("rust-sdl2 demo: No Renderer", WINDOW_WIDTH, WINDOW_HEIGHT) .position_centered() .build() .map_err(|e| e.to_string())?; le...
{ use crate::Gradient::*; match gradient { Red => Cyan, Cyan => Green, Green => Blue, Blue => White, White => Red, } }
identifier_body
jquery.corner.js
www.gnu.org/licenses/gpl.html */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. * by default, al...
return this.each(function(index){ var $this = $(this); var o = [ options || '', $this.attr($.fn.corner.defaults.metaAttr) || ''].join(' ').toLowerCase(); //var o = (options || $this.attr($.fn.corner.defaults.metaAttr) || '').toLowerCase(); var keep = /keep/.test(o); // keep borders? ...
{ if (!$.isReady && this.selector) { var s = this.selector, c = this.context; $(function() { $(s,c).corner(options); }); } return this; }
conditional_block
jquery.corner.js
www.gnu.org/licenses/gpl.html */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. * by default, al...
; function hex2(s) { var s = parseInt(s).toString(16); return ( s.length < 2 ) ? '0'+s : s; }; function gpc(node) { for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) { var v = $.css(node,'backgroundColor'); if (v == 'rgba(0, 0, 0, 0)') continue; // w...
{ return parseInt($.css(el,p))||0; }
identifier_body
jquery.corner.js
://www.gnu.org/licenses/gpl.html */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. * by default,...
(el, p) { return parseInt($.css(el,p))||0; }; function hex2(s) { var s = parseInt(s).toString(16); return ( s.length < 2 ) ? '0'+s : s; }; function gpc(node) { for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) { var v = $.css(node,'backgroundColor'); if (v =...
sz
identifier_name
jquery.corner.js
://www.gnu.org/licenses/gpl.html */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. * by default,...
case 'bevel': return i+1; } }; $.fn.corner = function(options) { // in 1.3+ we can fix mistakes with the ready state if (this.length == 0) { if (!$.isReady && this.selector) { var s = this.selector, c = this.context; $(function() { $(s,c).corner(options); ...
case 'notch': return width;
random_line_split
reseeding.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 ...
} } impl<R: Rng, Rsdr: Reseeder<R>> Rng for ReseedingRng<R, Rsdr> { fn next_u32(&mut self) -> u32 { self.reseed_if_necessary(); self.bytes_generated += 4; self.rng.next_u32() } fn next_u64(&mut self) -> u64 { self.reseed_if_necessary(); self.bytes_generated +=...
{ self.reseeder.reseed(&mut self.rng); self.bytes_generated = 0; }
conditional_block
reseeding.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 ...
/// Reseed the internal RNG if the number of bytes that have been /// generated exceed the threshold. pub fn reseed_if_necessary(&mut self) { if self.bytes_generated >= self.generation_threshold { self.reseeder.reseed(&mut self.rng); self.bytes_generated = 0; } ...
{ ReseedingRng { rng: rng, generation_threshold: generation_threshold, bytes_generated: 0, reseeder: reseeder } }
identifier_body
reseeding.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 ...
<R, Rsdr> { rng: R, generation_threshold: usize, bytes_generated: usize, /// Controls the behaviour when reseeding the RNG. pub reseeder: Rsdr, } impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> { /// Create a new `ReseedingRng` with the given parameters. /// /// # Arguments //...
ReseedingRng
identifier_name
reseeding.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 ...
use core::iter::{order, repeat}; use super::{ReseedingRng, ReseedWithDefault}; use {SeedableRng, Rng}; struct Counter { i: u32 } impl Rng for Counter { fn next_u32(&mut self) -> u32 { self.i += 1; // very random self.i - 1 } } ...
#[cfg(test)] mod tests { use std::prelude::v1::*;
random_line_split
subarray_product_less_than_k.py
from typing import List class Solution: def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 0: return 0 l, r, prod, ans = 0, 0, 1, 0 while r < len(nums): prod *= nums[r] while l <= r and prod >= k: prod /= nums[...
# TESTS tests = [ ([10, 5, 2, 6], 0, 0), ([10, 5, 2, 6], 100, 8), ] for nums, k, expected in tests: sol = Solution() actual = sol.numSubarrayProductLessThanK(nums, k) print("# of subarray in", nums, "with product less than", k, "->", actual) assert actual == expected
random_line_split
subarray_product_less_than_k.py
from typing import List class Solution:
# TESTS tests = [ ([10, 5, 2, 6], 0, 0), ([10, 5, 2, 6], 100, 8), ] for nums, k, expected in tests: sol = Solution() actual = sol.numSubarrayProductLessThanK(nums, k) print("# of subarray in", nums, "with product less than", k, "->", actual) assert actual == expected
def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 0: return 0 l, r, prod, ans = 0, 0, 1, 0 while r < len(nums): prod *= nums[r] while l <= r and prod >= k: prod /= nums[l] l += 1 ans += r...
identifier_body
subarray_product_less_than_k.py
from typing import List class Solution: def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 0: return 0 l, r, prod, ans = 0, 0, 1, 0 while r < len(nums): prod *= nums[r] while l <= r and prod >= k: prod /= nums[...
sol = Solution() actual = sol.numSubarrayProductLessThanK(nums, k) print("# of subarray in", nums, "with product less than", k, "->", actual) assert actual == expected
conditional_block
subarray_product_less_than_k.py
from typing import List class
: def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int: if k <= 0: return 0 l, r, prod, ans = 0, 0, 1, 0 while r < len(nums): prod *= nums[r] while l <= r and prod >= k: prod /= nums[l] l += 1 an...
Solution
identifier_name
static-website.fr.js
'use strict'; /** * @ngdoc service
* @name ortolangMarketApp.STATIC_WEBSITE_FR * @description * # STATIC_WEBSITE_FR * Constant in the ortolangMarketApp. */ angular.module('ortolangMarketApp') .constant('STATIC_WEBSITE_FR', { STATIC_WEBSITE: { PATH: { LEGAL_NOTICES: 'common/static-website/fr/legal-notices.html...
random_line_split
test_class_traits.py
""" Unit tests for the `HasTraits.class_traits` class function. """ from __future__ import absolute_import from traits import _py2to3 from traits.testing.unittest_tools import unittest from ..api import HasTraits, Int, List, Str class A(HasTraits): x = Int name = Str(marked=True) class B(A): pas...
(self): expected = ['x', 'name', 'trait_added', 'trait_modified'] _py2to3.assertCountEqual(self, A.class_traits(), expected) # Check that derived classes report the correct traits. _py2to3.assertCountEqual(self, B.class_traits(), expected) expected.extend(('lst', 'y')) ...
test_all_class_traits
identifier_name
test_class_traits.py
""" Unit tests for the `HasTraits.class_traits` class function. """ from __future__ import absolute_import from traits import _py2to3 from traits.testing.unittest_tools import unittest from ..api import HasTraits, Int, List, Str class A(HasTraits): x = Int name = Str(marked=True) class B(A): pas...
def test_class_traits_with_metadata(self): # Retrieve all traits that have the `marked` metadata # attribute set to True. traits = C.class_traits(marked=True) _py2to3.assertCountEqual(self, traits.keys(), ('y', 'name')) # Retrieve all traits that have a `marked` metadata ...
expected = ['x', 'name', 'trait_added', 'trait_modified'] _py2to3.assertCountEqual(self, A.class_traits(), expected) # Check that derived classes report the correct traits. _py2to3.assertCountEqual(self, B.class_traits(), expected) expected.extend(('lst', 'y')) _py2to3.assertCo...
identifier_body
test_class_traits.py
""" Unit tests for the `HasTraits.class_traits` class function. """ from __future__ import absolute_import from traits import _py2to3 from traits.testing.unittest_tools import unittest from ..api import HasTraits, Int, List, Str class A(HasTraits): x = Int name = Str(marked=True) class B(A): pas...
class C(B): lst = List(marked=False) y = Int(marked=True) class TestClassTraits(unittest.TestCase): def test_all_class_traits(self): expected = ['x', 'name', 'trait_added', 'trait_modified'] _py2to3.assertCountEqual(self, A.class_traits(), expected) # Check that derived classes...
random_line_split
GadgetInstanceReceiver.ts
 import * as Home from "../../Contents/IndexedDB/Home"; import * as Personal from "../../Contents/IndexedDB/Personal"; import AbstractServiceReceiver from "../../Base/AbstractServiceReceiver"; import Sender from "../../Base/Container/Sender"; import GadgetInstanceController from "./GadgetInstanceController"; import ...
// キャスト情報の送信 if (sender.type === GetGadgetCastSettingSedner.ID) { this.Controller.CastSetting.status = this.Controller.View.CreateYouTubeStatus(); this.Controller.SwPeer.SendTo(conn, this.Controller.CastSetting); } // YouTubeの再生状況の送信 if (sender.type == ...
this.Controller.Guide = guide; this.Controller.View.SetGuide(guide, true); }
random_line_split
GadgetInstanceReceiver.ts
 import * as Home from "../../Contents/IndexedDB/Home"; import * as Personal from "../../Contents/IndexedDB/Personal"; import AbstractServiceReceiver from "../../Base/AbstractServiceReceiver"; import Sender from "../../Base/Container/Sender"; import GadgetInstanceController from "./GadgetInstanceController"; import ...
onn: PeerJs.DataConnection, sender: Sender) { // カーソル表示 if (sender.type === IconCursorSender.ID) { if (this.Controller.CastSetting.dispUserCursor) { let cursor = sender as IconCursorSender; this.Controller.CursorCache.Set(cursor); this.Contro...
ceive(c
identifier_name
GadgetInstanceReceiver.ts
 import * as Home from "../../Contents/IndexedDB/Home"; import * as Personal from "../../Contents/IndexedDB/Personal"; import AbstractServiceReceiver from "../../Base/AbstractServiceReceiver"; import Sender from "../../Base/Container/Sender"; import GadgetInstanceController from "./GadgetInstanceController"; import ...
sender.type === RoomSender.ID) { this.Controller.CastRoom = sender as RoomSender; this.Controller.View.SetRoomName(this.Controller.CastRoom.room); } if (sender.type === GuideSender.ID) { let guide = (sender as GuideSender).guide; this.Controller.Guide = g...
if (this.Controller.CastSetting.dispUserCursor) { let cursor = sender as IconCursorSender; this.Controller.CursorCache.Set(cursor); this.Controller.SwPeer.SendAll(sender); } } if (
conditional_block
into_iter.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::option::IntoIter; // #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] // #[stable(feature = "rust1", since = "1.0.0")] // pub enum Option<T> { // /// No value // #[stable(feature = "rust1", since...
}
{ let x: Option<T> = None::<T>; let mut n: usize = 0; for v in x { n += 1; assert_eq!(v, "string"); } assert_eq!(n, 0); }
identifier_body
into_iter.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::option::IntoIter; // #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] // #[stable(feature = "rust1", since = "1.0.0")] // pub enum Option<T> { // /// No value // #[stable(feature = "rust1", since...
// Some(T) // } // impl<T> IntoIterator for Option<T> { // type Item = T; // type IntoIter = IntoIter<T>; // // /// Returns a consuming iterator over the possibly contained value. // /// // /// # Examples // /// // /// ``` // /// let x...
random_line_split
into_iter.rs
#![feature(core)] extern crate core; #[cfg(test)] mod tests { use core::option::IntoIter; // #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] // #[stable(feature = "rust1", since = "1.0.0")] // pub enum Option<T> { // /// No value // #[stable(feature = "rust1", since...
() { let x: Option<T> = None::<T>; let mut n: usize = 0; for v in x { n += 1; assert_eq!(v, "string"); } assert_eq!(n, 0); } }
into_iter_test4
identifier_name
gulpfile-advanced.js
var basePaths = { src: 'public/', dest: 'public.dist/', bower: 'bower_components/' }; var paths = { images: { src: basePaths.src + 'images/', dest: basePaths.dest + 'images/min/' }, scripts: { src: basePaths.src + 'scripts/', dest: basePaths.dest + 'scripts/min/' }, styles: { src: ba...
var isProduction = true; var sassStyle = 'compressed'; var sourceMap = false; if (gutil.env.dev === true) { sassStyle = 'expanded'; sourceMap = true; isProduction = false; } var changeEvent = function(evt) { gutil.log('File', gutil.colors.cyan(evt.path.replace(new RegExp('/.*(?=/' + basePaths.src + ')/'), '')...
// allows gulp --dev to be run for a more verbose output
random_line_split
gulpfile-advanced.js
var basePaths = { src: 'public/', dest: 'public.dist/', bower: 'bower_components/' }; var paths = { images: { src: basePaths.src + 'images/', dest: basePaths.dest + 'images/min/' }, scripts: { src: basePaths.src + 'scripts/', dest: basePaths.dest + 'scripts/min/' }, styles: { src: ba...
var changeEvent = function(evt) { gutil.log('File', gutil.colors.cyan(evt.path.replace(new RegExp('/.*(?=/' + basePaths.src + ')/'), '')), 'was', gutil.colors.magenta(evt.type)); }; gulp.task('css', function() { var sassFiles = gulp.src(appFiles.styles) /* .pipe(plugins.rubySass({ style: sassStyle, sourcem...
{ sassStyle = 'expanded'; sourceMap = true; isProduction = false; }
conditional_block
animals.js
const util = require('util'); let inherits = util.inherits; function
(name){ this.name = name; } Animal.prototype.walk = function(destination){ console.log(this.name, 'is walking to', destination); }; let animal = new Animal('elephant'); animal.walk('Melbourne'); // function Bird(name){ Animal.call(this, name); //Call the super constructor // } //Bird.prototype.__proto__ = Animal...
Animal
identifier_name
animals.js
const util = require('util'); let inherits = util.inherits; function Animal(name){ this.name = name; } Animal.prototype.walk = function(destination){ console.log(this.name, 'is walking to', destination); }; let animal = new Animal('elephant'); animal.walk('Melbourne'); // function Bird(name){ Animal.call(this, n...
console.log(foo.constructor === Foo); //--------------------- function Bird2(name){ Animal.call(this, name); } inherits(Bird2, Animal); //Discouraged by Node //---------------------- function Bird3(name){ Animal.call(this, name); } //Object.setPrototypeOf(Bird.prototype, Animal.prototype); Bird3.prototype = Obje...
random_line_split
animals.js
const util = require('util'); let inherits = util.inherits; function Animal(name)
Animal.prototype.walk = function(destination){ console.log(this.name, 'is walking to', destination); }; let animal = new Animal('elephant'); animal.walk('Melbourne'); // function Bird(name){ Animal.call(this, name); //Call the super constructor // } //Bird.prototype.__proto__ = Animal.prototype; //extend class O...
{ this.name = name; }
identifier_body
form.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
(self): return self._form def createForm(self, names=[]): # Text area for sending path data pathDataArea = webform.Textarea("", rows=30, cols=90, value="", id="pathData", hidden=True) form = webform.Form(pathDataArea) return form
form
identifier_name
form.py
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR ...
random_line_split
form.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
"""Form class""" def __init__(self, names=[]): self._form = self.createForm(names) self.httpConfig = httpconfig.HttpConfig(web.ctx.env["DOCUMENT_ROOT"]) @property def form(self): return self._form def createForm(self, names=[]): # Text area for sending path data ...
identifier_body
time.rs
use std::io::{self, Write}; use std::time::{Duration, Instant}; /// RAII timer to measure how long phases take. #[derive(Debug)] pub struct Timer<'a> { output: bool, name: &'a str, start: Instant, } impl<'a> Timer<'a> { /// Creates a Timer with the given name, and starts it. By default, /// will p...
/// Returns the time elapsed since the timer's creation pub fn elapsed(&self) -> Duration { Instant::now() - self.start } fn print_elapsed(&mut self) { if self.output { let elapsed = self.elapsed(); let time = (elapsed.as_secs() as f64) * 1e3 + ...
{ self.output = output; self }
identifier_body
time.rs
use std::io::{self, Write}; use std::time::{Duration, Instant}; /// RAII timer to measure how long phases take. #[derive(Debug)] pub struct Timer<'a> { output: bool, name: &'a str, start: Instant, } impl<'a> Timer<'a> { /// Creates a Timer with the given name, and starts it. By default, /// will p...
} } impl<'a> Drop for Timer<'a> { fn drop(&mut self) { self.print_elapsed(); } }
{ let elapsed = self.elapsed(); let time = (elapsed.as_secs() as f64) * 1e3 + (elapsed.subsec_nanos() as f64) / 1e6; let stderr = io::stderr(); // Arbitrary output format, subject to change. writeln!(stderr.lock(), " time: {:>9.3} ms.\t{}", ti...
conditional_block
time.rs
use std::io::{self, Write}; use std::time::{Duration, Instant}; /// RAII timer to measure how long phases take. #[derive(Debug)] pub struct Timer<'a> { output: bool, name: &'a str, start: Instant, } impl<'a> Timer<'a> { /// Creates a Timer with the given name, and starts it. By default, /// will p...
pub fn with_output(mut self, output: bool) -> Self { self.output = output; self } /// Returns the time elapsed since the timer's creation pub fn elapsed(&self) -> Duration { Instant::now() - self.start } fn print_elapsed(&mut self) { if self.output { ...
/// Sets whether or not the Timer will print a message /// when it is dropped.
random_line_split
time.rs
use std::io::{self, Write}; use std::time::{Duration, Instant}; /// RAII timer to measure how long phases take. #[derive(Debug)] pub struct Timer<'a> { output: bool, name: &'a str, start: Instant, } impl<'a> Timer<'a> { /// Creates a Timer with the given name, and starts it. By default, /// will p...
(name: &'a str) -> Self { Timer { output: true, name, start: Instant::now(), } } /// Sets whether or not the Timer will print a message /// when it is dropped. pub fn with_output(mut self, output: bool) -> Self { self.output = output; ...
new
identifier_name
en-gb.js
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'colorbutton', 'en-gb', { auto: 'Automatic', bgColorTitle: 'Background Colour', colors: { '000': 'Black', '800000': 'Maroon', '8B...
'00FF00': 'Lime', AFEEEE: 'Pale Turquoise', ADD8E6: 'Light Blue', DDA0DD: 'Plum', D3D3D3: 'Light Grey', FFF0F5: 'Lavender Blush', FAEBD7: 'Antique White', FFFFE0: 'Light Yellow', F0FFF0: 'Honeydew', F0FFFF: 'Azure', F0F8FF: 'Alice Blue', E6E6FA: 'Lavender', FFF: 'White' }, more...
FFA500: 'Orange', FFFF00: 'Yellow',
random_line_split
topologytemplate.ts
import { NodeTemplate } from './nodetemplate'; import { RelationshipTemplate } from './relationshiptemplate'; /******************************************************************************************************************************************************************************************************* * * @c...
{ id: number; name: string; nodeTemplates: NodeTemplate[]; relationshipTemplates: RelationshipTemplate[]; parentTopologyTemplate: TopologyTemplate; parentTopologyTemplateId: number; childTopologyTemplates: TopologyTemplate[]; abstractionLevel: number; constructor() { this.id = null; this...
TopologyTemplate
identifier_name
topologytemplate.ts
import { NodeTemplate } from './nodetemplate'; import { RelationshipTemplate } from './relationshiptemplate'; /******************************************************************************************************************************************************************************************************* * * @c...
* @field - parentTopologyTemplate: TopologyTemplate - Parent of the TopologyTemplate from which it was derived * @field - parentTopologyTemplateId: number - ID of the parent of the topology * @field - childTopologyTemplates: TopologyTemplate[] - Array of child of the TopologyTemplate. Child are all TopologyTemplate ...
* @field - nodeTemplates: NodeTemplate[] - Array of all NodeTemplates in the LevelGraph * @field - relationshipTemplates: RelationshipTemplate[] - Array of all RelationshipTemplates in the LevelGraph
random_line_split
flexbox_sub_layout.rs
/*! A very simple application that show how to use a flexbox layout. Requires the following features: `cargo run --example flexbox --features "flexbox"` */ extern crate native_windows_gui as nwg; use nwg::NativeUi; #[derive(Default)] pub struct FlexBoxApp { window: nwg::Window, layout: nwg::FlexboxL...
impl FlexBoxApp { fn exit(&self) { nwg::stop_thread_dispatch(); } } // // ALL of this stuff is handled by native-windows-derive // mod flexbox_app_ui { use native_windows_gui as nwg; use super::*; use std::rc::Rc; use std::cell::RefCell; use std::ops::Deref; pub struct FlexB...
button1: nwg::Button, layout2: nwg::FlexboxLayout, button2: nwg::Button, button3: nwg::Button, }
random_line_split
flexbox_sub_layout.rs
/*! A very simple application that show how to use a flexbox layout. Requires the following features: `cargo run --example flexbox --features "flexbox"` */ extern crate native_windows_gui as nwg; use nwg::NativeUi; #[derive(Default)] pub struct FlexBoxApp { window: nwg::Window, layout: nwg::FlexboxL...
(mut data: FlexBoxApp) -> Result<FlexBoxAppUi, nwg::NwgError> { use nwg::Event as E; // Controls nwg::Window::builder() .size((500, 500)) .position((300, 300)) .title("Flexbox example") .build(&mut data.wind...
build_ui
identifier_name
flexbox_sub_layout.rs
/*! A very simple application that show how to use a flexbox layout. Requires the following features: `cargo run --example flexbox --features "flexbox"` */ extern crate native_windows_gui as nwg; use nwg::NativeUi; #[derive(Default)] pub struct FlexBoxApp { window: nwg::Window, layout: nwg::FlexboxL...
.build(&mut data.button2)?; nwg::Button::builder() .text("Btn 3") .parent(&data.window) .focus(true) .build(&mut data.button3)?; // Wrap-up let ui =FlexBoxAppUi { inner: Rc::new(data), ...
{ use nwg::Event as E; // Controls nwg::Window::builder() .size((500, 500)) .position((300, 300)) .title("Flexbox example") .build(&mut data.window)?; nwg::Button::builder() .tex...
identifier_body
island.js
/** * echarts组件:孤岛数据 * * @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。 * @author Kener (@Kener-林峰, linzhifeng@baidu.com) * */ define(function (require) { /** * 构造函数 * @param {Object} messageCenter echart消息中心 * @param {ZRender} zr zrender实例 * @param {Object} option 图表选项 ...
wHieght / (_zrHeight || newHieght); if (xScale == 1 && yScale == 1) { return; } _zrWidth = newWidth; _zrHeight = newHieght; for (var i = 0, l = self.shapeList.length; i < l; i++) { zr.modShape( self.shapeList...
e = ne
identifier_name
island.js
/** * echarts组件:孤岛数据 * * @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。 * @author Kener (@Kener-林峰, linzhifeng@baidu.com) * */ define(function (require) { /** * 构造函数 * @param {Object} messageCenter echart消息中心 * @param {ZRender} zr zrender实例 * @param {Object} option 图表选项 ...
self.shapeList[i].id, { style: { x: Math.round(self.shapeList[i].style.x * xScale), y: Math.round(self.shapeList[i].style.y * yScale) } } ); ...
zr.modShape(
conditional_block
island.js
/** * echarts组件:孤岛数据 * * @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。 * @author Kener (@Kener-林峰, linzhifeng@baidu.com) * */ define(function (require) { /** * 构造函数 * @param {Object} messageCenter echart消息中心 * @param {ZRender} zr zrender实例 * @param {Object} option 图表选项 ...
}; if (islandShape.style.color == '#fff') { islandShape.style.color = shape.style.strokeColor; } self.setCalculable(islandShape); ecData.pack( islandShape, {name:seriesName}, -1, value, -1, ...
ned' ? ecData.get(shape, 'series').name : ''; var font = self.getFont(option.island.textStyle); var islandShape = { shape : 'circle', id : zr.newShapeId(self.type), zlevel : _zlevelBase, ...
identifier_body
island.js
/** * echarts组件:孤岛数据 * * @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。 * @author Kener (@Kener-林峰, linzhifeng@baidu.com) * */ define(function (require) { /** * 构造函数 * @param {Object} messageCenter echart消息中心 * @param {ZRender} zr zrender实例 * @param {Object} option 图表选项 ...
// 拖拽的不是孤岛数据,如果没有图表接受孤岛数据,需要新增孤岛数据 if (!status.dragIn) { target.style.x = zrEvent.getX(param.event); target.style.y = zrEvent.getY(param.event); add(target); status.needRefresh = true; } ...
if (!self.isDragend) {
random_line_split
jquery.progressbar.js
/** * jQuery EasyUI 1.5 * * Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved. * * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php * To use it on other terms please contact us: info@jeasyui.com * */ (function($){ function _1(_2){ $(_2).addClass("progressbar"); $(_2)...
return $.extend({},$.parser.parseOptions(_12,["width","height","text",{value:"number"}])); }; $.fn.progressbar.defaults={width:"auto",height:22,value:0,text:"{value}%",onChange:function(_13,_14){ }}; })(jQuery);
}); }}; $.fn.progressbar.parseOptions=function(_12){
random_line_split
jquery.progressbar.js
/** * jQuery EasyUI 1.5 * * Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved. * * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php * To use it on other terms please contact us: info@jeasyui.com * */ (function($){ function _1(_2){ $(_2).addClass("progressbar"); $(_2)...
eturn jq.each(function(){ var _f=$.data(this,"progressbar").options; var _10=_f.text.replace(/{value}/,_e); var _11=_f.value; _f.value=_e; $(this).find("div.progressbar-value").width(_e+"%"); $(this).find("div.progressbar-text").html(_10); if(_11!=_e){ _f.onChange.call(this,_e,_11); } }); }}; $.fn.progressbar.parseOpti...
_e=100; } r
conditional_block
jquery.progressbar.js
/** * jQuery EasyUI 1.5 * * Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved. * * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php * To use it on other terms please contact us: info@jeasyui.com * */ (function($){ function _1(_2){
function _4(_5,_6){ var _7=$.data(_5,"progressbar").options; var _8=$.data(_5,"progressbar").bar; if(_6){ _7.width=_6; } _8._size(_7); _8.find("div.progressbar-text").css("width",_8.width()); _8.find("div.progressbar-text,div.progressbar-value").css({height:_8.height()+"px",lineHeight:_8.height()+"px"}); }; $.fn.progre...
$(_2).addClass("progressbar"); $(_2).html("<div class=\"progressbar-text\"></div><div class=\"progressbar-value\"><div class=\"progressbar-text\"></div></div>"); $(_2).bind("_resize",function(e,_3){ if($(this).hasClass("easyui-fluid")||_3){ _4(_2); } return false; }); return $(_2); };
identifier_body
jquery.progressbar.js
/** * jQuery EasyUI 1.5 * * Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved. * * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php * To use it on other terms please contact us: info@jeasyui.com * */ (function($){ function _1(_2){ $(_2).addClass("progressbar"); $(_2)...
5,_6){ var _7=$.data(_5,"progressbar").options; var _8=$.data(_5,"progressbar").bar; if(_6){ _7.width=_6; } _8._size(_7); _8.find("div.progressbar-text").css("width",_8.width()); _8.find("div.progressbar-text,div.progressbar-value").css({height:_8.height()+"px",lineHeight:_8.height()+"px"}); }; $.fn.progressbar=functio...
(_
identifier_name