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
file_info.rs
extern crate libc; use std::mem; use crate::libproc::helpers; use crate::libproc::proc_pid::{ListPIDInfo, PidInfoFlavor}; #[cfg(target_os = "macos")] use self::libc::{c_int, c_void}; // this extern block links to the libproc library // Original signatures of functions can be found at http://opensource.apple.com/sou...
else { Ok(pidinfo) } } #[cfg(not(target_os = "macos"))] pub fn pidfdinfo<T: PIDFDInfo>(_pid: i32, _fd: i32) -> Result<T, String> { unimplemented!() } #[cfg(all(test, target_os = "macos"))] mod test { use crate::libproc::bsd_info::BSDInfo; use crate::libproc::file_info::{ListFDs, ProcFDType}; ...
{ Err(helpers::get_errno_with_message(ret)) }
conditional_block
file_info.rs
extern crate libc; use std::mem; use crate::libproc::helpers; use crate::libproc::proc_pid::{ListPIDInfo, PidInfoFlavor}; #[cfg(target_os = "macos")] use self::libc::{c_int, c_void}; // this extern block links to the libproc library // Original signatures of functions can be found at http://opensource.apple.com/sou...
#[cfg(all(test, target_os = "macos"))] mod test { use crate::libproc::bsd_info::BSDInfo; use crate::libproc::file_info::{ListFDs, ProcFDType}; use crate::libproc::net_info::{SocketFDInfo, SocketInfoKind}; use crate::libproc::proc_pid::{listpidinfo, pidinfo}; use super::pidfdinfo; #[test] ...
{ unimplemented!() }
identifier_body
file_info.rs
use std::mem; use crate::libproc::helpers; use crate::libproc::proc_pid::{ListPIDInfo, PidInfoFlavor}; #[cfg(target_os = "macos")] use self::libc::{c_int, c_void}; // this extern block links to the libproc library // Original signatures of functions can be found at http://opensource.apple.com/source/Libc/Libc-594.9....
extern crate libc;
random_line_split
index.ts
/** * @ngdoc filter * @module superdesk.apps.products * @name ProductsFilter * @description Returns a function that allows filtering an array of * products by various criteria. */ export function ProductsFilter() { /** * @description Returns a new array based on the passed filter. * @param {Array<Ob...
if (search.product_type && search.product_type !== '') { filteredItems = filteredItems.filter((item) => (item.product_type || 'both') === search.product_type); } return filteredItems; }; }
{ const regExp = new RegExp(search.name, 'i'); filteredItems = filteredItems.filter((item) => item.name.match(regExp)); }
conditional_block
index.ts
/** * @ngdoc filter * @module superdesk.apps.products * @name ProductsFilter * @description Returns a function that allows filtering an array of * products by various criteria. */ export function
() { /** * @description Returns a new array based on the passed filter. * @param {Array<Object>} items - Array of templates to filter. * @param {Object} search - The filter. search by name and product type. * @returns {Array<Object>} The filtered array. */ return function(items, search)...
ProductsFilter
identifier_name
index.ts
/** * @ngdoc filter * @module superdesk.apps.products * @name ProductsFilter * @description Returns a function that allows filtering an array of * products by various criteria. */ export function ProductsFilter()
{ /** * @description Returns a new array based on the passed filter. * @param {Array<Object>} items - Array of templates to filter. * @param {Object} search - The filter. search by name and product type. * @returns {Array<Object>} The filtered array. */ return function(items, search) { ...
identifier_body
index.ts
/** * @ngdoc filter * @module superdesk.apps.products * @name ProductsFilter * @description Returns a function that allows filtering an array of
*/ export function ProductsFilter() { /** * @description Returns a new array based on the passed filter. * @param {Array<Object>} items - Array of templates to filter. * @param {Object} search - The filter. search by name and product type. * @returns {Array<Object>} The filtered array. */ ...
* products by various criteria.
random_line_split
tools.js
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import Color from 'color'; /** * Adjust a given token's lightness by a specified percentage * Example: token = hsl(10, 10, 10); * adjustLi...
(token, shift) { const original = Color(token).hsl().object(); return Color({ ...original, l: (original.l += shift) }) .round() .hex() .toLowerCase(); }
adjustLightness
identifier_name
tools.js
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import Color from 'color'; /** * Adjust a given token's lightness by a specified percentage * Example: token = hsl(10, 10, 10); * adjustLi...
{ const original = Color(token).hsl().object(); return Color({ ...original, l: (original.l += shift) }) .round() .hex() .toLowerCase(); }
identifier_body
tools.js
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import Color from 'color'; /** * Adjust a given token's lightness by a specified percentage * Example: token = hsl(10, 10, 10); * adjustLi...
}
.toLowerCase();
random_line_split
help.py
from wrappers import * from inspect import getdoc @plugin class Help: @command("list") def list(self, message): """list the loaded plugins""" return message.reply(list(self.bot.plugins.keys()), "loaded plugins: " + ", ".join(self.bot.plugins.keys())) @command("commands") d...
else: return message.reply("Help can be found at https://github.com/ellxc/piperbot/blob/master/README.md or by joining #piperbot on freenode")
firstline = "%s: %s" % (com, doc.split("\n")[0]) return message.reply(doc, firstline)
conditional_block
help.py
from wrappers import * from inspect import getdoc @plugin class Help: @command("list") def list(self, message): """list the loaded plugins""" return message.reply(list(self.bot.plugins.keys()), "loaded plugins: " + ", ".join(self.bot.plugins.keys())) @command("commands") d...
(self, message): """list the available commands""" return message.reply(list(self.bot.commands.keys()), "available commands: " + ", ".join(self.bot.commands.keys())) @command("aliases") def listaliases(self, message): """list the saved aliases""" return message.reply(list...
listcoms
identifier_name
help.py
from wrappers import * from inspect import getdoc @plugin class Help:
@command("list") def list(self, message): """list the loaded plugins""" return message.reply(list(self.bot.plugins.keys()), "loaded plugins: " + ", ".join(self.bot.plugins.keys())) @command("commands") def listcoms(self, message): """list the available commands""" re...
identifier_body
help.py
from wrappers import * from inspect import getdoc @plugin class Help: @command("list") def list(self, message): """list the loaded plugins""" return message.reply(list(self.bot.plugins.keys()), "loaded plugins: " + ", ".join(self.bot.plugins.keys())) @command("commands") d...
return message.reply(doc, firstline) elif message.data: try: com = message.data.split()[0] func = self.bot.commands[com][0] except: raise Exception("specifed command not found") doc = func.__doc__ ...
firstline = "%s: %s" % (message.data.__class__.__name__, doc.split("\n")[0])
random_line_split
errors.rs
/* Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, th...
/// The device name is invalid BadDeviceName(String), /// The number of fuses was incorrect for the device WrongFuseCount, /// An unknown value was used in the `Oe` field UnsupportedOeConfiguration([bool; 4]), /// An unknown value was used in the ZIA selection bits UnsupportedZIAConfigur...
random_line_split
errors.rs
/* Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, th...
(_: ()) -> Self { // FIXME unreachable!(); } } impl error::Error for XC2BitError { fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { &XC2BitError::JedParseError(ref err) => Some(err), &XC2BitError::BadDeviceName(_) => None, &XC2...
from
identifier_name
errors.rs
/* Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, th...
, } } }
{ write!(f, "unknown ZIA selection bit pattern ")?; for &bit in bits { write!(f, "{}", b2s(bit))?; } Ok(()) }
conditional_block
errors.rs
/* Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, th...
} impl fmt::Display for XC2BitError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { &XC2BitError::JedParseError(err) => { write!(f, ".jed parsing failed: {}", err) }, &XC2BitError::BadDeviceName(ref devname) => { wri...
{ match self { &XC2BitError::JedParseError(ref err) => Some(err), &XC2BitError::BadDeviceName(_) => None, &XC2BitError::WrongFuseCount => None, &XC2BitError::UnsupportedOeConfiguration(_) => None, &XC2BitError::UnsupportedZIAConfiguration(_) => None, ...
identifier_body
stack_switcher.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT use Box; use Buildable; use Container; use Orientable; #[cfg(feature = "3.10")] use Stack; use Widget; use ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! { pub struct StackSwitcher(Object<ffi::GtkStackSwitc...
}
{ unsafe { ffi::gtk_stack_switcher_set_stack(self.to_glib_none().0, stack.to_glib_none().0); } }
identifier_body
stack_switcher.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT use Box; use Buildable; use Container; use Orientable; #[cfg(feature = "3.10")] use Stack; use Widget; use ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! { pub struct StackSwitcher(Object<ffi::GtkStackSwitc...
(&self) -> Option<Stack> { unsafe { from_glib_none(ffi::gtk_stack_switcher_get_stack(self.to_glib_none().0)) } } #[cfg(feature = "3.10")] pub fn set_stack(&self, stack: Option<&Stack>) { unsafe { ffi::gtk_stack_switcher_set_stack(self.to_glib_none().0, stack....
get_stack
identifier_name
stack_switcher.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT use Box; use Buildable; use Container; use Orientable; #[cfg(feature = "3.10")] use Stack; use Widget; use ffi; use glib::object::Downcast; use glib::translate::*; glib_wrapper! { pub struct StackSwitcher(Object<ffi::GtkStackSwitc...
} } impl StackSwitcher { #[cfg(feature = "3.10")] pub fn new() -> StackSwitcher { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_stack_switcher_new()).downcast_unchecked() } } #[cfg(feature = "3.10")] pub fn get_stack(&self) -> O...
get_type => || ffi::gtk_stack_switcher_get_type(),
random_line_split
index.tsx
import { color } from "@artsy/palette" import { avantgarde } from "@artsy/reaction/dist/Assets/Fonts" import { IconEditEmbed } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditEmbed" import { IconEditImages } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditImages" import { IconEditSection } f...
) } } const mapStateToProps = state => ({ article: state.edit.article, isPartnerChannel: state.app.isPartnerChannel, }) const mapDispatchToProps = { newHeroSectionAction: newHeroSection, newSectionAction: newSection, } export default connect( mapStateToProps, mapDispatchToProps )(SectionTool) inte...
random_line_split
index.tsx
import { color } from "@artsy/palette" import { avantgarde } from "@artsy/reaction/dist/Assets/Fonts" import { IconEditEmbed } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditEmbed" import { IconEditImages } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditImages" import { IconEditSection } f...
> <IconHeroVideo /> Large Format Video </SectionToolMenuItem> </SectionToolMenu> ) } } renderSectionMenu() { const { article: { layout }, firstSection, isPartnerChannel, } = this.props const { isOpen } = this.state const isNews =...
{ return ( <SectionToolMenu> <SectionToolMenuItem onClick={() => this.setHero("image_collection")}> <IconHeroImage /> Large Format Image </SectionToolMenuItem> <SectionToolMenuItem onClick={() => this.setHero("video")}
conditional_block
index.tsx
import { color } from "@artsy/palette" import { avantgarde } from "@artsy/reaction/dist/Assets/Fonts" import { IconEditEmbed } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditEmbed" import { IconEditImages } from "@artsy/reaction/dist/Components/Publishing/Icon/IconEditImages" import { IconEditSection } f...
() { if (this.state.isOpen) { return ( <SectionToolMenu> <SectionToolMenuItem onClick={() => this.setHero("image_collection")}> <IconHeroImage /> Large Format Image </SectionToolMenuItem> <SectionToolMenuItem onClick={() => this.setHero("video")}>...
renderHeroMenu
identifier_name
process-args.ts
import { symbol } from 'ember-utils'; import { MUTABLE_CELL } from 'ember-views'; import { CapturedNamedArguments } from '@glimmer/runtime'; import { ARGS } from '../component'; import { ACTION } from '../helpers/action'; import { UPDATE } from './references'; // ComponentArgs takes EvaluatedNamedArgs and converts the...
for (let i = 0; i < keys.length; i++) { let name = keys[i]; let ref = namedArgs.get(name); let value = attrs[name]; if (typeof value === 'function' && value[ACTION]) { attrs[name] = value; } else if (ref[UPDATE]) { attrs[name] = new MutableCell(ref, value); } args[name] = ref...
props[ARGS] = args;
random_line_split
process-args.ts
import { symbol } from 'ember-utils'; import { MUTABLE_CELL } from 'ember-views'; import { CapturedNamedArguments } from '@glimmer/runtime'; import { ARGS } from '../component'; import { ACTION } from '../helpers/action'; import { UPDATE } from './references'; // ComponentArgs takes EvaluatedNamedArgs and converts the...
(namedArgs: CapturedNamedArguments) { let keys = namedArgs.names; let attrs = namedArgs.value(); let props = Object.create(null); let args = Object.create(null); props[ARGS] = args; for (let i = 0; i < keys.length; i++) { let name = keys[i]; let ref = namedArgs.get(name); let value = attrs[nam...
processComponentArgs
identifier_name
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{self, File, OpenOptions}; use std::io; use std::io::prelude::*; use std::iter; use std::path::{Component, Path, PathBuf}; use filetime::FileTime; use crate::util::errors::{CargoResult, CargoResultExt}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &...
(path: &Path) -> PathAncestors<'_> { PathAncestors { current: Some(path), //HACK: avoid reading `~/.cargo/config` when testing Cargo itself. stop_at: env::var("__CARGO_TEST_ROOT").ok().map(PathBuf::from), } } } impl<'a> Iterator for PathAncestors<'a> { type I...
new
identifier_name
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{self, File, OpenOptions}; use std::io; use std::io::prelude::*; use std::iter; use std::path::{Component, Path, PathBuf}; use filetime::FileTime; use crate::util::errors::{CargoResult, CargoResultExt}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &...
#[cfg(unix)] pub fn path2bytes(path: &Path) -> CargoResult<&[u8]> { use std::os::unix::prelude::*; Ok(path.as_os_str().as_bytes()) } #[cfg(windows)] pub fn path2bytes(path: &Path) -> CargoResult<&[u8]> { match path.as_os_str().to_str() { Some(s) => Ok(s.as_bytes()), None => Err(anyhow::for...
{ // note that if `FileTime::from_system_time(SystemTime::now());` is determined to be sufficient, // then this can be removed. let timestamp = path.join("invoked.timestamp"); write( &timestamp, b"This file has an mtime of when this was started.", )?; let ft = mtime(&timestamp)?;...
identifier_body
paths.rs
use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{self, File, OpenOptions}; use std::io; use std::io::prelude::*; use std::iter; use std::path::{Component, Path, PathBuf}; use filetime::FileTime; use crate::util::errors::{CargoResult, CargoResultExt}; pub fn join_paths<T: AsRef<OsStr>>(paths: &[T], env: &...
.chain_err(|| format!("failed to write `{}`", path.as_ref().display()))?; Ok(()) } pub fn append(path: &Path, contents: &[u8]) -> CargoResult<()> { (|| -> CargoResult<()> { let mut f = OpenOptions::new() .write(true) .append(true) .create(true) .open(...
f.seek(io::SeekFrom::Start(0))?; f.write_all(contents)?; } Ok(()) })()
random_line_split
pt_pt.js
/*! * froala_editor v3.2.5 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2020 Froala Labs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) : typeof define === 'function...
'Angry face': 'Rosto irritado', 'Pouting face': 'Beicinho Rosto', 'Crying face': 'Cara de choro', 'Persevering face': 'Perseverar Rosto', 'Face with look of triumph': 'Rosto com olhar de triunfo', 'Disappointed but relieved face': 'Fiquei Desapontado mas aliviado Rosto', 'Frown...
'Disappointed face': 'Rosto decepcionado', 'Worried face': 'O rosto preocupado',
random_line_split
consoleLogger.js
/*jshint unused:false */ "use strict"; var _verbosity = 0; var _prefix = "[videojs-vast-vpaid] "; function setVerbosity (v) { _verbosity = v; } function handleMsg (method, args) { if ((args.length) > 0 && (typeof args[0] === 'string')) { args[0] = _prefix + args[0]; } if (method.apply) ...
handleMsg (console.warn, arguments); } function error () { handleMsg (console.error, arguments); } var consoleLogger = { setVerbosity: setVerbosity, debug: debug, log: log, info: info, warn: warn, error: error }; if ((typeof (console) === 'undefined') || !console.log) { // no co...
{ return; }
conditional_block
consoleLogger.js
/*jshint unused:false */ "use strict"; var _verbosity = 0; var _prefix = "[videojs-vast-vpaid] "; function setVerbosity (v) { _verbosity = v; } function handleMsg (method, args) { if ((args.length) > 0 && (typeof args[0] === 'string')) { args[0] = _prefix + args[0]; } if (method.apply) ...
() { handleMsg (console.error, arguments); } var consoleLogger = { setVerbosity: setVerbosity, debug: debug, log: log, info: info, warn: warn, error: error }; if ((typeof (console) === 'undefined') || !console.log) { // no console available; make functions no-op consoleLogger.debu...
error
identifier_name
consoleLogger.js
/*jshint unused:false */ "use strict"; var _verbosity = 0; var _prefix = "[videojs-vast-vpaid] "; function setVerbosity (v) { _verbosity = v; } function handleMsg (method, args) { if ((args.length) > 0 && (typeof args[0] === 'string')) { args[0] = _prefix + args[0]; } if (method.apply) ...
{ handleMsg (console.error, arguments); } var consoleLogger = { setVerbosity: setVerbosity, debug: debug, log: log, info: info, warn: warn, error: error }; if ((typeof (console) === 'undefined') || !console.log) { // no console available; make functions no-op consoleLogger.debug = ...
function error ()
random_line_split
consoleLogger.js
/*jshint unused:false */ "use strict"; var _verbosity = 0; var _prefix = "[videojs-vast-vpaid] "; function setVerbosity (v) { _verbosity = v; } function handleMsg (method, args) { if ((args.length) > 0 && (typeof args[0] === 'string')) { args[0] = _prefix + args[0]; } if (method.apply) ...
function warn () { if (_verbosity < 1) { return; } handleMsg (console.warn, arguments); } function error () { handleMsg (console.error, arguments); } var consoleLogger = { setVerbosity: setVerbosity, debug: debug, log: log, info: info, warn: warn, error: error }...
{ if (_verbosity < 2) { return; } handleMsg (console.info, arguments); }
identifier_body
trait-implementations.rs
// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] pub trait SomeTrait { fn foo(&self); fn bar<T>(&self, x: T); } impl SomeTrait for i64 { //~ MONO_ITEM fn <i64 as SomeTrait>::foo fn foo(&self) {} fn bar<T>(&self, _: T) {} }
fn bar<T>(&self, _: T) {} } pub trait SomeGenericTrait<T> { fn foo(&self, x: T); fn bar<T2>(&self, x: T, y: T2); } // Concrete impl of generic trait impl SomeGenericTrait<u32> for f64 { //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::foo fn foo(&self, _: u32) {} fn bar<T2>(&self, _: u32, _...
impl SomeTrait for i32 { //~ MONO_ITEM fn <i32 as SomeTrait>::foo fn foo(&self) {}
random_line_split
trait-implementations.rs
// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] pub trait SomeTrait { fn foo(&self); fn bar<T>(&self, x: T); } impl SomeTrait for i64 { //~ MONO_ITEM fn <i64 as SomeTrait>::foo fn foo(&self) {} fn bar<T>(&self, _: T) {} } impl SomeTrait for i32 { //~ MONO_...
<T>(&self, _: T) {} } pub trait SomeGenericTrait<T> { fn foo(&self, x: T); fn bar<T2>(&self, x: T, y: T2); } // Concrete impl of generic trait impl SomeGenericTrait<u32> for f64 { //~ MONO_ITEM fn <f64 as SomeGenericTrait<u32>>::foo fn foo(&self, _: u32) {} fn bar<T2>(&self, _: u32, _: T2) {} } ...
bar
identifier_name
trait-implementations.rs
// compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] #![feature(start)] pub trait SomeTrait { fn foo(&self); fn bar<T>(&self, x: T); } impl SomeTrait for i64 { //~ MONO_ITEM fn <i64 as SomeTrait>::foo fn foo(&self)
fn bar<T>(&self, _: T) {} } impl SomeTrait for i32 { //~ MONO_ITEM fn <i32 as SomeTrait>::foo fn foo(&self) {} fn bar<T>(&self, _: T) {} } pub trait SomeGenericTrait<T> { fn foo(&self, x: T); fn bar<T2>(&self, x: T, y: T2); } // Concrete impl of generic trait impl SomeGenericTrait<u32> fo...
{}
identifier_body
t_output.py
#!/usr/local/bin/python2.6 -tt # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (...
def force_newline(self): 'Force a newline' print >>self._output self._on_blank_line = True self._flag = False def line_feed(self): '''Enforce that the cursor is placed on an empty line, returns whether a newline was printed or not''' if not self._on_bla...
pass
identifier_body
t_output.py
#!/usr/local/bin/python2.6 -tt # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (...
(self, amount): assert self._indent - amount >= 0 self._indent -= amount def _write_line_contents_impl(self, line): # strip trailing characters line = line.rstrip() # handle case where _write is being passed a \n-terminated string if line == '': # don't f...
unindent
identifier_name
t_output.py
#!/usr/local/bin/python2.6 -tt # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (...
class CompositeOutput(Output): def __init__(self, *outputs): self._outputs = outputs def indent(self): for output in self._outputs: output.indent() def unindent(self): for output in self._outputs: output.unindent() def _write(self, lines): fo...
self.force_newline() self._write_line_contents(line)
conditional_block
t_output.py
#!/usr/local/bin/python2.6 -tt # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (...
def indent(self): for output in self._outputs: output.indent() def unindent(self): for output in self._outputs: output.unindent() def _write(self, lines): for output in self._outputs: output.write(lines) def _write_line_contents_impl(self, ...
class CompositeOutput(Output): def __init__(self, *outputs): self._outputs = outputs
random_line_split
drop_flag_effects.rs
// Copyright 2012-2017 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...
<'a, 'gcx, 'tcx>( tcx: TyCtxt<'a, 'gcx, 'tcx>, mir: &Mir<'tcx>, move_data: &MoveData<'tcx>, path: MovePathIndex) -> bool { place_contents_drop_state_cannot_differ( tcx, mir, &move_data.move_paths[path].place) } fn on_all_children_bits<'a, 'gcx, 'tcx, F>( ...
is_terminal_path
identifier_name
drop_flag_effects.rs
// Copyright 2012-2017 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...
ty::Slice(..) | ty::Ref(..) | ty::RawPtr(..) => { debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} refd => true", place, ty); true } ty::Adt(def, _) if (def.has_dtor(tcx) && !def.is_box()) || def.is_union() => { debug!("...
{ debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} => false", place, ty); false }
conditional_block
drop_flag_effects.rs
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
pub(crate) fn on_lookup_result_bits<'a, 'gcx, 'tcx, F>( tcx: TyCtxt<'a, 'gcx, 'tcx>, mir: &Mir<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, each_child: F) where F: FnMut(MovePathIndex) { match lookup_result { LookupResult::Parent(..) => { // access to...
{ let ty = place.ty(mir, tcx).to_ty(tcx); match ty.sty { ty::Array(..) => { debug!("place_contents_drop_state_cannot_differ place: {:?} ty: {:?} => false", place, ty); false } ty::Slice(..) | ty::Ref(..) | ty::RawPtr(..) => { debug!(...
identifier_body
drop_flag_effects.rs
// Copyright 2012-2017 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...
use super::move_paths::{MoveData, LookupResult, InitKind}; pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, path: MovePathIndex, mut cond: F) -> Option<MovePathIndex> where...
random_line_split
test-bi-promise-constructor-all-iterable.js
/*--- { "skip": true } ---*/ /*=== next called, done: false next called, done: false next called, done: false next called, done: true done all fulfill: foo,bar,quux ===*/ var iterable = {}; var index = 0; var values = [ // Plain values, Promise, a Promise returning a generic thenable. 'foo', Promise.r...
} }; }; var P = Promise.all(iterable); P.then(function (v) { print('all fulfill:', String(v)); }, function (e) { print('all reject:', String(e)); }); print('done');
random_line_split
elfinder.es.js
/* * Spanish translation * @author Alex Vavilin <xand@xand.es> * @version 2010-09-22 */ (function($) { if (elFinder && elFinder.prototype.options && elFinder.prototype.options.i18n) elFinder.prototype.options.i18n.es = { /* errors */ 'Root directory does not exists' : 'El directorio raíz no ex...
'Create archive' : 'Nuevo archivo', 'Uncompress archive' : 'Extraer archivo', 'Get info' : 'Propiedades', 'Help' : 'Ayuda', 'Dock/undock filemanager window' : 'Despegar/pegar el gestor de ficheros a la página', /* upload/get info dialogs */ 'Maximum al...
'Resize image' : 'Tamaño de imagen',
random_line_split
register.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Registration } from '../../core/domain/registration'; import { OperationResult } from '../../core/domain/operationResult'; import { MembershipService } from '../../core/services/membership.service'; import { Notificati...
register(): void { var _registrationResult: OperationResult = new OperationResult(false, ''); this.membershipService.register(this._newUser) .subscribe(res => { _registrationResult.Succeeded = res.Succeeded; _registrationResult.Message = res.Message; ...
this._newUser = new Registration('', '', ''); }
identifier_body
register.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Registration } from '../../core/domain/registration'; import { OperationResult } from '../../core/domain/operationResult';
import { MembershipService } from '../../core/services/membership.service'; import { NotificationService } from '../../core/services/notification.service'; @Component({ selector: 'register', providers: [MembershipService, NotificationService], templateUrl: './app/components/account/register.component.html'...
random_line_split
register.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Registration } from '../../core/domain/registration'; import { OperationResult } from '../../core/domain/operationResult'; import { MembershipService } from '../../core/services/membership.service'; import { Notificati...
}); }; }
this.notificationService.printErrorMessage(_registrationResult.Message); }
conditional_block
register.component.ts
import { Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import { Registration } from '../../core/domain/registration'; import { OperationResult } from '../../core/domain/operationResult'; import { MembershipService } from '../../core/services/membership.service'; import { Notificati...
: void { var _registrationResult: OperationResult = new OperationResult(false, ''); this.membershipService.register(this._newUser) .subscribe(res => { _registrationResult.Succeeded = res.Succeeded; _registrationResult.Message = res.Message; }, ...
gister()
identifier_name
views.py
#!/usr/bin/python from django.http import HttpResponse from django.template import RequestContext, loader from django.views.decorators.csrf import csrf_exempt import django.shortcuts from wlokalu.api import presence #----------------------------------------------------------------------------- from wlokalu.logging ...
#----------------------------------------------------------------------------- # vim:ft=python:foldmethod=marker
template = loader.get_template("list.html") from django.core.urlresolvers import reverse from forms import PresenceForm form = PresenceForm() if nick is not None: form.initial['nick'] = nick form_target = reverse(list, kwargs = {'nick': nick}) else: form_target = reverse(list) if request.POST....
identifier_body
views.py
#!/usr/bin/python from django.http import HttpResponse from django.template import RequestContext, loader from django.views.decorators.csrf import csrf_exempt import django.shortcuts from wlokalu.api import presence #----------------------------------------------------------------------------- from wlokalu.logging ...
'form': form, 'present': presence.list_people(), 'sensors': presence.list_simple_sensors(), 'complex_sensors': presence.list_complex_sensors(), }) return HttpResponse(template.render(context)) #----------------------------------------------------------------------------- # vim:ft=python:foldmethod=...
# tell the browser to reload the page, but with GET request return django.shortcuts.redirect(request.path) context = RequestContext(request, { 'form_target': form_target,
random_line_split
views.py
#!/usr/bin/python from django.http import HttpResponse from django.template import RequestContext, loader from django.views.decorators.csrf import csrf_exempt import django.shortcuts from wlokalu.api import presence #----------------------------------------------------------------------------- from wlokalu.logging ...
(request, nick = None): template = loader.get_template("list.html") from django.core.urlresolvers import reverse from forms import PresenceForm form = PresenceForm() if nick is not None: form.initial['nick'] = nick form_target = reverse(list, kwargs = {'nick': nick}) else: form_target = reverse...
list
identifier_name
views.py
#!/usr/bin/python from django.http import HttpResponse from django.template import RequestContext, loader from django.views.decorators.csrf import csrf_exempt import django.shortcuts from wlokalu.api import presence #----------------------------------------------------------------------------- from wlokalu.logging ...
# tell the browser to reload the page, but with GET request return django.shortcuts.redirect(request.path) context = RequestContext(request, { 'form_target': form_target, 'form': form, 'present': presence.list_people(), 'sensors': presence.list_simple_sensors(), 'complex_sensors': presen...
presence.person_left(request.POST['nick'], context)
conditional_block
webpack.horizon.config.js
const path = require('path') const BannerPlugin = require('webpack/lib/BannerPlugin') const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') const DefinePlugin = require('webpack/lib/DefinePlugin') const OccurrenceOrderPlugin = require( 'webpack/lib/optimize/OccurrenceOrderPlugin') const UglifyJsPlugin = ...
commonjs2: 'rxjs', amd: 'rxjs' }) } else { callback() } }, { ws: 'commonjs ws' } ], debug: DEV_BUILD, devtool: SOURCEMAPS ? (DEV_BUILD ? 'source-map' : 'source-map') : false, module: { noParse: [ ], preLoaders: [], ...
// Otherwise imported via `require('rx')` commonjs: 'rxjs',
random_line_split
webpack.horizon.config.js
const path = require('path') const BannerPlugin = require('webpack/lib/BannerPlugin') const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') const DefinePlugin = require('webpack/lib/DefinePlugin') const OccurrenceOrderPlugin = require( 'webpack/lib/optimize/OccurrenceOrderPlugin') const UglifyJsPlugin = ...
else { // Show correct paths in stack traces return path.join('..', file.resourcePath) .replace(/~/g, 'node_modules') } } : null, }, externals: [ function(context, request, callback) { // Selected modules are not packaged into horizon....
{ return `webpack:///${file.resourcePath}` }
conditional_block
context.rs
/* This Source Code Form is subject to the terms of the Mozilla Public
//! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; use heapsize::HeapSizeOf; use msg::constellation_msg::PipelineId; use net_traits::image_cache::{CanRequestImages, ImageCac...
* 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/. */
random_line_split
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
} } } impl<'a> LayoutContext<'a> { #[inline(always)] pub fn shared_context(&self) -> &SharedStyleContext { &self.style_context } pub fn get_or_request_image_or_meta(&self, node: OpaqueNode, url: ServoU...
{ assert!(pending_images.lock().unwrap().is_empty()); }
conditional_block
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
(&self, node: OpaqueNode, url: ServoUrl, use_placeholder: UsePlaceholder) -> Option<WebRenderImageInfo> { if let Some(existing_webrender_image) = self.webre...
get_webrender_image_for_url
identifier_name
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
pub fn heap_size_of_persistent_local_context() -> usize { FONT_CONTEXT_KEY.with(|r| { if let Some(ref context) = *r.borrow() { context.heap_size_of_children() } else { 0 } }) } /// Layout information shared among all workers. This must be thread-safe. pub struc...
{ FONT_CONTEXT_KEY.with(|k| { let mut font_context = k.borrow_mut(); if font_context.is_none() { let font_cache_thread = layout_context.font_cache_thread.lock().unwrap().clone(); *font_context = Some(FontContext::new(font_cache_thread)); } f(&mut RefMut::map(f...
identifier_body
xibalba.js
var game = new Phaser.Game( 300, 600, Phaser.CANVAS, 'gameDiv', { preload: preload, create: create, update: update, render: render } ); function preload() { game.load.image('background', 'assets/background.png'); game.load.image('playerBody', 'assets/playerBody.png'); game.load.image(...
function update() { } function render() { }
{ bg = game.add.tileSprite(0, 0, 400, 800, 'background'); bg.scale.setTo(.75); player = game.add.group(); player.scale.setTo(.75); playerBody = game.add.sprite(200, 777, 'playerBody'); playerBody.anchor.setTo(0.5, 0.5); leftForearm = game.add.sprite(170, 763, 'leftForearm'); leftForearm.anchor.setTo(...
identifier_body
xibalba.js
var game = new Phaser.Game( 300, 600, Phaser.CANVAS, 'gameDiv', { preload: preload, create: create, update: update, render: render } ); function preload() { game.load.image('background', 'assets/background.png'); game.load.image('playerBody', 'assets/playerBody.png'); game.load.image(...
() { bg = game.add.tileSprite(0, 0, 400, 800, 'background'); bg.scale.setTo(.75); player = game.add.group(); player.scale.setTo(.75); playerBody = game.add.sprite(200, 777, 'playerBody'); playerBody.anchor.setTo(0.5, 0.5); leftForearm = game.add.sprite(170, 763, 'leftForearm'); leftForearm.anchor.set...
create
identifier_name
mixins.py
#!/bin/env python2 # -*- coding: utf-8 -*- # # This file is part of the VecNet Zika modeling interface. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/vecnet/zika # # This Source Code Form is...
view = super(LoginRequiredMixin, cls).as_view(**initkwargs) return login_required(view)
identifier_body
mixins.py
#!/bin/env python2 # -*- coding: utf-8 -*- # # This file is part of the VecNet Zika modeling interface. # For copyright and licensing information about this package, see the # NOTICE.txt and LICENSE.txt files in its top-level directory; they are # available at https://github.com/vecnet/zika # # This Source Code Form is...
(cls, **initkwargs): # Ignore PyCharm warning below, this is a Mixin class after all view = super(LoginRequiredMixin, cls).as_view(**initkwargs) return login_required(view)
as_view
identifier_name
mixins.py
#!/bin/env python2 # -*- coding: utf-8 -*- # # This file is part of the VecNet Zika modeling interface. # For copyright and licensing information about this package, see the
# available at https://github.com/vecnet/zika # # This Source Code Form is subject to the terms of the Mozilla Public # License (MPL), version 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/. import json from django.contrib.auth.decorators import logi...
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
random_line_split
mean_level_spacing_test.py
from __future__ import print_function, division import sys,os qspin_path = os.path.join(os.getcwd(),"../") sys.path.insert(0,qspin_path) # from quspin.operators import hamiltonian # Hamiltonians and operators from quspin.basis import spin_basis_1d # Hilbert space spin basis from quspin.tools.measurements import mean_l...
print("mean level spacing is", r)
r=mean_level_spacing(E2,verbose=False)
random_line_split
parseSysInfoStats.spec.ts
/* global it, describe, before, after */ import * as mock from '../__mocks__/mock-server-responses'; import * as misrcon from '../src/node-misrcon'; describe('parseSysInfoStats', () => { it('sysinfo stats live', () => { const sysInfo = misrcon.parseSysInfoStats(mock.sysInfoStats); expect(sysInfo.upd).toBe('9...
try { misrcon.parseSysInfoStats('Some other random String'); } catch (e) { expect(e instanceof misrcon.ParserError).toEqual(true); } }); });
it('should throw ParserError', () => {
random_line_split
lib.rs
//! # bittrex-api //! //! **bittrex-api** provides a wrapper for the [Bittrex API](https://bittrex.com/home/api). //! This crate makes it easy to consume the **Bittrex API** in Rust. //! //! ##Example //! //! ```no_run //! extern crate bittrex_api; //! //! use bittrex_api::BittrexClient; //! # fn main() {
//! # } //! ``` extern crate time; extern crate hmac; extern crate sha2; extern crate generic_array; extern crate reqwest; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; pub mod error; pub mod values; mod client; pub use client::BittrexClient;
//! let bittrex_client = BittrexClient::new("KEY".to_string(), "SECRET".to_string()); // Initialize the Bittrex Client with your API Key and Secret //! let markets = bittrex_client.get_markets().unwrap(); //Get all available markets of Bittrex
random_line_split
facebook.js
var Purest = require('purest'); function Facebook(opts) { this._opts = opts || {}; this._opts.provider = 'facebook'; this._purest = new Purest(this._opts); this._group = 'LIB:SOCIAL:FACEBOOK'; return this; } Facebook.prototype.user = function (cb) { var self = this; this._purest.query() ...
// form = {message: 'post message'} this._purest.query() .post(endpoint || 'me/feed') .auth(this._opts.auth.token) .form(form) .request(function (err, res, body) { if (err) { console.log(err); return cb(err); } ...
Facebook.prototype.post = function (endpoint, form, cb) {
random_line_split
facebook.js
var Purest = require('purest'); function Facebook(opts) { this._opts = opts || {}; this._opts.provider = 'facebook'; this._purest = new Purest(this._opts); this._group = 'LIB:SOCIAL:FACEBOOK'; return this; } Facebook.prototype.user = function (cb) { var self = this; this._purest.query() ...
cb(null, body); }); }; module.exports = function(app) { return Facebook; };
{ console.log(err); return cb(err); }
conditional_block
facebook.js
var Purest = require('purest'); function Facebook(opts)
Facebook.prototype.user = function (cb) { var self = this; this._purest.query() .get('me') .auth(this._opts.auth.token) .request(function (err, res, body) { if (err) { console.log(err); return cb(err); } cb(null, bod...
{ this._opts = opts || {}; this._opts.provider = 'facebook'; this._purest = new Purest(this._opts); this._group = 'LIB:SOCIAL:FACEBOOK'; return this; }
identifier_body
facebook.js
var Purest = require('purest'); function
(opts) { this._opts = opts || {}; this._opts.provider = 'facebook'; this._purest = new Purest(this._opts); this._group = 'LIB:SOCIAL:FACEBOOK'; return this; } Facebook.prototype.user = function (cb) { var self = this; this._purest.query() .get('me') .auth(this._opts.auth.t...
Facebook
identifier_name
str.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 geometry::Au; use cssparser::{self, RGBA, Color}; use libc::c_char; use num_lib::ToPrimitive; use std::ascii...
&split: &&str) -> bool { !split.is_empty() } s.split(HTML_SPACE_CHARACTERS).filter(not_empty as fn(&&str) -> bool) } /// Shared implementation to parse an integer according to /// <https://html.spec.whatwg.org/#rules-for-parsing-integers> or /// <https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integer...
ot_empty(
identifier_name
str.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 geometry::Au; use cssparser::{self, RGBA, Color}; use libc::c_char; use num_lib::ToPrimitive; use std::ascii...
fn hex_string(string: &[u8]) -> Result<u8, ()> { match string.len() { 0 => Err(()), 1 => hex(string[0] as char), _ => { let upper = try!(hex(string[0] as char)); let lower = try!(hex(string[1] as char)); Ok((upper << 4) | low...
match ch { '0'...'9' => Ok((ch as u8) - b'0'), 'a'...'f' => Ok((ch as u8) - b'a' + 10), 'A'...'F' => Ok((ch as u8) - b'A' + 10), _ => Err(()), } }
identifier_body
str.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 geometry::Au; use cssparser::{self, RGBA, Color}; use libc::c_char; use num_lib::ToPrimitive; use std::ascii...
'\u{000d}', ]; pub fn split_html_space_chars<'a>(s: &'a str) -> Filter<Split<'a, StaticCharVec>, fn(&&str) -> bool> { fn not_empty(&split: &&str) -> bool { !split.is_empty() } s.split(HTML_SPACE_CHARACTERS).filter(not_empty as fn(&&str) -> bool) } /// Shared implementatio...
'\u{0020}', '\u{0009}', '\u{000a}', '\u{000c}',
random_line_split
issue-5554.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 ...
{ constants!(); }
identifier_body
issue-5554.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 ...
<T> { a: T, } // reordering these bounds stops the ICE // // nmatsakis: This test used to have the bounds Default + PartialEq + // Default, but having duplicate bounds became illegal. impl<T: Default + PartialEq> Default for X<T> { fn default() -> X<T> { X { a: Default::default() } } } macro_rules...
X
identifier_name
issue-5554.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
pub struct X<T> { a: T, } // reordering these bounds stops the ICE // // nmatsakis: This test used to have the bounds Default + PartialEq + // Default, but having duplicate bounds became illegal. impl<T: Default + PartialEq> Default for X<T> { fn default() -> X<T> { X { a: Default::default() } } }...
// <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. use std::default::Default;
random_line_split
test_devstack.py
# Copyright 2013: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
(self): super(DevstackEngineTestCase, self).setUp() self.deployment = { "uuid": "de641026-dbe3-4abe-844a-ffef930a600a", "config": SAMPLE_CONFIG, } self.engine = devstack.DevstackEngine(self.deployment) def test_invalid_config(self): self.deployment = ...
setUp
identifier_name
test_devstack.py
# Copyright 2013: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
mock_endpoint.assert_called_once_with( "http://host:5000/v2.0/", "admin", "secret", "admin", "admin") mock_deployment.add_resource.assert_called_once_with( info="fake_credentials", provider_name="DevstackEngine", type="credentials") repo = "https:/...
fake_provider.create_servers.return_value = [server] with mock.patch.object(self.engine, "deployment") as mock_deployment: endpoints = self.engine.deploy() self.assertEqual({"admin": "fake_endpoint"}, endpoints)
random_line_split
test_devstack.py
# Copyright 2013: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
def setUp(self): super(DevstackEngineTestCase, self).setUp() self.deployment = { "uuid": "de641026-dbe3-4abe-844a-ffef930a600a", "config": SAMPLE_CONFIG, } self.engine = devstack.DevstackEngine(self.deployment) def test_invalid_config(self): self.depl...
identifier_body
server.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: sansna # Date : 2020 Aug 01 17:42:43 import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import re # App Config # XXX: https://stackoverflow.com/questions/3536620/how-to-change-a-module-variable-from-another...
conditional_block
server.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: sansna # Date : 2020 Aug 01 17:42:43 import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import re # App Config # XXX: https://stackoverflow.com/questions/3536620/how-to-change-a-module-variable-from-another...
decorator of adding path for a function Usage: @add_path("path", methods=["POST","GET"]) def func(json): print "ok" """ path = args[0] if "methods" in kwargs: methods = kwargs["methods"] else: methods = ["POST"] def inner(func): AddPath(path, func, meth...
"""
identifier_name
server.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: sansna # Date : 2020 Aug 01 17:42:43 import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import re # App Config # XXX: https://stackoverflow.com/questions/3536620/how-to-change-a-module-variable-from-another...
def AddPath(path, f, methods=["POST"]): if len(path) == 0: return if path[0] != "/": path = "/"+path fun = path+str(methods) fun = pathre.sub('_', fun) """ see https://stackoverflow.com/questions/17256602/assertionerror-view-function-mapping-is-overwriting-an-existing-endpoint...
random_line_split
server.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: sansna # Date : 2020 Aug 01 17:42:43 import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import re # App Config # XXX: https://stackoverflow.com/questions/3536620/how-to-change-a-module-variable-from-another...
def DAY(ts): return time.strftime("%d", time.localtime(ts)) pathre = re.compile('[^a-zA-Z0-9]') def AddPath(path, f, methods=["POST"]): if len(path) == 0: return if path[0] != "/": path = "/"+path fun = path+str(methods) fun = pathre.sub('_', fun) """ see https://stacko...
return time.strftime("%Y%m", time.localtime(ts))
identifier_body
inefficient_to_string.rs
// run-rustfix #![deny(clippy::inefficient_to_string)] use std::borrow::Cow; fn
() { let rstr: &str = "hello"; let rrstr: &&str = &rstr; let rrrstr: &&&str = &rrstr; let _: String = rstr.to_string(); let _: String = rrstr.to_string(); let _: String = rrrstr.to_string(); let string: String = String::from("hello"); let rstring: &String = &string; let rrstring: &&...
main
identifier_name
inefficient_to_string.rs
// run-rustfix #![deny(clippy::inefficient_to_string)] use std::borrow::Cow; fn main() { let rstr: &str = "hello"; let rrstr: &&str = &rstr; let rrrstr: &&&str = &rrstr;
let rstring: &String = &string; let rrstring: &&String = &rstring; let rrrstring: &&&String = &rrstring; let _: String = string.to_string(); let _: String = rstring.to_string(); let _: String = rrstring.to_string(); let _: String = rrrstring.to_string(); let cow: Cow<'_, str> = Cow::Bor...
let _: String = rstr.to_string(); let _: String = rrstr.to_string(); let _: String = rrrstr.to_string(); let string: String = String::from("hello");
random_line_split
inefficient_to_string.rs
// run-rustfix #![deny(clippy::inefficient_to_string)] use std::borrow::Cow; fn main()
{ let rstr: &str = "hello"; let rrstr: &&str = &rstr; let rrrstr: &&&str = &rrstr; let _: String = rstr.to_string(); let _: String = rrstr.to_string(); let _: String = rrrstr.to_string(); let string: String = String::from("hello"); let rstring: &String = &string; let rrstring: &&Str...
identifier_body
UCNES_Class.py
import numpy as np import os import sys import math #import class files # sys.path.append('../../../') from source import bioRead as br from source import classify as cl #import PyInsect for measuring similarity #sys.path.append('../../../../') from PyINSECT import representations as REP from PyINSECT import comparator...
# End local function # If we have cached the main analysis data if os.path.exists('SimilaritiesAndDictionaries/UCNE.npz'): # Use them npz = np.load('SimilaritiesAndDictionaries/UCNE.npz') hd = npz['hd'] cd = npz['cd'] S = npz['S'] l1 = npz['l1'] l2 = npz['l2'] l = npz['l'] L = np....
i, l, S, ngg = setting # Explode for j in range(i,l): dTmp = sop.getSimilarityDouble(ngg[i],ngg[j]) if (math.isnan(dTmp)): raise Exception("Invalid similarity! Check similarity implementation.") S[i,j] = dTmp
identifier_body
UCNES_Class.py
import numpy as np import os import sys import math #import class files # sys.path.append('../../../') from source import bioRead as br from source import classify as cl #import PyInsect for measuring similarity #sys.path.append('../../../../') from PyINSECT import representations as REP from PyINSECT import comparator...
# S[i,j] = sop.getSimilarityDouble(ngg[i],ngg[j]) print "" print "Getting chicken similarities... Done" # Update symmetric matrix, based on current findings for i in range(0,l): for j in range(0,i): S[i,j] = S[j,i] print "Similarity matrix constructed.." if...
# for i in range(l1,l): # print i," ", # L[i] = 1 #1 for chickens # for j in range(i,l):
random_line_split
UCNES_Class.py
import numpy as np import os import sys import math #import class files # sys.path.append('../../../') from source import bioRead as br from source import classify as cl #import PyInsect for measuring similarity #sys.path.append('../../../../') from PyINSECT import representations as REP from PyINSECT import comparator...
(setting): i, l, S, ngg = setting # Explode for j in range(i,l): dTmp = sop.getSimilarityDouble(ngg[i],ngg[j]) if (math.isnan(dTmp)): raise Exception("Invalid similarity! Check similarity implementation.") S[i,j] = dTmp # End local function # If we have cached the main anal...
__getSimilaritiesForIndex
identifier_name
UCNES_Class.py
import numpy as np import os import sys import math #import class files # sys.path.append('../../../') from source import bioRead as br from source import classify as cl #import PyInsect for measuring similarity #sys.path.append('../../../../') from PyINSECT import representations as REP from PyINSECT import comparator...
np.savez('SimilaritiesAndDictionaries/metrics.npz', metrics=metrics, cm=cm)
try: print class_types[i],"\n" evaluator = cl.Evaluator(cl.SVM()) Sp = cl.kernelization(S,i) S1 = Sp[0:l1,:] S2 = Sp[l1:,:] metrics[class_types[i]],cm[class_types[i]] = evaluator.Randomized_kfold((S1,S2),(L1,L2),reps,verbose=True) print "" except Exception as ...
conditional_block
custom-typings.d.ts
/* * Custom Type Definitions * When including 3rd party modules you also need to include the type definition for the module * if they don't provide one within the module. You can try to install it with @types npm install @types/node npm install @types/lodash * If you can't find the type definition in the registry...
// support NodeJS modules without type definitions declare module '*'; /* // for legacy tslint etc to understand rename 'modern-lru' with your package // then comment out `declare module '*';`. For each new module copy/paste // this method of creating an `any` module type definition declare module 'modern-lru' { ...
random_line_split
test_hashing.py
import numpy as np import pandas as pd import pytest from dask.dataframe.hashing import hash_pandas_object from dask.dataframe.utils import assert_eq @pytest.mark.parametrize('obj', [ pd.Series([1, 2, 3]), pd.Series([1.0, 1.5, 3.2]), pd.Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]), pd.Series(['a',...
assert_eq(a, b)
conditional_block
test_hashing.py
import numpy as np import pandas as pd import pytest from dask.dataframe.hashing import hash_pandas_object from dask.dataframe.utils import assert_eq @pytest.mark.parametrize('obj', [ pd.Series([1, 2, 3]), pd.Series([1.0, 1.5, 3.2]), pd.Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]), pd.Series(['a',...
a = hash_pandas_object(obj) b = hash_pandas_object(obj) if isinstance(a, np.ndarray): np.testing.assert_equal(a, b) else: assert_eq(a, b)
random_line_split
test_hashing.py
import numpy as np import pandas as pd import pytest from dask.dataframe.hashing import hash_pandas_object from dask.dataframe.utils import assert_eq @pytest.mark.parametrize('obj', [ pd.Series([1, 2, 3]), pd.Series([1.0, 1.5, 3.2]), pd.Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]), pd.Series(['a',...
(obj): a = hash_pandas_object(obj) b = hash_pandas_object(obj) if isinstance(a, np.ndarray): np.testing.assert_equal(a, b) else: assert_eq(a, b)
test_hash_pandas_object
identifier_name
test_hashing.py
import numpy as np import pandas as pd import pytest from dask.dataframe.hashing import hash_pandas_object from dask.dataframe.utils import assert_eq @pytest.mark.parametrize('obj', [ pd.Series([1, 2, 3]), pd.Series([1.0, 1.5, 3.2]), pd.Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]), pd.Series(['a',...
a = hash_pandas_object(obj) b = hash_pandas_object(obj) if isinstance(a, np.ndarray): np.testing.assert_equal(a, b) else: assert_eq(a, b)
identifier_body
pre_NAMD.py
# pre_NAMD.py # Creates the files used for NAMD based on the .pdb file dowloaded from PDB bank # # Usage: # python pre_NAMD.py $PDBID # # $PDBID=the 4 characters identification code of the .pdb file # # Input: # $PDBID.pdb: .pdb file downloaded from PDB bank # # Output: # $PDBID_p.pdb: .pdb file with water mole...
mypath = os.path.realpath(__file__) tclpath = os.path.split(mypath)[0] + os.path.sep + 'tcl' + os.path.sep pdbid = sys.argv[1] logfile = pdbid+'.log' # Using the right path of VMD vmd = "/Volumes/VMD-1.9.2/VMD 1.9.2.app/Contents/vmd/vmd_MACOSXX86" print("Input: "+pdbid+".pdb") # Remove water print("Remove water..") ...
print_error("Usage: python pre_NAMD.py $PDBID") sys.exit(-1)
conditional_block
pre_NAMD.py
# pre_NAMD.py # Creates the files used for NAMD based on the .pdb file dowloaded from PDB bank # # Usage: # python pre_NAMD.py $PDBID # # $PDBID=the 4 characters identification code of the .pdb file # # Input: # $PDBID.pdb: .pdb file downloaded from PDB bank # # Output: # $PDBID_p.pdb: .pdb file with water mole...
(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) # main if len(sys.argv) != 2: print_error("Usage: python pre_NAMD.py $PDBID") sys.exit(-1) mypath = os.path.realpath(__file__) tclpath = os.path.split(mypath)[0] + os.path.sep + 'tcl' + os.path.sep pdbid = sys.argv[1] logfile = pdbid+'.log' # Using...
print_error
identifier_name