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
focus_peak_cam1.rs
/* * Copyright (C) 2015 The Android Open Source Project
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License ...
* * 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
random_line_split
focus_peak_cam1.rs
/* * Copyright (C) 2015 The Android Open Source Project * * 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-...
if(rgb.r <=0 +factor && rgb.g <= 0 +factor && rgb.b <= 0 +factor) { rgb.r =0; rgb.g = 0; rgb.b = 255; } if (rgb.r > 255) rgb.r = 255; if(rgb.r < 0) rgb.r = 0; if (rgb.g > 255) rgb.g = 255; if(rgb.g < 0) rgb.g = 0; if (rgb.b > 255) rgb.b = 255; if(rgb.b < 0) ...
{ rgb.r =255; rgb.g = 0; rgb.b = 0; }
conditional_block
bcbio_setup_genome.py
return out_file def _output_gff3(gff3_file, out_file, dialect): db = gffutils.create_db(gff3_file, ":memory:") with file_transaction(out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: for feature in DataIterator(db.features_of_type("exon"), dialect=dialect): ...
attr = {"transcript_id": transcript_id, "gene_id": gene_id, "gene_biotype": biotype} attributes = gffutils.attributes.Attributes(attr) feature.attributes = attributes print(feature, file=out_handle, end="") def _is_from_ncbi(gff3_...
gene_key = "gene" id_spec = {"gene": gene_key} db = gffutils.create_db(gff3_file, ":memory:", id_spec=id_spec) with file_transaction(out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: for feature in DataIterator(db.features_of_type("exon"), dialect=dialect): ...
identifier_body
bcbio_setup_genome.py
else: return filename def gff3_to_gtf(gff3_file): dialect = {'field separator': '; ', 'fmt': 'gtf', 'keyval separator': ' ', 'leading semicolon': False, 'multival separator': ',', 'quoted GFF2 values': True, 'or...
subprocess.check_call("gzip -cd %s > %s" % (filename, stem), shell=True) return stem
conditional_block
bcbio_setup_genome.py
(gff3_file): dialect = {'field separator': '; ', 'fmt': 'gtf', 'keyval separator': ' ', 'leading semicolon': False, 'multival separator': ',', 'quoted GFF2 values': True, 'order': ['gene_id', 'transcript_id'], ...
gff3_to_gtf
identifier_name
bcbio_setup_genome.py
_id = [] for char in list(rec.id): if char in ALLOWED_CONTIG_NAME_CHARS: out_id.append(char) else: out_id.append("_") rec.id = "".join(out_id) rec.description = "" return rec def install_gtf_file(build_dir, gtf, build): out_file = os.path.join(build_dir, RNAS...
random_line_split
MeasureDialog.js
buttons = this.panel.children(); } buttons.each(function() { $(this).data("active", false); var type = $(this).data("type"); self.controls[type].deactivate(); self.renderButton($(this).find("img"), false); }); }, /** * Deactivate the result div and cursor div */ deactivateResultDiv: func...
else { measure = measure.toFixed(this.decimals_km); } if (e.type==="measure") { // Get the position of the resultDiv var p = $("#measure-resultDiv input").offset(); this.cursorDiv.css("z-index", "5000"); // this.cursorDiv.appendTo("body"); this.cursorDiv.animate({ "left": p.left+"px", ...
{ measure = measure.toFixed(this.decimals_m); }
conditional_block
MeasureDialog.js
Epsg, easting, northing) { var p = sMap.util.projectPoint(fromEpsg, toEpsg, easting, northing); var dec = this.projections[toEpsg].decimals; this.displayCoordinates(p.x.toFixed(dec), p.y.toFixed(dec)); }, /** * If any of the coordinates is out of bounds or not a number, display a message. * * @param...
// title: this.lang.titleLine, // displayClass: "btnMeasureLine", // trigger: function() { // self.toggleControl("line"); // }
random_line_split
TimerNode.js
/** * @author sunag / http://www.sunag.com.br/ */ import { FloatNode } from '../inputs/FloatNode.js'; import { NodeLib } from '../core/NodeLib.js'; function
( scale, scope, timeScale ) { FloatNode.call( this ); this.scale = scale !== undefined ? scale : 1; this.scope = scope || TimerNode.GLOBAL; this.timeScale = timeScale !== undefined ? timeScale : scale !== undefined; } TimerNode.GLOBAL = 'global'; TimerNode.LOCAL = 'local'; TimerNode.DELTA = 'delta'; TimerNode...
TimerNode
identifier_name
TimerNode.js
/** * @author sunag / http://www.sunag.com.br/ */ import { FloatNode } from '../inputs/FloatNode.js'; import { NodeLib } from '../core/NodeLib.js'; function TimerNode( scale, scope, timeScale ) { FloatNode.call( this );
this.timeScale = timeScale !== undefined ? timeScale : scale !== undefined; } TimerNode.GLOBAL = 'global'; TimerNode.LOCAL = 'local'; TimerNode.DELTA = 'delta'; TimerNode.prototype = Object.create( FloatNode.prototype ); TimerNode.prototype.constructor = TimerNode; TimerNode.prototype.nodeType = "Timer"; TimerNode...
this.scale = scale !== undefined ? scale : 1; this.scope = scope || TimerNode.GLOBAL;
random_line_split
TimerNode.js
/** * @author sunag / http://www.sunag.com.br/ */ import { FloatNode } from '../inputs/FloatNode.js'; import { NodeLib } from '../core/NodeLib.js'; function TimerNode( scale, scope, timeScale )
TimerNode.GLOBAL = 'global'; TimerNode.LOCAL = 'local'; TimerNode.DELTA = 'delta'; TimerNode.prototype = Object.create( FloatNode.prototype ); TimerNode.prototype.constructor = TimerNode; TimerNode.prototype.nodeType = "Timer"; TimerNode.prototype.getReadonly = function () { // never use TimerNode as readonly but...
{ FloatNode.call( this ); this.scale = scale !== undefined ? scale : 1; this.scope = scope || TimerNode.GLOBAL; this.timeScale = timeScale !== undefined ? timeScale : scale !== undefined; }
identifier_body
TimerNode.js
/** * @author sunag / http://www.sunag.com.br/ */ import { FloatNode } from '../inputs/FloatNode.js'; import { NodeLib } from '../core/NodeLib.js'; function TimerNode( scale, scope, timeScale ) { FloatNode.call( this ); this.scale = scale !== undefined ? scale : 1; this.scope = scope || TimerNode.GLOBAL; thi...
return data; }; NodeLib.addKeyword( 'time', function () { return new TimerNode(); } ); export { TimerNode };
{ data = this.createJSONNode( meta ); data.scope = this.scope; data.scale = this.scale; data.timeScale = this.timeScale; }
conditional_block
http-auth.providers.ts
import { HttpClient, HttpHandler } from '@angular/common/http'; import { Http, XHRBackend, RequestOptions } from '@angular/http'; import { HttpService } from './http.service'; import { CsrfService } from './csrf.service'; import { HttpErrorHandlerServic...
(csrfService: CsrfService , httpErrorHandlerService: HttpErrorHandlerService , handler: HttpHandler , tokenService: TokenService , xhrBackend: XHRBackend) { let angularHttp = new HttpClient(handler); return new HttpService(angularHttp, httpErrorHandlerService, csrfService, tokenService); } export const Au...
authHttpFactory
identifier_name
http-auth.providers.ts
import { HttpClient, HttpHandler } from '@angular/common/http'; import { Http, XHRBackend, RequestOptions } from '@angular/http'; import { HttpService } from './http.service'; import { CsrfService } from './csrf.service'; import { HttpErrorHandlerServic...
export const AuthHttpProviders = [ { provide: Http, useFactory: authHttpFactory, deps: [ CsrfService, HttpErrorHandlerService, RequestOptions, TokenService, XHRBackend ] } ];
{ let angularHttp = new HttpClient(handler); return new HttpService(angularHttp, httpErrorHandlerService, csrfService, tokenService); }
identifier_body
http-auth.providers.ts
RequestOptions } from '@angular/http'; import { HttpService } from './http.service'; import { CsrfService } from './csrf.service'; import { HttpErrorHandlerService } from './http-error-handler.service'; import { TokenService } from './token.servi...
import { HttpClient, HttpHandler } from '@angular/common/http'; import { Http, XHRBackend,
random_line_split
globals_test.py
# Copyright The OpenTelemetry Authors #
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing ...
# 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
random_line_split
globals_test.py
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
def tearDown(self) -> None: super().tearDown() reset_trace_globals() class MetricsGlobalsTest(unittest.TestCase): """Resets metrics API globals in setUp/tearDown Use as a base class or mixin for your test that modifies metrics API globals. """ def setUp(self) -> None: s...
super().setUp() reset_trace_globals()
identifier_body
globals_test.py
# Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
(self) -> None: super().tearDown() reset_metrics_globals()
tearDown
identifier_name
index.tsx
import * as React from 'react' import {WebView} from 'react-native-webview' import {openUrl, canOpenUrl} from '@frogpond/open-url' import type {StyleProp, ViewStyle} from 'react-native' type Props = { html: string baseUrl?: string
} export class HtmlContent extends React.Component<Props> { _webview: WebView onNavigationStateChange = ({url}: {url: string}) => { // iOS navigates to about:blank when you provide raw HTML to a webview. // Android navigates to data:text/html;$stuff (that is, the document you passed) instead. if (!canOpenUrl(...
style?: StyleProp<ViewStyle>
random_line_split
index.tsx
import * as React from 'react' import {WebView} from 'react-native-webview' import {openUrl, canOpenUrl} from '@frogpond/open-url' import type {StyleProp, ViewStyle} from 'react-native' type Props = { html: string baseUrl?: string style?: StyleProp<ViewStyle> } export class HtmlContent extends React.Component<Prop...
this._webview.stopLoading() this._webview.goBack() return openUrl(url) } render() { return ( <WebView ref={(ref) => (this._webview = ref)} onNavigationStateChange={this.onNavigationStateChange} source={{html: this.props.html, baseUrl: this.props.baseUrl}} style={this.props.style} us...
{ return }
conditional_block
index.tsx
import * as React from 'react' import {WebView} from 'react-native-webview' import {openUrl, canOpenUrl} from '@frogpond/open-url' import type {StyleProp, ViewStyle} from 'react-native' type Props = { html: string baseUrl?: string style?: StyleProp<ViewStyle> } export class HtmlContent extends React.Component<Prop...
() { return ( <WebView ref={(ref) => (this._webview = ref)} onNavigationStateChange={this.onNavigationStateChange} source={{html: this.props.html, baseUrl: this.props.baseUrl}} style={this.props.style} useWebKit={true} /> ) } }
render
identifier_name
pages.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
row += 1 except NoSuchElementException as e: return names return names
try: elt = self.find_element(By.ID, 'spn_student_name_%d' % row) names.append(elt.text)
random_line_split
pages.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
return names
ry: elt = self.find_element(By.ID, 'spn_student_name_%d' % row) names.append(elt.text) row += 1 except NoSuchElementException as e: return names
conditional_block
pages.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
self, row: int = 1): return self.find_element(By.ID, 'td_student_%d' % row).text def find_name_in_table(self): names = [] row = 1 last = False while not last: try: elt = self.find_element(By.ID, 'spn_student_name_%d' % row) names.a...
ind_registration_id_in_table(
identifier_name
pages.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
def find_name_in_table(self): names = [] row = 1 last = False while not last: try: elt = self.find_element(By.ID, 'spn_student_name_%d' % row) names.append(elt.text) row += 1 except NoSuchElementException as e:...
eturn self.find_element(By.ID, 'td_student_%d' % row).text
identifier_body
querystring_builder.py
import logging from office365.sharepoint.helpers.utils import to_camel logger = logging.getLogger(__name__) class QueryStringBuilder: """class to map web-querystring dictionary to sharepoint-querystring""" date_operators = ['ge', 'gt', 'le', 'lt'] mapping_operator = { 'gte': 'ge', 'gt': ...
elif operator == 'substringof': values = filter_value.split(',') query = ' or '.join([f"{operator}('{value}', {filter_name})" for value in values]) else: values = filter_value.split(',') query = ' or '.join([f"{filter_name} {opera...
values = ["{}T00:00:00Z".format(filter_value)] # 2016-03-26 query = ' or '.join([f"{filter_name} {operator} datetime'{value}'" for value in values])
conditional_block
querystring_builder.py
import logging from office365.sharepoint.helpers.utils import to_camel logger = logging.getLogger(__name__) class QueryStringBuilder: """class to map web-querystring dictionary to sharepoint-querystring""" date_operators = ['ge', 'gt', 'le', 'lt'] mapping_operator = { 'gte': 'ge', 'gt': ...
logger.info(query) return str(" and ".join(filter_queries)) def get_querystring(self): return self.get_filter_querystring() or ''
random_line_split
querystring_builder.py
import logging from office365.sharepoint.helpers.utils import to_camel logger = logging.getLogger(__name__) class QueryStringBuilder: """class to map web-querystring dictionary to sharepoint-querystring""" date_operators = ['ge', 'gt', 'le', 'lt'] mapping_operator = { 'gte': 'ge', 'gt': ...
(self): return self.get_filter_querystring() or ''
get_querystring
identifier_name
querystring_builder.py
import logging from office365.sharepoint.helpers.utils import to_camel logger = logging.getLogger(__name__) class QueryStringBuilder: """class to map web-querystring dictionary to sharepoint-querystring""" date_operators = ['ge', 'gt', 'le', 'lt'] mapping_operator = { 'gte': 'ge', 'gt': ...
return self.get_filter_querystring() or ''
identifier_body
tuple.rs
//! [Lambda-encoded `n`-tuple](https://www.mathstat.dal.ca/~selinger/papers/lambdanotes.pdf) //!
/// # Example /// ``` /// # #[macro_use] extern crate lambda_calculus; /// # fn main() { /// use lambda_calculus::term::*; /// use lambda_calculus::*; /// /// assert_eq!( /// tuple!(1.into_church(), 2.into_church()), /// abs(app!(Var(1), 1.into_church(), 2.into_church())) /// ); /// /// assert_eq!( /// tupl...
//! This module contains the `tuple` and `pi` macros. /// A macro for creating lambda-encoded tuples. ///
random_line_split
masq.py
# Copyright (c) Metaswitch Networks 2015. All rights reserved. import logging from calico.felix.actor import Actor, actor_message from calico.felix.futils import IPV4, IPV6 from calico.felix.ipsets import Ipset, FELIX_PFX _log = logging.getLogger(__name__) ALL_POOLS_SET_NAME = FELIX_PFX + "all-ipam-pools" MASQ_POOL...
else: _log.info("No masquerade-enabled pools present. " "Removing rules and ipsets.") # Ensure that the rule doesn't exist before we try to remove # our ipsets. Have to make a blocking call so that we don't # try to r...
_log.info("There are masquerade-enabled pools present. " "Updating.") self._all_pools_ipset.replace_members(all_cidrs) self._masq_pools_ipset.replace_members(masq_enabled_cidrs) # Enable masquerading for traffic coming from pools that ...
conditional_block
masq.py
# Copyright (c) Metaswitch Networks 2015. All rights reserved. import logging from calico.felix.actor import Actor, actor_message from calico.felix.futils import IPV4, IPV6 from calico.felix.ipsets import Ipset, FELIX_PFX _log = logging.getLogger(__name__) ALL_POOLS_SET_NAME = FELIX_PFX + "all-ipam-pools" MASQ_POOL...
@actor_message() def on_ipam_pool_updated(self, pool_id, pool): if self.pools_by_id.get(pool_id) != pool: if pool is None: _log.info("IPAM pool deleted: %s", pool_id) del self.pools_by_id[pool_id] else: _log.info("IPAM pool %s upd...
_log.info("Applying IPAM pool snapshot with %s pools", len(pools_by_id)) self.pools_by_id.clear() self.pools_by_id.update(pools_by_id) self._dirty = True
identifier_body
masq.py
# Copyright (c) Metaswitch Networks 2015. All rights reserved. import logging from calico.felix.actor import Actor, actor_message from calico.felix.futils import IPV4, IPV6 from calico.felix.ipsets import Ipset, FELIX_PFX _log = logging.getLogger(__name__) ALL_POOLS_SET_NAME = FELIX_PFX + "all-ipam-pools" MASQ_POOL...
_log.info("No masquerade-enabled pools present. " "Removing rules and ipsets.") # Ensure that the rule doesn't exist before we try to remove # our ipsets. Have to make a blocking call so that we don't # try to remove the ipsets be...
async=True) else:
random_line_split
masq.py
# Copyright (c) Metaswitch Networks 2015. All rights reserved. import logging from calico.felix.actor import Actor, actor_message from calico.felix.futils import IPV4, IPV6 from calico.felix.ipsets import Ipset, FELIX_PFX _log = logging.getLogger(__name__) ALL_POOLS_SET_NAME = FELIX_PFX + "all-ipam-pools" MASQ_POOL...
(Actor): def __init__(self, ip_type, iptables_mgr): super(MasqueradeManager, self).__init__(qualifier=str(ip_type)) assert ip_type in (IPV4, IPV6) assert iptables_mgr.table == "nat" self.ip_type = ip_type self.pools_by_id = {} self._iptables_mgr = iptables_mgr ...
MasqueradeManager
identifier_name
IconFormatListBulleted.js
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconFormatListBulleted(props: IconProps)
IconFormatListBulleted.displayName = 'IconFormatListBulleted'; IconFormatListBulleted.category = 'editor';
{ const iconProps = { rtl: true, ...props }; return ( <Icon {...iconProps}> <g> <path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-...
identifier_body
IconFormatListBulleted.js
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function IconFormatListBulleted(props: IconProps) {
const iconProps = { rtl: true, ...props }; return ( <Icon {...iconProps}> <g> <path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.6...
random_line_split
IconFormatListBulleted.js
/* @flow */ import React from 'react'; import Icon from 'mineral-ui/Icon'; import type { IconProps } from 'mineral-ui/Icon/types'; /* eslint-disable prettier/prettier */ export default function
(props: IconProps) { const iconProps = { rtl: true, ...props }; return ( <Icon {...iconProps}> <g> <path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s....
IconFormatListBulleted
identifier_name
script_analysis.py
__author__ = 'junz' import os import matplotlib.pyplot as plt import retinotopic_mapping.RetinotopicMapping as rm from tools import FileTools as ft trialName = "160211_M214522_Trial1.pkl" isSave = True params = {'phaseMapFilterSigma': 1., 'signMapFilterSigma': 9., 'signMapThr': 0.3, 'e...
ft.saveFile(trial.getName()+'.pkl',trialDict)
conditional_block
script_analysis.py
__author__ = 'junz'
import os import matplotlib.pyplot as plt import retinotopic_mapping.RetinotopicMapping as rm from tools import FileTools as ft trialName = "160211_M214522_Trial1.pkl" isSave = True params = {'phaseMapFilterSigma': 1., 'signMapFilterSigma': 9., 'signMapThr': 0.3, 'eccMapFilterSigma': 15...
random_line_split
dom.rs
Mut}; use std::marker::PhantomData; use std::ops::BitOr; use std::sync::Arc; use string_cache::{Atom, Namespace}; /// Opaque type stored in type-unsafe work queues for parallel layout. /// Must be transmutable to and from TNode. pub type UnsafeNode = (usize, usize); /// An opaque handle to a node, which, unlike Unsaf...
/// initialized. /// /// FIXME(pcwalton): Do this as part of fragment building instead of in a traversal. fn initialize_data(self); /// While doing a reflow, the node at the root has no parent, as far as we're /// concerned. This method returns `None` at the reflow root. fn layout_parent_no...
fn opaque(&self) -> OpaqueNode; /// Initializes style and layout data for the node. No-op if the data is already
random_line_split
dom.rs
Mut}; use std::marker::PhantomData; use std::ops::BitOr; use std::sync::Arc; use string_cache::{Atom, Namespace}; /// Opaque type stored in type-unsafe work queues for parallel layout. /// Must be transmutable to and from TNode. pub type UnsafeNode = (usize, usize); /// An opaque handle to a node, which, unlike Unsaf...
} } pub struct TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> { stack: Vec<ConcreteNode>, // Satisfy the compiler about the unused lifetime. phantom: PhantomData<&'a ()>, } impl<'a, ConcreteNode> TreeIterator<'a, ConcreteNode> where ConcreteNode: TNode<'a> { fn new(root: ConcreteNod...
{ let mut next = ::selectors::Element::next_sibling_element(self); while let Some(sib) = next { let sib_node = sib.as_node(); sib_node.dirty_self(); sib_node.dirty_descendants(); next = ::selectors::Element::next_sibling_element(&si...
conditional_block
dom.rs
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf, Hash, Eq, Deserialize, Serialize)] pub struct OpaqueNode(pub usize); impl OpaqueNode { /// Returns the address of this node, for debugging purposes. #[inline] pub fn id(&self) -> usize { let OpaqueNode(pointer) = *self; pointer } } pu...
next
identifier_name
connection.rs
//! The connection module contains the Connection struct, that provides an interface for a Server //! Query connection. use channel::ChannelList; use client::ClientList; use command::Command; use error; use error::{Error, SQError}; use map::*; use std::fmt; use std::io::prelude::*; use std::io::BufReader; use std::net...
let s = self.send_command(&"channellist")?; let cl = s.parse()?; Ok(cl) } /// # common errors /// If a client disconnects between the getting of the clientlist and the getting of the client /// information, then there will be an error 512, because the client id is invalid. p...
Ok(clients) } /// sends the channellist command to the server and parses the result. pub fn channellist(&mut self) -> error::Result<ChannelList> {
random_line_split
connection.rs
//! The connection module contains the Connection struct, that provides an interface for a Server //! Query connection. use channel::ChannelList; use client::ClientList; use command::Command; use error; use error::{Error, SQError}; use map::*; use std::fmt; use std::io::prelude::*; use std::io::BufReader; use std::net...
/// sends the channellist command to the server and parses the result. pub fn channellist(&mut self) -> error::Result<ChannelList> { let s = self.send_command(&"channellist")?; let cl = s.parse()?; Ok(cl) } /// # common errors /// If a client disconnects between the gettin...
{ let mut clients = self.clientlist()?; for client in clients.as_mut().iter_mut() { let command = format!("clientinfo clid={}", client.clid); let str = self.send_command(&command)?; let map = to_map(&str); client.mut_from_map(&map); } Ok(cl...
identifier_body
connection.rs
//! The connection module contains the Connection struct, that provides an interface for a Server //! Query connection. use channel::ChannelList; use client::ClientList; use command::Command; use error; use error::{Error, SQError}; use map::*; use std::fmt; use std::io::prelude::*; use std::io::BufReader; use std::net...
(&mut self, nickname: &str) -> error::Result<()> { let map = self.send_command_to_map(&"whoami")?; let id = map .get("client_id") .ok_or("error at collecting client_id")?; let cmd = format!("clientupdate clid={} client_nickname={}", id, nickname); let _ = self.sen...
change_nickname
identifier_name
connection.rs
//! The connection module contains the Connection struct, that provides an interface for a Server //! Query connection. use channel::ChannelList; use client::ClientList; use command::Command; use error; use error::{Error, SQError}; use map::*; use std::fmt; use std::io::prelude::*; use std::io::BufReader; use std::net...
connection.read_line(&mut tmp)?; Ok(connection) } fn read_line<'a>(&mut self, buf: &'a mut String) -> error::Result<&'a str> { let _ = self.conn.read_line(buf)?; Ok(buf.trim_left_matches(char::is_control)) } fn get_stream_mut(&mut self) -> &mut net::TcpStream { ...
{ return Err(From::from("the given server is not a TS3 server")); }
conditional_block
build.js
'use strict'; var streamArray = require('stream-array'),
module.exports = build; module.exports.description = 'build documentation'; /** * Add yargs parsing for the build command * @param {Object} yargs module instance * @returns {Object} yargs with options * @private */ module.exports.parseArgs = function (yargs) { return sharedOptions.sharedOutputOptions( shar...
sharedOptions = require('./shared_options'), fs = require('fs'), vfs = require('vinyl-fs'), chokidar = require('chokidar'), debounce = require('debounce');
random_line_split
build.js
'use strict'; var streamArray = require('stream-array'), sharedOptions = require('./shared_options'), fs = require('fs'), vfs = require('vinyl-fs'), chokidar = require('chokidar'), debounce = require('debounce'); module.exports = build; module.exports.description = 'build documentation'; /** * Add yargs p...
(err, comments) { if (err) { if (typeof callback === 'function') { return callback(err); } throw err; } documentation.formats[buildOptions.format](comments, formatterOptions, onFormatted); } function onFormatted(err, output) { if (buildOptions.watch) { updateWatcher...
onDocumented
identifier_name
build.js
'use strict'; var streamArray = require('stream-array'), sharedOptions = require('./shared_options'), fs = require('fs'), vfs = require('vinyl-fs'), chokidar = require('chokidar'), debounce = require('debounce'); module.exports = build; module.exports.description = 'build documentation'; /** * Add yargs p...
function onFormatted(err, output) { if (buildOptions.watch) { updateWatcher(); } if (typeof callback === 'function') { callback(null, output); } else if (buildOptions.output === 'stdout') { process.stdout.write(output); } else if (Array.isArray(output)) { streamArray(out...
{ if (err) { if (typeof callback === 'function') { return callback(err); } throw err; } documentation.formats[buildOptions.format](comments, formatterOptions, onFormatted); }
identifier_body
build.js
'use strict'; var streamArray = require('stream-array'), sharedOptions = require('./shared_options'), fs = require('fs'), vfs = require('vinyl-fs'), chokidar = require('chokidar'), debounce = require('debounce'); module.exports = build; module.exports.description = 'build documentation'; /** * Add yargs p...
function updateWatcher() { documentation.expandInputs(inputs, options, addNewFiles); } function addNewFiles(err, files) { watcher.add(files.map(function (data) { return data.file; })); } }
{ var watcher = chokidar.watch(inputs); watcher.on('all', debounce(generator, 300)); }
conditional_block
stop-instance.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_ec2::{Client, Error, Region, PKG_VERSION}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The AWS Region. ...
let shared_config = aws_config::from_env().region(region_provider).load().await; let client = Client::new(&shared_config); stop_instance(&client, &instance_id).await }
{ println!("EC2 client version: {}", PKG_VERSION); println!( "Region: {}", region_provider.region().await.unwrap().as_ref() ); println!("Instance ID: {}", instance_id); println!(); }
conditional_block
stop-instance.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_ec2::{Client, Error, Region, PKG_VERSION}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The AWS Region. ...
() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { region, instance_id, verbose, } = Opt::from_args(); let region_provider = RegionProviderChain::first_try(region.map(Region::new)) .or_default_provider() .or_else(Region::new("us-west-2")); p...
main
identifier_name
stop-instance.rs
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_config::meta::region::RegionProviderChain; use aws_sdk_ec2::{Client, Error, Region, PKG_VERSION}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The AWS Region. ...
/// If not supplied, uses the value of the **AWS_REGION** environment variable. /// If the environment variable is not set, defaults to **us-west-2**. /// * `[-v]` - Whether to display additional information. #[tokio::main] async fn main() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { ...
/// /// * `-i INSTANCE-ID` - The ID of the instances to stop. /// * `[-r REGION]` - The Region in which the client is created.
random_line_split
calibrate_arm_a1r1.py
#Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED...
(M3CalibrateActuatorEcA1R1): def __init__(self): M3CalibrateActuatorEcA1R1.__init__(self) self.joint_names=['Shoulder J0', 'Shoulder J1', 'Shoulder J2', 'Elbow J3', 'Wrist J4', 'Wrist J5', 'Wrist J6'] self.config_default=[ config_default_a1_j0, config_default_a1_j1, ...
M3Calibrate_Arm_A1R1
identifier_name
calibrate_arm_a1r1.py
#Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED...
'Shoulder J2', 'Elbow J3', 'Wrist J4', 'Wrist J5', 'Wrist J6'] self.config_default=[ config_default_a1_j0, config_default_a1_j1, config_default_a1_j2, config_default_a1_j3, config_default_a1_j4, config_default_a1_j5, config_default_a1_j6] def start(self,ctype): ...
'Shoulder J1',
random_line_split
calibrate_arm_a1r1.py
#Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED...
if not M3CalibrateActuatorEcA1R1.start(self,ctype): return False self.jid=int(self.comp_ec.name[self.comp_ec.name.find('_j')+2:]) self.param_internal=self.config_default[self.jid]['param_internal'] self.calib_default=self.config_default[self.jid]['calib'] self.param_default=self.config_default[self.jid]['p...
def __init__(self): M3CalibrateActuatorEcA1R1.__init__(self) self.joint_names=['Shoulder J0', 'Shoulder J1', 'Shoulder J2', 'Elbow J3', 'Wrist J4', 'Wrist J5', 'Wrist J6'] self.config_default=[ config_default_a1_j0, config_default_a1_j1, config_default_a1_j2, con...
identifier_body
calibrate_arm_a1r1.py
#Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED...
self.jid=int(self.comp_ec.name[self.comp_ec.name.find('_j')+2:]) self.param_internal=self.config_default[self.jid]['param_internal'] self.calib_default=self.config_default[self.jid]['calib'] self.param_default=self.config_default[self.jid]['param'] print 'Calibrating joint',self.joint_names[self.jid] retur...
return False
conditional_block
app02-functions.js
'use strict' // const foo = (msg) => { // Função anónima... MAS o this tem outro significado
// if(msg == undefined) return console.log('Empty msg') if(!msg) return console.log('Empty msg') let str = '' for(let i = 0; i < arguments.length; i++){ str += arguments[i] + ', ' } console.log('this = ' + this + '; ' + msg + ' (args = ' + str + ')') } foo() foo('ola mundo') foo(3,...
// const foo = function(msg) { // Função anónima function foo(msg) {
random_line_split
app02-functions.js
'use strict' // const foo = (msg) => { // Função anónima... MAS o this tem outro significado // const foo = function(msg) { // Função anónima function foo(msg) { // if(msg == undefined) return console.log('Empty msg') if(!msg) return console.log('Empty msg') let str = '' for(let i = 0; i < argumen...
console.log('this = ' + this + '; ' + msg + ' (args = ' + str + ')') } foo() foo('ola mundo') foo(3,4,4,5) foo.apply(null, [3,4,4,5]) foo.call(null, 'ola', 87364, 22, 'abc', 2, 3) const d = new foo(89) // !!!!!! NÃO FAZER const g = foo g('Calling foo through g') new g(76) // !!!!!! NÃO FAZER const obj = {} /...
str += arguments[i] + ', ' }
conditional_block
app02-functions.js
'use strict' // const foo = (msg) => { // Função anónima... MAS o this tem outro significado // const foo = function(msg) { // Função anónima function foo(msg) {
) foo('ola mundo') foo(3,4,4,5) foo.apply(null, [3,4,4,5]) foo.call(null, 'ola', 87364, 22, 'abc', 2, 3) const d = new foo(89) // !!!!!! NÃO FAZER const g = foo g('Calling foo through g') new g(76) // !!!!!! NÃO FAZER const obj = {} // <=> new Object() obj.xpto = foo obj.xpto(345) // this = obj obj.xpto....
// if(msg == undefined) return console.log('Empty msg') if(!msg) return console.log('Empty msg') let str = '' for(let i = 0; i < arguments.length; i++){ str += arguments[i] + ', ' } console.log('this = ' + this + '; ' + msg + ' (args = ' + str + ')') } foo(
identifier_body
app02-functions.js
'use strict' // const foo = (msg) => { // Função anónima... MAS o this tem outro significado // const foo = function(msg) { // Função anónima function foo(ms
{ // if(msg == undefined) return console.log('Empty msg') if(!msg) return console.log('Empty msg') let str = '' for(let i = 0; i < arguments.length; i++){ str += arguments[i] + ', ' } console.log('this = ' + this + '; ' + msg + ' (args = ' + str + ')') } foo() foo('ola mundo') foo(...
g)
identifier_name
works.js
function EditWorksCtrl($scope, QuoteService)
} $scope.up = function(idx) { $scope.utils.up($scope.editing.works, idx); $scope.qot.initRowNumbers($scope.editing.works); } $scope.loadWork = function(idx) { $scope.$log.info("load Work edit works " + idx); $scope.work = $scope.editing.works[idx]; } } EditWorksCtrl.$inject = ['$scope', 'Q...
{ QuoteService.findOrCreateForWorks($scope); $scope.remove = function(idx) { $scope.utils.remove($scope.editing.works, idx); $scope.qot.initRowNumbers($scope.editing.works); $scope.qot.updateWorksTotal($scope, $scope.editing); } $scope.add = function(idx) { idx = $scope.utils.add($scope.editi...
identifier_body
works.js
function EditWorksCtrl($scope, QuoteService) { QuoteService.findOrCreateForWorks($scope); $scope.remove = function(idx) { $scope.utils.remove($scope.editing.works, idx); $scope.qot.initRowNumbers($scope.editing.works); $scope.qot.updateWorksTotal($scope, $scope.editing); } $scope.add = function(i...
} $scope.loadWork = function(idx) { $scope.$log.info("load Work edit works " + idx); $scope.work = $scope.editing.works[idx]; } } EditWorksCtrl.$inject = ['$scope', 'QuoteService'];
random_line_split
works.js
function
($scope, QuoteService) { QuoteService.findOrCreateForWorks($scope); $scope.remove = function(idx) { $scope.utils.remove($scope.editing.works, idx); $scope.qot.initRowNumbers($scope.editing.works); $scope.qot.updateWorksTotal($scope, $scope.editing); } $scope.add = function(idx) { idx = $scope...
EditWorksCtrl
identifier_name
avatar.service.ts
import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import { Avatar } from "./avatar.model"; import { Observable } from "rxjs"; import { ExceptionService } from "../core"; @Injectable() export class
{ constructor(private _http: Http) { } public add(entity: Avatar) { return this._http .post(`${this._baseUrl}/api/avatar/add`, entity) .map(data => data.json()) .catch(err => { return Observable.of(false); }); } public get() { ...
AvatarService
identifier_name
avatar.service.ts
import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import { Avatar } from "./avatar.model"; import { Observable } from "rxjs"; import { ExceptionService } from "../core"; @Injectable() export class AvatarService { constructor(private _http: Http) { } public add(entity: Avatar) {...
}
{ return ""; }
identifier_body
avatar.service.ts
import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import { Avatar } from "./avatar.model"; import { Observable } from "rxjs"; import { ExceptionService } from "../core"; @Injectable() export class AvatarService { constructor(private _http: Http) { } public add(entity: Avatar) {...
return Observable.of(false); }); } public getById(options: { id: number }) { return this._http .get(`${this._baseUrl}/api/avatar/getById?id=${options.id}`) .map(data => data.json()) .catch(err => { return Observable.of(fals...
.map(data => data.json()) .catch(err => {
random_line_split
vgg16.py
9.1556) """ from __future__ import print_function from __future__ import absolute_import import warnings from keras.models import Model from keras.layers import Flatten, Dense, Input,Lambda from keras.layers import Convolution2D, MaxPooling2D from keras.engine.topology import get_source_inputs from keras.utils.layer...
# Block 4 x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv1')(x) x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv2')(x) x = Convolution2D(512, 3, 3, activation='relu', border_mode='same', name='block4_conv3')(x) x = MaxPoolin...
x = Convolution2D(256, 3, 3, activation='relu', border_mode='same', name='block3_conv3')(x) x = MaxPooling2D((2, 2), strides=(2, 2), name='block3_pool')(x)
random_line_split
vgg16.py
9.1556) """ from __future__ import print_function from __future__ import absolute_import import warnings from keras.models import Model from keras.layers import Flatten, Dense, Input,Lambda from keras.layers import Convolution2D, MaxPooling2D from keras.engine.topology import get_source_inputs from keras.utils.layer...
def VGG16(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, classes=1000): """Instantiate the VGG16 architecture, optionally loading weights pre-trained on ImageNet. Note that when using TensorFlow, for best performance you should set `image_dim_orde...
x = x - vgg_mean return x[:,::-1]
identifier_body
vgg16.py
9.1556) """ from __future__ import print_function from __future__ import absolute_import import warnings from keras.models import Model from keras.layers import Flatten, Dense, Input,Lambda from keras.layers import Convolution2D, MaxPooling2D from keras.engine.topology import get_source_inputs from keras.utils.layer...
# Block 1 print("sandeep adding lambda layer buddy good luck ") x = Lambda(img_preprocess,input_shape=(3,224,224),output_shape=(3,224,224))(img_input) x = Convolution2D(64, 3, 3, activation='relu', border_mode='same', name='block1_conv1')(x) x = Convolution2D(64, 3, 3, activation='relu', border_mod...
if not K.is_keras_tensor(input_tensor): img_input = Input(tensor=input_tensor, shape=input_shape) else: img_input = input_tensor
conditional_block
vgg16.py
9.1556) """ from __future__ import print_function from __future__ import absolute_import import warnings from keras.models import Model from keras.layers import Flatten, Dense, Input,Lambda from keras.layers import Convolution2D, MaxPooling2D from keras.engine.topology import get_source_inputs from keras.utils.layer...
(x): x = x - vgg_mean return x[:,::-1] def VGG16(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, classes=1000): """Instantiate the VGG16 architecture, optionally loading weights pre-trained on ImageNet. Note that when using TensorFlow, for best perfor...
img_preprocess
identifier_name
menu.py
import random import telegram MENU = [[('handler', 'Venues ☕', 'foursquare-location-choice'), ('handler', 'Weather 🌤', 'weather-show'), ('handler', 'News 📰', 'news-get-entry')], [('handler', 'Vinci 🌇', 'vinci-upload-image'), ('handler', 'Get Uber 🚘', 'uber-choose-location'), ...
for line in MENU: subkeyboard = [] for row in line: if row[0] == 'handler': subkeyboard.append(row[1]) if subkeyboard: keyboard.append(subkeyboard) return keyboard
ler(query.message, 'main-menu') def get_keyboard(): keyboard = []
identifier_body
menu.py
import random import telegram MENU = [[('handler', 'Venues ☕', 'foursquare-location-choice'), ('handler', 'Weather 🌤', 'weather-show'), ('handler', 'News 📰', 'news-get-entry')], [('handler', 'Vinci 🌇', 'vinci-upload-image'), ('handler', 'Get Uber 🚘', 'uber-choose-location'), ...
bot.handlers['main-menu'] = main_menu bot.callback_handlers['main-menu-callback'] = main_menu_callback def main_menu(message, bot, phrase=None): if not bot.user_get(message.u_id, 'registered'): bot.call_handler(message, 'welcome-message') return if not message.moved: for line...
def register(bot):
random_line_split
menu.py
import random import telegram MENU = [[('handler', 'Venues ☕', 'foursquare-location-choice'), ('handler', 'Weather 🌤', 'weather-show'), ('handler', 'News 📰', 'news-get-entry')], [('handler', 'Vinci 🌇', 'vinci-upload-image'), ('handler', 'Get Uber 🚘', 'uber-choose-location'), ...
bot.call_handler(query.message, 'main-menu') def get_keyboard(): keyboard = [] for line in MENU: subkeyboard = [] for row in line: if row[0] == 'handler': subkeyboard.append(row[1]) if subkeyboard: keyboard.append(subkeyboard) return key...
ssage.moved = True
identifier_name
menu.py
import random import telegram MENU = [[('handler', 'Venues ☕', 'foursquare-location-choice'), ('handler', 'Weather 🌤', 'weather-show'), ('handler', 'News 📰', 'news-get-entry')], [('handler', 'Vinci 🌇', 'vinci-upload-image'), ('handler', 'Get Uber 🚘', 'uber-choose-location'), ...
rkup = telegram.ReplyKeyboardMarkup(keyboard, resize_keyboard=True) bot.telegram.send_message(message.u_id, phrase or random.choice(GREETING_PHRASES), reply_markup=reply_markup) def main_menu_callback(query, bot): query.message.moved = True bot.call_handler(query.message, 'ma...
.text: message.handler = row[2] return bot.call_handler(message, row[2]) keyboard = get_keyboard() reply_ma
conditional_block
check_new_bsd_license.py
#!/usr/bin/env python import sys bsd = ''' Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclai...
result += "missing: " + l + "\n" thiserror = True if thiserror: nerrors += 1 else: result += "ok" if thiserror and autofix: newf = open(filename, "w") for k, v in commentchars.iteritems(): if filename.endswith(k): ...
for l in bsd.split('\n'): if l not in txt:
random_line_split
check_new_bsd_license.py
#!/usr/bin/env python import sys bsd = ''' Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclai...
print result sys.exit(nerrors)
newf = open(filename, "w") for k, v in commentchars.iteritems(): if filename.endswith(k): cmt = v if txt.startswith('#!'): hashbang, rest = txt.split('\n', 1) print >>newf, hashbang else: rest = txt print >>newf, cmt, bsd.re...
conditional_block
graph.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>). # # This program is free software: you ca...
(self): return self._pprint() def _pprint(self, depth=0): s = '%s\n' % self.name for c in self.children: s += '%s`-> %s' % (' ' * depth, c._pprint(depth+1)) return s # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
__str__
identifier_name
graph.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>). # # This program is free software: you ca...
def update_from_db(self, cr): if not len(self): return # update the graph with values from the database (if exist) ## First, we set the default values for each package in graph additional_data = dict.fromkeys(self.keys(), {'id': 0, 'state': 'uninstalled', 'dbdemo': Fals...
max_depth, father = 0, None for n in [Node(x, self, None) for x in info['depends']]: if n.depth >= max_depth: father = n max_depth = n.depth if father: return father.add_child(name, info) else: return Node(name, self, info)
identifier_body
graph.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>). # # This program is free software: you ca...
packages = [] len_graph = len(self) # force additional dependencies for the upgrade process if given # in config file forced_deps = tools.config.get_misc('openupgrade', 'force_deps', '{}') forced_deps = tools.config.get_misc('openupgrade', ...
force = []
conditional_block
graph.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>). # # This program is free software: you ca...
## Then we get the values from the database cr.execute('SELECT name, id, state, demo AS dbdemo, latest_version AS installed_version' ' FROM ir_module_module' ' WHERE name IN %s',(tuple(additional_data),) ) ## and we update the default va...
additional_data = dict.fromkeys(self.keys(), {'id': 0, 'state': 'uninstalled', 'dbdemo': False, 'installed_version': None})
random_line_split
steps.py
from holmium.core import ( Page, Element, Locators, Elements, ElementMap, Section, Sections ) from holmium.core.cucumber import init_steps init_steps() class TestSection(Section): el = Element(Locators.NAME, "el") els = Elements(Locators.NAME, "els") elmap = ElementMap(Locators.NAME, "elmap") class ...
(self, *args, **kwargs): return args, kwargs
do_stuff_var_args
identifier_name
steps.py
from holmium.core import ( Page, Element, Locators, Elements, ElementMap, Section, Sections ) from holmium.core.cucumber import init_steps init_steps() class TestSection(Section): el = Element(Locators.NAME, "el") els = Elements(Locators.NAME, "els") elmap = ElementMap(Locators.NAME, "elmap") class ...
class TestPage(Page): el = Element(Locators.NAME, "el") els = Elements(Locators.NAME, "els") elmap = ElementMap(Locators.NAME, "elmap") sections = TestSections(Locators.NAME, "sections") section = TestSection(Locators.NAME, "section") def do_stuff(self, a, b): return a + b def d...
el = Element(Locators.NAME, "el")
identifier_body
steps.py
from holmium.core import ( Page, Element, Locators, Elements, ElementMap, Section, Sections ) from holmium.core.cucumber import init_steps init_steps() class TestSection(Section): el = Element(Locators.NAME, "el") els = Elements(Locators.NAME, "els") elmap = ElementMap(Locators.NAME, "elmap") class ...
class TestPage(Page): el = Element(Locators.NAME, "el") els = Elements(Locators.NAME, "els") elmap = ElementMap(Locators.NAME, "elmap") sections = TestSections(Locators.NAME, "sections") section = TestSection(Locators.NAME, "section") def do_stuff(self, a, b): return a + b def do_s...
el = Element(Locators.NAME, "el")
random_line_split
AlarmConfigurer.tsx
import * as React from 'react'; import type { ICloudMetricStatistics } from '@spinnaker/core'; import { NumberInput, ReactSelectInput, usePrevious } from '@spinnaker/core'; import { MetricSelector } from './MetricSelector'; import { MetricAlarmChart } from '../../chart/MetricAlarmChart'; import type { IAmazonServerGr...
<div className="col-md-12"> <div className="alert alert-warning"> <p> <i className="fa fa-exclamation-triangle"></i> This scaling policy is configured with multiple alarms. You are only editing the first alarm. </p> <p>To ed...
{multipleAlarms && ( <div className="row">
random_line_split
AlarmConfigurer.tsx
import * as React from 'react'; import type { ICloudMetricStatistics } from '@spinnaker/core'; import { NumberInput, ReactSelectInput, usePrevious } from '@spinnaker/core'; import { MetricSelector } from './MetricSelector'; import { MetricAlarmChart } from '../../chart/MetricAlarmChart'; import type { IAmazonServerGr...
}, [alarm.threshold]); const onChartLoaded = (stats: ICloudMetricStatistics) => setUnit(stats.unit); const onAlarmChange = (key: string, value: any) => { const newAlarm = { ...alarm, [key]: value, }; updateAlarm(newAlarm); }; const onMetricChange = (newAlarm: IScalingPolicyAlarm) =...
{ const updatedStepAdjustments = [...stepAdjustments]; // Always set the first step at the alarm threshold updatedStepAdjustments[0][source] = alarm.threshold; stepsChanged(updatedStepAdjustments); }
conditional_block
base.py
Cleanup(_p.stop) def
(self): # NOTE(stephenfin): We don't start the compute service here as we wish # to configure the host capabilities first. We instead start the # service in the test self.flags(compute_driver='libvirt.LibvirtDriver') def _setup_scheduler_service(self): enabled_filters = CONF...
_setup_compute_service
identifier_name
base.py
Cleanup(_p.stop) def _setup_compute_service(self): # NOTE(stephenfin): We don't start the compute service here as we wish # to configure the host capabilities first. We instead start the # service in the test self.flags(compute_driver='libvirt.LibvirtDriver') def _setup_schedul...
dom = conn.lookupByUUIDString(self.server['id']) dom.complete_job() self.migrate_stub_ran = True class LibvirtNeutronFixture(nova_fixtures.NeutronFixture): """A custom variant of the stock neutron fixture with more networks. There are three networks available: two l2 networks (one fl...
"""A simple mixin to facilliate successful libvirt live migrations Requires that the test class set self.server for the specific test instnace and self.{src,dest} to indicate the direction of the migration. For any scenarios more complex than this they should override _migrate_stub with their own imple...
identifier_body
base.py
Cleanup(_p.stop) def _setup_compute_service(self): # NOTE(stephenfin): We don't start the compute service here as we wish # to configure the host capabilities first. We instead start the # service in the test self.flags(compute_driver='libvirt.LibvirtDriver') def _setup_schedul...
compute = self.start_service('compute', host=hostname) # Once that's done, we need to tweak the compute "service" to # make sure it returns unique objects. We do this inside the # mock context to avoid a small window between the end of the ...
with mock.patch('nova.virt.libvirt.host.Host.get_connection', return_value=fake_connection):
random_line_split
base.py
'name': 'physical-network-foo', 'admin_state_up': True, 'tenant_id': nova_fixtures.NeutronFixture.tenant_id, 'provider:physical_network': 'foo', 'provider:network_type': 'flat', 'provider:segmentation_id': None, } network_2 = network_1.copy() network_2.update({ ...
port = self.network_2_port_1
conditional_block
shared.module.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
{ }
SharedModule
identifier_name
shared.module.ts
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
AlertSeverityDirective, MetronTableDirective, NavContentDirective, CenterEllipsesPipe, AlertSearchDirective, ColumnNameTranslatePipe, AlertSeverityHexagonDirective, TimeLapsePipe, MapKeysPipe, ] }) export class SharedModule { }
CommonModule, ContextMenuModule, FormsModule,
random_line_split
config.rs
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 http://opensource.org...
_ => true } } _ => true } } fn fold_block(cx: &mut Context, b: ast::P<ast::Block>) -> ast::P<ast::Block> { let resulting_stmts: Vec<&Gc<ast::Stmt>> = b.stmts.iter().filter(|&a| retain_stmt(cx, *a)).collect(); let resulting_stmts = resulting_stmts.move_iter() ....
{ item_in_cfg(cx, &**item) }
conditional_block
config.rs
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 http://opensource.org...
impl<'a> fold::Folder for Context<'a> { fn fold_mod(&mut self, module: &ast::Mod) -> ast::Mod { fold_mod(self, module) } fn fold_block(&mut self, block: ast::P<ast::Block>) -> ast::P<ast::Block> { fold_block(self, block) } fn fold_foreign_mod(&mut self, foreign_mod: &ast::ForeignMo...
{ let config = krate.config.clone(); strip_items(krate, |attrs| in_cfg(config.as_slice(), attrs)) }
identifier_body
config.rs
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 http://opensource.org...
filter_view_item(cx, a).map(|x| cx.fold_view_item(x)) }).collect(); ast::Mod { inner: m.inner, view_items: filtered_view_items, items: flattened_items } } fn filter_foreign_item(cx: &mut Context, item: Gc<ast::ForeignItem>) -> Option<Gc<ast::ForeignIte...
let flattened_items = filtered_items.move_iter() .flat_map(|&x| cx.fold_item(x).move_iter()) .collect(); let filtered_view_items = m.view_items.iter().filter_map(|a| {
random_line_split
config.rs
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 http://opensource.org...
(cx: &mut Context, item: Gc<ast::ForeignItem>) -> Option<Gc<ast::ForeignItem>> { if foreign_item_in_cfg(cx, &*item) { Some(item) } else { None } } fn fold_foreign_mod(cx: &mut Context, nm: &ast::ForeignMod) -> ast::ForeignMod { let filtered_items = nm.items ...
filter_foreign_item
identifier_name
flavor_rxtx.py
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
self._extend_flavors(req, list(resp_obj.obj['flavors']))
return
conditional_block
flavor_rxtx.py
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
(wsgi.Controller): def _extend_flavors(self, req, flavors): for flavor in flavors: db_flavor = req.get_db_flavor(flavor['id']) key = 'rxtx_factor' flavor[key] = db_flavor['rxtx_factor'] or "" def _show(self, req, resp_obj): context = req.environ['nova.context...
FlavorRxtxController
identifier_name
flavor_rxtx.py
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
@wsgi.extends def detail(self, req, resp_obj): context = req.environ['nova.context'] if not context.can(fr_policies.BASE_POLICY_NAME, fatal=False): return self._extend_flavors(req, list(resp_obj.obj['flavors']))
def _extend_flavors(self, req, flavors): for flavor in flavors: db_flavor = req.get_db_flavor(flavor['id']) key = 'rxtx_factor' flavor[key] = db_flavor['rxtx_factor'] or "" def _show(self, req, resp_obj): context = req.environ['nova.context'] if not conte...
identifier_body
flavor_rxtx.py
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
return if 'flavor' in resp_obj.obj: self._extend_flavors(req, [resp_obj.obj['flavor']]) @wsgi.extends def show(self, req, resp_obj, id): return self._show(req, resp_obj) @wsgi.extends(action='create') def create(self, req, resp_obj, body): return self._s...
if not context.can(fr_policies.BASE_POLICY_NAME, fatal=False):
random_line_split