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
diagnostics.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if(switches[what] === true) { // replay back-in-time functions var allArgs = [arguments]; idx = data.indexOf(fn); if(idx !== -1) { allArgs.unshift.apply(allArgs, data[idx + 1] || []); data[idx + 1] = []; } var backInTime = allArgs.length > 1; var doIt:()=>void = function() { var thi...
{ if (true) { return () => { // Intentional empty, disable for now because it is leaking memory }; } // register switch var flag = switches[what] || false; switches[what] = flag; // register function var tracers = map[what] || []; tracers.push(fn); map[what] = tracers; var result = function(...args...
identifier_body
preferencesUnit.js
'use strict'; angular.module('copayApp.controllers').controller('preferencesUnitController', function($rootScope, $scope, configService, go) { var config = configService.getSync(); this.unitName = config.wallet.settings.unitName; this.unitOpts = [ // TODO : add Satoshis to bitcore-wallet-client for...
}; });
});
random_line_split
many-digits.rs
extern crate rand; use rand::distributions::{Range, Sample}; use rand::{IsaacRng, Rng, SeedableRng}; use std::char; use test_float_parse::{validate, SEED}; fn
() { let mut rnd = IsaacRng::from_seed(&SEED); let mut range = Range::new(0, 10); for _ in 0..5_000_000u64 { let num_digits = rnd.gen_range(100, 400); let digits = gen_digits(num_digits, &mut range, &mut rnd); validate(&digits); } } fn gen_digits<R: Rng>(n: u32, range: &mut Rang...
main
identifier_name
many-digits.rs
extern crate rand; use rand::distributions::{Range, Sample}; use rand::{IsaacRng, Rng, SeedableRng}; use std::char; use test_float_parse::{validate, SEED}; fn main() { let mut rnd = IsaacRng::from_seed(&SEED); let mut range = Range::new(0, 10); for _ in 0..5_000_000u64 { let num_digits = rnd.gen_r...
{ let mut s = String::new(); for _ in 0..n { let digit = char::from_digit(range.sample(rnd), 10).unwrap(); s.push(digit); } s }
identifier_body
many-digits.rs
extern crate rand; use rand::distributions::{Range, Sample}; use rand::{IsaacRng, Rng, SeedableRng}; use std::char; use test_float_parse::{validate, SEED}; fn main() { let mut rnd = IsaacRng::from_seed(&SEED); let mut range = Range::new(0, 10); for _ in 0..5_000_000u64 { let num_digits = rnd.gen_r...
}
let digit = char::from_digit(range.sample(rnd), 10).unwrap(); s.push(digit); } s
random_line_split
152_add_message_id_to_event.py
"""add message column to event Revision ID: 211e93aff1e1 Revises: 2493281d621 Create Date: 2015-03-20 18:50:29.961734 """ # revision identifiers, used by Alembic. revision = '211e93aff1e1' down_revision = '2f3c8fa3fc3a' from alembic import op from sqlalchemy.sql import text def upgrade(): conn = op.get_bind()...
(): conn = op.get_bind() conn.execute(text("SET FOREIGN_KEY_CHECKS=0;")) conn.execute(text("ALTER TABLE event DROP FOREIGN KEY message_ifbk")) conn.execute(text("ALTER TABLE event DROP COLUMN message_id"))
downgrade
identifier_name
152_add_message_id_to_event.py
"""add message column to event Revision ID: 211e93aff1e1 Revises: 2493281d621 Create Date: 2015-03-20 18:50:29.961734 """ # revision identifiers, used by Alembic. revision = '211e93aff1e1' down_revision = '2f3c8fa3fc3a' from alembic import op from sqlalchemy.sql import text def upgrade(): conn = op.get_bind()...
conn = op.get_bind() conn.execute(text("SET FOREIGN_KEY_CHECKS=0;")) conn.execute(text("ALTER TABLE event DROP FOREIGN KEY message_ifbk")) conn.execute(text("ALTER TABLE event DROP COLUMN message_id"))
identifier_body
152_add_message_id_to_event.py
"""add message column to event Revision ID: 211e93aff1e1 Revises: 2493281d621 Create Date: 2015-03-20 18:50:29.961734 """ # revision identifiers, used by Alembic. revision = '211e93aff1e1' down_revision = '2f3c8fa3fc3a'
def upgrade(): conn = op.get_bind() conn.execute(text("SET FOREIGN_KEY_CHECKS=0;")) conn.execute(text("ALTER TABLE event ADD COLUMN message_id int(11) DEFAULT NULL")) conn.execute(text("ALTER TABLE event ADD CONSTRAINT message_ifbk FOREIGN KEY " "(`message_id`) REFERENCES `messag...
from alembic import op from sqlalchemy.sql import text
random_line_split
htmls2csvs.py
# pylint: disable = C0301 from bs4 import BeautifulSoup from urllib2 import urlopen import pandas as pd pos_idx_map = { 'qb': 2, 'rb': 3, 'wr': 4, 'te': 5, } def make_url(pos, wk): ii = pos_idx_map[pos] fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1...
def position_html_local(posn): dflist = [] for ii in range(1, 17): fname = '%s%s.html' % (posn, ii) with open(fname) as f: df = html2df(BeautifulSoup(f)) df['wk'] = ii df.columns = header_clean(df.columns, posn) dflist.append(df) return pd.concat(dflist)...
table = soup.find('table') headers = [header.text.lower() for header in table.find_all('th')] rows = [] for row in table.find_all('tr'): rows.append([val.text.encode('utf8') for val in row.find_all('td')]) rows = [rr for rr in rows if len(rr) > 0] df = pd.DataFrame.from_records(rows) df...
identifier_body
htmls2csvs.py
# pylint: disable = C0301 from bs4 import BeautifulSoup from urllib2 import urlopen import pandas as pd pos_idx_map = { 'qb': 2, 'rb': 3, 'wr': 4, 'te': 5, } def make_url(pos, wk): ii = pos_idx_map[pos] fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1...
else: res = header return res if __name__ == '__main__': data_all = {} for pp in ['qb', 'wr', 'rb', 'te']: data_all[pp] = position_html_local(pp) data_all[pp].to_pickle('%s.pkl' % pp)
suffixes = pos_header_suffixes[posn] seen_dict = {hh: 0 for hh in header} for hh in header: if not hh in exclude_cols: hres = hh + suffixes[seen_dict[hh]] seen_dict[hh] += 1 res.append(hres) else: res.append(hh)
conditional_block
htmls2csvs.py
# pylint: disable = C0301 from bs4 import BeautifulSoup from urllib2 import urlopen import pandas as pd pos_idx_map = { 'qb': 2, 'rb': 3, 'wr': 4, 'te': 5, } def make_url(pos, wk): ii = pos_idx_map[pos] fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1...
seen_dict[hh] += 1 res.append(hres) else: res.append(hh) else: res = header return res if __name__ == '__main__': data_all = {} for pp in ['qb', 'wr', 'rb', 'te']: data_all[pp] = position_html_local(pp) data_all[pp].t...
seen_dict = {hh: 0 for hh in header} for hh in header: if not hh in exclude_cols: hres = hh + suffixes[seen_dict[hh]]
random_line_split
htmls2csvs.py
# pylint: disable = C0301 from bs4 import BeautifulSoup from urllib2 import urlopen import pandas as pd pos_idx_map = { 'qb': 2, 'rb': 3, 'wr': 4, 'te': 5, } def make_url(pos, wk): ii = pos_idx_map[pos] fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1...
(header, posn): res = [] if posn in pos_header_suffixes: suffixes = pos_header_suffixes[posn] seen_dict = {hh: 0 for hh in header} for hh in header: if not hh in exclude_cols: hres = hh + suffixes[seen_dict[hh]] seen_dict[hh] += 1 ...
header_clean
identifier_name
snapscroll.py
############################################################################# ## ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ## Contact: Qt Software Information (qt-info@nokia.com) ## ## This file is part of the Graphics Dojo project on Qt Labs. ## ## This file may be used under the terms of th...
previousOffset = self.page().mainFrame().scrollPosition() QWebView.keyReleaseEvent(self, event) if not event.isAccepted(): return if event.key() == Qt.Key_Down: ofs = self.page().mainFrame().scrollPosition() jump = ofs.y() - previousOffset....
QWebView.keyReleaseEvent(self, event) return
conditional_block
snapscroll.py
############################################################################# ## ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ## Contact: Qt Software Information (qt-info@nokia.com) ## ## This file is part of the Graphics Dojo project on Qt Labs. ## ## This file may be used under the terms of th...
self.snapEnabled = not self.snapEnabled if self.snapEnabled: self.setWindowTitle(self.tr("Snap-scrolling is ON")) else: self.setWindowTitle(self.tr("Snap-scrolling is OFF")) event.accept() return # no snapping? ...
# toggle snapping if event.key() == Qt.Key_F3:
random_line_split
snapscroll.py
############################################################################# ## ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ## Contact: Qt Software Information (qt-info@nokia.com) ## ## This file is part of the Graphics Dojo project on Qt Labs. ## ## This file may be used under the terms of th...
hitRects.append(hit.boundingRect()) i += 1 return hitRects def keyPressEvent(self, event): # toggle snapping if event.key() == Qt.Key_F3: self.snapEnabled = not self.snapEnabled if self.snapEnabled: self.setWi...
def __init__(self): QWebView.__init__(self) self.snapEnabled = True self.setWindowTitle(self.tr("Snap-scrolling is ON")) # rects hit by the line, in main frame's view coordinate def hitBoundingRects(self, line): hitRects = [] points = 8 delta = QPoint(...
identifier_body
snapscroll.py
############################################################################# ## ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ## Contact: Qt Software Information (qt-info@nokia.com) ## ## This file is part of the Graphics Dojo project on Qt Labs. ## ## This file may be used under the terms of th...
(self): QWebView.__init__(self) self.snapEnabled = True self.setWindowTitle(self.tr("Snap-scrolling is ON")) # rects hit by the line, in main frame's view coordinate def hitBoundingRects(self, line): hitRects = [] points = 8 delta = QPoint(line.dx() / ...
__init__
identifier_name
day14.rs
#[cfg(target_family = "unix")] extern crate cursive; #[cfg(target_family = "unix")] use cursive::Cursive; #[cfg(target_family = "unix")] use cursive::traits::*; #[cfg(target_family = "unix")] use cursive::views::{Dialog, DummyView, LinearLayout, SelectView, TextView}; #[cfg(target_family = "unix")] use std::fs::{self...
text_view.set_content(content); } #[cfg(target_family = "unix")] fn main() { println!("24 Days of Rust vol. 2 - cursive"); let mut app = Cursive::new(); let mut panes = LinearLayout::horizontal(); let picker = file_picker("."); panes.add_child(picker.fixed_size((30, 25))); panes.add_child(D...
random_line_split
day14.rs
#[cfg(target_family = "unix")] extern crate cursive; #[cfg(target_family = "unix")] use cursive::Cursive; #[cfg(target_family = "unix")] use cursive::traits::*; #[cfg(target_family = "unix")] use cursive::views::{Dialog, DummyView, LinearLayout, SelectView, TextView}; #[cfg(target_family = "unix")] use std::fs::{self...
#[cfg(target_family = "unix")] fn update_status(app: &mut Cursive, entry: &DirEntry) { let mut status_bar = app.find_id::<TextView>("status").unwrap(); let file_name = entry.file_name().into_string().unwrap(); let file_size = entry.metadata().unwrap().len(); let content = format!("{}: {} bytes", file_...
{ let mut view = SelectView::new(); for entry in fs::read_dir(directory).expect("can't read directory") { if let Ok(e) = entry { let file_name = e.file_name().into_string().unwrap(); view.add_item(file_name, e); } } view.on_select(update_status).on_submit(load_con...
identifier_body
day14.rs
#[cfg(target_family = "unix")] extern crate cursive; #[cfg(target_family = "unix")] use cursive::Cursive; #[cfg(target_family = "unix")] use cursive::traits::*; #[cfg(target_family = "unix")] use cursive::views::{Dialog, DummyView, LinearLayout, SelectView, TextView}; #[cfg(target_family = "unix")] use std::fs::{self...
else { let mut buf = String::new(); let _ = File::open(entry.file_name()) .and_then(|mut f| f.read_to_string(&mut buf)) .map_err(|e| buf = format!("Error: {}", e)); buf }; text_view.set_content(content); } #[cfg(target_family = "unix")] fn main() { println!(...
{ "<DIR>".to_string() }
conditional_block
day14.rs
#[cfg(target_family = "unix")] extern crate cursive; #[cfg(target_family = "unix")] use cursive::Cursive; #[cfg(target_family = "unix")] use cursive::traits::*; #[cfg(target_family = "unix")] use cursive::views::{Dialog, DummyView, LinearLayout, SelectView, TextView}; #[cfg(target_family = "unix")] use std::fs::{self...
<D>(directory: D) -> SelectView<DirEntry> where D: AsRef<Path>, { let mut view = SelectView::new(); for entry in fs::read_dir(directory).expect("can't read directory") { if let Ok(e) = entry { let file_name = e.file_name().into_string().unwrap(); view.add_item(file_name, e); ...
file_picker
identifier_name
app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router';
import { TodoListComponent } from './todo-list/todo-list.component'; import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; @NgModule({ imports: [ // Transition between server and client BrowserModule.withServerTransition({ appId: 'angular-meteor-universal' }), Forms...
import { AppComponent } from './app.component'; import { TodoAddComponent } from './todo-add/todo-add.component';
random_line_split
app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; import { TodoAddComponent } from './todo-add/todo-add.component'; import ...
{ }
AppModule
identifier_name
S11.13.2_A4.1_T1.3.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * The production x *= y is the same as the production x = x * y * * @path ch11/11.13/11.13.2/S11.13.2_A4.1_T1.3.js * @description Type(x) and Type(y) vary between primitive string...
//CHECK#2 x = new String("1"); x *= "1"; if (x !== 1) { $ERROR('#2: x = new String("1"); x *= "1"; x === 1. Actual: ' + (x)); } //CHECK#3 x = "1"; x *= new String("1"); if (x !== 1) { $ERROR('#3: x = "1"; x *= new String("1"); x === 1. Actual: ' + (x)); } //CHECK#4 x = new String("1"); x *= new String("1"); if ...
{ $ERROR('#1: x = "1"; x *= "1"; x === 1. Actual: ' + (x)); }
conditional_block
S11.13.2_A4.1_T1.3.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * The production x *= y is the same as the production x = x * y * * @path ch11/11.13/11.13.2/S11.13.2_A4.1_T1.3.js * @description Type(x) and Type(y) vary between primitive string...
//CHECK#5 x = "x"; x *= "1"; if (isNaN(x) !== true) { $ERROR('#5: x = "x"; x *= "1"; x === Not-a-Number. Actual: ' + (x)); } //CHECK#6 x = "1"; x *= "x"; if (isNaN(x) !== true) { $ERROR('#6: x = "1"; x *= "x"; x === Not-a-Number. Actual: ' + (x)); }
x = new String("1"); x *= new String("1"); if (x !== 1) { $ERROR('#4: x = new String("1"); x *= new String("1"); x === 1. Actual: ' + (x)); }
random_line_split
nc04.py
#! /usr/bin/env python # # Copyright 2012 Vaibhav Bajpai <contact@vaibhavbajpai.com> # Copyright 2009 Shikhar Bhushan <shikhar@schmizz.net> # # Create a new user to the running configuration using edit-config # and the test-option provided by the :validate capability. # # $ ./nc04.py cook bob 42 42 import sys, os, war...
def setlogging_level(level_name): level = LEVELS.get(level_name, logging.CRITICAL) logging.basicConfig(level=level) results = parse_arguments() setlogging_level(results.level_name) connect( results.hostname, results.port, results.username, results.password, ...
conditional_block
nc04.py
#! /usr/bin/env python # # Copyright 2012 Vaibhav Bajpai <contact@vaibhavbajpai.com> # Copyright 2009 Shikhar Bhushan <shikhar@schmizz.net> # # Create a new user to the running configuration using edit-config # and the test-option provided by the :validate capability. # # $ ./nc04.py cook bob 42 42 import sys, os, war...
(): parser = argparse.ArgumentParser() parser.add_argument( 'hostname', action='store', help='hostname or IP address' ) parser.add_argument( 'name', action='store',...
parse_arguments
identifier_name
nc04.py
#! /usr/bin/env python # # Copyright 2012 Vaibhav Bajpai <contact@vaibhavbajpai.com> # Copyright 2009 Shikhar Bhushan <shikhar@schmizz.net> # # Create a new user to the running configuration using edit-config # and the test-option provided by the :validate capability. # # $ ./nc04.py cook bob 42 42 import sys, os, war...
) parser.add_argument( '--port', action='store', default=830, type=int, dest='port', help='''port number [default: 830]''' ) ...
parser = argparse.ArgumentParser() parser.add_argument( 'hostname', action='store', help='hostname or IP address' ) parser.add_argument( 'name', action='store', ...
identifier_body
nc04.py
#! /usr/bin/env python # # Copyright 2012 Vaibhav Bajpai <contact@vaibhavbajpai.com> # Copyright 2009 Shikhar Bhushan <shikhar@schmizz.net> # # Create a new user to the running configuration using edit-config # and the test-option provided by the :validate capability. # # $ ./nc04.py cook bob 42 42 import sys, os, war...
) parser.add_argument( 'name', action='store', help='username of the new user' ) parser.add_argument( 'uid', action='store', ...
help='hostname or IP address'
random_line_split
destructured-local.rs
// gdb-command:print d // gdb-check:$4 = 3 // gdb-command:print e // gdb-check:$5 = 4 // gdb-command:print f // gdb-check:$6 = 5 // gdb-command:print g // gdb-check:$7 = {6, 7} // gdb-command:print h // gdb-check:$8 = 8 // gdb-command:print i // gdb-check:$9 = {a = 9, b = 10} // gdb-command:print j // gdb-check:$10 =...
{ a: i64, b: i32 } enum Univariant { Unit(i32) } struct TupleStruct (f64, int); fn main() { // simple tuple let (a, b) : (int, bool) = (1, false); // nested tuple let (c, (d, e)) : (int, (u16, u16)) = (2, (3, 4)); // bind tuple-typed value to one name (destructure only first level...
Struct
identifier_name
destructured-local.rs
// gdb-command:print d // gdb-check:$4 = 3
// gdb-command:print e // gdb-check:$5 = 4 // gdb-command:print f // gdb-check:$6 = 5 // gdb-command:print g // gdb-check:$7 = {6, 7} // gdb-command:print h // gdb-check:$8 = 8 // gdb-command:print i // gdb-check:$9 = {a = 9, b = 10} // gdb-command:print j // gdb-check:$10 = 11 // gdb-command:print k // gdb-check:$1...
random_line_split
conditions.py
# MIT License # # Copyright (c) 2015-2021 Iakiv Kramarenko # # 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 use, copy, modif...
class CollectionCondition(Condition[Collection]): pass class BrowserCondition(Condition[Browser]): pass
pass
identifier_body
conditions.py
# MIT License #
# Copyright (c) 2015-2021 Iakiv Kramarenko # # 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 use, copy, modify, merge, publis...
random_line_split
conditions.py
# MIT License # # Copyright (c) 2015-2021 Iakiv Kramarenko # # 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 use, copy, modif...
(Condition[Element]): pass class CollectionCondition(Condition[Collection]): pass class BrowserCondition(Condition[Browser]): pass
ElementCondition
identifier_name
pat-lt-bracket-3.rs
// Copyright 2015 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 ...
<T>(T, T); impl<T> Foo<T> { fn foo(&self) { match *self { Foo<T>(x, y) => { //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<` println!("Goodbye, World!") } } } }
Foo
identifier_name
pat-lt-bracket-3.rs
// Copyright 2015 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 ...
}
{ match *self { Foo<T>(x, y) => { //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<` println!("Goodbye, World!") } } }
identifier_body
pat-lt-bracket-3.rs
// Copyright 2015 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 ...
match *self { Foo<T>(x, y) => { //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<` println!("Goodbye, World!") } } } }
impl<T> Foo<T> { fn foo(&self) {
random_line_split
pat-lt-bracket-3.rs
// Copyright 2015 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: expected one of `=>`, `@`, `if`, or `|`, found `<` println!("Goodbye, World!") }
conditional_block
borrowck-multiple-captures.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let x = box 1is; drop(x); Thread::spawn(move|| { drop(x); //~ ERROR capture of moved value: `x` drop(x); //~ ERROR use of moved value: `x` }); } fn main() { different_vars_after_borrows(); different_vars_after_moves(); same_var_after_borrow(); same_var_after_move();...
same_var_after_move
identifier_name
borrowck-multiple-captures.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed drop(x); //~ ERROR use of moved value: `x` }); borrow(&*p); } fn same_var_after_move() { let x = box 1is; drop(x); Thread::spawn(move|| { drop(x); //~ ERROR capture of moved value: `x` drop(x); //...
fn same_var_after_borrow() { let x = box 1is; let p = &x; Thread::spawn(move|| {
random_line_split
borrowck-multiple-captures.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn different_vars_after_moves() { let x1 = box 1is; drop(x1); let x2 = box 2is; drop(x2); Thread::spawn(move|| { drop(x1); //~ ERROR capture of moved value: `x1` drop(x2); //~ ERROR capture of moved value: `x2` }); } fn same_var_after_borrow() { let x = box 1is; let p ...
{ let x1 = box 1is; let p1 = &x1; let x2 = box 2is; let p2 = &x2; Thread::spawn(move|| { drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed }); borrow(&*p1); borrow(&*p2); }
identifier_body
oncoprinttrackoptionsview.js
oprintTrackOptionsView = (function() { function OncoprintTrackOptionsView($div, moveUpCallback, moveDownCallback, removeCallback, sortChangeCallback) { // removeCallback: function(track_id) var position = $div.css('position'); if (position !== 'absolute' && position !=='relative') { console.log("WARNING: di...
module.exports = Oncop
renderAllOptions(this, model); } return OncoprintTrackOptionsView; })();
random_line_split
oncoprinttrackoptionsview.js
oprintTrackOptionsView = (function() { function OncoprintTrackOptionsView($div, moveUpCallback, moveDownCallback, removeCallback, sortChangeCallback)
this.menu_shown = {}; var self = this; $(document).click(function () { for (var track_id in self.track_options_$elts) { if (self.track_options_$elts.hasOwnProperty(track_id)) { hideTrackMenu(self, track_id); } } }); this.interaction_disabled = false; } var renderAllOptions = f...
{ // removeCallback: function(track_id) var position = $div.css('position'); if (position !== 'absolute' && position !=='relative') { console.log("WARNING: div passed to OncoprintTrackOptionsView must be absolute or relative positioned - layout problems will occur"); } this.moveUpCallback = moveUpCallback; ...
identifier_body
oncoprinttrackoptionsview.js
oprintTrackOptionsView = (function() { function OncoprintTrackOptionsView($div, moveUpCallback, moveDownCallback, removeCallback, sortChangeCallback) { // removeCallback: function(track_id) var position = $div.css('position'); if (position !== 'absolute' && position !=='relative') { console.log("WARNING: di...
evt.stopPropagation(); $sort_inc_li.css('font-weight', 'normal'); $sort_dec_li.css('font-weight', 'normal'); $dont_sort_li.css('font-weight', 'bold'); view.sortChangeCallback(track_id, 0); }); $dropdown.append($sort_inc_li); $dropdown.append($sort_dec_li); $dropdown.append($dont_sort_li); ...
{ $dropdown.append($makeDropdownSeparator()); var $sort_inc_li; var $sort_dec_li; var $dont_sort_li; $sort_inc_li = $makeDropdownOption('Sort a-Z', (model.getTrackSortDirection(track_id) === 1 ? 'bold' : 'normal'), function(evt) { evt.stopPropagation(); $sort_inc_li.css('font-weight', 'bold...
conditional_block
oncoprinttrackoptionsview.js
oprintTrackOptionsView = (function() { function
($div, moveUpCallback, moveDownCallback, removeCallback, sortChangeCallback) { // removeCallback: function(track_id) var position = $div.css('position'); if (position !== 'absolute' && position !=='relative') { console.log("WARNING: div passed to OncoprintTrackOptionsView must be absolute or relative positioned...
OncoprintTrackOptionsView
identifier_name
shutdown.js
const chalk = require('chalk'); const { curry } = require('ramda'); const log = curry((color, string) => console.info(color(string)));
const bad = log(chalk.red.bold); module.exports = (server, port) => { const resolve = (signal) => { info('\n'); info(`Signal ${signal} received`); info(`Express is shutting down on http://localhost:${port}`); server.close(); good('\nThe server shutdown gracefully'); }; const reject = (signal...
const good = log(chalk.green); const info = log(chalk.cyan); const warn = log(chalk.magenta);
random_line_split
index.js
'use strict'; var yeoman = require('yeoman-generator'); var chalk = require('chalk'); var yosay = require('yosay'); module.exports = yeoman.Base.extend({ prompting: function () { // Have Yeoman greet the user. this.log(yosay( 'Welcome to the stylish ' + chalk.red('generator-dev-cli') + ...
choices: ['jsPlugin', 'react'], default: 'jsPlugin' }, { type: 'input', name: 'name', message: 'Your project name', default: this.appname // Default to current folder name }, { type: 'confirm', name: 'besure'...
name: 'environment', message: 'Please choose dev environment(jsPlugin):',
random_line_split
zombie.rs
use game::*; use behaviour::LeafResolution; use direction::Direction; pub fn zombie_step<K: KnowledgeRenderer>() -> BehaviourLeaf<K> { BehaviourLeaf::new(move |input| { let position = input.entity.position().unwrap(); let knowledge = input.entity.simple_npc_knowledge_borrow().unwrap(); let ...
}) }
random_line_split
zombie.rs
use game::*; use behaviour::LeafResolution; use direction::Direction; pub fn
<K: KnowledgeRenderer>() -> BehaviourLeaf<K> { BehaviourLeaf::new(move |input| { let position = input.entity.position().unwrap(); let knowledge = input.entity.simple_npc_knowledge_borrow().unwrap(); let level_knowledge = knowledge.level(input.level_id); let action = if let Some(targ...
zombie_step
identifier_name
zombie.rs
use game::*; use behaviour::LeafResolution; use direction::Direction; pub fn zombie_step<K: KnowledgeRenderer>() -> BehaviourLeaf<K> { BehaviourLeaf::new(move |input| { let position = input.entity.position().unwrap(); let knowledge = input.entity.simple_npc_knowledge_borrow().unwrap(); let ...
else { ActionArgs::Null }; LeafResolution::Yield(MetaAction::ActionArgs(action)) }) }
{ if position == target { ActionArgs::Null } else { let delta = target - position; if delta.x.abs() > delta.y.abs() { if delta.x > 0 { ActionArgs::Walk(input.entity.id(), Direction::East) ...
conditional_block
zombie.rs
use game::*; use behaviour::LeafResolution; use direction::Direction; pub fn zombie_step<K: KnowledgeRenderer>() -> BehaviourLeaf<K>
} else { ActionArgs::Walk(input.entity.id(), Direction::North) } } } } else { ActionArgs::Null }; LeafResolution::Yield(MetaAction::ActionArgs(action)) }) }
{ BehaviourLeaf::new(move |input| { let position = input.entity.position().unwrap(); let knowledge = input.entity.simple_npc_knowledge_borrow().unwrap(); let level_knowledge = knowledge.level(input.level_id); let action = if let Some(target) = level_knowledge.any_target() { ...
identifier_body
server.js
var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/cleancity'); var Complaint = require('./app/models/complaint'); app.use(bodyParser.urlencoded({ exte...
router.route('/complaints/:user_id') .get(function(req, res) { Complaint.find({ email: req.params.user_id }).sort({_id: -1}).limit(10).exec(function(err, complaints) { if (err) res.send(err); res.json(complaints); }); }); app.use('/images', express.stat...
res.json({ message: 'Complaint created!' }); }); });
random_line_split
pattern.py
#!/usr/bin/env python # coding=utf-8
# # Copyright (C) 2016-2017, Alberto Pettarin (www.albertopettarin.it) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later v...
# lachesis automates the segmentation of a transcript into closed captions
random_line_split
pattern.py
#!/usr/bin/env python # coding=utf-8 # lachesis automates the segmentation of a transcript into closed captions # # Copyright (C) 2016-2017, Alberto Pettarin (www.albertopettarin.it) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
elif self.language == Language.FRENCH: from pattern.fr import parse as func_parse from pattern.fr import split as func_split elif self.language == Language.GERMAN: from pattern.de import parse as func_parse from pattern.de import split as func_split ...
from pattern.es import parse as func_parse from pattern.es import split as func_split
conditional_block
pattern.py
#!/usr/bin/env python # coding=utf-8 # lachesis automates the segmentation of a transcript into closed captions # # Copyright (C) 2016-2017, Alberto Pettarin (www.albertopettarin.it) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
(self, language): super(PatternWrapper, self).__init__(language) if self.language == Language.ENGLISH: from pattern.en import parse as func_parse from pattern.en import split as func_split elif self.language == Language.ITALIAN: from pattern.it import parse as...
__init__
identifier_name
pattern.py
#!/usr/bin/env python # coding=utf-8 # lachesis automates the segmentation of a transcript into closed captions # # Copyright (C) 2016-2017, Alberto Pettarin (www.albertopettarin.it) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
raise ValueError(u"No pattern submodule for the given language '%s'." % language) self.func_parse = func_parse self.func_split = func_split # # From the docs: # http://www.clips.ua.ac.be/pages/pattern-en#parser # # The output of parse() is a subclass ...
super(PatternWrapper, self).__init__(language) if self.language == Language.ENGLISH: from pattern.en import parse as func_parse from pattern.en import split as func_split elif self.language == Language.ITALIAN: from pattern.it import parse as func_parse fr...
identifier_body
layout.component.tsx
import * as React from 'react'; import { Link, RouteComponentProps } from 'react-router-dom'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import { Props, State } from './layout.type'; import { PureComponent } from '../utils/pure-render' import SimpleCrud from '../pages/simple-crud/index....
); } }
random_line_split
layout.component.tsx
import * as React from 'react'; import { Link, RouteComponentProps } from 'react-router-dom'; import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import { Props, State } from './layout.type'; import { PureComponent } from '../utils/pure-render' import SimpleCrud from '../pages/simple-crud/index....
extends PureComponent<Props, State> { public static defaultProps = new Props(); public state = new State(); public render() { return ( <Router> <div> <div> <Link to="/" >SimpleCrud</Link> <Link to="/gaea-editor" >GaeaEditor</Link> </div> <...
Layout
identifier_name
subgrid.js
// @flow 'use strict'; const grid = 12; // functions for correcting responsive sizes in bootstrap subgrids // determine size wanted based on size in function
(gridSize, sizeEle, sizeScreen = 'xs') { // determine outer size let outerSize = _getOuterSize(gridSize, sizeScreen); // subtract outer from this size let size = sizeEle * grid/outerSize; if (size > grid) size = grid; else if (size < 1) size = 1; return Math.round(size); } exports.sizeIt = sizeIt; /** ...
sizeIt
identifier_name
subgrid.js
// @flow 'use strict'; const grid = 12; // functions for correcting responsive sizes in bootstrap subgrids // determine size wanted based on size in function sizeIt(gridSize, sizeEle, sizeScreen = 'xs') { // determine outer size let outerSize = _getOuterSize(gridSize, sizeScreen); // subtract outer from this s...
// default return grid; }
{ if (gridSize && gridSize.xs) { return gridSize.xs; } }
conditional_block
subgrid.js
// @flow 'use strict'; const grid = 12; // functions for correcting responsive sizes in bootstrap subgrids // determine size wanted based on size in function sizeIt(gridSize, sizeEle, sizeScreen = 'xs')
exports.sizeIt = sizeIt; /** * determine size of outer element */ function _getOuterSize(gridSize, sizeScreen) { if ('lg' === sizeScreen) { if (gridSize && gridSize.lg) { return gridSize.lg; } else if (gridSize && gridSize.md) { return gridSize.md; } else if (gridSize && gridSize.s...
{ // determine outer size let outerSize = _getOuterSize(gridSize, sizeScreen); // subtract outer from this size let size = sizeEle * grid/outerSize; if (size > grid) size = grid; else if (size < 1) size = 1; return Math.round(size); }
identifier_body
subgrid.js
// @flow 'use strict'; const grid = 12;
// determine size wanted based on size in function sizeIt(gridSize, sizeEle, sizeScreen = 'xs') { // determine outer size let outerSize = _getOuterSize(gridSize, sizeScreen); // subtract outer from this size let size = sizeEle * grid/outerSize; if (size > grid) size = grid; else if (size < 1) size = 1; ...
// functions for correcting responsive sizes in bootstrap subgrids
random_line_split
buffer.rs
/* * This file is part of the uutils coreutils package. * * (c) Rolf Morel <rolfmorel@gmail.com> * (c) kwantam <kwantam@gmail.com> * substantially rewritten to use the stdlib BufReader trait * rather than re-implementing it here. * * For the full copyright and license information, please view the LICENS...
#[derive(Debug)] pub struct ByteReader<R> where R: Read { inner: BufReader<R>, } impl<R: Read> ByteReader<R> { pub fn new(read: R) -> ByteReader<R> { ByteReader { inner: BufReader::with_capacity(4096, read), } } } impl<R: Read> Read for ByteReader<R> { fn read(&mut self, b...
}
random_line_split
buffer.rs
/* * This file is part of the uutils coreutils package. * * (c) Rolf Morel <rolfmorel@gmail.com> * (c) kwantam <kwantam@gmail.com> * substantially rewritten to use the stdlib BufReader trait * rather than re-implementing it here. * * For the full copyright and license information, please view the LICENS...
(&mut self) -> IoResult<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } } impl<R: Read> ByteReader<R> { pub fn consume_line(&mut self) -> usize { let mut bytes_consumed = 0; let mut consume_val; loop { ...
fill_buf
identifier_name
episodeRow.js
/* * Create the tableViewRow for the Episodes in the MasterView table */ function
(episode){ // Create the row var self = Ti.UI.createTableViewRow( { className: 'episodeRow', backgroundColor: '#FFFFFF', episodeId: episode.id, episodeTitle: episode.title, episodeSubtitle: episode.subtitle, layout: 'vertical', ...
EpisodeRow
identifier_name
episodeRow.js
/* * Create the tableViewRow for the Episodes in the MasterView table */ function EpisodeRow(episode)
top: '8dp', left: '12dp', font:{ fontFamily: 'HelveticaNeue-CondensedBold', fontSize: '11sp' } }); self.add(episodeTitle); // Episode Subtitle var subtitle = Ti.UI.createLabel({ text: episode.subtitle, color: '#000000', tex...
{ // Create the row var self = Ti.UI.createTableViewRow( { className: 'episodeRow', backgroundColor: '#FFFFFF', episodeId: episode.id, episodeTitle: episode.title, episodeSubtitle: episode.subtitle, layout: 'vertical', ...
identifier_body
episodeRow.js
/* * Create the tableViewRow for the Episodes in the MasterView table */ function EpisodeRow(episode){ // Create the row var self = Ti.UI.createTableViewRow( { className: 'episodeRow', backgroundColor: '#FFFFFF', episodeId: episode.id, episodeTitle: ep...
textAlign: 'left', left: '12dp', font: { fontFamily: 'HelveticaNeue-Light', fontSize: '16sp' }, bottom: '8dp' }); self.add(subtitle); // todo: add heard/unheard indicator // todo: add // And return the row return self; } module....
color: '#000000',
random_line_split
tuple_alignment.rs
enum Foo { Bazlooooooooooong(i32, i32, i32, i32, i32, i32), } fn
() { let long_tuple: (u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, f32, f64, char, bool) = (1u8, 2u16, 3u32, 4u64, 5u128, -1i8, -2i16, -3i32, -4i64, -5i128, 0.1f32, 0.2f64, 'a', true); ...
main
identifier_name
tuple_alignment.rs
enum Foo { Bazlooooooooooong(i32, i32, i32, i32, i32, i32), } fn main() { let long_tuple: (u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, f32, f64, char, bool) = (1u8, 2u16, 3u32, 4u64, 5u128,
'a', true); match 1 { FooSome(1234, true, 5678, false, 91011, "foobar") => 10 } }
-1i8, -2i16, -3i32, -4i64, -5i128, 0.1f32, 0.2f64,
random_line_split
borrowck-move-error-with-note.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(box_synt...
random_line_split
borrowck-move-error-with-note.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn move_in_match() { match (S {f: "foo".to_string(), g: "bar".to_string()}) { S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait f: _s, //~ NOTE attempting to move value to here g: _t //~ NOTE and here } => {} } } // from issue-8064 ...
{ println!("{}", self.f); }
identifier_body
borrowck-move-error-with-note.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} } // from issue-8064 struct A { a: Box<isize>, } fn free<T>(_: T) {} fn blah2() { let a = &A { a: box 1 }; match a.a { //~ ERROR cannot move out of n => { //~ NOTE attempting to move value to here free(n) } } free(a) } fn main() {}
{}
conditional_block
borrowck-move-error-with-note.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&mut self) { println!("{}", self.f); } } fn move_in_match() { match (S {f: "foo".to_string(), g: "bar".to_string()}) { S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait f: _s, //~ NOTE attempting to move value to here g: _t //~ NOTE and here ...
drop
identifier_name
Utils.ts
import { Fail, Ok, Result } from "./Result"; export function inlineEscaped(str : string) : Result<string, string> { let result = "" for (let i = 0; i < str.length; ++i) { const ch = str[i]; if (ch == "\\") { if (i + 1 === str.length) { return new Fail("Extra backslash"); } result += str[i + 1]; +...
(line: string) : Result<(str: string) => boolean, string> { return stripComments(line) .bind(escapedSplit) .bind(parts => { if (parts.length === 0) { return new Fail("Empty pattern."); } else if (parts.reduce((sum, str) => sum + str.length, 0) <= 3) { return new Fail("Pattern is too short: " + parts); } ...
parseGlob
identifier_name
Utils.ts
import { Fail, Ok, Result } from "./Result"; export function inlineEscaped(str : string) : Result<string, string> { let result = "" for (let i = 0; i < str.length; ++i) { const ch = str[i]; if (ch == "\\") { if (i + 1 === str.length) { return new Fail("Extra backslash"); } result += str[i + 1]; +...
interface Template { nodeName : string className? : string events? : { click? : ((e: MouseEvent) => void) mousedown? : ((e: MouseEvent) => void) mouseup? : ((e: MouseEvent) => void) }, childNodes? : Node[] type? : string disabled? : boolean width? : number height? : number } export function $(params :...
{ var diff = ( Date.now() - value ) / 1000; if (diff < 60) { return "<1m"; } else if (diff < 3600) { return Math.round(diff / 60) + "m"; } else if (diff < 3600 * 24) { return Math.round(diff / 3600) + "h"; } else if (diff < 3600 * 24 * 365) { return Math.round(diff / 3600 / 24) + "d"; } else { return Ma...
identifier_body
Utils.ts
import { Fail, Ok, Result } from "./Result"; export function inlineEscaped(str : string) : Result<string, string> { let result = "" for (let i = 0; i < str.length; ++i) { const ch = str[i]; if (ch == "\\") { if (i + 1 === str.length) { return new Fail("Extra backslash"); } result += str[i + 1]; +...
if (params.disabled !== undefined) { (element as HTMLInputElement).disabled = params.disabled } if (params.width) { const canvas = element as HTMLCanvasElement canvas.width = params.width canvas.height = params.height } return element; } const MouseButton = Object.freeze({ Left : 0, Middle : 1, }) exp...
{ (element as HTMLInputElement).type = params.type }
conditional_block
Utils.ts
import { Fail, Ok, Result } from "./Result"; export function inlineEscaped(str : string) : Result<string, string> { let result = "" for (let i = 0; i < str.length; ++i) { const ch = str[i]; if (ch == "\\") { if (i + 1 === str.length) { return new Fail("Extra backslash"); } result += str[i + 1]; +...
return new Ok(haystack => glob(parts, haystack)); } }); } export function* enumerate<T>(enumerator: Iterable<T>) : Iterable<[number, T]> { let i = 0; for (const element of enumerator) { yield [i, element]; ++i; } } export function parseGlobs(lines : string[]) { const parsers : ((str: string) => boolean)...
return new Fail("Pattern is too short: " + parts); } else {
random_line_split
mod.rs
it must implement the `Content` trait. This trait is //! automatically implemented on all `Sized` types and on slices (like `[u8]`). This means that //! you can create a `Buffer<Foo>` (if `Foo` is sized) or a `Buffer<[u8]>` for example without //! worrying about it. //! //! However unsized structs don't automatically ...
fn read<F, E>(size: usize, f: F) -> Result<T, E> where F: FnOnce(&mut T) -> Result<(), E> { assert!(size == mem::size_of::<T>()); let mut value = unsafe { mem::uninitialized() }; try!(f(&mut value)); Ok(value) } #[inline] fn get_elements_size() -> usize { mem::si...
type Owned = T; #[inline]
random_line_split
mod.rs
32]` is unsized, therefore `Data` is unsized too //! } //! //! implement_buffer_content!(Data); // without this, you can't put `Data` in a glium buffer //! //! // creates a buffer of 64 bytes, which thus holds 8 f32s //! let mut buffer = glium::buffer::Buffer::<Data>::empty_unsized(&display, BufferType::UniformBuffe...
BufferType
identifier_name
mod.rs
mem::uninitialized() }; //! struct Data { //! data: [f32], // `[f32]` is unsized, therefore `Data` is unsized too //! } //! //! implement_buffer_content!(Data); // without this, you can't put `Data` in a glium buffer //! //! // creates a buffer of 64 bytes, which thus holds 8 f32s //! let mut buffer = gl...
{ BufferMode::Default }
identifier_body
miniep3.py
#! /usr/bin/env python3 import sys import re def uso(): """Imprime instruções de uso do programa.""" uso = """ Este programa gera a ordem correta de inclusão em um banco de dados. Passe o nome dos arquivos na linha de comando. Caso queira imprimir ocorrências de referência circular ou inexistente ...
3: Procurando se é uma referência a criação de chave estrangeira FOREIGN 4: Verificando se é uma referência a criação de chave estrangeira KEY 5: Procurando as referências REFERENCES 6: Procurando o nome da tabela de referência, contando que diferente de ";" 7: Próxima palavra é o novo delimitador ...
2: Procurando o nome da tabela que está sendo criada, contando que diferente de ";"
random_line_split
miniep3.py
#! /usr/bin/env python3 import sys import re def uso():
mprime(dic): """Imprime um dicionário de listas num formato melhorado.""" for key in dic.keys(): print(key + ": ", end="") print(', '.join(dic[key])) def procura(dic, ordem, verb): """Procura uma ordem correta de inclusão enquanto existirem tabelas cujas todas as referências já tenham s...
"""Imprime instruções de uso do programa.""" uso = """ Este programa gera a ordem correta de inclusão em um banco de dados. Passe o nome dos arquivos na linha de comando. Caso queira imprimir ocorrências de referência circular ou inexistente utilize a opção -v. """ print(uso) def i
identifier_body
miniep3.py
#! /usr/bin/env python3 import sys import re def uso(): """Imprime instruções de uso do programa.""" uso = """ Este programa gera a ordem correta de inclusão em um banco de dados. Passe o nome dos arquivos na linha de comando. Caso queira imprimir ocorrências de referência circular ou inexistente ...
t() """ Tabelas a serem removidas nesta iteração. """ for table in dic.keys(): if len(dic[table]) == 0: lst.add(table) if len(lst) == 0: """ Caso todas as tabelas restantes possuam referências a serem processadas restaram apenas referências inexistentes ou circulares.""" ...
alizada. """ return ordem lst = se
conditional_block
miniep3.py
#! /usr/bin/env python3 import sys import re def uso(): """Imprime instruções de uso do programa.""" uso = """ Este programa gera a ordem correta de inclusão em um banco de dados. Passe o nome dos arquivos na linha de comando. Caso queira imprimir ocorrências de referência circular ou inexistente ...
""Gera uma lista de procedencia para cada tabela. Inicialmente a função iria trabalhar com o arquivo separado por linhas, mas como o arquivo pode ser inteiro feito em apenas uma linha modifiquei a estratégia para uma varredura de estados. Não me preocupei com erros de sintaxe. Lista de est...
erb): "
identifier_name
CheckConditionsCard.tsx
// Libraries import React, {FC} from 'react' import {connect} from 'react-redux' // Components import { FlexBox, FlexDirection, AlignItems, ComponentSize, } from '@influxdata/clockface' import ThresholdConditions from 'src/alerting/components/builder/ThresholdConditions' import DeadmanConditions from 'src/aler...
else { throw new Error('Incorrect check type provided to <CheckConditionsCard/>') } return ( <BuilderCard testID="builder-conditions" className="alert-builder--card alert-builder--conditions-card" > <BuilderCard.Header title={cardTitle} /> <BuilderCard.Body addPadding={true} au...
{ cardTitle = 'Thresholds' conditionsComponent = <ThresholdConditions /> }
conditional_block
CheckConditionsCard.tsx
// Libraries import React, {FC} from 'react' import {connect} from 'react-redux' // Components import { FlexBox, FlexDirection, AlignItems, ComponentSize, } from '@influxdata/clockface' import ThresholdConditions from 'src/alerting/components/builder/ThresholdConditions' import DeadmanConditions from 'src/aler...
} return ( <BuilderCard testID="builder-conditions" className="alert-builder--card alert-builder--conditions-card" > <BuilderCard.Header title={cardTitle} /> <BuilderCard.Body addPadding={true} autoHideScrollbars={true}> <FlexBox direction={FlexDirection.Column} ...
} else if (checkType === 'threshold') { cardTitle = 'Thresholds' conditionsComponent = <ThresholdConditions /> } else { throw new Error('Incorrect check type provided to <CheckConditionsCard/>')
random_line_split
coerce-reborrow-mut-vec-arg.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let mut the_vec = vec!(1, 2, 3, 100); bar(&mut the_vec); assert_eq!(the_vec, [100, 3, 2, 1]); }
pub fn main() {
random_line_split
coerce-reborrow-mut-vec-arg.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(v: &mut [usize]) { v.reverse(); } fn bar(v: &mut [usize]) { reverse(v); reverse(v); reverse(v); } pub fn main() { let mut the_vec = vec!(1, 2, 3, 100); bar(&mut the_vec); assert_eq!(the_vec, [100, 3, 2, 1]); }
reverse
identifier_name
coerce-reborrow-mut-vec-arg.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn bar(v: &mut [usize]) { reverse(v); reverse(v); reverse(v); } pub fn main() { let mut the_vec = vec!(1, 2, 3, 100); bar(&mut the_vec); assert_eq!(the_vec, [100, 3, 2, 1]); }
{ v.reverse(); }
identifier_body
dpo.src.js
/** * @license Highstock JS v8.0.3 (2020-03-06) * * Indicator series type for Highstock * * (c) 2010-2019 Wojciech Chmiel * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.ex...
} return correctFloat(sum + price); } /* eslint-enable valid-jsdoc */ /** * The DPO series type. * * @private * @class * @name Highcharts.seriesTypes.dpo * * @augments Highcharts.Series */ ser...
yVal[i]); if (subtract) { return correctFloat(sum - price);
random_line_split
dpo.src.js
/** * @license Highstock JS v8.0.3 (2020-03-06) * * Indicator series type for Highstock * * (c) 2010-2019 Wojciech Chmiel * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.ex...
return correctFloat(sum + price); } /* eslint-enable valid-jsdoc */ /** * The DPO series type. * * @private * @class * @name Highcharts.seriesTypes.dpo * * @augments Highcharts.Series */ seriesType('dpo'...
{ return correctFloat(sum - price); }
conditional_block
dpo.src.js
/** * @license Highstock JS v8.0.3 (2020-03-06) * * Indicator series type for Highstock * * (c) 2010-2019 Wojciech Chmiel * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.ex...
(obj, path, args, fn) { if (!obj.hasOwnProperty(path)) { obj[path] = fn.apply(null, args); } } _registerModule(_modules, 'indicators/dpo.src.js', [_modules['parts/Utilities.js']], function (U) { /* * * * License: www.highcharts.com/license * ...
_registerModule
identifier_name
dpo.src.js
/** * @license Highstock JS v8.0.3 (2020-03-06) * * Indicator series type for Highstock * * (c) 2010-2019 Wojciech Chmiel * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.ex...
/* eslint-enable valid-jsdoc */ /** * The DPO series type. * * @private * @class * @name Highcharts.seriesTypes.dpo * * @augments Highcharts.Series */ seriesType('dpo', 'sma', /** * Detrended Price Oscilla...
{ var price = pick(yVal[i][index], yVal[i]); if (subtract) { return correctFloat(sum - price); } return correctFloat(sum + price); }
identifier_body
util_split.py
# -*- coding: utf-8 -*- # # This file is part of JSONAlchemy. # Copyright (C) 2013, 2014, 2015 CERN. # # JSONAlchemy 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 yo...
""" Helper function to split safely a string and get the n-th element. :param string: String to be split :param separator: :param index: n-th part of the split string to return :return: The n-th part of the string or empty string in case of error """ string_splitted = string.split(separato...
identifier_body
util_split.py
# -*- coding: utf-8 -*- #
# # JSONAlchemy 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 version. # # JSONAlchemy is distributed in the hope that it will be useful, but ...
# This file is part of JSONAlchemy. # Copyright (C) 2013, 2014, 2015 CERN.
random_line_split
util_split.py
# -*- coding: utf-8 -*- # # This file is part of JSONAlchemy. # Copyright (C) 2013, 2014, 2015 CERN. # # JSONAlchemy 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 yo...
(string, separator, index): """ Helper function to split safely a string and get the n-th element. :param string: String to be split :param separator: :param index: n-th part of the split string to return :return: The n-th part of the string or empty string in case of error """ string_...
util_split
identifier_name
odp.js
'use strict' // Module dependencies. var request = require('request') var querystring = require('querystring') var userAgent = require('random-useragent') // Root for all endpoints. var _baseUrl = 'http://data.europa.eu/euodp/data/api/action' // Infrastructure prevents requests from original user agent of requestee. ...
resolve(body) }) }) } /** * Get a list of the datasets in JSON. * @param {object} options - The request set of options. * @param {number} options.query.limit - Limit the number of items returned. * @param {number} options.query.offset - Acts like pagination when limited results. */ module.exports.get...
{ reject(error) }
conditional_block
odp.js
'use strict' // Module dependencies. var request = require('request') var querystring = require('querystring') var userAgent = require('random-useragent') // Root for all endpoints. var _baseUrl = 'http://data.europa.eu/euodp/data/api/action' // Infrastructure prevents requests from original user agent of requestee. ...
* @param {object} options.query - The query parameters. * @param {string} options.body.id - The id of the data set. * For example: {"id": "dgt-translation-memory"} */ module.exports.getDataset = (options) => { return _sendRequest({ method: 'POST', endpoint: 'package_show', query: (options !== undefin...
* Return a list of the site's tags. * @param {object} options - The request set of options.
random_line_split
odp.js
'use strict' // Module dependencies. var request = require('request') var querystring = require('querystring') var userAgent = require('random-useragent') // Root for all endpoints. var _baseUrl = 'http://data.europa.eu/euodp/data/api/action' // Infrastructure prevents requests from original user agent of requestee. ...
/** * Get a list of the datasets in JSON. * @param {object} options - The request set of options. * @param {number} options.query.limit - Limit the number of items returned. * @param {number} options.query.offset - Acts like pagination when limited results. */ module.exports.getDatasets = (options) => { return...
{ return new Promise((resolve, reject) => { var query = querystring.stringify(options.query) var bodyData = JSON.stringify(options.body) request({ url: _baseUrl + `/${options.endpoint}?${query}`, headers: headers, method: options.method, body: bodyData }, (error, response, bod...
identifier_body
odp.js
'use strict' // Module dependencies. var request = require('request') var querystring = require('querystring') var userAgent = require('random-useragent') // Root for all endpoints. var _baseUrl = 'http://data.europa.eu/euodp/data/api/action' // Infrastructure prevents requests from original user agent of requestee. ...
(options) { return new Promise((resolve, reject) => { var query = querystring.stringify(options.query) var bodyData = JSON.stringify(options.body) request({ url: _baseUrl + `/${options.endpoint}?${query}`, headers: headers, method: options.method, body: bodyData }, (error, re...
_sendRequest
identifier_name
javalab.service.ts
import {Injectable} from "@angular/core"; import {Http, Headers, RequestOptions, RequestMethod, ResponseContentType} from "@angular/http"; import "rxjs/add/operator/toPromise"; import {FileNode, GlobalModel} from "../common"; import fileSaver = require("file-saver"); const BASE = "http://localhost:48080/rest/process";...
else if (node.children !== null && node.children !== undefined) { var result = null; for (var i = 0; result === null && i < node.children.length; i++) { result = this.searchNode(id, node.children[i]); } return result; } return null; } ...
{ return node; }
conditional_block