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
ThreeMFWriter.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Mesh.MeshWriter import MeshWriter from UM.Math.Vector import Vector from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application import UM.Scene.SceneNode import Savitar ...
try: model_file = zipfile.ZipInfo("3D/3dmodel.model") # Because zipfile is stupid and ignores archive-level compression settings when writing with ZipInfo. model_file.compress_type = zipfile.ZIP_DEFLATED # Create content types file content_types_file ...
def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode): self._archive = None # Reset archive archive = zipfile.ZipFile(stream, "w", compression = zipfile.ZIP_DEFLATED)
random_line_split
ThreeMFWriter.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Mesh.MeshWriter import MeshWriter from UM.Math.Vector import Vector from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application import UM.Scene.SceneNode import Savitar ...
savitar_node = Savitar.SceneNode() node_matrix = um_node.getLocalTransformation() matrix_string = self._convertMatrixToString(node_matrix.preMultiply(transformation)) savitar_node.setTransformation(matrix_string) mesh_data = um_node.getMeshData() if mesh_data is not ...
return None
conditional_block
ThreeMFWriter.py
# Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. from UM.Mesh.MeshWriter import MeshWriter from UM.Math.Vector import Vector from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application import UM.Scene.SceneNode import Savitar ...
def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode): self._archive = None # Reset archive archive = zipfile.ZipFile(stream, "w", compression = zipfile.ZIP_DEFLATED) try: model_file = zipfile.ZipInfo("3D/3dmodel.model") # Because zipfile is stupid...
return self._archive
identifier_body
ArchivedRuns.tsx
/* * Copyright 2018 The Kubeflow Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
(): JSX.Element { return ( <div className={classes(commonCss.page, padding(20, 'lr'))}> <RunList namespaceMask={this.props.namespace} onError={this.showPageError.bind(this)} selectedIds={this.state.selectedIds} onSelectionChange={this._selectionChanged.bind(this...
render
identifier_name
ArchivedRuns.tsx
/* * Copyright 2018 The Kubeflow Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
public getInitialToolbarState(): ToolbarProps { const buttons = new Buttons(this.props, this.refresh.bind(this)); return { actions: buttons .restore('run', () => this.state.selectedIds, false, this._selectionChanged.bind(this)) .refresh(this.refresh.bind(this)) .delete( ...
{ super(props); this.state = { selectedIds: [], }; }
identifier_body
ArchivedRuns.tsx
/* * Copyright 2018 The Kubeflow Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agre...
toolbarActions[ButtonKeys.DELETE_RUN].disabled = !selectedIds.length; this.props.updateToolbar({ actions: toolbarActions, breadcrumbs: this.props.toolbarProps.breadcrumbs, }); this.setState({ selectedIds }); } } const EnhancedArchivedRuns = (props: PageProps) => { const namespace = Reac...
random_line_split
collapse.js
import { _ as __vue_normalize__, r as registerComponent, u as use } from './chunk-cca88db8.js'; var script = { name: 'BCollapse', // deprecated, to replace with default 'value' in the next breaking change model: { prop: 'open', event: 'update:open' }, props: { open: { type: Boolean, d...
methods: { /** * Toggle and emit events */ toggle: function toggle() { this.isOpen = !this.isOpen; this.$emit('update:open', this.isOpen); this.$emit(this.isOpen ? 'open' : 'close'); } }, render: function render(createElement) { var trigger = createElement('div', { ...
watch: { open: function open(value) { this.isOpen = value; } },
random_line_split
_test_ns.py
import unittest import numpy as np import socket import Pyro4 from nested_sampling import NestedSampling, MonteCarloWalker, Harmonic, Replica class TestNS(unittest.TestCase): """to test distributed computing must start a dispatcher with --server-name test and --port 9090 """ def setUp(self): self.s...
(TestNS): def setUp(self): self.setUp1(nproc=3) class testNSParPyro(TestNS): def setUp(self): self.setUp1(nproc=3,multiproc=False) if __name__ == "__main__": unittest.main()
testNSParMultiproc
identifier_name
_test_ns.py
import unittest import numpy as np import socket import Pyro4 from nested_sampling import NestedSampling, MonteCarloWalker, Harmonic, Replica class TestNS(unittest.TestCase): """to test distributed computing must start a dispatcher with --server-name test and --port 9090 """ def setUp(self): self.s...
self.ns = NestedSampling(replicas, self.mc_runner, stepsize=0.1, nproc=nproc, verbose=False, dispatcher_URI=self.dispatcher_URI) self.Emax0 = self.ns.replicas[-1].energy self.niter = 100 for i in xrange(self.niter): self.ns....
replicas = [] for i in xrange(self.nreplicas): x = self.harmonic.get_random_configuration() replicas.append(Replica(x, self.harmonic.get_energy(x)))
random_line_split
_test_ns.py
import unittest import numpy as np import socket import Pyro4 from nested_sampling import NestedSampling, MonteCarloWalker, Harmonic, Replica class TestNS(unittest.TestCase): """to test distributed computing must start a dispatcher with --server-name test and --port 9090 """ def setUp(self): self.s...
unittest.main()
conditional_block
_test_ns.py
import unittest import numpy as np import socket import Pyro4 from nested_sampling import NestedSampling, MonteCarloWalker, Harmonic, Replica class TestNS(unittest.TestCase): """to test distributed computing must start a dispatcher with --server-name test and --port 9090 """ def setUp(self): self.s...
class testNSParMultiproc(TestNS): def setUp(self): self.setUp1(nproc=3) class testNSParPyro(TestNS): def setUp(self): self.setUp1(nproc=3,multiproc=False) if __name__ == "__main__": unittest.main()
print "running TestNS" self.assert_(len(self.ns.replicas) == self.nreplicas) self.assert_(self.Emax < self.Emax0) self.assert_(self.Emin < self.Emax) self.assert_(self.Emin >= 0) self.assert_(self.ns.stepsize != self.stepsize) self.assertEqual(len(self.ns.max_energies), s...
identifier_body
modelparser.py
# ============================================================ # modelparser.py # # (C) Tiago Almeida 2016 # # Still in early development stages. # # This module uses PLY (http://www.dabeaz.com/ply/ply.html) # and a set of grammar rules to parse a custom model # definition language. # =======================...
if p[1] == '*': p[0] = MULT_ANY else: p[0] = MULT_SINGLE def p_field_notnull(p): """ notnull : EXCLAMATION | empty """ if p[1] == '!': p[0] = False else: p[0] = True def p_empty(p): 'empty :' pass def p_modeldecl_print_error(p): 'model : ...
def p_field_multiplicity(p): """ multiplicity : STAR | empty """
random_line_split
modelparser.py
# ============================================================ # modelparser.py # # (C) Tiago Almeida 2016 # # Still in early development stages. # # This module uses PLY (http://www.dabeaz.com/ply/ply.html) # and a set of grammar rules to parse a custom model # definition language. # =======================...
def p_field_notnull(p): """ notnull : EXCLAMATION | empty """ if p[1] == '!': p[0] = False else: p[0] = True def p_empty(p): 'empty :' pass def p_modeldecl_print_error(p): 'model : ID LBRACKET error RBRACKET' print("Syntax error in model declarat...
p[0] = MULT_SINGLE
conditional_block
modelparser.py
# ============================================================ # modelparser.py # # (C) Tiago Almeida 2016 # # Still in early development stages. # # This module uses PLY (http://www.dabeaz.com/ply/ply.html) # and a set of grammar rules to parse a custom model # definition language. # =======================...
def p_modelsdecl(p): """ models : models model | model """ if len(p) >= 3: models.append(p[2]) else: models.append(p[1]) def p_modeldecl(p): 'model : ID LBRACKET fields RBRACKET' global fields p[0] = { 'model': p[1], 'fields': fields } ...
""" rules : models """ p[0] = p[1]
identifier_body
modelparser.py
# ============================================================ # modelparser.py # # (C) Tiago Almeida 2016 # # Still in early development stages. # # This module uses PLY (http://www.dabeaz.com/ply/ply.html) # and a set of grammar rules to parse a custom model # definition language. # =======================...
(p): 'model : ID LBRACKET fields RBRACKET' global fields p[0] = { 'model': p[1], 'fields': fields } fields = [] def p_fields_decl(p): """ fields : fields field | field """ if len(p) >= 3: fields.append(p[2]) else: fields.append(p[1]) de...
p_modeldecl
identifier_name
__init__.py
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals __license__ = 'Public Domain' import codecs import io import os import random import sys from .options import ( parseOpts, ) from .compat import ( compat_expanduser, compat_getpass, compat_shlex_split, workaround_optp...
(retries): if retries in ('inf', 'infinite'): parsed_retries = float('inf') else: try: parsed_retries = int(retries) except (TypeError, ValueError): parser.error('invalid retry count specified') return parsed_retries if opts...
parse_retries
identifier_name
__init__.py
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals __license__ = 'Public Domain' import codecs import io import os import random import sys from .options import ( parseOpts, ) from .compat import ( compat_expanduser, compat_getpass, compat_shlex_split, workaround_optp...
if opts.retries is not None: opts.retries = parse_retries(opts.retries) if opts.fragment_retries is not None: opts.fragment_retries = parse_retries(opts.fragment_retries) if opts.buffersize is not None: numeric_buffersize = FileDownloader.parse_bytes(opts.buffersize) if nume...
if retries in ('inf', 'infinite'): parsed_retries = float('inf') else: try: parsed_retries = int(retries) except (TypeError, ValueError): parser.error('invalid retry count specified') return parsed_retries
identifier_body
__init__.py
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals __license__ = 'Public Domain' import codecs import io import os import random import sys from .options import ( parseOpts, ) from .compat import ( compat_expanduser, compat_getpass, compat_shlex_split, workaround_optp...
std_headers[key] = value # Dump user agent if opts.dump_user_agent: write_string(std_headers['User-Agent'] + '\n', out=sys.stdout) sys.exit(0) # Batch file verification batch_urls = [] if opts.batchfile is not None: try: if opts.batchfile == '-': ...
write_string('[debug] Adding header from command line option %s:%s\n' % (key, value))
conditional_block
__init__.py
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals __license__ = 'Public Domain' import codecs import io import os import random import sys from .options import ( parseOpts, ) from .compat import ( compat_expanduser, compat_getpass, compat_shlex_split, workaround_optp...
except DownloadError: sys.exit(1) except SameFileError: sys.exit('ERROR: fixed output name but more than one file to download') except KeyboardInterrupt: sys.exit('\nERROR: Interrupted by user') __all__ = ['main', 'YoutubeDL', 'gen_extractors', 'list_extractors']
def main(argv=None): try: _real_main(argv)
random_line_split
lib.rs
//! # The Rust Core Library //! //! The Rust Core Library is the dependency-free[^free] foundation of [The //! Rust Standard Library](../std/index.html). It is the portable glue //! between the language and its libraries, defining the intrinsic and //! primitive building blocks of all Rust code. It links to no //! upst...
#![deny(rust_2021_incompatible_or_patterns)] #![deny(unsafe_op_in_unsafe_fn)] #![warn(deprecated_in_future)] #![warn(missing_debug_implementations)] #![warn(missing_docs)] #![allow(explicit_outlives_requirements)] #![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard // // Library features for const fns: ...
// Lints:
random_line_split
tests.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use super::*; use once_cell::sync::Lazy; use parking_lot::Mutex; use regex::Regex; use std::fmt; use std::sync::atomic::AtomicU64; use std::s...
{ id: AtomicU64, out: Arc<Mutex<Vec<String>>>, } impl TestSubscriber { fn log(&self, s: String) { self.out.lock().push(normalize(&s)); } } impl Subscriber for TestSubscriber { fn enabled(&self, _metadata: &Metadata) -> bool { true } fn new_span(&self, span: &Attributes) -> I...
TestSubscriber
identifier_name
tests.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use super::*; use once_cell::sync::Lazy; use parking_lot::Mutex; use regex::Regex; use std::fmt; use std::sync::atomic::AtomicU64; use std::s...
/// Capture logs about tracing. fn capture(f: impl FnOnce()) -> Vec<String> { // Prevent races since tests run in multiple threads. let _locked = THREAD_LOCK.lock(); let sub = TestSubscriber::default(); let out = sub.out.clone(); tracing::subscriber::with_default(sub, f); let out = out.lock(); ...
let s2 = "abc".to_string().intern(); assert_eq!(s1.as_ptr(), s2.as_ptr()); }
random_line_split
tests.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use super::*; use once_cell::sync::Lazy; use parking_lot::Mutex; use regex::Regex; use std::fmt; use std::sync::atomic::AtomicU64; use std::s...
#[test] fn test_intern() { use crate::Intern; let s1 = "abc".intern(); let s2 = "abc".to_string().intern(); assert_eq!(s1.as_ptr(), s2.as_ptr()); } /// Capture logs about tracing. fn capture(f: impl FnOnce()) -> Vec<String> { // Prevent races since tests run in multiple threads. let _locked =...
{ let callsite1 = create_callsite::<EventKindType, _>((33, 1), CallsiteInfo::default); let callsite2 = create_callsite::<EventKindType, _>((33, 1), CallsiteInfo::default); assert_eq!(callsite1 as *const _, callsite2 as *const _); }
identifier_body
test_3d.py
from model_3d import * # ------------------------ Functions ------------------------------------------# def test():
if __name__ == "__main__": test()
""" A simple test routine to draw the quadcopter model """ # Creates a VPython Scene scene = display(title='Quad_Test', x=0, y=0, width=800, height=600, center=(0,0,0), background=(0,0,0), forward=(-1,-1,-1)) # Inertial Static Reference Frame pointer = arrow(pos=(0,0,0), axis=(...
identifier_body
test_3d.py
from model_3d import * # ------------------------ Functions ------------------------------------------# def test(): """ A simple test routine to draw the quadcopter model """ # Creates a VPython Scene scene = display(title='Quad_Test', x=0, y=0, width=800, height=600, center=(0,0,0), ...
test()
conditional_block
test_3d.py
from model_3d import * # ------------------------ Functions ------------------------------------------# def
(): """ A simple test routine to draw the quadcopter model """ # Creates a VPython Scene scene = display(title='Quad_Test', x=0, y=0, width=800, height=600, center=(0,0,0), background=(0,0,0), forward=(-1,-1,-1)) # Inertial Static Reference Frame pointer = arrow(pos=(0,0,0)...
test
identifier_name
test_3d.py
from model_3d import * # ------------------------ Functions ------------------------------------------# def test():
scene = display(title='Quad_Test', x=0, y=0, width=800, height=600, center=(0,0,0), background=(0,0,0), forward=(-1,-1,-1)) # Inertial Static Reference Frame pointer = arrow(pos=(0,0,0), axis=(10,0,0), shaftwidth=0.1) pointer = arrow(pos=(0,0,0), axis=(0,10,0), shaftwidth=0.1) pointer =...
""" A simple test routine to draw the quadcopter model """ # Creates a VPython Scene
random_line_split
results-charge.component.ts
import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; //Language import { Language } from '../../language/language'; import { LanguageService } from '../../language/language.service'; //Objects import { Company } from '../../objects/company'; import { Product } from '../../objects/pr...
() { this.charges = []; var resultPeriode = "result" + this.periode; Object.keys(this.company.result).map( (keyResult) => { if(keyResult === resultPeriode){ Object.keys(this.company.result[keyResult].charge).map( (key) =>{ if(key == "all"){ this.chargesTotal = this.compan...
ngOnInit
identifier_name
results-charge.component.ts
import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; //Language import { Language } from '../../language/language'; import { LanguageService } from '../../language/language.service'; //Objects import { Company } from '../../objects/company'; import { Product } from '../../objects/pr...
}); this.sumCharges = []; this.charges.map( (charge, iProd) => { var sumCharge = this.charges[iProd].materialConso; sumCharge += this.charges[iProd].directLabour; sumCharge += this.charges[iProd].qualityCost; sumCharge += this.charges[iProd].publicityCost; sumCharge += this.c...
{ Object.keys(this.company.result[keyResult].charge).map( (key) =>{ if(key == "all"){ this.chargesTotal = this.company.result[keyResult].charge[key]; } else { this.charges.push(this.company.result[keyResult].charge[key]); } }); }
conditional_block
results-charge.component.ts
import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; //Language import { Language } from '../../language/language'; import { LanguageService } from '../../language/language.service'; //Objects import { Company } from '../../objects/company'; import { Product } from '../../objects/pr...
}
this.ngOnInit(); }
random_line_split
util.ts
import readdirRecursive from "fs-readdir-recursive"; import * as babel from "@babel/core"; import path from "path"; import fs from "fs"; import * as watcher from "./watcher"; export function chmod(src: string, dest: string): void { try { fs.chmodSync(dest, fs.statSync(src).mode); } catch (err) { console.w...
timer = setTimeout(fn, time); } debounced.flush = () => { clearTimeout(timer); fn(); }; return debounced; }
export function debounce(fn: () => void, time: number) { let timer; function debounced() { clearTimeout(timer);
random_line_split
util.ts
import readdirRecursive from "fs-readdir-recursive"; import * as babel from "@babel/core"; import path from "path"; import fs from "fs"; import * as watcher from "./watcher"; export function chmod(src: string, dest: string): void { try { fs.chmodSync(dest, fs.statSync(src).mode); } catch (err) { console.w...
export async function compile( filename: string, opts: any | Function, ): Promise<any> { opts = { ...opts, caller: CALLER, }; // TODO (Babel 8): Use `babel.transformFileAsync` const result: any = await new Promise((resolve, reject) => { babel.transformFile(filename, opts, (err, result) => { ...
{ opts = { ...opts, caller: CALLER, filename, }; return new Promise((resolve, reject) => { babel.transform(code, opts, (err, result) => { if (err) reject(err); else resolve(result); }); }); }
identifier_body
util.ts
import readdirRecursive from "fs-readdir-recursive"; import * as babel from "@babel/core"; import path from "path"; import fs from "fs"; import * as watcher from "./watcher"; export function chmod(src: string, dest: string): void { try { fs.chmodSync(dest, fs.statSync(src).mode); } catch (err) { console.w...
(filename: string, ext: string = ".js") { const newBasename = path.basename(filename, path.extname(filename)) + ext; return path.join(path.dirname(filename), newBasename); } export function debounce(fn: () => void, time: number) { let timer; function debounced() { clearTimeout(timer); timer = setTimeou...
withExtension
identifier_name
index.js
'use strict'; /* * Regex */ var regex = { facebookPattern: /(?:https?:\/\/)?(?:[\w\-]+\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/, // jshint ignore:line facebookPluginPattern: /.*%2F(\w+?)&/ }; module.exports = { /** * Returns the page id for a given URL * e.g. : https:/...
else { return id; } } return null; } };
{ var likeMatch = regex.facebookPluginPattern.exec(match.input); if (likeMatch) { return likeMatch[1]; } }
conditional_block
index.js
'use strict'; /* * Regex */ var regex = {
module.exports = { /** * Returns the page id for a given URL * e.g. : https://www.facebook.com/my_page_id => my_page_id * http://www.facebook.com/pages/foo/Bar/123456 => 123456 * * @param String URL FacebookURL * @return Page ID */ getPageId: function (url) { if (typeof u...
facebookPattern: /(?:https?:\/\/)?(?:[\w\-]+\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/, // jshint ignore:line facebookPluginPattern: /.*%2F(\w+?)&/ };
random_line_split
sliplink.py
# Copyright (c) 2007-2017 Joseph Hager. # # Copycat is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License, # as published by the Free Software Foundation. # # Copycat is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; with...
(self): """Return the degree of association of the link.""" if self.fixed_length != None: return 100 - self.fixed_length else: return self.label.degree_of_association()
degree_of_association
identifier_name
sliplink.py
# Copyright (c) 2007-2017 Joseph Hager. # # Copycat is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License, # as published by the Free Software Foundation. # # Copycat is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; with...
return self.label.degree_of_association()
conditional_block
sliplink.py
# Copyright (c) 2007-2017 Joseph Hager. # # Copycat is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License, # as published by the Free Software Foundation. # # Copycat is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; with...
"""Return the degree of association of the link.""" if self.fixed_length != None: return 100 - self.fixed_length else: return self.label.degree_of_association()
identifier_body
sliplink.py
# Copyright (c) 2007-2017 Joseph Hager. # # Copycat is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License, # as published by the Free Software Foundation. # # Copycat is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; with...
return 100 - self.fixed_length else: return self.label.intrinsic_degree_of_association() def degree_of_association(self): """Return the degree of association of the link.""" if self.fixed_length != None: return 100 - self.fixed_length else: ...
if self.fixed_length != None:
random_line_split
myCSPs.py
import csp rgb = ['R', 'G', 'B'] domains = { 'Aosta Valley': rgb, 'Piedmont': rgb, 'Liguria': rgb, 'Lombardy': rgb, 'Trentino': rgb, 'South Tyrol': rgb, 'Veneto': rgb, 'Friuli-Venezia Giulia': rgb, 'Emilia-Romagna': rgb, 'Tuscany': rgb, 'Umbria': rgb, 'Marche': rgb, ...
]
random_line_split
myCSPs.py
import csp rgb = ['R', 'G', 'B'] domains = { 'Aosta Valley': rgb, 'Piedmont': rgb, 'Liguria': rgb, 'Lombardy': rgb, 'Trentino': rgb, 'South Tyrol': rgb, 'Veneto': rgb, 'Friuli-Venezia Giulia': rgb, 'Emilia-Romagna': rgb, 'Tuscany': rgb, 'Umbria': rgb, 'Marche': rgb, ...
if a == b: # e.g. WA = G and SA = G return False return True myItalymap = csp.CSP(vars, domains, neighbors, constraints) myCSPs = [ {'csp': myItalymap, # 'select_unassigned_variable':csp.mrv, } ]
return True
conditional_block
myCSPs.py
import csp rgb = ['R', 'G', 'B'] domains = { 'Aosta Valley': rgb, 'Piedmont': rgb, 'Liguria': rgb, 'Lombardy': rgb, 'Trentino': rgb, 'South Tyrol': rgb, 'Veneto': rgb, 'Friuli-Venezia Giulia': rgb, 'Emilia-Romagna': rgb, 'Tuscany': rgb, 'Umbria': rgb, 'Marche': rgb, ...
(A, a, B, b): if A == B: # e.g. NSW == NSW return True if a == b: # e.g. WA = G and SA = G return False return True myItalymap = csp.CSP(vars, domains, neighbors, constraints) myCSPs = [ {'csp': myItalymap, # 'select_unassigned_variable':csp.mrv, } ]
constraints
identifier_name
myCSPs.py
import csp rgb = ['R', 'G', 'B'] domains = { 'Aosta Valley': rgb, 'Piedmont': rgb, 'Liguria': rgb, 'Lombardy': rgb, 'Trentino': rgb, 'South Tyrol': rgb, 'Veneto': rgb, 'Friuli-Venezia Giulia': rgb, 'Emilia-Romagna': rgb, 'Tuscany': rgb, 'Umbria': rgb, 'Marche': rgb, ...
myItalymap = csp.CSP(vars, domains, neighbors, constraints) myCSPs = [ {'csp': myItalymap, # 'select_unassigned_variable':csp.mrv, } ]
if A == B: # e.g. NSW == NSW return True if a == b: # e.g. WA = G and SA = G return False return True
identifier_body
convert_basti.py
#!/usr/bin/python import glob,re,sys,math,pyfits import numpy as np import utils if len( sys.argv ) < 2: print '\nconvert basti SSP models to ez_gal fits format' print 'Run in directory with SED models for one metallicity' print 'Usage: convert_basti.py ez_gal.ascii\n' sys.exit(2) fileout = sys.argv[1] # try to...
files = glob.glob( 'SPEC*agb*' ) nages = len( files ) ages = [] for (i,file) in enumerate(files): ls = [] this = [] # extract the age from the filename and convert to years m = re.search( 't60*(\d+)$', file ) ages.append( int( m.group(1) )*1e6 ) # read in this file fp = open( file, 'r' ) for line in fp: ...
print 'Loading masses from %s' % mass_file[0] data = utils.rascii( mass_file[0], silent=True ) masses = data[:,10:14].sum( axis=1 ) has_masses = True
conditional_block
convert_basti.py
#!/usr/bin/python import glob,re,sys,math,pyfits import numpy as np import utils if len( sys.argv ) < 2: print '\nconvert basti SSP models to ez_gal fits format' print 'Run in directory with SED models for one metallicity' print 'Usage: convert_basti.py ez_gal.ascii\n' sys.exit(2)
# try to extract meta data out of fileout sfh = ''; tau = ''; met = ''; imf = '' # split on _ but get rid of the extension parts = '.'.join( fileout.split( '.' )[:-1] ).split( '_' ) # look for sfh for (check,val) in zip( ['ssp','exp'], ['SSP','Exponential'] ): if parts.count( check ): sfh = val sfh_index = parts.i...
fileout = sys.argv[1]
random_line_split
lorentzAttractor_timeScale_I.py
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
# See the License for the specific language governing permissions and # limitations under the License. # from wikipedia: dx/dt = sigma*(y-x) ; dy/dt = x*(rho-z)-y dz/dt = x*y-beta*z import numpy as np def initialize(self,runInfoDict,inputFiles): """ Constructor @ In, runInfoDict, dict, dictionary of inpu...
random_line_split
lorentzAttractor_timeScale_I.py
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
def run(self,Input): """ Constructor @ In, Input, dict, dictionary of input values for each feature. @ Out, None """ disc = 2.0 maxTime = 0.5 tStep = 0.005 self.sigma = 10.0 self.rho = 28.0 self.beta = 8.0/3.0 numberTimeSteps = int(maxTime/tStep) self.x1 = np.zeros(numberTimeSt...
""" Constructor @ In, runInfoDict, dict, dictionary of input file names, file location, and other parameters RAVEN run. @ In, inputFiles, list, data objects required for external model initialization. @ Out, None """ self.sigma = 10.0 self.rho = 28.0 self.beta = 8.0/3.0 return
identifier_body
lorentzAttractor_timeScale_I.py
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
(self,runInfoDict,inputFiles): """ Constructor @ In, runInfoDict, dict, dictionary of input file names, file location, and other parameters RAVEN run. @ In, inputFiles, list, data objects required for external model initialization. @ Out, None """ self.sigma = 10.0 self.rho = 28.0 ...
initialize
identifier_name
lorentzAttractor_timeScale_I.py
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
self.time1[t+1] = self.time1[t] + tStep self.x1[t+1] = self.x1[t] + disc*self.sigma*(self.y1[t]-self.x1[t]) * tStep self.y1[t+1] = self.y1[t] + disc*(self.x1[t]*(self.rho-self.z1[t])-self.y1[t]) * tStep self.z1[t+1] = self.z1[t] + disc*(self.x1[t]*self.y1[t]-self.beta*self.z1[t]) * tStep
conditional_block
pinned-users.ts
import define from '../define'; import { Users } from '../../../models'; import { fetchMeta } from '../../../misc/fetch-meta'; import parseAcct from '../../../misc/acct/parse'; import { User } from '../../../models/entities/user'; export const meta = { tags: ['users'], requireCredential: false as const, params: {...
return await Users.packMany(users.filter(x => x !== undefined) as User[], me, { detail: true }); });
export default define(meta, async (ps, me) => { const meta = await fetchMeta(); const users = await Promise.all(meta.pinnedUsers.map(acct => Users.findOne(parseAcct(acct))));
random_line_split
gh-find-in-webview-test.js
import Ember from 'ember'; import {test, moduleForComponent} from 'ember-qunit'; const {run} = Ember; moduleForComponent('gh-find-in-webview', 'Unit | Component | gh find in webview', { unit: true, // specify the other units that are required for this test needs: ['service:window-menu', 'util:find-vis...
else { return docQuerySelector(selector); } }; run(() => { this.render(); component.handleFind(); document.querySelectorAll = docQuerySelector; }); }); test('_insertMenuItem() injects an item', function(assert) { assert.expect(6); const component = thi...
{ return [{ stopFindInPage: (action) => assert.equal(action, 'clearSelection') }]; }
conditional_block
gh-find-in-webview-test.js
import Ember from 'ember'; import {test, moduleForComponent} from 'ember-qunit'; const {run} = Ember; moduleForComponent('gh-find-in-webview', 'Unit | Component | gh find in webview', { unit: true, // specify the other units that are required for this test needs: ['service:window-menu', 'util:find-vis...
assert.equal(params.position, 3); } }) }); run(() => { this.render(); }); });
assert.equal(params.menuName, 'Edit'); assert.equal(params.name, 'find-in-webview'); assert.equal(params.label, '&Find'); assert.equal(params.accelerator, 'CmdOrCtrl+F'); assert.equal(params.addSeperator, true);
random_line_split
gh-find-in-webview-test.js
import Ember from 'ember'; import {test, moduleForComponent} from 'ember-qunit'; const {run} = Ember; moduleForComponent('gh-find-in-webview', 'Unit | Component | gh find in webview', { unit: true, // specify the other units that are required for this test needs: ['service:window-menu', 'util:find-vis...
}) }); run(() => { this.render(); }); });
{ assert.equal(params.menuName, 'Edit'); assert.equal(params.name, 'find-in-webview'); assert.equal(params.label, '&Find'); assert.equal(params.accelerator, 'CmdOrCtrl+F'); assert.equal(params.addSeperator, true); assert.equ...
identifier_body
gh-find-in-webview-test.js
import Ember from 'ember'; import {test, moduleForComponent} from 'ember-qunit'; const {run} = Ember; moduleForComponent('gh-find-in-webview', 'Unit | Component | gh find in webview', { unit: true, // specify the other units that are required for this test needs: ['service:window-menu', 'util:find-vis...
(params) { assert.equal(params.menuName, 'Edit'); assert.equal(params.name, 'find-in-webview'); assert.equal(params.label, '&Find'); assert.equal(params.accelerator, 'CmdOrCtrl+F'); assert.equal(params.addSeperator, true); a...
injectMenuItem
identifier_name
method_self_arg2.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 ...
() -> u64 { unsafe { COUNT } } #[derive(Copy, Clone)] pub struct Foo; impl Foo { pub fn run_trait(self) { unsafe { COUNT *= 17; } // Test internal call. Bar::foo1(&self); Bar::foo2(self); Bar::foo3(box self); Bar::bar1(&self); Bar::bar2(self); Bar::...
get_count
identifier_name
method_self_arg2.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 ...
}
random_line_split
method_self_arg2.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 foo2(self) { unsafe { COUNT *= 3; } } fn foo3(self: Box<Foo>) { unsafe { COUNT *= 5; } } }
{ unsafe { COUNT *= 2; } }
identifier_body
026_add_consistencygroup_quota_class.py
# Copyright (C) 2012 - 2014 EMC Corporation. # # 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 applicab...
"""Don't delete the 'default' entries at downgrade time. We don't know if the user had default entries when we started. If they did, we wouldn't want to remove them. So, the safest thing to do is just leave the 'default' entries at downgrade time. """ pass
identifier_body
026_add_consistencygroup_quota_class.py
# Copyright (C) 2012 - 2014 EMC Corporation. # # 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 applicab...
try: # Set consistencygroups qci = quota_classes.insert() qci.execute({'created_at': CREATED_AT, 'class_name': CLASS_NAME, 'resource': 'consistencygroups', 'hard_limit': CONF.quota_consistencygroups, 'delet...
LOG.info(_("Found existing 'consistencygroups' entries in the" "quota_classes table. Skipping insertion.")) return
conditional_block
026_add_consistencygroup_quota_class.py
# Copyright (C) 2012 - 2014 EMC Corporation. # # 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 applicab...
(migrate_engine): """Don't delete the 'default' entries at downgrade time. We don't know if the user had default entries when we started. If they did, we wouldn't want to remove them. So, the safest thing to do is just leave the 'default' entries at downgrade time. """ pass
downgrade
identifier_name
026_add_consistencygroup_quota_class.py
# Copyright (C) 2012 - 2014 EMC Corporation.
# not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # ...
# # Licensed under the Apache License, Version 2.0 (the "License"); you may
random_line_split
logger_04.py
# -*- coding: utf8 -*- import logging from logging.handlers import RotatingFileHandler from babel.dates import format_datetime, datetime from time import sleep from traceback import print_exception, format_exception class LogFile(logging.Logger): '''rotatively logs erverything ''' def initself(self): ...
def p_log(self, msg, **kwargs): '''level = {info, warning, debug, error} you can also use an exception=exc_info() argument to uprising exceptions! ''' logger = self if 'error' in kwargs: print('error YES') kwargs['level'] = 'error' ...
self.setLevel(logging.DEBUG) self.handler = RotatingFileHandler( 'app.log', # maxBytes=2000, # approximatively 100 line (81) maxBytes=6000, backupCount=3 # number of log backup files ) self.addHandler(self.handler)
identifier_body
logger_04.py
# -*- coding: utf8 -*- import logging from logging.handlers import RotatingFileHandler from babel.dates import format_datetime, datetime from time import sleep from traceback import print_exception, format_exception class LogFile(logging.Logger): '''rotatively logs erverything ''' def initself(self): ...
sleep(.5) logger.p_log('coucou', level="warning")
conditional_block
logger_04.py
# -*- coding: utf8 -*- import logging from logging.handlers import RotatingFileHandler from babel.dates import format_datetime, datetime from time import sleep from traceback import print_exception, format_exception class LogFile(logging.Logger): '''rotatively logs erverything ''' def initself(self): ...
eval("logger." + level + "(\"" + message + "\")") if __name__ == '__main__': logger = LogFile('app.log') logger.initself() for i in range(10): sleep(.5) logger.p_log('coucou', level="warning")
else: message = format_datetime(datetime.now(), "HH:mm:ss", locale='en')\ + " (" + level + ") > "\ + msg
random_line_split
logger_04.py
# -*- coding: utf8 -*- import logging from logging.handlers import RotatingFileHandler from babel.dates import format_datetime, datetime from time import sleep from traceback import print_exception, format_exception class LogFile(logging.Logger): '''rotatively logs erverything ''' def
(self): self.setLevel(logging.DEBUG) self.handler = RotatingFileHandler( 'app.log', # maxBytes=2000, # approximatively 100 line (81) maxBytes=6000, backupCount=3 # number of log backup files ) self.addHandler(self.handler) def p_log(...
initself
identifier_name
evec-slice.rs
// run-pass #![allow(unused_assignments)] pub fn main() { let x : &[isize] = &[1,2,3,4,5]; let mut z : &[isize] = &[1,2,3,4,5]; z = x; assert_eq!(z[0], 1);
assert_eq!(z[4], 5); let a : &[isize] = &[1,1,1,1,1]; let b : &[isize] = &[2,2,2,2,2]; let c : &[isize] = &[2,2,2,2,3]; let cc : &[isize] = &[2,2,2,2,2,2]; println!("{:?}", a); assert!(a < b); assert!(a <= b); assert!(a != b); assert!(b >= a); assert!(b > a); println!...
random_line_split
evec-slice.rs
// run-pass #![allow(unused_assignments)] pub fn main()
{ let x : &[isize] = &[1,2,3,4,5]; let mut z : &[isize] = &[1,2,3,4,5]; z = x; assert_eq!(z[0], 1); assert_eq!(z[4], 5); let a : &[isize] = &[1,1,1,1,1]; let b : &[isize] = &[2,2,2,2,2]; let c : &[isize] = &[2,2,2,2,3]; let cc : &[isize] = &[2,2,2,2,2,2]; println!("{:?}", a); ...
identifier_body
evec-slice.rs
// run-pass #![allow(unused_assignments)] pub fn
() { let x : &[isize] = &[1,2,3,4,5]; let mut z : &[isize] = &[1,2,3,4,5]; z = x; assert_eq!(z[0], 1); assert_eq!(z[4], 5); let a : &[isize] = &[1,1,1,1,1]; let b : &[isize] = &[2,2,2,2,2]; let c : &[isize] = &[2,2,2,2,3]; let cc : &[isize] = &[2,2,2,2,2,2]; println!("{:?}", a)...
main
identifier_name
basicscroll.js
var url = document.URL; var array = url.split("/"); var base = array[3]; if (array[2] == 'localhost') { var staticurl = '/' + base + '/client/dashboard/reporting'; //var url_action = array[6].split("?")[0]; } else { var staticurl = '/client/dashboard/reporting'; // var url_action = array[5].split("?")[0]; } ...
else { $('.permission_check').prop('checked', false); $('.permission_check').css("pointer-events", "auto"); } }); $('#select_all_0').click(function(){ var select = $("#select_all_0").is(":checked"); if(select) { $('#select_all_0').removeClass('permission_check'); $('.per...
$('.permission_check').prop('checked', true); $('.permission_check').css("pointer-events", "none"); }
conditional_block
basicscroll.js
var url = document.URL; var array = url.split("/"); var base = array[3]; if (array[2] == 'localhost') { var staticurl = '/' + base + '/client/dashboard/reporting'; //var url_action = array[6].split("?")[0]; } else { var staticurl = '/client/dashboard/reporting'; // var url_action = array[5].split("?")[0]; } ...
$('.permission_check').prop('checked', true); $('.permission_check').css("pointer-events", "none"); } else { $('.permission_check').prop('checked', false); $('.permission_check').css("pointer-events", "auto"); } }); $('#select_all_0').click(function(){ var select = $("#sele...
var select = $("#selectall").is(":checked"); if(select) {
random_line_split
real.py
# Copyright (c) 2008 testtools developers. See LICENSE for details. """Test results and related things.""" __metaclass__ = type __all__ = [ 'ExtendedToOriginalDecorator', 'MultiTestResult', 'TestResult', 'ThreadsafeForwardingResult', ] import datetime import sys import unittest from testtools.co...
def _dispatch(self, message, *args, **kwargs): return tuple( getattr(result, message)(*args, **kwargs) for result in self._results) def startTest(self, test): return self._dispatch('startTest', test) def stopTest(self, test): return self._dispatch('stopTes...
return '<%s (%s)>' % ( self.__class__.__name__, ', '.join(map(repr, self._results)))
identifier_body
real.py
# Copyright (c) 2008 testtools developers. See LICENSE for details. """Test results and related things.""" __metaclass__ = type __all__ = [ 'ExtendedToOriginalDecorator', 'MultiTestResult', 'TestResult', 'ThreadsafeForwardingResult', ] import datetime import sys import unittest from testtools.co...
(unittest.TestResult): """Subclass of unittest.TestResult extending the protocol for flexability. This test result supports an experimental protocol for providing additional data to in test outcomes. All the outcome methods take an optional dict 'details'. If supplied any other detail parameters like '...
TestResult
identifier_name
real.py
# Copyright (c) 2008 testtools developers. See LICENSE for details. """Test results and related things.""" __metaclass__ = type __all__ = [ 'ExtendedToOriginalDecorator', 'MultiTestResult', 'TestResult', 'ThreadsafeForwardingResult', ] import datetime import sys import unittest from testtools.co...
test, reason, details=details) def addSuccess(self, test, details=None): self._add_result_with_semaphore(self.result.addSuccess, test, details=details) def addUnexpectedSuccess(self, test, details=None): self._add_result_with_semaphore(self.result.addUnexpectedSuccess, ...
def addSkip(self, test, reason=None, details=None): self._add_result_with_semaphore(self.result.addSkip,
random_line_split
real.py
# Copyright (c) 2008 testtools developers. See LICENSE for details. """Test results and related things.""" __metaclass__ = type __all__ = [ 'ExtendedToOriginalDecorator', 'MultiTestResult', 'TestResult', 'ThreadsafeForwardingResult', ] import datetime import sys import unittest from testtools.co...
return method(new_tags, gone_tags) def time(self, a_datetime): method = getattr(self.decorated, 'time', None) if method is None: return return method(a_datetime) def wasSuccessful(self): return self.decorated.wasSuccessful() class _StringException(Excepti...
return
conditional_block
driver.rs
use util::errors::{ Result, Error, }; use term::terminfo::TermInfo; use term::terminfo::parm; use term::terminfo::parm::{ Param, Variables, }; // String constants correspond to terminfo capnames and are used internally for name resolution. const ENTER_CA: &'static str = "smcup"; const EXIT_CA: &'stati...
Cap::SetCursor(x, y) => { let params = &[Param::Number(y as i16), Param::Number(x as i16)]; let mut vars = Variables::new(); parm::expand(cap, params, &mut vars).unwrap() }, _ => { cap.clone() }, } ...
let params = &[Param::Number(attr as i16)]; let mut vars = Variables::new(); parm::expand(cap, params, &mut vars).unwrap() },
random_line_split
driver.rs
use util::errors::{ Result, Error, }; use term::terminfo::TermInfo; use term::terminfo::parm; use term::terminfo::parm::{ Param, Variables, }; // String constants correspond to terminfo capnames and are used internally for name resolution. const ENTER_CA: &'static str = "smcup"; const EXIT_CA: &'stati...
(&self) -> &'static str { match *self { Cap::EnterCa => ENTER_CA, Cap::ExitCa => EXIT_CA, Cap::ShowCursor => SHOW_CURSOR, Cap::HideCursor => HIDE_CURSOR, Cap::SetCursor(..) => SET_CURSOR, Cap::Clear => CLEAR, Cap::Reset => RESET...
resolve
identifier_name
models.py
from django.db import models class ProductionDatasetsExec(models.Model): name = models.CharField(max_length=200, db_column='NAME', primary_key=True) taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='TASK_ID', null=False, default=0) status = models.CharField(max_length=12, db_column='...
task_name = models.CharField(max_length=130, db_column='TASKNAME') status = models.CharField(max_length=12, db_column='STATUS') class Meta: app_label = "grisli" managed = False db_table = 'T_TASK_REQUEST' class TRequest(models.Model): request = models.CharField(max_length=200,...
taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='REQID', primary_key=True) total_events = models.DecimalField(decimal_places=0, max_digits=10, db_column='TOTAL_EVENTS')
random_line_split
models.py
from django.db import models class ProductionDatasetsExec(models.Model): name = models.CharField(max_length=200, db_column='NAME', primary_key=True) taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='TASK_ID', null=False, default=0) status = models.CharField(max_length=12, db_column='...
class TaskProdSys1(models.Model): taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='REQID', primary_key=True) total_events = models.DecimalField(decimal_places=0, max_digits=10, db_column='TOTAL_EVENTS') task_name = models.CharField(max_length=130, db_column='TASKNAME') status ...
app_label = "grisli" managed = False db_table = 'T_PRODUCTIONDATASETS_EXEC'
identifier_body
models.py
from django.db import models class ProductionDatasetsExec(models.Model): name = models.CharField(max_length=200, db_column='NAME', primary_key=True) taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='TASK_ID', null=False, default=0) status = models.CharField(max_length=12, db_column='...
: app_label = "grisli" managed = False db_table = 'T_TASK_REQUEST' class TRequest(models.Model): request = models.CharField(max_length=200, db_column='REQUEST', null=True)
Meta
identifier_name
font.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 app_units::Au; use euclid::{Point2D, Rect, Size2D}; use font_context::{FontContext, FontSource}; use font_temp...
if character == ' ' { // https://drafts.csswg.org/css-text-3/#word-spacing-property let (length, percent) = options.word_spacing; advance = (advance + length) + Au((advance.0 as f32 * percent.into_inner()) as i32); } if let Some(letter_...
let mut advance = Au::from_f64_px(self.glyph_h_advance(glyph_id));
random_line_split
font.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 app_units::Au; use euclid::{Point2D, Rect, Size2D}; use font_context::{FontContext, FontSource}; use font_temp...
{ descriptor: FontDescriptor, families: SmallVec<[FontGroupFamily; 8]>, last_matching_fallback: Option<FontRef>, } impl FontGroup { pub fn new(style: &FontStyleStruct) -> FontGroup { let descriptor = FontDescriptor::from(style); let families = style.font_family.0.iter() ...
FontGroup
identifier_name
bot.js
/** * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ ( function( bender ) { 'use strict'; bender.editorBot = function( tc, editor ) { this.testCase = tc; this.editor = editor; }; ben...
); // Test if output data are equal to input or given expectedData. assert.areSame( expectedData || input, bender.tools.compatHtml( that.getData(), 0, 1 ), 'Editor\'s data' ); } ); } ); wait(); } }; } )( bender );
// Test html after data->html conversion. assert[ typeof expectedHtml == 'string' ? 'areSame' : 'isMatching' ]( expectedHtml, bender.tools.compatHtml( that.editor.getSnapshot(), 0, 1 ), 'Editor\'s html'
random_line_split
bot.js
/** * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ ( function( bender ) { 'use strict'; bender.editorBot = function( tc, editor ) { this.testCase = tc; this.editor = editor; }; ben...
bender.editorBot.prototype = { dialog: function( dialogName, callback ) { var tc = this.testCase, editor = this.editor; editor.on( 'dialogShow', function( event ) { var dialog = event.data; event.removeListener(); setTimeout( function() { tc.resume( function() { callback.call( ...
{ return function( name, callback ) { var editor = this.editor, btn = editor.ui.get( name ), tc = this.testCase, btnEl, leftMouseButton = CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT; editor.once( 'panelShow', function() { // Make sure resume comes after wai...
identifier_body
bot.js
/** * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ ( function( bender ) { 'use strict'; bender.editorBot = function( tc, editor ) { this.testCase = tc; this.editor = editor; }; ben...
return org.call( this, name, val ); }; } ); writer.sortAttributes = 1; } // Accept bookmarks created e.g. by tools.setHtmlWithSelection. editor.filter.allow( { span: { match: function( element ) { var id = element.attributes.id; return id && id.match( /^cke_bm_/ ); ...
{ val = val.replace( /&amp;/g, '&' ); }
conditional_block
bot.js
/** * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ ( function( bender ) { 'use strict'; bender.editorBot = function( tc, editor ) { this.testCase = tc; this.editor = editor; }; ben...
( isPanel ) { return function( name, callback ) { var editor = this.editor, btn = editor.ui.get( name ), tc = this.testCase, btnEl, leftMouseButton = CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT; editor.once( 'panelShow', function() { // Make sure resume com...
menuOrPanel
identifier_name
chain.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
{ let mut fail_unless = |cond: bool| if !cond && !fail { failed.push(name.clone()); flushln!("FAIL"); fail = true; true } else {false}; flush!(" - {}...", name); let spec = { let genesis = Genesis::from(blockchain.genesis()); let state = From::from(blockchain.pre_state.clone())...
random_line_split
chain.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
(json_data: &[u8]) -> Vec<String> { json_chain_test(json_data, ChainEra::TransitionTest) } declare_test!{BlockchainTests_TestNetwork_bcSimpleTransitionTest, "BlockchainTests/TestNetwork/bcSimpleTransitionTest"} declare_test!{BlockchainTests_TestNetwork_bcTheDaoTest, "BlockchainTests/TestNetwork/bcTheDaoTest"} de...
do_json_test
identifier_name
chain.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity 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 la...
declare_test!{BlockchainTests_TestNetwork_bcSimpleTransitionTest, "BlockchainTests/TestNetwork/bcSimpleTransitionTest"} declare_test!{BlockchainTests_TestNetwork_bcTheDaoTest, "BlockchainTests/TestNetwork/bcTheDaoTest"} declare_test!{BlockchainTests_TestNetwork_bcEIP150Test, "BlockchainTests/TestNetwork/bcEIP150Te...
{ json_chain_test(json_data, ChainEra::TransitionTest) }
identifier_body
main.rs
extern crate yars_raytracer;
use std::path::Path; use yars_raytracer::vector3d::Vec3; use yars_raytracer::algebra::InnerProductSpace; use yars_raytracer::space_algebra::SO3; use yars_raytracer::ray::Orientable; use yars_raytracer::camera::CameraBuilder; use yars_raytracer::scene::{Scene, Light, AmbientLight}; use yars_raytracer::shade::{Shader, P...
extern crate image; use std::fs::File;
random_line_split
main.rs
extern crate yars_raytracer; extern crate image; use std::fs::File; use std::path::Path; use yars_raytracer::vector3d::Vec3; use yars_raytracer::algebra::InnerProductSpace; use yars_raytracer::space_algebra::SO3; use yars_raytracer::ray::Orientable; use yars_raytracer::camera::CameraBuilder; use yars_raytracer::scene...
() { let WIDTH = 800; let HEIGHT = 600; let OUTPUT = "output.png"; let camera = (SO3::rotation_x(0.47) * CameraBuilder::new(WIDTH, HEIGHT, 45.0) + Vec3(0.0, -2.0, 0.0)) .build(); let mut img = ImageBuffer::new(WIDTH, HEIGHT); // Some test paramters let a_colour =...
main
identifier_name
main.rs
extern crate yars_raytracer; extern crate image; use std::fs::File; use std::path::Path; use yars_raytracer::vector3d::Vec3; use yars_raytracer::algebra::InnerProductSpace; use yars_raytracer::space_algebra::SO3; use yars_raytracer::ray::Orientable; use yars_raytracer::camera::CameraBuilder; use yars_raytracer::scene...
{ let WIDTH = 800; let HEIGHT = 600; let OUTPUT = "output.png"; let camera = (SO3::rotation_x(0.47) * CameraBuilder::new(WIDTH, HEIGHT, 45.0) + Vec3(0.0, -2.0, 0.0)) .build(); let mut img = ImageBuffer::new(WIDTH, HEIGHT); // Some test paramters let a_colour = Rg...
identifier_body
GridWidget.ts
import Geometry = THREE.Geometry; import Mesh = THREE.Mesh; import LineBasicMaterial = THREE.LineBasicMaterial; import Material = THREE.Material; import Vector3 = THREE.Vector3; import Line = THREE.Line; import { ChartWidget } from "../Widget"; import LineSegments = THREE.LineSegments; import { Utils } from "../Utils";...
(xVal: number, scrollXVal: number, scrollYVal: number): Vector3[] { let chart = this.chart; let localXVal = xVal - chart.state.xAxis.range.zeroVal - scrollXVal; let heightVal = chart.viewport.pxToValByYAxis(chart.state.height); return [ new THREE.Vector3(localXVal, heightVal * 2 + scrollYVal, 0 ), new THR...
getVerticalLineSegment
identifier_name
GridWidget.ts
import Geometry = THREE.Geometry; import Mesh = THREE.Mesh; import LineBasicMaterial = THREE.LineBasicMaterial; import Material = THREE.Material; import Vector3 = THREE.Vector3; import Line = THREE.Line; import { ChartWidget } from "../Widget"; import LineSegments = THREE.LineSegments; import { Utils } from "../Utils";...
let gridStep = 0; let gridStepInPixels = 0; let minGridStepInPixels = axisOptions.grid.minSizePx; let axisLengthStr = String(axisLength); let axisLengthPointPosition = axisLengthStr.indexOf('.'); let intPartLength = axisLengthPointPosition !== -1 ? axisLengthPointPosition : axisLengthStr.length; let grid...
random_line_split
GridWidget.ts
import Geometry = THREE.Geometry; import Mesh = THREE.Mesh; import LineBasicMaterial = THREE.LineBasicMaterial; import Material = THREE.Material; import Vector3 = THREE.Vector3; import Line = THREE.Line; import { ChartWidget } from "../Widget"; import LineSegments = THREE.LineSegments; import { Utils } from "../Utils";...
private getHorizontalLineSegment(yVal: number, scrollXVal: number, scrollYVal: number): Vector3[] { var chartState = this.chart; var localYVal = yVal - chartState.state.yAxis.range.zeroVal - scrollYVal; var widthVal = chartState.viewport.pxToValByXAxis(chartState.state.width); return [ new THREE.Vector3(w...
{ if (this.isDestroyed) return; var {yAxis, xAxis, width, height} = this.chart.state; var axisXGrid = GridWidget.getGridParamsForAxis(xAxis, width, xAxis.range.zoom); var axisYGrid = GridWidget.getGridParamsForAxis(yAxis, height, yAxis.range.zoom); var scrollXInSegments = Math.ceil(xAxis.range.scroll / axisXG...
identifier_body
GridWidget.ts
import Geometry = THREE.Geometry; import Mesh = THREE.Mesh; import LineBasicMaterial = THREE.LineBasicMaterial; import Material = THREE.Material; import Vector3 = THREE.Vector3; import Line = THREE.Line; import { ChartWidget } from "../Widget"; import LineSegments = THREE.LineSegments; import { Utils } from "../Utils";...
break; } } if (!gridStepFound) digitPos++ } var gridStart = Math.floor(from / gridStep) * gridStep; var gridEnd = Math.floor(to / gridStep) * gridStep; return { start: gridStart, end: gridEnd, step: gridStep, stepInPx: gridStepInPixels, length: gridEnd - gridStart, segments...
{ gridStep = nextGridStep; gridStepInPixels = nextGridStepInPixels; }
conditional_block
webWorker.ts
// // LESERKRITIKK v2 (aka Reader Critics) // Copyright (C) 2017 DB Medialab/Aller Media AS, Oslo, Norway // https://github.com/dbmedialab/reader-critics/ // // 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 ...
httpServer.listen(httpPort, () => { const p = colors.brightGreen(httpPort); const m = colors.brightCyan(app.env); log(`Reader Critics webservice running on port ${p} in ${m} mode`); return resolve(); }); }); } function initExpress() { routes(expressApp); return Promise.resolve(); // Sync finish } ...
return new Promise((resolve) => {
random_line_split
webWorker.ts
// // LESERKRITIKK v2 (aka Reader Critics) // Copyright (C) 2017 DB Medialab/Aller Media AS, Oslo, Norway // https://github.com/dbmedialab/reader-critics/ // // 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 ...
// Additional startup functions function printAvailableParsers() : Promise <void> { return getAvailableParsers().then(parsers => { log('Available parsers: %s', parsers.join(', ')); }); } // TODO Graceful shutdown
{ routes(expressApp); return Promise.resolve(); // Sync finish }
identifier_body
webWorker.ts
// // LESERKRITIKK v2 (aka Reader Critics) // Copyright (C) 2017 DB Medialab/Aller Media AS, Oslo, Norway // https://github.com/dbmedialab/reader-critics/ // // 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 ...
() { routes(expressApp); return Promise.resolve(); // Sync finish } // Additional startup functions function printAvailableParsers() : Promise <void> { return getAvailableParsers().then(parsers => { log('Available parsers: %s', parsers.join(', ')); }); } // TODO Graceful shutdown
initExpress
identifier_name
lib.rs
//! # Getting started //! //! ```rust,no_run //! extern crate sdl2; //! //! use sdl2::pixels::Color; //! use sdl2::event::Event; //! use sdl2::keyboard::Keycode; //! use std::time::Duration; //! //! pub fn main() { //! let sdl_context = sdl2::init().unwrap(); //! let video_subsystem = sdl_context.video().unwrap...
pub use crate::sdl::*; pub mod clipboard; pub mod cpuinfo; #[macro_use] mod macros; pub mod audio; pub mod controller; pub mod event; pub mod filesystem; pub mod haptic; pub mod hint; pub mod joystick; pub mod keyboard; pub mod log; pub mod messagebox; pub mod mouse; pub mod pixels; pub mod rect; pub mod render; pub m...
#[cfg(feature = "gfx")] extern crate c_vec;
random_line_split
mod.rs
extern crate bip_metainfo; extern crate bip_disk; extern crate bip_util; extern crate bytes; extern crate futures; extern crate tokio_core; extern crate rand; use std::collections::HashMap; use std::io::{self}; use std::path::{Path, PathBuf}; use std::sync::{Mutex, Arc}; use std::cmp; use std::time::Duration; use bip...
impl FileSystem for InMemoryFileSystem { type File = InMemoryFile; fn open_file<P>(&self, path: P) -> io::Result<Self::File> where P: AsRef<Path> + Send + 'static { let file_path = path.as_ref().to_path_buf(); self.run_with_lock(|files| { if !files.contains_key(&file_path)...
random_line_split