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
webkittab.py
self._follow_enter(tab) return try: selected_element = xml.etree.ElementTree.fromstring( '<html>{}</html>'.format(selection)).find('a') except xml.etree.ElementTree.ParseError: raise browsertab.WebTabError('Could...
is_muted
identifier_name
webkittab.py
if not self.selection_enabled: act = [QWebPage.MoveToNextLine, QWebPage.MoveToEndOfBlock] else: act = [QWebPage.SelectNextLine, QWebPage.SelectEndOfBlock] for _ in range(count): for a in act: self._widget.triggerP...
callback(None)
conditional_block
meta.tsx
import Head from "next/head"; import { CMS_NAME, HOME_OG_IMAGE_URL } from "../lib/constants"; export const Meta = () => { return ( <Head> <link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" /> ...
name="description" content={`A statically generated blog example using Next.js and ${CMS_NAME}.`} /> <meta property="og:image" content={HOME_OG_IMAGE_URL} /> </Head> ); };
content="/favicon/browserconfig.xml" /> <meta name="theme-color" content="#000" /> <link rel="alternate" type="application/rss+xml" href="/feed.xml" /> <meta
random_line_split
histogram_logscale.py
""" ================================================================================ Logscaled Histogram ================================================================================ | Calculates a logarithmically spaced histogram for a data map. | Written By: Matthew Stadelman | Date Written: 2016/03/07 | Last Mod...
(Histogram): r""" Performs a histogram where the bin limits are logarithmically spaced based on the supplied scale factor. If there are negative values then the first bin contains everything below 0, the next bin will contain everything between 0 and 1. kwargs include: scale_fact - numer...
HistogramLogscale
identifier_name
histogram_logscale.py
""" ================================================================================ Logscaled Histogram ================================================================================ | Calculates a logarithmically spaced histogram for a data map. | Written By: Matthew Stadelman | Date Written: 2016/03/07 | Last Mod...
based on the supplied scale factor. If there are negative values then the first bin contains everything below 0, the next bin will contain everything between 0 and 1. kwargs include: scale_fact - numeric value to generate axis scale for bins. A scale fact of 10 creates bins: 0-1, 1-1...
random_line_split
histogram_logscale.py
""" ================================================================================ Logscaled Histogram ================================================================================ | Calculates a logarithmically spaced histogram for a data map. | Written By: Matthew Stadelman | Date Written: 2016/03/07 | Last Mod...
r""" This defines the bins for a logscaled histogram """ self.data_vector.sort() sf = self.args['scale_fact'] num_bins = int(sp.logn(sf, self.data_vector[-1]) + 1) # # generating initial bins from 1 - sf**num_bins low = list(sp.logspace(0, num_bins, num_bi...
identifier_body
histogram_logscale.py
""" ================================================================================ Logscaled Histogram ================================================================================ | Calculates a logarithmically spaced histogram for a data map. | Written By: Matthew Stadelman | Date Written: 2016/03/07 | Last Mod...
if self.data_vector[0] < 0.0: low.insert(0, self.data_vector[0]) high.insert(0, 0.0) # self.bins = [bin_ for bin_ in zip(low, high)]
low.insert(0, 0.0) high.insert(0, 1.0)
conditional_block
atomic_nand_acq.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_nand_acq; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread;
// pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsafe impl Sync for A<T> {} impl<T> A<T> { fn new(v: T) -> A<T> { A { v: UnsafeCell::<T>::new(v) } } } type T = usize; macro_rules! atomic_nand_acq_test { ($init:expr, $value:expr, $re...
random_line_split
atomic_nand_acq.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_nand_acq; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_nand_acq<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsafe i...
(v: T) -> A<T> { A { v: UnsafeCell::<T>::new(v) } } } type T = usize; macro_rules! atomic_nand_acq_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data...
new
identifier_name
tests_iso_14443_a_card_1_hydranfc_v2.py
import time from pynfcreader.sessions.iso14443.iso14443a import Iso14443ASession def test_iso_14443_a_card_1_generic(hydranfc_connection):
hn = Iso14443ASession(drv=hydranfc_connection, block_size=120) hn.connect() hn.field_off() time.sleep(0.1) hn.field_on() hn.polling() r = hn.send_apdu("00 a4 04 00 0E 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31 00") assert b'oW\x84\x0e2PAY.S.DDF01\xa5E\xbf\x0cBO\x07\xa0\x00\x00\x00B\x1...
identifier_body
tests_iso_14443_a_card_1_hydranfc_v2.py
import time from pynfcreader.sessions.iso14443.iso14443a import Iso14443ASession
hn.field_off() time.sleep(0.1) hn.field_on() hn.polling() r = hn.send_apdu("00 a4 04 00 0E 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31 00") assert b'oW\x84\x0e2PAY.S.DDF01\xa5E\xbf\x0cBO\x07\xa0\x00\x00\x00B\x10\x10P\x02\x87\x01\x01\x9f(\x08@\x02\x00\x00\x00\x00a#O\x07\xa0\x00\x00\x00\x04\x...
def test_iso_14443_a_card_1_generic(hydranfc_connection): hn = Iso14443ASession(drv=hydranfc_connection, block_size=120) hn.connect()
random_line_split
tests_iso_14443_a_card_1_hydranfc_v2.py
import time from pynfcreader.sessions.iso14443.iso14443a import Iso14443ASession def
(hydranfc_connection): hn = Iso14443ASession(drv=hydranfc_connection, block_size=120) hn.connect() hn.field_off() time.sleep(0.1) hn.field_on() hn.polling() r = hn.send_apdu("00 a4 04 00 0E 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31 00") assert b'oW\x84\x0e2PAY.S.DDF01\xa5E\xbf\x0...
test_iso_14443_a_card_1_generic
identifier_name
topicview.py
) return ret #@memoizedproperty #def topicInputManager(self): # import topicinput # ret = topicinput.TopicInputManager(self.q) # ret.topicReceived.connect(self._submitTopic) # return ret def _submitPost(self, postData, imageData): if self.topicId and netman.manager().isOnline(): import...
w.refresh() return w
conditional_block
topicview.py
return topicedit.TopicEditorManagerBean(parent=self.q, manager=self.topicEditorManager) #@memoizedproperty #def topicInputBean(self): # import topicinput # return topicinput.TopicInputManagerBean(parent=self.q, manager=self.topicInputManager) @memoizedproperty def postEditorManager(self): import...
self.__d.clear() class _TopicViewManager:
random_line_split
topicview.py
return postinput.PostInputManagerBean(parent=self.q, manager=self.postInputManager) @memoizedproperty def topicEditBean(self): import topicedit return topicedit.TopicEditorManagerBean(parent=self.q, manager=self.topicEditorManager) #@memoizedproperty #def topicInputBean(self): # import topicinp...
def __init__(self, parent=None): WINDOW_FLAGS = Qt.Dialog|Qt.WindowMinMaxButtonsHint super(TopicView, self).__init__(parent, WINDOW_FLAGS) self.setWindowIcon(rc.icon('window-forum')) self.setWindowTitle(tr_("Topic")) self.__d = _TopicView(self) def refresh(self): self.__d.refresh() def clear(se...
identifier_body
topicview.py
self.topicComet = comets.createPostComet() qml = self.topicComet.q #qml.topicDataReceived.connect(self._onTopicReceived) qml.topicDataUpdated.connect(self._onTopicUpdated) qml.postDataUpdated.connect(self._onPostUpdated) qml.postDataReceived.connect(self._onPostReceive...
(self, data): # unicode json -> js = 'if (window.READY) addPost(%s); null' % data self.webView.evaljs(js
addPost
identifier_name
index.js
'use strict'; var util = require('../node_modules/mapbox-gl/js/util/util'); try { main(); } catch (err) { log('red', err.toString()); throw err; } function main() { var benchmarks = { simple_select_small: require('./tests/simple_select_small'), simple_select_large: require('./tests/si...
function createMap(options) { var mapElement = document.getElementById('map'); options = util.extend({width: 512, height: 512}, options); mapElement.style.display = 'block'; mapElement.style.width = options.width + 'px'; mapElement.style.height = options.height + 'px'; mapboxgl.accessToken ...
{ var regexp = new RegExp('[?&]' + name + '=([^&#]*)', 'i'); var output = regexp.exec(window.location.href); return output && output[1]; }
identifier_body
index.js
'use strict'; var util = require('../node_modules/mapbox-gl/js/util/util'); try { main(); } catch (err) { log('red', err.toString()); throw err; } function main() { var benchmarks = { simple_select_small: require('./tests/simple_select_small'), simple_select_large: require('./tests/si...
testDiv.innerHTML = innerHTML; log('dark', 'please keep this window in the foreground and close the debugger'); var createBenchmark = benchmarks[benchmarkName]; if (!createBenchmark) { log('dark', benchmarkName+' is not a valid test name'); return; } var benchmark = createBen...
} });
random_line_split
index.js
'use strict'; var util = require('../node_modules/mapbox-gl/js/util/util'); try { main(); } catch (err) { log('red', err.toString()); throw err; } function main() { var benchmarks = { simple_select_small: require('./tests/simple_select_small'), simple_select_large: require('./tests/si...
var benchmark = createBenchmark({ accessToken: getAccessToken(), createMap: createMap }); benchmark.on('log', function(event) { log(event.color || 'blue', event.message); }); benchmark.on('pass', function(event) { log('green', '<strong class="prose-big">' + event....
{ log('dark', benchmarkName+' is not a valid test name'); return; }
conditional_block
index.js
'use strict'; var util = require('../node_modules/mapbox-gl/js/util/util'); try { main(); } catch (err) { log('red', err.toString()); throw err; } function main() { var benchmarks = { simple_select_small: require('./tests/simple_select_small'), simple_select_large: require('./tests/si...
(name) { var regexp = new RegExp('[?&]' + name + '=([^&#]*)', 'i'); var output = regexp.exec(window.location.href); return output && output[1]; } function createMap(options) { var mapElement = document.getElementById('map'); options = util.extend({width: 512, height: 512}, options); mapElemen...
getURLParameter
identifier_name
headless.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 compositing::*; use geom::size::Size2D; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, Resize...
} fn handle_message(&self, constellation_chan: ConstellationChan) { loop { match self.port.recv() { Exit(chan) => { debug!("shutting down the constellation"); let ConstellationChan(ref con_chan) = constellation_chan; ...
{ let compositor = NullCompositor::new(port); // Tell the constellation about the initial fake size. { let ConstellationChan(ref chan) = constellation_chan; chan.send(ResizedWindowMsg(Size2D(640u, 480u))); } compositor.handle_message(constellation_chan); ...
identifier_body
headless.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 compositing::*; use geom::size::Size2D; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, Resize...
(&self, constellation_chan: ConstellationChan) { loop { match self.port.recv() { Exit(chan) => { debug!("shutting down the constellation"); let ConstellationChan(ref con_chan) = constellation_chan; con_chan.send(ExitMsg); ...
handle_message
identifier_name
headless.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 compositing::*; use geom::size::Size2D; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, Resize...
// Explicitly list ignored messages so that when we add a new one, // we'll notice and think about whether it needs a response, like // SetIds. CreateRootCompositorLayerIfNecessary(..) | CreateDescendantCompositorLayerIfNecessary(..) | Set...
SetIds(_, response_chan, _) => { response_chan.send(()); }
random_line_split
poll_fn.rs
use crate::fmt; use crate::future::Future; use crate::pin::Pin; use crate::task::{Context, Poll}; /// Creates a future that wraps a function returning [`Poll`]. /// /// Polling the future delegates to the wrapped function. /// /// # Examples /// /// ``` /// #![feature(future_poll_fn)] /// # async fn run() { /// use co...
(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T> { (&mut self.f)(cx) } }
poll
identifier_name
poll_fn.rs
use crate::fmt; use crate::future::Future; use crate::pin::Pin; use crate::task::{Context, Poll}; /// Creates a future that wraps a function returning [`Poll`]. /// /// Polling the future delegates to the wrapped function. /// /// # Examples /// /// ``` /// #![feature(future_poll_fn)] /// # async fn run() { /// use co...
/// A Future that wraps a function returning [`Poll`]. /// /// This `struct` is created by [`poll_fn()`]. See its /// documentation for more. #[must_use = "futures do nothing unless you `.await` or poll them"] #[unstable(feature = "future_poll_fn", issue = "72302")] pub struct PollFn<F> { f: F, } #[unstable(feat...
{ PollFn { f } }
identifier_body
poll_fn.rs
use crate::fmt;
use crate::task::{Context, Poll}; /// Creates a future that wraps a function returning [`Poll`]. /// /// Polling the future delegates to the wrapped function. /// /// # Examples /// /// ``` /// #![feature(future_poll_fn)] /// # async fn run() { /// use core::future::poll_fn; /// use std::task::{Context, Poll}; /// ///...
use crate::future::Future; use crate::pin::Pin;
random_line_split
fps.py
# Copyright 2016 ARM Limited # # 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 writin...
""" Internal method for calculating the number of frames that did not render in a single vsync cycle. """ epsilon = 0.0001 func = lambda x: (abs(x - 1.0) > epsilon) and 1 or 0 not_at_vsync = vsyncs_to_compose.apply(func).sum() return not_at_vsync
identifier_body
fps.py
# Copyright 2016 ARM Limited # # 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 writin...
(self, data, action=None): """ data - a pandas.DataFrame object with frame data (e.g. frames.csv) action - output metrics names with additional action specifier """ self.data = data self.action = action def process(self, refresh_period, drop_threshold):...
__init__
identifier_name
fps.py
# Copyright 2016 ARM Limited # # 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 writin...
metrics = (fps, frame_count, janks, not_at_vsync) return per_frame_fps, metrics @staticmethod def _calc_janks(filtered_vsyncs_to_compose): """ Internal method for calculating jank frames. """ pause_latency = 20 vtc_deltas = filtered_vsyncs_to_compose -...
total_vsyncs = filtered_vsyncs_to_compose.sum() frame_count = filtered_vsyncs_to_compose.size if total_vsyncs: fps = 1e9 * frame_count / (vsync_interval * total_vsyncs) janks = self._calc_janks(filtered_vsyncs_to_compose) not_at_vsync = self._calc_not_at...
conditional_block
fps.py
# Copyright 2016 ARM Limited # # 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 writin...
return per_frame_fps, metrics @staticmethod def _calc_janks(filtered_vsyncs_to_compose): """ Internal method for calculating jank frames. """ pause_latency = 20 vtc_deltas = filtered_vsyncs_to_compose - filtered_vsyncs_to_compose.shift() vtc_deltas.index...
janks = self._calc_janks(filtered_vsyncs_to_compose) not_at_vsync = self._calc_not_at_vsync(vsyncs_to_compose) metrics = (fps, frame_count, janks, not_at_vsync)
random_line_split
testPathHelpers.py
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
def testPathComponents(self): components = PathComponents('/some/external/path/to/file.h5/with/internal/path/to/data') assert components.externalPath == '/some/external/path/to/file.h5' assert components.extension == '.h5' assert components.internalPath == '/with/internal/path/to/d...
if SIMULATE_WINDOWS: import ntpath os.sep = ntpath.sep os.path = ntpath
identifier_body
testPathHelpers.py
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
(self): components = PathComponents('/some/external/path/to/file.h5/with/internal/path/to/data') assert components.externalPath == '/some/external/path/to/file.h5' assert components.extension == '.h5' assert components.internalPath == '/with/internal/path/to/data' components = P...
testPathComponents
identifier_name
testPathHelpers.py
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
def test_getPathVariants(self): abs, rel = getPathVariants('/aaa/bbb/ccc/ddd.txt', '/aaa/bbb/ccc/eee') #assert abs == '/aaa/bbb/ccc/ddd.txt' # Use normpath to make sure this test works on windows... expected = os.path.normpath(os.path.join('/aaa/bbb/ccc/eee', '/aaa/bbb/ccc/ddd.txt'...
assert len(compressPathForDisplay(path, l)) == l
conditional_block
testPathHelpers.py
############################################################################### # lazyflow: data flow based lazy parallel computation framework # # Copyright (C) 2011-2014, the ilastik developers # <team@ilastik.org> # # This program is free software; you can redistribute it and/o...
assert len(compressPathForDisplay(path, l)) == l def test_getPathVariants(self): abs, rel = getPathVariants('/aaa/bbb/ccc/ddd.txt', '/aaa/bbb/ccc/eee') #assert abs == '/aaa/bbb/ccc/ddd.txt' # Use normpath to make sure this test works on windows... expected = os.path.norm...
def testCompressPathForDisplay(self): assert compressPathForDisplay("/a/b.txt", 30) == "/a/b.txt" path = "/test/bla/bla/this_is_a_very_long_filename_bla_bla.txt" for l in [5,10,15,20,30]:
random_line_split
KoaApplicationFactory.js
'use strict'; var views = require('co-views'); var assets = require('koa-static-folder'); var logger = require('koa-logger'); var route = require('koa-route'); var koa = require('koa'); var parser = require('co-body'); var KoaApplication = require('./KoaApplication'); const PUBLIC_PATH = './public'; var KoaApplicati...
}; module.exports = KoaApplicationFactory;
{ var render = views(__dirname + '/../views/', { map: { html: 'swig' } }); var app = new KoaApplication( koa, route, render, assets, logger, parser, name, port); app.setStaticFol...
identifier_body
KoaApplicationFactory.js
'use strict'; var views = require('co-views'); var assets = require('koa-static-folder'); var logger = require('koa-logger'); var route = require('koa-route'); var koa = require('koa'); var parser = require('co-body'); var KoaApplication = require('./KoaApplication'); const PUBLIC_PATH = './public'; var KoaApplicati...
app.setStaticFolder(PUBLIC_PATH); return app; } }; module.exports = KoaApplicationFactory;
assets, logger, parser, name, port);
random_line_split
KoaApplicationFactory.js
'use strict'; var views = require('co-views'); var assets = require('koa-static-folder'); var logger = require('koa-logger'); var route = require('koa-route'); var koa = require('koa'); var parser = require('co-body'); var KoaApplication = require('./KoaApplication'); const PUBLIC_PATH = './public'; var KoaApplicati...
(name, port){ var render = views(__dirname + '/../views/', { map: { html: 'swig' } }); var app = new KoaApplication( koa, route, render, assets, logger, parser, name, port); app....
build
identifier_name
ex31.py
print "You enter a dark room with three doors. Do you go through door #1, door #2 or door #3?" door = raw_input("> ") if door == "1": print "There's a giant bear here eating a cheese cake. What do you do?" print "1. Take the cake." print "2. Scream at the bear." bear = raw_input("> ") if bear ...
else: print "You are bore." else: print "You stumble around and fall on a knife and die. Good job!"
print " No bear, only unicorns. Suffer"
conditional_block
ex31.py
print "You enter a dark room with three doors. Do you go through door #1, door #2 or door #3?" door = raw_input("> ") if door == "1": print "There's a giant bear here eating a cheese cake. What do you do?" print "1. Take the cake." print "2. Scream at the bear." bear = raw_input("> ") if bear ...
print "Well, doing %s is probably better. Bear runs away." % bear elif door == "2": print "You stare into the endless abyss at Cthulhu's retina." print "1. Blueberries." print "2. Yellow jacket clothespins." print "3. Understanding revolvers yelling melodies." insanity = raw_input("> ") ...
elif bear == "2": print "The bear eats your legs off. Good job!" else:
random_line_split
__main__.py
import os import sys import textwrap from collections import OrderedDict from argparse import ArgumentParser, RawDescriptionHelpFormatter from faice.tools.run.__main__ import main as run_main from faice.tools.run.__main__ import DESCRIPTION as RUN_DESCRIPTION from faice.tools.vagrant.__main__ import main as vagrant_ma...
_ = parser.parse_known_args() sub_args = sub_parser.parse_known_args() tool = TOOLS[sub_args[1][0]] sys.argv[0] = 'faice {}'.format(sys.argv[1]) del sys.argv[1] exit(tool()) if __name__ == '__main__': main()
parser.print_help() exit()
conditional_block
__main__.py
import os import sys import textwrap from collections import OrderedDict from argparse import ArgumentParser, RawDescriptionHelpFormatter from faice.tools.run.__main__ import main as run_main from faice.tools.run.__main__ import DESCRIPTION as RUN_DESCRIPTION from faice.tools.vagrant.__main__ import main as vagrant_ma...
exit() _ = parser.parse_known_args() sub_args = sub_parser.parse_known_args() tool = TOOLS[sub_args[1][0]] sys.argv[0] = 'faice {}'.format(sys.argv[1]) del sys.argv[1] exit(tool()) if __name__ == '__main__': main()
description = [ 'FAICE Copyright (C) 2017 Christoph Jansen', '', 'This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it' 'under certain conditions. See the LICENSE file distributed with this software for details.', ] parse...
identifier_body
__main__.py
import os import sys import textwrap from collections import OrderedDict from argparse import ArgumentParser, RawDescriptionHelpFormatter from faice.tools.run.__main__ import main as run_main from faice.tools.run.__main__ import DESCRIPTION as RUN_DESCRIPTION from faice.tools.vagrant.__main__ import main as vagrant_ma...
(): description = [ 'FAICE Copyright (C) 2017 Christoph Jansen', '', 'This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it' 'under certain conditions. See the LICENSE file distributed with this software for details.', ] ...
main
identifier_name
__main__.py
import os import sys import textwrap from collections import OrderedDict from argparse import ArgumentParser, RawDescriptionHelpFormatter from faice.tools.run.__main__ import main as run_main from faice.tools.run.__main__ import DESCRIPTION as RUN_DESCRIPTION from faice.tools.vagrant.__main__ import main as vagrant_ma...
description=os.linesep.join([textwrap.fill(block) for block in description]), formatter_class=RawDescriptionHelpFormatter ) parser.add_argument( '-v', '--version', action='version', version=VERSION ) subparsers = parser.add_subparsers(title="tools") sub_parser = subparsers.a...
'This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it' 'under certain conditions. See the LICENSE file distributed with this software for details.', ] parser = ArgumentParser(
random_line_split
package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyIlmbase(AutotoolsPackage):
return args
"""The PyIlmBase libraries provides python bindings for the IlmBase libraries.""" homepage = "https://github.com/AcademySoftwareFoundation/openexr/tree/v2.3.0/PyIlmBase" url = "https://github.com/AcademySoftwareFoundation/openexr/releases/download/v2.3.0/pyilmbase-2.3.0.tar.gz" version('2.3.0', sha25...
identifier_body
package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyIlmbase(AutotoolsPackage): """The PyIlmBase libraries provides python bindings for the I...
(self): spec = self.spec args = [ '--with-boost-python-libname=boost_python{0}'.format( spec['python'].version.up_to(2).joined) ] return args
configure_args
identifier_name
package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyIlmbase(AutotoolsPackage): """The PyIlmBase libraries provides python bindings for the I...
args = [ '--with-boost-python-libname=boost_python{0}'.format( spec['python'].version.up_to(2).joined) ] return args
spec = self.spec
random_line_split
stock_slot_verification_request.py
# Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class SlotVerificationRequest(models.Model): _name = 'stock.slot.verification.request' _inherit = 'mail.thr...
comodel_name='stock.inventory', string='Inventory Adjustment', readonly=True) inventory_line_id = fields.Many2one( comodel_name='stock.inventory.line', string='Inventory Line', readonly=True) location_id = fields.Many2one( comodel_name='stock.location', ...
default="/", required=True, readonly=True, states={'wait': [('readonly', False)]}) inventory_id = fields.Many2one(
random_line_split
stock_slot_verification_request.py
# Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class SlotVerificationRequest(models.Model): _name = 'stock.slot.verification.request' _inherit = 'mail.thr...
(self): domain = [('product_id', '=', self.product_id.id), ('location_id', '=', self.location_id.id)] return domain @api.multi def _get_involved_lines_and_locations(self): involved_moves = self.env['stock.move'].search( self._get_involved_moves_domain()) ...
_get_involved_lines_domain
identifier_name
stock_slot_verification_request.py
# Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class SlotVerificationRequest(models.Model): _name = 'stock.slot.verification.request' _inherit = 'mail.thr...
@api.multi def action_view_inv_lines(self): action = self.env.ref( 'stock_inventory_verification_request.action_inv_adj_line_tree') result = action.read()[0] result['context'] = {} line_ids = self.mapped('involved_inv_line_ids').ids if len(line_ids) > 1: ...
action = self.env.ref('stock.stock_move_action') result = action.read()[0] result['context'] = {} moves_ids = self.mapped('involved_move_ids').ids if len(moves_ids) > 1: result['domain'] = [('id', 'in', moves_ids)] elif len(moves_ids) == 1: res = self.env....
identifier_body
stock_slot_verification_request.py
# Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class SlotVerificationRequest(models.Model): _name = 'stock.slot.verification.request' _inherit = 'mail.thr...
elif len(moves_ids) == 1: res = self.env.ref('stock.view_move_form', False) result['views'] = [(res and res.id or False, 'form')] result['res_id'] = moves_ids and moves_ids[0] or False return result @api.multi def action_view_inv_lines(self): action ...
result['domain'] = [('id', 'in', moves_ids)]
conditional_block
part.js
ns: "irc", description: "Part Message", phrases: { active: "Client parting" }, ports: { input: { bot: { title: "IRC Client", type: "Client", required: true } }, output: { channel: { title: "Channel", type: "string" }, who: {...
module.exports = { name: "part",
random_line_split
test_plugin_bbciplayer.py
import json import logging import unittest from requests import Response, Request from streamlink.compat import urlencode from streamlink.plugins.bbciplayer import BBCiPlayer class TestPluginBBCiPlayer(unittest.TestCase): def test_can_handle_url(self): # should match self.assertTrue( ...
Response(), last_response ] self.assertEqual(BBCiPlayer._extract_nonce(mock_response), mock_nonce)
Response(), # Add some extra dummy responses in to make sure we always get the last
random_line_split
test_plugin_bbciplayer.py
import json import logging import unittest from requests import Response, Request from streamlink.compat import urlencode from streamlink.plugins.bbciplayer import BBCiPlayer class TestPluginBBCiPlayer(unittest.TestCase): def test_can_handle_url(self): # should match self.assertTrue( ...
(self): mock_nonce = "mock-nonce-nse" last_response = Response() last_response.request = Request('GET', "http://example.com/?" + urlencode(dict( goto="http://example.com/?" + urlencode(dict( state=json.dumps(dict(nonce=mock_nonce)) )) ))) ...
test_extract_nonce
identifier_name
test_plugin_bbciplayer.py
import json import logging import unittest from requests import Response, Request from streamlink.compat import urlencode from streamlink.plugins.bbciplayer import BBCiPlayer class TestPluginBBCiPlayer(unittest.TestCase): def test_can_handle_url(self): # should match self.assertTrue( ...
mock_nonce = "mock-nonce-nse" last_response = Response() last_response.request = Request('GET', "http://example.com/?" + urlencode(dict( goto="http://example.com/?" + urlencode(dict( state=json.dumps(dict(nonce=mock_nonce)) )) ))) mock_response =...
identifier_body
mod.rs
pub mod vcx; pub mod connection; pub mod issuer_credential; pub mod utils; pub mod proof; pub mod credential_def; pub mod schema; pub mod credential; pub mod disclosed_proof; pub mod wallet; pub mod logger; pub mod return_types_u32; use std::fmt; /// This macro allows the VcxStateType to be /// serialized within serd...
(){ let z = VcxStateNone; let y = serde_json::to_string(&z).unwrap(); assert_eq!(y,"0"); } }
test_serialize_vcx_state_type
identifier_name
mod.rs
pub mod vcx; pub mod connection; pub mod issuer_credential; pub mod utils; pub mod proof; pub mod credential_def; pub mod schema; pub mod credential; pub mod disclosed_proof; pub mod wallet; pub mod logger; pub mod return_types_u32; use std::fmt; /// This macro allows the VcxStateType to be /// serialized within serd...
#[cfg(test)] mod tests { use super::*; use serde_json; use self::VcxStateType::*; #[test] fn test_serialize_vcx_state_type(){ let z = VcxStateNone; let y = serde_json::to_string(&z).unwrap(); assert_eq!(y,"0"); } }
pub status: libc::c_int, pub msg: *mut libc::c_char, }
random_line_split
CheckedMenuItem.js.uncompressed.js
require({cache:{ 'url:dijit/templates/CheckedMenuItem.html':"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon ...
this.onClick(evt); } }); });
{ this.set("checked", !this.checked); this.onChange(this.checked); }
conditional_block
CheckedMenuItem.js.uncompressed.js
require({cache:{ 'url:dijit/templates/CheckedMenuItem.html':"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon ...
this.domNode.setAttribute("aria-checked", checked ? "true" : "false"); this._set("checked", checked); }, iconClass: "", // override dijitNoIcon onChange: function(/*Boolean*/ /*===== checked =====*/){ // summary: // User defined function to handle check/uncheck events // tags: // c...
// Sets the class and state for the check box. domClass.toggle(this.domNode, "dijitCheckedMenuItemChecked", checked);
random_line_split
blogger.py
import gdata.blogger.client import gdata.blogger.data import atom class Blog: """ A simple class for interacting with a Blogger blog. It uses the Google gdata API to create, update and delete posts. """ def __init__ (self, blog, client): self.client = client self.blog_id = blog.get_blog_id() ...
return self.client.update(post) def publish(self, data): """ Publish the post to the blog. If no posts matched with the given title, then a new post will be created, otherwise the existent post will be updated. """ post = self.get_post(data['title']) return self.update_post(post, da...
if category.term == tag: post.category.remove(category)
conditional_block
blogger.py
import gdata.blogger.client import gdata.blogger.data import atom class Blog: """ A simple class for interacting with a Blogger blog. It uses the Google gdata API to create, update and delete posts. """ def __init__ (self, blog, client): self.client = client self.blog_id = blog.get_blog_id() ...
class NoSuchBlogError(Exception): pass class Account: def __init__ (self, config): """ ``config`` is a configuration dictionary that must provide values for: - *username* -- the email of the blogger user - *password* -- the password of the blogger user """ self.client = gdata.blo...
""" Generates a tag list from a comma-separated string value """ tags = data.get('tags','').strip() return [tag.strip() for tag in tags.split(',')] if len(tags) > 0 else []
identifier_body
blogger.py
import gdata.blogger.client import gdata.blogger.data import atom class Blog: """ A simple class for interacting with a Blogger blog. It uses the Google gdata API to create, update and delete posts. """ def __init__ (self, blog, client): self.client = client self.blog_id = blog.get_blog_id() ...
(self): """ List all posts. """ return [post.title.text for post in self.client.get_posts(self.blog_id).entry] def get_post(self, post_title): """ Retrieve a post by title. """ posts = [post for post in self.client.get_posts(self.blog_id).entry if post.title.text == post_title] ...
get_posts
identifier_name
blogger.py
import gdata.blogger.client import gdata.blogger.data import atom class Blog: """ A simple class for interacting with a Blogger blog. It uses the Google gdata API to create, update and delete posts. """ def __init__ (self, blog, client): self.client = client self.blog_id = blog.get_blog_id() ...
return urls[0] if len(urls) == 1 else None def taglist(self,data): """ Generates a tag list from a comma-separated string value """ tags = data.get('tags','').strip() return [tag.strip() for tag in tags.split(',')] if len(tags) > 0 else [] class NoSuchBlogError(Exception): pass class A...
""" Retrieve the url for a given post. """ urls = [link.href for link in post.link if link.rel == 'alternate']
random_line_split
jquery.equalHeight.js
import debounce from 'debounce'; import $ from 'jquery'; const groupElementsByTop = (groups, element) => { const top = $(element).offset().top;
return groups; }; const groupElementsByZero = (groups, element) => { groups[0] = groups[0] || []; groups[0].push(element); return groups; }; const clearHeight = elements => $(elements).css('height', 'auto'); const getHeight = element => $(element).height(); const applyMaxHeight = (elements) => { const hei...
groups[top] = groups[top] || []; groups[top].push(element);
random_line_split
jquery.equalHeight.js
import debounce from 'debounce'; import $ from 'jquery'; const groupElementsByTop = (groups, element) => { const top = $(element).offset().top; groups[top] = groups[top] || []; groups[top].push(element); return groups; }; const groupElementsByZero = (groups, element) => { groups[0] = groups[0] || []; grou...
}); // Handle ready event. $(document).on('ready', () => { if (updateOnDOMReady) { equalizeHeights(elements, groupByTop); } }); return this; };
{ equalizeHeights(elements, groupByTop); }
conditional_block
Switch.js
//>>built define("dojox/mobile/Switch",["dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/event","dojo/_base/window","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/dom-attr","dojo/touch","dijit/_Contained","dijit/_WidgetBase","./sniff","./_maskUtils","./common","dojo/has!dojo-bidi?d...
this._hasMaskImage=false; this._createMaskImage(); } },_changeState:function(_17,_18){ var on=(_17==="on"); this.left.style.display=""; this.right.style.display=""; this.inner.style.left=""; if(_18){ _6.add(this.switchNode,"mblSwitchAnimation"); } _6.remove(this.switchNode,on?"mblSwitchOff":"mblSwitchOn"); _6.add(this....
if(this.value=="off"){ _8.set(this.inner,"left",this.isLeftToRight()?("-"+_16):0); }
random_line_split
Switch.js
//>>built define("dojox/mobile/Switch",["dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/event","dojo/_base/window","dojo/dom-class","dojo/dom-construct","dojo/dom-style","dojo/dom-attr","dojo/touch","dijit/_Contained","dijit/_WidgetBase","./sniff","./_maskUtils","./common","dojo/has!dojo-bidi?d...
this.inherited(arguments); if(!this.templateString){ var c=(this.srcNodeRef&&this.srcNodeRef.className)||this.className||this["class"]; if((c=c.match(/mblSw.*Shape\d*/))){ this.shape=c; } _6.add(this.domNode,this.shape); var _11=this.name?" name=\""+this.name+"\"":""; this.domNode.innerHTML="<div class=\"mblSwitchInne...
{ this.domNode.style.msTouchAction="none"; }
conditional_block
movelist.rs
// This file is part of the shakmaty library. // Copyright (C) 2017-2022 Niklas Fiekas <niklas.fiekas@backscattering.de> // // 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 version 3 of...
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. use arrayvec::ArrayVec; use crate::types::Move; /// A container for moves that can be stored inline on the stack. /// /// The...
// but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
random_line_split
media-selection.js
/* * This file is part of the Husky Validation. * * (c) MASSIVE ART WebServices GmbH * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. * */ define([ 'type/default' ], function(Default) { 'use strict'; var dataChangedHandler = function(...
App.dom.data($el, 'media-selection', value); }, getValue: function() { return App.dom.data($el, 'media-selection'); }, needsValidation: function() { return false; }, ...
{ var ids = []; App.util.foreach(value, function(el) { ids.push(el.id); }.bind(this)); value = {ids: ids}; }
conditional_block
media-selection.js
/* * This file is part of the Husky Validation. * * (c) MASSIVE ART WebServices GmbH * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. * */ define([ 'type/default' ], function(Default) { 'use strict'; var dataChangedHandler = function(...
App.on(dataChangedEvent, dataChangedHandler); }, setValue: function(value) { // array of objects if (App.util.typeOf(value) === 'array' && App.util.typeOf(value[0]) === 'object') { var ids = []; ...
random_line_split
jdk.nashorn.api.scripting.JSObject.d.ts
declare namespace jdk { namespace nashorn { namespace api { namespace scripting { interface JSObject { call(arg0: java.lang.Object | any, ...vargs: (java.lang.Object | any)[]): java.lang.Object newObject(...vargs: (java.lang.Object | any)[]): java.lang.Object eval(arg0...
} } } } }
isFunction(): boolean isStrictFunction(): boolean isArray(): boolean toNumber(): number getDefaultValue(arg0: java.lang.Class<unknown>): java.lang.Object
random_line_split
locations.ts
import {Component} from '@angular/core'; import {NavController, NavParams, AlertController, Events} from 'ionic-angular'; import {WeatherLocation} from "../../interfaces/weather-location"; import {LocationsService} from "../../providers/locations-service"; import {GeocodeService} from "../../providers/geocode-service";...
{ locs: Array<WeatherLocation>; constructor(public navCtrl: NavController, public navParams: NavParams, public locationsService: LocationsService, public geocodeService: GeocodeService, public alertCtrl: AlertController, public events: Events) { locationsService.locations$.subscribe((locs: Arra...
LocationsPage
identifier_name
locations.ts
import {Component} from '@angular/core'; import {NavController, NavParams, AlertController, Events} from 'ionic-angular'; import {WeatherLocation} from "../../interfaces/weather-location"; import {LocationsService} from "../../providers/locations-service"; import {GeocodeService} from "../../providers/geocode-service";...
} } ] }); prompt.present(); } }
{ this.geocodeService.getLatLong(data.title).then(res => { let newLoc = {title: '', component: WeatherPage, icon: 'pin', loc: {lat: 0, lon: 0}}; newLoc.title = res.name; newLoc.loc.lat = res.location.latitude; newLoc.loc.lon = res.location.lo...
conditional_block
locations.ts
import {Component} from '@angular/core'; import {NavController, NavParams, AlertController, Events} from 'ionic-angular'; import {WeatherLocation} from "../../interfaces/weather-location"; import {LocationsService} from "../../providers/locations-service"; import {GeocodeService} from "../../providers/geocode-service";...
}) } } } ] }); prompt.present(); } }
this.locationsService.addLocation(newLoc);
random_line_split
locations.ts
import {Component} from '@angular/core'; import {NavController, NavParams, AlertController, Events} from 'ionic-angular'; import {WeatherLocation} from "../../interfaces/weather-location"; import {LocationsService} from "../../providers/locations-service"; import {GeocodeService} from "../../providers/geocode-service";...
if (data.title != '') { this.geocodeService.getLatLong(data.title).then(res => { let newLoc = {title: '', component: WeatherPage, icon: 'pin', loc: {lat: 0, lon: 0}}; newLoc.title = res.name; newLoc.loc.lat = res.location.latitude; ...
{ let prompt = this.alertCtrl.create({ title: 'Add a City', message: "Enter the city's name", inputs: [ { name: 'title', placeholder: 'City name' } ], buttons: [ { text: 'Cancel', handler: data => { console.log...
identifier_body
utils.py
''' utils.py: helper functions for DLP api Copyright (c) 2017 Vanessa Sochat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, ...
'''clean_text will remove phi findings from a text object :param text: the original text sent to the content.inspect DLP endpoint :param findings: the full response for the text. ''' if 'findings' in findings: for finding in findings['findings']: label = "**%s**" %finding['infoType']...
identifier_body
utils.py
''' utils.py: helper functions for DLP api Copyright (c) 2017 Vanessa Sochat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, ...
(items,size=100): '''paginate_items will return a list of lists, each of a particular max size ''' groups = [] for idx in range(0, len(items), size): group = items[idx:idx+size] groups.append(group) return groups def clean_text(text,findings): '''clean_text will remove phi ...
paginate_items
identifier_name
utils.py
''' utils.py: helper functions for DLP api Copyright (c) 2017 Vanessa Sochat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, ...
return groups def clean_text(text,findings): '''clean_text will remove phi findings from a text object :param text: the original text sent to the content.inspect DLP endpoint :param findings: the full response for the text. ''' if 'findings' in findings: for finding in findings['findi...
group = items[idx:idx+size] groups.append(group)
conditional_block
utils.py
''' utils.py: helper functions for DLP api Copyright (c) 2017 Vanessa Sochat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, c...
def clean_text(text,findings): '''clean_text will remove phi findings from a text object :param text: the original text sent to the content.inspect DLP endpoint :param findings: the full response for the text. ''' if 'findings' in findings: for finding in findings['findings']: ...
random_line_split
CapabilitiesSkillsService.ts
'use strict'; import angular, { IPromise, resource } from 'angular'; import { ICapabilitySkill } from '../../shared/ICapabilitySkillDTO'; export interface ICapabilitySkillResource extends resource.IResource<ICapabilitySkill>, ICapabilitySkill { capabilityskillId: '@_id'; $promise: IPromise<ICapabilitySkill>; } exp...
{ capabilityskillId: '@_id' }, { create: createAction, update: updateAction } ) as ICapabilitySkillsService; } ]);
}; return $resource( '/api/capabilityskill/:capabilityskillId',
random_line_split
node_count.rs
// Copyright 2015 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 visit_path_list_item(&mut self, prefix: &Path, item: &PathListItem) { self.count += 1; walk_path_list_item(self, prefix, item) } fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &PathParameters) { self.count += 1; walk_path_parameters(self, path_span,...
{ self.count += 1; walk_path(self, path) }
identifier_body
node_count.rs
// Copyright 2015 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 ...
(&mut self, b: &Block) { self.count += 1; walk_block(self, b) } fn visit_stmt(&mut self, s: &Stmt) { self.count += 1; walk_stmt(self, s) } fn visit_arm(&mut self, a: &Arm) { self.count += 1; walk_arm(self, a) } fn visit_pat(&mut self, p: &Pat) { ...
visit_block
identifier_name
node_count.rs
// Copyright 2015 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 ...
walk_assoc_type_binding(self, type_binding) } fn visit_attribute(&mut self, _attr: &Attribute) { self.count += 1; } }
} fn visit_assoc_type_binding(&mut self, type_binding: &TypeBinding) { self.count += 1;
random_line_split
no-whitespace-before-property.js
/** * @fileoverview Rule to disallow whitespace before properties * @author Kai Cataldo */ "use strict"; var astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Rule Definition //--------------------------------------------------------------------...
(node) { var token = sourceCode.getTokenBefore(node.property); while (token.value !== "[") { token = sourceCode.getTokenBefore(token); } return token; } /** * Reports whitespace before property token * @param {ASTNode} n...
findOpeningBracket
identifier_name
no-whitespace-before-property.js
/** * @fileoverview Rule to disallow whitespace before properties * @author Kai Cataldo */ "use strict"; var astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Rule Definition //--------------------------------------------------------------------...
//-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- return { MemberExpression: function(node) { var rightToken; var leftToken; ...
{ var replacementText = node.computed ? "" : "."; context.report({ node: node, message: "Unexpected whitespace before property {{propName}}.", data: { propName: sourceCode.getText(node.property) }, ...
identifier_body
no-whitespace-before-property.js
/** * @fileoverview Rule to disallow whitespace before properties * @author Kai Cataldo */ "use strict"; var astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Rule Definition //--------------------------------------------------------------------...
if (node.computed) { rightToken = findOpeningBracket(node); leftToken = sourceCode.getTokenBefore(rightToken); } else { rightToken = sourceCode.getFirstToken(node.property); leftToken = sourceCode.getTokenB...
{ return; }
conditional_block
no-whitespace-before-property.js
/** * @fileoverview Rule to disallow whitespace before properties * @author Kai Cataldo */ "use strict"; var astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ // Rule Definition //--------------------------------------------------------------------...
/** * Finds opening bracket token of node's computed property * @param {ASTNode} node - the node to check * @returns {Token} opening bracket token of node's computed property * @private */ function findOpeningBracket(node) { var token = sourceCod...
var sourceCode = context.getSourceCode(); //-------------------------------------------------------------------------- // Helpers //--------------------------------------------------------------------------
random_line_split
TerrainShader.d.ts
import { Uniform } from '../../../src/Three'; export const TerrainShader: { uniforms: { ambientLightColor: Uniform; diffuse: Uniform; directionalLights: Uniform; directionalShadowMap: Uniform; directionalShadowMatrix: Uniform; enableDiffuse1: Uniform; enableDiffuse2: Uniform; enable...
fragmentShader: string; };
}; vertexShader: string;
random_line_split
service.py
import uuid from motey.models.image import Image from motey.models.service_state import ServiceState class Service(object): """ Model object. Represent a service. A service can have multiple states, action types and service types. """ def __init__(self, service_name, images, id=uuid.uuid4().hex,...
state_message=data['state_message'] if 'state_message' in data else '' )
images=[Image.transform(image) for image in data['images']], state=data['state'] if 'state' in data else ServiceState.INITIAL,
random_line_split
service.py
import uuid from motey.models.image import Image from motey.models.service_state import ServiceState class Service(object): """ Model object. Represent a service. A service can have multiple states, action types and service types. """ def __init__(self, service_name, images, id=uuid.uuid4().hex,...
def __iter__(self): yield 'id', self.id yield 'service_name', self.service_name yield 'images', [dict(image) for image in self.images] yield 'state', self.state yield 'state_message', self.state_message @staticmethod def transform(data): """ Static ...
""" Constructor of the service model. :param service_name: the name of the service :type service_name: str :param images: list of images which are asociated with the service :type images: list :param id: autogenerated id of the service :type id: uuid :par...
identifier_body
service.py
import uuid from motey.models.image import Image from motey.models.service_state import ServiceState class
(object): """ Model object. Represent a service. A service can have multiple states, action types and service types. """ def __init__(self, service_name, images, id=uuid.uuid4().hex, state=ServiceState.INITIAL, state_message=''): """ Constructor of the service model. :param...
Service
identifier_name
service.py
import uuid from motey.models.image import Image from motey.models.service_state import ServiceState class Service(object): """ Model object. Represent a service. A service can have multiple states, action types and service types. """ def __init__(self, service_name, images, id=uuid.uuid4().hex,...
return Service( id=data['id'] if 'id' in data else uuid.uuid4().hex, service_name=data['service_name'], images=[Image.transform(image) for image in data['images']], state=data['state'] if 'state' in data else ServiceState.INITIAL, state_message=data['...
return None
conditional_block
dump.js
YUI.add('dump', function(Y) { /** * Returns a simple string representation of the object or array. * Other types of objects will be returned unprocessed. Arrays * are expected to be indexed. Use object notation for * associative arrays. * * If included, the dump method is added to the YUI instance. * * @modu...
// arrays [1, 2, 3] if (type == "array") { s.push("["); for (i=0,len=o.length;i<len;i=i+1) { if (L.isObject(o[i])) { s.push((d > 0) ? L.dump(o[i], d-1) : OBJ); } else { s.push(o[i]); } ...
} // dig into child objects the depth specifed. Default 3 d = (L.isNumber(d)) ? d : 3;
random_line_split
scanwifi.py
# -*- coding: utf-8 -*- """ 扫描周围无线网络,列出SSID and mac address 开启网卡监听模式(mon),侦听无线网络流量 开启/关闭 监听模式 >sudo airmon-ng start/stop wlan0 找回网络管理图标 >NetworkManager start """ import sys from scapy.all import * from argparse import ArgumentParser def packet_handler(pkt): ap_list = [] if pkt.haslayer(Dot11): if...
{prog} wlan0mon".format(prog=sys.argv[0]) parser = ArgumentParser(usage=usage) parser.add_argument('interface', help="the interface needed to monitor") args = parser.parse_args() iface = args.interface sniff(iface=iface, prn=packet_handler)
kt.addr2 not in ap_list: ap_list.append(pkt.addr2) print("Avaliable SSID: {name}, MAC: {addr}" "".fomat(name=pkt.info, addr=pkt.addr2)) usage = "python {prog} <interface>\n".format(prog=sys.argv[0]) usage += "\te.g. python
conditional_block
scanwifi.py
# -*- coding: utf-8 -*- """ 扫描周围无线网络,列出SSID and mac address 开启网卡监听模式(mon),侦听无线网络流量 开启/关闭 监听模式 >sudo airmon-ng start/stop wlan0 找回网络管理图标 >NetworkManager start """ import sys from scapy.all import * from argparse import ArgumentParser def packet_handler(pkt): ap_list = [] if pkt.haslayer(Dot11): if...
btype == 8: # filter mac address if pkt.addr2 not in ap_list: ap_list.append(pkt.addr2) print("Avaliable SSID: {name}, MAC: {addr}" "".fomat(name=pkt.info, addr=pkt.addr2)) usage = "python {prog} <interface>\n".format(prog=sys.argv[0]) usage...
= 0 and pkt.su
identifier_name
scanwifi.py
# -*- coding: utf-8 -*- """ 扫描周围无线网络,列出SSID and mac address 开启网卡监听模式(mon),侦听无线网络流量 开启/关闭 监听模式 >sudo airmon-ng start/stop wlan0 找回网络管理图标 >NetworkManager start """ import sys from scapy.all import * from argparse import ArgumentParser
ap_list = [] if pkt.haslayer(Dot11): if pkt.type == 0 and pkt.subtype == 8: # filter mac address if pkt.addr2 not in ap_list: ap_list.append(pkt.addr2) print("Avaliable SSID: {name}, MAC: {addr}" "".fomat(name=pkt.info, addr=...
def packet_handler(pkt):
random_line_split
scanwifi.py
# -*- coding: utf-8 -*- """ 扫描周围无线网络,列出SSID and mac address 开启网卡监听模式(mon),侦听无线网络流量 开启/关闭 监听模式 >sudo airmon-ng start/stop wlan0 找回网络管理图标 >NetworkManager start """ import sys from scapy.all import * from argparse import ArgumentParser def packet_handler(pkt): ap_list = [] if pkt.haslayer(Dot11): if...
{prog} wlan0mon".format(prog=sys.argv[0]) parser = ArgumentParser(usage=usage) parser.add_argument('interface', help="the interface needed to monitor") args = parser.parse_args() iface = args.interface sniff(iface=iface, prn=packet_handler)
# filter mac address if pkt.addr2 not in ap_list: ap_list.append(pkt.addr2) print("Avaliable SSID: {name}, MAC: {addr}" "".fomat(name=pkt.info, addr=pkt.addr2)) usage = "python {prog} <interface>\n".format(prog=sys.argv[0]) usage += "\te.g....
identifier_body
preprocessor.rs
use std::vec::Vec; use std::string::String; use std::collections::HashMap; //Returns a string with comments removed, with everything in lowercase pub fn sanitize_line(input: &mut String) { while let Some(i) = input.find(',') { input.remove(i); } match input.find(';') { Some(i) => *input = ...
} Ok(converted) }
sanitize_line(&mut line); if !line.is_empty() { converted.push(line); }
random_line_split
preprocessor.rs
use std::vec::Vec; use std::string::String; use std::collections::HashMap; //Returns a string with comments removed, with everything in lowercase pub fn
(input: &mut String) { while let Some(i) = input.find(',') { input.remove(i); } match input.find(';') { Some(i) => *input = input[0..i].to_string(), None => {} } *input = input.trim().to_string().to_lowercase(); } //Preprocessor should support #define VAL xyz pub fn prepro...
sanitize_line
identifier_name
preprocessor.rs
use std::vec::Vec; use std::string::String; use std::collections::HashMap; //Returns a string with comments removed, with everything in lowercase pub fn sanitize_line(input: &mut String) { while let Some(i) = input.find(',') { input.remove(i); } match input.find(';') { Some(i) => *input = ...
else { new.push(word.clone()); } } let check_line = current_line.trim_left(); if check_line.starts_with("#") { //Preprocessor definition let mut words = check_line.split_whitespace(); match &words.next().unwrap()[1..] { ...
{ let to_check; if word.ends_with(",") { to_check = &word[1..word.len() - 1]; } else { to_check = &word[1..]; } match definitions.get(to_check) { Some(n) => new.push(n.clone()), ...
conditional_block
preprocessor.rs
use std::vec::Vec; use std::string::String; use std::collections::HashMap; //Returns a string with comments removed, with everything in lowercase pub fn sanitize_line(input: &mut String)
//Preprocessor should support #define VAL xyz pub fn preprocess(input: &Vec<&str>) -> Result<Vec<String>, (String, u32)> { let mut output: Vec<String> = input.iter().map(|x| x.to_string()).collect(); let mut definitions: HashMap<String, String> = HashMap::new(); let mut line_num = 0u32; //Find defin...
{ while let Some(i) = input.find(',') { input.remove(i); } match input.find(';') { Some(i) => *input = input[0..i].to_string(), None => {} } *input = input.trim().to_string().to_lowercase(); }
identifier_body