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
views.py
# -*- coding: utf-8 -*- from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponseRedirect, Http404 from django.core.urlresolvers import reverse from StackSmash.apps.uploader.models import Document from StackSmash.apps.uploader.forms import DocumentF...
if not request.user.is_superuser: raise Http404 Document.objects.filter(pk=pk).delete() return HttpResponseRedirect(reverse('list'))
identifier_body
skin.rs
// Copyright 2015 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. use measure::Measureable; pub struct Skin<'a> { name: String, measures: Vec<Box<Measureable<'a> + 'a>>,...
(&self) -> &Vec<Box<Measureable<'a> + 'a>> { &self.measures } } #[test] fn test_name() { let skin = Skin::new("skin"); assert_eq!("skin", skin.name()); } #[test] fn test_add_measure() { use time_measure::TimeMeasure; let mut skin = Skin::new("skin"); skin.add_measure(Box::new(TimeMeas...
measures
identifier_name
skin.rs
// Copyright 2015 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. use measure::Measureable; pub struct Skin<'a> { name: String, measures: Vec<Box<Measureable<'a> + 'a>>,...
#[test] fn test_add_measure() { use time_measure::TimeMeasure; let mut skin = Skin::new("skin"); skin.add_measure(Box::new(TimeMeasure::new("foo"))); assert_eq!(1, skin.measures().len()); }
{ let skin = Skin::new("skin"); assert_eq!("skin", skin.name()); }
identifier_body
skin.rs
// Copyright 2015 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. use measure::Measureable; pub struct Skin<'a> { name: String, measures: Vec<Box<Measureable<'a> + 'a>>,...
pub fn name(&self) -> &str { self.name.as_slice() } pub fn add_measure(&mut self, measure: Box<Measureable<'a> + 'a>) { self.measures.push(measure); } pub fn measures(&self) -> &Vec<Box<Measureable<'a> + 'a>> { &self.measures } } #[test] fn test_name() { let skin =...
random_line_split
NewTaskDialog.js
import React from 'react'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; // import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; export default class NewTaskDialog extends React.Component { state = { open: false, ...
}; render() { const actions = [ <FlatButton label="Cancel" primary={true} onTouchTap={this.handleClose} />, <FlatButton label="Create Task" primary={true} disabled={!thi...
{ this.setState({valid: true}); }
conditional_block
NewTaskDialog.js
import React from 'react'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; // import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; export default class
extends React.Component { state = { open: false, valid: false, title: '', description: '' }; handleOpen = () => { this.setState({open: true}); }; handleClose = () => { this.resetDialog(); this.setState({open: false}); }; resetDialo...
NewTaskDialog
identifier_name
NewTaskDialog.js
import React from 'react'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; // import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; export default class NewTaskDialog extends React.Component { state = { open: false, ...
this.setState({open: false}); }; resetDialog = () => { this.setState({title: '', description: '', valid: false}) }; handleCreateTask = (e) => { e.preventDefault(); this.props.onCreateTask({ title: this.state.title, description: this.state.descrip...
random_line_split
mod.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} /// A trait for viewing representations from std types #[doc(hidden)] pub trait AsInnerMut<Inner: ?Sized> { fn as_inner_mut(&mut self) -> &mut Inner; } /// A trait for extracting representations from std types #[doc(hidden)] pub trait IntoInner<Inner> { fn into_inner(self) -> Inner; } /// A trait for creat...
/// A trait for viewing representations from std types #[doc(hidden)] pub trait AsInner<Inner: ?Sized> { fn as_inner(&self) -> &Inner;
random_line_split
test_extensions.py
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
elif ext: self.assertIn(ext, map(lambda x: x['alias'], extensions)) else: raise self.skipException('There are not any extensions configured') # Log extensions list extension_list = map(lambda x: x['alias'], extensions) LOG.debug("Nova extensions: %s" % ',...
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
conditional_block
test_extensions.py
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
(base.BaseV2ComputeTest): @test.idempotent_id('3bb27738-b759-4e0d-a5fa-37d7a6df07d1') def test_list_extensions(self): # List of all extensions if len(CONF.compute_feature_enabled.api_extensions) == 0: raise self.skipException('There are not any extensions configured') extens...
ExtensionsTestJSON
identifier_name
test_extensions.py
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
# get the specified extensions extension = self.extensions_client.show_extension('os-consoles') self.assertEqual('os-consoles', extension['extension']['alias'])
@test.idempotent_id('3bb27738-b759-4e0d-a5fa-37d7a6df07d1') def test_list_extensions(self): # List of all extensions if len(CONF.compute_feature_enabled.api_extensions) == 0: raise self.skipException('There are not any extensions configured') extensions = self.extensions_client.l...
identifier_body
test_extensions.py
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
LOG = logging.getLogger(__name__) class ExtensionsTestJSON(base.BaseV2ComputeTest): @test.idempotent_id('3bb27738-b759-4e0d-a5fa-37d7a6df07d1') def test_list_extensions(self): # List of all extensions if len(CONF.compute_feature_enabled.api_extensions) == 0: raise self.skipExcepti...
from tempest import test CONF = config.CONF
random_line_split
admonitions.py
# $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import Directive from docutils.parsers.rst import states, di...
self.state.nested_parse(self.content, self.content_offset, admonition_node) return [admonition_node] class Admonition(BaseAdmonition): required_arguments = 1 node_class = nodes.admonition class Attention(BaseAdmonition): node_class = nodes.attention c...
admonition_node['classes'] += ['admonition-' + nodes.make_id(title_text)]
conditional_block
admonitions.py
# $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import Directive from docutils.parsers.rst import states, di...
class Error(BaseAdmonition): node_class = nodes.error class Hint(BaseAdmonition): node_class = nodes.hint class Important(BaseAdmonition): node_class = nodes.important class Note(BaseAdmonition): node_class = nodes.note class Tip(BaseAdmonition): node_class = nodes.tip class Warnin...
node_class = nodes.danger
identifier_body
admonitions.py
# $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import Directive from docutils.parsers.rst import states, di...
'name': directives.unchanged} has_content = True node_class = None """Subclasses must set this to the appropriate admonition node class.""" def run(self): set_classes(self.options) self.assert_has_content() text = '\n'.join(self.content) admonition_no...
final_argument_whitespace = True option_spec = {'class': directives.class_option,
random_line_split
admonitions.py
# $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import Directive from docutils.parsers.rst import states, di...
(BaseAdmonition): node_class = nodes.hint class Important(BaseAdmonition): node_class = nodes.important class Note(BaseAdmonition): node_class = nodes.note class Tip(BaseAdmonition): node_class = nodes.tip class Warning(BaseAdmonition): node_class = nodes.warning
Hint
identifier_name
loader.styles.ts
/** * Copyright (C) 2017 3D Repo Ltd *
* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it wi...
random_line_split
ed25519KeyDeriver.ts
import 'should'; import { Ed25519KeyDeriver } from '../../../src/utils/ed25519KeyDeriver'; import { keys } from '../../resources/ed25519Deriver'; describe('Key Derivation:', () => { const verifyTestVector = ({ path, seed, prv, chainCode }) => { const derivedKey = Ed25519KeyDeriver.derivePath(path, seed); der...
it('should derive SLIP-0010 ed25519 test vector 1', () => { verifyTestVector(keys.testVec1); }); // https://github.com/satoshilabs/slips/blob/master/slip-0010.md#test-vector-2-for-ed25519 it('should derive SLIP-0010 ed25519 test vector 2', () => { verifyTestVector(keys.testVec2); }); });
// https://github.com/satoshilabs/slips/blob/master/slip-0010.md#test-vector-1-for-ed25519
random_line_split
invoice.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 OpenERP Italian Community (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Gener...
def __init__(self, cr, uid, name, context): super(Parser, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, })
identifier_body
invoice.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 OpenERP Italian Community (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Gener...
(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(Parser, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, })
Parser
identifier_name
invoice.py
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 OpenERP Italian Community (<http://www.openerp-italia.org>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Gener...
'time': time, })
def __init__(self, cr, uid, name, context): super(Parser, self).__init__(cr, uid, name, context) self.localcontext.update({
random_line_split
demo.rs
#!/usr/bin/env run-cargo-script //! ```cargo //! [dependencies] //! unixbar = "0" //! systemstat = "0" //! ``` #[macro_use] extern crate unixbar; extern crate systemstat; use systemstat::{Platform, System}; use unixbar::*; fn main() { UnixBar::new(I3BarFormatter::new()) .add(Volume::new(default_volume(),...
else { bfmt![click[MouseButton::Left => sh "rhythmbox"] fg["#bbbbbb"] text["[start music]"]] } } )) .add(Text::new(bfmt![click[MouseButton::Left => sh "notify-send hi"] click[MouseButton::Right => sh...
{ bfmt![ fg["#bbbbbb"] multi[ (click[MouseButton::Left => fn "prev"] no_sep text["[|<]"]), (click[MouseButton::Left => fn "play_pause"] no_sep text[if playing { "[||]"...
conditional_block
demo.rs
#!/usr/bin/env run-cargo-script //! ```cargo //! [dependencies] //! unixbar = "0" //! systemstat = "0" //! ``` #[macro_use] extern crate unixbar; extern crate systemstat; use systemstat::{Platform, System}; use unixbar::*; fn main()
(click[MouseButton::Left => fn "prev"] no_sep text["[|<]"]), (click[MouseButton::Left => fn "play_pause"] no_sep text[if playing { "[||]" } else { "[>]" }]), (click[MouseButton::Left => sh format!("firefox '...
{ UnixBar::new(I3BarFormatter::new()) .add(Volume::new(default_volume(), |volume| match volume.muted { false => bfmt![fmt["Volume {}", (volume.volume * 100.0) as i32]], true => bfmt![fmt["(muted) {}", (volume.volume * 100.0) as i32]] ...
identifier_body
demo.rs
#!/usr/bin/env run-cargo-script //! ```cargo //! [dependencies] //! unixbar = "0" //! systemstat = "0" //! ``` #[macro_use] extern crate unixbar; extern crate systemstat; use systemstat::{Platform, System}; use unixbar::*; fn
() { UnixBar::new(I3BarFormatter::new()) .add(Volume::new(default_volume(), |volume| match volume.muted { false => bfmt![fmt["Volume {}", (volume.volume * 100.0) as i32]], true => bfmt![fmt["(muted) {}", (volume.volume * 100.0) as i32]] ...
main
identifier_name
demo.rs
#!/usr/bin/env run-cargo-script //! ```cargo //! [dependencies] //! unixbar = "0" //! systemstat = "0" //! ``` #[macro_use] extern crate unixbar; extern crate systemstat; use systemstat::{Platform, System}; use unixbar::*; fn main() { UnixBar::new(I3BarFormatter::new()) .add(Volume::new(default_volume(),...
.register_fn("play_pause", move || { MPRISMusic::new().play_pause(); }) .register_fn("next", move || { MPRISMusic::new().next(); }) .add(Music::new(MPRISMusic::new(), |song| { if let Some(playing) = song.playback.map(|playback| playback.playing) { ...
random_line_split
table-data-source.spec.ts
/* eslint-disable no-underscore-dangle */ import { TsTableDataSource } from './table-data-source'; interface Foo { [key: string]: any; } // Additional tests for parts missed by the {@link TsTableComponent} integration test describe(`TsTableDataSource`, function() { let source: TsTableDataSource<Foo>; let seeded...
}); }); test(`should have a disconnected() noop`, () => { expect(source.disconnect()).toEqual(undefined); }); });
expect(spy).toHaveBeenCalled();
random_line_split
lang.ts
/* * Copyright 2017 Crown Copyright * * 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...
// const formatDate = (dateString: string) => { // const dateFormatString = "ddd mmm d yyyy, hh:MM:ss"; // return dateString ? dateFormat(dateString, dateFormatString) : ""; // }; export { hasAnyProps };
{ let hasProps = false; for (const prop in object) { if (Object.prototype.hasOwnProperty.call(object, prop)) { hasProps = true; } } return hasProps; }
identifier_body
lang.ts
/* * Copyright 2017 Crown Copyright * * 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...
// const formatDate = (dateString: string) => { // const dateFormatString = "ddd mmm d yyyy, hh:MM:ss"; // return dateString ? dateFormat(dateString, dateFormatString) : ""; // }; export { hasAnyProps };
} } return hasProps; }
random_line_split
lang.ts
/* * Copyright 2017 Crown Copyright * * 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...
} return hasProps; } // const formatDate = (dateString: string) => { // const dateFormatString = "ddd mmm d yyyy, hh:MM:ss"; // return dateString ? dateFormat(dateString, dateFormatString) : ""; // }; export { hasAnyProps };
{ hasProps = true; }
conditional_block
lang.ts
/* * Copyright 2017 Crown Copyright * * 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...
(object: Record<string, unknown>): boolean { let hasProps = false; for (const prop in object) { if (Object.prototype.hasOwnProperty.call(object, prop)) { hasProps = true; } } return hasProps; } // const formatDate = (dateString: string) => { // const dateFormatString = "ddd mmm d yyyy, hh:MM:ss...
hasAnyProps
identifier_name
AbstractExtendedActivityDataModifier.js
var AbstractExtendedActivityDataModifier = Fiber.extend(function(base) { return { content: '', isAuthorOfViewedActivity: null, dataViews: [], summaryGrid: null, init: function(analysisData, appResources, userSettings, athleteId, athleteIdAuthorOfActivity, basicInfos) { ...
this.insertContentSummaryGridContent(); $('.inline-stats.section').first().after(this.summaryGrid.html()).each(function() { // Grid placed if (panelAdded) panelAdded(); }); }, placeExtendedStatsButton: function(buttonAdded) { ...
random_line_split
AbstractExtendedActivityDataModifier.js
var AbstractExtendedActivityDataModifier = Fiber.extend(function(base) { return { content: '', isAuthorOfViewedActivity: null, dataViews: [], summaryGrid: null, init: function(analysisData, appResources, userSettings, athleteId, athleteIdAuthorOfActivity, basicInfos) { ...
this.insertContentAtGridPosition(0, 2, climbTime, 'Time climbing', climbTimeExtra, 'displayAdvancedGradeData'); }, /** * Affect default view needed */ setDataViewsNeeded: function() { // By default we have... If data exist of course... ...
{ climbTime = Helper.secondsToHHMMSS(this.analysisData_.gradeData.upFlatDownInSeconds.up); climbTimeExtra = '<span class="summarySubGridTitle">(' + (this.analysisData_.gradeData.upFlatDownInSeconds.up / this.analysisData_.gradeData.upFlatDownInSeconds.total * 100).toFixed(0) + '% of time...
conditional_block
attributes.py
# Copyright 2017, OpenCensus 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 w...
elif isinstance(value, six.string_types): value_type = 'string_value' value = utils.get_truncatable_str(value) elif isinstance(value, float): value_type = 'double_value' else: return None return {value_type: value} class Attributes(object): """A set of attributes,...
value_type = 'int_value'
conditional_block
attributes.py
# Copyright 2017, OpenCensus 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 w...
(self, key, value): """Set a key value pair.""" self.attributes[key] = value def delete_attribute(self, key): """Delete an attribute given a key if existed.""" self.attributes.pop(key, None) def get_attribute(self, key): """Get a attribute value.""" return self....
set_attribute
identifier_name
attributes.py
# Copyright 2017, OpenCensus 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
# 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 permissions and # limitations under the License. import six from opencensus.common import utils def _format_attribute_va...
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software
random_line_split
attributes.py
# Copyright 2017, OpenCensus 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 w...
def delete_attribute(self, key): """Delete an attribute given a key if existed.""" self.attributes.pop(key, None) def get_attribute(self, key): """Get a attribute value.""" return self.attributes.get(key, None) def format_attributes_json(self): """Convert the Attr...
"""Set a key value pair.""" self.attributes[key] = value
identifier_body
test_ipv4_strategy.py
import sys import pytest from netaddr import INET_PTON, AddrFormatError from netaddr.strategy import ipv4 def test_strategy_ipv4():
@pytest.mark.skipif(sys.version_info > (3,), reason="requires python 2.x") def test_strategy_ipv4_py2(): i = 3221225985 p = '\xc0\x00\x02\x01' assert ipv4.int_to_packed(i) == p assert ipv4.packed_to_int(p) == i @pytest.mark.skipif(sys.version_info < (3,), reason="requires python 3.x") def test_stra...
b = '11000000.00000000.00000010.00000001' i = 3221225985 t = (192, 0, 2, 1) s = '192.0.2.1' bin_val = '0b11000000000000000000001000000001' assert ipv4.bits_to_int(b) == i assert ipv4.int_to_bits(i) == b assert ipv4.int_to_str(i) == s assert ipv4.int_to_words(i) == t assert ipv4.int_...
identifier_body
test_ipv4_strategy.py
import sys import pytest from netaddr import INET_PTON, AddrFormatError from netaddr.strategy import ipv4 def test_strategy_ipv4(): b = '11000000.00000000.00000010.00000001' i = 3221225985 t = (192, 0, 2, 1) s = '192.0.2.1' bin_val = '0b11000000000000000000001000000001'
assert ipv4.bits_to_int(b) == i assert ipv4.int_to_bits(i) == b assert ipv4.int_to_str(i) == s assert ipv4.int_to_words(i) == t assert ipv4.int_to_bin(i) == bin_val assert ipv4.int_to_bin(i) == bin_val assert ipv4.bin_to_int(bin_val) == i assert ipv4.words_to_int(t) == i assert ipv4...
random_line_split
test_ipv4_strategy.py
import sys import pytest from netaddr import INET_PTON, AddrFormatError from netaddr.strategy import ipv4 def test_strategy_ipv4(): b = '11000000.00000000.00000010.00000001' i = 3221225985 t = (192, 0, 2, 1) s = '192.0.2.1' bin_val = '0b11000000000000000000001000000001' assert ipv4.bits_to_...
(): i = 3221225985 p = '\xc0\x00\x02\x01' assert ipv4.int_to_packed(i) == p assert ipv4.packed_to_int(p) == i @pytest.mark.skipif(sys.version_info < (3,), reason="requires python 3.x") def test_strategy_ipv4_py3(): i = 3221225985 p = b'\xc0\x00\x02\x01' assert ipv4.int_to_packed(i) == p ...
test_strategy_ipv4_py2
identifier_name
make_waterfalls.py
#!/usr/bin/env python3 import argparse import pathlib import numpy as np def waterfall(input_filename, output_filename):
np.save(output_filename, f.astype('float32')) def parse_args(): parser = argparse.ArgumentParser( description='Make waterfalls from the December 2021 eclipse IQ data') parser.add_argument('input_folder', help='Input folder') parser.add_argument('output_folder', ...
fs = 200 nfft = 8192 w = np.blackman(nfft) x = np.fromfile(input_filename, 'int16') x = (x[::2] + 1j*x[1::2])/2**15 freq_span = 5 nbins = round(freq_span / fs * nfft) # In these recordings the internal reference was used, so there # is a frequency offset freq_offset = 11.6 if '2021-1...
identifier_body
make_waterfalls.py
#!/usr/bin/env python3 import argparse import pathlib import numpy as np def
(input_filename, output_filename): fs = 200 nfft = 8192 w = np.blackman(nfft) x = np.fromfile(input_filename, 'int16') x = (x[::2] + 1j*x[1::2])/2**15 freq_span = 5 nbins = round(freq_span / fs * nfft) # In these recordings the internal reference was used, so there # is a frequency o...
waterfall
identifier_name
make_waterfalls.py
#!/usr/bin/env python3 import argparse import pathlib import numpy as np def waterfall(input_filename, output_filename): fs = 200 nfft = 8192 w = np.blackman(nfft) x = np.fromfile(input_filename, 'int16') x = (x[::2] + 1j*x[1::2])/2**15 freq_span = 5 nbins = round(freq_span / fs * nfft) ...
parser = argparse.ArgumentParser( description='Make waterfalls from the December 2021 eclipse IQ data') parser.add_argument('input_folder', help='Input folder') parser.add_argument('output_folder', help='Output folder') return parser.parse_args() ...
def parse_args():
random_line_split
make_waterfalls.py
#!/usr/bin/env python3 import argparse import pathlib import numpy as np def waterfall(input_filename, output_filename): fs = 200 nfft = 8192 w = np.blackman(nfft) x = np.fromfile(input_filename, 'int16') x = (x[::2] + 1j*x[1::2])/2**15 freq_span = 5 nbins = round(freq_span / fs * nfft) ...
main()
conditional_block
book.service.ts
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import params_local = require('../../params/params_local'); import params = require('../../params/params'); import 'rxjs/add/operator/toPromise'; @Injectable() export class BookService { api_path: string = 'http://172.23.3...
.toPromise() .then((res: Response) => res.json()); } getHotBooks(): Promise<any[]> { return this.http.get(this.api_path + 'sach_noi_bat') .toPromise() .then((res: Response) => res.json()); } }
random_line_split
book.service.ts
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import params_local = require('../../params/params_local'); import params = require('../../params/params'); import 'rxjs/add/operator/toPromise'; @Injectable() export class BookService { api_path: string = 'http://172.23.3...
(): Promise<any[]> { return this.http.get(this.api_path + 'sach_noi_bat') .toPromise() .then((res: Response) => res.json()); } }
getHotBooks
identifier_name
tasks.py
#Copyright (c) 2012, Carnegie Mellon University. #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions #are met: #1. Redistributions of source code must retain the above copyright # notice, this list of condition...
@task() def get_status(savename): cache = Cache(getcachedir(savename)) return cache.getstatus() @task() def get_summary(savename): cache = Cache(getcachedir(savename)) return cache.getsummary() @task() def get_file(savename,fname): cache = Cache(getcachedir(savename)) return cache.load(fname...
"""Set save metadata.""" with open(getmetaname(), "w") as fp: json.dump(data, fp)
identifier_body
tasks.py
#Copyright (c) 2012, Carnegie Mellon University. #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions #are met: #1. Redistributions of source code must retain the above copyright # notice, this list of condition...
(data): """Set save metadata.""" with open(getmetaname(), "w") as fp: json.dump(data, fp) @task() def get_status(savename): cache = Cache(getcachedir(savename)) return cache.getstatus() @task() def get_summary(savename): cache = Cache(getcachedir(savename)) return cache.getsummary() @...
set_savemeta
identifier_name
tasks.py
#Copyright (c) 2012, Carnegie Mellon University. #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions #are met: #1. Redistributions of source code must retain the above copyright # notice, this list of condition...
input = {} input['hosts'] = machines input['metrics'] = attributes input['start'] = startt #'2011/11/01-00:00:00' input['end'] = endt #'2011/11/01-23:30:00' if sourcename is not None: input['sourcename'] = sourcename if tsdbhost is not None: input['tsdbhost'] = tsdbhost ...
pipeline.set_skipstages(skipstages)
conditional_block
tasks.py
#Copyright (c) 2012, Carnegie Mellon University. #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions #are met: #1. Redistributions of source code must retain the above copyright # notice, this list of condition...
return decorator import sys import traceback IMPORTPATH = "../../" if IMPORTPATH not in sys.path: sys.path.append(IMPORTPATH) from pipeline import * from rescache import * def getconfig(): fp = open("config.json") st = fp.read() fp.close() return json.loads(st) #@param savename the name o...
def task(): def decorator(target): return target
random_line_split
pattern-tyvar-2.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 ...
() { }
main
identifier_name
pattern-tyvar-2.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 ...
//~ ERROR binary operation * cannot be applied to fn main() { }
{ match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } }
identifier_body
pattern-tyvar-2.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 ...
enum bar { t1((), Option<~[int]>), t2, } // n.b. my change changes this error message, but I think it's right -- tjc fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } } //~ ERROR binary operation * cannot be applied to fn main() { }
random_line_split
signature.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Signature) on 2017-03-22. # 2017, SMART Health IT.
class Signature(element.Element): """ A digital Signature - XML DigSig, JWT, Graphical image of signature, etc.. A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature pr...
from . import element
random_line_split
signature.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Signature) on 2017-03-22. # 2017, SMART Health IT. from . import element class
(element.Element): """ A digital Signature - XML DigSig, JWT, Graphical image of signature, etc.. A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different...
Signature
identifier_name
signature.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Signature) on 2017-03-22. # 2017, SMART Health IT. from . import element class Signature(element.Element):
Type `str`. """ self.contentType = None """ The technical format of the signature. Type `str`. """ self.onBehalfOfReference = None """ The party represented. Type `FHIRReference` referencing `Practitioner, RelatedPerson, Patient, Device, Organiza...
""" A digital Signature - XML DigSig, JWT, Graphical image of signature, etc.. A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different signature approach...
identifier_body
DropdownOption.tsx
import * as React from 'react'; import { Text, TYPOGRAPHY } from '../Text'; import { st, classes } from './DropdownOption.st.css'; import { TPAComponentProps } from '../../types'; export interface DropdownOptionProps { id?: string; value?: string; subtitle?: string; isSelectable?: boolean; isSectionTitle?: b...
export const DropdownOption: React.FC< DropdownOptionProps & TPAComponentProps > = (props) => { const { value, id, isSelectable, subtitle, icon, isSectionTitle, className, } = props; return ( <div key={id} className={st( classes.root, { with...
icon?: React.ReactElement; divider?: boolean; }
random_line_split
htmlpreelement.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::bindings::codegen::Bindings::HTMLPreElementBinding; use dom::bindings::js::Root; use dom::document::Docum...
}
{ Node::reflect_node(box HTMLPreElement::new_inherited(local_name, prefix, document), document, HTMLPreElementBinding::Wrap) }
identifier_body
htmlpreelement.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::bindings::codegen::Bindings::HTMLPreElementBinding; use dom::bindings::js::Root; use dom::document::Docum...
} } #[allow(unrooted_must_root)] pub fn new(local_name: LocalName, prefix: Option<Prefix>, document: &Document) -> Root<HTMLPreElement> { Node::reflect_node(box HTMLPreElement::new_inherited(local_name, prefix, document), document, ...
htmlelement: HTMLElement::new_inherited(local_name, prefix, document)
random_line_split
htmlpreelement.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::bindings::codegen::Bindings::HTMLPreElementBinding; use dom::bindings::js::Root; use dom::document::Docum...
(local_name: LocalName, prefix: Option<Prefix>, document: &Document) -> Root<HTMLPreElement> { Node::reflect_node(box HTMLPreElement::new_inherited(local_name, prefix, document), document, HTMLPreElementBinding::Wrap) } }
new
identifier_name
simple.rs
0, 0, (win_w / 3) as i32, (win_h / 2) as i32, Color::rgb(128, 128, 128), Color::rgb(255, 255, 255), ); // horizontal gradient window.linear_gradient( (win_w / 3) as i32, 0, win_w / 3, win_h, (win_w / 3) as i32, 0...
{ let (width, height) = orbclient::get_display_size().unwrap(); let mut window = Window::new( (width as i32) / 4, (height as i32) / 4, width / 2, height / 2, "TITLE", ) .unwrap(); let (win_w, win_h) = (width / 2, height / 2); // top left -> bottom rigth...
identifier_body
simple.rs
() { let (width, height) = orbclient::get_display_size().unwrap(); let mut window = Window::new( (width as i32) / 4, (height as i32) / 4, width / 2, height / 2, "TITLE", ) .unwrap(); let (win_w, win_h) = (width / 2, height / 2); // top left -> bottom ri...
main
identifier_name
simple.rs
() { let (width, height) = orbclient::get_display_size().unwrap(); let mut window = Window::new( (width as i32) / 4, (height as i32) / 4, width / 2, height / 2, "TITLE", ) .unwrap(); let (win_w, win_h) = (width / 2, height / 2); // top left -> bottom ri...
window.sync(); 'events: loop { for event in window.events() { match event.to_option() { EventOption::Quit(_quit_event) =>
window.box_blur(170, 100, 150, 150, 10); //Draw a shadow around a box window.box_shadow(170, 100, 150, 150, 0, 0, 20, Color::rgba(0, 0, 0, 255));
random_line_split
thanker.js
var twimap; twimap = require("twimap"); var Twit = require("twit"); var util = require("util"); var _current_index = -1; var _followers_list ; var thanks_temp; thanks_temp = [ "Dear %s, thank you for following :)", "%s = awesome. Me = grateful for following :)", "Is there no limit to your awesomeness %s? ...
//return current day function now() { var d; d = new Date(); return d.toUTCString(); } //reset values on error function reset_values(){ _current_index = -1; _followers_list = null; } // run safe and sound :| function run(){ _interval = setInterval(load_followers_priodically,1000*60*30); //run no...
random_line_split
thanker.js
var twimap; twimap = require("twimap"); var Twit = require("twit"); var util = require("util"); var _current_index = -1; var _followers_list ; var thanks_temp; thanks_temp = [ "Dear %s, thank you for following :)", "%s = awesome. Me = grateful for following :)", "Is there no limit to your awesomeness %s? ...
try{ twimap.followersAsync(last_check, function(result) { if(typeof result != "undefined" && result.length >=1){ //save it in our variable _followers_list = result; last_check = now(); msg_followers_thanks(); } },function (err){ // I command you to stay silent ...
_followers_priodically() {
identifier_name
thanker.js
var twimap; twimap = require("twimap"); var Twit = require("twit"); var util = require("util"); var _current_index = -1; var _followers_list ; var thanks_temp; thanks_temp = [ "Dear %s, thank you for following :)", "%s = awesome. Me = grateful for following :)", "Is there no limit to your awesomeness %s? ...
run safe and sound :| function run(){ _interval = setInterval(load_followers_priodically,1000*60*30); //run now , I can't wait ;) load_followers_priodically(); } //cheers to a happy running ;) run();
_current_index = -1; _followers_list = null; } //
identifier_body
home.py
""" This page is in the table of contents. Plugin to home the tool at beginning of each layer. The home manual page is at: http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home ==Operation== The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not...
(self): self.distanceFeedRate = gcodec.DistanceFeedRate() self.extruderActive = False self.highestZ = None self.homeLines = [] self.layerCount = settings.LayerCount() self.lineIndex = 0 self.lines = None self.oldLocation = None self.shouldHome = False self.travelFeedRateMinute = 957.0 def addFloat...
__init__
identifier_name
home.py
""" This page is in the table of contents. Plugin to home the tool at beginning of each layer. The home manual page is at: http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home ==Operation== The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not...
elif firstWord == '(<travelFeedRatePerSecond>': self.travelFeedRateMinute = 60.0 * float(splitLine[1]) self.distanceFeedRate.addLine(line) def parseLine(self, line): "Parse a gcode line and add it to the bevel gcode." splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: ...
self.absoluteEdgeWidth = abs(float(splitLine[1]))
conditional_block
home.py
""" This page is in the table of contents. Plugin to home the tool at beginning of each layer. The home manual page is at: http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home ==Operation== The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not...
def parseLine(self, line): "Parse a gcode line and add it to the bevel gcode." splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if firstWord == 'G1': self.addHomeTravel(splitLine) self.oldLocation = gcodec.getLocationFromSplitLine(s...
'Parse gcode initialization and store the parameters.' for self.lineIndex in xrange(len(self.lines)): line = self.lines[self.lineIndex] splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) firstWord = gcodec.getFirstWord(splitLine) self.distanceFeedRate.parseSplitLine(firstWord, splitLine) if fi...
identifier_body
home.py
""" This page is in the table of contents. Plugin to home the tool at beginning of each layer. The home manual page is at: http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home ==Operation== The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not...
self.lineIndex = 0 self.lines = None self.oldLocation = None self.shouldHome = False self.travelFeedRateMinute = 957.0 def addFloat( self, begin, end ): "Add dive to the original height." beginEndDistance = begin.distance(end) alongWay = self.absoluteEdgeWidth / beginEndDistance closeToEnd = euclide...
self.highestZ = None self.homeLines = [] self.layerCount = settings.LayerCount()
random_line_split
operations.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { HttpService } from './http.service'; import { IndicatorService } from './indicator.service'; import { Mission } from '../model/...
}) .catch(error => { this.indicator.stopActivity(); return this.httpService.handleError(error); }) } private convertJsonMissionToObject(json: Mission): Mission { let mission = new Mission(); mission.setValues(json); return mission; } }
{ throw new Error(response.json().message); }
conditional_block
operations.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { HttpService } from './http.service'; import { IndicatorService } from './indicator.service'; import { Mission } from '../model/...
saveMission(mission: Mission): Observable<boolean> { this.indicator.startActivity(); let params = { id: mission.id, date: mission.date, name: mission.name, location: mission.location, pocName: mission.pocName, pocPhone: mission.pocPhone, pocEmail: mission.pocEmail, details: mission.detai...
{ this.indicator.startActivity(); return this.http.post("api/operations/create", JSON.stringify(mission), new RequestOptions({headers: new Headers({'Content-Type': 'application/json'})})) .map(response => { if (response.json().status == "success") { this.indicator.stopActivity(); return response.js...
identifier_body
operations.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { HttpService } from './http.service'; import { IndicatorService } from './indicator.service'; import { Mission } from '../model/...
status: 'REQUESTED', event: mission.event ? mission.event.id : null, requestedPersonnel: new Array<string>() }; for (let user of mission.requestedPersonnel) { params.requestedPersonnel.push(user.id); } return this.http.post("api/operations/save", JSON.stringify(params), new RequestOptions({headers: ...
transportationNotes: mission.transportationNotes, lodgingRequired: mission.lodgingRequired, lodgingNco: mission.lodgingNco ? mission.lodgingNco.id : null, lodgingNotes: mission.lodgingNotes, mandatory: mission.mandatory,
random_line_split
operations.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import '../rxjs-operators'; import { HttpService } from './http.service'; import { IndicatorService } from './indicator.service'; import { Mission } from '../model/...
(mission: Mission): Observable<number> { this.indicator.startActivity(); return this.http.post("api/operations/create", JSON.stringify(mission), new RequestOptions({headers: new Headers({'Content-Type': 'application/json'})})) .map(response => { if (response.json().status == "success") { this.indicator....
createMission
identifier_name
lib.rs
#![warn(missing_docs, missing_debug_implementations)] //! EGL utilities //! //! This module contains bindings to the `libwayland-egl.so` library. //! //! This library is used to interface with the OpenGL stack, and creating //! EGL surfaces from a wayland surface.
use std::os::raw::c_void; use wayland_backend::{client::InvalidId, sys::client::ObjectId}; use wayland_sys::{client::wl_proxy, egl::*, ffi_dispatch}; /// Checks if the wayland-egl lib is available and can be used /// /// Trying to create an `WlEglSurface` while this function returns /// `false` will result in a pani...
//! //! See WlEglSurface documentation for details.
random_line_split
lib.rs
#![warn(missing_docs, missing_debug_implementations)] //! EGL utilities //! //! This module contains bindings to the `libwayland-egl.so` library. //! //! This library is used to interface with the OpenGL stack, and creating //! EGL surfaces from a wayland surface. //! //! See WlEglSurface documentation for details. u...
/// Create an EGL surface from a raw pointer to a wayland surface /// /// # Safety /// /// The provided pointer must be a valid `wl_surface` pointer from `libwayland-client`. pub unsafe fn new_from_raw(surface: *mut wl_proxy, width: i32, height: i32) -> WlEglSurface { let ptr = ffi_dis...
{ if surface.interface().name != "wl_surface" { return Err(InvalidId); } let ptr = surface.as_ptr(); if ptr.is_null() { Err(InvalidId) } else { Ok(unsafe { WlEglSurface::new_from_raw(ptr, width, height) }) } }
identifier_body
lib.rs
#![warn(missing_docs, missing_debug_implementations)] //! EGL utilities //! //! This module contains bindings to the `libwayland-egl.so` library. //! //! This library is used to interface with the OpenGL stack, and creating //! EGL surfaces from a wayland surface. //! //! See WlEglSurface documentation for details. u...
(&self) -> *const c_void { self.ptr as *const c_void } } impl Drop for WlEglSurface { fn drop(&mut self) { unsafe { ffi_dispatch!(WAYLAND_EGL_HANDLE, wl_egl_window_destroy, self.ptr); } } }
ptr
identifier_name
lib.rs
#![warn(missing_docs, missing_debug_implementations)] //! EGL utilities //! //! This module contains bindings to the `libwayland-egl.so` library. //! //! This library is used to interface with the OpenGL stack, and creating //! EGL surfaces from a wayland surface. //! //! See WlEglSurface documentation for details. u...
} /// Create an EGL surface from a raw pointer to a wayland surface /// /// # Safety /// /// The provided pointer must be a valid `wl_surface` pointer from `libwayland-client`. pub unsafe fn new_from_raw(surface: *mut wl_proxy, width: i32, height: i32) -> WlEglSurface { let ptr = f...
{ Ok(unsafe { WlEglSurface::new_from_raw(ptr, width, height) }) }
conditional_block
service-group-api.ts
import {Router, Request, Response} from 'express'; import {ServiceGroupRepo} from '../persistence/service-group-repo'; import {HttpStatus} from '../common/http-status'; import {CommandBus} from '../infrastructure/cqrs/index'; import {RequestHandler} from 'express'; import {NextFunction} from 'express'; import {IService...
async getServiceGroupById(req: Request, res: Response, next: Function): Promise<void> { let id = Validate.notEmpty(req.param('id')), group = await this.repo.getById(id); if (!group) { throw new NotFoundError(`No group with id ${id}`); } res.json(toServiceG...
{ let groups = await this.repo.getAll(); res.json(groups.map(group => toServiceGroupSummary(group))) }
identifier_body
service-group-api.ts
import {Router, Request, Response} from 'express'; import {ServiceGroupRepo} from '../persistence/service-group-repo'; import {HttpStatus} from '../common/http-status'; import {CommandBus} from '../infrastructure/cqrs/index'; import {RequestHandler} from 'express'; import {NextFunction} from 'express'; import {IService...
throw new NotFoundError(`No group with id ${id}`); } res.json(toServiceGroupSummary(group)); } async createServiceGroup(req: Request, res: Response): Promise<void> { let body = req.body || {}, name = body.name; await this.bus.process<ICreateServiceGroup...
if (!group) {
random_line_split
service-group-api.ts
import {Router, Request, Response} from 'express'; import {ServiceGroupRepo} from '../persistence/service-group-repo'; import {HttpStatus} from '../common/http-status'; import {CommandBus} from '../infrastructure/cqrs/index'; import {RequestHandler} from 'express'; import {NextFunction} from 'express'; import {IService...
(repo: ServiceGroupRepo = new ServiceGroupRepo(), bus: CommandBus = CommandBus.instance) { this.repo = repo; this.bus = bus; } routes(): Router { let router = express.Router(); router.get('/api/service-groups', handleErrors((req, res, next) => this.getServiceGroups(req, res, ne...
constructor
identifier_name
service-group-api.ts
import {Router, Request, Response} from 'express'; import {ServiceGroupRepo} from '../persistence/service-group-repo'; import {HttpStatus} from '../common/http-status'; import {CommandBus} from '../infrastructure/cqrs/index'; import {RequestHandler} from 'express'; import {NextFunction} from 'express'; import {IService...
res.json(toServiceGroupSummary(group)); } async createServiceGroup(req: Request, res: Response): Promise<void> { let body = req.body || {}, name = body.name; await this.bus.process<ICreateServiceGroupCommand>(ServiceGroupCommands.CreateServiceGroup, { name: na...
{ throw new NotFoundError(`No group with id ${id}`); }
conditional_block
home.rs
///Tässä tiedostossa luodaan routeri "/" polulle. Jos käyttäjä on kirjautuneena, näytetään omat ///tapahtumat, suosituimmat tapahtumat, lippukunnan tapahtumat ja hallinoimat tapahtumat. Jos ei ole, kerrotaan mikä on Silmukka ja ohjataan ///rekisteröitymään use nickel::{Nickel, HttpRouter}; use nickel::router::router::...
erverData>{ let mut home: Router<ServerData> = Nickel::router(); home.get("/", middleware!{|req, mut vastaus| let mut palautetaan = HashMap::new(); let logged = match *CookieSession::get_mut(req, &mut vastaus){ Some(_) => true, _ => false }; if logged =...
ter<S
identifier_name
home.rs
///Tässä tiedostossa luodaan routeri "/" polulle. Jos käyttäjä on kirjautuneena, näytetään omat ///tapahtumat, suosituimmat tapahtumat, lippukunnan tapahtumat ja hallinoimat tapahtumat. Jos ei ole, kerrotaan mikä on Silmukka ja ohjataan ///rekisteröitymään use nickel::{Nickel, HttpRouter}; use nickel::router::router::...
let mut user = "/user/".to_string(); // otetaan käyttäjänimi {let ref a: Option<String> = *CookieSession::get_mut(req, &mut vastaus); user.push_str(&(a.clone().unwrap()));} palautetaan.insert("kirjaudu".to_string(), "Kirjaudu ulos".to_string()); ...
if logged == false{ palautetaan.insert("kirjaudu".to_string(), "Kirjaudu sisään".to_string()); return vastaus.render("assets/out_index.html", &palautetaan); } else{
random_line_split
home.rs
///Tässä tiedostossa luodaan routeri "/" polulle. Jos käyttäjä on kirjautuneena, näytetään omat ///tapahtumat, suosituimmat tapahtumat, lippukunnan tapahtumat ja hallinoimat tapahtumat. Jos ei ole, kerrotaan mikä on Silmukka ja ohjataan ///rekisteröitymään use nickel::{Nickel, HttpRouter}; use nickel::router::router::...
}); return home; }
t home: Router<ServerData> = Nickel::router(); home.get("/", middleware!{|req, mut vastaus| let mut palautetaan = HashMap::new(); let logged = match *CookieSession::get_mut(req, &mut vastaus){ Some(_) => true, _ => false }; if logged == false{ p...
identifier_body
professors.js
(function() { 'use strict'; /** * @name config * @description config block */ function config($stateProvider) { $stateProvider .state('root.sub-bar-professors.professors', { url: '/professors', templateUrl: 'src/app/professors/professors.tpl.html', controller: 'Profess...
(ProfessorsService , $scope) { var professors = this; var postInit = function(professorsData) { professors.professors = professorsData; professors.loaded = true; professors.inputText = 'enter a professor\'s name...'; $scope.$applyAsync(); }; var init = function(){ Profess...
ProfessorsCtrl
identifier_name
professors.js
(function() { 'use strict'; /** * @name config * @description config block */ function config($stateProvider)
/** * @name ProfessorsCtrl * @description Controller */ function ProfessorsCtrl(ProfessorsService , $scope) { var professors = this; var postInit = function(professorsData) { professors.professors = professorsData; professors.loaded = true; professors.inputText = 'enter a prof...
{ $stateProvider .state('root.sub-bar-professors.professors', { url: '/professors', templateUrl: 'src/app/professors/professors.tpl.html', controller: 'ProfessorsCtrl as professors' } ); }
identifier_body
professors.js
(function() { 'use strict'; /** * @name config * @description config block */ function config($stateProvider) {
templateUrl: 'src/app/professors/professors.tpl.html', controller: 'ProfessorsCtrl as professors' } ); } /** * @name ProfessorsCtrl * @description Controller */ function ProfessorsCtrl(ProfessorsService , $scope) { var professors = this; var postInit = function(pr...
$stateProvider .state('root.sub-bar-professors.professors', { url: '/professors',
random_line_split
chart.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either ...
export interface Chart { id: string; config?: ChartConfig; } export interface ChartConfig { type: ChartType; axes?: Partial<Record<ChartAxisType, ChartAxisConfig>>; prediction?: boolean; lockAxes?: boolean; rangeSlider?: boolean; sort?: ChartSort; version: ChartConfigVersion; } export enum ChartConf...
import {QueryAttribute} from '../../model/query-attribute';
random_line_split
mod.rs
// Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co // // This file is part of cancer. // // cancer 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 // (a...
pub mod cursor; pub use self::cursor::Cursor; pub mod grid; pub use self::grid::Grid; mod tabs; pub use self::tabs::Tabs; mod input; pub use self::input::Input; mod sixel; pub use self::sixel::Sixel; mod terminal; pub use self::terminal::Terminal;
pub mod mode; pub use self::mode::Mode;
random_line_split
postgres_operator.py
# # 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
# "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 writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT...
# to you under the Apache License, Version 2.0 (the
random_line_split
some.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createTester = require('./internal/createTester'); var _createTester2 = _interopRequireDefault(_createTester); var _eachOf = require('./eachOf'); var _eachOf2 = _interopRequireDefault(_eachOf); var _identity = require('lodash/iden...
/** * Returns `true` if at least one element in the `coll` satisfies an async test. * If any iteratee call returns `true`, the main `callback` is immediately * called. * * @name some * @static * @memberOf module:Collections * @method * @alias any * @category Collection * @param {Array|Iterable|Object} coll...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
some.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createTester = require('./internal/createTester'); var _createTester2 = _interopRequireDefault(_createTester); var _eachOf = require('./eachOf'); var _eachOf2 = _interopRequireDefault(_eachOf); var _identity = require('lodash/iden...
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Returns `true` if at least one element in the `coll` satisfies an async test. * If any iteratee call returns `true`, the main `callback` is immediately * called. * * @name some * @static * @memberOf module:Collections * @method * @alias an...
_interopRequireDefault
identifier_name
some.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createTester = require('./internal/createTester'); var _createTester2 = _interopRequireDefault(_createTester); var _eachOf = require('./eachOf'); var _eachOf2 = _interopRequireDefault(_eachOf); var _identity = require('lodash/iden...
* @param {Array|Iterable|Object} coll - A collection to iterate over. * @param {Function} iteratee - A truth test to apply to each item in the array * in parallel. The iteratee is passed a `callback(err, truthValue)` which must * be called with a boolean argument once it has completed. Invoked with * (item, callba...
* @static * @memberOf module:Collections * @method * @alias any * @category Collection
random_line_split
io.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #[cfg(not(feature = "std"))] use alloc::prelude::*; use byteorder::ByteOrder; use core::result; pub type Result<T> = result::R...
} impl<R: Reader + ?Sized> ReadBytesExt for R {}
{ let mut buf = [0; 4]; self.read_exact(&mut buf)?; Ok(T::read_u32(&buf)) }
identifier_body
io.rs
// This file is part of zinc64.
// Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #[cfg(not(feature = "std"))] use alloc::prelude::*; use byteorder::ByteOrder; use core::result; pub type Result<T> = result::Result<T, String>; pub trait Rea...
random_line_split
io.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #[cfg(not(feature = "std"))] use alloc::prelude::*; use byteorder::ByteOrder; use core::result; pub type Result<T> = result::R...
(&mut self) -> Result<u8> { let mut buf = [0; 1]; self.read_exact(&mut buf)?; Ok(buf[0]) } #[inline] fn read_u16<T: ByteOrder>(&mut self) -> Result<u16> { let mut buf = [0; 2]; self.read_exact(&mut buf)?; Ok(T::read_u16(&buf)) } #[inline] fn read...
read_u8
identifier_name
form_group_name.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Self, SkipSelf} from '@angular/core'...
( @Optional() @Host() @SkipSelf() parent: ControlContainer, @Optional() @Self() @Inject(NG_VALIDATORS) validators: any[], @Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]) { super(); this._parent = parent; this._validators = validators; this._asyncValidators = as...
constructor
identifier_name
form_group_name.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Self, SkipSelf} from '@angular/core'...
* to indices when iterating over arrays in a `FormArray`. */ // TODO(issue/24571): remove '!'. @Input('formArrayName') name!: string|number|null; constructor( @Optional() @Host() @SkipSelf() parent: ControlContainer, @Optional() @Self() @Inject(NG_VALIDATORS) validators: any[], @Optional(...
* to a key in the parent `FormGroup` or `FormArray`. * Accepts a name as a string or a number. * The name in the form of a string is useful for individual forms, * while the numerical form allows for form arrays to be bound
random_line_split
form_group_name.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Self, SkipSelf} from '@angular/core'...
} } export const formArrayNameProvider: any = { provide: ControlContainer, useExisting: forwardRef(() => FormArrayName) }; /** * @description * * Syncs a nested `FormArray` to a DOM element. * * This directive is designed to be used with a parent `FormGroupDirective` (selector: * `[formGroup]`). * * It...
{ ReactiveErrors.groupParentException(); }
conditional_block
form_group_name.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Directive, forwardRef, Host, Inject, Input, OnDestroy, OnInit, Optional, Self, SkipSelf} from '@angular/core'...
/** * @description * Synchronous validator function composed of all the synchronous validators registered with this * directive. */ get validator(): ValidatorFn|null { return composeValidators(this._validators); } /** * @description * Async validator function composed of all the async v...
{ return controlPath(this.name == null ? this.name : this.name.toString(), this._parent); }
identifier_body