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
ipc.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 crate::time; use crate::time::ProfilerCategory; use crate::time::ProfilerChan; use ipc_channel::ipc; use serde...
time::profile( ProfilerCategory::IpcBytesReceiver, None, self.time_profile_chan.clone(), move || self.ipc_bytes_receiver.recv(), ) } } pub fn bytes_channel( time_profile_chan: ProfilerChan, ) -> Result<(ipc::IpcBytesSender, IpcBytesReceiver), Erro...
random_line_split
ipc.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 crate::time; use crate::time::ProfilerCategory; use crate::time::ProfilerChan; use ipc_channel::ipc; use serde...
pub fn try_recv(&self) -> Result<T, bincode::Error> { self.ipc_receiver.try_recv() } pub fn to_opaque(self) -> ipc::OpaqueIpcReceiver { self.ipc_receiver.to_opaque() } } pub fn channel<T>( time_profile_chan: ProfilerChan, ) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error> wh...
{ time::profile( ProfilerCategory::IpcReceiver, None, self.time_profile_chan.clone(), move || self.ipc_receiver.recv(), ) }
identifier_body
ipc.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 crate::time; use crate::time::ProfilerCategory; use crate::time::ProfilerChan; use ipc_channel::ipc; use serde...
(&self) -> Result<Vec<u8>, bincode::Error> { time::profile( ProfilerCategory::IpcBytesReceiver, None, self.time_profile_chan.clone(), move || self.ipc_bytes_receiver.recv(), ) } } pub fn bytes_channel( time_profile_chan: ProfilerChan, ) -> Result<...
recv
identifier_name
url_operations.py
import urllib import urlparse def get_path(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return path def get_host(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return host def add_path(url, new_path): """Given a url and path, return a new url that combine...
"""Given a url and a tuple or dict of parameters, return a url that includes the parameters as a properly formatted query string. If update is True, change any existing values to new values given in params. """ scheme, host, path, query, fragment = urlparse.urlsplit(url) # urlparse.parse_q...
identifier_body
url_operations.py
import urllib import urlparse def get_path(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return path def get_host(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return host def add_path(url, new_path): """Given a url and path, return a new url that combine...
(url, params): """use the _update_query_params function to set a new query string for the url based on params. """ return update_query_params(url, params, update=False) def update_query_params(url, params, update=True): """Given a url and a tuple or dict of parameters, return a url that include...
add_query_params
identifier_name
url_operations.py
import urllib import urlparse def get_path(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return path def get_host(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return host def add_path(url, new_path): """Given a url and path, return a new url that combine...
else: value = unicode(value) return key, value.encode('utf-8') def _make_query_tuples(params): if hasattr(params, 'items'): return [_query_param(*param) for param in params.items()] else: return [_query_param(*params)] def add_query_params(url, params): """use the _update_...
value = value.decode('utf-8')
conditional_block
url_operations.py
import urllib import urlparse def get_path(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return path def get_host(url): scheme, host, path, query, fragment = urlparse.urlsplit(url) return host def add_path(url, new_path): """Given a url and path, return a new url that combine...
path += '/' + new_path return urlparse.urlunsplit([scheme, host, path, query, fragment]) def _query_param(key, value): """ensure that a query parameter's value is a string of bytes in UTF-8 encoding. """ if isinstance(value, unicode): pass elif isinstance(value, str): va...
path += new_path else:
random_line_split
sanitizer.py
""":mod:`libearth.sanitizer` --- Sanitize HTML tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import cgi try: import htmlentitydefs import HTMLParser except ImportError: from html import entities as htmlentitydefs, parser as HTMLParser import re try: import urlparse except ImportError: ...
self.base_uri = base_uri self.fed = [] self.ignore = False def handle_starttag(self, tag, attrs): if tag == 'script': self.ignore = True return elif self.ignore: return remove_css = self.DISALLOWED_STYLE_PATTERN.sub self.fe...
random_line_split
sanitizer.py
""":mod:`libearth.sanitizer` --- Sanitize HTML tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import cgi try: import htmlentitydefs import HTMLParser except ImportError: from html import entities as htmlentitydefs, parser as HTMLParser import re try: import urlparse except ImportError: ...
self.fed.extend(('</', tag, '>')) def handle_data(self, d): if self.ignore: return self.fed.append(d) def handle_entityref(self, name): if self.ignore: return self.fed.extend(('&', name, ';')) def handle_charref(self, name): if self...
self.ignore = False return
conditional_block
sanitizer.py
""":mod:`libearth.sanitizer` --- Sanitize HTML tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import cgi try: import htmlentitydefs import HTMLParser except ImportError: from html import entities as htmlentitydefs, parser as HTMLParser import re try: import urlparse except ImportError: ...
def handle_entityref(self, name): try: codepoint = self.entity_map[name] except KeyError: pass else: self.fed.append(unichr(codepoint)) def handle_charref(self, name): if name.startswith('x'): codepoint = int(name[1:], 16) ...
self.fed.append(d)
identifier_body
sanitizer.py
""":mod:`libearth.sanitizer` --- Sanitize HTML tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import cgi try: import htmlentitydefs import HTMLParser except ImportError: from html import entities as htmlentitydefs, parser as HTMLParser import re try: import urlparse except ImportError: ...
(html): """Strip *all* markup tags from ``html`` string. That means, it simply makes the given ``html`` document a plain text. :param html: html string to clean :type html: :class:`str` :returns: cleaned plain text :rtype: :class:`str` """ parser = MarkupTagCleaner() parser.feed(ht...
clean_html
identifier_name
sms.js
var twilio = require('twilio'), Player = require('../models/Player'), Question = require('../models/Question'); // Handle inbound SMS and process commands module.exports = function(request, response) { var twiml = new twilio.TwimlResponse(); var body = request.param('Body').trim(), playerP...
else { respond('Sorry! That answer was incorrect. Guess again...'); } } } // Process the "answer" command function answer(input) { if (was('help', input)) { respond('Answer the current question - spelling is important, capitalization is not. If you d...
{ var points = 5 - question.answered.length; if (points < 1) { points = 1; } // DOUBLE POINTS // points = points*2; // Update the question, then the player score question.answered.push(p...
conditional_block
sms.js
var twilio = require('twilio'), Player = require('../models/Player'), Question = require('../models/Question'); // Handle inbound SMS and process commands module.exports = function(request, response) { var twiml = new twilio.TwimlResponse(); var body = request.param('Body').trim(), playerP...
if (was('nick', input)) { nick(chopped); } else if (was('stop', input)) { stop(chopped); } else if (was('answer', input)) { answer(chopped); } else if (was('question', input)) { questionCommand(chopped); } else if (was('score', inp...
random_line_split
sms.js
var twilio = require('twilio'), Player = require('../models/Player'), Question = require('../models/Question'); // Handle inbound SMS and process commands module.exports = function(request, response) { var twiml = new twilio.TwimlResponse(); var body = request.param('Body').trim(), playerP...
(str) { twiml.message(str); response.send(twiml); } // Process the "nick" command function nick(input) { if (was('help', input)) { respond('Set your nickname, as you want it to appear on the leaderboard. Example: "nick Mrs. Awesomepants"'); } else { i...
respond
identifier_name
sms.js
var twilio = require('twilio'), Player = require('../models/Player'), Question = require('../models/Question'); // Handle inbound SMS and process commands module.exports = function(request, response) { var twiml = new twilio.TwimlResponse(); var body = request.param('Body').trim(), playerP...
// Process the "stop" command function stop(input) { if (was('help', input)) { respond('Unsubscribe from all messages. Example: "stop"'); } else { player.remove(function(err, model) { if (err) { respond('There was a problem unsubscrib...
{ if (was('help', input)) { respond('Set your nickname, as you want it to appear on the leaderboard. Example: "nick Mrs. Awesomepants"'); } else { if (input === '') { respond('A nickname is required. Text "nick help" for command help.'); } else { ...
identifier_body
mod.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/. */ pub mod dom_manipulation; pub mod file_reading; pub mod history_traversal; pub mod networking; pub mod user_intera...
msg: Box<T>, wrapper: &RunnableWrapper) -> Result<(), ()> where T: Runnable + Send + 'static; fn queue<T: Runnable + Send + 'static>(&self, msg: Box<T>, global: GlobalRef) -> Result<(), ()> { ...
use script_thread::{Runnable, RunnableWrapper}; use std::result::Result; pub trait TaskSource { fn queue_with_wrapper<T>(&self,
random_line_split
mod.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/. */ pub mod dom_manipulation; pub mod file_reading; pub mod history_traversal; pub mod networking; pub mod user_intera...
<T: Runnable + Send + 'static>(&self, msg: Box<T>, global: GlobalRef) -> Result<(), ()> { self.queue_with_wrapper(msg, &global.get_runnable_wrapper()) } }
queue
identifier_name
mod.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/. */ pub mod dom_manipulation; pub mod file_reading; pub mod history_traversal; pub mod networking; pub mod user_intera...
}
{ self.queue_with_wrapper(msg, &global.get_runnable_wrapper()) }
identifier_body
new_graphics3.py
#!/usr/bin/python ############################################################################### # NAME: new_graphics3.py # VERSION: 2.0.0b15 (18SEPTEMBER2006) # AUTHOR: John B. Cole, PhD (jcole@aipl.arsusda.gov) # LICENSE: LGPL ############################################################################### from PyP...
print '[INFO]: Calling pyp_graphics.new_draw_pedigree() at %s' % (pyp_nice_time()) pyp_graphics.new_draw_pedigree(example, gfilename='graphics3', gtitle='graphics3 pedigree', gorient='p') pyp_jbc.color_pedigree(example,gfilename='graphics3', ghatch='0', \ metric='sons', gtitle='Nodes are colore...
if example.kw['messages'] == 'verbose':
random_line_split
new_graphics3.py
#!/usr/bin/python ############################################################################### # NAME: new_graphics3.py # VERSION: 2.0.0b15 (18SEPTEMBER2006) # AUTHOR: John B. Cole, PhD (jcole@aipl.arsusda.gov) # LICENSE: LGPL ############################################################################### from PyP...
print 'Starting pypedal.py at %s' % (pyp_nice_time()) example = pyp_newclasses.loadPedigree(optionsfile='new_graphics3.ini') if example.kw['messages'] == 'verbose': print '[INFO]: Calling pyp_graphics.new_draw_pedigree() at %s' % (pyp_nice_time()) pyp_graphics.new_draw_pedigree(example, gfilename='...
conditional_block
AccountTag.tsx
import { IPromise } from 'angular'; import React from 'react'; import { AccountService } from './AccountService'; export interface IAccountTagProps { account: string; className?: string; } export interface IAccountTagState { isProdAccount: boolean; }
export class AccountTag extends React.Component<IAccountTagProps, IAccountTagState> { private static cache: { [account: string]: boolean | IPromise<boolean>; } = {}; public state = { isProdAccount: false }; private mounted = true; public componentWillUnmount(): void { this.mounted = false; } pu...
random_line_split
AccountTag.tsx
import { IPromise } from 'angular'; import React from 'react'; import { AccountService } from './AccountService'; export interface IAccountTagProps { account: string; className?: string; } export interface IAccountTagState { isProdAccount: boolean; } export class AccountTag extends React.Component<IAccountTagP...
public componentDidMount() { this.updateAccount(this.props.account); } public componentWillReceiveProps(nextProps: IAccountTagProps): void { this.updateAccount(nextProps.account); } private updateAccount(account: string) { const { cache } = AccountTag; if (!cache.hasOwnProperty(account)) {...
{ this.mounted = false; }
identifier_body
AccountTag.tsx
import { IPromise } from 'angular'; import React from 'react'; import { AccountService } from './AccountService'; export interface IAccountTagProps { account: string; className?: string; } export interface IAccountTagState { isProdAccount: boolean; } export class AccountTag extends React.Component<IAccountTagP...
else { cachedVal.then(isProdAccount => this.mounted && this.setState({ isProdAccount })); } } public render() { const { account, className } = this.props; const { isProdAccount } = this.state; return ( <span className={`account-tag account-tag-${isProdAccount ? 'prod' : 'notprod'} ${cl...
{ this.setState({ isProdAccount: cachedVal }); }
conditional_block
AccountTag.tsx
import { IPromise } from 'angular'; import React from 'react'; import { AccountService } from './AccountService'; export interface IAccountTagProps { account: string; className?: string; } export interface IAccountTagState { isProdAccount: boolean; } export class AccountTag extends React.Component<IAccountTagP...
() { this.updateAccount(this.props.account); } public componentWillReceiveProps(nextProps: IAccountTagProps): void { this.updateAccount(nextProps.account); } private updateAccount(account: string) { const { cache } = AccountTag; if (!cache.hasOwnProperty(account)) { cache[account] = Acco...
componentDidMount
identifier_name
traversal.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 context::{SharedStyleContext, StyleContext}; use dom::{OpaqueNode, TNode, TRestyleDamage, UnsafeNode}; use mat...
} } let unsafe_layout_node = node.to_unsafe(); // Before running the children, we need to insert our nodes into the bloom // filter. debug!("[{}] + {:X}", tid(), unsafe_layout_node.0); node.insert_into_bloom_filter(&mut *bf); // NB: flow construction updates the bloom filter on t...
{ style_sharing_candidate_cache.touch(index); node.set_restyle_damage(damage); }
conditional_block
traversal.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 context::{SharedStyleContext, StyleContext}; use dom::{OpaqueNode, TNode, TRestyleDamage, UnsafeNode}; use mat...
context: &SharedStyleContext<Impl>) -> Box<BloomFilter> where N: TNode { STYLE_BLOOM.with(|style_bloom| { match (parent_node, st...
/// /// If one does not exist, a new one will be made for you. If it is out of date, /// it will be cleared and reused. fn take_thread_local_bloom_filter<N, Impl: SelectorImplExt>(parent_node: Option<N>, root: OpaqueNode,
random_line_split
traversal.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 context::{SharedStyleContext, StyleContext}; use dom::{OpaqueNode, TNode, TRestyleDamage, UnsafeNode}; use mat...
pub fn put_thread_local_bloom_filter<Impl: SelectorImplExt>(bf: Box<BloomFilter>, unsafe_node: &UnsafeNode, context: &SharedStyleContext<Impl>) { STYLE_BLOOM.with(move |style_bloom| { as...
{ STYLE_BLOOM.with(|style_bloom| { match (parent_node, style_bloom.borrow_mut().take()) { // Root node. Needs new bloom filter. (None, _ ) => { debug!("[{}] No parent, but new bloom filter!", tid()); Box::new(BloomFilter::new()) } ...
identifier_body
traversal.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 context::{SharedStyleContext, StyleContext}; use dom::{OpaqueNode, TNode, TRestyleDamage, UnsafeNode}; use mat...
<'a, N, C>(context: &'a C, root: OpaqueNode, node: N) where N: TNode, C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>, <N::ConcreteElement as Element>::Impl: SelectorImplExt<ComputedValues=N::ConcreteComputedValues> + '...
recalc_style_at
identifier_name
multivalue_select.js
define([ 'underscore', 'pgui.editors/custom', 'libs/select2', 'locales/select2_locale' ], function (_, CustomEditor) { return CustomEditor.extend({ init: function (rootElement, readyCallback) { this._super(rootElement, readyCallback); var self = this; ...
this.rootElement.select2("val", value); } else { console.error("'value' must be string or array, '" + typeof(value) + "' given"); } return this; }, getEnabled: function () { return !this.rootElement.prop("disabled"); },...
} else if (_.isArray(value)) {
random_line_split
multivalue_select.js
define([ 'underscore', 'pgui.editors/custom', 'libs/select2', 'locales/select2_locale' ], function (_, CustomEditor) { return CustomEditor.extend({ init: function (rootElement, readyCallback) { this._super(rootElement, readyCallback); var self = this; ...
$('label[for=' + $el.attr('id') + ']').on('click', function () { $el.select2('focus'); }); $el.on('change', function () { if (typeof $el.valid === 'function' ) { var $form = $(this.form); if ($form.l...
{ this.setReadonly(true); }
conditional_block
drawer.js
import React, { PropTypes } from 'react'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import Divider from 'material-ui/Divider'; export default class MyDrawer extends React.Component { constructor(props) { super(prop...
() { this.props.toggleDrawer(); } render() { const { isDrawerOpen } = this.props; return ( <div> <Drawer open={isDrawerOpen}> <MenuItem>Sign In</MenuItem> <MenuItem>Feedback</MenuItem> <Divider /> <MenuItem onTouchTap={this.onToggleDrawer()}>Close M...
toggleDrawer
identifier_name
drawer.js
import React, { PropTypes } from 'react'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import RaisedButton from 'material-ui/RaisedButton'; import Divider from 'material-ui/Divider';
super(props); } onToggleDrawer() { return () => { this.toggleDrawer(); }; } toggleDrawer() { this.props.toggleDrawer(); } render() { const { isDrawerOpen } = this.props; return ( <div> <Drawer open={isDrawerOpen}> <MenuItem>Sign In</MenuItem> ...
export default class MyDrawer extends React.Component { constructor(props) {
random_line_split
mithril_config.rs
extern crate mithril; use mithril::mithril_config; use std::path::Path; use std::time::{Duration, Instant}; #[test] fn test_read_default_config() { let config = read_default_config(); assert_eq!(config.pool_conf.pool_address, "xmrpool.eu:3333"); assert_eq!(config.pool_conf.wallet_address, ""); asser...
//helper fn read_default_config() -> mithril_config::MithrilConfig { let path = &format!("{}{}", "./", "default_config.toml"); return mithril_config::read_config(Path::new(path), "default_config.toml").unwrap(); }
{ let config = read_default_config(); let now = Instant::now(); let _ = now + Duration::from_secs(config.metric_conf.sample_interval_seconds); //Ok if it doesn't panic }
identifier_body
mithril_config.rs
extern crate mithril; use mithril::mithril_config; use std::path::Path; use std::time::{Duration, Instant};
#[test] fn test_read_default_config() { let config = read_default_config(); assert_eq!(config.pool_conf.pool_address, "xmrpool.eu:3333"); assert_eq!(config.pool_conf.wallet_address, ""); assert_eq!(config.pool_conf.pool_password, ""); assert_eq!(config.worker_conf.num_threads, 8); assert_eq!(c...
random_line_split
mithril_config.rs
extern crate mithril; use mithril::mithril_config; use std::path::Path; use std::time::{Duration, Instant}; #[test] fn test_read_default_config() { let config = read_default_config(); assert_eq!(config.pool_conf.pool_address, "xmrpool.eu:3333"); assert_eq!(config.pool_conf.wallet_address, ""); asser...
() -> mithril_config::MithrilConfig { let path = &format!("{}{}", "./", "default_config.toml"); return mithril_config::read_config(Path::new(path), "default_config.toml").unwrap(); }
read_default_config
identifier_name
packetWriter.spec.ts
import { Packet } from '../packets/packet'; import { PacketWriter } from '../packetWriter'; describe('serializer/packetWriter', () => { describe('writePacket', () => { it('should throw if actual bytes length differs from packet.size', () => { const buf = Buffer.allocUnsafe(10); cons...
expect(offset).toEqual(6); const expected = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00]; expect(buf).toEqual(Buffer.from(expected)); }); }); });
random_line_split
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
(AnsibleError): ''' something was detected early that is wrong about a playbook or data file ''' pass class AnsibleInternalError(AnsibleError): ''' internal safeguards tripped, something happened in the code that should never happen ''' pass class AnsibleRuntimeError(AnsibleError): ''' ansible had...
AnsibleParserError
identifier_name
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
if unbalanced: error_message += YAML_COMMON_UNBALANCED_QUOTES_ERROR except (IOError, TypeError): error_message += '\n(could not open file to display line)' except IndexError: error_message += '\n(specified line no long...
error_message += YAML_COMMON_PARTIALLY_QUOTED_LINE_ERROR
conditional_block
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
class AnsibleRuntimeError(AnsibleError): ''' ansible had a problem while running a playbook ''' pass class AnsibleModuleError(AnsibleRuntimeError): ''' a module failed somehow ''' pass class AnsibleConnectionFailure(AnsibleRuntimeError): ''' the transport / connection_plugin had a fatal error '''...
random_line_split
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
class AnsibleInternalError(AnsibleError): ''' internal safeguards tripped, something happened in the code that should never happen ''' pass class AnsibleRuntimeError(AnsibleError): ''' ansible had a problem while running a playbook ''' pass class AnsibleModuleError(AnsibleRuntimeError): ''' a mo...
''' something was detected early that is wrong about a playbook or data file ''' pass
identifier_body
cli.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License,...
recid = int(recid) except ValueError: print('ERROR: record ID must be integer, not %s.' % recid) sys.exit(1) record_rev_list = get_record_revision_ids(recid) if not details: out = '\n'.join(record_rev_list) else: out = "%s %s %s %s\n" % ("# Revision".ljust(22), "#...
random_line_split
cli.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License,...
(recid, verbose=True, fix=False): revisions = get_record_revisions(recid) for recid, job_date in revisions: rev = '%s.%s' % (recid, job_date) try: get_marcxml_of_revision_id(rev) if verbose: print('%s: ok' % rev) except zlib.error: prin...
check_rev
identifier_name
cli.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License,...
def check_rev(recid, verbose=True, fix=False): revisions = get_record_revisions(recid) for recid, job_date in revisions: rev = '%s.%s' % (recid, job_date) try: get_marcxml_of_revision_id(rev) if verbose: print('%s: ok' % rev) except zlib.error: ...
"""Submit specified record revision REVID upload, to replace current version. """ if not revision_format_valid_p(revid): print('ERROR: revision %s is invalid; ' \ 'must be NNN.YYYYMMDDhhmmss.' % revid) sys.exit(1) xml_record = get_marcxml_of_revision_id(revid) if xml_...
identifier_body
cli.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License,...
else: check_rev(recid, fix=True) def main(): """Main entry point.""" if '--help' in sys.argv or \ '-h' in sys.argv: print_usage() elif '--version' in sys.argv or \ '-V' in sys.argv: print_version() else: try: cmd = sys.argv[1] ...
print('Fixing all records') recids = intbitset(run_sql("SELECT id FROM bibrec ORDER BY id")) for index, rec in enumerate(recids): if index % 1000 == 0 and index: print(index, 'records processed') check_rev(rec, verbose=False, fix=True)
conditional_block
selectorPrinting.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if (element.children) { label = label + '{'; for (var index = 0; index < element.children.length; index++) { if (index > 0) { label = label + '|'; } label = label + elementToString(element.children[index]); } label = label + '}'; } return label; } export function parseSelector(p: parser.Par...
{ label = label + '['; var needsSeparator = false; for (var key in element.attributes) { if (needsSeparator) { label = label + '|'; } needsSeparator = true; label = label + key + '=' + element.attributes[key]; } label = label + ']'; }
conditional_block
selectorPrinting.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
suite('CSS - selector printing', () => { test('class/hash/elementname/attr', function() { var p = new parser.Parser(); assertElement(p, 'element', { name: 'element' }); assertElement(p, '.div', { attributes: { class: 'div'} }); assertElement(p, '#first', { attributes: { id: 'first'} }); assertElement(p, ...
{ var node = p.internalParse(input, p._parseSimpleSelector); var actual = selectorPrinter.toElement(node); assert.ok(actual.name === element.name); assert.ok(objects.equals(actual.attributes, element.attributes)); }
identifier_body
selectorPrinting.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(p: parser.Parser, input:string, selectorName:string, expected: string):void { var styleSheet = p.parseStylesheet(workerTests.mockMirrorModel(input)); var node = nodes.getNodeAtOffset(styleSheet, input.indexOf(selectorName)); var selector = node.findParent(nodes.NodeType.Selector); var element = selectorPrinter.s...
parseSelector
identifier_name
selectorPrinting.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
});
random_line_split
application.js
// Copyright (c) 2011-2013 Turbulenz Limited /*global Backbone*/ /*global TurbulenzStore*/ /*global TurbulenzGameNotifications*/ /*global TurbulenzBridge*/ /*global LocalMessageView*/ /*global LocalPlayView*/ /*global CarouselView*/ /*global LocalMetricsView*/ /*global LocalListView*/ /*global LocalUserdataView*/ /*gl...
list: function listFn(type, slug, directory) { this.game(slug, true); this.prepareAction(slug, 'list'); this.trigger('assets:list', type, slug, directory); }, userdata: function userdataFn(slug, directory) { this.game(slug, true); this.prepareAction(slug, 'userdata')...
random_line_split
application.js
// Copyright (c) 2011-2013 Turbulenz Limited /*global Backbone*/ /*global TurbulenzStore*/ /*global TurbulenzGameNotifications*/ /*global TurbulenzBridge*/ /*global LocalMessageView*/ /*global LocalPlayView*/ /*global CarouselView*/ /*global LocalMetricsView*/ /*global LocalListView*/ /*global LocalUserdataView*/ /*gl...
return true; }, prepareAction: function prepareActionFn(slug, action) { var $game = $('#' + slug); //no game selected for the action and not creating a new game if (!$game.hasClass('selected') && !$game.hasClass('Temporary')) { this.trigger('carousel:collap...
{ if (window.location.hash !== this.currentHash) { window.location.hash = this.currentHash; } return false; }
conditional_block
ng_for_of.d.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { DoCheck, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef } from '@angular/core';...
<T> implements DoCheck { private _viewContainer; private _template; private _differs; ngForOf: NgIterable<T>; ngForTrackBy: TrackByFunction<T>; private _ngForOf; private _ngForOfDirty; private _differ; private _trackByFn; constructor(_viewContainer: ViewContainerRef, _template: T...
NgForOf
identifier_name
ng_for_of.d.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { DoCheck, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef } from '@angular/core';...
* * When an item is added, a new instance of the template is added to the DOM. * * When an item is removed, its template instance is removed from the DOM. * * When items are reordered, their respective templates are reordered in the DOM. * * Otherwise, the DOM element for that item will remain the same. * * Angul...
* ### Change Propagation * * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: *
random_line_split
auth.actions.ts
import { Action } from '@ngrx/store'; export const TRY_SIGNUP = 'TRY_SIGNUP'; export const SIGNUP = 'SIGNUP'; export const TRY_SIGNIN = 'TRY_SIGNIN'; export const SIGNIN = 'SIGNIN'; export const LOGOUT = 'LOGOUT'; export const SET_TOKEN = 'SET_TOKEN'; export class TrySignup implements Action { readonly type = TRY_S...
export class Logout implements Action { readonly type = LOGOUT; } export class SetToken implements Action { readonly type = SET_TOKEN; constructor(public payload: string) {} } export type AuthActions = Signup | Signin | Logout | SetToken | TrySignup | TrySignin;
random_line_split
auth.actions.ts
import { Action } from '@ngrx/store'; export const TRY_SIGNUP = 'TRY_SIGNUP'; export const SIGNUP = 'SIGNUP'; export const TRY_SIGNIN = 'TRY_SIGNIN'; export const SIGNIN = 'SIGNIN'; export const LOGOUT = 'LOGOUT'; export const SET_TOKEN = 'SET_TOKEN'; export class TrySignup implements Action { readonly type = TRY_S...
(public payload: { username: string, password: string}) {} } export class Signup implements Action { readonly type = SIGNUP; } export class TrySignin implements Action { readonly type = TRY_SIGNIN; constructor(public payload: { username: string, password: string}) {} } export class Signin implements Action { ...
constructor
identifier_name
tool.py
#!/usr/bin/env python3 ## # Copyright (c) 2007 Apple Inc. # # This is the MIT license. This software may also be distributed under the # same terms as Python (the PSF license). # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "...
class NullsInString(Exception): """Nulls in string.""" _FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)]) def _dump(src, length=16): result=[] for i in range(0, len(src), length): s = src[i:i+length] hexa = ' '.join(["%02X"%ord(x) for x in s]) printab...
if e: print(e) print("") name = os.path.basename(sys.argv[0]) print("usage: %s [-lz] file [file ...]" % (name,)) print(" %s -p [-lz] attr_name file [file ...]" % (name,)) print(" %s -w [-z] attr_name attr_value file [file ...]" % (name,)) print(" %s -d attr_name fi...
identifier_body
tool.py
#!/usr/bin/env python3 ## # Copyright (c) 2007 Apple Inc. # # This is the MIT license. This software may also be distributed under the # same terms as Python (the PSF license). # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "...
for filename in args: def onError(e): if not os.path.exists(filename): sys.stderr.write("No such file: %s\n" % (filename,)) else: sys.stderr.write(str(e) + "\n") status = 1 try: attrs = xattr.xattr(filename) e...
multiple_files = False
conditional_block
tool.py
#!/usr/bin/env python3 ## # Copyright (c) 2007 Apple Inc. # # This is the MIT license. This software may also be distributed under the # same terms as Python (the PSF license). # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "...
file_prefix = "%s: " % (filename,) else: file_prefix = "" for attr_name in attr_names: try: try: attr_value = decompress(attrs[attr_name]) except zlib.error: a...
except (IOError, OSError) as e: onError(e) continue if multiple_files:
random_line_split
tool.py
#!/usr/bin/env python3 ## # Copyright (c) 2007 Apple Inc. # # This is the MIT license. This software may also be distributed under the # same terms as Python (the PSF license). # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "...
(Exception): """Nulls in string.""" _FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)]) def _dump(src, length=16): result=[] for i in range(0, len(src), length): s = src[i:i+length] hexa = ' '.join(["%02X"%ord(x) for x in s]) printable = s.translate(_FIL...
NullsInString
identifier_name
schema.d.ts
/** * Creates a new generic library project in the current workspace. */ export interface Schema { /** * The path at which to create the library's public API file, relative to the workspace root. */ entryFile?: string; /** * When true, applies lint fixes after generating the library. *...
* A prefix to apply to generated selectors. */ prefix?: string; /** * When true, does not install dependency packages. */ skipInstall?: boolean; /** * When true, does not add dependencies to the "package.json" file. */ skipPackageJson?: boolean; /** * When true...
* The name of the library. */ name?: string; /**
random_line_split
htmlsourceelement.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElem...
fn iterate_next_html_image_element_siblings( next_siblings_iterator: impl Iterator<Item = Root<Dom<Node>>>, ) { for next_sibling in next_siblings_iterator { if let Some(html_image_element_sibling) = next_sibling.downcast::<HTMLImageElement>() { html_image_element_si...
{ Node::reflect_node( Box::new(HTMLSourceElement::new_inherited( local_name, prefix, document, )), document, ) }
identifier_body
htmlsourceelement.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElem...
, } } /// <https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted> fn bind_to_tree(&self, context: &BindContext) { self.super_type().unwrap().bind_to_tree(context); let parent = self.upcast::<Node>().GetParentNode().unwrap(); if let Some(media) = paren...
{}
conditional_block
htmlsourceelement.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElem...
( local_name: LocalName, prefix: Option<Prefix>, document: &Document, ) -> HTMLSourceElement { HTMLSourceElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), } } #[allow(unrooted_must_root)] pub fn new( local_name: ...
new_inherited
identifier_name
htmlsourceelement.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 https://mozilla.org/MPL/2.0/. */ use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::HTMLSourceElementBinding::HTMLSourceElem...
&local_name!("srcset") | &local_name!("sizes") | &local_name!("media") | &local_name!("type") => { let next_sibling_iterator = self.upcast::<Node>().following_siblings(); HTMLSourceElement::iterate_next_html_image_element_siblings(next_sibl...
match attr.local_name() {
random_line_split
htmloptgroupelement.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 dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;...
} impl<'a> VirtualMethods for JSRef<'a, HTMLOptGroupElement> { fn super_type<'a>(&'a self) -> Option<&'a VirtualMethods> { let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_borrowed_ref(self); Some(htmlelement as &VirtualMethods) } fn after_set_attr(&self, attr: JSRef<Attr>) { ...
// http://www.whatwg.org/html#dom-optgroup-disabled make_bool_setter!(SetDisabled, "disabled")
random_line_split
htmloptgroupelement.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 dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;...
, _ => () } } }
{ let node: JSRef<Node> = NodeCast::from_ref(*self); node.set_disabled_state(false); node.set_enabled_state(true); for child in node.children().filter(|child| child.is_htmloptionelement()) { child.check_disabled_attribute(); ...
conditional_block
htmloptgroupelement.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 dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;...
fn after_set_attr(&self, attr: JSRef<Attr>) { match self.super_type() { Some(ref s) => s.after_set_attr(attr), _ => () } match attr.local_name() { &atom!("disabled") => { let node: JSRef<Node> = NodeCast::from_ref(*self); ...
{ let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_borrowed_ref(self); Some(htmlelement as &VirtualMethods) }
identifier_body
htmloptgroupelement.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 dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;...
(&self, attr: JSRef<Attr>) { match self.super_type() { Some(ref s) => s.after_set_attr(attr), _ => () } match attr.local_name() { &atom!("disabled") => { let node: JSRef<Node> = NodeCast::from_ref(*self); node.set_disabled_stat...
after_set_attr
identifier_name
security_rule_associations.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
super(SecurityRuleAssociations, self).__init__(**kwargs) self.network_interface_association = kwargs.get('network_interface_association', None) self.subnet_association = kwargs.get('subnet_association', None) self.default_security_rules = kwargs.get('default_security_rules', None) self.e...
identifier_body
security_rule_associations.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
(Model): """All security rules associated with the network interface. :param network_interface_association: :type network_interface_association: ~azure.mgmt.network.v2016_09_01.models.NetworkInterfaceAssociation :param subnet_association: :type subnet_association: ~azure.mgmt.network.v201...
SecurityRuleAssociations
identifier_name
security_rule_associations.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
self.effective_security_rules = kwargs.get('effective_security_rules', None)
random_line_split
__manifest__.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Point of Sale', 'version': '1.0.1', 'category': 'Point Of Sale', 'sequence': 20, 'summary': 'Touchscreen Interface for Shops', 'description': """ Quick and Easy sale process ===========...
'application': True, 'qweb': ['static/src/xml/pos.xml'], 'website': 'https://www.odoo.com/page/point-of-sale', }
'data/point_of_sale_demo.xml', ], 'installable': True,
random_line_split
liveness-use-after-send.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// 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/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accordin...
// file at the top-level directory of this distribution and at
random_line_split
liveness-use-after-send.rs
// Copyright 2012 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 ...
() { fail!(); }
main
identifier_name
test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest import StringIO import tempfile from os.path import join, dirname, ...
def test_external_css(self): # test correct behavior # CSS should be in /tmp directory fmt1 = HtmlFormatter(full=True, cssfile='fmt1.css', outencoding='utf-8') # CSS should be in TESTDIR (TESTDIR is absolute) fmt2 = HtmlFormatter(full=True, cssfile=join(TESTDIR, 'fmt2.css')...
hfmt = HtmlFormatter(nowrap=True) houtfile = StringIO.StringIO() hfmt.format(tokensource, houtfile) nfmt = NullFormatter() noutfile = StringIO.StringIO() nfmt.format(tokensource, noutfile) stripped_html = re.sub('<.*?>', '', houtfile.getvalue()) escaped_text = e...
identifier_body
test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests
:license: BSD, see LICENSE for details. """ import os import re import unittest import StringIO import tempfile from os.path import join, dirname, isfile, abspath from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter, NullFormatter from pygments.formatters.html import escape_html ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS.
random_line_split
test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest import StringIO import tempfile from os.path import join, dirname, ...
(self): # test all available wrappers fmt = HtmlFormatter(full=True, linenos=True, noclasses=True, outencoding='utf-8') handle, pathname = tempfile.mkstemp('.html') tfile = os.fdopen(handle, 'w+b') fmt.format(tokensource, tfile) tfile.close() ...
test_valid_output
identifier_name
test_html_formatter.py
# -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest import StringIO import tempfile from os.path import join, dirname, ...
def test_valid_output(self): # test all available wrappers fmt = HtmlFormatter(full=True, linenos=True, noclasses=True, outencoding='utf-8') handle, pathname = tempfile.mkstemp('.html') tfile = os.fdopen(handle, 'w+b') fmt.format(tokensource, tf...
outfile = StringIO.StringIO() fmt = HtmlFormatter(**optdict) fmt.format(tokensource, outfile)
conditional_block
gateway_tcp.py
"""Start a tcp gateway.""" import click from mysensors.cli.helper import ( common_gateway_options, handle_msg, run_async_gateway, run_gateway, ) from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway def common_tcp_options(func): """Supply common tcp gateway options.""" func = click.op...
@click.command(options_metavar="<options>") @common_tcp_options @common_gateway_options def async_tcp_gateway(**kwargs): """Start an async tcp gateway.""" gateway = AsyncTCPGateway(event_callback=handle_msg, **kwargs) run_async_gateway(gateway)
"""Start a tcp gateway.""" gateway = TCPGateway(event_callback=handle_msg, **kwargs) run_gateway(gateway)
identifier_body
gateway_tcp.py
"""Start a tcp gateway.""" import click from mysensors.cli.helper import ( common_gateway_options, handle_msg, run_async_gateway, run_gateway, ) from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway def common_tcp_options(func): """Supply common tcp gateway options.""" func = click.op...
return func @click.command(options_metavar="<options>") @common_tcp_options @common_gateway_options def tcp_gateway(**kwargs): """Start a tcp gateway.""" gateway = TCPGateway(event_callback=handle_msg, **kwargs) run_gateway(gateway) @click.command(options_metavar="<options>") @common_tcp_options @co...
random_line_split
gateway_tcp.py
"""Start a tcp gateway.""" import click from mysensors.cli.helper import ( common_gateway_options, handle_msg, run_async_gateway, run_gateway, ) from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway def common_tcp_options(func): """Supply common tcp gateway options.""" func = click.op...
(**kwargs): """Start an async tcp gateway.""" gateway = AsyncTCPGateway(event_callback=handle_msg, **kwargs) run_async_gateway(gateway)
async_tcp_gateway
identifier_name
manager.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
def launch(self, **kwargs): """ Collect conf files and attempt to spawn the processes for this server """ conf_files = self.conf_files(**kwargs) if not conf_files: return {} pids = self.get_running_pids(**kwargs) already_started = False ...
""" wait on spawned procs to terminate """ status = 0 for proc in self.procs: # wait for process to terminate proc.communicate() if proc.returncode: status += 1 return status
identifier_body
manager.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
(self, **kwargs): """graceful shutdown then restart on supporting servers """ kwargs['graceful'] = True status = 0 for server in self.server_names: m = Manager([server]) status += m.stop(**kwargs) status += m.start(**kwargs) return stat...
reload
identifier_name
manager.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
return 1 @command def kill(self, **kwargs): """stop a server (no error if not running) """ status = self.stop(**kwargs) kwargs['quiet'] = True if status and not self.status(**kwargs): # only exit error if the server is still running retur...
if not killed_pids.issuperset(pids): # some pids of this server were not killed if kill_after_timeout: print(_('Waited %(kill_wait)s seconds for %(server)s ' 'to die; killing') % {'kill_wait': kill_wait, 'server': ...
conditional_block
manager.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
try: conf_files = [found_conf_files[number - 1]] except IndexError: conf_files = [] else: conf_files = found_conf_files if not conf_files: # maybe there's a config file(s) out there, but I couldn't find it! if no...
if number:
random_line_split
2041013.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
function action(mode, type, selection) { if (mode < 1) { // disposing issue with stylishs found thanks to Vcoc cm.dispose(); } else { if (mode == 1) status++; else status--; if (status == 0) { cm.sendSimple("Oh, hello! Welcome to the Ludibrium Skin-Care! Are you interested in getting tanned and lo...
{ status = -1; action(1, 0, 0); }
identifier_body
2041013.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
() { status = -1; action(1, 0, 0); } function action(mode, type, selection) { if (mode < 1) { // disposing issue with stylishs found thanks to Vcoc cm.dispose(); } else { if (mode == 1) status++; else status--; if (status == 0) { cm.sendSimple("Oh, hello! Welcome to the Ludibrium Skin-Care! Are y...
start
identifier_name
2041013.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
else { if (mode == 1) status++; else status--; if (status == 0) { cm.sendSimple("Oh, hello! Welcome to the Ludibrium Skin-Care! Are you interested in getting tanned and looking sexy? How about a beautiful, snow-white skin? If you have #b#t5153002##k, you can let us take care of the rest and have the kin...
{ // disposing issue with stylishs found thanks to Vcoc cm.dispose(); }
conditional_block
2041013.js
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
var status = 0; var price = 1000000; var skin = Array(0, 1, 2, 3, 4); function start() { status = -1; action(1, 0, 0); } function action(mode, type, selection) { if (mode < 1) { // disposing issue with stylishs found thanks to Vcoc cm.dispose(); } else { if (mode == 1) status++; else status--; if (...
along with this program. If not, see <http://www.gnu.org/licenses/>. */
random_line_split
settings.py
""" Django settings for SciMs project. Generated by 'django-admin startproject' using Django 1.10.3. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os ...
'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'scims.templatetags.scims_extras', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sess...
'scims.apps.ScimsConfig',
random_line_split
pb0027.py
#!/usr/bin/env python # *-* coding:utf-8 *-* """ Date : Author : Vianney Gremmel loutre.a@gmail.com """ def
(f): class Memo(dict): def __missing__(self, key): r = self[key] = f(key) return r return Memo().__getitem__ @memo def isprime(n): for d in xrange(2, int(n**0.5) + 1): if n % d == 0: return False return True def maxi_primes(): for a in xrange(-10...
memo
identifier_name
pb0027.py
#!/usr/bin/env python # *-* coding:utf-8 *-* """ Date : Author : Vianney Gremmel loutre.a@gmail.com """ def memo(f): class Memo(dict): def __missing__(self, key):
return Memo().__getitem__ @memo def isprime(n): for d in xrange(2, int(n**0.5) + 1): if n % d == 0: return False return True def maxi_primes(): for a in xrange(-1000, 1001): for b in xrange(-999, 1001, 2): n = 0 while True: if not is...
r = self[key] = f(key) return r
identifier_body
pb0027.py
#!/usr/bin/env python # *-* coding:utf-8 *-*
""" def memo(f): class Memo(dict): def __missing__(self, key): r = self[key] = f(key) return r return Memo().__getitem__ @memo def isprime(n): for d in xrange(2, int(n**0.5) + 1): if n % d == 0: return False return True def maxi_primes(): for a i...
""" Date : Author : Vianney Gremmel loutre.a@gmail.com
random_line_split
pb0027.py
#!/usr/bin/env python # *-* coding:utf-8 *-* """ Date : Author : Vianney Gremmel loutre.a@gmail.com """ def memo(f): class Memo(dict): def __missing__(self, key): r = self[key] = f(key) return r return Memo().__getitem__ @memo def isprime(n): for d in xrange(2, int(n**0.5)...
print 'please wait...' max_score = max(score for score in maxi_primes()) print max_score print max_score[1]*max_score[2]
n = 0 while True: if not isprime(abs(n*n + a*n + b)) and n: yield (n, a, b) break n += 1
conditional_block
demo8.py
#!/usr/bin/python # Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC # 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 n...
if __name__ == "__main__": of_demo_8()
f = "cfg.yml" d = {} if(load_dict_from_file(f, d) is False): print("Config file '%s' read error: " % f) exit() try: ctrlIpAddr = d['ctrlIpAddr'] ctrlPortNum = d['ctrlPortNum'] ctrlUname = d['ctrlUname'] ctrlPswd = d['ctrlPswd'] nodeName = d['nodeName'...
identifier_body
demo8.py
#!/usr/bin/python # Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC # 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 n...
(): f = "cfg.yml" d = {} if(load_dict_from_file(f, d) is False): print("Config file '%s' read error: " % f) exit() try: ctrlIpAddr = d['ctrlIpAddr'] ctrlPortNum = d['ctrlPortNum'] ctrlUname = d['ctrlUname'] ctrlPswd = d['ctrlPswd'] nodeName = d['n...
of_demo_8
identifier_name
demo8.py
#!/usr/bin/python # Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC # 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 n...
if(status.eq(STATUS.OK)): print ("<<< Flow successfully read from the Controller") print ("Flow info:") flow = result.get_data() print json.dumps(flow, indent=4) else: print ("\n") print ("!!!Demo terminated, reason: %s" % status.brief().lower()) exit(0) ...
print ("\n") print ("<<< Get configured flow from the Controller") time.sleep(rundelay) result = ofswitch.get_configured_flow(table_id, flow_id) status = result.get_status()
random_line_split
demo8.py
#!/usr/bin/python # Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC # 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 n...
else: print ("\n") print ("!!!Demo terminated, reason: %s" % status.brief().lower()) exit(0) print ("\n") print ("<<< Delete flow with id of '%s' from the Controller's cache " "and from the table '%s' on the '%s' node" % (flow_id, table_id, nodeName)) time...
print ("<<< Flow successfully read from the Controller") print ("Flow info:") flow = result.get_data() print json.dumps(flow, indent=4)
conditional_block
option_addition.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 ...
}
random_line_split
option_addition.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let foo = 1; let bar = 2; let foobar = foo + bar; let nope = optint(0) + optint(0); let somefoo = optint(foo) + optint(0); let somebar = optint(bar) + optint(0); let somefoobar = optint(foo) + optint(bar); match nope { None => (), Some(foo) => fail!(fmt!("expected ...
main
identifier_name
option_addition.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 ...
}
{ return Some(in); }
conditional_block