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
generate_xwalk_core_library_aar.py
#!/usr/bin/env python # # Copyright (c) 2014 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import os import sys import zipfile def main(): option_parser = optparse.OptionParser() option_parser.add_opti...
zip_path = os.path.join(dest, os.path.relpath(root, src), f) if real_path in exclude_files: continue aar_file.write(real_path, zip_path) return 0 if __name__ == '__main__': sys.exit(main())
for root, _, files in os.walk(src): for f in files: real_path = os.path.join(root, f)
random_line_split
generate_xwalk_core_library_aar.py
#!/usr/bin/env python # # Copyright (c) 2014 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import os import sys import zipfile def
(): option_parser = optparse.OptionParser() option_parser.add_option('-t', dest='target', help='Product out target directory.') option_parser.add_option('--shared', action='store_true', default=False, help='Generate shared library', ...
main
identifier_name
generate_xwalk_core_library_aar.py
#!/usr/bin/env python # # Copyright (c) 2014 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import os import sys import zipfile def main(): option_parser = optparse.OptionParser() option_parser.add_opti...
else: dirs = ( (os.path.join(options.target, 'xwalk_core_library', 'libs'), 'jni'), (os.path.join(options.target, 'xwalk_core_library', 'res'), 'res'), ) files = ( (os.path.join(options.target, 'xwalk_core_library', 'AndroidManifest.xml'), 'AndroidManifest.xml'), ...
dirs = ( (os.path.join(options.target, 'xwalk_shared_library', 'libs'), 'jni'), (os.path.join(options.target, 'xwalk_shared_library', 'res'), 'res'), ) files = ( (os.path.join(options.target, 'xwalk_shared_library', 'AndroidManifest.xml'), 'AndroidManifest.xml'), (o...
conditional_block
generate_xwalk_core_library_aar.py
#!/usr/bin/env python # # Copyright (c) 2014 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import os import sys import zipfile def main():
'AndroidManifest.xml'), 'AndroidManifest.xml'), (os.path.join(options.target, 'xwalk_shared_library', 'libs', 'xwalk_core_library_java_app_part.jar'), 'classes.jar'), (os.path.join(options.target, 'xwalk_core_empty_embedder_apk', 'gen', 'R.txt'), 'R.txt'), ) exclude_files = (...
option_parser = optparse.OptionParser() option_parser.add_option('-t', dest='target', help='Product out target directory.') option_parser.add_option('--shared', action='store_true', default=False, help='Generate shared library', ) op...
identifier_body
states.py
from __future__ import print_function from helpers import flatten, merge, add, search import sys import os import yaml import boto3 import termcolor def str_presenter(dumper, data): if len(data.splitlines()) == 1 and data[-1] == '\n': return dumper.represent_scalar( 'tag:yaml.org,2002:str', dat...
def __str__(self): return termcolor.colored(self.secure, 'magenta') def __eq__(self, other): return self.secure == other.secure if isinstance(other, SecureTag) else False def __hash__(self): return hash(self.secure) def __ne__(self, other): return (not self.__eq__(oth...
return self.secure
random_line_split
states.py
from __future__ import print_function from helpers import flatten, merge, add, search import sys import os import yaml import boto3 import termcolor def str_presenter(dumper, data): if len(data.splitlines()) == 1 and data[-1] == '\n': return dumper.represent_scalar( 'tag:yaml.org,2002:str', dat...
def apply(self, diff): for k in diff.added(): ssm_type = 'String' if isinstance(diff.target[k], list): ssm_type = 'StringList' if isinstance(diff.target[k], SecureTag): ssm_type = 'SecureString' self.ssm.put_parameter( ...
return SecureTag(value) if ssm_type == 'SecureString' else str(value)
identifier_body
states.py
from __future__ import print_function from helpers import flatten, merge, add, search import sys import os import yaml import boto3 import termcolor def str_presenter(dumper, data): if len(data.splitlines()) == 1 and data[-1] == '\n': return dumper.represent_scalar( 'tag:yaml.org,2002:str', dat...
return flatten(output) if flat else output def _read_param(self, value, ssm_type='String'): return SecureTag(value) if ssm_type == 'SecureString' else str(value) def apply(self, diff): for k in diff.added(): ssm_type = 'String' if isinstance(diff.target[k], l...
add( obj=output, path=param['Name'], value=self._read_param(param['Value'], param['Type']))
conditional_block
states.py
from __future__ import print_function from helpers import flatten, merge, add, search import sys import os import yaml import boto3 import termcolor def str_presenter(dumper, data): if len(data.splitlines()) == 1 and data[-1] == '\n': return dumper.represent_scalar( 'tag:yaml.org,2002:str', dat...
(self): return self.secure def __str__(self): return termcolor.colored(self.secure, 'magenta') def __eq__(self, other): return self.secure == other.secure if isinstance(other, SecureTag) else False def __hash__(self): return hash(self.secure) def __ne__(self, other): ...
__repr__
identifier_name
test_eval_power.py
from sympy.core import * def test_rational(): a = Rational(1, 5) assert a**Rational(1, 2) == a**Rational(1, 2) assert 2 * a**Rational(1, 2) == 2 * a**Rational(1, 2) assert a**Rational(3, 2) == a * a**Rational(1, 2) assert 2 * a**Rational(3, 2) == 2*a * a**Rational(1, 2) assert a**Rational(17...
assert feq(Basic.One() / Real(-0.5), -Integer(2)) def test_expand(): x = Symbol('x') assert (2**(-1-x)).expand() == Rational(1,2)*2**(-x) def test_issue153(): #test that is runs: a = Basic.sqrt(2*(1+Basic.sqrt(2))) def test_issue350(): #test if powers are simplified correctly a = Symbol('...
return abs(a - b) < 1E-10
random_line_split
test_eval_power.py
from sympy.core import * def test_rational(): a = Rational(1, 5) assert a**Rational(1, 2) == a**Rational(1, 2) assert 2 * a**Rational(1, 2) == 2 * a**Rational(1, 2) assert a**Rational(3, 2) == a * a**Rational(1, 2) assert 2 * a**Rational(3, 2) == 2*a * a**Rational(1, 2) assert a**Rational(17...
def test_issue350(): #test if powers are simplified correctly a = Symbol('a') assert ((a**Rational(1,3))**Rational(2)) == a**Rational(2,3) assert ((a**Rational(3))**Rational(2,5)) != a**Rational(6,5) a = Symbol('a', real = True) assert (a**Rational(3))**Rational(2,5) == a**Rational(6,5) ...
a = Basic.sqrt(2*(1+Basic.sqrt(2)))
identifier_body
test_eval_power.py
from sympy.core import * def test_rational(): a = Rational(1, 5) assert a**Rational(1, 2) == a**Rational(1, 2) assert 2 * a**Rational(1, 2) == 2 * a**Rational(1, 2) assert a**Rational(3, 2) == a * a**Rational(1, 2) assert 2 * a**Rational(3, 2) == 2*a * a**Rational(1, 2) assert a**Rational(17...
(): e = (Rational(123712**12-1,7)+Rational(1,7))**Rational(1,3) assert e == 234232585392159195136 * (Rational(1,7)**Rational(1,3)) def test_negative_real(): def feq(a,b): return abs(a - b) < 1E-10 assert feq(Basic.One() / Real(-0.5), -Integer(2)) def test_expand(): x = Symbol('x') ass...
test_large_rational
identifier_name
Layer.d.ts
import { Coordinate } from '../../coordinate'; import { EventsKey } from '../../events'; import BaseEvent from '../../events/Event'; import Layer from '../../layer/Layer'; import { Pixel } from '../../pixel'; import { FrameState } from '../../PluggableMap'; import WebGLHelper, { UniformValue } from '../../webgl/Helper'...
* Generates a color array based on a numerical id * Note: the range for each component is 0 to 1 with 256 steps */ export function colorEncodeId(id: number, opt_array?: number[]): number[];
random_line_split
Layer.d.ts
import { Coordinate } from '../../coordinate'; import { EventsKey } from '../../events'; import BaseEvent from '../../events/Event'; import Layer from '../../layer/Layer'; import { Pixel } from '../../pixel'; import { FrameState } from '../../PluggableMap'; import WebGLHelper, { UniformValue } from '../../webgl/Helper'...
<LayerType extends Layer = Layer> extends LayerRenderer { constructor(layer: LayerType, opt_options?: Options); protected helper: WebGLHelper; protected postRender(frameState: FrameState): void; protected preRender(frameState: FrameState): void; /** * Clean up. */ disposeInternal(): vo...
WebGLLayerRenderer
identifier_name
test_shared_network_extension.py
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv # Copyright 2015 OpenStack Foundation # 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 # # ...
(self, user): body = user.list_networks(shared=True) networks_list = [net['id'] for net in body['networks']] self.assertIn(self.shared_network['id'], networks_list) self.assertTrue(self.shared_network['shared']) @test.idempotent_id('a064a9fd-e02f-474a-8159-f828cd636a28') def tes...
_list_shared_networks
identifier_name
test_shared_network_extension.py
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv # Copyright 2015 OpenStack Foundation # 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 # # ...
def _list_shared_networks(self, user): body = user.list_networks(shared=True) networks_list = [net['id'] for net in body['networks']] self.assertIn(self.shared_network['id'], networks_list) self.assertTrue(self.shared_network['shared']) @test.idempotent_id('a064a9fd-e02f-474a-...
self.addCleanup(self.admin_client.delete_network, net['id']) self.assertIsNotNone(net['id']) self.assertTrue(net['shared'])
conditional_block
test_shared_network_extension.py
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv # Copyright 2015 OpenStack Foundation # 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 # # ...
def _list_shared_networks(self, user): body = user.list_networks(shared=True) networks_list = [net['id'] for net in body['networks']] self.assertIn(self.shared_network['id'], networks_list) self.assertTrue(self.shared_network['shared']) @test.idempotent_id('a064a9fd-e02f-474a-...
net_nm = [data_utils.rand_name('network'), data_utils.rand_name('network')] body = self.admin_client.create_bulk_network(net_nm, shared=True) created_networks = body['networks'] for net in created_networks: self.addCleanup(self.admin_client.delete_network, net['id']...
identifier_body
test_shared_network_extension.py
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv # Copyright 2015 OpenStack Foundation # 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 # # ...
@test.idempotent_id('6661d219-b96d-4597-ad10-55766ce4abf7') def test_create_update_shared_network(self): shared_network = self.create_shared_network() net_id = shared_network['id'] self.assertEqual('ACTIVE', shared_network['status']) self.assertIsNotNone(shared_network['id']) ...
super(SharedNetworksTest, cls).resource_setup() cls.shared_network = cls.create_shared_network()
random_line_split
index.ts
killServer } from './WS' const ports = {} export default async () => { const app = express() const getPort = (req) => +req.originalUrl.split('/')[2] || 8095 app.get(/\/on\/.*/, async (req, res) => { const port = getPort(req) if(!ports[port]) { await createServer(getPort(req)) ports[port] ...
import * as express from 'express' import { createServer,
random_line_split
index.ts
import * as express from 'express' import { createServer, killServer } from './WS' const ports = {} export default async () => { const app = express() const getPort = (req) => +req.originalUrl.split('/')[2] || 8095 app.get(/\/on\/.*/, async (req, res) => { const port = getPort(req) if(!ports[port]...
else { } res.send('on') }) app.get(/\/off\/.*/, async (req, res) => { const port = getPort(req) if(ports[port]) { await killServer(port) delete ports[port] } else { } res.send('off') }) try { app.listen(8085); } catch(e) { } return true }
{ await createServer(getPort(req)) ports[port] = true }
conditional_block
infohash.rs
/* * Copyright (C) 2014-2020 Savoir-faire Linux Inc. * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 ...
pub fn get(data: &str) -> InfoHash { let mut h = InfoHash::new(); unsafe { let c_str = CString::new(data).unwrap(); dht_infohash_get(&mut h, c_str.as_ptr() as *mut u8, data.len()); } h } pub fn from_bytes(data: &Vec<u8>) -> InfoHash { let mut...
let mut h = InfoHash::new(); unsafe { dht_infohash_random(&mut h); } h }
identifier_body
infohash.rs
/* * Copyright (C) 2014-2020 Savoir-faire Linux Inc. * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 ...
data: &Vec<u8>) -> InfoHash { let mut h = InfoHash::new(); unsafe { dht_infohash_get(&mut h, data.as_ptr() as *mut u8, data.len()); } h } pub fn from_hex(data: &str) -> InfoHash { let mut h = InfoHash::new(); unsafe { let c_str = CString::...
rom_bytes(
identifier_name
infohash.rs
/* * Copyright (C) 2014-2020 Savoir-faire Linux Inc. * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 ...
pub fn random() -> InfoHash { let mut h = InfoHash::new(); unsafe { dht_infohash_random(&mut h); } h } pub fn get(data: &str) -> InfoHash { let mut h = InfoHash::new(); unsafe { let c_str = CString::new(data).unwrap(); dht...
pub fn new() -> InfoHash { InfoHash { d: [0; 20] } }
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
"""A Sphinx extension to literally insert the output of arbitrary commands into documents, helping you to keep your command examples up to date.""" homepage = "https://sphinxcontrib-programoutput.readthedocs.org/" url = "https://pypi.io/packages/source/s/sphinxcontrib-programoutput/sphinxcontrib-progr...
identifier_body
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even t...
# For details, see https://github.com/llnl/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. #
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(PythonPackage): """A Sphinx extension to literally insert the output of arbitrary commands into documents, helping you to keep your command examples up to date.""" homepage = "https://sphinxcontrib-programoutput.readthedocs.org/" url = "https://pypi.io/packages/source/s/sphinxcontrib-programoutpu...
PySphinxcontribProgramoutput
identifier_name
_9001_developer.py
# Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
DISABLED = False
conditional_block
_9001_developer.py
# Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
if getattr(settings, 'DEBUG', False): DISABLED = False
AUTO_DISCOVER_STATIC_FILES = True DISABLED = True
random_line_split
dialog.ts
import { Component, ChangeDetectionStrategy, Input } from '@angular/core'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'dialog', template: ` <div class="ms-Dialog-center" [hidden]="!show"> <div class="ms-Overlay" [ngClass]="{ 'is-visible': show }"></div> <div...
<div class="ms-Dialog-header"> <p [hidden]="title == null" class="ms-Dialog-title">{{ title }}</p> </div> <div class="ms-Dialog-inner"> <ng-content></ng-content> </div> </div> </div> </div> ` ...
<div class="ms-Dialog-main">
random_line_split
dialog.ts
import { Component, ChangeDetectionStrategy, Input } from '@angular/core'; @Component({ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'dialog', template: ` <div class="ms-Dialog-center" [hidden]="!show"> <div class="ms-Overlay" [ngClass]="{ 'is-visible': show }"></div> <div...
{ @Input() title: string; @Input() show: boolean; }
Dialog
identifier_name
remutex.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 ...
} #[unsafe_destructor] impl<'a, T> Drop for ReentrantMutexGuard<'a, T> { #[inline] fn drop(&mut self) { unsafe { self.__lock.poison.done(&self.__poison); self.__lock.inner.unlock(); } } } #[cfg(test)] mod test { use prelude::v1::*; use sys_common::remutex:...
{ &self.__lock.data }
identifier_body
remutex.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 ...
/// /// The data protected by the mutex can be accessed through this guard via its /// Deref and DerefMut implementations #[must_use] pub struct ReentrantMutexGuard<'a, T: 'a> { // funny underscores due to how Deref/DerefMut currently work (they // disregard field privacy). __lock: &'a ReentrantMutex<T>, ...
/// dropped (falls out of scope), the lock will be unlocked.
random_line_split
remutex.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 ...
(&mut self) { *self.0.borrow_mut() = 42; } } #[test] fn poison_works() { let m = Arc::new(ReentrantMutex::new(RefCell::new(0))); let mc = m.clone(); let result = thread::spawn(move ||{ let lock = mc.lock().unwrap(); *lock.borrow_mut() = 1;...
drop
identifier_name
column.ts
import { DataSet } from './data-set'; export class Column { public title: string = ''; public type: string = ''; public class: string = ''; public isSortable: boolean = false; public isEditable: boolean = true; public isDeleteable: boolean = false; public isExpandable: boolean = false; public isFilter...
public getValuePrepareFunction(): Function { return this.valuePrepareFunction; } public getFilterFunction(): Function { return this.filterFunction; } public getCellRenderFunction(): Function { return this.cellRenderFunction; } protected process(): void { this.title = this.settings['ti...
{ return this.compareFunction; }
identifier_body
column.ts
import { DataSet } from './data-set'; export class Column { public title: string = ''; public type: string = ''; public class: string = ''; public isSortable: boolean = false; public isEditable: boolean = true; public isDeleteable: boolean = false; public isExpandable: boolean = false; public isFilter...
(): string { return this.settings['sort'] === 'desc' ? 'desc' : 'asc'; } protected determineType(): string { // TODO: determine type by data return 'string'; } }
prepareSortDirection
identifier_name
column.ts
import { DataSet } from './data-set'; export class Column { public title: string = ''; public type: string = ''; public class: string = ''; public isSortable: boolean = false; public isEditable: boolean = true; public isDeleteable: boolean = false; public isExpandable: boolean = false; public isFilter...
constructor(public id: string, protected settings: any, protected dataSet: DataSet) { this.process(); } public getCompareFunction(): Function { return this.compareFunction; } public getValuePrepareFunction(): Function { return this.valuePrepareFunction; } public getFilterFunction(): Functio...
protected compareFunction: Function; protected valuePrepareFunction: Function; protected filterFunction: Function; protected cellRenderFunction: Function;
random_line_split
_5_1_framebuffers.rs
() { let mut camera = Camera { Position: Point3::new(0.0, 0.0, 3.0), ..Camera::default() }; let mut firstMouse = true; let mut lastX: f32 = SCR_WIDTH as f32 / 2.0; let mut lastY: f32 = SCR_HEIGHT as f32 / 2.0; // timing let mut deltaTime: f32; // time between current frame ...
main_4_5_1
identifier_name
_5_1_framebuffers.rs
glfw.window_hint(glfw::WindowHint::OpenGlForwardCompat(true)); // glfw window creation // -------------------- let (mut window, events) = glfw.create_window(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", glfw::WindowMode::Windowed) .expect("Failed to create GLFW window"); // query framebuffer size ...
{ let mut camera = Camera { Position: Point3::new(0.0, 0.0, 3.0), ..Camera::default() }; let mut firstMouse = true; let mut lastX: f32 = SCR_WIDTH as f32 / 2.0; let mut lastY: f32 = SCR_HEIGHT as f32 / 2.0; // timing let mut deltaTime: f32; // time between current frame and...
identifier_body
_5_1_framebuffers.rs
0.5, 0.5, -0.5, 1.0, 1.0, 0.5, -0.5, -0.5, 0.0, 1.0, 0.5, -0.5, -0.5, 0.0, 1.0, 0.5, -0.5, 0.5, 0.0, 0.0, 0.5, 0.5, 0.5, 1.0, 0.0, -0.5, -0.5, -0.5, 0.0, 1.0, 0.5, -0.5, -0.5, 1.0, 1.0, 0.5, -0.5, 0.5, 1.0, 0....
{ println!("ERROR::FRAMEBUFFER:: Framebuffer is not complete!"); }
conditional_block
_5_1_framebuffers.rs
-0.5, 0.5, -0.5, 0.0, 1.0, 0.5, 0.5, -0.5, 1.0, 1.0, 0.5, 0.5, 0.5, 1.0, 0.0, 0.5, 0.5, 0.5, 1.0, 0.0, -0.5, 0.5, 0.5, 0.0, 0.0, -0.5, 0.5, -0.5, 0.0, 1.0 ]; let planeVertices: [f32; 30] = [ // positions ...
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);
random_line_split
responding_test.js
var xhr, xmlDocumentConstructor; module("responding", { setup: function(){ xhr = new FakeXMLHttpRequest(); xmlDocumentConstructor = makeXMLDocument().constructor; }, teardown: function(){ xhr = undefined; xmlDocumentConstructor = undefined; } }); // Different browsers report different construct...
});
random_line_split
responding_test.js
var xhr, xmlDocumentConstructor; module("responding", { setup: function(){ xhr = new FakeXMLHttpRequest(); xmlDocumentConstructor = makeXMLDocument().constructor; }, teardown: function(){ xhr = undefined; xmlDocumentConstructor = undefined; } }); // Different browsers report different construct...
test("defaults responseHeaders to {} if not passed", function(){ xhr.respond(200); deepEqual(xhr.responseHeaders, {}); }); test("sets responseHeaders", function(){ xhr.respond(200, {"Content-Type":"application/json"}); deepEqual(xhr.responseHeaders, {"Content-Type":"application/json"}); }); test("sets body"...
{ var xmlDoc, text = "<some>xml</some>"; if (typeof DOMParser != "undefined") { var parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); } else { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(text); } return xmlDoc; }
identifier_body
responding_test.js
var xhr, xmlDocumentConstructor; module("responding", { setup: function(){ xhr = new FakeXMLHttpRequest(); xmlDocumentConstructor = makeXMLDocument().constructor; }, teardown: function(){ xhr = undefined; xmlDocumentConstructor = undefined; } }); // Different browsers report different construct...
else { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(text); } return xmlDoc; } test("defaults responseHeaders to {} if not passed", function(){ xhr.respond(200); deepEqual(xhr.responseHeaders, {}); }); test("sets responseHeaders", function(){ xhr.respon...
{ var parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); }
conditional_block
responding_test.js
var xhr, xmlDocumentConstructor; module("responding", { setup: function(){ xhr = new FakeXMLHttpRequest(); xmlDocumentConstructor = makeXMLDocument().constructor; }, teardown: function(){ xhr = undefined; xmlDocumentConstructor = undefined; } }); // Different browsers report different construct...
() { var xmlDoc, text = "<some>xml</some>"; if (typeof DOMParser != "undefined") { var parser = new DOMParser(); xmlDoc = parser.parseFromString(text, "text/xml"); } else { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(text); } return xmlDoc; } t...
makeXMLDocument
identifier_name
static-function-pointer-xc.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// 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. // ignore-fast // aux-build:static-function-pointer-aux.rs extern crate aux = "static-fu...
// 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
random_line_split
static-function-pointer-xc.rs
// Copyright 2013-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-MI...
() { assert_eq!(aux::F(42), -42); unsafe { assert_eq!(aux::MutF(42), -42); aux::MutF = f; assert_eq!(aux::MutF(42), 42); aux::MutF = aux::f; assert_eq!(aux::MutF(42), -42); } }
main
identifier_name
static-function-pointer-xc.rs
// Copyright 2013-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-MI...
pub fn main() { assert_eq!(aux::F(42), -42); unsafe { assert_eq!(aux::MutF(42), -42); aux::MutF = f; assert_eq!(aux::MutF(42), 42); aux::MutF = aux::f; assert_eq!(aux::MutF(42), -42); } }
{ x }
identifier_body
AdminRequiredWrapper.js
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { actions as userActions, USER_ENUM } from '../../redux/modules/UserReducer' class AuthRequiredWrapper extends React.Component { static propTypes = { children: PropTypes.element.isRequired, isAuthenticated: PropTypes.bool...
} const mapStateToProps = (state) => ({ isAuthenticated : state.user.isAuthenticated, user : state.user }) export default connect(mapStateToProps, userActions)(AuthRequiredWrapper)
{ const { children } = this.props return ( <div> {children} </div> ) }
identifier_body
AdminRequiredWrapper.js
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { actions as userActions, USER_ENUM } from '../../redux/modules/UserReducer' class AuthRequiredWrapper extends React.Component { static propTypes = { children: PropTypes.element.isRequired, isAuthenticated: PropTypes.bool...
const { isAuthenticated, user } = this.props if (!(isAuthenticated && user.user && ([USER_ENUM.ROLE_ADMIN, USER_ENUM.ROLE_OWNER].includes(user.user.role)))) { this.props.unauthorizedRoute() } } render() { const { children } = this.props return ( <div> {children} ...
user: PropTypes.object.isRequired, unauthorizedRoute: PropTypes.func.isRequired }; componentWillMount() {
random_line_split
AdminRequiredWrapper.js
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { actions as userActions, USER_ENUM } from '../../redux/modules/UserReducer' class AuthRequiredWrapper extends React.Component { static propTypes = { children: PropTypes.element.isRequired, isAuthenticated: PropTypes.bool...
} render() { const { children } = this.props return ( <div> {children} </div> ) } } const mapStateToProps = (state) => ({ isAuthenticated : state.user.isAuthenticated, user : state.user }) export default connect(mapStateToProps, userActions)(AuthRequiredWrapper)
{ this.props.unauthorizedRoute() }
conditional_block
AdminRequiredWrapper.js
import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { actions as userActions, USER_ENUM } from '../../redux/modules/UserReducer' class AuthRequiredWrapper extends React.Component { static propTypes = { children: PropTypes.element.isRequired, isAuthenticated: PropTypes.bool...
() { const { isAuthenticated, user } = this.props if (!(isAuthenticated && user.user && ([USER_ENUM.ROLE_ADMIN, USER_ENUM.ROLE_OWNER].includes(user.user.role)))) { this.props.unauthorizedRoute() } } render() { const { children } = this.props return ( <div> {children} ...
componentWillMount
identifier_name
dashboard.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
(horizon.Dashboard): name = _("Project") slug = "project" panels = (BasePanels, NetworkPanels, ObjectStorePanels, BackupJobPanels) default_panel = 'overview' supports_tenants = True horizon.register(Project)
Project
identifier_name
dashboard.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
class NetworkPanels(horizon.PanelGroup): slug = "network" name = _("Manage Network") panels = ('networks', 'routers', 'loadbalancers', 'network_topology',) class ObjectStorePanels(horizon.PanelGroup): slug = "object_store" name = _("Object Store") pan...
slug = "compute" name = _("Manage Compute") panels = ('overview', 'instances', 'volumes', 'images_and_snapshots', 'access_and_security',)
identifier_body
dashboard.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
import horizon class BasePanels(horizon.PanelGroup): slug = "compute" name = _("Manage Compute") panels = ('overview', 'instances', 'volumes', 'images_and_snapshots', 'access_and_security',) class NetworkPanels(horizon.PanelGroup): slug = "netw...
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from django.utils.translation import ugettext_lazy as _
random_line_split
platform-browser.ts
/** * @license * Copyright Google LLC All Rights Reserved.
* * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ export {BrowserModule, platformBrowser} from './browser'; export {Meta, MetaDefinition} from './browser/meta'; export {Title} from './browser/title'; export {disableDebugTools, e...
random_line_split
lib.js
//Scroll View function scrollHandler(view, hscrollbar, vscrollbar){ this.view= view; this.view.addEventListener('DOMMouseScroll', this, false); this.view.addEventListener('mousewheel', this, false); this.hListeners= []; this.vListeners= []; if (hscrollbar != undefined){ this.hscrollbar= hscrollbar; this.h...
src, dst){ for (var attr in src) dst[attr]= src[attr]; };
as_copyAttributes(
identifier_name
lib.js
//Scroll View function scrollHandler(view, hscrollbar, vscrollbar){ this.view= view; this.view.addEventListener('DOMMouseScroll', this, false); this.view.addEventListener('mousewheel', this, false); this.hListeners= []; this.vListeners= []; if (hscrollbar != undefined){ this.hscrollbar= hscrollbar; this.h...
for (var attr in src) dst[attr]= src[attr]; };
identifier_body
lib.js
//Scroll View function scrollHandler(view, hscrollbar, vscrollbar){ this.view= view; this.view.addEventListener('DOMMouseScroll', this, false); this.view.addEventListener('mousewheel', this, false); this.hListeners= []; this.vListeners= []; if (hscrollbar != undefined){ this.hscrollbar= hscrollbar; this.h...
, event.clientX - this.initialPoint.x , event.clientY - this.initialPoint.y); event.preventDefault(); } break; } }; function bas_copyAttributes(src, dst){ for (var attr in src) dst[attr]= src[attr]; };
document.getElementsByTagName('body')[0].style.cursor= 'auto'; //document.childNodes[0].style.cursor= 'auto'; this.dragging= false; //TODO: En lugar de lanzar un evento, puede redimensionar la división padre. this.listener.OnResize(this.draggingId
random_line_split
listviewv_test.ts
import { ViewV, View } from '../../core/view'; import { AncView, v, f, vlist } from '../../core/tinyts'; import { Button } from '../../control/button'; import { ListView, ListViewV, SubView } from '../../control/list'; import { Meta } from '../../core/meta'; import { TsDate } from '../../utils/date'; class DataModel {...
() { var data = []; data.push(new DataModel(1, "a1", ["aa"], "qqq")); data.push(new DataModel(2, "a1", ["aa"], "qqq")); this.mList.SetData(data); } } var aa = new ListViewVModel();
AfterInject
identifier_name
listviewv_test.ts
import { ViewV, View } from '../../core/view'; import { AncView, v, f, vlist } from '../../core/tinyts'; import { Button } from '../../control/button'; import { ListView, ListViewV, SubView } from '../../control/list'; import { Meta } from '../../core/meta'; import { TsDate } from '../../utils/date'; class DataModel {...
} var aa = new ListViewVModel();
{ var data = []; data.push(new DataModel(1, "a1", ["aa"], "qqq")); data.push(new DataModel(2, "a1", ["aa"], "qqq")); this.mList.SetData(data); }
identifier_body
listviewv_test.ts
import { ViewV, View } from '../../core/view'; import { AncView, v, f, vlist } from '../../core/tinyts'; import { Button } from '../../control/button'; import { ListView, ListViewV, SubView } from '../../control/list'; import { Meta } from '../../core/meta'; import { TsDate } from '../../utils/date'; class DataModel {...
var aa = new ListViewVModel();
}
random_line_split
shootout-meteor.rs
T> { fn next(&mut self) -> Option<T> { let mut res = (self.f)(&self.next); std::mem::swap(&mut res, &mut self.next); Some(res) } } // a linked list using borrowed next. enum List<'a, T> { Nil, Cons(T, &'a List<'a, T>) } struct ListIterator<'a, T> { cur: &'a List<'a, T> } im...
(&mut self, other: Data) { self.nb += other.nb; let Data { min: min, max: max, ..} = other; if min < self.min { self.min = min; } if max > self.max { self.max = max; } } } // Records a new found solution. Returns false if the search must be // stopped. fn handle_sol(raw_sol: &List<...
reduce_from
identifier_name
shootout-meteor.rs
T> { fn next(&mut self) -> Option<T> { let mut res = (self.f)(&self.next); std::mem::swap(&mut res, &mut self.next); Some(res) } } // a linked list using borrowed next. enum List<'a, T> { Nil, Cons(T, &'a List<'a, T>) } struct ListIterator<'a, T> { cur: &'a List<'a, T> } im...
for (cur_id, pos_masks) in masks_at.iter().enumerate() { if board & 1 << (50 + cur_id) != 0 { continue; } for &cur_m in pos_masks.iter() { if cur_m & board != 0 { continue; } coverable |= cur_m; // if every coordinates can be covered and e...
{ continue; }
conditional_block
shootout-meteor.rs
T> { fn next(&mut self) -> Option<T> { let mut res = (self.f)(&self.next); std::mem::swap(&mut res, &mut self.next); Some(res) } } // a linked list using borrowed next. enum List<'a, T> { Nil, Cons(T, &'a List<'a, T>) } struct ListIterator<'a, T> { cur: &'a List<'a, T> } im...
// Records a new found solution. Returns false if the search must be // stopped. fn handle_sol(raw_sol: &List<u64>, data: &mut Data) { // because we break the symetry, 2 solutions correspond to a call // to
if min < self.min { self.min = min; } if max > self.max { self.max = max; } } }
random_line_split
multi_conf.py
from mongrel2.config import * main = Server( uuid="f400bf85-4538-4f7a-8908-67e313d515c2", access_log="/logs/access.log", error_log="/logs/error.log", chroot="./", default_host="localhost", name="test", pid_file="/run/mongrel2.pid", port=6767, hosts = [ Host(name="localhost"...
chroot="./", default_host="sub", name="sub", pid_file="/run/mongrel2.pid", port=6767, hosts = [ Host(name="sub", routes={ r'/dev/null/(.*)': Dir(base='tests/', index_file='index.html', default_ctype='text/plain') }) ] ) foo = Server( ...
sub = Server( uuid="e3ce7982-086f-4374-adde-bee320d509e6", access_log="/logs/access.log", error_log="/logs/error.log",
random_line_split
main.rs
use std::io; use std::cmp; fn main() { let mut input = String::new(); let mut wrap = 0; let mut ribbon = 0; while let Ok(n) = io::stdin().read_line(&mut input) { if n == 0
let (l, w, h) = { let parts: Vec<_> = input.split('x').collect(); let dims: Vec<_> = parts.iter().filter_map(|&x| x.trim().parse::<i32>().ok()).collect(); if dims.len() != 3 { continue; } (dims[0], dims[1], dims[2]) }; ...
{ break; }
conditional_block
main.rs
use std::io; use std::cmp; fn main() { let mut input = String::new(); let mut wrap = 0; let mut ribbon = 0; while let Ok(n) = io::stdin().read_line(&mut input) { if n == 0 { break;
let (l, w, h) = { let parts: Vec<_> = input.split('x').collect(); let dims: Vec<_> = parts.iter().filter_map(|&x| x.trim().parse::<i32>().ok()).collect(); if dims.len() != 3 { continue; } (dims[0], dims[1], dims[2]) }; ...
}
random_line_split
main.rs
use std::io; use std::cmp; fn
() { let mut input = String::new(); let mut wrap = 0; let mut ribbon = 0; while let Ok(n) = io::stdin().read_line(&mut input) { if n == 0 { break; } let (l, w, h) = { let parts: Vec<_> = input.split('x').collect(); let dims: Vec<_> = parts.it...
main
identifier_name
main.rs
use std::io; use std::cmp; fn main()
wrap += 2*l*w + 2*w*h + 2*h*l; wrap += cmp::min(l*w, cmp::min(w*h, h*l)); ribbon += 2*l + 2*w + 2*h - 2*(cmp::max(l, cmp::max(w, h))); ribbon += l*w*h; input.clear(); } println!("Wrap: {0}", wrap); println!("Ribbon: {0}", ribbon); }
{ let mut input = String::new(); let mut wrap = 0; let mut ribbon = 0; while let Ok(n) = io::stdin().read_line(&mut input) { if n == 0 { break; } let (l, w, h) = { let parts: Vec<_> = input.split('x').collect(); let dims: Vec<_> = parts.iter(...
identifier_body
netutil.py
Family may be set to either `socket.AF_INET` or `socket.AF_INET6` to restrict to IPv4 or IPv6 addresses, otherwise both will be used if available. The ``backlog`` argument has the same meaning as for `socket.listen() <socket.socket.listen>`. ``flags`` is a bitmask of AI_* flags to `~socket.getad...
BlockingResolver
identifier_name
netutil.py
sockets are returned if the given address maps to multiple IP addresses, which is most common for mixed IPv4 and IPv6 use). Address may be either an IP address or hostname. If it's a hostname, the server will listen on all IP addresses associated with the name. Address may be an empty string or ...
# On linux, ipv6 sockets accept ipv4 too by default, # but this makes it impossible to bind to both # 0.0.0.0 in ipv4 and :: in ipv6. On other systems, # separate sockets *must* be used to listen for both ipv4 # and ipv6. For consistency, always disable ipv4...
af, socktype, proto, canonname, sockaddr = res if (platform.system() == 'Darwin' and address == 'localhost' and af == socket.AF_INET6 and sockaddr[3] != 0): # Mac OS X includes a link-local address fe80::1%lo0 in the # getaddrinfo results for 'localhost'. However, the fi...
conditional_block
netutil.py
sockets are returned if the given address maps to multiple IP addresses, which is most common for mixed IPv4 and IPv6 use). Address may be either an IP address or hostname. If it's a hostname, the server will listen on all IP addresses associated with the name. Address may be an empty string or ...
continue raise callback(connection, address) io_loop.add_handler(sock, accept_handler, IOLoop.READ) def is_valid_ip(ip): """Returns true if the given string is a well-formed IP address. Supports IPv4 and IPv6. """ if not ip or '\x00' in ip: ...
return # ECONNABORTED indicates that there was a connection # but it was closed while still in the accept queue. # (observed on FreeBSD). if errno_from_exception(e) == errno.ECONNABORTED:
random_line_split
netutil.py
# but this makes it impossible to bind to both # 0.0.0.0 in ipv4 and :: in ipv6. On other systems, # separate sockets *must* be used to listen for both ipv4 # and ipv6. For consistency, always disable ipv4 on our # ipv6 sockets and use a separate ipv4 socket...
self.resolver.close()
identifier_body
zoofcgi.py
def _do_unknown_type(self, inrec): """Handle an unknown request type. Respond accordingly.""" outrec = Record(FCGI_UNKNOWN_TYPE) outrec.contentData = struct.pack(FCGI_UnknownTypeBody, inrec.type) outrec.contentLength = FCGI_UnknownTypeBody_LEN self.writeRecord(outrec) class FC...
settings_module = django_settings_module
conditional_block
zoofcgi.py
Attempts to receive length bytes from a socket, blocking if necessary. (Socket may be blocking or non-blocking.) """ if __dbg__: logging.debug('_recvall (%d)' % length) dataList = [] recvLen = 0 while length: data = stream.read(length) i...
"""Handle an FCGI_BEGIN_REQUEST from the web server.""" role, flags = struct.unpack(FCGI_BeginRequestBody, inrec.contentData) req = self.server.request_class(self, self._inputStreamClass) req.requestId, req.role, req.flags = inrec.requestId, role, flags req.aborted = False if n...
identifier_body
zoofcgi.py
% (recvLen)) return ''.join(dataList), recvLen _recvall = staticmethod(_recvall) def read(self, stream): """Read and decode a Record from a socket.""" try: header, length = self._recvall(stream, FCGI_HEADER_LEN) except: raise if length < FCGI_...
_do_params
identifier_name
zoofcgi.py
if not self.closed and self.dataWritten: self.flush() rec = Record(self._type, self._req.requestId) self._conn.writeRecord(rec) self.closed = True class TeeOutputStream(object): """ Simple wrapper around two or more output file-like objects that copies writ...
rec.read(self._stdin) if rec.type == FCGI_GET_VALUES: self._do_get_values(rec)
random_line_split
log-util.ts
import { ChildProcess, spawn } from 'child_process'; import { Actions } from '../state/actions'; import { Screen, Status } from '../types/types'; import { logger } from './logger'; import { searchIndex } from './search'; import { GIT_LOG_ARGS, stash } from './stash'; import { getCounter } from './util-functions'; let ...
}); Actions.addCommits(lines); }); gitLogProcess.stderr.on('data', (data: string) => (errorString += data)); gitLogProcess.on('close', (code: number) => { if (code > 0) { screen.destroy(); logger.error('\nGIT LOG ERROR:'); logger.error(errorString); process.exit(code); } else { Actions.up...
lines.forEach((line) => { searchIndex.indexLine(counter.next().value as number, line);
random_line_split
log-util.ts
import { ChildProcess, spawn } from 'child_process'; import { Actions } from '../state/actions'; import { Screen, Status } from '../types/types'; import { logger } from './logger'; import { searchIndex } from './search'; import { GIT_LOG_ARGS, stash } from './stash'; import { getCounter } from './util-functions'; let ...
else { Actions.updateStatus(Status.LOG_COMPLETED); } }); screen.render(); };
{ screen.destroy(); logger.error('\nGIT LOG ERROR:'); logger.error(errorString); process.exit(code); }
conditional_block
users.js
'use strict'; module.exports.install = function(admin){ admin.menu.addBefore('account', { id:'users', name:'User Management',
// admin angular module dependencies admin.modules.push('neAdmin.users'); // admin routes admin.routes[ '/users' ] = { templateUrl: admin.basePath + 'views/users.html', controller:'UsersCtrl', reloadOnSearch:false }; // include styles // admin.styles.push('css/mystyle.css'); ...
icon:'fa fa-users', href:'#/users', allowRoles:['admin'] });
random_line_split
users.js
'use strict'; module.exports.install = function(admin){ admin.menu.addBefore('account', { id:'users', name:'User Management', icon:'fa fa-users', href:'#/users', allowRoles:['admin'] }); // admin angular module dependencies admin.module...
function disableSelfRemove(ctx, next){ if(ctx.params.id === this.user.id){ this.status = 400; this.json({ data:{ id:['selfRemove'] } }); } else next(); } function disableSelfDisable(ctx, next){ if(ctx.body.disabled && ctx.params.i...
{ ctx.model.hashPass(); next(); }
identifier_body
users.js
'use strict'; module.exports.install = function(admin){ admin.menu.addBefore('account', { id:'users', name:'User Management', icon:'fa fa-users', href:'#/users', allowRoles:['admin'] }); // admin angular module dependencies admin.module...
(ctx, next){ ctx.model.hashPass(); next(); } function disableSelfRemove(ctx, next){ if(ctx.params.id === this.user.id){ this.status = 400; this.json({ data:{ id:['selfRemove'] } }); } else next(); } function disableSe...
hashPass
identifier_name
pageserver.py
import tornado.web import forms import config import io class Index(tornado.web.RequestHandler): """ Returns the index page. """ def get(self): form = forms.RecomputeForm() recomputations_count = io.get_recomputations_count() latest_recomputations = io.load_all_recomputations...
(tornado.web.RequestHandler): """ Returns the individual recomputation page. """ def get(self, name): if name.isdigit(): recomputation = io.load_recomputation_by_id(int(name)) else: recomputation = io.load_recomputation(name) if recomputation is not None...
Recomputation
identifier_name
pageserver.py
import tornado.web import forms import config import io class Index(tornado.web.RequestHandler): """ Returns the index page. """ def get(self): form = forms.RecomputeForm() recomputations_count = io.get_recomputations_count() latest_recomputations = io.load_all_recomputations...
def post(self): if self.form.validate(): print "here" name = self.form.name.data if name != "": print name self.recomputations = [r for r in self.recomputations if r["name"] == name] self.render("recomputations.html", filter_reco...
self.render("recomputations.html", filter_recomputations_form=self.form, recomputations=self.recomputations)
identifier_body
pageserver.py
import tornado.web import forms import config import io class Index(tornado.web.RequestHandler): """ Returns the index page. """ def get(self): form = forms.RecomputeForm() recomputations_count = io.get_recomputations_count() latest_recomputations = io.load_all_recomputations...
self.render("recomputations.html", filter_recomputations_form=self.form, recomputations=self.recomputations) class Recomputation(tornado.web.RequestHandler): """ Returns the individual recomputation page. """ def get(self, name): if name.isdigit(): recomputation = io.loa...
print "here" name = self.form.name.data if name != "": print name self.recomputations = [r for r in self.recomputations if r["name"] == name]
conditional_block
pageserver.py
import tornado.web import forms import config import io class Index(tornado.web.RequestHandler): """ Returns the index page. """
self.render("index.html", recompute_form=form, recomputations_count=recomputations_count, latest_recomputations=latest_recomputations) class Recomputations(tornado.web.RequestHandler): """ Returns the recomputations/search page. """ def initialize(self): self.form ...
def get(self): form = forms.RecomputeForm() recomputations_count = io.get_recomputations_count() latest_recomputations = io.load_all_recomputations(config.latest_recomputations_count)
random_line_split
nvptx.rs
use super::{InlineAsmArch, InlineAsmType}; use rustc_macros::HashStable_Generic; def_reg_class! { Nvptx NvptxInlineAsmRegClass { reg16, reg32, reg64, } } impl NvptxInlineAsmRegClass { pub fn valid_modifiers(self, _arch: InlineAsmArch) -> &'static [char] { &[] } pub...
pub fn suggest_modifier( self, _arch: InlineAsmArch, _ty: InlineAsmType, ) -> Option<(char, &'static str)> { None } pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<(char, &'static str)> { None } pub fn supported_types( self, ...
{ None }
identifier_body
nvptx.rs
use super::{InlineAsmArch, InlineAsmType}; use rustc_macros::HashStable_Generic; def_reg_class! { Nvptx NvptxInlineAsmRegClass { reg16, reg32, reg64, } } impl NvptxInlineAsmRegClass { pub fn valid_modifiers(self, _arch: InlineAsmArch) -> &'static [char] { &[] } pub...
def_regs! { // Registers in PTX are declared in the assembly. // There are no predefined registers that one can use. Nvptx NvptxInlineAsmReg NvptxInlineAsmRegClass {} }
} } }
random_line_split
nvptx.rs
use super::{InlineAsmArch, InlineAsmType}; use rustc_macros::HashStable_Generic; def_reg_class! { Nvptx NvptxInlineAsmRegClass { reg16, reg32, reg64, } } impl NvptxInlineAsmRegClass { pub fn
(self, _arch: InlineAsmArch) -> &'static [char] { &[] } pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> { None } pub fn suggest_modifier( self, _arch: InlineAsmArch, _ty: InlineAsmType, ) -> Option<(char, &'static str)> {...
valid_modifiers
identifier_name
parsers.py
from abc import ABCMeta, abstractmethod from enum import Enum class InputType(Enum): ls = 1 dir = 2 unknown = 3 class ParserBase(metaclass=ABCMeta): def __init__(self, input_text, extensions): self.input = input_text.splitlines() self.extensions = extensions @abstractmethod ...
directory = '' output = [] for line in self.input: if len(line) == 0: continue elif line == '\n': continue elif self._check_if_directory(line): directory = self._parse_directory(line) else: ...
random_line_split
parsers.py
from abc import ABCMeta, abstractmethod from enum import Enum class InputType(Enum): ls = 1 dir = 2 unknown = 3 class ParserBase(metaclass=ABCMeta): def __init__(self, input_text, extensions): self.input = input_text.splitlines() self.extensions = extensions @abstractmethod ...
elif self._check_if_directory(line): directory = self._parse_directory(line) else: title = self._parse_line(line, num_word) if self._check_extension(title): output.append(directory + title) return output @abstractm...
continue
conditional_block
parsers.py
from abc import ABCMeta, abstractmethod from enum import Enum class InputType(Enum): ls = 1 dir = 2 unknown = 3 class ParserBase(metaclass=ABCMeta): def __init__(self, input_text, extensions): self.input = input_text.splitlines() self.extensions = extensions @abstractmethod ...
@abstractmethod def _parse_directory(self, line): pass @staticmethod def _parse_line(line, num_word): words = line.split(None, num_word - 1) if len(words) < num_word: return '' else: return words[num_word - 1] def _check_extension(self, tit...
pass
identifier_body
parsers.py
from abc import ABCMeta, abstractmethod from enum import Enum class InputType(Enum): ls = 1 dir = 2 unknown = 3 class ParserBase(metaclass=ABCMeta): def __init__(self, input_text, extensions): self.input = input_text.splitlines() self.extensions = extensions @abstractmethod ...
(ParserBase): def __init__(self, input_text, extensions): super(ParserDIR, self).__init__(input_text, extensions) self.firstDir = '' def read_directories(self): self._set_first_dir() return self._read_directories(4) def _check_if_directory(self, line): return line.s...
ParserDIR
identifier_name
offer.ts
import { GraphQLObjectType, GraphQLString, GraphQLInt } from "graphql" import { connectionDefinitions } from "graphql-relay" import date from "schema/v1/fields/date" import { OrderPartyUnionType } from "./order_party_union" import { OrderInterface, resolveOrderParty } from "./order" import { UserType } from "schema/v1/...
note: { type: GraphQLString, description: "Offer note", }, currencyCode: { type: GraphQLString, description: "Currency code of this order", }, }), }) export const { connectionType: OfferConnection, edgeType: OfferEdge, } = connectionDefinitions({ nodeType: OfferType, })
random_line_split
offer.ts
import { GraphQLObjectType, GraphQLString, GraphQLInt } from "graphql" import { connectionDefinitions } from "graphql-relay" import date from "schema/v1/fields/date" import { OrderPartyUnionType } from "./order_party_union" import { OrderInterface, resolveOrderParty } from "./order" import { UserType } from "schema/v1/...
}), }, from: { type: OrderPartyUnionType, description: "The type of the party who made the offer", resolve: ({ from }, _args, { userByIDLoader, partnerLoader }) => resolveOrderParty(from, userByIDLoader, partnerLoader), }, fromParticipant: { type: OrderParticipan...
{ return false }
conditional_block
no_0113_path_sum_ii.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Solution; impl Solution { pub fn
(root: Option<Rc<RefCell<TreeNode>>>, sum: i32) -> Vec<Vec<i32>> { let mut ans = Vec::new(); Self::helper(&root, sum, &mut vec![], &mut ans); ans } fn helper( root: &Option<Rc<RefCell<TreeNode>>>, mut sum: i32, tmp: &mut Vec<i32>, ans: &mut Vec<Vec<i32>>,...
path_sum
identifier_name
no_0113_path_sum_ii.rs
use crate::common::TreeNode;
use std::rc::Rc; struct Solution; impl Solution { pub fn path_sum(root: Option<Rc<RefCell<TreeNode>>>, sum: i32) -> Vec<Vec<i32>> { let mut ans = Vec::new(); Self::helper(&root, sum, &mut vec![], &mut ans); ans } fn helper( root: &Option<Rc<RefCell<TreeNode>>>, mut s...
use std::cell::RefCell;
random_line_split
no_0113_path_sum_ii.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Solution; impl Solution { pub fn path_sum(root: Option<Rc<RefCell<TreeNode>>>, sum: i32) -> Vec<Vec<i32>> { let mut ans = Vec::new(); Self::helper(&root, sum, &mut vec![], &mut ans); ans } fn helper( ...
} } #[cfg(test)] mod tests { use super::*; use crate::common::tree_node; #[test] fn test_path_sum() { let root = tree_node(TreeNode { val: 5, left: tree_node(TreeNode { val: 4, left: tree_node(TreeNode { val: 11, ...
{ let r = r.borrow(); sum -= r.val; tmp.push(r.val); if sum == 0 && r.left.is_none() && r.right.is_none() { ans.push(tmp.clone()); } if r.left.is_some() { Self::helper(&r.left, sum, tmp, ans); } ...
conditional_block
fakead3p.js
/** * Copyright 2016 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
(global, data) { if (data.ad_container) { dev().assert(data.container == data.ad_container, 'wrong container'); } }
fakead3p
identifier_name
fakead3p.js
/** * Copyright 2016 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
/** * @param {!Window} global * @param {!Object} data */ export function fakead3p(global, data) { if (data.ad_container) { dev().assert(data.container == data.ad_container, 'wrong container'); } }
import {dev} from '../src/log';
random_line_split
fakead3p.js
/** * Copyright 2016 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless require...
{ if (data.ad_container) { dev().assert(data.container == data.ad_container, 'wrong container'); } }
identifier_body