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
volumeops.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
return bad_devices
sr_ref = volume_utils.find_sr_from_vbd(self._session, vbd_ref) try: # TODO(sirp): bug1152401 This relies on a 120 sec timeout # within XenServer, update this to fail-fast when this is fixed # upstream self._session.call_xenapi("SR.scan", sr_re...
conditional_block
volumeops.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
# Unplug VBD if we're NOT shutdown unplug = not vm_utils._is_vm_shutdown(self._session, vm_ref) self._detach_vbd(vbd_ref, unplug=unplug) LOG.info(_('Mountpoint %(mountpoint)s detached from instance' ' %(instance_name)s') % locals()) def _get_all_volume_vbd_refs(...
# detached previously. LOG.warn(_('Skipping detach because VBD for %(instance_name)s was' ' not found') % locals()) return
random_line_split
volumeops.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2013 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
# NOTE(sirp): This will introduce the first VDI in the SR vdi_ref = volume_utils.introduce_vdi(self._session, sr_ref) # Attach vbd_ref = vm_utils.create_vbd(self._session, vm_ref, vdi_ref, dev_number, bootable=False, ...
sr_uuid, sr_label, sr_params = volume_utils.parse_sr_info( connection_data, 'Disk-for:%s' % instance_name) # Introduce SR if not already present sr_ref = volume_utils.find_sr_by_uuid(self._session, sr_uuid) if not sr_ref: sr_ref = volume_utils.introduce_sr( ...
identifier_body
stockListGen.py
# (c) 2011, 2012 Georgia Tech Research Corporation # This source code is released under the New BSD license. Please see # http://wiki.quantsoftware.org/index.php?title=QSTK_License # for license details. # # Created on October <day>, 2011 # # @author: Vishal Shekhar # @contact: mailvishalshekhar@gmail.com
dataobj = da.DataAccess('Norgate') delistSymbols = set(dataobj.get_symbols_in_sublist('/US/Delisted Securities')) allSymbols = set(dataobj.get_all_symbols()) #by default Alive symbols only aliveSymbols = list(allSymbols - delistSymbols) # set difference is smart startday = dt.datetime(2008,1,1) endday = dt.datetime(2...
# @summary: Utiltiy script to create list of symbols for study. import qstkutil.DataAccess as da import qstkutil.qsdateutil as du import datetime as dt
random_line_split
stockListGen.py
# (c) 2011, 2012 Georgia Tech Research Corporation # This source code is released under the New BSD license. Please see # http://wiki.quantsoftware.org/index.php?title=QSTK_License # for license details. # # Created on October <day>, 2011 # # @author: Vishal Shekhar # @contact: mailvishalshekhar@gmail.com # @summary: ...
file.close()
file.write(str(symbol)+'\n')
conditional_block
scripts.js
)[0]; var bind = e[key]; // loop through the JSON and apply it to the HTML // Load New if (bind.title != "" || bind.color != "") { var $bind = $("#" + key); if (bind.action != "") { $bind.attr("title", bind.action); $bind.addClass("has_action...
if (bind.title != "") { $("h2", $bind).html(bind.title); } }); $('#picker').colpick({ flat:true, layout:'hex', colorScheme:'dark', submit:0 }); $("#about").click(function() { $("#about-info").show(); }); $("#parse").click(function() { $("#parse-my-config").show(); }); $(...
{ $bind.css("background-color", bind.color); }
conditional_block
scripts.js
} }); }); } // Stupid hack to clear them for now function clearBinds() { $("#bind_container h2").html(""); $("#bind_container div").css("background-color",""); $("#bind_container div").attr("title",""); $("#bind_container div").removeClass("has_action"); } // Initial loa...
{ // Load Binds $.get("data/" + file, function(data) { binds = JSON.parse(data); binds.forEach(function(e, i, a) { var key = Object.keys(e)[0]; var bind = e[key]; // loop through the JSON and apply it to the HTML // Load New if (bind.title != "" || bind.col...
identifier_body
scripts.js
to the HTML // Load New if (bind.title != "" || bind.color != "") { var $bind = $("#" + key); if (bind.action != "") { $bind.attr("title", bind.action); $bind.addClass("has_action"); } if (bind.color != "") { $bind.css("background-color",...
xon_to_kbx
identifier_name
scripts.js
(e)[0]; var bind = e[key]; // loop through the JSON and apply it to the HTML // Load New if (bind.title != "" || bind.color != "") { var $bind = $("#" + key); if (bind.action != "") { $bind.attr("title", bind.action); $bind.addClass("has_acti...
if (bind.color != "") { $('#picker').colpickSetColor(bind.color); } else { $('#picker').colpickSetColor("#ffffff"); } return false; } }); }); $("#key_save").click(function() { console.log(binds[edit_index]); console.log(binds[edit_index][edit_ke...
$("#edit_key_action").val(bind.action);
random_line_split
signals.py
""" This module contains signals related to enterprise. """ import logging import six from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from ent...
@receiver(pre_save, sender=EnterpriseCustomer) def update_dsc_cache_on_enterprise_customer_update(sender, instance, **kwargs): """ clears data_sharing_consent_needed cache after enable_data_sharing_consent flag is changed. """ old_instance = sender.objects.filter(pk=instance.uuid).first() if ...
""" clears data_sharing_consent_needed cache after Enterprise Course Enrollment """ clear_data_consent_share_cache( instance.enterprise_customer_user.user_id, instance.course_id )
identifier_body
signals.py
""" This module contains signals related to enterprise. """ import logging import six from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from ent...
(sender, instance, **kwargs): # pylint: disable=unused-argument """ clears data_sharing_consent_needed cache after Enterprise Course Enrollment """ clear_data_consent_share_cache( instance.enterprise_customer_user.user_id, instance.course_id ) @receiver(pre_save, sender=Enterp...
update_dsc_cache_on_course_enrollment
identifier_name
signals.py
""" This module contains signals related to enterprise. """ import logging import six from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from ent...
log.exception( error_message.format(type(ex).__name__, order_number, course_enrollment, course_enrollment.user) )
random_line_split
signals.py
""" This module contains signals related to enterprise. """ import logging import six from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db.models.signals import post_save, pre_save from django.dispatch import receiver from ent...
if not EnterpriseCourseEnrollment.objects.filter( enterprise_customer_user__user_id=course_enrollment.user_id, course_id=str(course_enrollment.course.id) ).exists(): return service_user = User.objects.get(username=settings.ECOMMERCE_SERVICE_WORKER_USERNAME) client = ecommerce_a...
return
conditional_block
statevector.js
// so us.evMOUSECHANGE event is fired if mouse move is sufficient var lastMouseState_ = new cPoint(0, 0); this.mouseUpdate = function (state, eventDesc, bForce) { if (bForce == false && cb_mouseState.length == 0) // do not save state if no one is subscribed return; //dbg-only if (us.DBGSTATEV...
{ // not implemented }
conditional_block
statevector.js
var stateTypeView = us.eStateTypes.view; // for quick access var stateTypeMouse = us.eStateTypes.mouse; var minMoveMagnitude_ = 12; // the minimum magnitude in pixels of movement to record var slopeLimit = 4; var slopeLimtInv = 0.25; // 1. / slopeLimit var kSVQUEUE_VIEW_SIZE = 500; ...
{ var thisImg = vpObj; // the viewport object - the parent var self = this; // local var for closure var imageId_ = thisImg.getImageId(); var uScopeIdx_ = thisImg.getImageIdx(); var imageSizeMax; var mouseSizeMax; var idxPrevNext = -1; // index in image queue var idxPrevNe...
identifier_body
statevector.js
(stateType === us.eStateTypes.view) cb_imageState.push(functionString); else cb_mouseState.push(functionString); } }; //............................................ unRegisterForEvent // This function removes a subscription to state change event. this.unRegisterForEvent = function (functionStr...
//if (us.DBGSTATEVECTOR) sv.magpx ? thisImg.log("cStateVector: viewUpdate: dir: " + sv.dir + " magpx: " + sv.magpx) // : thisImg.log("cStateVector: viewUpdate: desc: " + sv.desc); for (var c = 0, len = cb_imageState.length; c < len; c++) // execute the callbacks to signal a SV update event cb_ima...
lastViewState_.set(state.left, state.top); // save last queue view position
random_line_split
statevector.js
(vpObj) { var thisImg = vpObj; // the viewport object - the parent var self = this; // local var for closure var imageId_ = thisImg.getImageId(); var uScopeIdx_ = thisImg.getImageIdx(); var imageSizeMax; var mouseSizeMax; var idxPrevNext = -1; // index in image queue var i...
cStateVector
identifier_name
socket.js
'use strict'; var phonetic = require('phonetic'); var socketio = require('socket.io'); var _ = require('underscore'); var load = function(http) { var io = socketio(http); var ioNamespace = '/'; var getEmptyRoomId = function() { var roomId = null; do { roomId = phoneti...
info.roomId = data && data.roomId ? data.roomId : null; if (!info.roomId || !io.nsps[ioNamespace].adapter.rooms[data.roomId]) { info.roomId = getEmptyRoomId(socket); console.log('[Socket] Assigning room id ' + info.roomId + ' to ip ' + socket.handshake.add...
{ return; }
conditional_block
socket.js
'use strict'; var phonetic = require('phonetic'); var socketio = require('socket.io'); var _ = require('underscore'); var load = function(http) { var io = socketio(http); var ioNamespace = '/'; var getEmptyRoomId = function() { var roomId = null; do { roomId = phoneti...
module.exports = { load: load };
io.on('connection', onConnection); };
random_line_split
vga.rs
use core::prelude::*; use io; const BACKSPACE: u8 = 0x08; const TAB: u8 = 0x09; const NEWLINE: u8 = 0x0A; const CR: u8 = 0x0D; const WHITESPACE: u8 = 0x20; const VGA_ADDRESS: int = 0xB8000; const VGA_HEIGHT: u16 = 25; const VGA_WIDTH: u16 = 80; enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3...
VGA.putc(character); } } pub fn puts(string: &str) { unsafe { VGA.puts(string); } }
pub fn putc(character: u8) { unsafe {
random_line_split
vga.rs
use core::prelude::*; use io; const BACKSPACE: u8 = 0x08; const TAB: u8 = 0x09; const NEWLINE: u8 = 0x0A; const CR: u8 = 0x0D; const WHITESPACE: u8 = 0x20; const VGA_ADDRESS: int = 0xB8000; const VGA_HEIGHT: u16 = 25; const VGA_WIDTH: u16 = 80; enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3...
self.put(offset, Black as u16, White as u16, character); self.forward(); } self.mov(); } fn puti(&mut self, integer: uint) { if integer == 0 { self.puts("0"); } else { let mut integer = integer; let mut revers...
{ if character == BACKSPACE { self.back(); } else if character == TAB { self.tab(); } else if character == NEWLINE { self.newline(); } else if character == CR { self.cr(); } else if character >= ...
identifier_body
vga.rs
use core::prelude::*; use io; const BACKSPACE: u8 = 0x08; const TAB: u8 = 0x09; const NEWLINE: u8 = 0x0A; const CR: u8 = 0x0D; const WHITESPACE: u8 = 0x20; const VGA_ADDRESS: int = 0xB8000; const VGA_HEIGHT: u16 = 25; const VGA_WIDTH: u16 = 80; enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3...
(&mut self, integer: uint) { self.puts("0x"); let mut nibbles = 1; while (integer >> nibbles * 4) > 0 { nibbles += 1 } for i in range(0, nibbles) { let nibble = ((integer >> (nibbles - i - 1) * 4) & 0xF) as u8; let character = if nibble ...
puth
identifier_name
vga.rs
use core::prelude::*; use io; const BACKSPACE: u8 = 0x08; const TAB: u8 = 0x09; const NEWLINE: u8 = 0x0A; const CR: u8 = 0x0D; const WHITESPACE: u8 = 0x20; const VGA_ADDRESS: int = 0xB8000; const VGA_HEIGHT: u16 = 25; const VGA_WIDTH: u16 = 80; enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3...
else if character >= WHITESPACE { let offset = self.offset(); self.put(offset, Black as u16, White as u16, character); self.forward(); } self.mov(); } fn puti(&mut self, integer: uint) { if integer == 0 { self.puts("0"); ...
{ self.cr(); }
conditional_block
LossOfControl.ts
import { OvaleDebug } from "./Debug"; import { OvaleProfiler } from "./Profiler"; import { Ovale } from "./Ovale"; import { OvaleState } from "./State"; import { RegisterRequirement, UnregisterRequirement, Tokens } from "./Requirement"; import aceEvent from "@wowts/ace_event-3.0"; import { C_LossOfControl, GetTim...
OnDisable() { this.Debug("Disabled LossOfControl module"); this.lossOfControlHistory = {}; this.UnregisterEvent("LOSS_OF_CONTROL_ADDED"); UnregisterRequirement("lossofcontrol"); } LOSS_OF_CONTROL_ADDED(event: string, eventIndex: number){ this.Debug("GetEventInfo:", eventIndex, C_LossOf...
{ this.Debug("Enabled LossOfControl module"); this.lossOfControlHistory = {}; this.RegisterEvent("LOSS_OF_CONTROL_ADDED"); RegisterRequirement("lossofcontrol", this.RequireLossOfControlHandler); }
identifier_body
LossOfControl.ts
import { OvaleDebug } from "./Debug"; import { OvaleProfiler } from "./Profiler"; import { Ovale } from "./Ovale"; import { OvaleState } from "./State"; import { RegisterRequirement, UnregisterRequirement, Tokens } from "./Requirement"; import aceEvent from "@wowts/ace_event-3.0"; import { C_LossOfControl, GetTim...
this.Debug("GetEventInfo:", eventIndex, C_LossOfControl.GetEventInfo(eventIndex)); let [locType, spellID, , , startTime, , duration] = C_LossOfControl.GetEventInfo(eventIndex); let data: LossOfControlEventInfo = { locType: upper(locType), spellID: spellID, startTime: startTime || GetTime(), dura...
random_line_split
LossOfControl.ts
import { OvaleDebug } from "./Debug"; import { OvaleProfiler } from "./Profiler"; import { Ovale } from "./Ovale"; import { OvaleState } from "./State"; import { RegisterRequirement, UnregisterRequirement, Tokens } from "./Requirement"; import aceEvent from "@wowts/ace_event-3.0"; import { C_LossOfControl, GetTim...
(): void { } } OvaleLossOfControl = new OvaleLossOfControlClass(); OvaleState.RegisterState(OvaleLossOfControl);
ResetState
identifier_name
LossOfControl.ts
import { OvaleDebug } from "./Debug"; import { OvaleProfiler } from "./Profiler"; import { Ovale } from "./Ovale"; import { OvaleState } from "./State"; import { RegisterRequirement, UnregisterRequirement, Tokens } from "./Requirement"; import aceEvent from "@wowts/ace_event-3.0"; import { C_LossOfControl, GetTim...
else { Ovale.OneTimeMessage("Warning: requirement '%s' is missing a locType argument.", requirement); } return [verified, requirement, index]; } HasLossOfControl = function(locType: string, atTime: number) { let lowestStartTime: number|undefined = undefined; let highestEndTime: number|undefined = ...
{ let required = true; if (sub(locType, 1, 1) === "!") { required = false; locType = sub(locType, 2); } let hasLoss = this.HasLossOfControl(locType, atTime); verified = (required && hasLoss) || (!required && !hasLoss); }
conditional_block
gid_filter.rs
use filter; use filter::Filter; use walkdir::DirEntry; use std::os::unix::fs::MetadataExt; use std::process; pub struct GidFilter { gid: u32, comp_op: filter::CompOp, } impl GidFilter { pub fn new(comp_op: filter::CompOp, gid: u32) -> GidFilter { GidFilter{comp_op: comp_op, gid: gid} } } impl...
, } } }
{ eprintln!("Operator {:?} not covered for attribute gid!", self.comp_op); process::exit(1); }
conditional_block
gid_filter.rs
use filter; use filter::Filter; use walkdir::DirEntry; use std::os::unix::fs::MetadataExt; use std::process; pub struct GidFilter { gid: u32, comp_op: filter::CompOp, } impl GidFilter { pub fn new(comp_op: filter::CompOp, gid: u32) -> GidFilter { GidFilter{comp_op: comp_op, gid: gid} } } impl...
}
{ match self.comp_op { filter::CompOp::Equal => self.gid == dir_entry.metadata().unwrap().gid(), filter::CompOp::Unequal => self.gid != dir_entry.metadata().unwrap().gid(), _ => { eprintln!("Operator {:?} not covered for attribute gid!", ...
identifier_body
gid_filter.rs
use filter; use filter::Filter; use walkdir::DirEntry; use std::os::unix::fs::MetadataExt; use std::process; pub struct
{ gid: u32, comp_op: filter::CompOp, } impl GidFilter { pub fn new(comp_op: filter::CompOp, gid: u32) -> GidFilter { GidFilter{comp_op: comp_op, gid: gid} } } impl Filter for GidFilter { fn test(&self, dir_entry: &DirEntry) -> bool { match self.comp_op { filter::CompOp...
GidFilter
identifier_name
gid_filter.rs
use filter; use filter::Filter; use walkdir::DirEntry; use std::os::unix::fs::MetadataExt; use std::process; pub struct GidFilter { gid: u32, comp_op: filter::CompOp, } impl GidFilter { pub fn new(comp_op: filter::CompOp, gid: u32) -> GidFilter { GidFilter{comp_op: comp_op, gid: gid} } } impl...
eprintln!("Operator {:?} not covered for attribute gid!", self.comp_op); process::exit(1); }, } } }
fn test(&self, dir_entry: &DirEntry) -> bool { match self.comp_op { filter::CompOp::Equal => self.gid == dir_entry.metadata().unwrap().gid(), filter::CompOp::Unequal => self.gid != dir_entry.metadata().unwrap().gid(), _ => {
random_line_split
config.rs
#![allow(dead_code)] use log::LevelFilter; use once_cell::sync::Lazy; use std::str::FromStr; static CONF: Lazy<Config> = Lazy::new(|| { let log_level = std::env::var("SIMAG_LOG_LEVEL") .or_else::<std::env::VarError, _>(|_| Ok("info".to_owned())) .ok() .map(|l| LevelFilter::from_str(&l).unw...
; impl Logger { pub fn get_logger() -> &'static Logger { Lazy::force(&LOGGER) } } #[allow(unused_must_use)] static LOGGER: Lazy<Logger> = Lazy::new(|| { env_logger::builder() .format_module_path(true) .format_timestamp_nanos() .ta...
Logger
identifier_name
config.rs
#![allow(dead_code)] use log::LevelFilter; use once_cell::sync::Lazy; use std::str::FromStr; static CONF: Lazy<Config> = Lazy::new(|| { let log_level = std::env::var("SIMAG_LOG_LEVEL") .or_else::<std::env::VarError, _>(|_| Ok("info".to_owned())) .ok() .map(|l| LevelFilter::from_str(&l).unw...
pub struct Logger; impl Logger { pub fn get_logger() -> &'static Logger { Lazy::force(&LOGGER) } } #[allow(unused_must_use)] static LOGGER: Lazy<Logger> = Lazy::new(|| { env_logger::builder() .format_module_path(true) .format_timestamp_na...
#[cfg(any(test, debug_assertions))] pub(super) mod tracing { use super::*; #[derive(Clone, Copy)]
random_line_split
gamerules.ts
import { CCSGameRulesProxy } from "../sendtabletypes"; import { Networkable } from "./networkable"; /** * Represents the game rules. */ export class GameRules extends Networkable<CCSGameRulesProxy> { /** * @returns Is the game currently in 'warmup' mode? */ get isWarmup(): boolean { return this.getProp...
(): number { return this.getProp("DT_CSGameRules", "m_totalRoundsPlayed"); } /** * @returns 'first', 'second', 'halftime' or 'postgame' */ get phase(): string { const gamePhases: { [phase: number]: string } = { 2: "first", 3: "second", 4: "halftime", 5: "postgame" }; ...
roundsPlayed
identifier_name
gamerules.ts
import { CCSGameRulesProxy } from "../sendtabletypes";
/** * Represents the game rules. */ export class GameRules extends Networkable<CCSGameRulesProxy> { /** * @returns Is the game currently in 'warmup' mode? */ get isWarmup(): boolean { return this.getProp("DT_CSGameRules", "m_bWarmupPeriod"); } /** * @deprecated Use `GameRules#roundsPlayed` inst...
import { Networkable } from "./networkable";
random_line_split
gamerules.ts
import { CCSGameRulesProxy } from "../sendtabletypes"; import { Networkable } from "./networkable"; /** * Represents the game rules. */ export class GameRules extends Networkable<CCSGameRulesProxy> { /** * @returns Is the game currently in 'warmup' mode? */ get isWarmup(): boolean { return this.getProp...
}
{ const gamePhases: { [phase: number]: string } = { 2: "first", 3: "second", 4: "halftime", 5: "postgame" }; const phase = this.getProp("DT_CSGameRules", "m_gamePhase"); return gamePhases[phase]!; }
identifier_body
builder.rs
use crate::enums::{CapStyle, DashStyle, LineJoin}; use crate::factory::IFactory; use crate::stroke_style::StrokeStyle; use com_wrapper::ComWrapper; use dcommon::Error; use winapi::shared::winerror::SUCCEEDED; use winapi::um::d2d1::D2D1_STROKE_STYLE_PROPERTIES; pub struct StrokeStyleBuilder<'a> { factory: &'a dyn ...
else { Err(hr.into()) } } } pub fn with_start_cap(mut self, start_cap: CapStyle) -> Self { self.start_cap = start_cap; self } pub fn with_end_cap(mut self, end_cap: CapStyle) -> Self { self.end_cap = end_cap; self } pub fn w...
{ Ok(StrokeStyle::from_raw(ptr)) }
conditional_block
builder.rs
use crate::enums::{CapStyle, DashStyle, LineJoin}; use crate::factory::IFactory; use crate::stroke_style::StrokeStyle; use com_wrapper::ComWrapper; use dcommon::Error; use winapi::shared::winerror::SUCCEEDED; use winapi::um::d2d1::D2D1_STROKE_STYLE_PROPERTIES; pub struct StrokeStyleBuilder<'a> { factory: &'a dyn ...
} pub fn with_dash_cap(mut self, dash_cap: CapStyle) -> Self { self.dash_cap = dash_cap; self } pub fn with_line_join(mut self, line_join: LineJoin) -> Self { self.line_join = line_join; self } pub fn with_miter_limit(mut self, miter_limit: f32) -> Self { ...
pub fn with_end_cap(mut self, end_cap: CapStyle) -> Self { self.end_cap = end_cap; self
random_line_split
builder.rs
use crate::enums::{CapStyle, DashStyle, LineJoin}; use crate::factory::IFactory; use crate::stroke_style::StrokeStyle; use com_wrapper::ComWrapper; use dcommon::Error; use winapi::shared::winerror::SUCCEEDED; use winapi::um::d2d1::D2D1_STROKE_STYLE_PROPERTIES; pub struct StrokeStyleBuilder<'a> { factory: &'a dyn ...
pub fn with_end_cap(mut self, end_cap: CapStyle) -> Self { self.end_cap = end_cap; self } pub fn with_dash_cap(mut self, dash_cap: CapStyle) -> Self { self.dash_cap = dash_cap; self } pub fn with_line_join(mut self, line_join: LineJoin) -> Self { self.line...
{ self.start_cap = start_cap; self }
identifier_body
builder.rs
use crate::enums::{CapStyle, DashStyle, LineJoin}; use crate::factory::IFactory; use crate::stroke_style::StrokeStyle; use com_wrapper::ComWrapper; use dcommon::Error; use winapi::shared::winerror::SUCCEEDED; use winapi::um::d2d1::D2D1_STROKE_STYLE_PROPERTIES; pub struct StrokeStyleBuilder<'a> { factory: &'a dyn ...
(mut self, dashes: &'a [f32]) -> Self { self.dash_style = DashStyle::Custom; self.dashes = Some(dashes); self } fn to_d2d1(&self) -> D2D1_STROKE_STYLE_PROPERTIES { D2D1_STROKE_STYLE_PROPERTIES { startCap: self.start_cap as u32, endCap: self.end_cap as u32...
with_dashes
identifier_name
edp_engine.py
# Copyright (c) 2014 Mirantis 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 writ...
(self, cluster, job, data): pass @staticmethod def get_possible_job_config(job_type): return None @staticmethod def get_supported_job_types(): return edp.JOB_TYPES_ALL
validate_job_execution
identifier_name
edp_engine.py
# Copyright (c) 2014 Mirantis 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 writ...
return edp.JOB_TYPES_ALL
identifier_body
edp_engine.py
# Copyright (c) 2014 Mirantis Inc.
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the L...
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
random_line_split
utils.js
var utils = module.exports = require('../shared/utils'); var fs = require('fs'); var http = require('http'); var path = require('path'); var tty = require('tty'); var bones = require('..'); var colors = { 'default': 1, black: 30, red: 31, green: 32, yellow: 33, blue: 34, purple: 35, cy...
Error.call(this, message); Error.captureStackTrace(this, arguments.callee); this.message = message; this.status = status; }; Error.HTTP.prototype.__proto__ = Error.prototype;
{ message = http.STATUS_CODES[status] || 'Unknown'; }
conditional_block
utils.js
var utils = module.exports = require('../shared/utils'); var fs = require('fs'); var http = require('http'); var path = require('path'); var tty = require('tty'); var bones = require('..'); var colors = { 'default': 1, black: 30, red: 31, green: 32, yellow: 33, blue: 34, purple: 35, cy...
regular: 0, bold: 1, underline: 4 }; if (tty.isatty(process.stdout.fd) && tty.isatty(process.stderr.fd)) { utils.colorize = function(text, color, style) { color = color || 'red'; style = style || 'regular'; return "\033[" + styles[style] + ";" + colors[color] + "m" + text + "\03...
}; var styles = {
random_line_split
bc_gen_feature_rep_xls.py
#!/usr/bin/env python # # Generate report in Excel format (from xml input) # import sys,os,shelve import re,dfxml,fiwalk from bc_utils import filename_from_path from openpyxl.workbook import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def bc_generate_feature_x...
# columns where filename or feature may be missing. if len(row) > 3: filename = row[3] else: filename = "Unknown" if len(row) > 1: feature = row[1] else: feature = "Unknown" position = row[0] # If ...
wb = Workbook() dest_filename = PdfReport.featuredir +'/'+ (filename_from_path(feature_file))[10:-3] + "xlsx" row_idx = [2] ws = wb.worksheets[0] ws.title = "File Feature Information" ws.cell('%s%s'%('A', '1')).value = '%s' % "Filename" ws.cell('%s%s'%('B', '1')).value = '%s' % "Position" w...
identifier_body
bc_gen_feature_rep_xls.py
#!/usr/bin/env python # # Generate report in Excel format (from xml input) # import sys,os,shelve import re,dfxml,fiwalk from bc_utils import filename_from_path from openpyxl.workbook import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def
(PdfReport, data, feature_file): wb = Workbook() dest_filename = PdfReport.featuredir +'/'+ (filename_from_path(feature_file))[10:-3] + "xlsx" row_idx = [2] ws = wb.worksheets[0] ws.title = "File Feature Information" ws.cell('%s%s'%('A', '1')).value = '%s' % "Filename" ws.cell('%s%s'%('B',...
bc_generate_feature_xlsx
identifier_name
bc_gen_feature_rep_xls.py
#!/usr/bin/env python # # Generate report in Excel format (from xml input) # import sys,os,shelve import re,dfxml,fiwalk from bc_utils import filename_from_path from openpyxl.workbook import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def bc_generate_feature_x...
if len(row) > 1: feature = row[1] else: feature = "Unknown" position = row[0] # If it is a special file, check if the user wants it to # be repoted. If not, exclude this from the table. if (PdfReport.bc_config_report_special_files == Fals...
filename = "Unknown"
random_line_split
bc_gen_feature_rep_xls.py
#!/usr/bin/env python # # Generate report in Excel format (from xml input) # import sys,os,shelve import re,dfxml,fiwalk from bc_utils import filename_from_path from openpyxl.workbook import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter def bc_generate_feature_x...
else: filename = "Unknown" if len(row) > 1: feature = row[1] else: feature = "Unknown" position = row[0] # If it is a special file, check if the user wants it to # be repoted. If not, exclude this from the table. ...
filename = row[3]
conditional_block
第四集.py
#第四集(包含部分文件3.py和部分第二集) # courses=['History','Math','Physics','Compsci']#此行代码在Mutable之前都要打开 # print(courses) # courses.append('Art')#在最后添加一个元素 # courses.insert(0,'English')#在0的位置添加一个元素 # courses_2=['Chinese','Education'] # courses.insert(1,courses_2)#看看这条代码与下面两条代码有什么不同 # courses.append(courses_2) # courses.extend(cour...
# print(min(nums))#输出最小数 # print(max(nums))#输出最大数 # print(sum(nums))#输出总和 # #中文不知道是什么规则 # Chinese=['啊了','吧即','啦'] # Chinese.sort() # print(Chinese) # print(courses.index('Math'))#查找某元素在列表中的位置 # print('Art' in courses)#True则表示该元素存在于列表,False则是不存在 #for和in语言 # for item in courses: #将courses中的元素一个一个输出 # print(item) ...
# nums=[3,5,1,4,2] # nums.sort() # print(nums)
random_line_split
defs.rs
/* * Copyright (C) 2017 AltOS-Rust Team * * 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 the License, or
* 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/>. */ pub const GROUPA_ADDR: *const u32 = 0x4800_0000 as *const _; pub const GROUPB_ADDR: *const u32 = 0x4800_0400 as *const _; pub co...
* (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
random_line_split
demo-dacsinewave.py
4057, 4052, 4046, 4041, 4035, 4028, 4022, 4015, 4008, 4000, 3993, 3985, 3976, 3968, 3959, 3950, 3940, 3930, 3920, 3910, 3899, 3888, 3877, 3866, 3854, 3842, 3830, 3817, 3805, 3792, 3778, 3765, 3751, 3737, 3722, 3708, 3693, 3678, 3663, 3647, 3631, 3615, 3599, 3582, 3565, 3548, 3531, 3514, 34...
for val in DACLookup_FullSine_12Bit: adcdac.set_dac_raw(1, val)
conditional_block
demo-dacsinewave.py
3186, 3207, 3227, 3248, 3268, 3288, 3308, 3328, 3347, 3367, 3386, 3405, 3423, 3442, 3460, 3478, 3496, 3514, 3531, 3548, 3565, 3582, 3599, 3615, 3631, 3647, 3663, 3678, 3693, 3708, 3722, 3737, 3751, 3765, 3778, 3792, 3805, 3817, 3830, 3842, 3854, 3866, 3877, 3888, 3899, 3910, 3920, 3930, ...
2249, 2274, 2299, 2324, 2349, 2373, 2398, 2423, 2448, 2472, 2497, 2521, 2546, 2570, 2594, 2618, 2643, 2667, 2690, 2714, 2738, 2762, 2785, 2808, 2832, 2855, 2878, 2901, 2924, 2946, 2969, 2991, 3013, 3036, 3057, 3079, 3101, 3122, 3144, 3165,
random_line_split
server.js
(function() { 'use strict'; var express = require('express'); var path = require('path');
var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.engine('html', require('ejs').renderFile); app.set('view engine', 'html'); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(cookiePa...
var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var routes = require('./routes.js');
random_line_split
index.js
module.exports = { "methods": { "wiki": function(msg, sender, api) { var query = msg.match(/\".+\"/)[0]; query = query.substring(1, query.length-1); var base = "http://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&rawcontinue&redirects&titles="+encodeURIComponent(query); ap...
text = text.replace(/<\/?[^>]+(>|$)/g, ""); if (text.indexOf("\n") > 0) text = text.substr(0, text.indexOf("\n")); else if (text.indexOf("\n") === 0) text = text.substr(1); if (text.length === text.lastIndexOf("may refer to:") + 13) { api.randomMessage("oddresult", {"query"...
{ var pos = page.extract.indexOf(".", testpos); if (pos === -1) { api.randomMessage("oddresult", {"query": query}); return; } text = page.extract.substr(0, pos+1); var bstart = text.lastIndexOf("<b>"); var bend = text.lastIndexOf("</b>"); if (bstart < bend ...
conditional_block
index.js
module.exports = { "methods": { "wiki": function(msg, sender, api) { var query = msg.match(/\".+\"/)[0]; query = query.substring(1, query.length-1); var base = "http://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&rawcontinue&redirects&titles="+encodeURIComponent(query); ap...
text = text.replace(/<\/?[^>]+(>|$)/g, ""); if (text.indexOf("\n") > 0) text = text.substr(0, text.indexOf("\n")); else if (text.indexOf("\n") === 0) text = text.substr(1); if (text.length === text.lastIndexOf("may refer to:") + 13) { api.randomMessage("oddresult", {"query":...
break; testpos = pos + 1; }
random_line_split
require.d.ts
// require-2.1.1.d.ts // (c) 2012 Josh Baldwin // require.d.ts may be freely distributed under the MIT license. // For all details and documentation: // https://github.com/jbaldwin/require.d.ts interface RequireShim { // List of dependencies. deps?: string[]; // Name the module will...
// On Error override onError(): void; // Undefine a module undef(module: string): void; // Semi-private function, overload in special instance of undef() onResourceLoad(context: Object, map: RequireMap, depArray: RequireMap[]): void; } interface RequireError { requireType: string; requireModul...
random_line_split
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
(tx: &RFBTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { js.open_object("rfb")?; // Protocol version if let Some(tx_spv) = &tx.tc_server_protocol_version { js.open_object("server_protocol_version")?; js.set_string("major", &tx_spv.major)?; js.set_string("minor", &tx_sp...
log_rfb
identifier_name
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
match tx.chosen_security_type { Some(2) => { js.open_object("vnc")?; if let Some(ref sc) = tx.tc_vnc_challenge { let mut s = String::new(); for &byte in &sc.secret[..] { write!(&mut s, "{:02x}", byte).expect("Unable to write"); ...
if let Some(chosen_security_type) = tx.chosen_security_type { js.set_uint("security_type", chosen_security_type as u64)?; }
random_line_split
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
js.set_uint("security_type", chosen_security_type as u64)?; } match tx.chosen_security_type { Some(2) => { js.open_object("vnc")?; if let Some(ref sc) = tx.tc_vnc_challenge { let mut s = String::new(); for &byte in &sc.secret[..] { ...
{ js.open_object("rfb")?; // Protocol version if let Some(tx_spv) = &tx.tc_server_protocol_version { js.open_object("server_protocol_version")?; js.set_string("major", &tx_spv.major)?; js.set_string("minor", &tx_spv.minor)?; js.close()?; } if let Some(tx_cpv) = &tx.t...
identifier_body
serverFarmSku.ts
export class Tier { public static readonly free = 'Free'; public static readonly shared = 'Shared'; public static readonly basic = 'Basic'; public static readonly standard = 'Standard'; public static readonly premium = 'Premium'; public static readonly premiumV2 = 'PremiumV2'; public static readonly premi...
EP1CPU: 'EP1-C', EP1Memory: 'EP1-M', EP2CPU: 'EP2-C', EP2Memory: 'EP2-M', EP3CPU: 'EP3-C', EP3Memory: 'EP3-M', }; }
public static readonly ElasticPremium = { EP1: 'EP1', EP2: 'EP2', EP3: 'EP3',
random_line_split
serverFarmSku.ts
export class Tier { public static readonly free = 'Free'; public static readonly shared = 'Shared'; public static readonly basic = 'Basic'; public static readonly standard = 'Standard'; public static readonly premium = 'Premium'; public static readonly premiumV2 = 'PremiumV2'; public static readonly premi...
{ public static readonly Basic = { B1: 'B1', B2: 'B2', B3: 'B3', }; public static readonly Free = { F1: 'F1', }; public static readonly Shared = { D1: 'D1', }; public static readonly Standard = { S1: 'S1', S2: 'S2', S3: 'S3', }; public static readonly Premium = { ...
SkuCode
identifier_name
util.rs
use hyper::header::{Accept, Connection, ContentType, Headers, Quality, QualityItem, qitem}; use hyper::mime::{Mime, SubLevel, TopLevel}; use protobuf::{self, Message}; use proto::mesos::*; pub fn protobuf_headers() -> Headers { let mut headers = Headers::new(); headers.set(Accept(vec![ ...
{ offers.iter() .flat_map(|o| o.get_resources()) .filter(|r| r.get_name() == "mem") .map(|c| c.get_scalar()) .fold(0f64, |acc, mem_res| acc + mem_res.get_value()) }
identifier_body
util.rs
use hyper::header::{Accept, Connection, ContentType, Headers, Quality, QualityItem, qitem}; use hyper::mime::{Mime, SubLevel, TopLevel}; use protobuf::{self, Message}; use proto::mesos::*; pub fn protobuf_headers() -> Headers { let mut headers = Headers::new(); headers.set(Accept(vec![ ...
res.set_role(role.to_string()); res.set_field_type(Value_Type::SCALAR); res.set_scalar(scalar); res } pub fn get_scalar_resource_sum<'a>(name: &'a str, offers: Vec<&Offer>) -> f64 { offers.iter() .flat_map(|o| o.get_resources()) .filter(|r| r.get_name() == "mem") .map(...
let mut res = Resource::new(); res.set_name(name.to_string());
random_line_split
util.rs
use hyper::header::{Accept, Connection, ContentType, Headers, Quality, QualityItem, qitem}; use hyper::mime::{Mime, SubLevel, TopLevel}; use protobuf::{self, Message}; use proto::mesos::*; pub fn protobuf_headers() -> Headers { let mut headers = Headers::new(); headers.set(Accept(vec![ ...
(task_infos: Vec<TaskInfo>) -> Operation { let mut launch = Operation_Launch::new(); launch.set_task_infos(protobuf::RepeatedField::from_vec(task_infos)); let mut operation = Operation::new(); operation.set_field_type(Operation_Type::LAUNCH); operation.set_launch(launch); operation } pub fn sc...
launch_operation
identifier_name
settings.py
# Django settings for test_remote_project project. import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) FIXTURE_DIRS = [ os.path.join(PROJECT_ROOT, 'fixtures'...
# although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/Chicago' # Language code for...
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
random_line_split
gui.py
import cairo from gi.repository import Gtk from gi.repository import Gdk from pylsner import plugin class Window(Gtk.Window): def __init__(self): super(Window, self).__init__(skip_pager_hint=True, skip_taskbar_hint=True, ) ...
if redraw_required: self.queue_draw() return True def redraw(self, _, ctx): ctx.set_antialias(cairo.ANTIALIAS_SUBPIXEL) for wid in self.widgets: wid.redraw(ctx) class Widget: def __init__(self, name='default', metric=...
if (self.refresh_cnt % wid.metric.refresh_rate == 0) or force: wid.refresh() redraw_required = True
conditional_block
gui.py
import cairo from gi.repository import Gtk from gi.repository import Gdk from pylsner import plugin class Window(Gtk.Window): def __init__(self): super(Window, self).__init__(skip_pager_hint=True, skip_taskbar_hint=True, ) ...
(self, name='default', metric={'plugin': 'time'}, indicator={'plugin': 'arc'}, fill={'plugin': 'rgba_255'}, ): self.name = name MetricPlugin = plugin.load_plugin('metrics', metric['plugin']) self.metric = MetricP...
__init__
identifier_name
gui.py
import cairo from gi.repository import Gtk from gi.repository import Gdk from pylsner import plugin class Window(Gtk.Window): def __init__(self): super(Window, self).__init__(skip_pager_hint=True, skip_taskbar_hint=True, ) ...
self.stick() self.set_keep_below(True) drawing_area = Gtk.DrawingArea() drawing_area.connect('draw', self.redraw) self.refresh_cnt = 0 self.add(drawing_area) self.connect('destroy', lambda q: Gtk.main_quit()) self.widgets = [] self.show_all() ...
self.set_type_hint(Gdk.WindowTypeHint.DOCK)
random_line_split
gui.py
import cairo from gi.repository import Gtk from gi.repository import Gdk from pylsner import plugin class Window(Gtk.Window):
self.set_keep_below(True) drawing_area = Gtk.DrawingArea() drawing_area.connect('draw', self.redraw) self.refresh_cnt = 0 self.add(drawing_area) self.connect('destroy', lambda q: Gtk.main_quit()) self.widgets = [] self.show_all() def refresh(self,...
def __init__(self): super(Window, self).__init__(skip_pager_hint=True, skip_taskbar_hint=True, ) self.set_title('Pylsner') screen = self.get_screen() self.width = screen.get_width() self.height = screen.get...
identifier_body
DeleteNodeBST.py
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def deleteNode(self, root: TreeNode, key: int) -> TreeNode: # search for the node and its parent self.findNodeAndParent(root, key) if s...
return # if node has only one child if not node.left or not node.right: child = node.left if not node.right else node.right node.val = child.val node.left = child.left node.right = child.right return # nod...
parent.right = None
conditional_block
DeleteNodeBST.py
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def deleteNode(self, root: TreeNode, key: int) -> TreeNode: # search for the node and its parent self.findNodeAndParent(root, key) if s...
(self, root, key): if not root: return if root.val == key: self.node = root return self.parent = root if key < root.val: self.findNodeAndParent(root.left, key) else: self.findNodeAndParent(root.right, key) root = TreeNo...
findNodeAndParent
identifier_name
DeleteNodeBST.py
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def deleteNode(self, root: TreeNode, key: int) -> TreeNode: # search for the node and its parent self.findNodeAndParent(root, key) if s...
def getNodeSuccessor(self, node): succesorParent = node successor = node.right while successor.left: succesorParent = successor successor = successor.left return successor, succesorParent def findNodeAndParent(self, root, key): if not...
if not node.left and not node.right: if parent: if parent.left == node: parent.left = None else: parent.right = None return # if node has only one child if not node.left or not node.right: ...
identifier_body
DeleteNodeBST.py
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def deleteNode(self, root: TreeNode, key: int) -> TreeNode: # search for the node and its parent self.findNodeAndParent(root, key) if s...
# if node has only one child if not node.left or not node.right: child = node.left if not node.right else node.right node.val = child.val node.left = child.left node.right = child.right return # node has two children ...
parent.right = None return
random_line_split
directdl_tv.py
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 the License, or (at your option) any l...
from resources.lib.libraries import control from resources.lib.libraries import cleantitle from resources.lib.libraries import client from resources.lib import resolvers class source: def __init__(self): self.base_link = 'http://directdownload.tv' self.search_link = 'L2FwaT9rZXk9NEIwQkI4NjJGMjRDOE...
random_line_split
directdl_tv.py
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 the License, or (at your option) any l...
elif quality in ['720P', 'WEBDL']: quality = 'HD' else: quality = 'SD' size = i['size'] size = float(size)/1024 info = '%.2f GB' % size url = i['links'] for x in url.keys(): lin...
quality = '1080p'
conditional_block
directdl_tv.py
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 the License, or (at your option) any l...
(self, url, imdb, tvdb, title, date, season, episode): try: if url == None: return url = '%s S%02dE%02d' % (url, int(season), int(episode)) url = client.replaceHTMLCodes(url) url = url.encode('utf-8') return url except: return ...
get_episode
identifier_name
directdl_tv.py
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 the License, or (at your option) any l...
def get_sources(self, url, hosthdDict, hostDict, locDict): try: sources = [] if url == None: return sources if (control.setting('realdedrid_user') == '' and control.setting('premiumize_user') == ''): raise Exception() query = base64.urlsafe_b64decode(sel...
try: if url == None: return url = '%s S%02dE%02d' % (url, int(season), int(episode)) url = client.replaceHTMLCodes(url) url = url.encode('utf-8') return url except: return
identifier_body
inputgroup.tsx
import React from 'react'; import { LabIcon } from '../icon'; import { classes } from '../utils'; /** * InputGroup component properties */ export interface IInputGroupProps extends React.InputHTMLAttributes<HTMLInputElement> { /** * Right icon adornment */ rightIcon?: string | LabIcon; } /** * InputGro...
<span className="jp-InputGroupAction"> {typeof rightIcon === 'string' ? ( <LabIcon.resolveReact icon={rightIcon} elementPosition="center" tag="span" /> ) : ( <rightIcon.react elementPosition="center" tag="span" /> ...
{rightIcon && (
random_line_split
object-safety-issue-22040.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 main() { let a: Box<Expr> = Box::new(SExpr::new()); //~ ERROR E0038 let b: Box<Expr> = Box::new(SExpr::new()); //~ ERROR E0038 // assert_eq!(a , b); }
{ println!("element count: {}", self.elements.len()); }
identifier_body
object-safety-issue-22040.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 ...
(&self, other:&SExpr<'x>) -> bool { println!("L1: {} L2: {}", self.elements.len(), other.elements.len()); //~^ ERROR E0038 let result = self.elements.len() == other.elements.len(); println!("Got compare {}", result); return result; } } impl <'x> SExpr<'x> { fn new() -> ...
eq
identifier_name
object-safety-issue-22040.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 ...
impl <'x> SExpr<'x> { fn new() -> SExpr<'x> { return SExpr{elements: Vec::new(),}; } } impl <'x> Expr for SExpr<'x> { fn print_element_count(&self) { println!("element count: {}", self.elements.len()); } } fn main() { let a: Box<Expr> = Box::new(SExpr::new()); //~ ERROR E0038 let b: Box<E...
println!("Got compare {}", result); return result; } }
random_line_split
ConnectionDetailHeader.test.tsx
/* * Copyright 2020, EnMasse authors.
import { IConnectionHeaderDetailProps, ConnectionDetailHeader } from "components/ConnectionDetail/ConnectionDetailHeader"; import { render, fireEvent } from "@testing-library/react"; describe("Connection Detail Header with all connection details", () => { test("it renders ConnectionDetailHeader component with al...
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ import * as React from "react";
random_line_split
sessionQuizView.tsx
import * as React from "react"; import { connect } from "react-redux"; import { Link } from "react-router" import * as MediaQuery from "react-responsive" import DashboardContainer from "../../containers/dashboard/dashboardContainer" import PresentationContainer from "../../containers/dashboard/presentationContainer" i...
<button onClick={ updateRooms }>Update rooms</button> <button onClick={ leaveRoom }>Leave room</button> { roomOwner != null && <button onClick={ closeRoom }>Close room</button> } { isTeacher && <button onClick={ openRoom }>Open room</button...
{ const { rooms, isTeacher, roomOwner, updateRooms, joinRoom, leaveRoom, closeRoom, openRoom } = this.props let dashboard: boolean = (this.props as any).location.pathname == "/dashboard", ...
identifier_body
sessionQuizView.tsx
import * as React from "react"; import { connect } from "react-redux"; import { Link } from "react-router" import * as MediaQuery from "react-responsive" import DashboardContainer from "../../containers/dashboard/dashboardContainer" import PresentationContainer from "../../containers/dashboard/presentationContainer" i...
joinRoom, leaveRoom, closeRoom, openRoom } = this.props let dashboard: boolean = (this.props as any).location.pathname == "/dashboard", presentation: boolean = (this.props as any).location.pathname == "/presentation", remote: boole...
isTeacher, roomOwner, updateRooms,
random_line_split
sessionQuizView.tsx
import * as React from "react"; import { connect } from "react-redux"; import { Link } from "react-router" import * as MediaQuery from "react-responsive" import DashboardContainer from "../../containers/dashboard/dashboardContainer" import PresentationContainer from "../../containers/dashboard/presentationContainer" i...
() { const { rooms, isTeacher, roomOwner, updateRooms, joinRoom, leaveRoom, closeRoom, openRoom } = this.props let dashboard: boolean = (this.props as any).location.pathname == "/dashboard", ...
render
identifier_name
cart-monitor.js
/** * Watches for changes to the quantity of items in the shopping cart, to update * cart count indicators on the storefront. */ define(['modules/jquery-mozu', 'modules/api'], function ($, api) { $(document).ready(function () { var $cartCount = $('[data-mz-role="cartmonitor"]'), timeout; ...
api.on('sync', checkForCartUpdates); api.on('spawn', checkForCartUpdates); var savedCount = $.cookie('mozucartcount'); if (savedCount === null) waitAndGetCart(); $cartCount.text(savedCount || 0); }); });
$cartCount.text(count); $.cookie('mozucartcount', count, { path: '/' }); }
identifier_body
cart-monitor.js
/** * Watches for changes to the quantity of items in the shopping cart, to update * cart count indicators on the storefront.
var $cartCount = $('[data-mz-role="cartmonitor"]'), timeout; function waitAndGetCart() { return setTimeout(function() { api.get('cartsummary').then(function (summary) { updateCartCount(summary.count()); }); }, 500); ...
*/ define(['modules/jquery-mozu', 'modules/api'], function ($, api) { $(document).ready(function () {
random_line_split
cart-monitor.js
/** * Watches for changes to the quantity of items in the shopping cart, to update * cart count indicators on the storefront. */ define(['modules/jquery-mozu', 'modules/api'], function ($, api) { $(document).ready(function () { var $cartCount = $('[data-mz-role="cartmonitor"]'), timeout; ...
ount) { $cartCount.text(count); $.cookie('mozucartcount', count, { path: '/' }); } api.on('sync', checkForCartUpdates); api.on('spawn', checkForCartUpdates); var savedCount = $.cookie('mozucartcount'); if (savedCount === null) waitAndGetCart(); ...
dateCartCount(c
identifier_name
camera.py
#!/usr/bin/python3.7 import ssl import remi.gui as gui from remi import start, App class Camera(App): def __init__(self, *args, **kwargs): super(Camera, self).__init__(*args) def video_widgets(self): width = '300' height = '300' self.video = gui.Widget(_type='video') s...
# certfile='./ssl_keys/fullchain.pem', # keyfile='./ssl_keys/privkey.pem', # ssl_version=ssl.PROTOCOL_TLSv1_2,
start(Camera, address='0.0.0.0', port=2020, multiple_instance=True, enable_file_cache=True, start_browser=False, debug=False)
conditional_block
camera.py
#!/usr/bin/python3.7 import ssl import remi.gui as gui from remi import start, App class Camera(App): def __init__(self, *args, **kwargs): super(Camera, self).__init__(*args) def video_widgets(self): width = '300' height = '300' self.video = gui.Widget(_type='video') s...
print('I am here') ### Do whatever you want with the image here return def main(self): self.video_widgets() screen = [self.video] start_button = gui.Button('Start Video') start_button.onclick.do(self.video_start, 'process_image') screen.append(start_b...
""") def process_image(self, **kwargs): image = kwargs['image']
random_line_split
camera.py
#!/usr/bin/python3.7 import ssl import remi.gui as gui from remi import start, App class Camera(App): def __init__(self, *args, **kwargs): super(Camera, self).__init__(*args) def video_widgets(self): width = '300' height = '300' self.video = gui.Widget(_type='video') s...
requestAnimationFrame(render); } requestAnimationFrame(render); """%{'id':str(id(self)), 'callback_function': str(callback_function)}) def video_stop(self, widget): self.execute_javascript(""" document.video_stop = true; const video = document.querySel...
self.execute_javascript(""" var params={}; var frame = 0; document.video_stop = false; const video = document.querySelector('video'); video.setAttribute("playsinline", true); const canvas = document.createElement('canvas'); navigator.mediaDevices.getUserMedia({vid...
identifier_body
camera.py
#!/usr/bin/python3.7 import ssl import remi.gui as gui from remi import start, App class Camera(App): def __init__(self, *args, **kwargs): super(Camera, self).__init__(*args) def video_widgets(self): width = '300' height = '300' self.video = gui.Widget(_type='video') s...
(self): self.video_widgets() screen = [self.video] start_button = gui.Button('Start Video') start_button.onclick.do(self.video_start, 'process_image') screen.append(start_button) stop_button = gui.Button('Stop Video') stop_button.onclick.do(self.video_stop) ...
main
identifier_name
CellularEmporium.tsx
import { useBackend } from '../backend'; import { Button, Section, Icon, Stack, LabeledList, Box, NoticeBox } from '../components'; import { Window } from '../layouts';
can_readapt: boolean; genetic_points_remaining: number; } type Ability = { name: string; desc: string; dna_cost: number; helptext: string; owned: boolean; } export const CellularEmporium = (props, context) => { const { act, data } = useBackend<CellularEmporiumContext>(context); const { can_readapt, ...
type CellularEmporiumContext = { abilities: Ability[];
random_line_split
patient.medication.component.ts
import { Router, ActivatedRoute, Params } from '@angular/router'; import { Component } from '@angular/core'; import { Apollo } from 'apollo-angular'; import gql from 'graphql-tag'; interface QueryResponse { patient loading } interface PatientMedication { name: string; dose: string; pr...
export class PatientMedicationComponent { public patientMedications: PatientMedication[]; public loading: boolean; id: string; constructor(private apollo: Apollo, private activatedRoute: ActivatedRoute) { } ngOnInit() { this.activatedRoute.params.subscribe((params: Params) => { ...
@Component({ selector: 'patient-medication', templateUrl: './patient.medication.component.html' })
random_line_split
patient.medication.component.ts
import { Router, ActivatedRoute, Params } from '@angular/router'; import { Component } from '@angular/core'; import { Apollo } from 'apollo-angular'; import gql from 'graphql-tag'; interface QueryResponse { patient loading } interface PatientMedication { name: string; dose: string; pr...
ngOnInit() { this.activatedRoute.params.subscribe((params: Params) => { this.id = params['id']; this.apollo.query<QueryResponse>({ query: gql` query { patient(nhsNumber:"${this.id}"){medications{name,dose,prescribedOn}}}` }).subscribe(({ data })...
{ }
identifier_body
patient.medication.component.ts
import { Router, ActivatedRoute, Params } from '@angular/router'; import { Component } from '@angular/core'; import { Apollo } from 'apollo-angular'; import gql from 'graphql-tag'; interface QueryResponse { patient loading } interface PatientMedication { name: string; dose: string; pr...
() { this.activatedRoute.params.subscribe((params: Params) => { this.id = params['id']; this.apollo.query<QueryResponse>({ query: gql` query { patient(nhsNumber:"${this.id}"){medications{name,dose,prescribedOn}}}` }).subscribe(({ data }) => { ...
ngOnInit
identifier_name
token.py
#!/usr/bin/python # -*- coding: utf-8 -*- import mysql.connector #from token find userId #return 0 for error def findUser(userToken, cnx): userQuery = 'SELECT user_id FROM user_token WHERE user_token = %s' try: userCursor = cnx.cursor() userCursor.execute(userQuery, (userToken, )) retur...
#delete token #return 1 for success #return 0 for fail def deleteToken(userId, cnx): cleanQuery = 'DELETE FROM user_token WHERE user_id = %s' try: cleanCursor = cnx.cursor() cleanCursor.execute(cleanQuery, (userId, )) cnx.commit() return '1' except mysql.connector.Error as ...
addQuery = 'INSERT INTO user_token (user_id, user_token) VALUES (%s, %s) ON DUPLICATE KEY UPDATE user_token = %s' try: addCursor = cnx.cursor() addCursor.execute(addQuery, (userId, userToken, userToken)) cnx.commit() return '1' except mysql.connector.Error as err: print('...
identifier_body
token.py
#!/usr/bin/python # -*- coding: utf-8 -*- import mysql.connector #from token find userId #return 0 for error def findUser(userToken, cnx): userQuery = 'SELECT user_id FROM user_token WHERE user_token = %s' try: userCursor = cnx.cursor() userCursor.execute(userQuery, (userToken, )) retur...
addCursor = cnx.cursor() addCursor.execute(addQuery, (userId, userToken, userToken)) cnx.commit() return '1' except mysql.connector.Error as err: print('Something went wrong: {}'.format(err)) cnx.rollback() return '0' finally: addCursor.close() #d...
random_line_split
token.py
#!/usr/bin/python # -*- coding: utf-8 -*- import mysql.connector #from token find userId #return 0 for error def
(userToken, cnx): userQuery = 'SELECT user_id FROM user_token WHERE user_token = %s' try: userCursor = cnx.cursor() userCursor.execute(userQuery, (userToken, )) return userCursor.fetchone() #return 0 for db error except mysql.connector.Error as err: print('Something went ...
findUser
identifier_name