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 |
|---|---|---|---|---|
test_deprecations.py | import logging
import pytest
from traitlets.config import Config
from dockerspawner import DockerSpawner
def test_deprecated_config(caplog):
cfg = Config()
cfg.DockerSpawner.image_whitelist = {"1.0": "jupyterhub/singleuser:1.0"}
log = logging.getLogger("testlog")
spawner = DockerSpawner(config=cfg,... | cfg = Config()
cfg.DockerSpawner.image_whitelist = {"1.0": "jupyterhub/singleuser:1.0"}
spawner = DockerSpawner(config=cfg)
assert await spawner.check_allowed("1.0")
with pytest.deprecated_call():
assert await spawner.check_image_whitelist("1.0") | identifier_body | |
test_deprecations.py | import logging
import pytest
from traitlets.config import Config
from dockerspawner import DockerSpawner
def test_deprecated_config(caplog):
cfg = Config()
cfg.DockerSpawner.image_whitelist = {"1.0": "jupyterhub/singleuser:1.0"}
| logging.WARNING,
'DockerSpawner.image_whitelist is deprecated in DockerSpawner 12.0, use '
'DockerSpawner.allowed_images instead',
)
]
assert spawner.allowed_images == {"1.0": "jupyterhub/singleuser:1.0"}
async def test_deprecated_methods():
cfg = Config()
... | log = logging.getLogger("testlog")
spawner = DockerSpawner(config=cfg, log=log)
assert caplog.record_tuples == [
(
log.name, | random_line_split |
generic_type_does_not_live_long_enough.rs | // Copyright 2018 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 | |
generic_type_does_not_live_long_enough.rs | // Copyright 2018 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 ... |
existential type WrongGeneric<T>: 'static;
//~^ ERROR the parameter type `T` may not live long enough
fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
t
}
| {
let y = 42;
let x = wrong_generic(&y);
let z: i32 = x; //~ ERROR mismatched types
} | identifier_body |
generic_type_does_not_live_long_enough.rs | // Copyright 2018 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 y = 42;
let x = wrong_generic(&y);
let z: i32 = x; //~ ERROR mismatched types
}
existential type WrongGeneric<T>: 'static;
//~^ ERROR the parameter type `T` may not live long enough
fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
t
}
| main | identifier_name |
sectionalize_pass.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 ... | fn should_not_create_sections_from_indented_headers() {
let doc = mk_doc(
~"#[doc = \"\n\
Text\n # Header\n\
Body\"]\
mod a {
}");
assert!(doc.cratemod().mods()[0].item.sections.is_empty());
}
#[test]
fn should_remove_sec... | }");
assert!(doc.cratemod().mods()[0].item.sections[0].body.contains("Body"));
}
#[test] | random_line_split |
sectionalize_pass.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 ... |
fn fold_trait(fold: &fold::Fold<()>, doc: doc::TraitDoc) -> doc::TraitDoc {
let doc = fold::default_seq_fold_trait(fold, doc);
doc::TraitDoc {
methods: do doc.methods.map |method| {
let (desc, sections) = sectionalize(copy method.desc);
doc::MethodDoc {
desc: ... | {
let doc = fold::default_seq_fold_item(fold, doc);
let (desc, sections) = sectionalize(copy doc.desc);
doc::ItemDoc {
desc: desc,
sections: sections,
.. doc
}
} | identifier_body |
sectionalize_pass.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 ... | (desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
/*!
* Take a description of the form
*
* General text
*
* # Section header
*
* Section text
*
* # Section header
*
* Section text
*
* and remove each header and accompanyin... | sectionalize | identifier_name |
sectionalize_pass.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 ... |
(new_desc, sections)
}
fn parse_header<'a>(line: &'a str) -> Option<&'a str> {
if line.starts_with("# ") {
Some(line.slice_from(2))
} else {
None
}
}
#[cfg(test)]
mod test {
use astsrv;
use attr_pass;
use doc;
use extract;
use prune_hidden_pass;
use section... | {
sections.push(current_section.unwrap());
} | conditional_block |
androgui.py | #!/usr/bin/env python2
'''Androguard Gui'''
import argparse
import sys
from androguard.core import androconf
from androguard.session import Session
from androguard.gui.mainwindow import MainWindow
from androguard.misc import init_print_colors
from PySide import QtCore, QtGui
from threading import Thread
class Ipyt... |
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Androguard GUI")
parser.add_argument("-d", "--debug", action="store_true", default=False)
parser.add_argument("-i", "--input_file", default=None)
parser.add_argument("-c", "--console", action="store_true", default=False)
ar... | from IPython.terminal.embed import InteractiveShellEmbed
from traitlets.config import Config
cfg = Config()
ipshell = InteractiveShellEmbed(
config=cfg,
banner1="Androguard version %s" % androconf.ANDROGUARD_VERSION)
init_print_colors()
ipshell() | identifier_body |
androgui.py | #!/usr/bin/env python2
'''Androguard Gui'''
import argparse
import sys
from androguard.core import androconf
from androguard.session import Session
from androguard.gui.mainwindow import MainWindow
from androguard.misc import init_print_colors
from PySide import QtCore, QtGui
from threading import Thread
class | (Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
from IPython.terminal.embed import InteractiveShellEmbed
from traitlets.config import Config
cfg = Config()
ipshell = InteractiveShellEmbed(
config=cfg,
banner1="Androguard versio... | IpythonConsole | identifier_name |
androgui.py | #!/usr/bin/env python2
'''Androguard Gui'''
import argparse
import sys
from androguard.core import androconf
from androguard.session import Session
from androguard.gui.mainwindow import MainWindow
from androguard.misc import init_print_colors
from PySide import QtCore, QtGui
from threading import Thread
class Ipyt... |
app = QtGui.QApplication(sys.argv)
window = MainWindow(session=session, input_file=args.input_file)
window.resize(1024, 768)
window.show()
sys.exit(app.exec_()) | random_line_split | |
androgui.py | #!/usr/bin/env python2
'''Androguard Gui'''
import argparse
import sys
from androguard.core import androconf
from androguard.session import Session
from androguard.gui.mainwindow import MainWindow
from androguard.misc import init_print_colors
from PySide import QtCore, QtGui
from threading import Thread
class Ipyt... |
# We need that to save huge sessions when leaving and avoid
# RuntimeError: maximum recursion depth exceeded while pickling an object
# or
# RuntimeError: maximum recursion depth exceeded in cmp
# http://stackoverflow.com/questions/2134706/hitting-maximum-recursion-depth-using-pythons-pickle-cpick... | androconf.set_debug() | conditional_block |
sepcomp-unwind.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 ... | () -> usize { 0 }
mod a {
pub fn f() {
panic!();
}
}
mod b {
pub fn g() {
::a::f();
}
}
fn main() {
thread::spawn(move|| { ::b::g() }).join().err().unwrap();
}
| pad | identifier_name |
sepcomp-unwind.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 ... | fn main() {
thread::spawn(move|| { ::b::g() }).join().err().unwrap();
} | random_line_split | |
sepcomp-unwind.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 ... | {
thread::spawn(move|| { ::b::g() }).join().err().unwrap();
} | identifier_body | |
partner_events.py | # -*- coding: UTF-8 -*-
import haystack
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from conference import models
from conference.templatetags.conference import fare_blob
from collections import defaultdict
from datetime import datetime
from xml.sax.saxutils im... | (self, *args, **options):
try:
conference = args[0]
except IndexError:
raise CommandError('conference missing')
partner_events = defaultdict(list)
for f in models.Fare.objects.available(conference=conference).filter(ticket_type='partner'):
try:
... | handle | identifier_name |
partner_events.py | # -*- coding: UTF-8 -*-
import haystack
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from conference import models
from conference.templatetags.conference import fare_blob
from collections import defaultdict
from datetime import datetime
from xml.sax.saxutils im... |
else:
d = (19 - time.hour) * 60
event.duration = d
event.save()
| d = (13 - time.hour) * 60 | conditional_block |
partner_events.py | # -*- coding: UTF-8 -*-
import haystack
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from conference import models
from conference.templatetags.conference import fare_blob
from collections import defaultdict
from datetime import datetime
from xml.sax.saxutils im... | try:
conference = args[0]
except IndexError:
raise CommandError('conference missing')
partner_events = defaultdict(list)
for f in models.Fare.objects.available(conference=conference).filter(ticket_type='partner'):
try:
date = datetime.strptime... | identifier_body | |
partner_events.py | # -*- coding: UTF-8 -*-
import haystack
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from conference import models
from conference.templatetags.conference import fare_blob
from collections import defaultdict
from datetime import datetime
from xml.sax.saxutils im... | for fare, time in partner_events[sch.date]:
track_id = 'f%s' % fare.id
for e in events:
if track_id in e.get_all_tracks_names():
event = e
break
else:
event = models.Event(... |
for sch in models.Schedule.objects.filter(conference=conference):
events = list(models.Event.objects.filter(schedule=sch)) | random_line_split |
dbutils.py | # -*- coding: UTF-8 -*-
"""
Database utilities.
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
from datetime import datetime, timedelta
import os
from sqlobject.dberrors import DuplicateEntryError
from sqlobject import SQLOb... | @param keywordName: keyword name as a string
@param interactive: Ask user before creating keyword (this is the default)
@type interactive: Bool
@return: Keyword instance or None if user cancel creation"""
result = Keyword.selectBy(name=keywordName)
result = list(result)
if len(result):
... | """Get a keyword by its name. Create it if needed | random_line_split |
dbutils.py | # -*- coding: UTF-8 -*-
"""
Database utilities.
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
from datetime import datetime, timedelta
import os
from sqlobject.dberrors import DuplicateEntryError
from sqlobject import SQLOb... | if name.startswith("@"):
name = name[1:]
lst = list(Keyword.selectBy(name=name))
if len(lst) == 0:
raise YokadiException("No keyword named '%s' found" % name)
return lst[0]
class TaskLockManager:
"""Handle a lock to prevent concurrent editing of the same task"""
def __init__(self,... | e YokadiException("No keyword supplied")
| conditional_block |
dbutils.py | # -*- coding: UTF-8 -*-
"""
Database utilities.
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
from datetime import datetime, timedelta
import os
from sqlobject.dberrors import DuplicateEntryError
from sqlobject import SQLOb... | def release(self):
"""Release the lock for that task"""
# Only release our lock
lock = self._getLock()
if lock and lock.pid == os.getpid():
TaskLock.delete(lock.id)
# vi: ts=4 sw=4 et
| pdate lock timestamp to avoid it to expire"""
lock = self._getLock()
lock.updateDate = datetime.now()
| identifier_body |
dbutils.py | # -*- coding: UTF-8 -*-
"""
Database utilities.
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
from datetime import datetime, timedelta
import os
from sqlobject.dberrors import DuplicateEntryError
from sqlobject import SQLOb... | wordName, interactive=True):
"""Get a keyword by its name. Create it if needed
@param keywordName: keyword name as a string
@param interactive: Ask user before creating keyword (this is the default)
@type interactive: Bool
@return: Keyword instance or None if user cancel creation"""
result = Key... | rCreateKeyword(key | identifier_name |
messages.test.ts | /**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {formatExecError, formatResultsErrors} from '..';
const unixStackTrace =
` ` +
`at stack (../... | },
);
expect(messages).toMatchSnapshot();
}); | noStackTrace: false, | random_line_split |
__init__.py | #!/usr/bin/env python
""" Python SCSS parser. """
import operator
from . import compat
VERSION_INFO = (0, 8, 73)
__project__ = "scss"
__version__ = "0.8.73"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "GNU LGPL"
CONV = {
'size': {
'em': 13.0,
'px': 1.0},
'length': {
... | (Exception):
""" Raise SCSS exception. """
pass
| ScssException | identifier_name |
__init__.py | #!/usr/bin/env python
""" Python SCSS parser. """
import operator
from . import compat
VERSION_INFO = (0, 8, 73)
__project__ = "scss"
__version__ = "0.8.73"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "GNU LGPL"
CONV = {
'size': {
'em': 13.0,
'px': 1.0},
'length': {
... | 'border-corner-image',
'border-top-left-image',
'border-top-right-image',
'border-bottom-right-image',
'border-bottom-left-image',
'border-fit',
'border-length',
'border-spacing',
'border-style',
'border-width',
'border-top',
'border-top-width',
'border-top-style',
... | random_line_split | |
__init__.py | #!/usr/bin/env python
""" Python SCSS parser. """
import operator
from . import compat
VERSION_INFO = (0, 8, 73)
__project__ = "scss"
__version__ = "0.8.73"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "GNU LGPL"
CONV = {
'size': {
'em': 13.0,
'px': 1.0},
'length': {
... | """ Raise SCSS exception. """
pass | identifier_body | |
__init__.py | #!/usr/bin/env python
""" Python SCSS parser. """
import operator
from . import compat
VERSION_INFO = (0, 8, 73)
__project__ = "scss"
__version__ = "0.8.73"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "GNU LGPL"
CONV = {
'size': {
'em': 13.0,
'px': 1.0},
'length': {
... |
OPRT = {
'^': operator.__pow__,
'+': operator.__add__,
'-': operator.__sub__,
'*': operator.__mul__,
'/': compat.div,
'!': operator.__neg__,
'<': operator.__lt__,
'<=': operator.__le__,
'>': operator.__gt__,
'>=': operator.__ge__,
'==': operator.__eq__,
'=': operator.__... | CONV_TYPE[k] = t
CONV_FACTOR[k] = f | conditional_block |
hasteMapSize.test.ts | /**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | *
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import os from 'os';
import path from 'path';
import HasteMap from 'jest-haste-map';
import {sync as realpath} from 'realpath-native';
import {cleanup, writeFiles} from '../Utils';
cons... | random_line_split | |
storageevent.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::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBindi... | use util::str::DOMString;
#[dom_struct]
pub struct StorageEvent {
event: Event,
key: Option<DOMString>,
oldValue: Option<DOMString>,
newValue: Option<DOMString>,
url: DOMString,
storageArea: MutNullableHeap<JS<Storage>>
}
impl StorageEvent {
pub fn new_inherited(key: Option<DOMString>,
... | random_line_split | |
storageevent.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::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBindi... | (&self) -> Option<DOMString> {
self.newValue.clone()
}
// https://html.spec.whatwg.org/multipage/#dom-storageevent-url
fn Url(&self) -> DOMString {
self.url.clone()
}
// https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea
fn GetStorageArea(&self) -> Option<Root... | GetNewValue | identifier_name |
storageevent.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::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBindi... | ;
let cancelable = if init.parent.cancelable {
EventCancelable::Cancelable
} else {
EventCancelable::NotCancelable
};
let event = StorageEvent::new(global, Atom::from(&*type_),
bubbles, cancelable,
... | { EventBubbles::DoesNotBubble } | conditional_block |
storageevent.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::StorageEventBinding;
use dom::bindings::codegen::Bindings::StorageEventBindi... |
// https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea
fn GetStorageArea(&self) -> Option<Root<Storage>> {
self.storageArea.get()
}
}
| {
self.url.clone()
} | identifier_body |
task-perf-spawnalot.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 ... | () { }
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"400"]
} else if args.len() <= 1u {
~[~"", ~"10"]
} else {
args
};
let n = uint::from_str(args[1]).get();
let mut i = 0u;
while i < n { task::spawn(|| f(n) ); i ... | g | identifier_name |
task-perf-spawnalot.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 ... | else if args.len() <= 1u {
~[~"", ~"10"]
} else {
args
};
let n = uint::from_str(args[1]).get();
let mut i = 0u;
while i < n { task::spawn(|| f(n) ); i += 1u; }
}
| {
~[~"", ~"400"]
} | conditional_block |
task-perf-spawnalot.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at | // option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os;
use std::task;
use std::uint;
fn f(n: uint) {
let mut i = 0u;
while i < n {
task::try(|| g() );
i += 1u;
}
}
fn g() { }
fn main() {
let args = os::args();
let args = ... | // 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 | random_line_split |
task-perf-spawnalot.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 ... |
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
~[~"", ~"400"]
} else if args.len() <= 1u {
~[~"", ~"10"]
} else {
args
};
let n = uint::from_str(args[1]).get();
let mut i = 0u;
while i < n { task::spawn(|| f(n) ); i += 1u;... | { } | identifier_body |
default.py | # -*- coding: cp1254 -*-
# please visit http://www.iptvxtra.net
import xbmc,xbmcgui,xbmcplugin,sys
icondir = xbmc.translatePath("special://home/addons/plugin.audio.radio7ulm/icons/")
plugin_handle = int(sys.argv[1])
def add_video_item(url, infolabels, img=''):
listitem = xbmcgui.ListItem(infolabels['title'], icon... | add_video_item('http://srv01.radio7.fmstreams.de/stream1/livestream.mp3',{ 'title': 'Radio 7 - Webradio'},img=icondir + 'radio-7_web.png')
add_video_item('http://srv02.radio7.fmstreams.de/radio7_upa',{ 'title': 'Radio 7 - 80er'},img=icondir + 'radio-7_80er.png')
add_video_item('http://srv02.radio7.fmstreams.de/radio7_d... | listitem.setInfo('video', infolabels)
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(plugin_handle, url, listitem, isFolder=False)
| random_line_split |
default.py | # -*- coding: cp1254 -*-
# please visit http://www.iptvxtra.net
import xbmc,xbmcgui,xbmcplugin,sys
icondir = xbmc.translatePath("special://home/addons/plugin.audio.radio7ulm/icons/")
plugin_handle = int(sys.argv[1])
def add_video_item(url, infolabels, img=''):
|
add_video_item('http://srv01.radio7.fmstreams.de/stream1/livestream.mp3',{ 'title': 'Radio 7 - Webradio'},img=icondir + 'radio-7_web.png')
add_video_item('http://srv02.radio7.fmstreams.de/radio7_upa',{ 'title': 'Radio 7 - 80er'},img=icondir + 'radio-7_80er.png')
add_video_item('http://srv02.radio7.fmstreams.de/radio7... | listitem = xbmcgui.ListItem(infolabels['title'], iconImage=img, thumbnailImage=img)
listitem.setInfo('video', infolabels)
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(plugin_handle, url, listitem, isFolder=False) | identifier_body |
default.py | # -*- coding: cp1254 -*-
# please visit http://www.iptvxtra.net
import xbmc,xbmcgui,xbmcplugin,sys
icondir = xbmc.translatePath("special://home/addons/plugin.audio.radio7ulm/icons/")
plugin_handle = int(sys.argv[1])
def | (url, infolabels, img=''):
listitem = xbmcgui.ListItem(infolabels['title'], iconImage=img, thumbnailImage=img)
listitem.setInfo('video', infolabels)
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(plugin_handle, url, listitem, isFolder=False)
add_video_item('http://srv01.radio7.f... | add_video_item | identifier_name |
module.tsx | import { CloudWatchDatasource } from './datasource';
import { CloudWatchAnnotationsQueryCtrl } from './annotations_query_ctrl';
import { CloudWatchJsonData, CloudWatchQuery } from './types';
import { CloudWatchLogsQueryEditor } from './components/LogsQueryEditor';
import { PanelQueryEditor } from './components/PanelQue... | import './query_parameter_ctrl';
import { DataSourcePlugin } from '@grafana/data';
import { ConfigEditor } from './components/ConfigEditor'; | random_line_split | |
archive.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Debug;
use std::fs::File;
use std::io::{Seek, SeekFrom};
use std::mem;
use std::path::Path;
use std::path::PathBuf;
use std::slice;
use std::vec::Vec;
use std::result::Result as StdResult;
use common::ReadExt;
use meta::WadMetadata;
use types::{WadLu... |
}
// Read metadata.
let meta = try!(WadMetadata::from_file(meta_path));
Ok(Archive {
meta: meta,
file: RefCell::new(file),
lumps: lumps,
index_map: index_map,
levels: levels,
path: wad_path,
})
}
... | {
assert!(i_lump > 0);
levels.push((i_lump - 1) as usize);
} | conditional_block |
archive.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Debug;
use std::fs::File;
use std::io::{Seek, SeekFrom};
use std::mem;
use std::path::Path;
use std::path::PathBuf;
use std::slice;
use std::vec::Vec;
use std::result::Result as StdResult;
use common::ReadExt;
use meta::WadMetadata;
use types::{WadLu... |
pub fn read_named_lump<T: Copy>(&self, name: &WadName) -> Option<Result<Vec<T>>> {
self.named_lump_index(name).map(|index| self.read_lump(index))
}
pub fn read_lump<T: Copy>(&self, index: usize) -> Result<Vec<T>> {
let mut file = self.file.borrow_mut();
let info = self.lumps[index... | {
self.read_named_lump(name)
.unwrap_or_else(|| Err(MissingRequiredLump(*name).in_archive(self)))
} | identifier_body |
archive.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Debug;
use std::fs::File;
use std::io::{Seek, SeekFrom};
use std::mem;
use std::path::Path;
use std::path::PathBuf;
use std::slice;
use std::vec::Vec;
use std::result::Result as StdResult;
use common::ReadExt;
use meta::WadMetadata;
use types::{WadLu... | levels: levels,
path: wad_path,
})
}
pub fn num_levels(&self) -> usize { self.levels.len() }
pub fn level_lump_index(&self, level_index: usize) -> usize {
self.levels[level_index]
}
pub fn level_name(&self, level_index: usize) -> &WadName {
self.lum... | meta: meta,
file: RefCell::new(file),
lumps: lumps,
index_map: index_map, | random_line_split |
archive.rs | use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::Debug;
use std::fs::File;
use std::io::{Seek, SeekFrom};
use std::mem;
use std::path::Path;
use std::path::PathBuf;
use std::slice;
use std::vec::Vec;
use std::result::Result as StdResult;
use common::ReadExt;
use meta::WadMetadata;
use types::{WadLu... | (&self, level_index: usize) -> usize {
self.levels[level_index]
}
pub fn level_name(&self, level_index: usize) -> &WadName {
self.lump_name(self.levels[level_index])
}
pub fn num_lumps(&self) -> usize { self.lumps.len() }
pub fn named_lump_index(&self, name: &WadName) -> Option<us... | level_lump_index | identifier_name |
adamax_optimizer.d.ts | /**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable... | extends Optimizer {
protected learningRate: number;
protected beta1: number;
protected beta2: number;
protected epsilon: number;
protected decay: number;
/** @nocollapse */
static className: string;
private accBeta1;
private iteration;
private accumulatedFirstMoment;
private... | AdamaxOptimizer | identifier_name |
adamax_optimizer.d.ts | * 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 WARRANTIES OR ... | /**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); | random_line_split | |
forum.js | /*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum.js 33082 2013-04-18 11:13:53Z zhengqingpeng $
*/
function saveData(ignoreempty) {
var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty;
var obj = $('postform') && (($('fwin_newthread') && $(... |
function sidebar_collapse(lang) {
if(lang[0]) {
toggle_collapse('sidebar', null, null, lang);
$('wrap').className = $('wrap').className == 'wrap with_side s_clear' ? 'wrap s_clear' : 'wrap with_side s_clear';
} else {
var collapsed = getcookie('collapse');
collapsed = updatestring(collapsed, 'sideba... | {
var obj = $('postform') && (($('fwin_newthread') && $('fwin_newthread').style.display == '') || ($('fwin_reply') && $('fwin_reply').style.display == '')) ? $('postform') : $('fastpostform');
if(obj && obj.message.value != '') {
saveData();
url += (url.indexOf('?') != -1 ? '&' : '?') + 'cedit=yes';
}
loc... | identifier_body |
forum.js | /*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum.js 33082 2013-04-18 11:13:53Z zhengqingpeng $
*/
function saveData(ignoreempty) {
var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty;
var obj = $('postform') && (($('fwin_newthread') && $(... | if(ele[0] == 'message') {
if(!wysiwyg) {
textobj.value = elvalue;
} else {
editdoc.body.innerHTML = bbcode2html(elvalue);
}
} else {
el.value = elvalue;
}
} else if(ele[1] == 'SELECT') {
if($(el.id + '_ctrl_menu')) {
var lis = $(... | }
}
} else if(ele[1] == 'TEXTAREA') {
| random_line_split |
forum.js | /*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum.js 33082 2013-04-18 11:13:53Z zhengqingpeng $
*/
function saveData(ignoreempty) {
var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty;
var obj = $('postform') && (($('fwin_newthread') && $(... | (id) {
$(id).className = $(id).className == 'a' ? '' : 'a';
if(id == 'lf_fav') {
setcookie('leftsidefav', $(id).className == 'a' ? 0 : 1, 2592000);
}
}
var DTimers = new Array();
var DItemIDs = new Array();
var DTimers_exists = false;
function settimer(timer, itemid) {
if(timer && itemid) {
DTimers.p... | leftside | identifier_name |
forum.js | /*
[Discuz!] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum.js 33082 2013-04-18 11:13:53Z zhengqingpeng $
*/
function saveData(ignoreempty) {
var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty;
var obj = $('postform') && (($('fwin_newthread') && $(... |
}
function removetbodyrow(from, objid) {
if(!isUndefined(from) && $(objid)) {
from.removeChild($(objid));
}
}
function leftside(id) {
$(id).className = $(id).className == 'a' ? '' : 'a';
if(id == 'lf_fav') {
setcookie('leftsidefav', $(id).className == 'a' ? 0 : 1, 2592000);
}
}
var DTimers = ne... | {
_attachEvent(insertobj, insertID[2], function() {insertobj.className = '';});
} | conditional_block |
play-circle-outline.js | 'use strict';
var React = require('react/addons');
var PureRenderMixin = React.addons.PureRenderMixin;
var SvgIcon = require('../../svg-icon');
| render: function render() {
return React.createElement(
SvgIcon,
this.props,
React.createElement('path', { d: 'M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z' })
);
}
});
module.exports =... | var AvPlayCircleOutline = React.createClass({
displayName: 'AvPlayCircleOutline',
mixins: [PureRenderMixin],
| random_line_split |
issue-19340-1.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 ... | // pretty-expanded FIXME #23616
extern crate issue_19340_1 as lib;
use lib::Homura;
fn main() {
let homura = Homura::Madoka { name: "Kaname".to_string() };
match homura {
Homura::Madoka { name } => (),
};
} | // aux-build:issue-19340-1.rs
| random_line_split |
issue-19340-1.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 ... | {
let homura = Homura::Madoka { name: "Kaname".to_string() };
match homura {
Homura::Madoka { name } => (),
};
} | identifier_body | |
issue-19340-1.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 ... | () {
let homura = Homura::Madoka { name: "Kaname".to_string() };
match homura {
Homura::Madoka { name } => (),
};
}
| main | identifier_name |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
| dependencies = [
]
operations = [
migrations.CreateModel(
name='BTBeacon',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('label', models.CharField(max_length=255)),
('u... | identifier_body | |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class | (migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BTBeacon',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('label', models.CharField(max_leng... | Migration | identifier_name |
0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BTBeacon',
fields=[
('id', models.AutoField(ver... | ],
),
migrations.CreateModel(
name='Website',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title_fr', models.CharField(max_length=255)),
('title_en', model... | random_line_split | |
contributor_orcid.py | # coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... |
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
| return False | conditional_block |
contributor_orcid.py | # coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... | (self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
| __ne__ | identifier_name |
contributor_orcid.py | # coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... |
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x... | """
Sets the host of this ContributorOrcid.
:param host: The host of this ContributorOrcid.
:type: str
"""
self._host = host | identifier_body |
contributor_orcid.py | # coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... | def host(self, host):
"""
Sets the host of this ContributorOrcid.
:param host: The host of this ContributorOrcid.
:type: str
"""
self._host = host
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
... |
@host.setter | random_line_split |
run_tests.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at | #
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing p... | random_line_split | |
run_tests.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | args = sys.argv[1:]
args += ["--pd-thrift-path", pd_dir]
args += ["--enable-erspan", "--enable-vxlan", "--enable-geneve", "--enable-nvgre", "--enable-mpls"]
child = Popen([oft_path] + args)
child.wait()
sys.exit(child.returncode) | conditional_block | |
element_wrapper.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/. */
//! A wrapper over an element and a snapshot, that allows us to selector-match
//! against a past state of the ele... |
fn next_sibling_element(&self) -> Option<Self> {
self.element.next_sibling_element()
.map(|e| ElementWrapper::new(e, self.snapshot_map))
}
#[inline]
fn is_html_element_in_html_document(&self) -> bool {
self.element.is_html_element_in_html_document()
}
#[inline]
... | {
self.element.prev_sibling_element()
.map(|e| ElementWrapper::new(e, self.snapshot_map))
} | identifier_body |
element_wrapper.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/. */
//! A wrapper over an element and a snapshot, that allows us to selector-match
//! against a past state of the ele... | (&self) -> Option<Self> {
self.element.last_child_element()
.map(|e| ElementWrapper::new(e, self.snapshot_map))
}
fn prev_sibling_element(&self) -> Option<Self> {
self.element.prev_sibling_element()
.map(|e| ElementWrapper::new(e, self.snapshot_map))
}
fn next_s... | last_child_element | identifier_name |
element_wrapper.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/. */
//! A wrapper over an element and a snapshot, that allows us to selector-match
//! against a past state of the ele... | return Some(s);
}
let snapshot = self.snapshot_map.get(&self.element);
debug_assert!(snapshot.is_some(), "has_snapshot lied!");
self.cached_snapshot.set(snapshot);
snapshot
}
/// Returns the states that have changed since the element was snapshotted.
p... | if let Some(s) = self.cached_snapshot.get() { | random_line_split |
public.py | from configurations import values
from . import common, databases, email
from .. import __version__
class Raven(object):
|
class Sentry404(Raven):
"""Log 404 events to the Sentry server."""
MIDDLEWARE_CLASSES = (
'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
) + common.Common.MIDDLEWARE_CLASSES
class Public(email.Email, databases.Databases, common.Common):
"""General settings for pub... | """Report uncaught exceptions to the Sentry server."""
INSTALLED_APPS = common.Common.INSTALLED_APPS + ('raven.contrib.django.raven_compat',)
RAVEN_CONFIG = {
'dsn': values.URLValue(environ_name='RAVEN_CONFIG_DSN'),
'release': __version__,
} | identifier_body |
public.py | from configurations import values
from . import common, databases, email
from .. import __version__
class Raven(object):
"""Report uncaught exceptions to the Sentry server."""
INSTALLED_APPS = common.Common.INSTALLED_APPS + ('raven.contrib.django.raven_compat',)
RAVEN_CONFIG = {
'dsn': values.U... | SECURE_SSL_REDIRECT = True
class Prod(Public, SSL):
"""Settings for production server."""
pass | """Settings for SSL."""
SECURE_SSL_HOST = values.Value('www.example.com')
| random_line_split |
public.py | from configurations import values
from . import common, databases, email
from .. import __version__
class Raven(object):
"""Report uncaught exceptions to the Sentry server."""
INSTALLED_APPS = common.Common.INSTALLED_APPS + ('raven.contrib.django.raven_compat',)
RAVEN_CONFIG = {
'dsn': values.U... | (email.Email, databases.Databases, common.Common):
"""General settings for public projects."""
SECRET_KEY = values.SecretValue()
CSRF_COOKIE_HTTPONLY = True
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
X_FRAME_OPTIONS = 'DENY'
SILENCED_SYSTEM_CHECKS = values.List... | Public | identifier_name |
karma.conf.js | module.exports = function(config) {
config.set({
basePath: './',
frameworks: ['systemjs', 'jasmine'],
systemjs: {
configFile: 'config.js',
config: {
paths: {
"*": null,
"src/*": "src/*",
"typescript": "node_modules/typescript/lib/typescript.js",
... | }
},
transpiler: 'typescript'
},
serveFiles: [
'src/**/*.ts',
'jspm_packages/**/*.js'
]
},
files: [
'test/unit/*.spec.ts'
],
exclude: [],
preprocessors: { },
reporters: ['progress'],
port: 9876,
colors: tru... | 'src': {
defaultExtension: 'ts'
| random_line_split |
startup.py | # Copyright (c) 2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
client.remove_per_host_config(hostname, "IpInIpTunnelAddr")
def _get_host_tunnel_ip():
"""
:return: The IPAddress of the host's IPIP tunnel or None if not
present/invalid.
"""
raw_addr = client.get_per_host_config(hostname, "IpInIpTunnelAddr")
try:
ip_addr = IPAddress(raw... | client.release_ips({ip_addr}) | conditional_block |
startup.py | # Copyright (c) 2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | (ipip_pools):
"""
Claims an IPIP-enabled IP address from the first pool with some
space.
Stores the result in the host's config as its tunnel address.
Exits on failure.
:param ipip_pools: List of IPPools to search for an address.
"""
for ipip_pool in ipip_pools:
v4_addrs, _ = ... | _assign_host_tunnel_addr | identifier_name |
startup.py | # Copyright (c) 2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
def warn_if_unknown_ip(ip, ip6):
"""
Prints a warning message if the IP addresses are not assigned to interfaces
on the current host.
:param ip: IPv4 address which should be present on the host.
:param ip6: IPv6 address which should be present on the host.
:return: None
"""
if ip and... | """
Prints an error message and exits if either of the IPv4 or IPv6 addresses
is already in use by another calico BGP host.
:param ip: User-provided IPv4 address to start this node with.
:param ip6: User-provided IPv6 address to start this node with.
:return: Nothing
"""
ip_list = []
if... | identifier_body |
startup.py | # Copyright (c) 2016 Tigera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | if ip_conflicts.keys():
ip_error = "ERROR: IP address %s is already in use by host %s. " \
"Calico requires each compute host to have a unique IP. " \
"If this is your first time running the Calico node on " \
"this host, ensure that another host is n... | ip_conflicts = client.get_hostnames_from_ips(ip_list)
except KeyError:
# No hosts have been configured in etcd, so there cannot be a conflict
return
| random_line_split |
lib.rs | #![deny(missing_debug_implementations)]
use janus_plugin_sys as ffi;
use bitflags::bitflags;
pub use debug::LogLevel;
pub use debug::log;
pub use jansson::{JanssonDecodingFlags, JanssonEncodingFlags, JanssonValue, RawJanssonValue};
pub use session::SessionWrapper;
pub use ffi::events::janus_eventhandler as EventHandle... | (val: i32) -> JanusResult {
match val {
0 => Ok(()),
e => Err(JanusError { code: e })
}
}
}
impl Error for JanusError {}
impl fmt::Display for JanusError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{} (code: {})", self.to_cstr().to_str().... | from | identifier_name |
lib.rs | #![deny(missing_debug_implementations)]
use janus_plugin_sys as ffi;
use bitflags::bitflags;
pub use debug::LogLevel;
pub use debug::log;
pub use jansson::{JanssonDecodingFlags, JanssonEncodingFlags, JanssonValue, RawJanssonValue};
pub use session::SessionWrapper;
pub use ffi::events::janus_eventhandler as EventHandle... |
}
impl Deref for PluginResult {
type Target = RawPluginResult;
fn deref(&self) -> &RawPluginResult {
unsafe { &*self.ptr }
}
}
impl Drop for PluginResult {
fn drop(&mut self) {
unsafe { ffi::plugin::janus_plugin_result_destroy(self.ptr) }
}
}
unsafe impl Send for PluginResult {}... | {
let ptr = self.ptr;
mem::forget(self);
ptr
} | identifier_body |
lib.rs | #![deny(missing_debug_implementations)]
use janus_plugin_sys as ffi;
use bitflags::bitflags;
pub use debug::LogLevel;
pub use debug::log;
pub use jansson::{JanssonDecodingFlags, JanssonEncodingFlags, JanssonValue, RawJanssonValue};
pub use session::SessionWrapper;
pub use ffi::events::janus_eventhandler as EventHandle... | $crate::Plugin {
get_api_compatibility,
get_version,
get_version_string,
get_description,
get_name,
get_author,
get_package,
$($cb,)*
}
}}
}
/// Macro to export a Janus plugin instance from this module.
... | extern "C" fn get_version_string() -> *const c_char { $md.version_str.as_ptr() }
extern "C" fn get_description() -> *const c_char { $md.description.as_ptr() }
extern "C" fn get_name() -> *const c_char { $md.name.as_ptr() }
extern "C" fn get_author() -> *const c_char { $md.author.as_ptr()... | random_line_split |
form.py | """Form classes."""
from .errors import ValidationError
from .meta import FormBuilder
from .types import FormType, ListType, SetType, DictType
from .utils import Struct
class Form(object):
"""A form."""
__metaclass__ = FormBuilder
@classmethod
def from_obj(cls, obj):
"""
Return a form... |
return obj
| value = self._attrs.get(name)
if isinstance(field.typ, FormType):
obj_attr = getattr(obj, name, None)
subform = field.typ.form(**value)
value = subform.to_obj(obj_attr)
setattr(obj, name, value) | conditional_block |
form.py | """Form classes."""
from .errors import ValidationError
from .meta import FormBuilder
from .types import FormType, ListType, SetType, DictType
from .utils import Struct
class Form(object):
"""A form."""
__metaclass__ = FormBuilder
@classmethod
def from_obj(cls, obj):
"""
Return a form... | (self):
"""Validate the decoded form data. Raise ValidationError on failure."""
for name, field in self._meta.fields.iteritems():
value = self._attrs.get(name)
if value is None and field.require is True:
msg = "{} data is missing required fields: {}"
... | validate | identifier_name |
form.py | """Form classes."""
from .errors import ValidationError
from .meta import FormBuilder
from .types import FormType, ListType, SetType, DictType
from .utils import Struct
class Form(object):
"""A form."""
__metaclass__ = FormBuilder
@classmethod
def from_obj(cls, obj):
"""
Return a form... | raise ValidationError(msg.format(self.__class__.__name__, name))
if value is not None:
field.validate(self.__class__, name, value)
def to_dict(self):
"""Return the decoded form data as a dictionary."""
def copy(value):
if isinstance(value, dic... | random_line_split | |
form.py | """Form classes."""
from .errors import ValidationError
from .meta import FormBuilder
from .types import FormType, ListType, SetType, DictType
from .utils import Struct
class Form(object):
"""A form."""
__metaclass__ = FormBuilder
@classmethod
def from_obj(cls, obj):
"""
Return a form... | """
Return the decoded form data as an object. If the obj parameter is provided then it will be
loaded with the data. Otherwise a new object is created to return.
"""
if obj is None:
obj = Struct()
for name, field in self._meta.fields.iteritems():
value = ... | identifier_body | |
urls.py | from __future__ import absolute_import
| from django.conf.urls import url
from . import views as test_views
urlpatterns = [
url(r'^no-logging$', test_views.MockNoLoggingView.as_view()),
url(r'^logging$', test_views.MockLoggingView.as_view()),
url(r'^slow-logging$', test_views.MockSlowLoggingView.as_view()),
url(r'^explicit-logging$', test_vi... | random_line_split | |
example.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var lastModuleError = '';
var crashed = false;
function domContentLoaded(name, tc, config, width, height) {
common.attachDefaultListeners();
comm... | }
return filename + ' ' + map[i - 1].name + ' + 0x' + offs.toString(16);
}
}
var last = map.length - 1;
return filename + ' ' + map[last].name + ' + 0x' + offs.toString(16);
}
function buildTextMap(map) {
// The expected format of the map file is this:
// ...
// .text 0x00000000000201e... | while (filename.length < 50) {
filename = ' ' + filename; | random_line_split |
example.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var lastModuleError = '';
var crashed = false;
function | (name, tc, config, width, height) {
common.attachDefaultListeners();
common.createNaClModule(name, tc, config, width, height);
updateStatus('Page Loaded');
}
// Indicate success when the NaCl module has loaded.
function moduleDidLoad() {
updateStatus('LOADED');
setTimeout(boom, 2000);
}
function findAddres... | domContentLoaded | identifier_name |
example.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var lastModuleError = '';
var crashed = false;
function domContentLoaded(name, tc, config, width, height) {
common.attachDefaultListeners();
comm... |
function findAddress(addr, map) {
if (map.length < 1) {
return 'MAP Unavailable';
}
if (addr < map[0].offs) {
return 'Invalid Address';
}
for (var i = 1; i < map.length; i++) {
if (addr < map[i].offs) {
var offs = addr - map[i - 1].offs;
var filename = map[i - 1].file;
// For... | {
updateStatus('LOADED');
setTimeout(boom, 2000);
} | identifier_body |
example.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var lastModuleError = '';
var crashed = false;
function domContentLoaded(name, tc, config, width, height) {
common.attachDefaultListeners();
comm... |
return filename + ' ' + map[i - 1].name + ' + 0x' + offs.toString(16);
}
}
var last = map.length - 1;
return filename + ' ' + map[last].name + ' + 0x' + offs.toString(16);
}
function buildTextMap(map) {
// The expected format of the map file is this:
// ...
// .text 0x00000000000201e0 0... | {
filename = ' ' + filename;
} | conditional_block |
Gruntfile.js | var module = module;
//this keeps the module file from doing anything inside the jasmine tests.
//We could avoid this by making all the source be in a specific directory, but that would break backwards compatibility.
if (module) | {
module.exports = function (grunt) {
'use strict';
var config, debug, environment, spec;
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.registerTask('default', ['jasmine']);
spec = grunt.option('spec') || '*';
config = grunt.file.readJSON('config.json');
... | conditional_block | |
Gruntfile.js | var module = module;
//this keeps the module file from doing anything inside the jasmine tests.
//We could avoid this by making all the source be in a specific directory, but that would break backwards compatibility.
if (module) {
module.exports = function (grunt) {
'use strict';
var config, debug,... |
rallydeploy: {
options: {
server: config.server,
projectOid: 0,
deployFile: "deploy.json",
credentialsFile: "credentials.json",
timeboxFilter: "none"
},
prod: ... | }, | random_line_split |
tab-native.esm.js | /*!
* Native JavaScript for Bootstrap Tab v4.0.3 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2021 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/
const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document... | element, classNAME) {
element.classList.remove(classNAME);
}
const addEventListener = 'addEventListener';
const removeEventListener = 'removeEventListener';
const ariaSelected = 'aria-selected';
// collapse / tab
const collapsingClass = 'collapsing';
const activeClass = 'active';
const fadeClass = 'fade';
cons... | emoveClass( | identifier_name |
tab-native.esm.js | /*!
* Native JavaScript for Bootstrap Tab v4.0.3 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2021 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/
const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document... | } else {
handler.apply(element, [endEvent]);
}
}
function reflow(element) {
return element.offsetHeight;
}
function queryElement(selector, parent) {
const lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
}
... | setTimeout(() => {
if (!called) element.dispatchEvent(endEvent);
}, duration + 17); | random_line_split |
tab-native.esm.js | /*!
* Native JavaScript for Bootstrap Tab v4.0.3 (https://thednp.github.io/bootstrap.native/)
* Copyright 2015-2021 © dnp_theme
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
*/
const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document... |
function reflow(element) {
return element.offsetHeight;
}
function queryElement(selector, parent) {
const lookUp = parent && parent instanceof Element ? parent : document;
return selector instanceof Element ? selector : lookUp.querySelector(selector);
}
function addClass(element, classNAME) {
element.classLi... |
let called = 0;
const endEvent = new Event(transitionEndEvent);
const duration = getElementTransitionDuration(element);
if (duration) {
element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) {
if (e.target === element) {
handler.apply(element, [e]);
element.rem... | identifier_body |
jquery.countto.js | (function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(... |
}
function render(value) {
var formattedValue = settings.formatter.call(self, value, settings);
$self.html(formattedValue);
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 0, // the number the element should end at
... | {
// remove the interval
$self.removeData('countTo');
clearInterval(data.interval);
value = settings.to;
if (typeof(settings.onComplete) == 'function') {
settings.onComplete.call(self, value);
}
} | conditional_block |
jquery.countto.js | (function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(... | $self.data('countTo', data);
// if an existing interval can be found, clear it first
if (data.interval) {
clearInterval(data.interval);
}
data.interval = setInterval(updateTimer, settings.refreshInterval);
// initialize the element with the starting value
render(value);
function ... | data = $self.data('countTo') || {};
| random_line_split |
jquery.countto.js | (function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(... |
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 0, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be ... | {
var formattedValue = settings.formatter.call(self, value, settings);
$self.html(formattedValue);
} | identifier_body |
jquery.countto.js | (function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(... | (value, settings) {
return value.toFixed(settings.decimals);
}
}(jQuery)); | formatter | identifier_name |
core.js | define(["jquery", "underscore", "backbone"], function ($,_,Backbone) {
/* *****************************************************************************************************************
Prototype Inheritance
*********************************************************************************************************... | else {
var cid = options.collection
_collection = modelled.model.get(cid) || this.fact.models.get(cid)
_DEBUG && console.log("Local/Global Collection (%s): %o %o %o", cid, options, modelled, _collection)
}
if (!_collection) {
_collection = this.fact.factory.Local({ id: options.collection, fetch... | {
// global-collection
var cid = options.collection.substring(1)
_collection = fact.models.get(cid)
_DEBUG && console.log("Global Collection (%s): %o %o %o", cid, options, modelled, _collection)
} | conditional_block |
core.js | define(["jquery", "underscore", "backbone"], function ($,_,Backbone) {
/* *****************************************************************************************************************
Prototype Inheritance
*********************************************************************************************************... | }
if (!_collection) {
_collection = this.fact.factory.Local({ id: options.collection, fetch: false })
_DEBUG && console.log("Local Collection: %o %o %o %o", options.collection, options, modelled, _collection)
}
// resolve any string models
this.ux.model( { model: modelled.model, collection: _c... | random_line_split | |
core.js | define(["jquery", "underscore", "backbone"], function ($,_,Backbone) {
/* *****************************************************************************************************************
Prototype Inheritance
*********************************************************************************************************... | ;
return (_id()+"-"+_id()+"-"+_id()+"-"+_id()+"-"+_id()+"-"+_id()+"-"+_id()+"-"+_id());
},
/**
Generate a scoped UUID by pre-pending a prefix
**/
urn: function(prefix) {
return (prefix || core[idAttribute])+"#"+this.uuid();
},
/**
Turn camel-cased strings into a capitalised, space-separated ... | { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); } | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.