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
filter_news.py
"""Generate year files with news counts Usage: filter_news.py <directory> <output> <lang> Options: -h, --help """ from docopt import docopt from os import listdir from os.path import isfile, join, getsize import datetime from tqdm import * import pandas as pd def
(id, lis): for i in range(0, len(lis)): if id == lis[i]: return i return -1 if __name__ == "__main__": # Parse the command line args = docopt(__doc__) # Array with the week we are considering weeks = [42,43,44,45,46,47,48,49,50,51,52,1,23,4,5,6,7,8,9,10,11,12,13,14,15] # Final count dictionary news_cou...
find_index
identifier_name
DTITagManagement.js
var currentTagsArray = new Array(); var popularTagsArray = new Array(); var separatorArray = new Array(); var currIdArray = new Array(); $(document).ready(function(){ for (var currDivId in currentTagsArray) for(var index in currentTagsArray[currDivId]) if(isInteger(index) && currentTagsArray[...
) { return (s.toString().search(/^-?[0-9]+$/) == 0); } function prepareCurrentTags(){ var currDivId = 0; for (currDivId = 0; currDivId < currentTagsArray.length; currDivId++) { var tags = ''; var index = 0; for (index = 0; index < currentTagsArray[currDivId].length; index++) { ...
Integer(s
identifier_name
DTITagManagement.js
var currentTagsArray = new Array(); var popularTagsArray = new Array(); var separatorArray = new Array(); var currIdArray = new Array(); $(document).ready(function(){ for (var currDivId in currentTagsArray) for(var index in currentTagsArray[currDivId]) if(isInteger(index) && currentTagsArray[...
for (currDivId = 0; currDivId < currentTagsArray.length; currDivId++) { var tags = ''; var index = 0; for (index = 0; index < currentTagsArray[currDivId].length; index++) { if(currentTagsArray[currDivId][index].toString().trim() != '') { tags = tags + separatorArr...
var currDivId = 0;
random_line_split
DTITagManagement.js
var currentTagsArray = new Array(); var popularTagsArray = new Array(); var separatorArray = new Array(); var currIdArray = new Array(); $(document).ready(function(){ for (var currDivId in currentTagsArray) for(var index in currentTagsArray[currDivId]) if(isInteger(index) && currentTagsArray[...
else { for (var index in currIdArray) if (currIdArray[index] == addToDivId) if(jQuery.inArray(tag, currentTagsArray[index]) < 0) { currentTagsArray[index].push(tag); $("#" + addToDivId).append("<div class=\"DTICurrentTag\"><div class=\"DTIC...
$("#" + addToDivId).append("<div class=\"DTICurrentTag\"><div class=\"DTICancelButton\">X</div><div class=\"DTITagText\">" + tag + "</div></div>"); }
conditional_block
DTITagManagement.js
var currentTagsArray = new Array(); var popularTagsArray = new Array(); var separatorArray = new Array(); var currIdArray = new Array(); $(document).ready(function(){ for (var currDivId in currentTagsArray) for(var index in currentTagsArray[currDivId]) if(isInteger(index) && currentTagsArray[...
function prepareCurrentTags(){ var currDivId = 0; for (currDivId = 0; currDivId < currentTagsArray.length; currDivId++) { var tags = ''; var index = 0; for (index = 0; index < currentTagsArray[currDivId].length; index++) { if(currentTagsArray[currDivId][index].toString().trim...
return (s.toString().search(/^-?[0-9]+$/) == 0); }
identifier_body
index.js
var exec = require('child_process').exec; var EventEmitter = require('events').EventEmitter; var util = require('util'); var os = require('os-utils'); var async = require('async'); function Monitor(options){ this.options = options || { delay:1000, interval:5000 } } util.inherits(Monitor, EventEmitter); Monito...
} module.exports = function(options){ return new Monitor(options); }
}, function(error, data){ var packet = data.os || {}; packet.memory = data.memory; self.emit('stat', packet); })
random_line_split
index.js
var exec = require('child_process').exec; var EventEmitter = require('events').EventEmitter; var util = require('util'); var os = require('os-utils'); var async = require('async'); function
(options){ this.options = options || { delay:1000, interval:5000 } } util.inherits(Monitor, EventEmitter); Monitor.prototype.interval = function(delay){ this.options.interval = interval; this.stop(); this.start(); return this; } Monitor.prototype.start = function(){ var self = this; this.interval_id = se...
Monitor
identifier_name
index.js
var exec = require('child_process').exec; var EventEmitter = require('events').EventEmitter; var util = require('util'); var os = require('os-utils'); var async = require('async'); function Monitor(options){ this.options = options || { delay:1000, interval:5000 } } util.inherits(Monitor, EventEmitter); Monit...
return this; } Monitor.prototype.stat = function(){ var self = this; async.parallel({ os:function(done){ os.cpuUsage(function(v){ var packet = { cpu:{ usage:v }, load:{ load1:os.loadavg(1), load5:os.loadavg(5), load15:os.loadavg(15) }, system:{ uptim...
{ clearInterval(this.interval_id); }
conditional_block
index.js
var exec = require('child_process').exec; var EventEmitter = require('events').EventEmitter; var util = require('util'); var os = require('os-utils'); var async = require('async'); function Monitor(options)
util.inherits(Monitor, EventEmitter); Monitor.prototype.interval = function(delay){ this.options.interval = interval; this.stop(); this.start(); return this; } Monitor.prototype.start = function(){ var self = this; this.interval_id = setTimeout(function(){ self.stat(); self.interval_id = setInterval(funct...
{ this.options = options || { delay:1000, interval:5000 } }
identifier_body
buffer.rs
/// Memory buffers for the benefit of `std::io::net` which has slow read/write. use std::io::{IoResult, Stream}; use std::cmp::min; use std::slice; use std::fmt::radix; use std::ptr; // 64KB chunks (moderately arbitrary) const READ_BUF_SIZE: usize = 0x10000; const WRITE_BUF_SIZE: usize = 0x10000; // TODO: consider re...
} impl<T: Reader> BufferedStream<T> { /// Poke a single byte back so it will be read next. For this to make sense, you must have just /// read that byte. If `self.pos` is 0 and `self.max` is not 0 (i.e. if the buffer is just /// filled /// Very great caution must be used in calling this as it will fai...
{ let mut read_buffer = Vec::with_capacity(READ_BUF_SIZE); unsafe { read_buffer.set_len(READ_BUF_SIZE); } let mut write_buffer = Vec::with_capacity(WRITE_BUF_SIZE); unsafe { write_buffer.set_len(WRITE_BUF_SIZE); } BufferedStream { wrapped: stream, read_buf...
identifier_body
buffer.rs
/// Memory buffers for the benefit of `std::io::net` which has slow read/write. use std::io::{IoResult, Stream}; use std::cmp::min; use std::slice; use std::fmt::radix; use std::ptr; // 64KB chunks (moderately arbitrary) const READ_BUF_SIZE: usize = 0x10000; const WRITE_BUF_SIZE: usize = 0x10000; // TODO: consider re...
/// Finish off writing a response: this flushes the writer and in case of chunked /// Transfer-Encoding writes the ending zero-length chunk to indicate completion. /// /// At the time of calling this, headers MUST have been written, including the /// ending CRLF, or else an invalid HTTP response may...
random_line_split
buffer.rs
/// Memory buffers for the benefit of `std::io::net` which has slow read/write. use std::io::{IoResult, Stream}; use std::cmp::min; use std::slice; use std::fmt::radix; use std::ptr; // 64KB chunks (moderately arbitrary) const READ_BUF_SIZE: usize = 0x10000; const WRITE_BUF_SIZE: usize = 0x10000; // TODO: consider re...
} else { unsafe { ptr::copy_memory(self.write_buffer.as_mut_ptr().offset(self.write_len as isize), buf.as_ptr(), buf.len()); } self.write_len += buf.len(); if self.write_len == self.write_buffer.len() { if self...
{ try!(self.wrapped.write(b"\r\n")); }
conditional_block
buffer.rs
/// Memory buffers for the benefit of `std::io::net` which has slow read/write. use std::io::{IoResult, Stream}; use std::cmp::min; use std::slice; use std::fmt::radix; use std::ptr; // 64KB chunks (moderately arbitrary) const READ_BUF_SIZE: usize = 0x10000; const WRITE_BUF_SIZE: usize = 0x10000; // TODO: consider re...
(&mut self) -> IoResult<()> { if self.write_len > 0 { if self.writing_chunked_body { let s = format!("{}\r\n", radix(self.write_len, 16)); try!(self.wrapped.write(s.as_bytes())); } try!(self.wrapped.write(&self.write_buffer[..self.write_len]));...
flush
identifier_name
arthur-deviation-weights.unit.test.ts
ArthurDeviationWeights, arthurDeviationWeights, IArthurDeviationWeightsSettings, update, updateChange, } from './arthur-deviation-weights'; import { setup, teardown } from '../utilities/kernel'; import { mockLayer, shave, shave2D } from '../test-utils'; describe('ArthurDeviationWeights Class: Unit', () => { ...
import { GPU, IKernelRunShortcut } from 'gpu.js'; import { gpuMock } from 'gpu-mock.js'; import {
random_line_split
prf.py
return res[:req_len] def _tls_P_MD5(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-MD5"]) def _tls_P_SHA1(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-SHA"]) def _tls_P_SHA256(secret, seed, req_len): return _tls_P_...
res += hm(secret).digest(a + seed) a = hm(secret).digest(a) n -= 1
conditional_block
prf.py
) n -= 1 return res[:req_len] def _tls_P_MD5(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-MD5"]) def _tls_P_SHA1(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-SHA"]) def _tls_P_SHA256(secret, seed, req_len): ...
(self, master_secret, server_random, client_random, req_len): """ Perform the derivation of master_secret into a key_block of req_len requested length. See RFC 5246, section 6.3. """ seed = server_random + client_random if self.tls_version <= 0x03...
derive_key_block
identifier_name
prf.py
) n -= 1 return res[:req_len] def _tls_P_MD5(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-MD5"]) def _tls_P_SHA1(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-SHA"]) def _tls_P_SHA256(secret, seed, req_len): ...
"This PRF with the SHA-2
random_line_split
prf.py
) n -= 1 return res[:req_len] def _tls_P_MD5(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-MD5"]) def _tls_P_SHA1(secret, seed, req_len): return _tls_P_hash(secret, seed, req_len, _tls_hmac_algs["HMAC-SHA"]) def _tls_P_SHA256(secret, seed, req_len): ...
a1 = _tls_P_MD5(S1, label + seed, req_len) a2 = _tls_P_SHA1(S2, label + seed, req_len) return strxor(a1, a2) def _tls12_SHA256PRF(secret, label, seed, req_len): """ Provides the implementation of TLS 1.2 PRF function as defined in section 5 of RFC 5246: PRF(secret, label, seed) = P_SHA2...
""" Provides the implementation of TLS PRF function as defined in section 5 of RFC 4346: PRF(secret, label, seed) = P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed) Parameters are: - secret: the secret used by the HMAC in the 2 expansion functions...
identifier_body
problem_38.py
"""38. Count and Say https://leetcode.com/problems/count-and-say/description/ The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one ...
def say(num_str: str) -> str: res = "" cur_digit = num_str[0] cur_digit_count = 1 for i in range(1, len(num_str)): if num_str[i] == cur_digit: cur_digit_count += 1 else: res += str(cur_digit_coun...
n "1"
conditional_block
problem_38.py
"""38. Count and Say https://leetcode.com/problems/count-and-say/description/ The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one ...
cur_digit_count = 1 res += str(cur_digit_count) + cur_digit return res ans = "1" for i in range(1, n): ans = say(ans) return ans
random_line_split
problem_38.py
"""38. Count and Say https://leetcode.com/problems/count-and-say/description/ The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one ...
ans = "1" for i in range(1, n): ans = say(ans) return ans
ount_and_say(self, n: int) -> str: assert 1 <= n <= 30 if n == 1: return "1" def say(num_str: str) -> str: res = "" cur_digit = num_str[0] cur_digit_count = 1 for i in range(1, len(num_str)): if num_str[i] == cur_digit...
identifier_body
problem_38.py
"""38. Count and Say https://leetcode.com/problems/count-and-say/description/ The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "one ...
def count_and_say(self, n: int) -> str: assert 1 <= n <= 30 if n == 1: return "1" def say(num_str: str) -> str: res = "" cur_digit = num_str[0] cur_digit_count = 1 for i in range(1, len(num_str)): if num_str[i] == cur...
ion:
identifier_name
__init__.py
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from keras.models.cloning import _clone_sequential_model
random_line_split
bdo-poke.js
/** * Инициализация модуля. */ /*global define*/ define(['./poke-control', './poke-history', 'jquery'], function (pokeControl, pokeHistory, $) {
'use strict'; var pokeSettings = { pokeControl: { selector: '.poke-control-container', template: '<form class="form"><div class="form-group"><label for="bdoChannel">Канал:</label><select class="form-control" name="bdoChannel" id="bdoChannel"></select></div><div class...
random_line_split
brick_status_event_handler.py
#!/usr/bin/python # brick_status_event_handler.py Event handler for Brick status # Service. Reschedules the check for volume status service whenever a # brick status changes. # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General...
args = parse_input() if args.stateType == "SOFT": sys.exit(utils.PluginStatusCode.OK) hostName = _findClusterName(args.hostGroups) now = datetime.datetime.now() command = "SCHEDULE_SVC_CHECK" volumeStatusService = "Volume Status - %s" % args.volume cmdStr = "[%s] %s;%s;%s;%s\n" % (now, c...
conditional_block
brick_status_event_handler.py
#!/usr/bin/python # brick_status_event_handler.py Event handler for Brick status # Service. Reschedules the check for volume status service whenever a # brick status changes. # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General...
args = parser.parse_args() return args def _findClusterName(hostGroupNames): hostGroups = hostGroupNames.split(",") for hostGroup in hostGroups: if hostGroup != GLUSTER_HOST_GROUP: return hostGroup if __name__ == '__main__': args = parse_input() if args.stateType == "SOFT...
type=str, required=True, help='Volume Name')
random_line_split
brick_status_event_handler.py
#!/usr/bin/python # brick_status_event_handler.py Event handler for Brick status # Service. Reschedules the check for volume status service whenever a # brick status changes. # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General...
def _findClusterName(hostGroupNames): hostGroups = hostGroupNames.split(",") for hostGroup in hostGroups: if hostGroup != GLUSTER_HOST_GROUP: return hostGroup if __name__ == '__main__': args = parse_input() if args.stateType == "SOFT": sys.exit(utils.PluginStatusCode.OK)...
parser = argparse.ArgumentParser(description="Nagios plugin to handle " "brick status events") parser.add_argument('-hg', '--hostgroups', action='store', dest='hostGroups', type=str, required=True, help='Hostgroups') ...
identifier_body
brick_status_event_handler.py
#!/usr/bin/python # brick_status_event_handler.py Event handler for Brick status # Service. Reschedules the check for volume status service whenever a # brick status changes. # Copyright (C) 2014 Red Hat Inc # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General...
(hostGroupNames): hostGroups = hostGroupNames.split(",") for hostGroup in hostGroups: if hostGroup != GLUSTER_HOST_GROUP: return hostGroup if __name__ == '__main__': args = parse_input() if args.stateType == "SOFT": sys.exit(utils.PluginStatusCode.OK) hostName = _findCl...
_findClusterName
identifier_name
data_trigger.py
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permi...
if __name__ == '__main__': trigger = DataUpdateTrigger()
return
conditional_block
data_trigger.py
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permi...
(Trigger): def execute(my): sobject = my.get_current_sobject() class DataUpdateTrigger(Trigger): def get_args_keys(my): return { } def execute(my): input = my.get_input() if input.get("mode") == 'delete': return print "input: ", input ...
DataValidationTrigger
identifier_name
data_trigger.py
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permi...
value = sobject.get_value(src_col) delimiter = "_" parts = value.split(delimiter) value = parts[index] sobject.set_value(dst_col, value) sobject.commit() elif op == 'expression': # use the full expression language ...
index = int(index)
random_line_split
data_trigger.py
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permi...
class DataUpdateTrigger(Trigger): def get_args_keys(my): return { } def execute(my): input = my.get_input() if input.get("mode") == 'delete': return print "input: ", input sobject = input.get("sobject") trigger_sobj = my.get_trigger_s...
sobject = my.get_current_sobject()
identifier_body
__init__.py
"""Support for Geofency.""" import logging from aiohttp import web import voluptuous as vol from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK, HTTP_UNPROCESSABLE_ENTI...
else: location_name = STATE_NOT_HOME if ATTR_CURRENT_LATITUDE in data: data[ATTR_LATITUDE] = data[ATTR_CURRENT_LATITUDE] data[ATTR_LONGITUDE] = data[ATTR_CURRENT_LONGITUDE] return _set_location(hass, data, location_name) def _is_mobile_beacon(data, mobile_beacons): ...
location_name = data["name"]
conditional_block
__init__.py
"""Support for Geofency.""" import logging from aiohttp import web import voluptuous as vol from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK, HTTP_UNPROCESSABLE_ENTI...
def _is_mobile_beacon(data, mobile_beacons): """Check if we have a mobile beacon.""" return ATTR_BEACON_ID in data and data["name"] in mobile_beacons def _device_name(data): """Return name of device tracker.""" if ATTR_BEACON_ID in data: return f"{BEACON_DEV_PREFIX}_{data['name']}" retu...
"""Handle incoming webhook from Geofency.""" try: data = WEBHOOK_SCHEMA(dict(await request.post())) except vol.MultipleInvalid as error: return web.Response(text=error.error_message, status=HTTP_UNPROCESSABLE_ENTITY) if _is_mobile_beacon(data, hass.data[DOMAIN]["beacons"]): return _...
identifier_body
__init__.py
"""Support for Geofency.""" import logging from aiohttp import web import voluptuous as vol from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK, HTTP_UNPROCESSABLE_ENTI...
(hass, webhook_id, request): """Handle incoming webhook from Geofency.""" try: data = WEBHOOK_SCHEMA(dict(await request.post())) except vol.MultipleInvalid as error: return web.Response(text=error.error_message, status=HTTP_UNPROCESSABLE_ENTITY) if _is_mobile_beacon(data, hass.data[DOMA...
handle_webhook
identifier_name
__init__.py
"""Support for Geofency.""" import logging from aiohttp import web import voluptuous as vol from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK, HTTP_UNPROCESSABLE_ENTI...
_LOGGER = logging.getLogger(__name__) CONF_MOBILE_BEACONS = "mobile_beacons" CONFIG_SCHEMA = vol.Schema( { vol.Optional(DOMAIN): vol.Schema( { vol.Optional(CONF_MOBILE_BEACONS, default=[]): vol.All( cv.ensure_list, [cv.string] ) }...
from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.util import slugify from .const import DOMAIN
random_line_split
LogManager.py
(self.layoutFinished) if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged) def createSummary(self): from Screens.PluginBrowser import PluginBrowserSummary return PluginBrowserSummary def selectionChanged(self): item = self["list"]....
data = MIMEText(fp.read()) fp.close() msg.attach(data) self.saveSelection() sentfiles = self.sel
random_line_split
LogManager.py
= line.strip().split() mounts.append(parts[1]) f.close() for mount in mounts: if path.isdir(path.join(mount,'logs')): matches.append(path.join(mount,'logs')) matches.append('/home/root/logs') print "[LogManager] found following log's:", matches if len(matches): for logsfolder in matches: p...
elf): try: self.sel = self["list"].getCurrent()[0] except: self.sel = None if self.sel: self["list"].changeSelectionState() self.selectedFiles = self["list"].getSelectedList() def changelogtype(self): self["LogsSize"].update(config.crash.debug_path.value) import re if self.logtype == 'crashlog...
angeSelectionState(s
identifier_name
LogManager.py
0) if path.exists(self.defaultDir + self.sel[0]): remove(self.defaultDir + self.sel[0]) self["list"].changeDir(self.defaultDir) self["LogsSize"].update(config.crash.debug_path.value) def sendlog(self, addtionalinfo = None): try: self.sel = self["list"].getCurrent()[0] except: self.sel = None ...
lf.SOURCELIST.pageUp()
identifier_body
LogManager.py
= line.strip().split() mounts.append(parts[1]) f.close() for mount in mounts: if
matches.append('/home/root/logs') print "[LogManager] found following log's:", matches if len(matches): for logsfolder in matches: print "[LogManager] looking in:", logsfolder logssize = get_size(logsfolder) bytesToRemove = logssize - allowedBytes candidates = [] size = 0 for root, dirs...
path.isdir(path.join(mount,'logs')): matches.append(path.join(mount,'logs'))
conditional_block
last-use-in-cap-clause.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ assert_eq!(foo().call_mut(()), 22); }
identifier_body
last-use-in-cap-clause.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() -> Box<FnMut() -> isize + 'static> { let k: Box<_> = box 22; let _u = A {a: k.clone()}; // FIXME(#16640) suffix in `22` suffix shouldn't be necessary let result = || 22; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Box::new(result) } pub fn main() { assert_eq!...
foo
identifier_name
last-use-in-cap-clause.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let _u = A {a: k.clone()}; // FIXME(#16640) suffix in `22` suffix shouldn't be necessary let result = || 22; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. Box::new(result) } pub fn main() { assert_eq!(foo().call_mut(()), 22); }
struct A { a: Box<isize> } fn foo() -> Box<FnMut() -> isize + 'static> { let k: Box<_> = box 22;
random_line_split
scaffold.utils.js
var _ = require('lodash'); var fs = require('fs-extra'); var path = require('path'); var pathsHelper = require('../helpers/paths.helper'); exports.ADDABLE_NODES = ['Component', 'Layout', 'Page']; exports.SCSS_PLACEHOLDER_DELIMITERS = [ '/* insert new ', ' */' ]; exports.JS_COMPONENT_STRING = 'addcomponenttothis'...
}
return isCraft ? '/craft' : '';
random_line_split
evenlyDivisible.py
#!/bin/python import math def SumOfFactors(f_1, f_2): for key in f_2.keys(): if (key in f_1): f_1[key] += f_2[key] else:
def PrimeFactorsOfNumber(n): sqrt_n = int(math.sqrt(n)) if (n == sqrt_n * sqrt_n): # Perfect square return SumOfFactors( PrimeFactorsOfNumber(sqrt_n), PrimeFactorsOfNumber(sqrt_n)) for i in range (2, sqrt_n+1): if (n % i == 0): # n isn't prime return SumOfFactors( Pr...
f_1[key] = f_2[key] return f_1;
random_line_split
evenlyDivisible.py
#!/bin/python import math def SumOfFactors(f_1, f_2): for key in f_2.keys(): if (key in f_1): f_1[key] += f_2[key] else: f_1[key] = f_2[key] return f_1; def
(n): sqrt_n = int(math.sqrt(n)) if (n == sqrt_n * sqrt_n): # Perfect square return SumOfFactors( PrimeFactorsOfNumber(sqrt_n), PrimeFactorsOfNumber(sqrt_n)) for i in range (2, sqrt_n+1): if (n % i == 0): # n isn't prime return SumOfFactors( PrimeFactorsOfNumber(i), ...
PrimeFactorsOfNumber
identifier_name
evenlyDivisible.py
#!/bin/python import math def SumOfFactors(f_1, f_2): for key in f_2.keys(): if (key in f_1): f_1[key] += f_2[key] else: f_1[key] = f_2[key] return f_1; def PrimeFactorsOfNumber(n): sqrt_n = int(math.sqrt(n)) if (n == sqrt_n * sqrt_n): # Perfect square return SumOfFactors( P...
# n is prime factors = {} factors[n] = 1 return factors def EvenlyDivisible(largest): prime_factors = {}; for i in range (largest, 2, -1): prime_factors_i = PrimeFactorsOfNumber(i) print i, prime_factors_i for prime_factor in prime_factors_i.keys(): value = prime_factors_i[prime_factor]...
if (n % i == 0): # n isn't prime return SumOfFactors( PrimeFactorsOfNumber(i), PrimeFactorsOfNumber(n/i))
conditional_block
evenlyDivisible.py
#!/bin/python import math def SumOfFactors(f_1, f_2): for key in f_2.keys(): if (key in f_1): f_1[key] += f_2[key] else: f_1[key] = f_2[key] return f_1; def PrimeFactorsOfNumber(n): sqrt_n = int(math.sqrt(n)) if (n == sqrt_n * sqrt_n): # Perfect square return SumOfFactors( P...
if __name__ == '__main__': main()
print EvenlyDivisible(20);
identifier_body
network_cls.py
import tensorflow as tf from ocnn import * # octree-based resnet55 def network_resnet(octree, flags, training=True, reuse=None): depth = flags.depth channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8] with tf.variable_scope("ocnn_resnet", reuse=reuse): data = octree_property(octree, property_name="feature...
else: print('Error, no network: ' + flags.name)
return network_resnet(octree, flags, training, reuse)
random_line_split
network_cls.py
import tensorflow as tf from ocnn import * # octree-based resnet55 def network_resnet(octree, flags, training=True, reuse=None): depth = flags.depth channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8] with tf.variable_scope("ocnn_resnet", reuse=reuse): data = octree_property(octree, property_name="feature...
with tf.variable_scope("fc2"): logit = dense(data, flags.nout, use_bias=True) return logit def cls_network(octree, flags, training, reuse=False): if flags.name.lower() == 'ocnn': return network_ocnn(octree, flags, training, reuse) elif flags.name.lower() == 'resnet': return network_resnet(oc...
depth = flags.depth channels = [512, 256, 128, 64, 32, 16, 8, 4, 2] with tf.variable_scope("ocnn", reuse=reuse): data = octree_property(octree, property_name="feature", dtype=tf.float32, depth=depth, channel=flags.channel) data = tf.reshape(data, [1, flags.channel, -1, 1]) f...
identifier_body
network_cls.py
import tensorflow as tf from ocnn import * # octree-based resnet55 def
(octree, flags, training=True, reuse=None): depth = flags.depth channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8] with tf.variable_scope("ocnn_resnet", reuse=reuse): data = octree_property(octree, property_name="feature", dtype=tf.float32, depth=depth, channel=flags.channel) ...
network_resnet
identifier_name
network_cls.py
import tensorflow as tf from ocnn import * # octree-based resnet55 def network_resnet(octree, flags, training=True, reuse=None): depth = flags.depth channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8] with tf.variable_scope("ocnn_resnet", reuse=reuse): data = octree_property(octree, property_name="feature...
with tf.variable_scope("full_voxel"): data = octree_full_voxel(data, depth=2) data = tf.layers.dropout(data, rate=0.5, training=training) with tf.variable_scope("fc1"): data = fc_bn_relu(data, channels[2], training=training) data = tf.layers.dropout(data, rate=0.5, training=training) ...
with tf.variable_scope('depth_%d' % d): data = octree_conv_bn_relu(data, octree, d, channels[d], training) data, _ = octree_max_pool(data, octree, d)
conditional_block
_app-routing.module.ts
import { NgModule } from '@angular/core'; <% if (props.lazy) { -%> import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Shell } from '@app/shell/shell.service'; <% } else { -%> import { Routes, RouterModule } from '@angular/router'; <% } -%> const routes: Routes = [ <% if (props.lazy) { ...
{ }
AppRoutingModule
identifier_name
_app-routing.module.ts
import { NgModule } from '@angular/core'; <% if (props.lazy) { -%> import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Shell } from '@app/shell/shell.service'; <% } else { -%> import { Routes, RouterModule } from '@angular/router'; <% } -%> const routes: Routes = [ <% if (props.lazy) { ...
exports: [RouterModule], providers: [] }) export class AppRoutingModule { }
imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })], <% } else { -%> imports: [RouterModule.forRoot(routes)], <% } -%>
random_line_split
_app-routing.module.ts
import { NgModule } from '@angular/core'; <% if (props.lazy)
from '@angular/router'; import { Shell } from '@app/shell/shell.service'; <% } else { -%> import { Routes, RouterModule } from '@angular/router'; <% } -%> const routes: Routes = [ <% if (props.lazy) { -%> Shell.childRoutes([ { path: 'about', loadChildren: () => import('./about/about.module').then(m => m.AboutMo...
{ -%> import { Routes, RouterModule, PreloadAllModules }
conditional_block
Member3R.ts
/// <reference path="../Quiz.ts"/> module SevenThree.Model { //パラメーター import IMember = SevenThree.Model.IMember; export class Member implements IMember{ id: number; name: string; right: number; wrong: number; state: State; isSelected: boolean; constructor(name: string, id: number){ ...
eMember(s: string): void { var ss = s.split(","); this.id = parseInt(ss[0]); this.name = ss[1]; this.right = parseInt(ss[2]); this.wrong = parseInt(ss[3]); this.state = parseInt(ss[4]); } } }
rn this.id + "," + this.name + "," + this.right + "," + this.wrong + "," + this.state; } rewrit
identifier_body
Member3R.ts
/// <reference path="../Quiz.ts"/> module SevenThree.Model { //パラメーター import IMember = SevenThree.Model.IMember; export class Member implements IMember{ id: number; name: string; right: number; wrong: number; state: State; isSelected: boolean; constructor(name: string, id: number){ ...
to_s(): string { return this.id + "," + this.name + "," + this.right + "," + this.wrong + "," + this.state; } rewriteMember(s: string): void { var ss = s.split(","); this.id = parseInt(ss[0]); this.name = ss[1]; this.right = parseInt(ss[2]); this.wrong = parseInt(ss[3])...
random_line_split
Member3R.ts
/// <reference path="../Quiz.ts"/> module SevenThree.Model { //パラメーター import IMember = SevenThree.Model.IMember; export class Member implements IMember{ id: number; name: string; right: number; wrong: number; state: State; isSelected: boolean; constructor(name: string, id: number){ ...
void { var ss = s.split(","); this.id = parseInt(ss[0]); this.name = ss[1]; this.right = parseInt(ss[2]); this.wrong = parseInt(ss[3]); this.state = parseInt(ss[4]); } } }
r(s: string):
identifier_name
photoMasking.py
#!/usr/bin/python ## Download files from Amazon S3 (e.g. raw photos for 3D models) ## Andy Bevan 15-Jun-2014, updated 21-Nov-2014 ## Daniel Pett updated 05-Jan-2016 __author__ = 'ahb108' ## Currently for Python 2.7.5 (tested on MacOSX 10.9.2) launched in a virtual environment: from PIL import Image # Pillow with libj...
parser.add_argument('-w','--wd', help='Working directory',required=True) args = parser.parse_args() ## Global settings ## os.chdir(args.wd) app = args.app pybinst = 'http://crowdsourced.micropasts.org' ################################### # Get the raw jpg files from working directory ext = ['.JPG', '.jpg', '.jpeg', ...
parser.add_argument('-a','--app',help='MicroPasts application', required=True)
random_line_split
photoMasking.py
#!/usr/bin/python ## Download files from Amazon S3 (e.g. raw photos for 3D models) ## Andy Bevan 15-Jun-2014, updated 21-Nov-2014 ## Daniel Pett updated 05-Jan-2016 __author__ = 'ahb108' ## Currently for Python 2.7.5 (tested on MacOSX 10.9.2) launched in a virtual environment: from PIL import Image # Pillow with libj...
else: fn = imnameonly + '_mask_' + str(a) + '_user' + str(jtaskrun['user_id']) + '.JPG' imtmp.save(fn) if a is 1: fn1 = imnameonly + '_mask.JPG' imtmp.save(fn1) print("Done.")
fn = imnameonly + '_mask_' + str(a) + '_anon.JPG'
conditional_block
alarmCtrl.js
var alarmCtrl = function ($scope) { $scope.currentListName = getCurrentListFromLocalStorage(); $scope.currentTodo = getCurrentTodoFromLocalStorage(); $scope.isAlarmSet = $scope.currentTodo.isAlarmSet; $scope.alarmTime = null; function getAlarmDate(time)
var addAlarm = function (date) { var data = { "text": $scope.currentTodo.text, "currentListName": $scope.currentListName }; window.navigator.mozAlarms.add(date, "ignoreTimezone", data); }; var setAlarm = function (time) { var date = getAlarmDate(ti...
{ alert(time); var hours = Number(time.substr(0, 2)); var minutes = Number(time.substr(3, 2)); var alarmDate = new Date(); alert(alarmDate.getHours()); var isAlarmNextDay = alarmDate.getHours() < hours || alarmDate.getHours() == hours && alarmDate.getMinutes() <= minute...
identifier_body
alarmCtrl.js
var alarmCtrl = function ($scope) { $scope.currentListName = getCurrentListFromLocalStorage();
function getAlarmDate(time) { alert(time); var hours = Number(time.substr(0, 2)); var minutes = Number(time.substr(3, 2)); var alarmDate = new Date(); alert(alarmDate.getHours()); var isAlarmNextDay = alarmDate.getHours() < hours || alarmDate.getHours() == hours && ...
$scope.currentTodo = getCurrentTodoFromLocalStorage(); $scope.isAlarmSet = $scope.currentTodo.isAlarmSet; $scope.alarmTime = null;
random_line_split
alarmCtrl.js
var alarmCtrl = function ($scope) { $scope.currentListName = getCurrentListFromLocalStorage(); $scope.currentTodo = getCurrentTodoFromLocalStorage(); $scope.isAlarmSet = $scope.currentTodo.isAlarmSet; $scope.alarmTime = null; function getAlarmDate(time) { alert(time); var hours = ...
alert(hours); alarmDate.setHours(hours); alarmDate.setMinutes(minutes); return alarmDate; } var addAlarm = function (date) { var data = { "text": $scope.currentTodo.text, "currentListName": $scope.currentListName }; window.naviga...
{ alarmDate.setDate(alarmDate.getDate() + 1); }
conditional_block
alarmCtrl.js
var alarmCtrl = function ($scope) { $scope.currentListName = getCurrentListFromLocalStorage(); $scope.currentTodo = getCurrentTodoFromLocalStorage(); $scope.isAlarmSet = $scope.currentTodo.isAlarmSet; $scope.alarmTime = null; function getAlarmDate(time) { alert(time); var hours = ...
() { this.result.forEach(function (alarm) { var isAlarmEqualToCurrentAlarm = (alarm.data.text == $scope.currentTodo.text && alarm.date.currentListName == $scope.currentListName); if (isAlarmEqualToCurrentAlarm) { window.navigator.mozAlarms.remove(alarm.id); } ...
removeAlarm
identifier_name
process_monitor.py
import warnings from . import pedrpc from .base_monitor import BaseMonitor # Important: BaseMonitor needs to come *before* pedrpc.Client in the # Inheritance list for the method resolution order to produce # correct results. class ProcessMonitor(BaseMonitor, pedrpc.Client): """ Proxy class for the process ...
def set_proc_name(self, new_proc_name): """.. deprecated :: 0.2.0 This option should be set via ``set_options``. """ warnings.warn( "This method is deprecated and will be removed in a future Version of boofuzz." " Please use set_options(log_path=...) instea...
"""Restores all set options to the RPC daemon if it has restarted since the last call.""" for key, val in self.server_options.items(): self.__hot_transmit(("set_{}".format(key), ((val,), {})))
identifier_body
process_monitor.py
import warnings from . import pedrpc from .base_monitor import BaseMonitor # Important: BaseMonitor needs to come *before* pedrpc.Client in the # Inheritance list for the method resolution order to produce # correct results. class ProcessMonitor(BaseMonitor, pedrpc.Client): """ Proxy class for the process ...
def set_proc_name(self, new_proc_name): """.. deprecated :: 0.2.0 This option should be set via ``set_options``. """ warnings.warn( "This method is deprecated and will be removed in a future Version of boofuzz." " Please use set_options(log_path=...) instea...
self.__hot_transmit(("set_{}".format(key), ((val,), {})))
conditional_block
process_monitor.py
import warnings from . import pedrpc from .base_monitor import BaseMonitor # Important: BaseMonitor needs to come *before* pedrpc.Client in the # Inheritance list for the method resolution order to produce # correct results. class ProcessMonitor(BaseMonitor, pedrpc.Client): """ Proxy class for the process ...
return self.set_options(stop_commands=new_stop_commands) def set_crash_filename(self, new_crash_filename): """.. deprecated :: 0.2.0 This option should be set via ``set_options``. """ warnings.warn( "This method is deprecated and will be removed in a future Ver...
warnings.warn( "This method is deprecated and will be removed in a future Version of boofuzz." " Please use set_options(log_path=...) instead.", FutureWarning, )
random_line_split
process_monitor.py
import warnings from . import pedrpc from .base_monitor import BaseMonitor # Important: BaseMonitor needs to come *before* pedrpc.Client in the # Inheritance list for the method resolution order to produce # correct results. class ProcessMonitor(BaseMonitor, pedrpc.Client): """ Proxy class for the process ...
(self, *args, **kwargs): """ The old RPC interfaces specified set_foobar methods to set options. As these vary by RPC implementation, this trampoline method translates arguments that have been passed as keyword arguments to set_foobar calls. If you call ``set_options(foobar="bar...
set_options
identifier_name
changeForwarding.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
let req = { Filename: uri.fsPath }; serverUtils.filesChanged(server, [req]).catch(err => { console.warn(`[o] failed to forward file change event for ${uri.fsPath}`, err); return err; }); } const watcher = workspace.createFileSystemWatcher('**/*.*'); let d1 = watcher.onDidCreate(...
{ return; }
conditional_block
changeForwarding.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
} export default function forwardChanges(server: OmnisharpServer): Disposable { // combine file watching and text document watching return Disposable.from( forwardDocumentChanges(server), forwardFileChanges(server)); }
let d3 = watcher.onDidDelete(onFileSystemEvent); return Disposable.from(watcher, d1, d2, d3);
random_line_split
changeForwarding.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
return Disposable.from(watcher, d1, d2, d3); } export default function forwardChanges(server: OmnisharpServer): Disposable { // combine file watching and text document watching return Disposable.from( forwardDocumentChanges(server), forwardFileChanges(server)); }
{ function onFileSystemEvent(uri: Uri): void { if (!server.isRunning()) { return; } let req = { Filename: uri.fsPath }; serverUtils.filesChanged(server, [req]).catch(err => { console.warn(`[o] failed to forward file change event for ${uri.fsPath}`, err); return err; }); } ...
identifier_body
changeForwarding.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(uri: Uri): void { if (!server.isRunning()) { return; } let req = { Filename: uri.fsPath }; serverUtils.filesChanged(server, [req]).catch(err => { console.warn(`[o] failed to forward file change event for ${uri.fsPath}`, err); return err; }); } const watcher = workspace.cre...
onFileSystemEvent
identifier_name
__main__.py
# Copyright 2017 The Chromium Authors. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd. """Command line interface to Chromium Code Search. Currently emits JSON formatted responses from the Chromium Cod...
print(json.dumps(results, cls=CodeSearchProtoJsonEncoder)) def get_signature(cs, args): if args.signature: return args.signature if not (args.path and args.word): print('Both PATH and WORD must be specified') sys.exit(2) return cs.GetSignatureForSymbol(args.path, args.word) def setup_logging...
cls=CodeSearchProtoJsonSymbolizedEncoder)) else:
random_line_split
__main__.py
# Copyright 2017 The Chromium Authors. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd. """Command line interface to Chromium Code Search. Currently emits JSON formatted responses from the Chromium Cod...
def get_edge_filter(args): if args.all: return [ getattr(EdgeEnumKind, x) for x in vars(EdgeEnumKind) if isinstance(getattr(EdgeEnumKind, x), int) ] if args.type: return args.type return [] parser = argparse.ArgumentParser(description=__doc__) subcommands = parser.add_subparsers(...
if args.loglevel: if args.loglevel == 'info': level = logging.INFO else: level = logging.DEBUG cs.GetLogger().setLevel(level) logging.basicConfig()
identifier_body
__main__.py
# Copyright 2017 The Chromium Authors. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd. """Command line interface to Chromium Code Search. Currently emits JSON formatted responses from the Chromium Cod...
return [] parser = argparse.ArgumentParser(description=__doc__) subcommands = parser.add_subparsers(help='Subcommands') path_specifiers = argparse.ArgumentParser(add_help=False) path_specifiers.add_argument('path', help='Path to file.', metavar='PATH') signature_specifiers = argparse.ArgumentParser( descrip...
return args.type
conditional_block
__main__.py
# Copyright 2017 The Chromium Authors. # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd. """Command line interface to Chromium Code Search. Currently emits JSON formatted responses from the Chromium Cod...
(cs, args): if args.signature: return args.signature if not (args.path and args.word): print('Both PATH and WORD must be specified') sys.exit(2) return cs.GetSignatureForSymbol(args.path, args.word) def setup_logging(cs, args): if args.loglevel: if args.loglevel == 'info': level = logg...
get_signature
identifier_name
examples.spec.ts
import {getSpec, In, OperationPath, Path, Property, SpecTypes} from "@tsed/schema"; import {expect} from "chai"; import {Examples} from "./examples"; class
{ @Property() id: string; } describe("@Examples", () => { it("should declare example on body params", () => { // WHEN @Path("/") class MyController { @OperationPath("POST", "/:id") getMethod( @In("body") @Examples({ Example1: { description: "Example ...
MyModel
identifier_name
examples.spec.ts
import {getSpec, In, OperationPath, Path, Property, SpecTypes} from "@tsed/schema"; import {expect} from "chai"; import {Examples} from "./examples"; class MyModel { @Property() id: string; } describe("@Examples", () => { it("should declare example on body params", () => { // WHEN @Path("/") class M...
}, examples: { Example1: { description: "Example with hello1", value: { test: "hello1" } }, Example2: { description: "Example with hello2", ...
schema: { $ref: "#/components/schemas/MyModel" } }
random_line_split
lib.rs
["sample-playlists", name].iter().collect(); getm3u(path.to_str().unwrap()) } // ----------------------------------------------------------------------------------------------- // Playlist fn print_parse_playlist_test(playlist_name: &str) -> bool { let input: String = get_sample_playlist(playlist_name); ...
} #[test] fn playlist_master_with_alternatives() { assert!(print_parse_playlist_test("master-with-alternatives.m3u8")); } #[test] fn playlist_master_with_alternatives_2_3() { assert!(print_parse_playlist_test("master-with-alternatives-2.m3u8")); } #[test] fn playlist_master_with_i_frame_stream_inf() { a...
{ println!("Parsing failed:\n {:?}", parsed); false }
conditional_block
lib.rs
(path: &str) -> String { let mut buf = String::new(); let mut file = fs::File::open(path).unwrap_or_else(|_| panic!("Can't find m3u8: {}", path)); let u = file.read_to_string(&mut buf).expect("Can't read file"); buf } fn get_sample_playlist(name: &str) -> String { let path: std::path::PathBuf = ["s...
getm3u
identifier_name
lib.rs
["sample-playlists", name].iter().collect(); getm3u(path.to_str().unwrap()) } // ----------------------------------------------------------------------------------------------- // Playlist fn print_parse_playlist_test(playlist_name: &str) -> bool { let input: String = get_sample_playlist(playlist_name); ...
#[test] fn playlist_media_with_cues() { assert!(print_parse_playlist_test("media-playlist-with-cues.m3u8")); } #[test] fn playlist_media_with_cues1() { assert!(print_parse_playlist_test("media-playlist-with-cues-1.m3u8")); } #[test] fn playlist_media_with_scte35() { assert!(print_parse_playlist_test("me...
{ assert!(print_parse_playlist_test( "media-playlist-without-segments.m3u8" )); }
identifier_body
lib.rs
["sample-playlists", name].iter().collect(); getm3u(path.to_str().unwrap()) } // ----------------------------------------------------------------------------------------------- // Playlist fn print_parse_playlist_test(playlist_name: &str) -> bool { let input: String = get_sample_playlist(playlist_name); ...
keyformatversions: Some("xXFormatVers".into()), })], start: Some(Start { time_offset: "123123123".into(), precise: Some("YES".into()), }), independent_segments: true, unknown_tags: vec![], }); let playlist_parsed = print_create_and_pars...
session_key: vec![SessionKey(Key { method: "AES-128".into(), uri: Some("https://secure.domain.com".into()), iv: Some("0xb059217aa2649ce170b734".into()), keyformat: Some("xXkeyformatXx".into()),
random_line_split
csskeyframesrule.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::Parser; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::...
} // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-findrule fn FindRule(&self, selector: DOMString) -> Option<Root<CSSKeyframeRule>> { self.find_rule(&selector).and_then(|idx| { self.rulelist().item(idx as u32) }).and_then(Root::downcast) } // https://d...
{ let _ = self.rulelist().remove_rule(idx as u32); }
conditional_block
csskeyframesrule.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::Parser; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::...
(&self, selector: &str) -> Option<usize> { let mut input = Parser::new(selector); if let Ok(sel) = KeyframeSelector::parse(&mut input) { // This finds the *last* element matching a selector // because that's the rule that applies. Thus, rposition self.keyframesrule.re...
find_rule
identifier_name
csskeyframesrule.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::Parser; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::...
#[ignore_heap_size_of = "Arc"] keyframesrule: Arc<RwLock<KeyframesRule>>, rulelist: MutNullableJS<CSSRuleList>, } impl CSSKeyframesRule { fn new_inherited(parent_stylesheet: &CSSStyleSheet, keyframesrule: Arc<RwLock<KeyframesRule>>) -> CSSKeyframesRule { CSSKeyframesRule { ...
random_line_split
csskeyframesrule.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::Parser; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::...
#[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet, keyframesrule: Arc<RwLock<KeyframesRule>>) -> Root<CSSKeyframesRule> { reflect_dom_object(box CSSKeyframesRule::new_inherited(parent_stylesheet, keyframesrule), window,...
{ CSSKeyframesRule { cssrule: CSSRule::new_inherited(parent_stylesheet), keyframesrule: keyframesrule, rulelist: MutNullableJS::new(None), } }
identifier_body
recorder.rs
// The MIT License (MIT) // // Copyright (c) 2013 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitati...
pub fn start(&mut self) { let (stop_sender, stop_receiver) = channel(); let (data_sender, data_receiver) = channel(); let r_c = self.ctxt.clone(); self.stop_sender = Some(stop_sender); self.data_receiver = Some(data_receiver); task::spawn(proc() { let ...
{ Recorder { ctxt: record_context, stop_sender: None, data_receiver: None, samples: Vec::new() } }
identifier_body
recorder.rs
// The MIT License (MIT) // // Copyright (c) 2013 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitati...
f.write_i16(self.samples.as_mut_slice(), len); f.close(); true }, Err(e) => { println!("{}", e); false } } } } }
let mut file_ext = String::from_str(filename); file_ext.push_str(".wav"); match SndFile::new_with_info(file_ext.as_slice(), Write, infos) { Ok(mut f) => { let len = self.samples.len() as i64;
random_line_split
recorder.rs
// The MIT License (MIT) // // Copyright (c) 2013 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitati...
{ ctxt: RecordContext, stop_sender: Option<Sender<bool>>, data_receiver: Option<Receiver<Vec<i16>>>, samples: Vec<i16> } impl Recorder { /// Create a new audio recorder pub fn new(record_context: RecordContext) -> Recorder { Recorder { ctxt: record_context, stop...
Recorder
identifier_name
test.py
#Ensure there is an exceptional edge from the following case def f2(): b, d = Base, Derived try: class MyNewClass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: a, b, c = sequence_of_four except: e3 #Always treat locals as no...
except: ee else: ef
random_line_split
test.py
#Ensure there is an exceptional edge from the following case def f2(): b, d = Base, Derived try: class MyNewClass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: a, b, c = sequence_of_four except: e3 #Always treat locals as no...
def fb(): a, b, c = a_global try: seq = a, b, c except: eb #Ensure that a.b and c[d] can raise def fc(): a, b = a_global try: return a[b] except: ec def fd(): a = a_global try: return a.b except: ed def fe(): try: ...
seq = a_global try: a = seq except: ea
identifier_body
test.py
#Ensure there is an exceptional edge from the following case def f2(): b, d = Base, Derived try: class MyNewClass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: a, b, c = sequence_of_four except: e3 #Always treat locals as no...
(): if cond: local = 1 try: local except: e4 def f5(): try: a_global except: e5 def f6(): local = a_global try: local() except: e6 #Literals can't raise def f7(): try: 4 except: e7 def f8(): try: ...
f4
identifier_name
test.py
#Ensure there is an exceptional edge from the following case def f2(): b, d = Base, Derived try: class MyNewClass(b, d): pass except: e2 def f3(): sequence_of_four = a_global try: a, b, c = sequence_of_four except: e3 #Always treat locals as no...
ef
conditional_block
setup.py
import setuptools import io import sys import os.path import subprocess setuptools.setup( name='jsonpath-rw', version='1.4.0', description='A robust and significantly extended implementation of JSONPath for Python, with a clear AST for metaprogramming.', author='Kenneth Knowles', author_email='ken...
'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', ], )
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3',
random_line_split
account.service.ts
import {chain, intersection, zipObject} from 'lodash'; import {module} from 'angular'; import {Application} from 'core/application/application.model'; import {API_SERVICE, Api} from 'core/api/api.service'; import {CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry} from '../cloudProvider/cloudProvider.registry'; import {S...
result = result.then((accounts: IAccount[]) => accounts.filter((account: IAccount) => account.type === provider)); } return result; } public listProviders(application: Application = null): ng.IPromise<string[]> { return this.listAccounts() .then((accounts: IAccount[]) => { const al...
let result: ng.IPromise<IAccount[]> = this.API.one('credentials').useCache().get(); if (provider) {
random_line_split
account.service.ts
import {chain, intersection, zipObject} from 'lodash'; import {module} from 'angular'; import {Application} from 'core/application/application.model'; import {API_SERVICE, Api} from 'core/api/api.service'; import {CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry} from '../cloudProvider/cloudProvider.registry'; import {S...
(provider: string, account: string, region: string): ng.IPromise<string[]> { return this.getPreferredZonesByAccount(provider) .then((result: IAccountZone) => result[account] ? result[account][region] : []); } public getCredentialsKeyedByAccount(provider: string = null): ng.IPromise<IAggregatedAccounts> {...
getAvailabilityZonesForAccountAndRegion
identifier_name
account.service.ts
import {chain, intersection, zipObject} from 'lodash'; import {module} from 'angular'; import {Application} from 'core/application/application.model'; import {API_SERVICE, Api} from 'core/api/api.service'; import {CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry} from '../cloudProvider/cloudProvider.registry'; import {S...
result = intersection(available, result); } else { result = available; } return result.sort(); }); } } export const ACCOUNT_SERVICE = 'spinnaker.core.account.service'; module(ACCOUNT_SERVICE, [ CLOUD_PROVIDER_REGISTRY, API_SERVICE ]) .service('accountService...
{ if (SETTINGS.defaultProviders) { result = SETTINGS.defaultProviders; } else { result = available; } }
conditional_block
account.service.ts
import {chain, intersection, zipObject} from 'lodash'; import {module} from 'angular'; import {Application} from 'core/application/application.model'; import {API_SERVICE, Api} from 'core/api/api.service'; import {CLOUD_PROVIDER_REGISTRY, CloudProviderRegistry} from '../cloudProvider/cloudProvider.registry'; import {S...
public getRegionsForAccount(account: string): ng.IPromise<IRegion[]> { return this.getAccountDetails(account) .then((details: IAccountDetails) => details ? details.regions : []); } public getUniqueAttributeForAllAccounts(provider: string, attribute: string): ng.IPromise<string[]> { return this.ge...
{ const preferred: IAccountZone = {}; return this.getAllAccountDetailsForProvider(provider) .then((accounts: IAccountDetails[]) => { accounts.forEach((account: IAccountDetails) => { preferred[account.name] = {}; account.regions.forEach((region: IRegion) => { let zon...
identifier_body
app.js
var express = require('express'), compression = require('compression'), path = require('path'), favicon = require('serve-favicon'), logger = require('morgan'), cookieParser = require('cookie-parser'), bodyParser = require('body-parser'), session = require('express-session'), session = re...
else{ err.status = 500; err.message = "Internal Server Error." res.status(500); } res.render('404', {error: err}); }); module.exports = app;
{ res.status(err.status); }
conditional_block
app.js
var express = require('express'), compression = require('compression'), path = require('path'), favicon = require('serve-favicon'), logger = require('morgan'), cookieParser = require('cookie-parser'), bodyParser = require('body-parser'), session = require('express-session'), session = re...
err.status = 404; next(err); }); // error handlers // development error handler // will print stacktrace // if (app.get('env') === 'development') { // app.use(function(err, req, res, next) { // res.status(err.status || 500); // res.render('error', { // message: err.message, // error: err // ...
var err = new Error('Page Not Found.');
random_line_split