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
hawkular.py
# # Copyright 2016-2017 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
(name, value): return metrics.create_metric(metrics.MetricType.Gauge, name, metrics.create_datapoint(float(value))) def _run(address): global _running client = metrics.HawkularMetricsClient(tenant_id="oVirt", host=address) whi...
_get_gauge_metric
identifier_name
hawkular.py
# # Copyright 2016-2017 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
client.put(items) _running = False
break
conditional_block
hawkular.py
# # Copyright 2016-2017 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
def send(report): metrics_list = [_get_gauge_metric(name, value) for name, value in six.iteritems(report)] _queue.append(metrics_list) with _cond: _cond.notify() def _get_gauge_metric(name, value): return metrics.create_metric(metrics.MetricType.Gauge, name, ...
logging.info("Stopping hawkular reporter") with _cond: _queue.clear() _queue.append(_STOP) _cond.notify()
identifier_body
home.component.ts
import { Component, OnInit } from '@angular/core'; import { trigger, style, transition, animate, keyframes, query, stagger } from '@angular/animations'; import { DataService } from '../data.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], ...
() { this._data.goal.subscribe(res => this.goals = res); this.itemCount = this.goals.length; this._data.changeGoal(this.goals); } addItem() { this.goals.push(this.goalText); this.goalText = ''; this.itemCount = this.goals.length; this._data.changeGoal(this.goals); } removeItem(i) {...
ngOnInit
identifier_name
home.component.ts
import { Component, OnInit } from '@angular/core'; import { trigger, style, transition, animate, keyframes, query, stagger } from '@angular/animations'; import { DataService } from '../data.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], ...
ngOnInit() { this._data.goal.subscribe(res => this.goals = res); this.itemCount = this.goals.length; this._data.changeGoal(this.goals); } addItem() { this.goals.push(this.goalText); this.goalText = ''; this.itemCount = this.goals.length; this._data.changeGoal(this.goals); } rem...
{ }
identifier_body
home.component.ts
import { Component, OnInit } from '@angular/core'; import { trigger, style, transition, animate, keyframes, query, stagger } from '@angular/animations'; import { DataService } from '../data.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], ...
goalText: String = 'My first list goal'; goals = []; constructor(private _data: DataService) { } ngOnInit() { this._data.goal.subscribe(res => this.goals = res); this.itemCount = this.goals.length; this._data.changeGoal(this.goals); } addItem() { this.goals.push(this.goalText); this.g...
itemCount: Number; btnText: String = 'Add an item';
random_line_split
edit.sources.service.js
/* Copyright (C) 2017 Omri Abend, The Rachel and Selim Benin School of Computer Science and Engineering, The Hebrew University. */ (function () { 'use strict'; angular.module('zAdmin.pages.edit.sources') .service('editSourcesService', editSourcesService); /** @ngInject */ function editSourcesService(api...
id : "", name : "", text : "", created_by : "", created_at : "", updated_at : "", is_active : true }; } } return service; } })();
}, clearData: function(){ service.Data = {
random_line_split
edit.sources.service.js
/* Copyright (C) 2017 Omri Abend, The Rachel and Selim Benin School of Computer Science and Engineering, The Hebrew University. */ (function () { 'use strict'; angular.module('zAdmin.pages.edit.sources') .service('editSourcesService', editSourcesService); /** @ngInject */ function
(apiService, Core) { /*apiService.sources.getSourceTableData().then(function (res){ angular.copy(res.data.results, service.tableData); });*/ var service = { tableData:[], getEditTableStructure: function(){ return apiService.edit.sources.getEditSourceTableStructure().then(func...
editSourcesService
identifier_name
edit.sources.service.js
/* Copyright (C) 2017 Omri Abend, The Rachel and Selim Benin School of Computer Science and Engineering, The Hebrew University. */ (function () { 'use strict'; angular.module('zAdmin.pages.edit.sources') .service('editSourcesService', editSourcesService); /** @ngInject */ function editSourcesService(ap...
}, initData:function(data){ service.Data = data; }, get:function(key){ return this.Data[key]; }, clearData: function(){ service.Data = { id : "", name : "", text : "", created_by : "", ...
{ /*apiService.sources.getSourceTableData().then(function (res){ angular.copy(res.data.results, service.tableData); });*/ var service = { tableData:[], getEditTableStructure: function(){ return apiService.edit.sources.getEditSourceTableStructure().then(function (res){return r...
identifier_body
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn main() { // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::...
.define("PERF_TIMERS", "OFF") .build(); println!("cargo:rustc-link-search=native={}/build/pir", dst.display()); println!("cargo:rustc-link-lib=static=pir_static"); // Dynamic libraries needed by XPIR println!("cargo:rustc-link-lib=gomp"); p...
// Compile and link XPIR c++ shim let dst = cmake::Config::new("deps/xpir") .define("CMAKE_BUILD_TYPE", "Release") .define("MULTI_THREAD", "OFF")
random_line_split
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn main()
// Compile and link XPIR c++ shim let dst = cmake::Config::new("deps/xpir") .define("CMAKE_BUILD_TYPE", "Release") .define("MULTI_THREAD", "OFF") .define("PERF_TIMERS", "OFF") .build(); print...
{ // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::Build::new() .file("src/pir/cpp/pungPIR.cpp") ...
identifier_body
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn
() { // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::Build::new() .file("src/pir/cpp/pungPIR.cpp") ...
main
identifier_name
tr.ts
/* Turkish locals for flatpickr */ import { CustomLocale } from "types/locale"; import { FlatpickrFn } from "types/instance"; const fp: FlatpickrFn = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : { l10ns: {},
weekdays: { shorthand: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], longhand: [ "Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", ], }, months: { shorthand: [ "Oca", "Şub", "Mar", "Nis", "May", ...
} as FlatpickrFn; export const Turkish: CustomLocale = { firstDayOfWeek: 1,
random_line_split
test_zplsc_c_echogram.py
#!/usr/bin/env python import os from mi.logging import log from mi.dataset.parser.zplsc_c import ZplscCParser from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.driver.zplsc_c.resource import RESOURCE_PATH
MODULE_NAME = 'mi.dataset.parser.zplsc_c' CLASS_NAME = 'ZplscCRecoveredDataParticle' config = { DataSetDriverConfigKeys.PARTICLE_MODULE: MODULE_NAME, DataSetDriverConfigKeys.PARTICLE_CLASS: CLASS_NAME } def create_zplsc_c_parser(file_handle): """ This function creates a zplsc-c parser for recovered da...
__author__ = 'Rene Gelinas'
random_line_split
test_zplsc_c_echogram.py
#!/usr/bin/env python import os from mi.logging import log from mi.dataset.parser.zplsc_c import ZplscCParser from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.driver.zplsc_c.resource import RESOURCE_PATH __author__ = 'Rene Gelinas' MODULE_NAME = 'mi.dataset.parser.zplsc_c' CLASS_NAME = ...
def file_path(filename): log.debug('resource path = %s, file name = %s', RESOURCE_PATH, filename) return os.path.join(RESOURCE_PATH, filename) def rec_exception_callback(exception): """ Call back method to for exceptions @param exception - Exception that occurred """ log.info("Exception...
""" This function creates a zplsc-c parser for recovered data. @param file_handle - File handle of the ZPLSC_C raw data. """ return ZplscCParser(config, file_handle, rec_exception_callback)
identifier_body
test_zplsc_c_echogram.py
#!/usr/bin/env python import os from mi.logging import log from mi.dataset.parser.zplsc_c import ZplscCParser from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.driver.zplsc_c.resource import RESOURCE_PATH __author__ = 'Rene Gelinas' MODULE_NAME = 'mi.dataset.parser.zplsc_c' CLASS_NAME = ...
(exception): """ Call back method to for exceptions @param exception - Exception that occurred """ log.info("Exception occurred: %s", exception.message) def zplsc_c_echogram_test(): with open(file_path('160501.01A')) as in_file: parser = create_zplsc_c_parser(in_file) parser.cr...
rec_exception_callback
identifier_name
test_zplsc_c_echogram.py
#!/usr/bin/env python import os from mi.logging import log from mi.dataset.parser.zplsc_c import ZplscCParser from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.driver.zplsc_c.resource import RESOURCE_PATH __author__ = 'Rene Gelinas' MODULE_NAME = 'mi.dataset.parser.zplsc_c' CLASS_NAME = ...
zplsc_c_echogram_test()
conditional_block
041First Missing Positive.py
# -*- coding: utf-8 -*- # Given an unsorted integer array, find the first missing positive integer. # # For example, # Given [1,2,0] return 3, # and [3,4,-1,1] return 2. # [1,3,4,2,5,8,9,7] # Your algorithm should run in O(n) time and uses constant space. # 根据题目来看, find the first minimum missing positive integer, 所以一定...
> 0 and A[i] - 1 < len(A) and A[i] != A[A[i] - 1]: A[A[i] - 1], A[i] = A[i], A[A[i] - 1] else: i += 1 for i, integer in enumerate(A): if integer != i + 1: return i + 1 return len(A) + 1 print Solution().firstMissingPositive([4,5,8...
if A[i]
identifier_name
041First Missing Positive.py
# -*- coding: utf-8 -*- # Given an unsorted integer array, find the first missing positive integer. # # For example, # Given [1,2,0] return 3, # and [3,4,-1,1] return 2. # [1,3,4,2,5,8,9,7] # Your algorithm should run in O(n) time and uses constant space. # 根据题目来看, find the first minimum missing positive integer, 所以一定...
conditional_block
041First Missing Positive.py
# -*- coding: utf-8 -*- # Given an unsorted integer array, find the first missing positive integer. # # For example, # Given [1,2,0] return 3, # and [3,4,-1,1] return 2. # [1,3,4,2,5,8,9,7] # Your algorithm should run in O(n) time and uses constant space. # 根据题目来看, find the first minimum missing positive integer, 所以一定...
print Solution().firstMissingPositive([4,5,8,9,7])
return len(A) + 1
random_line_split
041First Missing Positive.py
# -*- coding: utf-8 -*- # Given an unsorted integer array, find the first missing positive integer. # # For example, # Given [1,2,0] return 3, # and [3,4,-1,1] return 2. # [1,3,4,2,5,8,9,7] # Your algorithm should run in O(n) time and uses constant space. # 根据题目来看, find the first minimum missing positive integer, 所以一定...
A[A[i] - 1], A[i] = A[i], A[A[i] - 1] else: i += 1 for i, integer in enumerate(A): if integer != i + 1: return i + 1 return len(A) + 1 print Solution().firstMissingPositive([4,5,8,9,7])
identifier_body
memories.js
/*! * memories: A simple in-memory caching module for Node.js * * Copyright(c) 2012 Sven Lito. <me@svenlito.com> * MIT LICENCE * */ "use strict"; var util = require('util'); var cache = {}, now = function() { return (new Date()).getTime(); }; var memories = { put: function(key, value, validFo...
} } else { return null; } }, del: function(key) { delete cache[key]; }, size: function() { var size = 0, key; for (key in cache) { if (cache.hasOwnProperty(key)) { if (memories.get(key) !== null) { size++; } } } return size; } };...
random_line_split
memories.js
/*! * memories: A simple in-memory caching module for Node.js * * Copyright(c) 2012 Sven Lito. <me@svenlito.com> * MIT LICENCE * */ "use strict"; var util = require('util'); var cache = {}, now = function() { return (new Date()).getTime(); }; var memories = { put: function(key, value, validFo...
} else { return null; } }, del: function(key) { delete cache[key]; }, size: function() { var size = 0, key; for (key in cache) { if (cache.hasOwnProperty(key)) { if (memories.get(key) !== null) { size++; } } } return size; } }; modul...
{ return data.value; }
conditional_block
metainfo_movie.py
from __future__ import unicode_literals, division, absolute_import import logging from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from flexget import plugin from flexget.event import event try: # NOTE: Importing other plugins is discouraged! from flexget.components.parsing.par...
:param entry: Entry that's being processed :return: True for successful parse """ if entry.get('movie_guessed'): # Return true if we already parsed this return True parser = plugin.get('parsing', 'metainfo_movie').parse_movie(data=entry['title']) i...
""" Check if entry appears to be a movie, and populate movie info if so. """ schema = {'type': 'boolean'} def on_task_metainfo(self, task, config): # Don't run if we are disabled if config is False: return for entry in task.entries: # If movie parser alr...
identifier_body
metainfo_movie.py
from __future__ import unicode_literals, division, absolute_import import logging from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from flexget import plugin from flexget.event import event try: # NOTE: Importing other plugins is discouraged! from flexget.components.parsing.par...
def register_plugin(): plugin.register(MetainfoMovie, 'metainfo_movie', api_ver=2)
return True return False @event('plugin.register')
random_line_split
metainfo_movie.py
from __future__ import unicode_literals, division, absolute_import import logging from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from flexget import plugin from flexget.event import event try: # NOTE: Importing other plugins is discouraged! from flexget.components.parsing.par...
(object): """ Check if entry appears to be a movie, and populate movie info if so. """ schema = {'type': 'boolean'} def on_task_metainfo(self, task, config): # Don't run if we are disabled if config is False: return for entry in task.entries: # If mo...
MetainfoMovie
identifier_name
metainfo_movie.py
from __future__ import unicode_literals, division, absolute_import import logging from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from flexget import plugin from flexget.event import event try: # NOTE: Importing other plugins is discouraged! from flexget.components.parsing.par...
self.guess_entry(entry) @staticmethod def guess_entry(entry): """ Populates movie_* fields for entries that are successfully parsed. :param entry: Entry that's being processed :return: True for successful parse """ if entry.get('movie_guessed'): ...
continue
conditional_block
trait-bounds-basic.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(_x: Box<Foo+Send>) { } fn c(x: Box<Foo+Sync+Send>) { e(x); } fn d(x: Box<Foo+Send>) { e(x); } fn e(x: Box<Foo>) { e(x); } pub fn main() { }
b
identifier_name
trait-bounds-basic.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn d(x: Box<Foo+Send>) { e(x); } fn e(x: Box<Foo>) { e(x); } pub fn main() { }
}
random_line_split
trait-bounds-basic.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn e(x: Box<Foo>) { e(x); } pub fn main() { }
{ e(x); }
identifier_body
lib.rs
#![crate_name = "xpath"] #![feature(macro_rules)] extern crate document; use std::collections::HashMap; use document::{Any,ToAny}; use document::{Nodeset}; use tokenizer::{XPathTokenizer,XPathTokenDeabbreviator,XPathTokenDisambiguator}; use parser::XPathParser; pub mod axis; pub mod expression; pub mod function; p...
} fn position(&self) -> uint { self.position } fn function_for_name(&self, name: &str) -> Option<& 'a BoxFunc> { self.functions.find(&name.to_string()) } fn value_of(&self, name: &str) -> Option<&XPathValue> { self.variables.find(&name.to_string()) } } pub struct ...
pub fn next<A: ToAny>(& mut self, node: A) { self.node = node.to_any(); self.position += 1;
random_line_split
lib.rs
#![crate_name = "xpath"] #![feature(macro_rules)] extern crate document; use std::collections::HashMap; use document::{Any,ToAny}; use document::{Nodeset}; use tokenizer::{XPathTokenizer,XPathTokenDeabbreviator,XPathTokenDisambiguator}; use parser::XPathParser; pub mod axis; pub mod expression; pub mod function; p...
<A: ToAny>(node: A, functions: &'a Functions, variables: &'a Variables) -> XPathEvaluationContext<'a> { XPathEvaluationContext { node: node.to_any(), functions: functions, variables: variables, position: 0, ...
new
identifier_name
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
self.visible_rect.intersects(&stacking_context.clip_rect) { result_list.push_back((*stacking_context).clone()) } } } }
where I: Iterator<&'a Arc<StackingContext>> { for stacking_context in stacking_contexts { if self.visible_rect.intersects(&stacking_context.bounds) &&
random_line_split
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
/// Adds display items that intersect the visible rect to `result_list`. fn add_in_bounds_display_items<'a,I>(&self, result_list: &mut DList<DisplayItem>, mut display_items: I) where I: I...
{ let mut result = DisplayList::new(); self.add_in_bounds_display_items(&mut result.background_and_borders, display_list.background_and_borders.iter()); self.add_in_bounds_display_items(&mut result.block_backgrounds_and_borders, ...
identifier_body
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
<'a,I>(&self, result_list: &mut DList<Arc<StackingContext>>, mut stacking_contexts: I) where I: Iterator<&'a Arc<StackingContext>> { for stacking_context in stacking_contexts { ...
add_in_bounds_stacking_contexts
identifier_name
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
} } /// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`. fn add_in_bounds_stacking_contexts<'a,I>(&self, result_list: &mut DList<Arc<StackingContext>>, mut stacking_c...
{ result_list.push_back((*display_item).clone()) }
conditional_block
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
() { let a = MainContext::new(); let b = MainContext::new(); assert!(!is_same_context(&a, &b)); a.with_thread_default(|| { let t = MainContext::get_thread_default().unwrap(); assert!(is_same_context(&a, &t)); b.with_thread_default(|| { ...
test_with_thread_default
identifier_name
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
fn test_invoke() { let c = MainContext::new(); let l = ::MainLoop::new(Some(&c), false); let l_clone = l.clone(); thread::spawn(move || { c.invoke(move || l_clone.quit()); }); l.run(); } fn is_same_context(a: &MainContext, b: &MainContext) -> bo...
use std::ptr; use std::thread; #[test]
random_line_split
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
unsafe extern "C" fn destroy_closure<F: FnOnce() + 'static>(ptr: gpointer) { Box::<Option<F>>::from_raw(ptr as *mut _); } let func = Box::into_raw(Box::new(Some(func))); glib_sys::g_main_context_invoke_full( self.to_glib_none().0, priority.to_glib(), ...
{ let func: &mut Option<F> = &mut *(func as *mut Option<F>); let func = func .take() .expect("MainContext::invoke() closure called multiple times"); func(); glib_sys::G_SOURCE_REMOVE }
identifier_body
node_emitter_transform.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 */ import {GeneratedFile} from '@angular/compiler'; import ts from 'typescript'; import {TypeScriptNodeEmitter} from '....
const emitter = new TypeScriptNodeEmitter(annotateForClosureCompiler); return function(sourceFile: ts.SourceFile): ts.SourceFile { const g = generatedFiles.get(sourceFile.fileName); const orig = g && program.getSourceFile(g.srcFileUrl); let originalComment = ''; if (orig) originalComment...
generatedFiles: Map<string, GeneratedFile>, program: ts.Program, annotateForClosureCompiler: boolean): () => (sourceFile: ts.SourceFile) => ts.SourceFile { return function() {
random_line_split
node_emitter_transform.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 */ import {GeneratedFile} from '@angular/compiler'; import ts from 'typescript'; import {TypeScriptNodeEmitter} from '....
{ const trivia = sourceFile.getFullText().substring(0, sourceFile.getStart()); const leadingComments = ts.getLeadingCommentRanges(trivia, 0); if (!leadingComments || leadingComments.length === 0) return ''; const comment = leadingComments[0]; if (comment.kind !== ts.SyntaxKind.MultiLineCommentTrivia) return '...
identifier_body
node_emitter_transform.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 */ import {GeneratedFile} from '@angular/compiler'; import ts from 'typescript'; import {TypeScriptNodeEmitter} from '....
( generatedFiles: Map<string, GeneratedFile>, program: ts.Program, annotateForClosureCompiler: boolean): () => (sourceFile: ts.SourceFile) => ts.SourceFile { return function() { const emitter = new TypeScriptNodeEmitter(annotateForClosureCompiler); return function(sourceFile: ts.SourceFile): ts.Source...
getAngularEmitterTransformFactory
identifier_name
theme.py
# -*- coding: utf-8 -*- """ This file is part of quiedit. quiedit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. quiedit is distributed i...
return d
_d = self.recTheme(d[u'inherits']) for key, val in _d.items(): if key not in d: d[key] = val
conditional_block
theme.py
# -*- coding: utf-8 -*- """ This file is part of quiedit. quiedit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. quiedit is distributed i...
(self, theme): """ Gets the current theme, respecting inheritance. Arguments: theme -- The theme name. Returns: A dictionary with with the theme information. """ if theme not in self.themeDict: print(u'theme.__init__(): %s is not a valid theme' % theme) theme = u'default' d = self.themeDict[...
recTheme
identifier_name
theme.py
# -*- coding: utf-8 -*- """ This file is part of quiedit. quiedit is free software: you can redistribute it and/or modify
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with quiedit. If not, see <http://www.gnu.org/licenses/>. """ from PyQt4 im...
it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. quiedit is distributed in the hope that it will be useful,
random_line_split
theme.py
# -*- coding: utf-8 -*- """ This file is part of quiedit. quiedit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. quiedit is distributed i...
self.editor.command_edit.setFont(self.font()) self.editor.command_label.setFont(self.font()) self.editor.status.setFont(self.font()) self.editor.status.setStyleSheet(u"color: %s;" % self.theme[ \ u"status_color"]) self.editor.central_widget.setMinimumWidth(int(self.theme[ \ u"editor_width"])) self.edi...
"""Applies the theme.""" stylesheet = u""" background: %(editor_background)s; color: %(font_color)s; selection-color: %(editor_background)s; selection-background-color: %(font_color)s; font-family: %(font_family)s; font-size: %(font_size)spt; """ % self.theme self.editor.main_widget.setStyleSh...
identifier_body
e_stop_button_test.tsx
const mockDevice = { emergencyUnlock: jest.fn(() => Promise.resolve()) }; jest.mock("../../../device", () => ({ getDevice: () => mockDevice })); import * as React from "react"; import { mount } from "enzyme"; import { EStopButton } from "../e_stop_btn"; import { bot } from "../../../__test_support__/fake_state/bot"; i...
it("is grayed out when offline", () => { bot.hardware.informational_settings.sync_status = undefined; const wrapper = mount(<EStopButton {...fakeProps()} />); expect(wrapper.text()).toEqual("E-STOP"); expect(wrapper.find("button").hasClass("pseudo-disabled")).toBeTruthy(); }); it("shows locked st...
random_line_split
commander.py
# -*- coding:utf-8 -*- import sys import config ,util ,logging ,log,downloader import xiami as xm import netease import re from threadpool import ThreadPool from time import sleep from os import path from threadpool import Terminate_Watcher from proxypool import ProxyPool LOG = log.get_logger("zxLogger") dl_songs = ...
dl_songs.extend(topsong.songs) msgs = [fmt_parsing % (xiami_url_abbr(url), u'艺人热门歌曲',topsong.artist_name)] if verbose: for s in topsong.songs: msgs.append(fmt_single_song %s.song_name) msg = u'\n |-> '.join(msgs) else: msgs.append( f...
random_line_split
commander.py
# -*- coding:utf-8 -*- import sys import config ,util ,logging ,log,downloader import xiami as xm import netease import re from threadpool import ThreadPool from time import sleep from os import path from threadpool import Terminate_Watcher from proxypool import ProxyPool LOG = log.get_logger("zxLogger") dl_songs = ...
playlist = netease.NeteasePlayList(m163, url) dl_songs.extend(playlist.songs) msgs = [ fmt_parsing % (m163_url_abbr(url),u'歌单',playlist.playlist_name)] if verbose: for s in playlist.songs: msgs.append( fmt_single_song % s.song_name) msg = u'\n |...
essing 163 url: "%s"'% url) msg = u'' if '/song?id=' in url: song =netease.NeteaseSong(m163,url=url) dl_songs.append(song) msg = fmt_parsing % (m163_url_abbr(url),u'曲目', song.song_name) elif '/album?id=' in url: album = netease.NeteaseAlbum(m163, url) dl_songs.exten...
identifier_body
commander.py
# -*- coding:utf-8 -*- import sys import config ,util ,logging ,log,downloader import xiami as xm import netease import re from threadpool import ThreadPool from time import sleep from os import path from threadpool import Terminate_Watcher from proxypool import ProxyPool LOG = log.get_logger("zxLogger") dl_songs = ...
song_nm % len(playlist.songs)) msg= u' => '.join(msgs) elif '/artist?id=' in url: topsong= netease.NeteaseTopSong(m163, url) dl_songs.extend(topsong.songs) msgs = [fmt_parsing % (m163_url_abbr(url), u'艺人热门歌曲',topsong.artist_name)] if verbose: for s in topsong...
else: msgs.append(fmt_has_
conditional_block
commander.py
# -*- coding:utf-8 -*- import sys import config ,util ,logging ,log,downloader import xiami as xm import netease import re from threadpool import ThreadPool from time import sleep from os import path from threadpool import Terminate_Watcher from proxypool import ProxyPool LOG = log.get_logger("zxLogger") dl_songs = ...
sing xiami url: "%s"'% url) msg = u'' if '/collect/' in url: collect = xm.Collection(xm_obj, url) dl_songs.extend(collect.songs) msgs = [ fmt_parsing % (xiami_url_abbr(url),u'精选集',collect.collection_name)] if verbose: for s in collect.songs: msgs.appen...
bug('proces
identifier_name
tools.py
csv': log.info('This is an ASCII file.') iq_data = CSVData(filename) if file_extension.lower() == '.bin': log.info('This is a raw binary file.') iq_data = BINData(filename) if file_extension.lower() == '.wav': log.info('This is a wav file.') iq_data = WAVData(fi...
for elem in xml_tree_root.iter(tag='Count'): count = int(elem.text) for elem in xml_tree_root.iter(tag='XStart'): start = float(elem.text) for elem in xml_tree_root.iter(tag='XStop'): stop = float(elem.text) for elem in xml_tree_root.iter(tag='XUnits'): xunits = elem.text...
with open(filename, 'rb') as f: ba = f.read() xml_tree_root = et.fromstring(ba)
random_line_split
tools.py
': log.info('This is an ASCII file.') iq_data = CSVData(filename) if file_extension.lower() == '.bin': log.info('This is a raw binary file.') iq_data = BINData(filename) if file_extension.lower() == '.wav': log.info('This is a wav file.') iq_data = WAVData(filen...
(f, fs, length=1, nharm=0, noise=False): """Make a sine signal with/without noise.""" t = np.arange(0, length, 1 / fs) x = np.zeros(len(t)) for i in range(nharm + 2): x += np.sin(2 * np.pi * i * f * t) if noise: x += np.random.normal(0, 1, len(t)) return t, x def shift_phase(...
make_test_signal
identifier_name
tools.py
raw binary file.') iq_data = BINData(filename) if file_extension.lower() == '.wav': log.info('This is a wav file.') iq_data = WAVData(filename) if file_extension.lower() == '.iqt': log.info('This is an iqt file.') iq_data = IQTData(filename) if file_extension.lowe...
""" Parses filenames of experimental data in the following format: 58Ni26+_374MeVu_250uA_pos_0_0.tiq :param filename: :return: """ filename = filename.split('_') descr = filename[0] energy = float(filename[1].replace('MeVu', 'e6')) current = float(filename[2].replace('uA', 'e-6')) ...
identifier_body
tools.py
': log.info('This is an ASCII file.') iq_data = CSVData(filename) if file_extension.lower() == '.bin': log.info('This is a raw binary file.') iq_data = BINData(filename) if file_extension.lower() == '.wav': log.info('This is a wav file.') iq_data = WAVData(filen...
return h def make_test_signal(f, fs, length=1, nharm=0, noise=False): """Make a sine signal with/without noise.""" t = np.arange(0, length, 1 / fs) x = np.zeros(len(t)) for i in range(nharm + 2): x += np.sin(2 * np.pi * i * f * t) if noise: x += np.random.normal(0, 1, len(t)...
h.SetBinContent(i, j, zz[j, i])
conditional_block
min-max.test.js
t.equal(doc.out(), '', 'match was too short') doc = nlp('hello1 one two three four five hello2').match('#Value{3}') t.equal(doc.out(), 'one two three', 'exactly three') doc = nlp('hello1 one two three four five hello2').match('#Value{3,3}') t.equal(doc.out(), 'one two three', 'still exactly three') doc =...
const test = require('tape') const nlp = require('../_lib') test('match min-max', function(t) { let doc = nlp('hello1 one hello2').match('#Value{7,9}')
random_line_split
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
(&self, dst: MVal, op1: MVal, op2: MVal, addr: Option<MAddr>) -> MInst { MInst::new(*self, dst, op1, op2, addr) } pub fn is_binary(&self) -> bool { self.arity() == MArity::Binary } pub fn is_unary(&self) -> bool { self.arity() == MArity::Unary } pub fn arity(&self) -> MArity { self.info().1 } pub fn...
to_inst
identifier_name
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
pub fn esilold() -> MVal { MVal::new("".to_string(), 64, MValType::EsilOld, 0, None) } pub fn esillastsz() -> MVal { MVal::new("".to_string(), 64, MValType::Lastsz, 0, None) } } impl MInst { pub fn new(opcode: MOpcode, dst: MVal, op1: MVal, op2: MVal, _addr: Option<MAddr>) -> MInst { let addr = _addr.unw...
{ MVal::new("".to_string(), 64, MValType::EsilCur, 0, None) }
identifier_body
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
pub enum MValType { Register, Temporary, Internal, EsilCur, EsilOld, Lastsz, Unknown, Null, } #[derive(Debug, Copy, Clone, PartialEq)] pub enum MOpcode { OpAdd, OpSub, OpMul, OpDiv, OpMod, OpAnd, OpOr, OpXor, OpNot, OpEq, OpCmp, OpGt, OpLt, OpLteq, OpGteq, OpLsl, OpLsr, OpIf, OpJmp, OpCJmp,...
Binary, Ternary, // Unused for now. Maybe remove later? } #[derive(Debug, Copy, Clone, PartialEq)]
random_line_split
nest-fastify-application.interface.ts
import { INestApplication } from '@nestjs/common'; import { FastifyInstance, FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifyRegisterOptions, } from 'fastify'; import { Chain as LightMyRequestChain, InjectOptions, Response as LightMyRequestResponse, } from 'light-my-request'; imp...
* * Don't pass in a string. The string type in the argument is for compatibilility reason and will cause an exception. * @returns {this} */ setViewEngine(options: PointOfViewOptions | string): this; /** * A wrapper function around native `fastify.inject()` method. * @returns {void} */ inject...
*/ useStaticAssets(options: FastifyStaticOptions): this; /** * Sets a view engine for templates (views), for example: `pug`, `handlebars`, or `ejs`.
random_line_split
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct B<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self) {} } impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> { // oh dear!
Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type...
random_line_split
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct B<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self)
} impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> { // oh dear! Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not l...
{}
identifier_body
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct
<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self) {} } impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> { // oh dear! Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live lo...
B
identifier_name
send_str_hashmap.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); ...
main
identifier_name
send_str_hashmap.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_s...
random_line_split
send_str_hashmap.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
assert!(map.insert("bcd".to_string().into_cow(), b).is_none()); assert!(map.insert("cde".into_cow(), c).is_none()); assert!(map.insert("def".to_string().into_cow(), d).is_none()); assert!(map.insert("abc".into_cow(), a).is_some()); assert!(map.insert("bcd".to_string().into_cow(), b).is_some()); ...
{ let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); as...
identifier_body
SystemIcon.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
children={icon.content} {...props.fontIconProps} style={{ ...icon.style, ...style, ...props.fontIconProps?.style }} /> ); } } export default SystemIcon;
{ let { icon, className, style } = props; if ('id' in icon) { const IconComponent = components.get(icon.id) as typeof ErrorRounded; const iconStyle = { ...icon.style, ...style, ...props.svgIconProps?.style }; const iconClassName = clsx(icon.class, className, props.svgIconProps?.className); return I...
identifier_body
SystemIcon.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
style={{ ...icon.style, ...style, ...props.fontIconProps?.style }} /> ); } } export default SystemIcon;
{ const IconComponent = components.get(icon.id) as typeof ErrorRounded; const iconStyle = { ...icon.style, ...style, ...props.svgIconProps?.style }; const iconClassName = clsx(icon.class, className, props.svgIconProps?.className); return IconComponent ? ( <Suspense fallback={<Skeleton variant="re...
conditional_block
SystemIcon.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope tha...
(props: SystemIconProps) { let { icon, className, style } = props; if ('id' in icon) { const IconComponent = components.get(icon.id) as typeof ErrorRounded; const iconStyle = { ...icon.style, ...style, ...props.svgIconProps?.style }; const iconClassName = clsx(icon.class, className, props.svgIconProps?....
SystemIcon
identifier_name
SystemIcon.tsx
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. *
* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty ...
random_line_split
inner-static.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // aux-build:inn...
// http://rust-lang.org/COPYRIGHT.
random_line_split
inner-static.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...
() { let a = inner_static::A::<()> { v: () }; let b = inner_static::B::<()> { v: () }; let c = inner_static::test::A::<()> { v: () }; assert_eq!(a.bar(), 2); assert_eq!(b.bar(), 4); assert_eq!(c.bar(), 6); }
main
identifier_name
inner-static.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...
{ let a = inner_static::A::<()> { v: () }; let b = inner_static::B::<()> { v: () }; let c = inner_static::test::A::<()> { v: () }; assert_eq!(a.bar(), 2); assert_eq!(b.bar(), 4); assert_eq!(c.bar(), 6); }
identifier_body
grpc_debug_server.py
state_change.state = new_state state_change.node_name = node_name state_change.output_slot = output_slot state_change.debug_op = debug_op return event_reply class EventListenerBaseStreamHandler(object): """Per-stream handler of EventListener gRPC streams.""" def __init__(self): """Constructor of Eve...
self._breakpoints.discard( (state_change.node_name, state_change.output_slot, state_change.debug_op)) yield event_reply def _process_tensor_event_in_chunks(self, event, tensor_chunks): """Possibly reassemble event chunks. Due to gRPC's message size limit, a large...
state_change.debug_op)
random_line_split
grpc_debug_server.py
(new_state, node_name, output_slot, debug_op): """Make `EventReply` proto to represent a request to watch/unwatch a debug op. Args: new_state: (`debug_service_pb2.EventReply.DebugOpStateChange.State`) the new state to set the debug node to, i.e., whether the debug node will become disabled under th...
_watch_key_event_reply
identifier_name
grpc_debug_server.py
state_change.state = new_state state_change.node_name = node_name state_change.output_slot = output_slot state_change.debug_op = debug_op return event_reply class EventListenerBaseStreamHandler(object): """Per-stream handler of EventListener gRPC streams.""" def __init__(self): """Constructor of Eve...
def _process_tensor_event_in_chunks(self, event, tensor_chunks): """Possibly reassemble event chunks. Due to gRPC's message size limit, a large tensor can be encapsulated in multiple Event proto chunks to be sent through the debugger stream. This method keeps track of the chunks that have arrived, ...
event_reply = self._event_reply_queue.get() for state_change in event_reply.debug_op_state_changes: if (state_change.state == debug_service_pb2.EventReply.DebugOpStateChange.READ_WRITE): logging.info("Adding breakpoint %s:%d:%s", state_change.node_name, state_c...
conditional_block
grpc_debug_server.py
state_change.state = new_state state_change.node_name = node_name state_change.output_slot = output_slot state_change.debug_op = debug_op return event_reply class EventListenerBaseStreamHandler(object): """Per-stream handler of EventListener gRPC streams.""" def __init__(self): """Constructor of Eve...
def run
for node_def in graph_def.node: if (debug_data.is_debug_node(node_def.name) and node_def.attr["gated_grpc"].b): node_name, output_slot, _, debug_op = ( debug_data.parse_debug_node_name(node_def.name)) self._gated_grpc_debug_watches.add( DebugWatch(node_name, outpu...
identifier_body
DeveloperMenu.ios.js
import React from 'react'; import * as snapshot from '../utils/snapshot'; import { TouchableOpacity, ActionSheetIOS, StyleSheet } from 'react-native'; /** * Simple developer menu, which allows e.g. to clear the app state. * It can be accessed through a tiny button in the bottom right corner of the screen. * ...
V__) { return null; } return ( <TouchableOpacity style={styles.circle} onPress={this.showDeveloperMenu} /> ); } }); const styles = StyleSheet.create({ circle: { position: 'absolute', bottom: 5, right: 5, width: 10, height: 10, borderRadius: 5...
(!__DE
identifier_name
DeveloperMenu.ios.js
import React from 'react'; import * as snapshot from '../utils/snapshot'; import { TouchableOpacity, ActionSheetIOS, StyleSheet } from 'react-native'; /** * Simple developer menu, which allows e.g. to clear the app state. * It can be accessed through a tiny button in the bottom right corner of the screen. * ...
nSheetIOS.showActionSheetWithOptions({ options: [ 'Clear state', 'Cancel' ], cancelButtonIndex: options.cancel }, callback); }, render() { if (!__DEV__) { return null; } return ( <TouchableOpacity style={styles.circle} onPress={this.sho...
{ await snapshot.clearSnapshot(); console.warn('(╯°□°)╯︵ ┻━┻ \nState cleared, Cmd+R to reload the application now'); } }; Actio
conditional_block
DeveloperMenu.ios.js
import React from 'react'; import * as snapshot from '../utils/snapshot'; import { TouchableOpacity, ActionSheetIOS, StyleSheet } from 'react-native'; /** * Simple developer menu, which allows e.g. to clear the app state. * It can be accessed through a tiny button in the bottom right corner of the screen. * ...
}, callback); }, render() { if (!__DEV__) { return null; } return ( <TouchableOpacity style={styles.circle} onPress={this.showDeveloperMenu} /> ); } }); const styles = StyleSheet.create({ circle: { position: 'absolute', bottom: 5, right: 5, ...
'Clear state', 'Cancel' ], cancelButtonIndex: options.cancel
random_line_split
DeveloperMenu.ios.js
import React from 'react'; import * as snapshot from '../utils/snapshot'; import { TouchableOpacity, ActionSheetIOS, StyleSheet } from 'react-native'; /** * Simple developer menu, which allows e.g. to clear the app state. * It can be accessed through a tiny button in the bottom right corner of the screen. * ...
}, callback); }, render() { if (!__DEV__) { return null; } return ( <TouchableOpacity style={styles.circle} onPress={this.showDeveloperMenu} /> ); } }); const styles = StyleSheet.create({ circle: { position: 'absolute', bottom: 5, right: 5,...
{ const options = { clearState: 0, showLogin: 1, cancel: 2 }; const callback = async index => { if (index === options.clearState) { await snapshot.clearSnapshot(); console.warn('(╯°□°)╯︵ ┻━┻ \nState cleared, Cmd+R to reload the application now'); } }; ...
identifier_body
lib.rs
nbits: usize } impl Index<usize> for BitVec { type Output = bool; #[inline] fn index(&self, i: usize) -> &bool { if self.get(i).expect("index out of bounds") { &TRUE } else { &FALSE } } } impl BitVec { /// An operation might screw up the unused ...
storage: Vec<u64>, /// The number of valid bits in the internal representation
random_line_split
lib.rs
`BitVec`. As per (3), it's assumed to be all 0s. This method fixes it up. fn fix_last_block(&mut self) { let extra_bits = self.len() % BITS; if extra_bits > 0 { let mask = (1 << extra_bits) - 1; let storage_len = self.storage.len(); self.storage[storage_len - 1] ...
(&self) -> bool { self.len() == 0 } /// Clears all bits in this vector. #[inline] pub fn clear(&mut self) { for w in &mut self.storage { *w = 0; } } } impl Default for BitVec { #[inline] fn default() -> BitVec { BitVec::new() } } impl Clone for BitVec { #[inline] fn clone(&self...
is_empty
identifier_name
lib.rs
`BitVec`. As per (3), it's assumed to be all 0s. This method fixes it up. fn fix_last_block(&mut self) { let extra_bits = self.len() % BITS; if extra_bits > 0 { let mask = (1 << extra_bits) - 1; let storage_len = self.storage.len(); self.storage[storage_len - 1] ...
; *ptr = val; } /// Sets all bits to 1. /// /// # Examples /// /// ```ignore /// use std::collections::BitVec; /// /// let before = 0b01100000; /// let after = 0b11111111; /// /// let mut bv = BitVec::from_bytes(&[before]); /// bv.set_all(); /// assert_e...
{ *ptr & !flag }
conditional_block
lib.rs
`BitVec`. As per (3), it's assumed to be all 0s. This method fixes it up. fn fix_last_block(&mut self) { let extra_bits = self.len() % BITS; if extra_bits > 0 { let mask = (1 << extra_bits) - 1; let storage_len = self.storage.len(); self.storage[storage_len - 1] ...
#[inline] pub fn as_bytes_mut(&mut self) -> &mut [u8] { unsafe { std::slice::from_raw_parts_mut(self.storage.as_mut_ptr() as *mut _, (self.nbits + 7) / 8) } } #[inline] pub fn as_bytes(&self) -> &[u8] { unsafe { ...
{ assert!(bits <= data.len() * 64); let mut ret = BitVec { storage: data, nbits: bits }; ret.fix_last_block(); ret }
identifier_body
inherited_table.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
${helpers.single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS", animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells")} ${helpers.single_keyword("caption-side", "top...
gecko_constant_prefix="NS_STYLE_BORDER", animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse")}
random_line_split
inherited_table.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
{ pub horizontal: Au, pub vertical: Au, } /// https://drafts.csswg.org/css-transitions/#animtype-simple-list impl Animatable for T { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result<Self, ()> { Ok(T { ...
T
identifier_name
inherited_table.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
impl ToCss for SpecifiedValue { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write, { try!(self.horizontal.to_css(dest)); if let Some(vertical) = self.vertical.as_ref() { try!(dest.write_str(" ")); vertical.to_cs...
{ computed_value::T { horizontal: Au(0), vertical: Au(0), } }
identifier_body
main.rs
// Works under Rust 1.14.0 :) extern crate rand; use std::io::prelude::*; use std::io; use rand::{thread_rng, Rng}; const MAX_ATTEMPTS:i16 = 5; fn play(guess:u8, target:u8, remaining_guesses:i16) -> bool
fn main() { println!(" Yo! Welcome to Guess the Number with Rust! Rust will, like, pick a number between 1 and 100 and, like, you've gotta guess it or whatever. Oh. And you only get 5 guesses. Bonne chance! "); let mut rng = thread_rng(); let _number = rng.gen_range::<u8>(1, 100); let mut _attempt = 1; // O...
{ if guess == target { // We won! println!("Noice! You gone done did good, kid."); return true; } else { if guess < target { // Go lower println!("Hmm too low, bro."); } else if guess > target { // Go higher println!("Yo too high, guy."); } println!("You have {0} guesses left. ", remaining_g...
identifier_body
main.rs
// Works under Rust 1.14.0 :) extern crate rand; use std::io::prelude::*; use std::io; use rand::{thread_rng, Rng}; const MAX_ATTEMPTS:i16 = 5; fn
(guess:u8, target:u8, remaining_guesses:i16) -> bool { if guess == target { // We won! println!("Noice! You gone done did good, kid."); return true; } else { if guess < target { // Go lower println!("Hmm too low, bro."); } else if guess > target { // Go higher println!("Yo too high, guy."); } ...
play
identifier_name
main.rs
// Works under Rust 1.14.0 :) extern crate rand; use std::io::prelude::*; use std::io; use rand::{thread_rng, Rng}; const MAX_ATTEMPTS:i16 = 5; fn play(guess:u8, target:u8, remaining_guesses:i16) -> bool { if guess == target { // We won! println!("Noice! You gone done did good, kid."); return true; } else { ...
// Get input: let mut input_text = String::new(); print!("Take a guess: "); io::stdout().flush().ok(); //.expect("Could not flush stdout"); io::stdin().read_line(&mut input_text).unwrap(); match input_text.trim().parse::<u8>().ok() { Some(i) => if play(i, _number, position) { break; } el...
{ println!("Ouf. Sorry but you're all out of guesses. You lose =("); println!("The number you were looking for is {}", _number); break; }
conditional_block
main.rs
// Works under Rust 1.14.0 :) extern crate rand; use std::io::prelude::*; use std::io; use rand::{thread_rng, Rng}; const MAX_ATTEMPTS:i16 = 5; fn play(guess:u8, target:u8, remaining_guesses:i16) -> bool { if guess == target { // We won! println!("Noice! You gone done did good, kid."); return true; } else { ...
println!("Yo too high, guy."); } println!("You have {0} guesses left. ", remaining_guesses); return false; } } fn main() { println!(" Yo! Welcome to Guess the Number with Rust! Rust will, like, pick a number between 1 and 100 and, like, you've gotta guess it or whatever. Oh. And you only get 5 guesses. B...
random_line_split
Motion.py
__author__ = 'andrucuna' # Ball motion with an explicit timer import simplegui # Initialize globals WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 init_pos = [WIDTH / 2, HEIGHT / 2] vel = [0, 3] # pixels per tick time = 0 # define event handlers def tick(): global time time = time + 1 def
(canvas): # create a list to hold ball position ball_pos = [0, 0] # calculate ball position ball_pos[0] = init_pos[0] + time * vel[0] ball_pos[1] = init_pos[1] + time * vel[1] # draw ball canvas.draw_circle(ball_pos, BALL_RADIUS, 2, "Red", "White") # create frame frame = simplegui.create_...
draw
identifier_name
Motion.py
__author__ = 'andrucuna' # Ball motion with an explicit timer import simplegui # Initialize globals WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 init_pos = [WIDTH / 2, HEIGHT / 2] vel = [0, 3] # pixels per tick time = 0 # define event handlers def tick(): global time time = time + 1 def draw(canvas): # ...
# create frame frame = simplegui.create_frame("Motion", WIDTH, HEIGHT) # register event handlers frame.set_draw_handler(draw) timer = simplegui.create_timer(100, tick) # start frame frame.start() timer.start()
ball_pos = [0, 0] # calculate ball position ball_pos[0] = init_pos[0] + time * vel[0] ball_pos[1] = init_pos[1] + time * vel[1] # draw ball canvas.draw_circle(ball_pos, BALL_RADIUS, 2, "Red", "White")
identifier_body
Motion.py
__author__ = 'andrucuna' # Ball motion with an explicit timer import simplegui # Initialize globals WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 init_pos = [WIDTH / 2, HEIGHT / 2] vel = [0, 3] # pixels per tick time = 0 # define event handlers def tick(): global time time = time + 1 def draw(canvas): # ...
canvas.draw_circle(ball_pos, BALL_RADIUS, 2, "Red", "White") # create frame frame = simplegui.create_frame("Motion", WIDTH, HEIGHT) # register event handlers frame.set_draw_handler(draw) timer = simplegui.create_timer(100, tick) # start frame frame.start() timer.start()
random_line_split
0007_auto_20170515_1241.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-15 04:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ ('asserts', '0006_auto_20170515_1227'), ] operations = [ migrations.CreateModel( name='AssertCategory', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')...
Migration
identifier_name
0007_auto_20170515_1241.py
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('asserts', '0006_auto_20170515_1227'), ] operations = [ migrations.CreateModel( name='AssertCategory', ...
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-15 04:41
random_line_split
0007_auto_20170515_1241.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-15 04:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
dependencies = [ ('asserts', '0006_auto_20170515_1227'), ] operations = [ migrations.CreateModel( name='AssertCategory', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', m...
identifier_body
view.py
# -*- coding: utf-8 -*- __author__ = 'itconsense@gmail.com' from collections import OrderedDict from math import pi from Products.Five import BrowserView from plone import api import base64 import logging import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import six LOG = logging.getLogger('eva...
# Plot data ax.plot(angles, values, linewidth=1, linestyle='solid') # Fill area ax.fill(angles, values, 'b', alpha=0.1) fig.savefig('test.png') img = six.BytesIO() fig.savefig(img, format='png') img.seek(0) return base64.b64encode(img.read())
random_line_split
view.py
# -*- coding: utf-8 -*- __author__ = 'itconsense@gmail.com' from collections import OrderedDict from math import pi from Products.Five import BrowserView from plone import api import base64 import logging import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import six LOG = logging.getLogger('eva...
(BrowserView): def __call__(self): portal_setup = api.portal.get_tool(name='portal_setup') portal_setup.runImportStepFromProfile( 'profile-plonetheme.sunburst:default', 'cssregistry', run_dependencies=False) portal_skins = api.portal.get_tool(name='portal_skins') custom ...
UpgradeIt
identifier_name