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
mahalanobis.py
6.23, 34.61164, 22.15451], [13486.23, 36003.67, 33.8431, 30.52712], [34.61164, 33.8431, 0.4143354, 0.1125765], [22.15451, 30.52712, 0.1125765, 0.2592451]]), '42': np.matrix([[17034.35, 8582.368, 28.08871...
[9.032116, 47.59889, -0.000626268, 0.4513407]]), '64': np.matrix([[7020.379, 9304.635, 11.09179, 2.643800], [9304.635, 34884.03, -2.304886, -0.4383724], [11.09179, -2.304886, 0.3025123, 0.09179999], ...
random_line_split
group_resize.py
# # -*- coding: utf-8 -*- # Dia Group Resize Plugin # Copyright (c) 2015, Alexandre Machado <axmachado@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
(self, options): value = options['value'].get_text() for opt in 'ignore', 'smallest', 'largest', 'specify': if options[opt].get_active(): return (opt,value) return ('ignore',value) def getValue(self, opt, value, elProperty): if opt == 'specify': ...
getSelectedGroupOption
identifier_name
group_resize.py
# # -*- coding: utf-8 -*- # Dia Group Resize Plugin # Copyright (c) 2015, Alexandre Machado <axmachado@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
def adjustHeight(self, value): for obj in self.group: pos = obj.properties['obj_pos'].value if obj.properties.has_key("elem_height"): difference = value - obj.properties['elem_height'].value handleTop = obj.handles[1] handleBottom = o...
difference = value - obj.properties['elem_width'].value handleLeft = obj.handles[3] handleRight = obj.handles[4] amount = difference/2 obj.move_handle(handleLeft, (handleLeft.pos.x - amount, handleLeft.pos.y), 0, 0) obj.move_handle(handleRi...
conditional_block
group_resize.py
# # -*- coding: utf-8 -*- # Dia Group Resize Plugin # Copyright (c) 2015, Alexandre Machado <axmachado@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
pos = obj.properties['obj_pos'].value if obj.properties.has_key("elem_width"): difference = value - obj.properties['elem_width'].value handleLeft = obj.handles[3] handleRight = obj.handles[4] amount = difference/2 ob...
return max(values) def adjustWidth(self, value): for obj in self.group:
random_line_split
group_resize.py
# # -*- coding: utf-8 -*- # Dia Group Resize Plugin # Copyright (c) 2015, Alexandre Machado <axmachado@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
def dia_group_resize_db (data,flags): diagram = dia.active_display().diagram group = diagram.get_sorted_selected() if len(group) > 0: win = ResizeWindow(group, data) win.show() else: dia.message(gtk.MESSAGE_INFO, "Please select a group of objects") dia.register_action(...
return self.dlg.run()
identifier_body
MessageInputType.js
import { GraphQLInputObjectType, GraphQLID, GraphQLList, GraphQLBoolean, } from 'graphql'; import RecipientTypeEnum from './RecipientTypeEnum'; import MessageTypeEnum from './MessageTypeEnum'; import NoteInputType from './NoteInputType'; import TranslationInputType from './TranslationInputType'; import Communi...
}, recipients: { type: new GraphQLList(GraphQLID), }, recipientType: { type: RecipientTypeEnum }, messageType: { type: MessageTypeEnum }, }, }); export default MessageInputType;
random_line_split
text.rs
} /// Specify that the **Text** should not wrap lines around the width. pub fn no_line_wrap(mut self) -> Self { self.style.maybe_wrap = Some(None); self } /// Line wrap the **Text** at the beginning of the first word that exceeds the width. pub fn wrap_by_word(mut self) -> Self { ...
} /// Align the text to the right of its bounding **Rect**'s *x* axis range. pub fn align_text_right(mut self) -> Self { self.style.text_align = Some(Align::End); self } /// The height of the space used between consecutive lines. pub fn line_spacing(mut self, height: Scalar) ->...
/// Align the text to the middle of its bounding **Rect**'s *x* axis range. pub fn align_text_middle(mut self) -> Self { self.style.text_align = Some(Align::Middle); self
random_line_split
text.rs
/// Specify that the **Text** should not wrap lines around the width. pub fn no_line_wrap(mut self) -> Self { self.style.maybe_wrap = Some(None); self } /// Line wrap the **Text** at the beginning of the first word that exceeds the width. pub fn wrap_by_word(mut self) -> Self { ...
(&self) -> Style { self.style.clone() } /// If no specific width was given, we'll use the width of the widest line as a default. fn default_x_dimension<B: Backend>(&self, ui: &Ui<B>) -> Dimension { let font_size = self.style.font_size(&ui.theme); let mut max_width = 0.0; for...
style
identifier_name
text.rs
/// Specify that the **Text** should not wrap lines around the width. pub fn no_line_wrap(mut self) -> Self { self.style.maybe_wrap = Some(None); self } /// Line wrap the **Text** at the beginning of the first word that exceeds the width. pub fn wrap_by_word(mut self) -> Self { ...
{ self.style.font_size = Some(size); self }
identifier_body
packageMoveTest.ts
import { movePackage } from "@atomist/automation-client/operations/generate/java/javaProjectUtils"; import { InMemoryProject } from "@atomist/automation-client/project/mem/InMemoryProject"; import "mocha"; import * as assert from "power-assert"; import { AllKotlinFiles, inferFromKotlinSource } from "../../src/commands/...
assert(structure.applicationPackage === "com.smashing.pumpkins"); assert(structure.appClassFile.path === path); movePackage(p, structure.applicationPackage, "com.the.smiths", AllKotlinFiles) .then(_ => { assert(!p.findFileSync(path)); ...
); inferFromKotlinSource(p).then(structure => {
random_line_split
sprite.rs
#[derive(Copy, Clone, Eq, PartialEq)] pub enum Color { Navy, Green, Teal, Maroon, Purple, Brown, Gray, Dark, Blue, Lime, Aqua, Red, Pink, Yellow, White, } use self::Color::*; pub const NAVY: &'static [Color] = &[Navy]; pub const GREEN: &'static [Color] = &[Green]; pub const TEAL: &'static [Color] = &[T...
(appearance: u8, bright: bool) -> Self { Sprite { character: ('!' as u8 + (appearance & 0b00011111)) as char, color: match (appearance >> 5, bright) { (0b000, false) => DARK, (0b001, false) => NAVY, (0b010, false) => GREEN, ...
of_byte
identifier_name
sprite.rs
#[derive(Copy, Clone, Eq, PartialEq)] pub enum Color { Navy, Green, Teal, Maroon, Purple, Brown, Gray, Dark, Blue, Lime, Aqua, Red, Pink, Yellow, White, } use self::Color::*; pub const NAVY: &'static [Color] = &[Navy]; pub const GREEN: &'static [Color] = &[Green]; pub const TEAL: &'static [Color] = &[T...
pub const HIDDEN: Sprite = Sprite { character: ' ', color: DARK }; impl Sprite { pub fn of_byte(appearance: u8, bright: bool) -> Self { Sprite { character: ('!' as u8 + (appearance & 0b00011111)) as char, color: match (appearance >> 5, bright) { (0b000, false...
random_line_split
promi2.py
from utils import get_value_from_keycolonvalue_list, ensure_dir, random_string import features import mirna_proximity import correlation import gff_unify_features import promirna import plots usage = """- Runs promi2 EXAMPLE: python2.7 promi2.py -i ../test/test.gff -o ../Testout-promi2 - When the features.gff file ...
## PART2: extract parameters & run promirna f_prediction = os.path.join(outdir, 'Predictions.'+in_bname+'.txt') print 'COMPUTING: "%s"...' % f_prediction promi2(f_param, listoffeatures, gff_allfeatures, f_prediction) ## PART3: plots if make_plots: plotdir = os.path.join(outdir, 'plots...
gff_allfeatures = gff_cage with open(gff_allfeatures) as f: l = f.readline().split('\t') if not (':' in l[7]): sys.exit('ERROR: this is not a features.gff formatted file')
conditional_block
promi2.py
from utils import get_value_from_keycolonvalue_list, ensure_dir, random_string import features import mirna_proximity import correlation import gff_unify_features import promirna import plots usage = """- Runs promi2 EXAMPLE: python2.7 promi2.py -i ../test/test.gff -o ../Testout-promi2 - When the features.gff file ...
## merge extracted features (gff_unify_features.py) gff_features = os.path.join(outdir, 'Features.1kb.mprox.'+in_bname) gff_unify_features.main(gff_1kbfeatures, gff_mirnaprox, 'mirna_prox', '0', gff_features) if is_consider_corr: ## merge extracted features (gff_unify_featu...
mirna_proximity.main(gff_cage, gff_mirna, gff_mirnaprox)
random_line_split
promi2.py
from utils import get_value_from_keycolonvalue_list, ensure_dir, random_string import features import mirna_proximity import correlation import gff_unify_features import promirna import plots usage = """- Runs promi2 EXAMPLE: python2.7 promi2.py -i ../test/test.gff -o ../Testout-promi2 - When the features.gff file ...
def _make_prediction(prior_prom, p_prom, p_back): if str(prior_prom).endswith('*'): note = '*' else: note = '' if p_prom >= p_back: prediction = 'prom'+note else: prediction = 'back'+note return prediction def promi2(f_param, listoffeatures, infile, outfile): ...
params_dict = {} with open(f_param) as f: for l in f: k,v = l.strip().split(':') params_dict[k] = float(v) mu1 = params_dict['mu_promoter'] mu2 = params_dict['mu_background'] lambda1 = params_dict['lambda_promoter'] lambda2 = params_dict['lambda_background'] bet...
identifier_body
promi2.py
from utils import get_value_from_keycolonvalue_list, ensure_dir, random_string import features import mirna_proximity import correlation import gff_unify_features import promirna import plots usage = """- Runs promi2 EXAMPLE: python2.7 promi2.py -i ../test/test.gff -o ../Testout-promi2 - When the features.gff file ...
(infile, outfile): ## cleanup of extra positions ## compare miRNA positions in PROX & CORR with open(outfile, 'w') as out: with open(infile) as f: for line in f: l = line.split('\t') descript = l[8].split('@') if (descript[1] != '') and (d...
_cleanup_extra_positions
identifier_name
Avatar.tsx
import * as React from 'react'; import { addPropertyControls, ControlType } from 'framer'; // tslint:disable-next-line: ban-ts-ignore // @ts-ignore import MuiAvatar from '@material-ui/core/Avatar'; import { Icon } from './Icon'; interface Props { variant?: 'circle' | 'circular' | 'rounded' | 'square'; backgroundCo...
}, imageFile: { type: ControlType.Image, title: 'Image File', hidden: function hidden(props) { return props.primaryAction && props.primaryAction !== 'avatar'; }, }, imageUrl: { type: ControlType.String, title: 'Image URL', hidden: function hidden(props) { return props.ima...
title: 'Text color', }, icon: { type: ControlType.String, title: 'Icon',
random_line_split
ajax_windows.js
/* ajax_windows.js. Support for modal popup windows in Umlaut items. */ jQuery(document).ready(function($) { var populate_modal = function(data, textStatus, jqXHR) { // Wrap the data object in jquery object var body = $("<div/>").html(data); // Remove the first heading from the returned data var head...
var footer = body.find("form").find("input[type=submit]").eq(0).remove(); // Add in content if (header) $("#modal").find("[data-role=modal-title-content]").text(header.text()); if (body) $("#modal").find("[data-role=modal-body-content]").html(body.html()); if (footer) $("#modal").find("...
// Remove the first submit button from the returned data
random_line_split
postal.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from gramfuzz.fields import * import names TOP_CAT = "postal" # Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form # The name rules have been modified and placed into names.py class
(Def): cat = "postal_def" class PRef(Ref): cat = "postal_def" EOL = "\n" # this will be the top-most rule Def("postal_address", PRef("name-part"), PRef("street-address"), PRef("zip-part"), cat="postal") # these will be the grammar rules that should not be randomly generated # as a top-level rule PDef("...
PDef
identifier_name
postal.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from gramfuzz.fields import * import names TOP_CAT = "postal" # Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form # The name rules have been modified and placed into names.py class PDef(Def): cat = "postal_def" class PRef(Ref): cat = "pos...
# this will be the top-most rule Def("postal_address", PRef("name-part"), PRef("street-address"), PRef("zip-part"), cat="postal") # these will be the grammar rules that should not be randomly generated # as a top-level rule PDef("name-part", Ref("name", cat=names.TOP_CAT), EOL ) PDef("street-address", P...
EOL = "\n"
random_line_split
postal.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from gramfuzz.fields import * import names TOP_CAT = "postal" # Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form # The name rules have been modified and placed into names.py class PDef(Def):
class PRef(Ref): cat = "postal_def" EOL = "\n" # this will be the top-most rule Def("postal_address", PRef("name-part"), PRef("street-address"), PRef("zip-part"), cat="postal") # these will be the grammar rules that should not be randomly generated # as a top-level rule PDef("name-part", Ref("name", ...
cat = "postal_def"
identifier_body
gen.rs
} pub fn parse_from_base64(base64: &[&str]) -> Self { GenePool { gene_pool: base64 .iter() .map(|s| s.from_base64().unwrap().into_boxed_slice()) .collect::<Vec<_>>() .into_boxed_slice(), round_robin: 0, } } pub fn parse_from_resource(data: &[u8]) -> Self { let mut gene_pool = Vec::new(...
(&mut self, upside_down: bool) -> Shape { let n = self.next_integer(3, MAX_POLY_SIDES); self.npoly(n, upside_down) } fn any_poly(&mut self) -> Shape { let n = self.next_integer(3, MAX_POLY_SIDES); let upside_down = self.next_bool(); self.npoly(n, upside_down) } fn npoly(&mut self, n: AttachmentIndex, up...
poly
identifier_name
gen.rs
} pub fn parse_from_base64(base64: &[&str]) -> Self { GenePool { gene_pool: base64 .iter() .map(|s| s.from_base64().unwrap().into_boxed_slice()) .collect::<Vec<_>>() .into_boxed_slice(), round_robin: 0, } } pub fn parse_from_resource(data: &[u8]) -> Self { let mut gene_pool = Vec::new(...
else { Shape::new_star(n, corrected_radius, ratio1, ratio2) } } } } #[allow(dead_code)] pub struct Randomizer<R> where R: rand::Rng { rng: R, } #[allow(dead_code)] impl Randomizer<rand::ThreadRng> { pub fn new() -> Randomizer<rand::ThreadRng> { Randomizer { rng: rand::thread_rng() } } } impl Generator f...
{ Shape::new_star(n, corrected_radius, ratio2, ratio1) }
conditional_block
gen.rs
; } pub fn parse_from_base64(base64: &[&str]) -> Self { GenePool { gene_pool: base64 .iter() .map(|s| s.from_base64().unwrap().into_boxed_slice()) .collect::<Vec<_>>() .into_boxed_slice(), round_robin: 0, } } pub fn parse_from_resource(data: &[u8]) -> Self { let mut gene_pool = Vec::ne...
Shape::new_star(n, radius, ratio1, ratio2) } fn poly(&mut self, upside_down: bool) -> Shape { let n = self.next_integer(3, MAX_POLY_SIDES); self.npoly(n, upside_down) } fn any_poly(&mut self) -> Shape { let n = self.next_integer(3, MAX_POLY_SIDES); let upside_down = self.next_bool(); self.npoly(n, ups...
// if pie slices are too small physics freaks out let n = self.next_integer(3, if radius > 1.5 { MAX_POLY_SIDES } else { MAX_POLY_SIDES - 2 }); let ratio1 = self.next_float(0.5, 1.0); let ratio2 = self.next_float(0.7, 0.9) * (1. / ratio1);
random_line_split
type-path-err-node-types.rs
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn ufcs_item() { NonExistent::Assoc::<u8>; //~ ERROR undeclared type or module `NonExistent` } fn method() { nonexistent.nonexistent::<u8>(); //~ ERROR cannot find value `nonexistent` } fn closure() { let _ = |a, b: _| -> _ { 0 }; // OK } fn main() {}
{ <u8 as Tr<u8>>::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent` }
identifier_body
type-path-err-node-types.rs
// Copyright 2017 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 ...
nonexistent.nonexistent::<u8>(); //~ ERROR cannot find value `nonexistent` } fn closure() { let _ = |a, b: _| -> _ { 0 }; // OK } fn main() {}
random_line_split
type-path-err-node-types.rs
// Copyright 2017 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 ...
() { <u8 as Tr<u8>>::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent` } fn ufcs_item() { NonExistent::Assoc::<u8>; //~ ERROR undeclared type or module `NonExistent` } fn method() { nonexistent.nonexistent::<u8>(); //~ ERROR cannot find value `nonexistent` } fn closure() { ...
ufcs_trait
identifier_name
role.rs
use std::cmp::Ordering; use std::fmt::{Display, Formatter, Result as FmtResult}; use model::*; #[cfg(feature = "cache")] use CACHE; #[cfg(all(feature = "builder", feature = "cache", feature = "model"))] use builder::EditRole; #[cfg(feature = "cache")] use internal::prelude::*; #[cfg(all(feature = "cache", feature = "m...
/// Checks whether the role has all of the given permissions. /// /// The 'precise' argument is used to check if the role's permissions are /// precisely equivalent to the given permissions. If you need only check /// that the role has at least the given permissions, pass `false`. pub fn has_per...
#[inline] pub fn has_permission(&self, permission: Permissions) -> bool { self.permissions.contains(permission) }
random_line_split
role.rs
use std::cmp::Ordering; use std::fmt::{Display, Formatter, Result as FmtResult}; use model::*; #[cfg(feature = "cache")] use CACHE; #[cfg(all(feature = "builder", feature = "cache", feature = "model"))] use builder::EditRole; #[cfg(feature = "cache")] use internal::prelude::*; #[cfg(all(feature = "cache", feature = "m...
} impl<'a> From<&'a Role> for RoleId { /// Gets the Id of a role. fn from(role: &Role) -> RoleId { role.id } }
{ role.id }
identifier_body
role.rs
use std::cmp::Ordering; use std::fmt::{Display, Formatter, Result as FmtResult}; use model::*; #[cfg(feature = "cache")] use CACHE; #[cfg(all(feature = "builder", feature = "cache", feature = "model"))] use builder::EditRole; #[cfg(feature = "cache")] use internal::prelude::*; #[cfg(all(feature = "cache", feature = "m...
(&self, other: &Role) -> Option<Ordering> { Some(self.cmp(other)) } } #[cfg(feature = "model")] impl RoleId { /// Search the cache for the role. #[cfg(feature = "cache")] pub fn find(&self) -> Option<Role> { let cache = CACHE.read().unwrap(); for guild in cache.guilds.values() { ...
partial_cmp
identifier_name
role.rs
use std::cmp::Ordering; use std::fmt::{Display, Formatter, Result as FmtResult}; use model::*; #[cfg(feature = "cache")] use CACHE; #[cfg(all(feature = "builder", feature = "cache", feature = "model"))] use builder::EditRole; #[cfg(feature = "cache")] use internal::prelude::*; #[cfg(all(feature = "cache", feature = "m...
if let Some(role) = guild.roles.get(self) { return Some(role.clone()); } } None } } impl Display for RoleId { fn fmt(&self, f: &mut Formatter) -> FmtResult { Display::fmt(&self.0, f) } } impl From<Role> for RoleId { /// Gets the Id of a role. ...
{ continue; }
conditional_block
vaesenc.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn
() { run_test(&Instruction { mnemonic: Mnemonic::VAESENC, operand1: Some(Direct(XMM0)), operand2: Some(Direct(XMM2)), operand3: Some(Direct(XMM6)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 226, 105, 220, 198], OperandSize::Dword) } fn vae...
vaesenc_1
identifier_name
vaesenc.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn vaesenc_1() { run_test(&Instruction { mnemonic: Mnemonic::VAESENC, operand1: Some(Direct(XMM0)), operand2: Some(Direct(...
run_test(&Instruction { mnemonic: Mnemonic::VAESENC, operand1: Some(Direct(XMM0)), operand2: Some(Direct(XMM7)), operand3: Some(Indirect(EDI, Some(OperandSize::Xmmword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[196, 226, 65, 220, 7], Op...
fn vaesenc_2() {
random_line_split
vaesenc.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn vaesenc_1() { run_test(&Instruction { mnemonic: Mnemonic::VAESENC, operand1: Some(Direct(XMM0)), operand2: Some(Direct(...
{ run_test(&Instruction { mnemonic: Mnemonic::VAESENC, operand1: Some(Direct(XMM7)), operand2: Some(Direct(XMM4)), operand3: Some(IndirectScaledIndexedDisplaced(RDX, RAX, Two, 1425141855, Some(OperandSize::Xmmword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, ...
identifier_body
on-changes-with-param.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { NgModule, Component, Input, OnChanges, SimpleChange, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {FormsModule} from '@angular/forms'; interface IChanges {[key: string]: Sim...
{ } platformBrowserDynamic().bootstrapModule(AppModule);
AppModule
identifier_name
on-changes-with-param.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { NgModule, Component, Input, OnChanges, SimpleChange, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {FormsModule} from '@angular/forms'; interface IChanges {[key: string]: Sim...
platformBrowserDynamic().bootstrapModule(AppModule);
imports: [ BrowserModule, FormsModule], declarations: [ AppComponent, ChildComponent], bootstrap: [ AppComponent ] }) class AppModule { }
random_line_split
pbrt.rs
use std::str::{self, FromStr}; use nom::{digit, space}; use linalg::vector::Vector3; use linalg::transform::Transform; named!(unsigned_float<f64>, map_res!( map_res!( recognize!( alt_complete!( delimited!(digit, tag!("."), opt!(complete!(digit))) | delimited!(opt!(digit), tag!("."), digit...
() { assert_eq!(signed_float(&b"134"[..]), Done(&b""[..], 134.0)); assert_eq!(signed_float(&b"-1234."[..]), Done(&b""[..], -1234.0)); assert_eq!(signed_float(&b"0.145"[..]), Done(&b""[..], 0.145)); assert_eq!(signed_float(&b"-2.45"[..]), Done(&b""[..], -2.45)); } #[test] ...
test_signed_float
identifier_name
pbrt.rs
use std::str::{self, FromStr}; use nom::{digit, space}; use linalg::vector::Vector3; use linalg::transform::Transform; named!(unsigned_float<f64>, map_res!( map_res!( recognize!( alt_complete!( delimited!(digit, tag!("."), opt!(complete!(digit))) | delimited!(opt!(digit), tag!("."), digit...
z: signed_float >> (Vector3::new(x, y, z)) )); named!(look_at<Transform>, do_parse!( tag!("LookAt") >> space >> eye: vector3 >> space >> look: vector3 >> space >> up: vector3 >> (Transform::look_at(eye, look, up)) )); named!(transformation<Trans...
space >> y: signed_float >> space >>
random_line_split
pbrt.rs
use std::str::{self, FromStr}; use nom::{digit, space}; use linalg::vector::Vector3; use linalg::transform::Transform; named!(unsigned_float<f64>, map_res!( map_res!( recognize!( alt_complete!( delimited!(digit, tag!("."), opt!(complete!(digit))) | delimited!(opt!(digit), tag!("."), digit...
}
{ assert_eq!( look_at(&b"LookAt 0 10 100 0 -1 0 0 1 0"[..]), Done( &b""[..], Transform::look_at( Vector3::new(0.0, 10.0, 100.0), Vector3::new(0.0, -1.0, 0.0), Vector3::new(0.0, 1.0, 0.0) ...
identifier_body
jquery.lightbox.js
Size * 2)); // Plus the image´s width and the left and right padding value var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image´s height and the left and right padding value // Diferences var intDiffW = intCurrentWidth - intWidth; var intDiffH = intCurrentHeight - int...
eHeight = yScroll; } // for
conditional_block
jquery.lightbox.js
MatchedObj = this; // This, in this context, refer to jQuery object /** * Initializing the plugin calling the start function * * @return boolean false */ function _
) { _start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked return false; // Avoid the browser following the link } /** * Start the jQuery lightBox plugin * * @param object objClicked The object (link) whick the user have clicked * @param...
initialize(
identifier_name
jquery.lightbox.js
-lightbox').css({ // If the shrinkToFit feature is enabled, the shrinkPadding property is used. If not, top is 10th of the page height top: arrPageScroll[1] + (settings.shrinkToFit ? settings.shrinkPadding : arrPageSizes[3] / 10), left: arrPageScroll[0] }); }; /** * Perfom an effect in the im...
(settings.imageArray.length -1) > settings.activeImage ) { objNext = new Image(); objNext.src = settings.imageArray[settings.activeImage + 1][0]; } if ( settings.activeImage > 0 ) { objPrev = new Image(); objPrev.src = settings.imageArray[settings.activeImage -1][0]; } } /**
identifier_body
jquery.lightbox.js
used. If not, top is 10th of the page height top: arrPageScroll[1] + (settings.shrinkToFit ? settings.shrinkPadding : arrPageSizes[3] / 10), left: arrPageScroll[0] }); }; /** * Perfom an effect in the image container resizing it * * @param integer intImageWidth The image´s width that wil...
* Remove jQuery lightBox plugin HTML markup * */ function _finish() {
random_line_split
noUndecoratedClassWithNgFieldsRule.ts
import * as Lint from 'tslint'; import * as ts from 'typescript'; const RULE_FAILURE = `Undecorated class defines fields with Angular decorators. Undecorated ` + `classes with Angular fields cannot be extended in Ivy since no definition is generated. ` + `Add a "@Directive" decorator to fix this.`; /** * Rule th...
const decl = symbol.declarations[0]; if (!ts.isImportSpecifier(decl)) { return null; } const importDecl = decl.parent.parent.parent; const moduleSpecifier = importDecl.moduleSpecifier; return ts.isStringLiteral(moduleSpecifier) ? moduleSpecifier.text : null; } }
{ return null; }
conditional_block
noUndecoratedClassWithNgFieldsRule.ts
import * as Lint from 'tslint'; import * as ts from 'typescript'; const RULE_FAILURE = `Undecorated class defines fields with Angular decorators. Undecorated ` + `classes with Angular fields cannot be extended in Ivy since no definition is generated. ` + `Add a "@Directive" decorator to fix this.`; /** * Rule th...
} } } /** Checks if the specified node has an Angular decorator. */ private _hasAngularDecorator(node: ts.Node): boolean { return !!node.decorators && node.decorators.some(d => { if (!ts.isCallExpression(d.expression) || !ts.isIdentifier(d.expression.expression)) { return fals...
for (let member of node.members) { if (member.decorators && this._hasAngularDecorator(member)) { this.addFailureAtNode(node, RULE_FAILURE); return;
random_line_split
noUndecoratedClassWithNgFieldsRule.ts
import * as Lint from 'tslint'; import * as ts from 'typescript'; const RULE_FAILURE = `Undecorated class defines fields with Angular decorators. Undecorated ` + `classes with Angular fields cannot be extended in Ivy since no definition is generated. ` + `Add a "@Directive" decorator to fix this.`; /** * Rule th...
(node: ts.ClassDeclaration) { if (this._hasAngularDecorator(node)) { return; } for (let member of node.members) { if (member.decorators && this._hasAngularDecorator(member)) { this.addFailureAtNode(node, RULE_FAILURE); return; } } } /** Checks if the specified nod...
visitClassDeclaration
identifier_name
noUndecoratedClassWithNgFieldsRule.ts
import * as Lint from 'tslint'; import * as ts from 'typescript'; const RULE_FAILURE = `Undecorated class defines fields with Angular decorators. Undecorated ` + `classes with Angular fields cannot be extended in Ivy since no definition is generated. ` + `Add a "@Directive" decorator to fix this.`; /** * Rule th...
/** Gets the module import of the given identifier if imported. */ private _getModuleImportOfIdentifier(node: ts.Identifier): string | null { const symbol = this._typeChecker.getSymbolAtLocation(node); if (!symbol || !symbol.declarations || !symbol.declarations.length) { return null; } const...
{ return !!node.decorators && node.decorators.some(d => { if (!ts.isCallExpression(d.expression) || !ts.isIdentifier(d.expression.expression)) { return false; } const moduleImport = this._getModuleImportOfIdentifier(d.expression.expression); return moduleImport ? moduleImpor...
identifier_body
plane.rs
// Copyright GFX Developers 2014-2017 // // 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 ...
self.x = 0; } let x = self.vert(self.x, self.y); let y = self.vert(self.x + 1, self.y); let z = self.vert(self.x + 1, self.y + 1); let w = self.vert(self.x, self.y + 1); self.x += 1; Some(Quad::new(x, y, z, w)) } } impl SharedVertex<Vertex> for...
{ return None; }
conditional_block
plane.rs
// Copyright GFX Developers 2014-2017 // // 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 ...
} #[test] fn test_shared_vertex_count() { let plane = Plane::new(); assert_eq!(plane.shared_vertex_count(), 4); assert_eq!(plane.indexed_polygon_count(), 1); let plane = Plane::subdivide(2, 2); assert_eq!(plane.shared_vertex_count(), 9); assert_eq!(plane.indexed_polygon_count(), 4); let...
{ self.subdivide_x * self.subdivide_y }
identifier_body
plane.rs
// Copyright GFX Developers 2014-2017 // // 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 ...
(&self) -> usize { self.subdivide_x * self.subdivide_y } } #[test] fn test_shared_vertex_count() { let plane = Plane::new(); assert_eq!(plane.shared_vertex_count(), 4); assert_eq!(plane.indexed_polygon_count(), 1); let plane = Plane::subdivide(2, 2); assert_eq!(plane.shared_vertex_coun...
indexed_polygon_count
identifier_name
plane.rs
// Copyright GFX Developers 2014-2017 // // 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 ...
Some(Quad::new(x, y, z, w)) } } impl SharedVertex<Vertex> for Plane { fn shared_vertex(&self, idx: usize) -> Vertex { let y = idx / (self.subdivide_x + 1); let x = idx % (self.subdivide_x + 1); self.vert(x, y) } fn shared_vertex_count(&self) -> usize { (self.s...
let y = self.vert(self.x + 1, self.y); let z = self.vert(self.x + 1, self.y + 1); let w = self.vert(self.x, self.y + 1); self.x += 1;
random_line_split
union-ub-fat-ptr.rs
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//~^ ERROR it is undefined behavior to use this value fn main() { }
const J2: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str };
random_line_split
union-ub-fat-ptr.rs
// Copyright 2018 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 ...
{ ptr: *const u8, len: &'static u8, } union SliceTransmute { repr: SliceRepr, bad: BadSliceRepr, slice: &'static [u8], str: &'static str, my_str: &'static MyStr, my_slice: &'static MySliceBool, } #[repr(C)] #[derive(Copy, Clone)] struct DynRepr { ptr: *const u8, vtable: *const...
BadSliceRepr
identifier_name
union-ub-fat-ptr.rs
// Copyright 2018 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 ...
{ }
identifier_body
xoshiro128plusplus.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
(&mut self) -> u64 { next_u64_via_u32(self) } #[inline] fn fill_bytes(&mut self, dest: &mut [u8]) { fill_bytes_via_next(self, dest); } #[inline] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.fill_bytes(dest); Ok(()) } } #[cfg(tes...
next_u64
identifier_name
xoshiro128plusplus.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
#[inline] fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.fill_bytes(dest); Ok(()) } } #[cfg(test)] mod tests { use super::*; #[test] fn reference() { let mut rng = Xoshiro128PlusPlus::from_seed( [1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, ...
{ fill_bytes_via_next(self, dest); }
identifier_body
xoshiro128plusplus.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
let mut state = [0; 4]; read_u32_into(&seed, &mut state); Xoshiro128PlusPlus { s: state } } /// Create a new `Xoshiro128PlusPlus` from a `u64` seed. /// /// This uses the SplitMix64 generator internally. fn seed_from_u64(mut state: u64) -> Self { const PHI: u64 = 0x...
{ return Self::seed_from_u64(0); }
conditional_block
xoshiro128plusplus.rs
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
mod tests { use super::*; #[test] fn reference() { let mut rng = Xoshiro128PlusPlus::from_seed( [1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0]); // These values were produced with the reference implementation: // http://xoshiro.di.unimi.it/xoshiro128plusplus.c ...
} #[cfg(test)]
random_line_split
da-events.factory.js
/** * da-events is included in starter-kit * it's a simple event listener that can register and trigger callbacks * based on events that are triggered through its methods */ module.exports = ngModule => { function daEvents($rootScope, $q, $log, SAMPLE_APP) { // central place for documenting app events con...
$log.error('No event registered with name: ' + name); return null; }, /** * Triggers an event that has been defined in `eventRegistry` object. * @param {string} name Name of event to trigger. Must be defined first. * @param {[.]} args Args to pass to callback. ...
{ return $rootScope.$on(name, listener); }
conditional_block
da-events.factory.js
/** * da-events is included in starter-kit * it's a simple event listener that can register and trigger callbacks * based on events that are triggered through its methods */ module.exports = ngModule => { function daEvents($rootScope, $q, $log, SAMPLE_APP) { // central place for documenting app events con...
, /** * Triggers an event that has been defined in `eventRegistry` object. * @param {string} name Name of event to trigger. Must be defined first. * @param {[.]} args Args to pass to callback. * @return {[type]} [description] */ trigger(name, args) { if (...
{ if (_eventRegistry.hasOwnProperty(name)) { return $rootScope.$on(name, listener); } $log.error('No event registered with name: ' + name); return null; }
identifier_body
da-events.factory.js
/** * da-events is included in starter-kit * it's a simple event listener that can register and trigger callbacks * based on events that are triggered through its methods */ module.exports = ngModule => { function daEvents($rootScope, $q, $log, SAMPLE_APP) { // central place for documenting app events con...
(name, listener) { if (_eventRegistry.hasOwnProperty(name)) { return $rootScope.$on(name, listener); } $log.error('No event registered with name: ' + name); return null; }, /** * Triggers an event that has been defined in `eventRegistry` object. * @par...
on
identifier_name
da-events.factory.js
/** * da-events is included in starter-kit * it's a simple event listener that can register and trigger callbacks * based on events that are triggered through its methods */ module.exports = ngModule => { function daEvents($rootScope, $q, $log, SAMPLE_APP) { // central place for documenting app events con...
};
random_line_split
sr_masterctl.rs
// SairaDB - A distributed database // Copyright (C) 2015 by Siyu Wang // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later ver...
fn master_connection() { }
{ let addr: &str = &(ip + ":" + &port); let count = Arc::new(AtomicUsize::new(0)); loop { let stream = TcpStream::connect(addr); //match stream.write_all(cookie.as_bytes()); } }
identifier_body
sr_masterctl.rs
// SairaDB - A distributed database // Copyright (C) 2015 by Siyu Wang // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later ver...
(ip: String, port: String, vnodes: Arc<Vec<u64>>, cookie: String, log_sender: Sender<String>) { let addr: &str = &(ip + ":" + &port); let count = Arc::new(AtomicUsize::new(0)); loop { let stream = TcpStream::connect(addr); //match stream.write_all(cookie.as_bytes()); ...
master_task
identifier_name
sr_masterctl.rs
// SairaDB - A distributed database // Copyright (C) 2015 by Siyu Wang // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later ver...
let stream = TcpStream::connect(addr); //match stream.write_all(cookie.as_bytes()); } } fn master_connection() { }
let addr: &str = &(ip + ":" + &port); let count = Arc::new(AtomicUsize::new(0)); loop {
random_line_split
package.js
Package.describe({ name: 'eahefnawy:accounts-coinbase', summary: 'A Meteor loginWithCoinbase Functionality.', version: '0.0.1-plugins.0', git: 'https://github.com/eahefnawy/accounts-coinbase.git', }); Package.onUse(function(api) { api.use('oauth2@1.1.3', ['client', 'server']); api.use('oauth@1.1.4', ['clie...
api.addFiles('coinbase.js'); });
random_line_split
Logger.js
function Logger () { } Logger.getBeats = function (attacker, defender) { return attacker.role.title + attacker.name + (attacker.weapon.name? '用' + attacker.weapon.name: '') + '攻击了' + defender.role.title + defender.name + ', '; }; Logger.getDetails = function (attacker, defender, damage, extra) { var mainBody = de...
} return ''; }; Logger.getDeath = function (player) { return player.name + '被打败了.'; }; Logger.getForward = function (attacker, defender) { return attacker.name + '靠近了' + defender.name + '.'; };
if(effect.double) { return attacker.name + '发动了连击, ' + defender.name + '受到了' + damage[0] + '点伤害, '; } if(effect.defence) { return defender.name + '发动了隔挡反击, ' + attacker.name + '受到了' + damage[1] + '点伤害, ';
random_line_split
Logger.js
function Logger ()
Logger.getBeats = function (attacker, defender) { return attacker.role.title + attacker.name + (attacker.weapon.name? '用' + attacker.weapon.name: '') + '攻击了' + defender.role.title + defender.name + ', '; }; Logger.getDetails = function (attacker, defender, damage, extra) { var mainBody = defender.name + '受到了' + ...
{ }
identifier_body
Logger.js
function Logger () { } Logger.getBeats = function (attacker, defender) { return attacker.role.title + attacker.name + (attacker.weapon.name? '用' + attacker.weapon.name: '') + '攻击了' + defender.role.title + defender.name + ', '; }; Logger.getDetails = function (attacker, defender, damage, extra) { var mainBody = de...
(player) { return player.name + '被打败了.'; }; Logger.getForward = function (attacker, defender) { return attacker.name + '靠近了' + defender.name + '.'; };
ame + '发动了隔挡反击, ' + attacker.name + '受到了' + damage[1] + '点伤害, '; } return ''; }; Logger.getDeath = function
conditional_block
Logger.js
function
() { } Logger.getBeats = function (attacker, defender) { return attacker.role.title + attacker.name + (attacker.weapon.name? '用' + attacker.weapon.name: '') + '攻击了' + defender.role.title + defender.name + ', '; }; Logger.getDetails = function (attacker, defender, damage, extra) { var mainBody = defender.name + '...
Logger
identifier_name
age.js
import config from '../components/configLoader'; import { addToDefaultPluginDOM } from '../components/helpers'; const pluginConfig = config.plugins.find(obj => obj.name === 'age'); // DOM setup
addToDefaultPluginDOM(pluginId); const ageDOM = document.getElementById(pluginId); const renderAge = () => { const { birthday, goal } = pluginConfig; // Inspired by: // Alex MacCaw https://github.com/maccman/motivation const now = new Date(); const age = (now - new Date(birthday)) / 3.1556952e+10; // divid...
const pluginId = 'js-plugin-age';
random_line_split
age.js
import config from '../components/configLoader'; import { addToDefaultPluginDOM } from '../components/helpers'; const pluginConfig = config.plugins.find(obj => obj.name === 'age'); // DOM setup const pluginId = 'js-plugin-age'; addToDefaultPluginDOM(pluginId); const ageDOM = document.getElementById(pluginId); con...
ageDOM.innerHTML = `Age: ${age.toFixed(5)}, ${remainder.toFixed(2)}% ${goalPrefix} ${goal}`; }; // Initialize plugin export const init = () => renderAge(); // eslint-disable-line import/prefer-default-export
{ goalPrefix = 'over goal of'; remainder = -remainder; }
conditional_block
spiralOutFast.py
from pattern import Pattern import copy import numpy as np import random import collections #from scipy.signal import convolve2d import time from collections import deque class SpiralOutFast(Pattern): def
(self): self.register_param("r_leak", 0, 3, 1.2) self.register_param("g_leak", 0, 3, 1.7) self.register_param("b_leak", 0, 3, 2) self.register_param("speed", 0, 1 , 0) #Initialise time and color history self.t = [0,0] self.r = [0,0] self.g = [0,0] ...
__init__
identifier_name
spiralOutFast.py
from pattern import Pattern import copy import numpy as np import random import collections #from scipy.signal import convolve2d import time from collections import deque class SpiralOutFast(Pattern): def __init__(self): self.register_param("r_leak", 0, 3, 1.2) self.register_param("g_leak", 0, 3, ...
self.buff_len = 1500 self.start_time = np.float(time.time()) def on_pattern_select(self, octopus): self.pixels = octopus.pixels_spiral() self.previous_time = np.float16(time.time()) def next_frame(self, octopus, data): current_time = time.time() - self.start_time ...
self.g = [0,0] self.b = [0,0]
random_line_split
spiralOutFast.py
from pattern import Pattern import copy import numpy as np import random import collections #from scipy.signal import convolve2d import time from collections import deque class SpiralOutFast(Pattern): def __init__(self):
def on_pattern_select(self, octopus): self.pixels = octopus.pixels_spiral() self.previous_time = np.float16(time.time()) def next_frame(self, octopus, data): current_time = time.time() - self.start_time self.previous_time = current_time scale = float(255) sel...
self.register_param("r_leak", 0, 3, 1.2) self.register_param("g_leak", 0, 3, 1.7) self.register_param("b_leak", 0, 3, 2) self.register_param("speed", 0, 1 , 0) #Initialise time and color history self.t = [0,0] self.r = [0,0] self.g = [0,0] self.b = [0,0]...
identifier_body
spiralOutFast.py
from pattern import Pattern import copy import numpy as np import random import collections #from scipy.signal import convolve2d import time from collections import deque class SpiralOutFast(Pattern): def __init__(self): self.register_param("r_leak", 0, 3, 1.2) self.register_param("g_leak", 0, 3, ...
self.pixels[i].color = (r[i], g[i], b[i])
conditional_block
VMgr_SendPing.py
#!/usr/bin/python ''' This script sends a ping to a specific mote and waits for the pingResponse notification. If any other pingResponses are received, the program continues listening and waits until the correct one is received. ''' #============================ adjust path =====================================
if __name__ == "__main__": here = sys.path[0] sys.path.insert(0, os.path.join(here, '..', 'libs')) sys.path.insert(0, os.path.join(here, '..', 'external_libs')) #============================ imports ========================================= import urllib3 import threading import traceback import time impo...
import sys import os
random_line_split
VMgr_SendPing.py
#!/usr/bin/python ''' This script sends a ping to a specific mote and waits for the pingResponse notification. If any other pingResponses are received, the program continues listening and waits until the correct one is received. ''' #============================ adjust path ===================================== impor...
else: print ('\nReceived a ping response, but either different mote or wrong callbackID... still waiting --> {0} , {1}\n'.format(mydata.mac_address, mydata.callback_id)) def process_notif(notif): ''' Dispatch notifications to specific processing functions. ''' if notif.type in ('pingRe...
print '\nPing response from mote {0} with callbackID = {1}'.format(mydata.mac_address, mydata.callback_id) print ' returned with result --> {0}'.format(mydata.result) print ' date and time --> {0}'.format(mydata.sys_time) print ' latency of response --> {0} mSec'.format(mydata.latency) ...
conditional_block
VMgr_SendPing.py
#!/usr/bin/python ''' This script sends a ping to a specific mote and waits for the pingResponse notification. If any other pingResponses are received, the program continues listening and waits until the correct one is received. ''' #============================ adjust path ===================================== impor...
(mydata): global macaddr, myresponse, stop_event if macaddr == mydata.mac_address and myresponse.callback_id == mydata.callback_id: print '\nPing response from mote {0} with callbackID = {1}'.format(mydata.mac_address, mydata.callback_id) print ' returned with result --> {0}'.format(mydata.re...
process_event
identifier_name
VMgr_SendPing.py
#!/usr/bin/python ''' This script sends a ping to a specific mote and waits for the pingResponse notification. If any other pingResponses are received, the program continues listening and waits until the correct one is received. ''' #============================ adjust path ===================================== impor...
def process_notif(notif): ''' Dispatch notifications to specific processing functions. ''' if notif.type in ('pingResponse'): # handle ping response notifications process_event(notif) else: # handle other event notifications pass #============================ m...
global macaddr, myresponse, stop_event if macaddr == mydata.mac_address and myresponse.callback_id == mydata.callback_id: print '\nPing response from mote {0} with callbackID = {1}'.format(mydata.mac_address, mydata.callback_id) print ' returned with result --> {0}'.format(mydata.result) ...
identifier_body
main.ts
import { CodeInspectionReport } from './types'; define((require, exports, module) => { // imports const CodeInspection = brackets.getModule('language/CodeInspection'); const ProjectManager = brackets.getModule('project/ProjectManager'); const ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); cons...
} function handleAutoFix() { const doc = DocumentManager.getCurrentDocument(); const language = doc.getLanguage(); const fileType = language._id; const fullPath = doc.file.fullPath; const editor = EditorManager.getCurrentFullEditor(); const cursor = editor.getCursorPos(); const scroll ...
{ const deferred: JQueryDeferred<CodeInspectionReport> = $.Deferred(); const projectRoot = ProjectManager.getProjectRoot().fullPath; const useLocalESLint = preferences.get('useLocalESLint'); nodeDomain.exec('lintFile', projectRoot, fullPath, text, useLocalESLint) .then((report: CodeInspectionRepor...
identifier_body
main.ts
import { CodeInspectionReport } from './types'; define((require, exports, module) => { // imports const CodeInspection = brackets.getModule('language/CodeInspection'); const ProjectManager = brackets.getModule('project/ProjectManager'); const ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); cons...
() { const doc = DocumentManager.getCurrentDocument(); const language = doc.getLanguage(); const fileType = language._id; const fullPath = doc.file.fullPath; const editor = EditorManager.getCurrentFullEditor(); const cursor = editor.getCursorPos(); const scroll = editor.getScrollPos(); ...
handleAutoFix
identifier_name
main.ts
import { CodeInspectionReport } from './types'; define((require, exports, module) => { // imports const CodeInspection = brackets.getModule('language/CodeInspection'); const ProjectManager = brackets.getModule('project/ProjectManager'); const ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); cons...
}); });
});
random_line_split
main.ts
import { CodeInspectionReport } from './types'; define((require, exports, module) => { // imports const CodeInspection = brackets.getModule('language/CodeInspection'); const ProjectManager = brackets.getModule('project/ProjectManager'); const ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); cons...
deferred.resolve(report); }, (err) => { deferred.reject(err); }); return deferred.promise(); } function handleAutoFix() { const doc = DocumentManager.getCurrentDocument(); const language = doc.getLanguage(); const fileType = language._id; const fullPath = doc.file.f...
{ log.error(`No bracketsInspectionGutters found on window, gutters disabled.`); }
conditional_block
diepdma0.rs
#[doc = "Register `DIEPDMA0` reader"] pub struct R(crate::R<DIEPDMA0_SPEC>); impl core::ops::Deref for R { type Target = crate::R<DIEPDMA0_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<DIEPDMA0_SPEC>> for R { #[inline(always)] fn from(reader: ...
(&self) -> DMAADDR_R { DMAADDR_R::new((self.bits & 0xffff_ffff) as u32) } } impl W { #[doc = "Bits 0:31 - DMA Address"] #[inline(always)] pub fn dmaaddr(&mut self) -> DMAADDR_W { DMAADDR_W { w: self } } #[doc = "Writes raw bits to the register."] #[inline(always)] pub uns...
dmaaddr
identifier_name
diepdma0.rs
#[doc = "Register `DIEPDMA0` reader"] pub struct R(crate::R<DIEPDMA0_SPEC>); impl core::ops::Deref for R { type Target = crate::R<DIEPDMA0_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<DIEPDMA0_SPEC>> for R { #[inline(always)] fn from(reader: ...
impl core::ops::Deref for DMAADDR_R { type Target = crate::FieldReader<u32, u32>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `DMAAddr` writer - DMA Address"] pub struct DMAADDR_W<'a> { w: &'a mut W, } impl<'a> DMAADDR_W<'a> { #[doc = r"Writes raw bits...
impl DMAADDR_R { pub(crate) fn new(bits: u32) -> Self { DMAADDR_R(crate::FieldReader::new(bits)) } }
random_line_split
EventHandler.js
/* 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/. * * @license MPL 2.0 * @copyright Famous Industries, Inc. 2014 */ /* Modified work copyright © 2015 David Valdman...
) { EventEmitter.apply(this, arguments); this.upstream = []; // upstream event handlers this.upstreamListeners = {}; // upstream listeners } EventHandler.prototype = Object.create(EventEmitter.prototype); EventHandler.prototype.constructor = EventHandler; /** * Constructo...
ventHandler(
identifier_name
EventHandler.js
/* 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/. * * @license MPL 2.0 * @copyright Famous Industries, Inc. 2014 */ /* Modified work copyright © 2015 David Valdman...
}; /** * Listen for events from an an upstream source. * * @method subscribe * @param source {EventEmitter} Event source */ EventHandler.prototype.subscribe = function subscribe(source) { var index = this.upstream.indexOf(source); if (index < 0) { this.u...
var upstreamListener = this.trigger.bind(this, type); this.upstreamListeners[type] = upstreamListener; for (var i = 0; i < this.upstream.length; i++) { this.upstream[i].on(type, upstreamListener); } }
conditional_block
EventHandler.js
/* 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/. * * @license MPL 2.0 * @copyright Famous Industries, Inc. 2014 */ /* Modified work copyright © 2015 David Valdman...
* * @method setOutputHandler * @param object {Object} Object to provide on, off and emit methods * @param handler {EventHandler} Handler assigned event handler */ EventHandler.setOutputHandler = function setOutputHandler(object, handler) { handler.bindThis(object); ...
}; /** * Constructor helper method. Assign an event handler to emit an object's output events. * Defines `emit`, `on` and `off` methods on the class instance.
random_line_split
EventHandler.js
/* 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/. * * @license MPL 2.0 * @copyright Famous Industries, Inc. 2014 */ /* Modified work copyright © 2015 David Valdman...
EventHandler.prototype = Object.create(EventEmitter.prototype); EventHandler.prototype.constructor = EventHandler; /** * Constructor helper method. Assign an event handler to receive an object's input events. * Defines `trigger`, `subscribe` and `unsubscribe` methods on the class instance. ...
EventEmitter.apply(this, arguments); this.upstream = []; // upstream event handlers this.upstreamListeners = {}; // upstream listeners }
identifier_body
SrvTourAverageChipsDataSerializer.ts
import { BitsReader } from "../../../../utils/BitsReader"; import { SerializerUtils } from "../../../../utils/SerializerUtils"; import { SrvTourAverageChipsData } from "../data/SrvTourAverageChipsData"; import { BinaryNetworkID } from "../../core/data/BinaryNetworkID"; import { BinaryNetworkIDSerializer } from "../../...
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder";
random_line_split
SrvTourAverageChipsDataSerializer.ts
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder"; import { BitsReader } from "../../../../utils/BitsReader"; import { SerializerUtils } from "../../../../utils/SerializerUtils"; import { SrvTourAverageChipsData } from "../data/SrvTourAverageChipsData"; import { BinaryNetworkID } from "../../co...
{ public static serialize(buffer: ArrayBufferBuilder, data: SrvTourAverageChipsData): void { BinaryNetworkIDSerializer.serialize(buffer, data.tourNetworkIDVO); OptimizedBinaryNumberSerializer.serialize( buffer, data.averageChips ); } public static deserialize(buffer: ArrayBufferBuilder, data: SrvTourAvera...
SrvTourAverageChipsDataSerializer
identifier_name
zone0.py
28' ret=vdns.common.reverse_name(ip2) # logging.error('Unhandled address family: %s' % (rec['family'], )) # ret='' else: logging.error('Unknown address family: %s' % (rec['family'], )) ret='' # Get rid of the suffix if we can domain=self...
elif rr=='ds': rrname='DS' data=[] data.append("%d %d %d %s" % (rec['keyid'], rec['algorithm'], 1, rec['digest_sha1'])) data.append("%d %d %d %s" % (rec['keyid'], rec['algorithm'], 2, rec['digest_sha256'])) elif rr=='a': ...
rrname='NS' data=rec['ns'] if rec['ns'].count('.')>=2: needsdot=True
conditional_block
zone0.py
(domain)-1] return(ret) # def make_soa(self, incserial): def make_soa(self): """! NO @param incserial If True then increment the serial number """ dt=self.dt dt2={ # 'serial': self.mkserial(dt, incserial), 'serial': dt['seria...
make_hosts
identifier_name
zone0.py
8' ret=vdns.common.reverse_name(ip2) # logging.error('Unhandled address family: %s' % (rec['family'], )) # ret='' else: logging.error('Unknown address family: %s' % (rec['family'], )) ret='' # Get rid of the suffix if we can domain=self....
def make_toplevel(self): """ Create the top-level entries. These are the entries with empty hostname or hostname=='.' """ lst=['ns', 'mx', 'dnssec', 'txt'] ret='' for typ in lst: if not typ in self.dt: continue re...
"""! Auto-determine A or AAAA and call mkrecord @record rec The record. Must be either A or AAAA @return The result of mkrecord() """ if vdns.common.addr_family(rec['ip_str'])==4: ret=self.mkrecord('a', rec) else: ret=self.mkrecord('aaaa', rec...
identifier_body
zone0.py
' data="%-4d %s" % (rec['priority'], rec['mx']) if rec['mx'].count('.')>=2: needsdot=True elif rr=='ns': rrname='NS' data=rec['ns'] if rec['ns'].count('.')>=2: needsdot=True elif rr=='ds': rrname='DS'...
random_line_split
urls.py
from django.conf.urls import include, url from django.shortcuts import redirect from olympia.stats.urls import stats_patterns from . import views ADDON_ID = r"""(?P<addon_id>[^/<>"']+)""" # These will all start with /addon/<addon_id>/ detail_patterns = [ url('^$', views.addon_detail, name='addons.detail'), ...
lambda r, addon_id: redirect('addons.detail', addon_id, permanent=True), name='addons.contribute'), url('^contribute/(?P<status>cancel|complete)$', lambda r, addon_id, status: redirect('addons.detail', addon_id...
name='addons.thanks'), url('^contribute/$',
random_line_split
rat-utils.js
'use strict'; var path = require('path'); var _ = require('lodash'); function convertToUnixPath(dir) { if (!_.isString(dir)) { throw new Error('Expected path to be a string'); } if (path.sep === '\\') { dir = path.normalize(dir); dir = dir.split(path.sep).join('/'); } return dir; } function g...
(routeName, prefix) { return _buildNameObject(routeName, 'route', prefix); } function generateConfigurationNames(configurationName, prefix) { return _buildNameObject(configurationName, 'configuration', prefix); } function generateRunNames(runName, prefix) { return _buildNameObject(runName, 'run', prefix); } fu...
generateRouteNames
identifier_name
rat-utils.js
'use strict'; var path = require('path'); var _ = require('lodash'); function convertToUnixPath(dir) { if (!_.isString(dir)) { throw new Error('Expected path to be a string'); } if (path.sep === '\\') { dir = path.normalize(dir); dir = dir.split(path.sep).join('/'); } return dir; } function g...
function getControllerTemplatePath() { return path.join('controller', '_controller.ts'); } function _buildNameObject(name, type, prefix) { name = _.camelCase(name); prefix = prefix || ''; var objectName = name + _.capitalize(type); if (prefix.length !== 0) { objectName = prefix + _.upperFirst(objectNa...
{ return path.join('service', '_service.ts'); }
identifier_body
rat-utils.js
'use strict'; var path = require('path'); var _ = require('lodash'); function convertToUnixPath(dir) { if (!_.isString(dir)) { throw new Error('Expected path to be a string'); } if (path.sep === '\\') { dir = path.normalize(dir); dir = dir.split(path.sep).join('/'); } return dir; } function g...
return { name: objectName, className: _.upperFirst(name) + _.capitalize(type), fileName: _.upperFirst(name) + '.' + type + '.ts' }; } module.exports = { convertToUnixPath: convertToUnixPath, generateModuleNames: generateModuleNames, generateRouteNames: generateRouteNames, generateConfiguratio...
{ objectName = prefix + _.upperFirst(objectName); }
conditional_block