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
repository.js
import Mirage from 'ember-cli-mirage'; export default Mirage.Factory.extend({ name: 'travis-web', vcs_name: 'travis-web', github_language: 'ruby', active: true, active_on_org: false, email_subscribed: true, migration_status: null, owner_name: 'travis-ci', owner: Object.freeze({ login: 'travis-ci...
} });
{ // Creates permissions for first user in the database // TODO: I'd like to remove it at some point as this is unexpected // we should set up permissions as needed. Possibly whenever we fully // switch to permissions from V3 const user = server.schema.users.all().models[0] || null; ...
conditional_block
repository.js
import Mirage from 'ember-cli-mirage'; export default Mirage.Factory.extend({ name: 'travis-web', vcs_name: 'travis-web', github_language: 'ruby', active: true, active_on_org: false, email_subscribed: true, migration_status: null, owner_name: 'travis-ci', owner: Object.freeze({ login: 'travis-ci...
(repository, server) { if (!repository.attrs.skipPermissions) { // Creates permissions for first user in the database // TODO: I'd like to remove it at some point as this is unexpected // we should set up permissions as needed. Possibly whenever we fully // switch to permissions from V3 ...
afterCreate
identifier_name
repository.js
import Mirage from 'ember-cli-mirage'; export default Mirage.Factory.extend({ name: 'travis-web', vcs_name: 'travis-web', github_language: 'ruby', active: true, active_on_org: false, email_subscribed: true, migration_status: null, owner_name: 'travis-ci', owner: Object.freeze({ login: 'travis-ci...
});
{ if (!repository.attrs.skipPermissions) { // Creates permissions for first user in the database // TODO: I'd like to remove it at some point as this is unexpected // we should set up permissions as needed. Possibly whenever we fully // switch to permissions from V3 const user = server...
identifier_body
office_strings.debug.js
= "Vismaz vienam šūnu parametram ir neatļauta vērtība. Kārtīgi pārbaudiet vērtības un mēģiniet vēlreiz."; Strings.OfficeOM.L_DataNotMatchBindingType = "Norādītais datu objekts nav saderīgs ar šo saistījuma tipu."; Strings.OfficeOM.L_InvalidFormatValue = "Vismaz vienam formāta parametram ir neatļauta vērtība. Kārtīgi...
Strings.OfficeOM.L_SelectionCannotBound = "Nevar piesaistīt pašreizējai atlasei.";
random_line_split
ui.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 cssparser::RGBA; use parsing::parse; use style::values::{Auto, Either}; use style::values::specified::Color; u...
#[test] fn test_caret_color() { use style::properties::longhands::caret_color; let auto = parse_longhand!(caret_color, "auto"); assert_eq!(auto, Either::Second(Auto)); let blue_color = Color::Numeric { parsed: RGBA { red: 0, green: 0, blue: 255, ...
{ use style::properties::longhands::_moz_user_select; assert_roundtrip_with_context!(_moz_user_select::parse, "auto"); assert_roundtrip_with_context!(_moz_user_select::parse, "text"); assert_roundtrip_with_context!(_moz_user_select::parse, "none"); assert_roundtrip_with_context!(_moz_user_select::p...
identifier_body
ui.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 cssparser::RGBA; use parsing::parse; use style::values::{Auto, Either}; use style::values::specified::Color; u...
assert_roundtrip_with_context!(_moz_user_select::parse, "text"); assert_roundtrip_with_context!(_moz_user_select::parse, "none"); assert_roundtrip_with_context!(_moz_user_select::parse, "element"); assert_roundtrip_with_context!(_moz_user_select::parse, "elements"); assert_roundtrip_with_context!(_m...
assert_roundtrip_with_context!(_moz_user_select::parse, "auto");
random_line_split
ui.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 cssparser::RGBA; use parsing::parse; use style::values::{Auto, Either}; use style::values::specified::Color; u...
() { use style::properties::longhands::caret_color; let auto = parse_longhand!(caret_color, "auto"); assert_eq!(auto, Either::Second(Auto)); let blue_color = Color::Numeric { parsed: RGBA { red: 0, green: 0, blue: 255, alpha: 255, }, ...
test_caret_color
identifier_name
PgHelp.py
# # PgHelp.py -- web application threading help routines. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import tornado.web import tornado.websocket import tornado.tem...
"focus": InputEvent, "focusout": InputEvent, "blur": InputEvent, "drop": InputEvent, #"paste": InputEvent, # These are all Hammer.js events "pinch": GestureEvent, "pinchstart": GestureEvent, "pinchend": GestureEv...
self.name = name self.app = app self.app.add_ws_handler(self) self.event_callbacks = { "activate": WidgetEvent, "setbounds": ConfigEvent, "mousedown": InputEvent, "mouseup": InputEvent, "mousemove": InputEvent, "mouseout": ...
identifier_body
PgHelp.py
# # PgHelp.py -- web application threading help routines. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import tornado.web import tornado.websocket import tornado.tem...
return ('data:image/%s;base64,' % imgtype) + img_string def get_icon(iconpath, size=None, format='png'): image = io_rgb.PILimage.open(iconpath) if size is not None: wd, ht = size else: wd, ht = 24, 24 image = image.resize((wd, ht)) img_buf = BytesIO() image.save(img_buf, f...
img_string = img_string.decode("utf-8")
conditional_block
PgHelp.py
# # PgHelp.py -- web application threading help routines. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import tornado.web import tornado.websocket import tornado.tem...
"wheel": InputEvent, "click": InputEvent, "dblclick": InputEvent, "keydown": InputEvent, "keyup": InputEvent, "keypress": InputEvent, "resize": ConfigEvent, "focus": InputEvent, "focusout": InputEvent, ...
"mousemove": InputEvent, "mouseout": InputEvent, "mouseover": InputEvent, "mousewheel": InputEvent,
random_line_split
PgHelp.py
# # PgHelp.py -- web application threading help routines. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import tornado.web import tornado.websocket import tornado.tem...
(self): self.logger.info("windowhandler get") # Collect arguments wid = self.get_argument('id', None) # Get window with this id wids = self.app.get_wids() if wid in wids: window = self.app.get_window(wid) output = window.render() else: ...
get
identifier_name
app.ts
import {Component, provide} from '@angular/core'; import {Platform, ionicBootstrap} from 'ionic-angular'; import {StatusBar} from 'ionic-native'; import {LandingPage} from './pages/landing/landing'; import { FIREBASE_PROVIDERS, defaultFirebase, firebaseAuthConfig, AuthProviders, AuthMethods } from 'angularfir...
}) export class MyApp { private rootPage: any; constructor(private platform: Platform) { this.rootPage = LandingPage; platform.ready().then(() => { // Okay, so the platform is ready and our plugins are available. // Here you can do any higher level native things you might need. StatusBa...
@Component({ template: '<ion-nav [root]="rootPage"></ion-nav>'
random_line_split
app.ts
import {Component, provide} from '@angular/core'; import {Platform, ionicBootstrap} from 'ionic-angular'; import {StatusBar} from 'ionic-native'; import {LandingPage} from './pages/landing/landing'; import { FIREBASE_PROVIDERS, defaultFirebase, firebaseAuthConfig, AuthProviders, AuthMethods } from 'angularfir...
{ private rootPage: any; constructor(private platform: Platform) { this.rootPage = LandingPage; platform.ready().then(() => { // Okay, so the platform is ready and our plugins are available. // Here you can do any higher level native things you might need. StatusBar.styleDefault(); ...
MyApp
identifier_name
setup.py
#!/usr/bin/python3 # # Copyright 2015 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 b...
(args): log("info", "Running android-specific setup") if not os.path.isdir("/sysroot"): os.mkdir("/sysroot") recursive_chown("/sysroot") # wget and curl output unsuitable progress bars even when not # connected to a TTY. Turn them off. with open("/etc/wgetrc", "a") as f: print(...
toolchain_specific_setup
identifier_name
setup.py
#!/usr/bin/python3 # # Copyright 2015 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 b...
for f in os.listdir("/sysroot"): if os.path.isdir(os.path.join("/sysroot", f)): shutil.copytree(os.path.join("/sysroot", f), os.path.join("/toolchain_root", f)) elif os.path.isfile(os.path.join("/sysroot", f)): shutil.copy(os.path.join("/sysroot"...
for f in os.listdir(d): f = os.path.join(d, f) cmd = "chmod a+rx %s" % f run_cmd(cmd, as_root=True)
conditional_block
setup.py
#!/usr/bin/python3 # # Copyright 2015 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 b...
cmd = ("wget -O %s" " http://dl.google.com/android/ndk/android-" "ndk-r10e-linux-x86_64.bin" % (setup_file)) run_cmd(cmd) cmd = "chmod +x " + setup_file run_cmd(cmd) run_cmd(setup_file, output=False) log("info", "Setting up toolchain") cmd = ("/home/tuscan/android-n...
log("info", "Running android-specific setup") if not os.path.isdir("/sysroot"): os.mkdir("/sysroot") recursive_chown("/sysroot") # wget and curl output unsuitable progress bars even when not # connected to a TTY. Turn them off. with open("/etc/wgetrc", "a") as f: print("verbose = o...
identifier_body
setup.py
#!/usr/bin/python3 # # Copyright 2015 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 b...
cmd = ("wget -O %s" " http://dl.google.com/android/ndk/android-" "ndk-r10e-linux-x86_64.bin" % (setup_file)) run_cmd(cmd) cmd = "chmod +x " + setup_file run_cmd(cmd) run_cmd(setup_file, output=False) log("info", "Setting up toolchain") cmd = ("/home/tuscan/android-...
log("info", "Downloading & unpacking NDK") os.chdir("/home/tuscan") setup_file = "/home/tuscan/ndk.bin"
random_line_split
day7.rs
use std::io::prelude::*; use std::fs::File; use std::collections::VecDeque; fn get_aba_or_abba(s: &String, abba: bool) -> Vec<(char, char)>{ let mut aba_vec = Vec::new(); let mut char_vec = VecDeque::new(); let len = if abba {4} else {3}; for ch in s.chars() { char_vec.push_back(ch); // Only look at ...
let mut f = File::open("day7.txt").unwrap(); let mut f_s = String::new(); f.read_to_string(&mut f_s).unwrap(); let mut tls_count = 0; // part 1 let mut ssl_count = 0; // part 2 for l in f_s.lines() { let mut s: String = l.to_string(); let mut supernet_bits = String::new(); let mut hypernet_bi...
fn main() {
random_line_split
day7.rs
use std::io::prelude::*; use std::fs::File; use std::collections::VecDeque; fn get_aba_or_abba(s: &String, abba: bool) -> Vec<(char, char)>{ let mut aba_vec = Vec::new(); let mut char_vec = VecDeque::new(); let len = if abba {4} else {3}; for ch in s.chars() { char_vec.push_back(ch); // Only look at ...
} if get_aba_or_abba(&supernet_bits, true).len() != 0 && get_aba_or_abba(&hypernet_bits, true).len() == 0 { tls_count += 1; } let bab_list = get_aba_or_abba(&hypernet_bits, false); for aba in get_aba_or_abba(&supernet_bits, false) { if bab_list.contains(&(aba.1, aba.0)) { ...
{ let mut f = File::open("day7.txt").unwrap(); let mut f_s = String::new(); f.read_to_string(&mut f_s).unwrap(); let mut tls_count = 0; // part 1 let mut ssl_count = 0; // part 2 for l in f_s.lines() { let mut s: String = l.to_string(); let mut supernet_bits = String::new(); let mut hypernet_...
identifier_body
day7.rs
use std::io::prelude::*; use std::fs::File; use std::collections::VecDeque; fn get_aba_or_abba(s: &String, abba: bool) -> Vec<(char, char)>{ let mut aba_vec = Vec::new(); let mut char_vec = VecDeque::new(); let len = if abba {4} else {3}; for ch in s.chars() { char_vec.push_back(ch); // Only look at ...
} } } return aba_vec; } fn main() { let mut f = File::open("day7.txt").unwrap(); let mut f_s = String::new(); f.read_to_string(&mut f_s).unwrap(); let mut tls_count = 0; // part 1 let mut ssl_count = 0; // part 2 for l in f_s.lines() { let mut s: String = l.to_string(); let mut s...
{ aba_vec.push((char_vec[0],char_vec[1])); }
conditional_block
day7.rs
use std::io::prelude::*; use std::fs::File; use std::collections::VecDeque; fn
(s: &String, abba: bool) -> Vec<(char, char)>{ let mut aba_vec = Vec::new(); let mut char_vec = VecDeque::new(); let len = if abba {4} else {3}; for ch in s.chars() { char_vec.push_back(ch); // Only look at characters for the given pattern if char_vec.len() > len { char_vec.pop_front(); ...
get_aba_or_abba
identifier_name
nom.py
# Copyright 2012 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
(Entity): """ Subclassed by protocol-specific switch classes, e.g. pox.openflow.topology.OpenFlowSwitch """ """ class Port (Entity): def __init__ (self, num, hwAddr, name): Entity.__init__(self) self.number = num self.hwAddr = EthAddr(hwAddr) self.name = name """ class NOM (Graph, EventMixi...
Switch
identifier_name
nom.py
# Copyright 2012 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
class EntityJoin (EntityEvent): """ An entity has been added. Note that if there is a more specific join event defined for a particular entity, (e.g., SwitchJoin), this event will not be fired. TODO: or we could always raise EntityJoins along with SwitchJoins, which seems more intuitive to me. """...
def __init__ (self, entity): Event.__init__(self) self.entity = entity
identifier_body
nom.py
# Copyright 2012 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
self.add(entity) self.log.info(str(entity) + " joined") self.raiseEvent(EntityJoin, entity) def getEntitiesOfType (self, t=Entity, subtypes=True): if subtypes is False: return self.find(is_a=t) else: return self.find(type=t) def raiseEvent (self, event, *args, **kw): """ W...
raise RuntimeError("Entity exists")
conditional_block
nom.py
# Copyright 2012 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
else: return self.find(type=t) def raiseEvent (self, event, *args, **kw): """ Whenever we raise any event, we also raise an Update, so we extend the implementation in EventMixin. """ rv = EventMixin.raiseEvent(self, event, *args, **kw) if type(event) is not Update: EventMixin....
def getEntitiesOfType (self, t=Entity, subtypes=True): if subtypes is False: return self.find(is_a=t)
random_line_split
test-replace-widget.py
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import pynotify
def exposed_cb(button, event, n): global exposed_signal_id button.disconnect(exposed_signal_id) if not n.show(): print "Failed to send notification" gtk.main_quit() def clicked_cb(button, n): global count count += 1 n.update("Widget Attachment Test", "You clicked th...
import sys exposed_signal_id = 0 count = 0
random_line_split
test-replace-widget.py
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import pynotify import sys exposed_signal_id = 0 count = 0 def exposed_cb(button, event, n):
def clicked_cb(button, n): global count count += 1 n.update("Widget Attachment Test", "You clicked the button %s times" % count) if not n.show(): print "Failed to send notification" gtk.main_quit() if __name__ == '__main__': if not pynotify.init("Replace Test"): ...
global exposed_signal_id button.disconnect(exposed_signal_id) if not n.show(): print "Failed to send notification" gtk.main_quit()
identifier_body
test-replace-widget.py
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import pynotify import sys exposed_signal_id = 0 count = 0 def exposed_cb(button, event, n): global exposed_signal_id button.disconnect(exposed_signal_id) if not n.show(): print "Failed to send notification" gtk.main_quit(...
(button, n): global count count += 1 n.update("Widget Attachment Test", "You clicked the button %s times" % count) if not n.show(): print "Failed to send notification" gtk.main_quit() if __name__ == '__main__': if not pynotify.init("Replace Test"): sys.exit(1) ...
clicked_cb
identifier_name
test-replace-widget.py
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import pynotify import sys exposed_signal_id = 0 count = 0 def exposed_cb(button, event, n): global exposed_signal_id button.disconnect(exposed_signal_id) if not n.show(): print "Failed to send notification" gtk.main_quit(...
if not pynotify.init("Replace Test"): sys.exit(1) win = gtk.Window(gtk.WINDOW_TOPLEVEL) win.show() win.connect('delete_event', gtk.main_quit) button = gtk.Button("Click here to change notification") button.show() win.add(button) n = pynotify.Notification("Widget Attachment Test", ...
conditional_block
rust_completer.py
PartyFolder( DIR_OF_THIS_SCRIPT ) RACERD_BINARY_NAME = 'racerd' + ( '.exe' if utils.OnWindows() else '' ) RACERD_BINARY = p.join( DIR_OF_THIRD_PARTY, 'racerd', 'target', 'release', RACERD_BINARY_NAME ) RACERD_HMAC_HEADER = 'x-racerd-hmac' HMAC_SECRET_LENGTH = 16 BINARY_NOT_FOUND_MESSAGE = ( ...
( self, request_data ): try: completions = self._FetchCompletions( request_data ) except requests.HTTPError: if not self._rust_source_path: raise RuntimeError( ERROR_FROM_RACERD_MESSAGE ) raise if not completions: return [] return [ responses.BuildCompletionData( ...
ComputeCandidatesInner
identifier_name
rust_completer.py
-hmac' HMAC_SECRET_LENGTH = 16 BINARY_NOT_FOUND_MESSAGE = ( 'racerd binary not found. Did you build it? ' + 'You can do so by running ' + '"./build.py --racer-completer".' ) ERROR_FROM_RACERD_MESSAGE = ( 'Received error from racerd while retrieving completion...
os.unlink( self._server_stdout ) self._server_stdout = None
conditional_block
rust_completer.py
ThirdPartyFolder( DIR_OF_THIS_SCRIPT ) RACERD_BINARY_NAME = 'racerd' + ( '.exe' if utils.OnWindows() else '' ) RACERD_BINARY = p.join( DIR_OF_THIRD_PARTY, 'racerd', 'target', 'release', RACERD_BINARY_NAME ) RACERD_HMAC_HEADER = 'x-racerd-hmac' HMAC_SECRET_LENGTH = 16 BINARY_NOT_FOUND_MESSAGE...
def _StartServer( self ): """ Start racerd. """ with self._server_state_lock: self._hmac_secret = self._CreateHmacSecret() secret_file_path = self._WriteSecretFile( self._hmac_secret ) port = utils.GetUnusedLocalhostPort() args = [ self._racerd, 'serve', '-...
""" Write a file containing the `secret` argument. The path to this file is returned. Note that racerd consumes the file upon reading; removal of the temp file is intentionally not handled here. """ # Make temp file secret_fd, secret_path = tempfile.mkstemp( text=True ) # Write secret...
identifier_body
rust_completer.py
ThirdPartyFolder( DIR_OF_THIS_SCRIPT ) RACERD_BINARY_NAME = 'racerd' + ( '.exe' if utils.OnWindows() else '' ) RACERD_BINARY = p.join( DIR_OF_THIRD_PARTY, 'racerd', 'target', 'release', RACERD_BINARY_NAME ) RACERD_HMAC_HEADER = 'x-racerd-hmac' HMAC_SECRET_LENGTH = 16 BINARY_NOT_FOUND_MESSAGE...
return None return response.json() def _TranslateRequest( self, request_data ): """ Transform ycm request into racerd request """ if not request_data: return None file_path = request_data[ 'filepath' ] buffers = [] for path, obj in request_data[ 'file_data' ].items(): ...
if response.status_code is httplib.NO_CONTENT:
random_line_split
config.ts
/** * Copyright 2021 Google LLC * * 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...
}); }); };
{ center = changedCenter; zoom = changedZoom; update(m); }
conditional_block
config.ts
/** * Copyright 2021 Google LLC * * 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...
maps.forEach((m) => { m.addListener("bounds_changed", () => { const changedCenter = m.getCenter(); const changedZoom = m.getZoom(); if (changedCenter !== center || changedZoom !== zoom) { center = changedCenter; zoom = changedZoom; update(m); } }); }); };
{ maps.forEach((m) => { if (m === changedMap) { return; } m.setCenter(center); m.setZoom(zoom); }); }
identifier_body
config.ts
/** * Copyright 2021 Google LLC * * 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...
(changedMap: google.maps.Map) { maps.forEach((m) => { if (m === changedMap) { return; } m.setCenter(center); m.setZoom(zoom); }); } maps.forEach((m) => { m.addListener("bounds_changed", () => { const changedCenter = m.getCenter(); const changedZoom = m.getZo...
update
identifier_name
config.ts
/** * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
return; } m.setCenter(center); m.setZoom(zoom); }); } maps.forEach((m) => { m.addListener("bounds_changed", () => { const changedCenter = m.getCenter(); const changedZoom = m.getZoom(); if (changedCenter !== center || changedZoom !== zoom) { center = ch...
if (m === changedMap) {
random_line_split
next_permutation.py
""" 6 8 7 4 3 2 1. from right to left, find the first element which violates the increasing order, marked as N. 2. from right to left, find the first element which is larger that N, marked as M. 3. swap N and M. > 7 8 6 4 3 2 4. reverse all digits on the right of M. > 7 2 3 4 6 8 """ class Solution: ...
r_num = num[idx:] r_num.reverse() return num[:idx] + r_num sol = Solution() print sol.nextPermutation([1,3,2])
if len(num) <= 1: return num # from right to left, find the first num which violates the increasing trend. idx = len(num) - 1 while idx > 0: if num[idx - 1] < num[idx]: break idx -= 1 # ..., find the 1st num which is larger ...
identifier_body
next_permutation.py
""" 6 8 7 4 3 2 1. from right to left, find the first element which violates the increasing order, marked as N. 2. from right to left, find the first element which is larger that N, marked as M. 3. swap N and M. > 7 8 6 4 3 2 4. reverse all digits on the right of M. > 7 2 3 4 6 8 """ class Solution: ...
# from right to left, find the first num which violates the increasing trend. idx = len(num) - 1 while idx > 0: if num[idx - 1] < num[idx]: break idx -= 1 # ..., find the 1st num which is larger than num[idx] pn = len(num) - 1 ...
return num
conditional_block
next_permutation.py
""" 6 8 7 4 3 2 1. from right to left, find the first element which violates the increasing order, marked as N. 2. from right to left, find the first element which is larger that N, marked as M. 3. swap N and M. > 7 8 6 4 3 2 4. reverse all digits on the right of M. > 7 2 3 4 6 8 """ class Solution: ...
(self, num): if len(num) <= 1: return num # from right to left, find the first num which violates the increasing trend. idx = len(num) - 1 while idx > 0: if num[idx - 1] < num[idx]: break idx -= 1 # ..., find the 1s...
nextPermutation
identifier_name
next_permutation.py
3. swap N and M. > 7 8 6 4 3 2 4. reverse all digits on the right of M. > 7 2 3 4 6 8 """ class Solution: # @param num, a list of integer # @return a list of integer def nextPermutation(self, num): if len(num) <= 1: return num # from right to left, find the firs...
""" 6 8 7 4 3 2 1. from right to left, find the first element which violates the increasing order, marked as N. 2. from right to left, find the first element which is larger that N, marked as M.
random_line_split
VisualLayers.ts
} The created object representing the layer. */ defineLayer(layerName: LayerName, order = 0): Layer { const layer = this.__getOrMakeLayer(layerName) const previousOrder = layer.order layer.order = order // Sort only if order changed. if (previousOrder !== layer.order) this.__layers.sort((a, b) => a.order...
for (const name of layerNames) { const layer = this.__layers.find(l => l.name === name) this.__removeObjectFromLayer(obj, layer) } } /** * Remove an object from a layer or set of layers. * @param {THREE.Object3D[]} objects The objects to remove from the specified layer or layers. * @param {LayerNames...
const layer = this.__layers.find(l => l.name === layerNames) return this.__removeObjectFromLayer(obj, layer) }
conditional_block
VisualLayers.ts
this.__renderer = renderer this.__Scene = Scene } /** * Deletes all defined layers -- hence un-references contained objects so * they can be garbage collected -- as if starting with a fresh new * VisualLayers. Generally you should call this if you are getting rid * of layering, or want to define a new se...
*/ // IDEA: Optionally accept different Scene types per layer. constructor(renderer: Renderer, Scene = ThreeScene) {
random_line_split
VisualLayers.ts
The created object representing the layer. */ defineLayer(layerName: LayerName, order = 0): Layer { const layer = this.__getOrMakeLayer(layerName) const previousOrder = layer.order layer.order = order // Sort only if order changed. if (previousOrder !== layer.order) this.__layers.sort((a, b) => a.order ...
/** * Check if a layer exists. * @param {LayerName} layerName The name of the layer to check existence of. * @returns {boolean} A boolean indicating if the layer exists. */ hasLayer(layerName: LayerName): boolean { return this.__layers.some(l => l.name === layerName) } /** * The number of layers. *...
{ const index = this.__layers.findIndex(l => { if (l.name === layerName) { l.backingScene.children.length = 0 return true } return false }) if (index >= 0) this.__layers.splice(index, 1) }
identifier_body
VisualLayers.ts
(): void { this.__layers.length = 0 } /** * Defines a new layer. * @param {LayerName} layerName The name to give the layer. * @param {number} order The order it will have. The newly-defined layer will * render above other layers that have lower numbers, and below other layers * that have higher order num...
dispose
identifier_name
events.ts
import { parseTimestamp, getDayIdentifier, getTimestampIdentifier, isTimedless, updateHasTime, } from './timestamp' import { CalendarTimestamp, CalendarEvent, CalendarEventParsed } from 'vuetify/types' export function
( input: CalendarEvent, index: number, startProperty: string, endProperty: string, timed = false, category: string | false = false, ): CalendarEventParsed { const startInput = input[startProperty] const endInput = input[endProperty] const startParsed: CalendarTimestamp = parseTimestamp(startInput, tr...
parseEvent
identifier_name
events.ts
import { parseTimestamp, getDayIdentifier, getTimestampIdentifier, isTimedless, updateHasTime, } from './timestamp' import { CalendarTimestamp, CalendarEvent, CalendarEventParsed } from 'vuetify/types' export function parseEvent ( input: CalendarEvent, index: number, startProperty: string, endPropert...
export function isEventStart (event: CalendarEventParsed, day: CalendarTimestamp, dayIdentifier: number, firstWeekday: number): boolean { return dayIdentifier === event.startIdentifier || (firstWeekday === day.weekday && isEventOn(event, dayIdentifier)) } export function isEventOverlapping (event: CalendarEventPar...
{ return event.end.time === '00:00' && event.end.date === day.date && event.start.date !== day.date }
identifier_body
events.ts
import { parseTimestamp, getDayIdentifier, getTimestampIdentifier, isTimedless, updateHasTime, } from './timestamp' import { CalendarTimestamp, CalendarEvent, CalendarEventParsed } from 'vuetify/types' export function parseEvent ( input: CalendarEvent, index: number, startProperty: string, endPropert...
return { input, start, startIdentifier, startTimestampIdentifier, end, endIdentifier, endTimestampIdentifier, allDay, index, category } } export function isEventOn (event: CalendarEventParsed, dayIdentifier: number): boolean { return dayIdentifier >= event.startIdentifier && dayIdentifier <= event.endIdentifier } ...
random_line_split
common.py
endOfJson = comment.find("\n}")+2; jsonstring = comment[0:endOfJson]; description = comment[endOfJson:].strip(); # print("Parsing "+jsonstring) try: jsondata = json.loads(jsonstring) if len(description): jsondata["description"] = description; ...
if commits_since_release=="0": return v else: return v+"."+commits_since_release return "UNKNOWN"
random_line_split
common.py
"); else: defines.append("defined(USB)=False"); elif arg[1]=="F": "" # -Fxxx.yy in args is filename xxx.yy, which is mandatory for build_jswrapper.py else: print("Unknown command-line option") exit(1) else: ...
get_script_dir
identifier_name
common.py
x" , "float|int|int32|bool|pin|JsVar|JsVarName|JsVarArray", "A floating point number"] ], # // float - parses into a JsVarFloat which is passed to the function # // int - parses into a JsVarInt which is passed to the function # //...
# now scan print("Scanning "+jswrap) code = open(jswrap, "r").read() if is_for_document and "DO_NOT_INCLUDE_IN_DOCS" in code: print("FOUND 'DO_NOT_INCLUDE_IN_DOCS' IN FILE "+jswrap) continue for comment in re.findall(r"/\*JSON.*?\*/", code, ...
continue
conditional_block
common.py
defines = [] if board and ("build" in board.info) and ("defines" in board.info["build"]): for i in board.info["build"]["defines"]: print("Got define from board: " + i); defines.append(i) if parseArgs and len(sys.argv)>1: print("Using files from comm...
if jsondata["type"]=="event": return "event" if jsondata["type"]=="constructor": return "constructor" if jsondata["type"]=="function": return "function" if jsondata["type"]=="method": return "function" if jsondata["type"]=="variable": return "variable" if jsondata["type"]=="property": return "property" retu...
identifier_body
core.rs
// Copyright (c) 2017-2019 Linaro LTD // Copyright (c) 2017-2019 JUUL Labs // // SPDX-License-Identifier: Apache-2.0 //! Core tests //! //! Run the existing testsuite as a Rust unit test. use bootsim::{ DepTest, DepType, UpgradeInfo, ImagesBuilder, Images, NO_DEPS, REV_DEPS, testlog, }; use st...
(image: &Images, name: &str) { if let Ok(request) = env::var("MCUBOOT_DEBUG_DUMP") { if request.split(',').any(|req| { req == "all" || name.contains(req) }) { let count = IMAGE_NUMBER.fetch_add(1, Ordering::SeqCst); let full_name = format!("{}-{:04}", name, count)...
dump_image
identifier_name
core.rs
// Copyright (c) 2017-2019 Linaro LTD // Copyright (c) 2017-2019 JUUL Labs // // SPDX-License-Identifier: Apache-2.0 //! Core tests //! //! Run the existing testsuite as a Rust unit test. use bootsim::{ DepTest, DepType, UpgradeInfo, ImagesBuilder, Images, NO_DEPS, REV_DEPS, testlog, }; use st...
}
log::info!("Dump {:?}", full_name); image.debug_dump(&full_name); } }
random_line_split
core.rs
// Copyright (c) 2017-2019 Linaro LTD // Copyright (c) 2017-2019 JUUL Labs // // SPDX-License-Identifier: Apache-2.0 //! Core tests //! //! Run the existing testsuite as a Rust unit test. use bootsim::{ DepTest, DepType, UpgradeInfo, ImagesBuilder, Images, NO_DEPS, REV_DEPS, testlog, }; use st...
}
{ if request.split(',').any(|req| { req == "all" || name.contains(req) }) { let count = IMAGE_NUMBER.fetch_add(1, Ordering::SeqCst); let full_name = format!("{}-{:04}", name, count); log::info!("Dump {:?}", full_name); image.debug_dump(&full_na...
conditional_block
core.rs
// Copyright (c) 2017-2019 Linaro LTD // Copyright (c) 2017-2019 JUUL Labs // // SPDX-License-Identifier: Apache-2.0 //! Core tests //! //! Run the existing testsuite as a Rust unit test. use bootsim::{ DepTest, DepType, UpgradeInfo, ImagesBuilder, Images, NO_DEPS, REV_DEPS, testlog, }; use st...
{ if let Ok(request) = env::var("MCUBOOT_DEBUG_DUMP") { if request.split(',').any(|req| { req == "all" || name.contains(req) }) { let count = IMAGE_NUMBER.fetch_add(1, Ordering::SeqCst); let full_name = format!("{}-{:04}", name, count); log::info!("Dum...
identifier_body
https.rs
// This requires running with: // // ```bash // cargo run --example https --features native-tls-example // ``` // // Generate an identity like so: // // ```bash // openssl req -x509 -newkey rsa:4096 -nodes -keyout localhost.key -out localhost.crt -days 3650 // openssl pkcs12 -export -out identity.p12 -inkey localhost.k...
extern crate hyper_native_tls; #[cfg(feature = "native-tls-example")] fn main() { // Avoid unused errors due to conditional compilation ('native-tls-example' feature is not default) use hyper_native_tls::NativeTlsServer; use iron::{Iron, Request, Response}; use iron::status; use std::result::Result...
// ``` extern crate iron; #[cfg(feature = "native-tls-example")]
random_line_split
https.rs
// This requires running with: // // ```bash // cargo run --example https --features native-tls-example // ``` // // Generate an identity like so: // // ```bash // openssl req -x509 -newkey rsa:4096 -nodes -keyout localhost.key -out localhost.crt -days 3650 // openssl pkcs12 -export -out identity.p12 -inkey localhost.k...
() { // Avoid unused errors due to conditional compilation ('native-tls-example' feature is not default) use hyper_native_tls::NativeTlsServer; use iron::{Iron, Request, Response}; use iron::status; use std::result::Result; let ssl = NativeTlsServer::new("identity.p12", "mypass").unwrap(); ...
main
identifier_name
https.rs
// This requires running with: // // ```bash // cargo run --example https --features native-tls-example // ``` // // Generate an identity like so: // // ```bash // openssl req -x509 -newkey rsa:4096 -nodes -keyout localhost.key -out localhost.crt -days 3650 // openssl pkcs12 -export -out identity.p12 -inkey localhost.k...
{ // We need to do this to make sure `cargo test` passes. }
identifier_body
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
_ => { } } } } impl HTMLObjectElementMethods for HTMLObjectElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(&self) -> DomRoot<ValidityState> { let window = window_from_node(self); ValidityState::new(&window, self.upcast()) } // ...
{ // TODO(gw): Prefetch the image here. }
conditional_block
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
(&self) -> Option<DomRoot<HTMLFormElement>> { self.form_owner() } } impl Validatable for HTMLObjectElement { fn is_instance_validatable(&self) -> bool { true } fn validate(&self, validate_flags: ValidationFlags) -> bool { if validate_flags.is_empty() {} // Need more flag...
GetForm
identifier_name
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
prefix: Option<Prefix>, document: &Document) -> DomRoot<HTMLObjectElement> { Node::reflect_node(Box::new(HTMLObjectElement::new_inherited(local_name, prefix, document)), document, HTMLObjectElementBinding::Wrap) } } trait P...
random_line_split
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
} impl VirtualMethods for HTMLObjectElement { fn super_type(&self) -> Option<&VirtualMethods> { Some(self.upcast::<HTMLElement>() as &VirtualMethods) } fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { self.super_type().unwrap().attribute_mutated(attr, mutation); ...
{ if validate_flags.is_empty() {} // Need more flag check for different validation types later true }
identifier_body
fa.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; exp...
[ ['01:00', '04:00'], ['04:00', '12:00'], ['12:00', '13:00'], ['13:00', '19:00'], ['19:00', '24:00'], ['00:00', '01:00'] ] ];
[ ['ب', 'ص', 'ظ', 'ع', 'ش', 'ن'], ['بامداد', 'صبح', 'ظهر', 'عصر', 'شب', 'نیمه\u200cشب'], u ], u,
random_line_split
pif.rs
use byteorder::{BigEndian, ByteOrder}; pub const PIF_ROM_START: u32 = 0x0000; pub const PIF_ROM_END: u32 = 0x07bf; pub const PIF_RAM_SIZE: usize = 0x40; pub const PIF_RAM_START: u32 = 0x07c0; pub const PIF_RAM_END: u32 = PIF_RAM_START + (PIF_RAM_SIZE as u32) - 1; const TEST_SEED: u32 = 0x00023F3F; fn fix_ram(ram: &m...
_ => { panic!("Address out of range"); } } } }
{ BigEndian::write_u32(&mut self.ram[(addr - PIF_RAM_START) as usize..], value); }
conditional_block
pif.rs
use byteorder::{BigEndian, ByteOrder}; pub const PIF_ROM_START: u32 = 0x0000; pub const PIF_ROM_END: u32 = 0x07bf; pub const PIF_RAM_SIZE: usize = 0x40; pub const PIF_RAM_START: u32 = 0x07c0; pub const PIF_RAM_END: u32 = PIF_RAM_START + (PIF_RAM_SIZE as u32) - 1; const TEST_SEED: u32 = 0x00023F3F; fn fix_ram(ram: &m...
(&mut self, addr: u32, value: u32) { match addr { PIF_ROM_START...PIF_ROM_END => { panic!("Cannot write to PIF ROM"); } PIF_RAM_START...PIF_RAM_END => { BigEndian::write_u32(&mut self.ram[(addr - PIF_RAM_START) as usize..], value); ...
write
identifier_name
pif.rs
use byteorder::{BigEndian, ByteOrder}; pub const PIF_ROM_START: u32 = 0x0000; pub const PIF_ROM_END: u32 = 0x07bf; pub const PIF_RAM_SIZE: usize = 0x40; pub const PIF_RAM_START: u32 = 0x07c0; pub const PIF_RAM_END: u32 = PIF_RAM_START + (PIF_RAM_SIZE as u32) - 1; const TEST_SEED: u32 = 0x00023F3F; fn fix_ram(ram: &m...
panic!("Cannot write to PIF ROM"); } PIF_RAM_START...PIF_RAM_END => { BigEndian::write_u32(&mut self.ram[(addr - PIF_RAM_START) as usize..], value); } _ => { panic!("Address out of range"); } } } }
} pub fn write(&mut self, addr: u32, value: u32) { match addr { PIF_ROM_START...PIF_ROM_END => {
random_line_split
pif.rs
use byteorder::{BigEndian, ByteOrder}; pub const PIF_ROM_START: u32 = 0x0000; pub const PIF_ROM_END: u32 = 0x07bf; pub const PIF_RAM_SIZE: usize = 0x40; pub const PIF_RAM_START: u32 = 0x07c0; pub const PIF_RAM_END: u32 = PIF_RAM_START + (PIF_RAM_SIZE as u32) - 1; const TEST_SEED: u32 = 0x00023F3F; fn fix_ram(ram: &m...
}
{ match addr { PIF_ROM_START...PIF_ROM_END => { panic!("Cannot write to PIF ROM"); } PIF_RAM_START...PIF_RAM_END => { BigEndian::write_u32(&mut self.ram[(addr - PIF_RAM_START) as usize..], value); } _ => { ...
identifier_body
matching.rs
//! //! The matching module defines how a request is matched //! against a list of potential interactions. //! use pact_matching::models::{RequestResponseInteraction, Request, PactSpecification}; use pact_matching::Mismatch; use pact_matching::s; use serde_json::json; use itertools::Itertools; use std::fmt::{Display, ...
}, MatchResult::RequestMismatch(interaction, mismatches) => { write!(f, "Request did not match - {}", interaction.request)?; for (i, mismatch) in mismatches.iter().enumerate() { write!(f, " {}) {}", i, mismatch)?; } Ok(()) }, MatchResult::RequestNotFo...
random_line_split
matching.rs
//! //! The matching module defines how a request is matched //! against a list of potential interactions. //! use pact_matching::models::{RequestResponseInteraction, Request, PactSpecification}; use pact_matching::Mismatch; use pact_matching::s; use serde_json::json; use itertools::Itertools; use std::fmt::{Display, ...
/// Converts this match result to a `Value` struct pub fn to_json(&self) -> serde_json::Value { match self { &MatchResult::RequestMatch(_) => json!({ s!("type") : s!("request-match")}), &MatchResult::RequestMismatch(ref interaction, ref mismatches) => mismatches_to_json(&intera...
{ match self { MatchResult::RequestNotFound(req) => req.method == "OPTIONS", _ => false } }
identifier_body
matching.rs
//! //! The matching module defines how a request is matched //! against a list of potential interactions. //! use pact_matching::models::{RequestResponseInteraction, Request, PactSpecification}; use pact_matching::Mismatch; use pact_matching::s; use serde_json::json; use itertools::Itertools; use std::fmt::{Display, ...
(req: &Request, interactions: &Vec<RequestResponseInteraction>) -> MatchResult { let mut match_results = interactions .into_iter() .map(|i| (i.clone(), pact_matching::match_request(i.request.clone(), req.clone()))) .sorted_by(|(_, i1), (_, i2)| { Ord::cmp(&i2.score(), &i1.score()) }); match ma...
match_request
identifier_name
views.py
import json import os from flask import request, g, render_template, make_response, jsonify, Response from helpers.raw_endpoint import get_id, store_json_to_file from helpers.groups import get_groups from json_controller import JSONController from main import app from pymongo import MongoClient, errors HERE = os.pat...
(): """API endpoint determines potential article hash exists in db :return: status code 204 -- hash not present, continue submission :return: status code 201 -- hash already exists, drop submission """ db = get_db() target_hash = request.form.get('hash') if db.raw.find({'hash': target_hash}...
ping_endpoint
identifier_name
views.py
import json import os from flask import request, g, render_template, make_response, jsonify, Response from helpers.raw_endpoint import get_id, store_json_to_file from helpers.groups import get_groups from json_controller import JSONController from main import app from pymongo import MongoClient, errors HERE = os.pat...
groups. The groups website is {group_website} and the submitter can \ be reached at {submitter_email}.".format( group_name=data['new_group_name'], group_website=data['new_group_website'], ...
msg = "Someone has request that you add {group_name} to the leaderboard \
random_line_split
views.py
import json import os from flask import request, g, render_template, make_response, jsonify, Response from helpers.raw_endpoint import get_id, store_json_to_file from helpers.groups import get_groups from json_controller import JSONController from main import app from pymongo import MongoClient, errors HERE = os.pat...
# User submitted an unsupported content-type else: return Response(status=400) #@TODO: Implicit or Explicit group additions? Issue #51 comments on the issues page #@TODO: Add form validation @app.route('/requestnewgroup/', methods=['POST']) def request_new_group(): # Grab submission form data and...
try: user_submission = json.loads(request.data) except ValueError: return Response(status=405) # generate UID for new entry uid = get_id() # store incoming JSON in raw storage file_path = os.path.join( HERE, ...
conditional_block
views.py
import json import os from flask import request, g, render_template, make_response, jsonify, Response from helpers.raw_endpoint import get_id, store_json_to_file from helpers.groups import get_groups from json_controller import JSONController from main import app from pymongo import MongoClient, errors HERE = os.pat...
@app.route('/raw', methods=['POST']) def raw_endpoint(): """API endpoint for submitting raw article data :return: status code 405 - invalid JSON or invalid request type :return: status code 400 - unsupported content-type or invalid publisher :return: status code 201 - successful submission """ ...
"""Eventual landing page for searching/retrieving articles""" if request.method == 'GET': return render_template("articles.html")
identifier_body
mod.rs
mod shell; mod syscall; use self::syscall::*; #[no_mangle] pub extern "C" fn el0_other() -> ! { println!("I just exit."); //loop {} syscall_exit(127); } #[no_mangle] pub extern "C" fn el0_shell() -> ! { println!("I sleep 50ms."); syscall_sleep(50).unwrap(); println!("And then I just shell.");...
unsafe { asm!("brk 1" :::: "volatile"); } println!("fuck you shit: {}", 555); unsafe { asm!("brk 2" :::: "volatile"); } //loop {} println!("test GPIO"); use pi::gpio::{Gpio, GPIO_BASE}; use pi::common::IO_BASE_RAW; let mut r = unsafe { Gpio::new_from(IO_BASE_RAW + GPIO_BASE, 21).into...
} #[no_mangle] pub extern "C" fn el0_init() -> ! { println!("im in a bear suite");
random_line_split
mod.rs
mod shell; mod syscall; use self::syscall::*; #[no_mangle] pub extern "C" fn el0_other() -> !
#[no_mangle] pub extern "C" fn el0_shell() -> ! { println!("I sleep 50ms."); syscall_sleep(50).unwrap(); println!("And then I just shell."); loop { let code = shell::shell("usr> "); println!("exit with code: {}", code); } } #[no_mangle] pub extern "C" fn el0_init() -> ! { pri...
{ println!("I just exit."); //loop {} syscall_exit(127); }
identifier_body
mod.rs
mod shell; mod syscall; use self::syscall::*; #[no_mangle] pub extern "C" fn el0_other() -> ! { println!("I just exit."); //loop {} syscall_exit(127); } #[no_mangle] pub extern "C" fn el0_shell() -> ! { println!("I sleep 50ms."); syscall_sleep(50).unwrap(); println!("And then I just shell.");...
else { g.clear() } if led & 4 != 0 { b.set() } else { b.clear() } if !btn.level() { led += 1; motor.set(); syscall_sleep(5).unwrap(); motor.clear(); syscall_sleep(100).unwrap(); } } }
{ g.set() }
conditional_block
mod.rs
mod shell; mod syscall; use self::syscall::*; #[no_mangle] pub extern "C" fn el0_other() -> ! { println!("I just exit."); //loop {} syscall_exit(127); } #[no_mangle] pub extern "C" fn el0_shell() -> ! { println!("I sleep 50ms."); syscall_sleep(50).unwrap(); println!("And then I just shell.");...
() -> ! { println!("im in a bear suite"); unsafe { asm!("brk 1" :::: "volatile"); } println!("fuck you shit: {}", 555); unsafe { asm!("brk 2" :::: "volatile"); } //loop {} println!("test GPIO"); use pi::gpio::{Gpio, GPIO_BASE}; use pi::common::IO_BASE_RAW; let mut r = unsafe { Gp...
el0_init
identifier_name
cmp_utils.rs
use regex::Regex; use std::cmp::Ordering; use crate::types::*; lazy_static! { static ref MODIFICATION_RE: Regex = Regex::new(r"^(?P<aa>[A-Z])(?P<pos>\d+)$").unwrap(); } pub fn cmp_residues(residue1: &Option<Residue>, residue2: &Option<Residue>) -> Ordering { if let Some(ref res1) = *residue1 { if let...
} else { if residue2.is_some() { Ordering::Greater } else { Ordering::Equal } } }
random_line_split
cmp_utils.rs
use regex::Regex; use std::cmp::Ordering; use crate::types::*; lazy_static! { static ref MODIFICATION_RE: Regex = Regex::new(r"^(?P<aa>[A-Z])(?P<pos>\d+)$").unwrap(); } pub fn cmp_residues(residue1: &Option<Residue>, residue2: &Option<Residue>) -> Ordering
} } else { Ordering::Less } } else { if residue2.is_some() { Ordering::Greater } else { Ordering::Equal } } }
{ if let Some(ref res1) = *residue1 { if let Some(ref res2) = *residue2 { if let (Some(res1_captures), Some(res2_captures)) = (MODIFICATION_RE.captures(res1), MODIFICATION_RE.captures(res2)) { let res1_aa = res1_captures.name("aa").unwrap().as_str(); ...
identifier_body
cmp_utils.rs
use regex::Regex; use std::cmp::Ordering; use crate::types::*; lazy_static! { static ref MODIFICATION_RE: Regex = Regex::new(r"^(?P<aa>[A-Z])(?P<pos>\d+)$").unwrap(); } pub fn
(residue1: &Option<Residue>, residue2: &Option<Residue>) -> Ordering { if let Some(ref res1) = *residue1 { if let Some(ref res2) = *residue2 { if let (Some(res1_captures), Some(res2_captures)) = (MODIFICATION_RE.captures(res1), MODIFICATION_RE.captures(res2)) { ...
cmp_residues
identifier_name
cmp_utils.rs
use regex::Regex; use std::cmp::Ordering; use crate::types::*; lazy_static! { static ref MODIFICATION_RE: Regex = Regex::new(r"^(?P<aa>[A-Z])(?P<pos>\d+)$").unwrap(); } pub fn cmp_residues(residue1: &Option<Residue>, residue2: &Option<Residue>) -> Ordering { if let Some(ref res1) = *residue1
} else { Ordering::Less } } else { if residue2.is_some() { Ordering::Greater } else { Ordering::Equal } } }
{ if let Some(ref res2) = *residue2 { if let (Some(res1_captures), Some(res2_captures)) = (MODIFICATION_RE.captures(res1), MODIFICATION_RE.captures(res2)) { let res1_aa = res1_captures.name("aa").unwrap().as_str(); let res2_aa = res2_captur...
conditional_block
cellular.d.ts
import Map, { CreateCallback } from "./map.js"; interface Options { born: number[]; survive: number[]; topology: 4 | 6 | 8; } interface ConnectionCallback { (from: Point, to: Point): void; } declare type Point = [number, number]; declare type PointMap = { [key: string]: Point; }; /** * @class Cellu...
extends Map { _options: Options; _dirs: number[][]; _map: number[][]; constructor(width: number, height: number, options?: Partial<Options>); /** * Fill the map with random values * @param {float} probability Probability for a cell to become alive; 0 = all empty, 1 = all full */ ...
Cellular
identifier_name
cellular.d.ts
import Map, { CreateCallback } from "./map.js"; interface Options { born: number[]; survive: number[]; topology: 4 | 6 | 8; } interface ConnectionCallback { (from: Point, to: Point): void; } declare type Point = [number, number]; declare type PointMap = { [key: string]: Point; }; /** * @class Cellu...
_dirs: number[][]; _map: number[][]; constructor(width: number, height: number, options?: Partial<Options>); /** * Fill the map with random values * @param {float} probability Probability for a cell to become alive; 0 = all empty, 1 = all full */ randomize(probability: number): this; ...
* @param {int} [options.topology] Topology 4 or 6 or 8 */ export default class Cellular extends Map { _options: Options;
random_line_split
mssql.js
if (typeof (QP) == "undefined" || !QP) { var QP = {} }; (function() { /* Draws the lines linking nodes in query plan diagram. root - The document element in which the diagram is contained. */ QP.drawLines = function(root) { if (root === null || root === undefined) { // Try...
})();
var fromOffset = from.offset(); fromOffset.top += from.outerHeight() / 2; fromOffset.left += from.outerWidth(); var toOffset = to.offset(); toOffset.top += to.outerHeight() / 2; var midOffsetLeft = fromOffset.left / 2 + toOffset.left / 2; context.move...
identifier_body
mssql.js
if (typeof (QP) == "undefined" || !QP) { var QP = {} }; (function() { /* Draws the lines linking nodes in query plan diagram. root - The document element in which the diagram is contained. */ QP.drawLines = function(root) { if (root === null || root === undefined) { // Try...
internalDrawLines(root); }; /* Internal implementaiton of drawLines. */ function internalDrawLines(root) { var canvas = getCanvas(root); var canvasElm = canvas[0]; // Check for browser compatability if (canvasElm.getContext !== null && canvasElm.getContext ...
// Make sure the object passed is jQuery wrapped root = $(root); }
conditional_block
mssql.js
if (typeof (QP) == "undefined" || !QP) { var QP = {} }; (function() { /* Draws the lines linking nodes in query plan diagram. root - The document element in which the diagram is contained. */ QP.drawLines = function(root) { if (root === null || root === undefined) { // Try...
oot) { var returnValue = $("canvas", root); if (returnValue.length == 0) { root.prepend($("<canvas></canvas>") .css("position", "absolute") .css("top", 0).css("left", 0) ); returnValue = $("canvas", root); } ret...
tCanvas(r
identifier_name
mssql.js
if (typeof (QP) == "undefined" || !QP) { var QP = {} }; (function() { /* Draws the lines linking nodes in query plan diagram. root - The document element in which the diagram is contained. */ QP.drawLines = function(root) { if (root === null || root === undefined) { // Try...
offset - Canvas offset in the document. from - The document jQuery object from which to draw the line. to - The document jQuery object to which to draw the line. */ function drawLine(context, offset, from, to) { var fromOffset = from.offset(); fromOffset.top += from.outerHeight() / ...
} /* Draws a line between two nodes. context - The canvas context with which to draw.
random_line_split
broadcast.js
action', currentHashStr); if (action != 'goalReport' && action != 'ecommerceReport' && action != 'products' && action != 'sales') { currentHashStr = broadcast.updateParamValue('idGoal=', currentHashStr); } // unset idDashboard if use doesn't display a dashboard var module = b...
sectionLoaded
identifier_name
broadcast.js
** If you'd like to make ajax call with new values then use propagateAjax ** * * * Expecting: * str = "param1=newVal1&param2=newVal2"; * * NOTE: This method will refresh the page with new values. * * @param {string} str url with parameters to be updated * @param {boolea...
{ if (request) { var responseHeader = request.getResponseHeader('Content-Type'); if (responseHeader && 0 <= responseHeader.toLowerCase().indexOf('json')) { var message = 'JSON cannot be displayed for'; if (this.getParams && this.getPara...
identifier_body
broadcast.js
setTimeout(function () { angular.element(document).injector().get('$rootScope').$apply(); }, 1); }, /** * Adds a handler for the 'popover' query parameter. * * @see broadcast#propagateNewPopoverParameter * * @param {String} handlerName The handler name, eg, ...
return ''; }
conditional_block
broadcast.js
HashStr = broadcast.getHash(); ajaxUrl = ajaxUrl.replace(/^\?|&#/, ''); var params_vals = ajaxUrl.split("&"); for (var i = 0; i < params_vals.length; i++) { currentHashStr = broadcast.updateParamValue(params_vals[i], currentHashStr); } // if the module is not 'Goal...
* @param {string} urlAjax url to load * @return {Boolean} */ loadAjaxContent: function (urlAjax) {
random_line_split
logger.js
/* eslint-disable no-console */ const chalk = require('chalk'); const ip = require('ip'); const divider = chalk.gray('\n-----------------------------------'); /** * Logger middleware, you can customize it to make messages more personal */ const logger = { // Called whenever there's an error on the server we w...
console.log(` ${chalk.bold('Access URLs:')}${divider} Localhost: ${chalk.magenta(`http://${host}:${port}`)} LAN: ${chalk.magenta(`http://${ip.address()}:${port}`) + (tunnelStarted ? `\n Proxy: ${chalk.magenta(tunnelStarted)}` : '')}${divider} ${chalk.blue(`Press ${chalk.italic('CTRL-C')} to stop`...
console.log(`Tunnel initialised ${chalk.green('✓')}`); }
conditional_block
logger.js
/* eslint-disable no-console */ const chalk = require('chalk'); const ip = require('ip'); const divider = chalk.gray('\n-----------------------------------'); /** * Logger middleware, you can customize it to make messages more personal */ const logger = { // Called whenever there's an error on the server we w...
`); }, }; module.exports = logger;
(tunnelStarted ? `\n Proxy: ${chalk.magenta(tunnelStarted)}` : '')}${divider} ${chalk.blue(`Press ${chalk.italic('CTRL-C')} to stop`)}
random_line_split
logstore.py
# # Copyright (c) SAS Institute 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 w...
(object): def __init__(self, path): util.mkdirChain(path) self.store = DeletableDataStore(path) def getTrovePath(self, trove): return self.store.hashToPath(self.hashTrove(trove)) def hashTrove(self, trove): return sha1helper.sha1ToString( sha1helper.sha1Stri...
LogStore
identifier_name
logstore.py
# # Copyright (c) SAS Institute 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 w...
def hashTrove(self, trove): return sha1helper.sha1ToString( sha1helper.sha1String('%s %s=%s[%s]' % (trove.jobId, trove.getName(), trove.getVersion(), trove.getFlavor()))) def hashTroveInfo(self, jobId, name, version, flavor): return sha1helper.sha1ToStrin...
return self.store.hashToPath(self.hashTrove(trove))
identifier_body
logstore.py
# # Copyright (c) SAS Institute 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 w...
self.store.deleteFile(hash)
conditional_block
logstore.py
# # Copyright (c) SAS Institute 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 w...
from conary.lib import util from conary.repository import datastore class DeletableDataStore(datastore.DataStore): def deleteFile(self, hash): path = self.hashToPath(hash) util.removeIfExists(path) class LogStore(object): def __init__(self, path): util.mkdirChain(path) self.sto...
# limitations under the License. # from conary.lib import sha1helper
random_line_split
conversation.ts
import * as models from "../models/models"; import * as jibe from '../service/jibe'; import * as logger from '../service/logger'; import * as drillplan from "../plugins/drillplan" import * as botbuilder from 'botbuilder' // Define an object for storing subscription information class Subscription { project: string...
return event.name; }); return subs; } // get all subscriptions for the given channel async function getSubscriptions(channelId: string): Promise<Subscription[]> { // fetch projects let projects = await jibe.getProjectList(); // Generate subscription list for this channel let ...
{ logger.Info("Unable to find event with regex " + route.expr); return ""; }
conditional_block