file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
sqlite1.py
import sqlite3 import os.path import sys import random def makeDatabase(databaseName): if databaseName[-3:] != ".db": databaseName = databaseName + ".db" conn = sqlite3.connect(databaseName) conn.commit() conn.close() def listToString(list): string = "" for i in list: string += str(i)+"\t" return string[:-...
def getURLsToGrade(self, wID, labNumber): self.cursor.execute("Select URLsToGrade FROM submissions WHERE wID=? and labNumber=?", [wID, labNumber]) dbExtract = self.cursor.fetchone() if dbExtract == None: return False else: return [i for i in stringToList(dbExtract[0])] def addGrade(self, wID, labNumb...
self.cursor.execute("SELECT URL FROM experts WHERE labNumber=? and hidden=0", [labNumber]) expertURL = [str(d[0]) for d in self.cursor.fetchall()] # find all the hidden expert videos self.cursor.execute("SELECT URL FROM experts WHERE labNumber=? and hidden=1", [labNumber]) hiddenURL = [str(d[0]) for d in s...
identifier_body
sqlite1.py
import sqlite3 import os.path import sys import random def makeDatabase(databaseName): if databaseName[-3:] != ".db": databaseName = databaseName + ".db" conn = sqlite3.connect(databaseName) conn.commit() conn.close() def listToString(list): string = "" for i in list: string += str(i)+"\t" return string[:-...
##find a way to make seperate expert tables for each lab, and then join them together to prevent the staggaring of grades in the excel sheet #self.cursor.execute("SELECT * FROM expert WHERE Lab1Grade") #print self.cursor.fetchall() #query = ("SELECT {0} FROM expert WHERE wID def getExpertURLs(self, labNum...
sys.exit("Trying to overrite")
conditional_block
sqlite1.py
import sqlite3 import os.path import sys import random def makeDatabase(databaseName): if databaseName[-3:] != ".db": databaseName = databaseName + ".db" conn = sqlite3.connect(databaseName) conn.commit() conn.close() def listToString(list): string = "" for i in list: string += str(i)+"\t" return string[:-...
sqldb.check(1) # sqldb.addExpert("expertVideo", 1, 1) # sqldb.addExpert("test2", 2, 2)
sqldb.compareToExpert("1",1)
random_line_split
sqlite1.py
import sqlite3 import os.path import sys import random def makeDatabase(databaseName): if databaseName[-3:] != ".db": databaseName = databaseName + ".db" conn = sqlite3.connect(databaseName) conn.commit() conn.close() def listToString(list): string = "" for i in list: string += str(i)+"\t" return string[:-...
(self): #creates tables if they do not exist self.cursor.execute("CREATE TABLE IF NOT EXISTS students (wID text, email text, UNIQUE(wID, email) ON CONFLICT ABORT)") self.cursor.execute("CREATE TABLE IF NOT EXISTS submissions (labNumber int, wID text, URL text, metadata text, URLsToGrade text)") self.cursor.exec...
createTables
identifier_name
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public
#![feature(custom_derive)] #![feature(plugin)] #![feature(mpsc_select)] #![feature(plugin)] #![plugin(plugins)] #![deny(unsafe_code)] #![plugin(serde_macros)] extern crate backtrace; extern crate canvas; extern crate canvas_traits; extern crate compositing; extern crate devtools_traits; extern crate euclid; #[cfg(not...
* 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/. */ #![feature(box_syntax)]
random_line_split
component_info.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A `PropertyBinding` represents a mapping between a property name * and an attribute name. It is parsed from ...
}
{ this.bracketAttr = `[${this.attr}]`; this.parenAttr = `(${this.attr})`; this.bracketParenAttr = `[(${this.attr})]`; const capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.substr(1); this.onAttr = `on${capitalAttr}`; this.bindAttr = `bind${capitalAttr}`; this.bindonAttr = `bindon...
identifier_body
component_info.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A `PropertyBinding` represents a mapping between a property name * and an attribute name. It is parsed from ...
() { this.bracketAttr = `[${this.attr}]`; this.parenAttr = `(${this.attr})`; this.bracketParenAttr = `[(${this.attr})]`; const capitalAttr = this.attr.charAt(0).toUpperCase() + this.attr.substr(1); this.onAttr = `on${capitalAttr}`; this.bindAttr = `bind${capitalAttr}`; this.bindonAttr = `bin...
parseBinding
identifier_name
component_info.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A `PropertyBinding` represents a mapping between a property name * and an attribute name. It is parsed from ...
}
random_line_split
ReflectionGroup.ts
import { Reflection, ReflectionKind } from './reflections/abstract'; /** * A group of reflections. All reflections in a group are of the same kind. * * Reflection groups are created by the ´GroupHandler´ in the resolving phase * of the dispatcher. The main purpose of groups is to be able to more easily * render h...
const children: any[] = []; this.children.forEach((child) => { children.push(child.id); }); result['children'] = children; } return result; } }
if (this.children) {
random_line_split
ReflectionGroup.ts
import { Reflection, ReflectionKind } from './reflections/abstract'; /** * A group of reflections. All reflections in a group are of the same kind. * * Reflection groups are created by the ´GroupHandler´ in the resolving phase * of the dispatcher. The main purpose of groups is to be able to more easily * render h...
return result; } }
const children: any[] = []; this.children.forEach((child) => { children.push(child.id); }); result['children'] = children; }
conditional_block
ReflectionGroup.ts
import { Reflection, ReflectionKind } from './reflections/abstract'; /** * A group of reflections. All reflections in a group are of the same kind. * * Reflection groups are created by the ´GroupHandler´ in the resolving phase * of the dispatcher. The main purpose of groups is to be able to more easily * render h...
/** * The title, a string representation of the typescript kind, of this group. */ title: string; /** * The original typescript kind of the children of this group. */ kind: ReflectionKind; /** * All reflections of this group. */ children: Reflection[] = []; ...
flectionGroup {
identifier_name
ReflectionGroup.ts
import { Reflection, ReflectionKind } from './reflections/abstract'; /** * A group of reflections. All reflections in a group are of the same kind. * * Reflection groups are created by the ´GroupHandler´ in the resolving phase * of the dispatcher. The main purpose of groups is to be able to more easily * render h...
const result = { title: this.title, kind: this.kind }; if (this.children) { const children: any[] = []; this.children.forEach((child) => { children.push(child.id); }); result['children'] = children; ...
identifier_body
const-vec-of-fns.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
static bare_fns: &'static [extern fn()] = &[f, f]; struct S<'self>(&'self fn()); static closures: &'static [S<'static>] = &[S(f), S(f)]; pub fn main() { for &bare_fn in bare_fns.iter() { bare_fn() } for &closure in closures.iter() { (*closure)() } }
{ }
identifier_body
const-vec-of-fns.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { for &bare_fn in bare_fns.iter() { bare_fn() } for &closure in closures.iter() { (*closure)() } }
main
identifier_name
const-vec-of-fns.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// FIXME: #7385: hits a codegen bug on OS X x86_64 /*! * Try to double-check that static fns have the right size (with or * without dummy env ptr, as appropriate) by iterating a size-2 array. * If the static size differs from the runtime size, the second element * should be read as a null or otherwise wrong pointe...
// option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-test
random_line_split
cfg.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// trailing comma is optional,. p.expect(&token::COMMA); } // test_cfg searches for meta items looking like `cfg(foo, ...)` let in_cfg = &[cx.meta_list(sp, InternedString::new("cfg"), cfgs)]; let matches_cfg = attr::test_cfg(cx.cfg().as_slice(), in_cfg.ite...
{ break }
conditional_block
cfg.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult> { let mut p = cx.new_parser_from_tts(tts); let mut cfgs = Vec::new(); // parse `cfg!(meta_item, meta_item(x,y), meta_item="foo", ...)` while p.token != token::EOF { cfgs.push(p.parse_meta_item()); ...
expand_cfg
identifier_name
cfg.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
use ast; use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; use attr; use attr::*; use parse::attr::ParserAttr; use parse::token::InternedString; use parse::token; pub fn expand_cfg(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Box<base::MacResult> { let mut...
match the current compilation environment. */
random_line_split
cfg.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let mut p = cx.new_parser_from_tts(tts); let mut cfgs = Vec::new(); // parse `cfg!(meta_item, meta_item(x,y), meta_item="foo", ...)` while p.token != token::EOF { cfgs.push(p.parse_meta_item()); if p.eat(&token::EOF) { break } // trailing comma is optional,. p.expect(&token::CO...
identifier_body
index.js
import selectorParser from "postcss-selector-parser" import { isKeyframeRule, isStandardRule, isStandardSelector, isStandardTypeSelector, report, ruleMessages, validateOptions, } from "../../utils" export const ruleName = "selector-type-case" export const messages = ruleMessages(ruleName, { expected: ...
function checkSelector(selectorAST) { selectorAST.walkTags(tag => { if (!isStandardTypeSelector(tag)) { return } const { sourceIndex, value } = tag const expectedValue = expectation === "lower" ? value.toLowerCase() : value.toUpperCase() if (value === expectedV...
{ return }
conditional_block
index.js
import selectorParser from "postcss-selector-parser" import { isKeyframeRule, isStandardRule, isStandardSelector, isStandardTypeSelector, report, ruleMessages, validateOptions, } from "../../utils" export const ruleName = "selector-type-case" export const messages = ruleMessages(ruleName, { expected: ...
selectorParser(checkSelector).process(selector) }) } }
ruleName, result, }) }) }
random_line_split
index.js
import selectorParser from "postcss-selector-parser" import { isKeyframeRule, isStandardRule, isStandardSelector, isStandardTypeSelector, report, ruleMessages, validateOptions, } from "../../utils" export const ruleName = "selector-type-case" export const messages = ruleMessages(ruleName, { expected: ...
(selectorAST) { selectorAST.walkTags(tag => { if (!isStandardTypeSelector(tag)) { return } const { sourceIndex, value } = tag const expectedValue = expectation === "lower" ? value.toLowerCase() : value.toUpperCase() if (value === expectedValue) { return } re...
checkSelector
identifier_name
index.js
import selectorParser from "postcss-selector-parser" import { isKeyframeRule, isStandardRule, isStandardSelector, isStandardTypeSelector, report, ruleMessages, validateOptions, } from "../../utils" export const ruleName = "selector-type-case" export const messages = ruleMessages(ruleName, { expected: ...
selectorParser(checkSelector).process(selector) }) } }
{ selectorAST.walkTags(tag => { if (!isStandardTypeSelector(tag)) { return } const { sourceIndex, value } = tag const expectedValue = expectation === "lower" ? value.toLowerCase() : value.toUpperCase() if (value === expectedValue) { return } report({ ...
identifier_body
air_quality.py
"""Support for the Airly air_quality service.""" from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_PM_2_5, ATTR_PM_10, AirQualityEntity, ) from homeassistant.const import CONF_NAME from .const import ( ATTR_API_ADVICE, ATTR_API_CAQI, ATTR_API_CAQI_DESCRIPTION, ATTR_API_C...
async def async_update(self): """Update Airly entity.""" await self.coordinator.async_request_refresh()
"""Connect to dispatcher listening for entity data notifications.""" self.async_on_remove( self.coordinator.async_add_listener(self.async_write_ha_state) )
identifier_body
air_quality.py
"""Support for the Airly air_quality service.""" from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_PM_2_5, ATTR_PM_10, AirQualityEntity, ) from homeassistant.const import CONF_NAME from .const import ( ATTR_API_ADVICE, ATTR_API_CAQI, ATTR_API_CAQI_DESCRIPTION, ATTR_API_C...
return res return _decorator class AirlyAirQuality(AirQualityEntity): """Define an Airly air quality.""" def __init__(self, coordinator, name, unique_id): """Initialize.""" self.coordinator = coordinator self._name = name self._unique_id = unique_id self....
return round(res)
conditional_block
air_quality.py
"""Support for the Airly air_quality service.""" from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_PM_2_5, ATTR_PM_10, AirQualityEntity, ) from homeassistant.const import CONF_NAME from .const import ( ATTR_API_ADVICE, ATTR_API_CAQI, ATTR_API_CAQI_DESCRIPTION, ATTR_API_C...
"""Return the state attributes.""" return { LABEL_AQI_DESCRIPTION: self.coordinator.data[ATTR_API_CAQI_DESCRIPTION], LABEL_ADVICE: self.coordinator.data[ATTR_API_ADVICE], LABEL_AQI_LEVEL: self.coordinator.data[ATTR_API_CAQI_LEVEL], LABEL_PM_2_5_LIMIT: self...
@property def device_state_attributes(self):
random_line_split
air_quality.py
"""Support for the Airly air_quality service.""" from homeassistant.components.air_quality import ( ATTR_AQI, ATTR_PM_2_5, ATTR_PM_10, AirQualityEntity, ) from homeassistant.const import CONF_NAME from .const import ( ATTR_API_ADVICE, ATTR_API_CAQI, ATTR_API_CAQI_DESCRIPTION, ATTR_API_C...
(self): """Return the air quality index.""" return self.coordinator.data[ATTR_API_CAQI] @property @round_state def particulate_matter_2_5(self): """Return the particulate matter 2.5 level.""" return self.coordinator.data[ATTR_API_PM25] @property @round_state def...
air_quality_index
identifier_name
main.rs
fn main() { // var() // control_flow() let n = 45; let big = fib(n); println!("{}th fib: {}", n, big); } fn var()
fn control_flow() { let number = 3; if number < 5 { println!("condition was true"); } else { println!("condition was false"); } let a = [1, 2, 3, 4, 5]; for e in a.iter() { println!("I'm looping {}", e) } for number in (1..4).rev() { println!("{}!", n...
{ let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let tup: (i32, f64, u8) = (500, 6.4, 1); let (_, y, _) = tup; println!("The value of y is: {}", y); println!("The value if x is: {}", tup.0); }
identifier_body
main.rs
fn main() { // var() // control_flow() let n = 45; let big = fib(n); println!("{}th fib: {}", n, big); } fn var() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let tup: (i32, f64, u8) = (500, 6.4, 1); let (_, y, _) = tu...
(n: u32) -> u32 { if n == 0 { 1 } else if n == 1 { 1 } else if n == 2 { 2 } else { fib(n - 1) + fib(n - 2) } }
fib
identifier_name
main.rs
fn main() { // var() // control_flow() let n = 45; let big = fib(n); println!("{}th fib: {}", n, big); } fn var() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let tup: (i32, f64, u8) = (500, 6.4, 1); let (_, y, _) = tu...
fn control_flow() { let number = 3; if number < 5 { println!("condition was true"); } else { println!("condition was false"); } let a = [1, 2, 3, 4, 5]; for e in a.iter() { println!("I'm looping {}", e) } for number in (1..4).rev() { println!("{}!", nu...
println!("The value of y is: {}", y); println!("The value if x is: {}", tup.0); }
random_line_split
main.rs
fn main() { // var() // control_flow() let n = 45; let big = fib(n); println!("{}th fib: {}", n, big); } fn var() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let tup: (i32, f64, u8) = (500, 6.4, 1); let (_, y, _) = tu...
else { fib(n - 1) + fib(n - 2) } }
{ 2 }
conditional_block
Window.ts
/* * Copyright 2017 András Parditka. * * This file is part of Ecset. * * Ecset is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. ...
}
public contentFactory: () => m.Comp<any, any>, ) { }
random_line_split
Window.ts
/* * Copyright 2017 András Parditka. * * This file is part of Ecset. * * Ecset is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. ...
}
}
identifier_body
Window.ts
/* * Copyright 2017 András Parditka. * * This file is part of Ecset. * * Ecset is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. ...
public id: string, public contentFactory: () => m.Comp<any, any>, ) { } }
onstructor(
identifier_name
files.ts
import {Request, Response} from "express"; import { DetailedFile } from '../models/DetailedFile'; import * as utils from '../utils/WopiUtil'; export let fileRequestHandler = (req: Request, res: Response) => { console.log('Handling ' + req.method + ' request for file/folder id ' + req.params["id"]); res.status...
files.push(pptFile); utils.PopulateActions(files); console.log(files); };
let pptFile = new DetailedFile(); pptFile.BaseFileName = 'myPPTFile.pptx'; files.push(docFile); files.push(xlFile);
random_line_split
library.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # Convolve MTSS rotamers with MD trajectory. # Copyright (c) 2011-2017 Philip Fowler and AUTHORS # Published under the GNU Public Licence, version 2 (or higher) # # Includ...
return pkg_resources.resource_filename(__name__, os.path.join(pkglibdir, filename)) class RotamerLibrary(object): """Rotamer library The library makes available the attributes :attr:`rotamers`, and :attr:`weights`. .. attribute:: rotamers :class:`MDAnalysis.core.AtomGroup.Universe` instance ...
return MDAnalysis.lib.util.realpath(filename)
conditional_block
library.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # Convolve MTSS rotamers with MD trajectory. # Copyright (c) 2011-2017 Philip Fowler and AUTHORS # Published under the GNU Public Licence, version 2 (or higher) # # Includ...
(self): return "<RotamerLibrary '{0}' by {1} with {2} rotamers>".format(self.name, self.lib['author'], len(self.weights))
__repr__
identifier_name
library.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # Convolve MTSS rotamers with MD trajectory. # Copyright (c) 2011-2017 Philip Fowler and AUTHORS # Published under the GNU Public Licence, version 2 (or higher) # # Includ...
1) If the *filename* exists, return rooted canonical path. 2) Otherwise, create a path to file in the installed *pkglibdir*. .. note:: A file name is *always* returned, even if the file does not exist (because this is how :func:`pkg_resources.resource_filename` works). """ if ...
random_line_split
library.py
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # Convolve MTSS rotamers with MD trajectory. # Copyright (c) 2011-2017 Philip Fowler and AUTHORS # Published under the GNU Public Licence, version 2 (or higher) # # Includ...
class RotamerLibrary(object): """Rotamer library The library makes available the attributes :attr:`rotamers`, and :attr:`weights`. .. attribute:: rotamers :class:`MDAnalysis.core.AtomGroup.Universe` instance that records all rotamers as a trajectory .. attribute:: weights NumP...
"""Return full path to file *filename*. 1) If the *filename* exists, return rooted canonical path. 2) Otherwise, create a path to file in the installed *pkglibdir*. .. note:: A file name is *always* returned, even if the file does not exist (because this is how :func:`pkg_resources.resource...
identifier_body
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use fbinit::FacebookInit; use futures_stats::{FutureStats, StreamStats}; use metadata::Metadata; use nonzero_ext::nonze...
<K: Into<String>>(&mut self, key: K) -> Entry<String, ScubaValue> { self.inner.entry(key) } pub fn flush(&self, timeout: Duration) { self.inner.flush(timeout) } pub fn get_sample(&self) -> &ScubaSample { self.inner.get_sample() } pub fn add_opt<K: Into<String>, V: Into...
entry
identifier_name
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use fbinit::FacebookInit; use futures_stats::{FutureStats, StreamStats}; use metadata::Metadata; use nonzero_ext::nonze...
self.log() } pub fn add_common_server_data(&mut self) -> &mut Self { self.inner.add_common_server_data(); self } pub fn sampling(&self) -> &Sampling { self.inner.sampling() } pub fn add_mapped_common_server_data<F>(&mut self, mapper: F) -> &mut Self where...
{ // Return value of the `log` function indicates whether // the sample passed sampling. If it's too verbose, let's // return false return false; }
conditional_block
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use fbinit::FacebookInit; use futures_stats::{FutureStats, StreamStats}; use metadata::Metadata; use nonzero_ext::nonze...
pub fn add_stream_stats(&mut self, stats: &StreamStats) -> &mut Self { self.inner .add("poll_count", stats.poll_count) .add("poll_time_us", stats.poll_time.as_micros_unchecked()) .add("count", stats.count) .add( "completion_time_us", ...
{ if !self.should_log_with_level(ScubaVerbosityLevel::Verbose) { return; } self.log_with_msg(log_tag, msg) }
identifier_body
lib.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #![deny(warnings)] use fbinit::FacebookInit; use futures_stats::{FutureStats, StreamStats}; use metadata::Metadata; use nonzero_ext::nonze...
pub fn log_with_msg_verbose<S: Into<Option<String>>>(&mut self, log_tag: &str, msg: S) { if !self.should_log_with_level(ScubaVerbosityLevel::Verbose) { return; } self.log_with_msg(log_tag, msg) } pub fn add_stream_stats(&mut self, stats: &StreamStats) -> &mut Self { ...
} /// Same as `log_with_msg`, but sample is assumed to be verbose and is only logged /// if verbose logging conditions are met
random_line_split
binding_on_syntax.test.ts
import { expect } from "chai"; import { Binding } from "../../src/bindings/binding"; import { BindingScopeEnum } from "../../src/constants/literal_types"; import { interfaces } from "../../src/interfaces/interfaces"; import { BindingOnSyntax } from "../../src/syntax/binding_on_syntax"; describe("BindingOnSyntax", () =...
});
expect(binding.onActivation).not.to.eql(null); });
random_line_split
user-form.js
PhaxMachine.pages['user-form'] = { render: function() { $('#addUserEmail').on('click', function() { var emailInputs = $('#userEmailList input[type=email]'); var nextIdx = emailInputs.length; var newInput = emailInputs.first().clone(); newInput.attr('id', 'user...
} }
});
random_line_split
link-checker.js
const glob = require('glob'); const fs = require('fs'); const path = require('path'); const request = require('request'); const checkedUrls = { 'src/archive/index.php': '', }; function
(url) { return new Promise(function(resolve, reject) { request( url, { followRedirect: false, followAllRedirects: false, headers: { 'Cache-Control': 'no-cache' } }, (error, response, body) => resolve([response.statusCode, body])); }); } function createUrl(file) { ...
getUrlContents
identifier_name
link-checker.js
const glob = require('glob'); const fs = require('fs'); const path = require('path'); const request = require('request'); const checkedUrls = { 'src/archive/index.php': '', }; function getUrlContents(url) { return new Promise(function(resolve, reject) { request( url, { followRe...
async function verifyFile(file) { const regex = /<a.*href=['"]([^'"]+)['"]/g; const [statusCode, contents] = await getUrlContents(createUrl(file)); if (statusCode !== 200) { //console.log(`\u2753 Ignoring ${file} (${statusCode})`); } let matches; let urlCount = 0; let validUrls =...
{ let isValid = false; const currentDirectory = path.dirname(file); let targetPath; if (url.startsWith('#')) { targetPath = file; } else { targetPath = path.join(url.startsWith('/') ? 'src' : currentDirectory, url.split('?')[0]); } if (targetPath.endsWith('/')) { t...
identifier_body
link-checker.js
const glob = require('glob'); const fs = require('fs'); const path = require('path'); const request = require('request'); const checkedUrls = { 'src/archive/index.php': '', }; function getUrlContents(url) { return new Promise(function(resolve, reject) { request( url, { followRe...
let matches; let urlCount = 0; let validUrls = []; let invalidUrls = []; let ignoredUrls = []; while ((matches = regex.exec(contents))) { const [urlMatch] = matches.slice(1); const [url, id] = urlMatch.split('#'); const ignoreList = ['mailto:', 'dist/', 'http']; ...
{ //console.log(`\u2753 Ignoring ${file} (${statusCode})`); }
conditional_block
link-checker.js
const glob = require('glob'); const fs = require('fs'); const path = require('path'); const request = require('request'); const checkedUrls = { 'src/archive/index.php': '', }; function getUrlContents(url) { return new Promise(function(resolve, reject) { request( url, { followRe...
if (isValid) { validUrls.push(urlMatch); } else { invalidUrls.push(urlMatch); } } urlCount++; } if (invalidUrls.length) { console.log(`\u274C Found errors in ${file}. Invalid URLs found linking to:\n-> ${invalidUrls.jo...
random_line_split
checkout-yubikey.py
#!/usr/bin/python ### # # checkout-yubikey.py # # Troy Axthelm # Advanced Research Computing Center # University of Wyoming # troy.axthelm@uwyo.edu # # Created: 13 June 2016 # # # Modified: <initials> <day> <month> <year> <change notes> # ### import sys sys.path.insert(0, './lib/') import logging import subprocess im...
# version parser.add_argument('--version', action='version', version="%(prog)s "+__version__) parser.add_argument('username', nargs='+') parser.add_argument('yubikeyid', nargs='+') # create parser args = parser.parse_args() print args #issue ipa command idm_manage.addyubikey(args.username[0], args.yubikeyid[0])
parser.set_defaults()
random_line_split
quobyte.py
# Copyright (c) 2015 Quobyte Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
(self, connection_info, instance): """Disconnect the volume.""" mount_path = self._get_mount_path(connection_info) try: validate_volume(mount_path) except (nova_exception.InvalidVolume, nova_exception.StaleVolumeMount) as exc: LOG.warning("Could n...
disconnect_volume
identifier_name
quobyte.py
# Copyright (c) 2015 Quobyte Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
_is_systemd = None def is_systemd(): """Checks if the host is running systemd""" global _is_systemd if _is_systemd is not None: return _is_systemd tmp_is_systemd = False if psutil.Process(1).name() == "systemd" or os.path.exists( SYSTEMCTL_CHECK_PATH): # NOTE(kaisers...
SYSTEMCTL_CHECK_PATH = "/run/systemd/system"
random_line_split
quobyte.py
# Copyright (c) 2015 Quobyte Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
def _normalize_export(self, export): protocol = SOURCE_PROTOCOL + "://" if export.startswith(protocol): export = export[len(protocol):] return export
"""Disconnect the volume.""" mount_path = self._get_mount_path(connection_info) try: validate_volume(mount_path) except (nova_exception.InvalidVolume, nova_exception.StaleVolumeMount) as exc: LOG.warning("Could not disconnect Quobyte volume mount: %s", ex...
identifier_body
quobyte.py
# Copyright (c) 2015 Quobyte Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
_is_systemd = tmp_is_systemd return _is_systemd def mount_volume(volume, mnt_base, configfile=None): """Wraps execute calls for mounting a Quobyte volume""" fileutils.ensure_tree(mnt_base) # Note(kaisers): with systemd this requires a separate CGROUP to # prevent Nova service stop/restarts ...
if state == sysdout.strip(): tmp_is_systemd = True break
conditional_block
capitalize-pipe.ts
/// <reference path="../../../typings/_custom.d.ts" /> import {Pipe, PipeFactory} from 'angular2/angular2'; // Check if the value is supported for the pipe export function isString(txt): boolean { return typeof txt === 'string'; } // Simple example of a Pipe export class CapitalizePipe implements Pipe { regexp: R...
(): void { // not needed since this is stateless } } // We create a factory since we create an instance for each binding for stateful pipes export class CapitalizeFactory implements PipeFactory { supports(txt): boolean { return isString(txt); } create(cdRef): Pipe { return new CapitalizePipe(); ...
onDestroy
identifier_name
capitalize-pipe.ts
/// <reference path="../../../typings/_custom.d.ts" /> import {Pipe, PipeFactory} from 'angular2/angular2'; // Check if the value is supported for the pipe export function isString(txt): boolean { return typeof txt === 'string'; } // Simple example of a Pipe export class CapitalizePipe implements Pipe { regexp: R...
create(cdRef): Pipe { return new CapitalizePipe(); } } // Since templates in angular are async we are passing the value to // NullPipeFactory if the value is not supported export var capitalize = [ new CapitalizeFactory() ];
{ return isString(txt); }
identifier_body
capitalize-pipe.ts
/// <reference path="../../../typings/_custom.d.ts" /> import {Pipe, PipeFactory} from 'angular2/angular2'; // Check if the value is supported for the pipe export function isString(txt): boolean { return typeof txt === 'string'; } // Simple example of a Pipe export class CapitalizePipe implements Pipe { regexp: R...
} transform(value: string, args?: List<any>): any { return (!value) ? '' : (!args) ? CapitalizePipe.capitalizeWord(value) : value.replace(this.regexp, CapitalizePipe.capitalizeWord); } static capitalizeWord(txt: string): string { return txt.charAt(0).toUpperCase() + txt.substr(1).t...
random_line_split
prepare.js
/** Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"...
var platformTag = xml.find(util.format('./platform[@name="%s"]', platform)); if (platformTag) { assets = assets.concat(platformTag.findall('./asset')); jsModules = jsModules.concat(platformTag.findall('./js-module')); } // Copy www assets described in <asset> ta...
var jsModules = xml.findall('./js-module'); var assets = xml.findall('asset');
random_line_split
prepare.js
/** Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"...
}); // Add it to the list of module objects bound for cordova_plugins.json moduleObjects.push(obj); }); }); // Write out moduleObjects as JSON wrapped in a cordova module to cordova_plugins.js var final_contents = "cordova.define('cordova/plugin_list', function...
{ obj.runs = true; }
conditional_block
function.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::rc::Rc; use std::cell::RefCell; use value::*; use ast; use environment::Environment; use runtime::Runtim...
} } } Ok(()) }
{ return Err(RuntimeError::GeneralRuntimeError( "http_server: threading error \ (could not send on reverse \ channel)" .to_owned(), )); }
conditional_block
function.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::rc::Rc; use std::cell::RefCell; use value::*; use ast; use environment::Environment; use runtime::Runtim...
{ NativeVoid(CallSign, fn(Vec<Value>) -> Result<(), RuntimeError>), NativeReturning(CallSign, fn(Vec<Value>) -> Result<Value, RuntimeError>), User { call_sign: CallSign, param_names: Vec<String>, body: Box<ast::StmtNode>, env: Rc<RefCell<Environment>>, }, } impl Functio...
Function
identifier_name
function.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use std::rc::Rc; use std::cell::RefCell; use value::*; use ast; use environment::Environment; use runtime::Runtim...
NativeVoid(CallSign, fn(Vec<Value>) -> Result<(), RuntimeError>), NativeReturning(CallSign, fn(Vec<Value>) -> Result<Value, RuntimeError>), User { call_sign: CallSign, param_names: Vec<String>, body: Box<ast::StmtNode>, env: Rc<RefCell<Environment>>, }, } impl Function {...
pub variadic: bool, } #[derive(Clone, Debug)] pub enum Function {
random_line_split
jquery.juicy.buttonselect.js
/* * jUIcy Button Select * * Depends: * jquery.ui.core.js * jquery.ui.widget.js * jquery.ui.button.js */ (function( $ ) { $.widget( "juicy.buttonselect", { options: { name: '', items: {}, wrapTemplate: '', click: null }, _create: function() { this.element.addClass( 'juicy-bu...
_appendInputs: function() { var self = this, o = this.options; this.element.addClass( 'juicy-buttonselectmulti' ); $.each( o.items, function( key, val ){ self._newInput( self.element, { type: 'checkbox', id: o.name + '-' + key, name: o.name, value: key, ...
},
random_line_split
jquery.juicy.buttonselect.js
/* * jUIcy Button Select * * Depends: * jquery.ui.core.js * jquery.ui.widget.js * jquery.ui.button.js */ (function( $ ) { $.widget( "juicy.buttonselect", { options: { name: '', items: {}, wrapTemplate: '', click: null }, _create: function() { this.element.addClass( 'juicy-bu...
realTarget.append( input, label ); return input; }, _appendInputs: function() { var self = this, o = this.options, checked = true; this.element.addClass( 'juicy-buttonselect-single' ); $.each( o.items, function( key, val ){ self._newInput( self.element, { type...
{ realTarget = target; }
conditional_block
tests.js
script('../node_modules/domready/ready.js', function () { domready(function() { sink('Basic', function(test, ok, before, after) { test('should call from chained ready calls', 4, function() { script.ready('jquery', function() { ok(true, 'loaded from ready callback') }) ...
}) test('ready should not call a duplicate callback', 1, function() { script.ready(['yui', 'moomoo'], function() { console.log('TWICE') ok(true, 'found yui and moomoo again') }) }) test('ready should not call a callback a third time', 1, function() { ...
script('../vendor/mootools.js', 'moomoo') script.ready(['yui', 'moomoo'], function() { console.log('ONCE') ok(true, 'multiple batch has been loaded') })
random_line_split
maclearning.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Nicira Networks, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
return {}
conditional_block
maclearning.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Nicira Networks, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
@classmethod def get_description(cls): return "Provides mac learning capabilities" @classmethod def get_namespace(cls): return "http://docs.openstack.org/ext/maclearning/api/v1.0" @classmethod def get_updated(cls): return "2013-05-1T10:00:00-00:00" @classmethod ...
return "mac-learning"
identifier_body
maclearning.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Nicira Networks, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
(object): """Extension class supporting port mac learning.""" @classmethod def get_name(cls): return "MAC Learning" @classmethod def get_alias(cls): return "mac-learning" @classmethod def get_description(cls): return "Provides mac learning capabilities" @class...
Maclearning
identifier_name
maclearning.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Nicira Networks, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under ...
random_line_split
linkedlist.rs
#![feature(associated_type_defaults)] #![warn(clippy::linkedlist)] #![allow(dead_code, clippy::needless_pass_by_value)] extern crate alloc; use alloc::collections::linked_list::LinkedList; const C: LinkedList<i32> = LinkedList::new(); static S: LinkedList<i32> = LinkedList::new(); trait Foo { type Baz = LinkedLi...
pub fn test(my_favourite_linked_list: LinkedList<u8>) { println!("{:?}", my_favourite_linked_list) } pub fn test_ret() -> Option<LinkedList<u8>> { unimplemented!(); } pub fn test_local_not_linted() { let _: LinkedList<u8>; } fn main() { test(LinkedList::new()); test_local_not_linted(); }
}
identifier_body
linkedlist.rs
#![feature(associated_type_defaults)] #![warn(clippy::linkedlist)] #![allow(dead_code, clippy::needless_pass_by_value)] extern crate alloc; use alloc::collections::linked_list::LinkedList; const C: LinkedList<i32> = LinkedList::new(); static S: LinkedList<i32> = LinkedList::new(); trait Foo { type Baz = LinkedLi...
test_local_not_linted(); }
let _: LinkedList<u8>; } fn main() { test(LinkedList::new());
random_line_split
linkedlist.rs
#![feature(associated_type_defaults)] #![warn(clippy::linkedlist)] #![allow(dead_code, clippy::needless_pass_by_value)] extern crate alloc; use alloc::collections::linked_list::LinkedList; const C: LinkedList<i32> = LinkedList::new(); static S: LinkedList<i32> = LinkedList::new(); trait Foo { type Baz = LinkedLi...
{ let _: LinkedList<u8>; } fn main() { test(LinkedList::new()); test_local_not_linted(); }
st_local_not_linted()
identifier_name
check_static_recursion.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 ...
} impl<'a, 'ast, 'v> Visitor<'v> for CheckItemRecursionVisitor<'a, 'ast> { fn visit_item(&mut self, it: &ast::Item) { self.with_item_id_pushed(it.id, |v| visit::walk_item(v, it)); } fn visit_trait_item(&mut self, ti: &ast::TraitItem) { self.with_item_id_pushed(ti.id, |v| visit::walk_trait...
{ if self.idstack.iter().any(|x| x == &(id)) { span_err!(self.sess, *self.root_span, E0265, "recursive constant"); return; } self.idstack.push(id); f(self); self.idstack.pop(); }
identifier_body
check_static_recursion.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 visit_item(&mut self, it: &ast::Item) { self.with_item_id_pushed(it.id, |v| visit::walk_item(v, it)); } fn visit_trait_item(&mut self, ti: &ast::TraitItem) { self.with_item_id_pushed(ti.id, |v| visit::walk_trait_item(v, ti)); } fn visit_impl_item(&mut self, ii: &ast::ImplItem) {...
random_line_split
check_static_recursion.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, ii: &ast::ImplItem) { match ii.node { ast::ConstImplItem(_, ref expr) => { let mut recursion_visitor = CheckItemRecursionVisitor::new(self, &ii.span); recursion_visitor.visit_impl_item(ii); visit::walk_expr(self, &*expr)...
visit_impl_item
identifier_name
directive.ts
import * as host from '../utils/host'; import * as injector from '../utils/injector'; import * as input from '../utils/input'; import * as output from '../utils/output'; function parseSelector(selector: string) { const regex = [ // {key: 'E', value: /^([a-zA-Z])$/}, {key: 'A', value: /^\[([a-zA-Z]+)\]$/}, {key:...
if (result !== null) { return {restrict: regex[i].key, name: result[1]}; } }; throw new Error(`Selector ${selector} could not be parsed`); } export function bootstrap(ngModule, target) { const annotations = target.__annotations__; const directive = annotations.directive; const selector = parseSelector(d...
random_line_split
directive.ts
import * as host from '../utils/host'; import * as injector from '../utils/injector'; import * as input from '../utils/input'; import * as output from '../utils/output'; function parseSelector(selector: string) { const regex = [ // {key: 'E', value: /^([a-zA-Z])$/}, {key: 'A', value: /^\[([a-zA-Z]+)\]$/}, {key:...
{ const annotations = target.__annotations__; const directive = annotations.directive; const selector = parseSelector(directive.selector); const hostBindings = host.parse(directive.host || {}); // Inject the services injector.inject(ngModule, target); ngModule .controller(target.name, target) .directive(s...
identifier_body
directive.ts
import * as host from '../utils/host'; import * as injector from '../utils/injector'; import * as input from '../utils/input'; import * as output from '../utils/output'; function parseSelector(selector: string) { const regex = [ // {key: 'E', value: /^([a-zA-Z])$/}, {key: 'A', value: /^\[([a-zA-Z]+)\]$/}, {key:...
}; throw new Error(`Selector ${selector} could not be parsed`); } export function bootstrap(ngModule, target) { const annotations = target.__annotations__; const directive = annotations.directive; const selector = parseSelector(directive.selector); const hostBindings = host.parse(directive.host || {}); // I...
{ return {restrict: regex[i].key, name: result[1]}; }
conditional_block
directive.ts
import * as host from '../utils/host'; import * as injector from '../utils/injector'; import * as input from '../utils/input'; import * as output from '../utils/output'; function parseSelector(selector: string) { const regex = [ // {key: 'E', value: /^([a-zA-Z])$/}, {key: 'A', value: /^\[([a-zA-Z]+)\]$/}, {key:...
(ngModule, target) { const annotations = target.__annotations__; const directive = annotations.directive; const selector = parseSelector(directive.selector); const hostBindings = host.parse(directive.host || {}); // Inject the services injector.inject(ngModule, target); ngModule .controller(target.name, tar...
bootstrap
identifier_name
associated-types-ref-in-struct-literal.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 thing = Thing{a: 1, b: 2}; assert_eq!(thing.a + 1, thing.b); }
main
identifier_name
associated-types-ref-in-struct-literal.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
// except according to those terms. // Test associated type references in a struct literal. Issue #20535. pub trait Foo { type Bar; fn dummy(&self) { } } impl Foo for isize { type Bar = isize; } struct Thing<F: Foo> { a: F, b: F::Bar, } fn main() { let thing = Thing{a: 1, b: 2}; asser...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed
random_line_split
associated-types-ref-in-struct-literal.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 thing = Thing{a: 1, b: 2}; assert_eq!(thing.a + 1, thing.b); }
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
('metadata', models.TextField(null=True)), ('mosaic_time_regex', models.CharField(max_length=128, null=True)), ('mosaic_time_value', models.CharField(max_length=128, null=True)), ('mosaic_elev_regex', models.CharField(max_length=128, null=True)), ...
('session', models.TextField(null=True)),
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
dependencies = [ ('layers', '0002_initial_step2'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Upload', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- ######################################################################### # # Copyright (C) 2016 OSGeo # # 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 ...
(migrations.Migration): dependencies = [ ('layers', '0002_initial_step2'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Upload', fields=[ ('id', models.AutoField(verbose_name='ID', ...
Migration
identifier_name
app.py
# -*- coding: utf-8 -*- from flask import (Flask, request, session, render_template, url_for, redirect, jsonify) app = Flask(__name__) app.debug = True app.secret_key = 'dummy secret key' from flaskext.mitten import Mitten mitten = Mitten(app) # apply Mitten @app.route('/') def
(): if session.get('logged_in'): return redirect(url_for('home')) return render_template('index.html') @app.route('/home/') def home(): if not session.get('logged_in'): return redirect(url_for('index')) return render_template('home.html') # A POST request is protected fr...
index
identifier_name
app.py
# -*- coding: utf-8 -*- from flask import (Flask, request, session, render_template, url_for, redirect, jsonify) app = Flask(__name__) app.debug = True app.secret_key = 'dummy secret key' from flaskext.mitten import Mitten mitten = Mitten(app) # apply Mitten @app.route('/') def in...
app.run(host='localhost', port=8080)
conditional_block
app.py
# -*- coding: utf-8 -*- from flask import (Flask, request, session, render_template, url_for, redirect, jsonify) app = Flask(__name__) app.debug = True app.secret_key = 'dummy secret key' from flaskext.mitten import Mitten mitten = Mitten(app) # apply Mitten @app.route('/') def in...
@app.route('/home/') def home(): if not session.get('logged_in'): return redirect(url_for('index')) return render_template('home.html') # A POST request is protected from csrf automatically @app.route('/login/', methods=['GET', 'POST']) def login(): if request.method == 'GET': ...
if session.get('logged_in'): return redirect(url_for('home')) return render_template('index.html')
identifier_body
app.py
# -*- coding: utf-8 -*- from flask import (Flask, request, session, render_template, url_for, redirect, jsonify) app = Flask(__name__) app.debug = True app.secret_key = 'dummy secret key' from flaskext.mitten import Mitten mitten = Mitten(app) # apply Mitten @app.route('/') def in...
return redirect(url_for('home')) @app.route('/logout/') def logout(): session.destroy() return redirect(url_for('home')) @mitten.csrf_exempt # excluded from csrf protection @app.route('/public_api/', methods=['POST']) def public_api(): return "POST was received successfully.", 200 ...
session['logged_in'] = True
random_line_split
amazon-settings.ts
import { Component } from '@angular/core'; import * as _ from 'lodash'; // Providers import { ConfigProvider } from '../../../../providers/config/config'; import { HomeIntegrationsProvider } from '../../../../providers/home-integrations/home-integrations'; @Component({ selector: 'page-amazon-settings', templateU...
{ private serviceName: string = 'amazon'; public showInHome: any; public service: any; constructor( private configProvider: ConfigProvider, private homeIntegrationsProvider: HomeIntegrationsProvider ) { this.service = _.filter(this.homeIntegrationsProvider.get(), { name: this.serviceName }); ...
AmazonSettingsPage
identifier_name
amazon-settings.ts
import { Component } from '@angular/core'; import * as _ from 'lodash'; // Providers import { ConfigProvider } from '../../../../providers/config/config'; import { HomeIntegrationsProvider } from '../../../../providers/home-integrations/home-integrations'; @Component({ selector: 'page-amazon-settings', templateU...
}; this.homeIntegrationsProvider.updateConfig(this.serviceName, this.showInHome); this.configProvider.set(opts); } }
} public showInHomeSwitch(): void { let opts = { showIntegration: { [this.serviceName] : this.showInHome }
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax, int_uint)] #![allow(unstable)] #[macro_use] extern crate bitflags; #[cfg(target_os="macos")] extern crate cgl; extern crate compositing; extern crate geom; extern crate gleam; extern crate glutin; extern crate layers; extern crate libc; extern crate msg; extern crate time; extern crate util; ex...
//! A simple application that uses glutin to open a window for Servo to display in.
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! A simple application that uses glutin to open a window for Servo to display in. #![feature(box_syntax, int_ui...
() -> Rc<Window> { // Read command-line options. let opts = opts::get(); let foreground = opts.output_file.is_none(); let scale_factor = opts.device_pixels_per_px.unwrap_or(ScaleFactor(1.0)); let size = opts.initial_window_size.as_f32() * scale_factor; // Open a window. Window::new(foregrou...
create_window
identifier_name
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! A simple application that uses glutin to open a window for Servo to display in. #![feature(box_syntax, int_ui...
{ // Read command-line options. let opts = opts::get(); let foreground = opts.output_file.is_none(); let scale_factor = opts.device_pixels_per_px.unwrap_or(ScaleFactor(1.0)); let size = opts.initial_window_size.as_f32() * scale_factor; // Open a window. Window::new(foreground, size.as_uint(...
identifier_body
testifacecache.py
#!/usr/bin/env python from basetest import BaseTest import sys, tempfile, os, time import unittest import data sys.path.insert(0, '..') from zeroinstall.injector import model, gpg, trust
from zeroinstall.injector.iface_cache import PendingFeed from zeroinstall.support import basedir class TestIfaceCache(BaseTest): def testList(self): iface_cache = self.config.iface_cache self.assertEquals([], iface_cache.list_all_interfaces()) iface_dir = basedir.save_cache_path(config_site, 'interfaces') fil...
from zeroinstall.injector.namespaces import config_site
random_line_split
testifacecache.py
#!/usr/bin/env python from basetest import BaseTest import sys, tempfile, os, time import unittest import data sys.path.insert(0, '..') from zeroinstall.injector import model, gpg, trust from zeroinstall.injector.namespaces import config_site from zeroinstall.injector.iface_cache import PendingFeed from zeroinstall.su...
unittest.main()
conditional_block
testifacecache.py
#!/usr/bin/env python from basetest import BaseTest import sys, tempfile, os, time import unittest import data sys.path.insert(0, '..') from zeroinstall.injector import model, gpg, trust from zeroinstall.injector.namespaces import config_site from zeroinstall.injector.iface_cache import PendingFeed from zeroinstall.su...
def testXMLupdate(self): iface_cache = self.config.iface_cache trust.trust_db.trust_key( '92429807C9853C0744A68B9AAE07828059A53CC1') stream = tempfile.TemporaryFile() stream.write(data.thomas_key) stream.seek(0) gpg.import_key(stream) iface = iface_cache.get_interface('http://foo') src = tempfile...
iface_cache = self.config.iface_cache trust.trust_db.trust_key( '92429807C9853C0744A68B9AAE07828059A53CC1') feed_url = 'http://foo' src = tempfile.TemporaryFile() # Unsigned src.write("hello") src.flush() src.seek(0) try: PendingFeed(feed_url, src) assert 0 except model.SafeException: pas...
identifier_body
testifacecache.py
#!/usr/bin/env python from basetest import BaseTest import sys, tempfile, os, time import unittest import data sys.path.insert(0, '..') from zeroinstall.injector import model, gpg, trust from zeroinstall.injector.namespaces import config_site from zeroinstall.injector.iface_cache import PendingFeed from zeroinstall.su...
(BaseTest): def testList(self): iface_cache = self.config.iface_cache self.assertEquals([], iface_cache.list_all_interfaces()) iface_dir = basedir.save_cache_path(config_site, 'interfaces') file(os.path.join(iface_dir, 'http%3a%2f%2ffoo'), 'w').close() self.assertEquals(['http://foo'], iface_cache.list_a...
TestIfaceCache
identifier_name
acceptancetest.py
import hashlib import shutil import os from datetime import datetime list_of_paths_and_strings = [ ["assignment1.cpp", "main()"] ] def main(): if acceptance_test(): make_txt_file() zip_dir() def get_md5_hash(file): # opening file file_to_hash = open(file) read_file = file_to_hash.read() ...
def make_txt_file(): # writes a text file with each of the hashes for each of the files using MD5 write_file = open("hash.txt", "w+") write_file.write("Write time: " + str(get_current_time()) + '\n') for file in os.listdir(os.getcwd()): if "." in file: f_name, file_hash = get_md5_hash(file) wri...
path = my_list[0] list_of_strings = my_list[1:] try: with open(path) as file: for string in list_of_strings: if string in file.read(): print "Found " + string + " in file." else: print string + "not found in file." return False file.close() return True excep...
conditional_block
acceptancetest.py
import hashlib import shutil import os from datetime import datetime list_of_paths_and_strings = [ ["assignment1.cpp", "main()"] ] def main(): if acceptance_test(): make_txt_file() zip_dir() def get_md5_hash(file): # opening file file_to_hash = open(file) read_file = file_to_hash.read() ...
# return hash return file, md5_hash_output def get_current_time(): print "The current time is " + " datetime.today()" return datetime.today() def acceptance_test(): # for each list of the list of paths and strings # make sure that a file with that name exists within the folder for my_list in list_o...
print "File Name: %s" % file print "MD5 Hash: %r" % md5_hash_output
random_line_split