file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
Main.js
/*global Ext*/ //<debug> console.log(new Date().toLocaleTimeString() + ": Log: Load: WPAKT.view.core.skeleton.Main"); //</debug> Ext.define("WPAKT.view.core.skeleton.Main", { extend: "Ext.container.Container" , alias: "widget.coreskeletonmain" , scrollable: "y" , layout: { type: "hbox" ...
items: [ {xtype: "coreskeletontreemain"} , {xtype: "coreskeletoncardmain"} ], beforeLayout : function() { // We setup some minHeights dynamically to ensure we stretch to fill the height // of the viewport minus the top toolbar var me = this, height = Ex...
// id: "main-view-detail-wrap", // reference: "mainContainerWrap", flex: 1,
random_line_split
256-header_op-add2.py
from base import * DIR = "headerop_add2" HEADERS = [("X-What-Rocks", "Cherokee does"), ("X-What-Sucks", "Failed QA tests"), ("X-What-Is-It", "A successful test")] CONF = """ vserver!1!rule!2560!match = directory vserver!1!rule!2560!match!directory = /%(DIR)s vserver!1!rule!2560!handler = dirlis...
(self, www): self.Mkdir (www, DIR)
Prepare
identifier_name
256-header_op-add2.py
from base import * DIR = "headerop_add2" HEADERS = [("X-What-Rocks", "Cherokee does"), ("X-What-Sucks", "Failed QA tests"), ("X-What-Is-It", "A successful test")] CONF = """ vserver!1!rule!2560!match = directory vserver!1!rule!2560!match!directory = /%(DIR)s vserver!1!rule!2560!handler = dirlis...
n = 2 for h,v in HEADERS: self.conf += "vserver!1!rule!2560!header_op!%d!type = add\n" %(n) self.conf += "vserver!1!rule!2560!header_op!%d!header = %s\n" %(n, h) self.conf += "vserver!1!rule!2560!header_op!%d!value = %s\n" %(n, v) n += 1 def Custom...
self.name = "Header Ops: Add multiple headers" self.request = "GET /%s/ HTTP/1.0\r\n" %(DIR) self.expected_error = 200 self.conf = CONF%(globals())
random_line_split
256-header_op-add2.py
from base import * DIR = "headerop_add2" HEADERS = [("X-What-Rocks", "Cherokee does"), ("X-What-Sucks", "Failed QA tests"), ("X-What-Is-It", "A successful test")] CONF = """ vserver!1!rule!2560!match = directory vserver!1!rule!2560!match!directory = /%(DIR)s vserver!1!rule!2560!handler = dirlis...
def CustomTest (self): header = self.reply[:self.reply.find("\r\n\r\n")+2] for h,v in HEADERS: if not "%s: %s\r\n" %(h,v) in header: return -1 return 0 def Prepare (self, www): self.Mkdir (www, DIR)
TestBase.__init__ (self, __file__) self.name = "Header Ops: Add multiple headers" self.request = "GET /%s/ HTTP/1.0\r\n" %(DIR) self.expected_error = 200 self.conf = CONF%(globals()) n = 2 for h,v in HEADERS: self.conf += "vserver!1...
identifier_body
256-header_op-add2.py
from base import * DIR = "headerop_add2" HEADERS = [("X-What-Rocks", "Cherokee does"), ("X-What-Sucks", "Failed QA tests"), ("X-What-Is-It", "A successful test")] CONF = """ vserver!1!rule!2560!match = directory vserver!1!rule!2560!match!directory = /%(DIR)s vserver!1!rule!2560!handler = dirlis...
return 0 def Prepare (self, www): self.Mkdir (www, DIR)
return -1
conditional_block
proteins.rs
extern crate protein_translation as proteins; #[test] fn test_methionine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("ATG"), Ok("methionine")); } #[test] fn test_cysteine_tgt() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("TGT"), Ok("cysteine")); } #...
() -> Vec<(&'static str, &'static str)> { let grouped = vec![ ("isoleucine", vec!["ATT", "ATC", "ATA"]), ("leucine", vec!["CTT", "CTC", "CTA", "CTG", "TTA", "TTG"]), ("valine", vec!["GTT", "GTC", "GTA", "GTG"]), ("phenylalanine", vec!["TTT", "TTC"]), ("methionine", vec!["ATG"...
make_pairs
identifier_name
proteins.rs
extern crate protein_translation as proteins; #[test] fn test_methionine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("ATG"), Ok("methionine")); } #[test] fn test_cysteine_tgt() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("TGT"), Ok("cysteine")); } #...
assert!(info.name_for("").is_err()); } #[test] fn x_is_not_shorthand_so_is_invalid() { let info = proteins::parse(make_pairs()); assert!(info.name_for("VWX").is_err()); } #[test] fn too_short_is_invalid() { let info = proteins::parse(make_pairs()); assert!(info.name_for("AT").is_err()); } #[test]...
random_line_split
proteins.rs
extern crate protein_translation as proteins; #[test] fn test_methionine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("ATG"), Ok("methionine")); } #[test] fn test_cysteine_tgt() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("TGT"), Ok("cysteine")); } #...
#[test] fn test_stop() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("TAA"), Ok("stop codon")); } #[test] fn test_valine() { let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("GTN"), Ok("valine")); } #[test] fn test_isoleucine() { let info = proteins::par...
{ // "compressed" name for TGT and TGC let info = proteins::parse(make_pairs()); assert_eq!(info.name_for("TGT"), info.name_for("TGY")); assert_eq!(info.name_for("TGC"), info.name_for("TGY")); }
identifier_body
popup.js
/* * Copyright (C) 2016 Alex Yatskov <alex@foosoft.net> * Author: Alex Yatskov <alex@foosoft.net> * * 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 * ...
} setContent(content) { if (this.popup === null) { return; } this.popup.contentWindow.scrollTo(0, 0); const doc = this.popup; doc.srcdoc=content; } sendMessage(action, params, callback) { if (this.popup !== null) { this...
{ this.popup.style.visibility = 'hidden'; }
conditional_block
popup.js
/* * Copyright (C) 2016 Alex Yatskov <alex@foosoft.net> * Author: Alex Yatskov <alex@foosoft.net> * * 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 * ...
return; } this.popup = document.createElement('iframe'); this.popup.id = 'yomichan-popup'; this.popup.addEventListener('mousedown', (e) => e.stopPropagation()); this.popup.addEventListener('scroll', (e) => e.stopPropagation()); let simpread = document.queryS...
inject() { if (this.popup !== null) {
random_line_split
popup.js
/* * Copyright (C) 2016 Alex Yatskov <alex@foosoft.net> * Author: Alex Yatskov <alex@foosoft.net> * * 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 * ...
(elementRect, content) { this.inject(); const popupRect = this.popup.getBoundingClientRect(); let posX = elementRect.left; if (posX + popupRect.width >= window.innerWidth) { posX = window.innerWidth - popupRect.width; } let posY = elementRect.bottom + this....
showNextTo
identifier_name
iced_error.rs
// SPDX-License-Identifier: MIT // Copyright wtfsckgh@gmail.com // Copyright iced contributors use alloc::borrow::Cow; use alloc::string::String; use core::fmt; #[cfg(feature = "std")] use std::error::Error; /// iced error #[derive(Debug, Clone)] pub struct IcedError { error: Cow<'static, str>, } impl IcedError { ...
#[allow(clippy::missing_inline_in_public_items)] fn description(&self) -> &str { &self.error } } impl fmt::Display for IcedError { #[allow(clippy::missing_inline_in_public_items)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", &self.error) } }
#[cfg(feature = "std")] impl Error for IcedError { // Required since MSRV < 1.42.0
random_line_split
iced_error.rs
// SPDX-License-Identifier: MIT // Copyright wtfsckgh@gmail.com // Copyright iced contributors use alloc::borrow::Cow; use alloc::string::String; use core::fmt; #[cfg(feature = "std")] use std::error::Error; /// iced error #[derive(Debug, Clone)] pub struct IcedError { error: Cow<'static, str>, } impl IcedError { ...
(&self) -> &str { &self.error } } impl fmt::Display for IcedError { #[allow(clippy::missing_inline_in_public_items)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", &self.error) } }
description
identifier_name
iced_error.rs
// SPDX-License-Identifier: MIT // Copyright wtfsckgh@gmail.com // Copyright iced contributors use alloc::borrow::Cow; use alloc::string::String; use core::fmt; #[cfg(feature = "std")] use std::error::Error; /// iced error #[derive(Debug, Clone)] pub struct IcedError { error: Cow<'static, str>, } impl IcedError { ...
}
{ write!(f, "{}", &self.error) }
identifier_body
fis-conf.js
/************************* Project Setting *****************************/ fis.set('project.md5Length', 7); fis.set('project.md5Connector ', '.'); fis.set('project.name', 'yhtml5'); fis.set('project.static', '/static'); fis.set('project.ignore', ['*.test.*', '*.psd', '.git/**', '/**/demo.*','/dist/**']); fis.set('projec...
release: '/vendor/design/$1' }); fis.match('/{map.json,fis-conf.*}', { release: '/config/$0' }); fis.match('/{view,components,bower_components,page}/**/(*.{png,gif,jpg,jpeg,svg})', { release: '${project.static}/img/$1' }); fis.match('/**/({glyphicons-halflings-regular.*,iconfont.{eot, svg, ttf, woff}})', {...
fis.match('/**/(*.design.*)', {
random_line_split
ko.rs
/************************************************************************ * * * Copyright 2014 Urban Hafner, Thomas Poinsot * * Copyright 2015 Urban Hafner, Igor Polyakov * * ...
let mut g = Game::new(19, 6.5, AnySizeTrompTaylor); g = g.play(Play(Black, 4, 4)).unwrap(); g = g.play(Play(White, 5, 4)).unwrap(); g = g.play(Play(Black, 3, 3)).unwrap(); g = g.play(Play(White, 4, 3)).unwrap(); g = g.play(Play(Black, 3, 5)).unwrap(); g = g.play(Play(White, 4, 5)).unwrap(); ...
g_directly_on_a_ko_point_should_be_illegal() {
identifier_name
ko.rs
/************************************************************************ * * * Copyright 2014 Urban Hafner, Thomas Poinsot * * Copyright 2015 Urban Hafner, Igor Polyakov * * ...
] fn positional_super_ko_should_be_illegal() { let parser = Parser::from_path(Path::new("fixtures/sgf/positional-superko.sgf")).unwrap(); let game = parser.game().unwrap(); let super_ko = game.play(Play(White, 2, 9)); match super_ko { Err(e) => assert_eq!(e, IllegalMove::SuperKo), Ok(_...
t mut g = Game::new(19, 6.5, AnySizeTrompTaylor); g = g.play(Play(Black, 4, 4)).unwrap(); g = g.play(Play(White, 5, 4)).unwrap(); g = g.play(Play(Black, 3, 3)).unwrap(); g = g.play(Play(White, 4, 3)).unwrap(); g = g.play(Play(Black, 3, 5)).unwrap(); g = g.play(Play(White, 4, 5)).unwrap(); g...
identifier_body
ko.rs
/************************************************************************ * * * Copyright 2014 Urban Hafner, Thomas Poinsot * * Copyright 2015 Urban Hafner, Igor Polyakov * * ...
g = g.play(Play(White, 5, 4)).unwrap(); g = g.play(Play(Black, 3, 3)).unwrap(); g = g.play(Play(White, 4, 3)).unwrap(); g = g.play(Play(Black, 3, 5)).unwrap(); g = g.play(Play(White, 4, 5)).unwrap(); g = g.play(Play(Black, 2, 4)).unwrap(); g = g.play(Play(White, 3, 4)).unwrap(); let ko ...
g = g.play(Play(Black, 4, 4)).unwrap();
random_line_split
integer_replacement.py
""" Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or n - 1. What is the minimum number of replacements needed for n to become 1? Example 1: Input: 8 Output: 3 Explanation: 8 -> 4 -> 2 -> 1 Example 2: Input: 7 Out...
(self, n): """ :type n: int :rtype: int """ count = 0 while n > 1: count += 1 if n % 2 == 0: n /= 2 elif (n+1) % 4 == 0 and (n-1) > 2: n += 1 else: n -= 1 return count
integerReplacement
identifier_name
integer_replacement.py
""" Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or n - 1.
Input: 8 Output: 3 Explanation: 8 -> 4 -> 2 -> 1 Example 2: Input: 7 Output: 4 Explanation: 7 -> 8 -> 4 -> 2 -> 1 or 7 -> 6 -> 3 -> 2 -> 1 """ class Solution(object): def integerReplacement(self, n): """ :type n: int :rtype: int """ count = 0 while n > 1: ...
What is the minimum number of replacements needed for n to become 1? Example 1:
random_line_split
integer_replacement.py
""" Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or n - 1. What is the minimum number of replacements needed for n to become 1? Example 1: Input: 8 Output: 3 Explanation: 8 -> 4 -> 2 -> 1 Example 2: Input: 7 Out...
return count
n -= 1
conditional_block
integer_replacement.py
""" Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or n - 1. What is the minimum number of replacements needed for n to become 1? Example 1: Input: 8 Output: 3 Explanation: 8 -> 4 -> 2 -> 1 Example 2: Input: 7 Out...
""" :type n: int :rtype: int """ count = 0 while n > 1: count += 1 if n % 2 == 0: n /= 2 elif (n+1) % 4 == 0 and (n-1) > 2: n += 1 else: n -= 1 return count
identifier_body
PlaceDetails.js
'use strict'; (function () { var autocompleteModule = angular.module('TVG.GoogleAPIAutocomplete'); autocompleteModule.factory('PlaceDetails', function () { function PlaceDetails(address, zipcode, state, city) { this.address = address; this.zipcode = zipcode; this....
} PlaceDetails.build = function (data, address) { var result = { address: address }; parseData(data, result); return new PlaceDetails(result.address, result.zipcode, result.state, result.city); }; return PlaceDetails; ...
{ _.forOwn(data, function (value) { if(_.has(desiredInfo, value.types[0])){ desiredInfo[value.types[0]](value); } }); }
conditional_block
PlaceDetails.js
'use strict'; (function () { var autocompleteModule = angular.module('TVG.GoogleAPIAutocomplete'); autocompleteModule.factory('PlaceDetails', function () { function
(address, zipcode, state, city) { this.address = address; this.zipcode = zipcode; this.state = state; this.city = city; } function parseData(data, result) { var desiredInfo = { locality: function (obj) { re...
PlaceDetails
identifier_name
PlaceDetails.js
'use strict'; (function () { var autocompleteModule = angular.module('TVG.GoogleAPIAutocomplete'); autocompleteModule.factory('PlaceDetails', function () { function PlaceDetails(address, zipcode, state, city)
function parseData(data, result) { var desiredInfo = { locality: function (obj) { result.city = obj.long_name; }, postal_code: function (obj) { result.zipcode = obj.long_name; }, ...
{ this.address = address; this.zipcode = zipcode; this.state = state; this.city = city; }
identifier_body
PlaceDetails.js
'use strict'; (function () { var autocompleteModule = angular.module('TVG.GoogleAPIAutocomplete'); autocompleteModule.factory('PlaceDetails', function () { function PlaceDetails(address, zipcode, state, city) { this.address = address;
} function parseData(data, result) { var desiredInfo = { locality: function (obj) { result.city = obj.long_name; }, postal_code: function (obj) { result.zipcode = obj.long_name; }, ...
this.zipcode = zipcode; this.state = state; this.city = city;
random_line_split
tessel-data.js
var Keen = require('keen.io'); var wifi = require('wifi-cc3000'); var keen = Keen.configure({ projectId: "542b084ce8759666375da5e5", writeKey: "5eb5ca575ff8bb7108c21fe13a6cd0e81c1e82b8df8d0fdf7d583029a0702cf892dc5a8b8e9b3884c0415d8a3603ce06465b4b7053aee014a8ab25e640af5b8750ea316034afbdc01899177aa55795829a14...
wifi.on('disconnect', function(){ console.log("disconnected, trying to reconnect"); wifi.connect({ ssid: 'technicallyWifi', password:'scriptstick' }); });
{ keen.addEvent("climate", { "sound-trigger": data }, function(){ console.log("added event"); }); }
identifier_body
tessel-data.js
var Keen = require('keen.io'); var wifi = require('wifi-cc3000'); var keen = Keen.configure({ projectId: "542b084ce8759666375da5e5", writeKey: "5eb5ca575ff8bb7108c21fe13a6cd0e81c1e82b8df8d0fdf7d583029a0702cf892dc5a8b8e9b3884c0415d8a3603ce06465b4b7053aee014a8ab25e640af5b8750ea316034afbdc01899177aa55795829a146b...
console.log('Degrees:', temp.toFixed(4) + 'F', 'Humidity:', humid.toFixed(4) + '%RH'); console.log("Light level:", light.toFixed(8), " ", "Sound Level:", sound.toFixed(8)); if (wifi.isConnected()) { sendToCloud(temp, humid, light, sound, function(){ ...
random_line_split
tessel-data.js
var Keen = require('keen.io'); var wifi = require('wifi-cc3000'); var keen = Keen.configure({ projectId: "542b084ce8759666375da5e5", writeKey: "5eb5ca575ff8bb7108c21fe13a6cd0e81c1e82b8df8d0fdf7d583029a0702cf892dc5a8b8e9b3884c0415d8a3603ce06465b4b7053aee014a8ab25e640af5b8750ea316034afbdc01899177aa55795829a14...
else { console.log("nope not connected"); setTimeout(loop, 10000); } }); }); }); }); }, 500); ambient.setLightTrigger(0.5); // Set a light level trigger // The trigger is a float between 0 and 1 ambient.on('light-tri...
{ sendToCloud(temp, humid, light, sound, function(){ setTimeout(loop, 10000); }); }
conditional_block
tessel-data.js
var Keen = require('keen.io'); var wifi = require('wifi-cc3000'); var keen = Keen.configure({ projectId: "542b084ce8759666375da5e5", writeKey: "5eb5ca575ff8bb7108c21fe13a6cd0e81c1e82b8df8d0fdf7d583029a0702cf892dc5a8b8e9b3884c0415d8a3603ce06465b4b7053aee014a8ab25e640af5b8750ea316034afbdc01899177aa55795829a14...
(data){ keen.addEvent("climate", { "light-trigger": data }, function(){ console.log("added event"); }); } function sendSoundTrigger(data){ keen.addEvent("climate", { "sound-trigger": data }, function(){ console.log("added event"); }); } wifi.on('disconnect', function(){ console.log("disco...
sendLightTrigger
identifier_name
authorizationDialog.component.ts
import {Component} from '@angular/core'; import {ModalDialog} from './modalDialog'; import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; type ButtonStyle = 'btn-primary' | 'btn-danger'; export interface IAuthModel { title:string;
@Component({ template: ` <div class="modal-body"> <button type="button" class="close" aria-label="Close" (click)="onCancel()"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title">AUTH OR NOT</h4> <p class="card-text">AUTH OR NOT</p> ...
text:string; buttonText: string; buttonIcon: string; buttonStyle: ButtonStyle; }
random_line_split
authorizationDialog.component.ts
import {Component} from '@angular/core'; import {ModalDialog} from './modalDialog'; import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; type ButtonStyle = 'btn-primary' | 'btn-danger'; export interface IAuthModel { title:string; text:string; buttonText: string; buttonIcon: string; buttonStyle: Button...
(activeModal: NgbActiveModal) { super(activeModal); } showConfirmation = (confirmation:IAuthModel) => this.model = confirmation; model: IAuthModel = null; }
constructor
identifier_name
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
fn after_set_attr(&self, attr: JSRef<Attr>) { match self.super_type() { Some(ref s) => s.after_set_attr(attr), _ => () } match attr.local_name() { &atom!("disabled") => { let node: JSRef<Node> = NodeCast::from_ref(*self); ...
{ let htmlelement: &JSRef<HTMLElement> = HTMLElementCast::from_borrowed_ref(self); Some(htmlelement as &VirtualMethods) }
identifier_body
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
(node: &JSRef<Node>, value: &mut DOMString) { let elem: JSRef<Element> = ElementCast::to_ref(*node).unwrap(); let svg_script = *elem.namespace() == ns!(SVG) && elem.local_name().as_slice() == "script"; let html_script = node.is_htmlscriptelement(); if svg_script || html_script { return; } el...
collect_text
identifier_name
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::CharacterDataBinding::Chara...
let svg_script = *elem.namespace() == ns!(SVG) && elem.local_name().as_slice() == "script"; let html_script = node.is_htmlscriptelement(); if svg_script || html_script { return; } else { for child in node.children() { if child.is_text() { let characterdata: JS...
fn collect_text(node: &JSRef<Node>, value: &mut DOMString) { let elem: JSRef<Element> = ElementCast::to_ref(*node).unwrap();
random_line_split
typewriter-scrolling.js
/** * LICENSE : MIT */ "use strict"; (function (mod) { if (typeof exports == "object" && typeof module == "object") { mod(require("codemirror")); } else if (typeof define == "function" && define.amd) { define(["codemirror"], mod); } else { mod(CodeMirror); } })(function...
var scrollTo = Math.round((top - halfWindowHeight)); cm.scrollTo(null, scrollTo); }; CodeMirror.defineOption("typewriterScrolling", false, function (cm, val, old) { if (old && old != CodeMirror.Init) { cm.off("changes", onChanges); } if (val) { cm....
random_line_split
typewriter-scrolling.js
/** * LICENSE : MIT */ "use strict"; (function (mod) { if (typeof exports == "object" && typeof module == "object") { mod(require("codemirror")); } else if (typeof define == "function" && define.amd) { define(["codemirror"], mod); } else { mod(CodeMirror); } })(function...
});
{ if (cm.getSelection().length !== 0) { return; } for (var i = 0, len = changes.length; i < len; i++) { var each = changes[i]; if (each.origin === '+input' || each.origin === '+delete') { cm.execCommand("scrollSelectionToCenter"); ...
identifier_body
typewriter-scrolling.js
/** * LICENSE : MIT */ "use strict"; (function (mod) { if (typeof exports == "object" && typeof module == "object") { mod(require("codemirror")); } else if (typeof define == "function" && define.amd)
else { mod(CodeMirror); } })(function (CodeMirror) { "use strict"; CodeMirror.commands.scrollSelectionToCenter = function (cm) { if (cm.getOption("disableInput")) { return CodeMirror.Pass; } var cursor = cm.getCursor('anchor'); var top = cm.charCoords...
{ define(["codemirror"], mod); }
conditional_block
typewriter-scrolling.js
/** * LICENSE : MIT */ "use strict"; (function (mod) { if (typeof exports == "object" && typeof module == "object") { mod(require("codemirror")); } else if (typeof define == "function" && define.amd) { define(["codemirror"], mod); } else { mod(CodeMirror); } })(function...
(cm, changes) { if (cm.getSelection().length !== 0) { return; } for (var i = 0, len = changes.length; i < len; i++) { var each = changes[i]; if (each.origin === '+input' || each.origin === '+delete') { cm.execCommand("scrollSelectionToCenter");...
onChanges
identifier_name
app.services.spec.js
describe('Unit : youtubePlugin content services', function () { describe('Unit: Buildfire Provider', function () { var Buildfire; beforeEach(module('youtubePluginContent')); beforeEach(inject(function (_Buildfire_) { Buildfire = _Buildfire_; })); it('Buildfire should exist and be an object...
}); });
random_line_split
event_importer.py
from datetime import datetime, date, time from HTMLParser import HTMLParser import random import urllib2 from django.conf import settings from django.db import transaction from django.db.models import Q from django.utils import timezone from icalendar import Calendar import pytz from wprevents.events.models import Ev...
# Bulk create and instantly retrieve events, and remove bulk_id Event.objects.bulk_create(events_to_create) created_events = Event.objects.filter(bulk_id=bulk_id) # Bulk update any functional areas of all these newly created events FunctionalAreaRelations = Event.areas.through relations = [] ...
title = HTMLParser().unescape(ical_event.get('summary')) title = title[:EVENT_TITLE_LENGTH] # Truncate to avoid potential errors location = ical_event.get('location', '') description = ical_event.get('description', '') description = HTMLParser().unescape(description).encode('utf-8') if s...
conditional_block
event_importer.py
from datetime import datetime, date, time from HTMLParser import HTMLParser import random import urllib2 from django.conf import settings from django.db import transaction from django.db.models import Q from django.utils import timezone from icalendar import Calendar import pytz from wprevents.events.models import Ev...
(self, ical_event, event): if not ical_event.get('RRULE') \ and not ical_event.get('EXRULE') \ and not ical_event.get('RDATE') \ and not ical_event.get('EXDATE'): return None def get_as_list(obj, attr): v = obj.get(attr) if v: return v if isinstance(v, list) else [v] ...
get_recurrence
identifier_name
event_importer.py
from datetime import datetime, date, time from HTMLParser import HTMLParser import random import urllib2 from django.conf import settings from django.db import transaction from django.db.models import Q from django.utils import timezone from icalendar import Calendar import pytz from wprevents.events.models import Ev...
rset = rruleset() for rrule in get_as_list(ical_event, 'RRULE'): rrule = rrulestr(rrule.to_ical(), dtstart=event.start) rset.rrule(rrule) for exrule in get_as_list(ical_event, 'EXRULE'): exrule = rrulestr(exrule.to_ical(), dtstart=event.start) rset.rrule(exrule) for rdate in...
if timezone.is_aware(dt): return timezone.make_naive(dt.astimezone(pytz.utc), pytz.utc) else: return pytz.utc.localize(dt)
identifier_body
event_importer.py
from datetime import datetime, date, time from HTMLParser import HTMLParser import random import urllib2 from django.conf import settings from django.db import transaction from django.db.models import Q from django.utils import timezone from icalendar import Calendar import pytz from wprevents.events.models import Ev...
return Event.objects.filter(filter_titles|filter_start_dates) def is_duplicate(self, duplicate_candidate, start, title, space): """ Determine if the event given as the first argument is a duplicate of another event that we are importing by comparing its properties """ e = duplicate_candida...
random_line_split
app.productList.component.ts
/**
import {Product} from "./product"; @Component({ selector: 'products-list', inputs: ['productList'], outputs: ['onProductSelected'], template: ` <div class="ui items"> <product-row *ngFor="let myProduct of productList" [product] = "myProduct" (click) = ...
* Created by wenjuntan on 2016-12-25. */ import {Component, EventEmitter} from "@angular/core";
random_line_split
app.productList.component.ts
/** * Created by wenjuntan on 2016-12-25. */ import {Component, EventEmitter} from "@angular/core"; import {Product} from "./product"; @Component({ selector: 'products-list', inputs: ['productList'], outputs: ['onProductSelected'], template: ` <div class="ui items"> <product-row *n...
{ productList: Product[]; onProductSelected: EventEmitter<Product>; currentProduct: Product; constructor(){ this.onProductSelected = new EventEmitter(); } clicked(product: Product): void{ this.currentProduct = product; this.onProductSelected.emit(product); } is...
ProductsList
identifier_name
app.productList.component.ts
/** * Created by wenjuntan on 2016-12-25. */ import {Component, EventEmitter} from "@angular/core"; import {Product} from "./product"; @Component({ selector: 'products-list', inputs: ['productList'], outputs: ['onProductSelected'], template: ` <div class="ui items"> <product-row *n...
return product.sku == this.currentProduct.sku; } }
{ return false; }
conditional_block
subscriptions.js
var icms = icms || {}; icms.subscriptions = (function ($) { this.active_link = {}; this.onDocumentReady = function () { this.setSubscribe(); $('.subscriber').on('click', function () { icms.subscriptions.active_link = this; icms.subscriptions.showLoader(); ...
{ icms.subscriptions.setResult(result); }
identifier_body
subscriptions.js
var icms = icms || {}; icms.subscriptions = (function ($) { this.active_link = {}; this.onDocumentReady = function () { this.setSubscribe(); $('.subscriber').on('click', function () { icms.subscriptions.active_link = this; icms.subscriptions.showLoader(); ...
if(data.success_text){ icms.modal.alert(data.success_text); } $(icms.subscriptions.active_link).data('issubscribe', data.is_subscribe); icms.subscriptions.setSubscribe(icms.subscriptions.active_link); $(icms.subscriptions.active_link).parent().find('.count-subscrib...
{ icms.modal.close(); }
conditional_block
subscriptions.js
var icms = icms || {}; icms.subscriptions = (function ($) { this.active_link = {}; this.onDocumentReady = function () { this.setSubscribe(); $('.subscriber').on('click', function () { icms.subscriptions.active_link = this; icms.subscriptions.showLoader(); ...
(form_data, result){ icms.subscriptions.setResult(result); }
successSubscribe
identifier_name
subscriptions.js
var icms = icms || {}; icms.subscriptions = (function ($) { this.active_link = {}; this.onDocumentReady = function () { this.setSubscribe(); $('.subscriber').on('click', function () { icms.subscriptions.active_link = this; icms.subscriptions.showLoader(); ...
} $('.subscriber').each(function(indx){ set(this); }); }; return this; }).call(icms.subscriptions || {},jQuery); function successSubscribe(form_data, result){ icms.subscriptions.setResult(result); }
random_line_split
CompassHeading.js
cordova.define("cordova-plugin-device-orientation.CompassHeading", function(require, exports, module) { /*
* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may...
*
random_line_split
simple_ng_model_spec.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ElementArrayFinder, ElementFinder, browser, by, element} from 'protractor'; import {verifyNoBrowserErrors} ...
it('should set the value by changing the domain model', () => { button.click(); expect(input.getAttribute('value')).toEqual('Nancy'); }); });
random_line_split
Middlewares.ts
'use strict'; ///<reference path="../../typings/tsd.d.ts"/> import {ExpressGo, LoaderInterface} from "../../typings/express-go"; declare var global : ExpressGo.Global; /** * Middlewares Provider */ export class Provider implements LoaderInterface { /** * Constructor */ constructor() { // ...
}
{ // }
identifier_body
Middlewares.ts
'use strict'; ///<reference path="../../typings/tsd.d.ts"/> import {ExpressGo, LoaderInterface} from "../../typings/express-go"; declare var global : ExpressGo.Global; /** * Middlewares Provider */ export class Provider implements LoaderInterface { /** * Constructor */ constructor() { // ...
() : void { // } /** * Loader method * * You can override default object initialization method * * @param loadObject * @param nameObject * @returns {any} */ public loader( loadObject : any, nameObject : string ) : any { return null; } /** * Boot method * * @param...
register
identifier_name
Middlewares.ts
'use strict'; ///<reference path="../../typings/tsd.d.ts"/> import {ExpressGo, LoaderInterface} from "../../typings/express-go"; declare var global : ExpressGo.Global; /** * Middlewares Provider */ export class Provider implements LoaderInterface { /** * Constructor */ constructor() { // ...
* Boot method * * @param app * @returns void */ public boot( app : any ) : void { // } }
return null; } /**
random_line_split
ops.rs
//! Image operations for textures. /// Flips the image vertically. pub fn flip_vertical(memory: &[u8], size: [u32; 2], channels: u8) -> Vec<u8> { let (width, height, channels) = (size[0] as usize, size[1] as usize, channels as usize); let mut res = vec![0; width * height]; let stride = width * chan...
(memory: &[u8], size: [u32; 2]) -> Vec<u8> { let (width, height) = (size[0] as usize, size[1] as usize); let capacity = width * height * 4; let stride = width; let mut res = Vec::with_capacity(capacity); for y in 0..height { for x in 0..width { res.push(255); res.push...
alpha_to_rgba8
identifier_name
ops.rs
//! Image operations for textures. /// Flips the image vertically. pub fn flip_vertical(memory: &[u8], size: [u32; 2], channels: u8) -> Vec<u8> { let (width, height, channels) = (size[0] as usize, size[1] as usize, channels as usize); let mut res = vec![0; width * height]; let stride = width * chan...
pub fn alpha_to_rgba8(memory: &[u8], size: [u32; 2]) -> Vec<u8> { let (width, height) = (size[0] as usize, size[1] as usize); let capacity = width * height * 4; let stride = width; let mut res = Vec::with_capacity(capacity); for y in 0..height { for x in 0..width { res.push(255);...
random_line_split
ops.rs
//! Image operations for textures. /// Flips the image vertically. pub fn flip_vertical(memory: &[u8], size: [u32; 2], channels: u8) -> Vec<u8> { let (width, height, channels) = (size[0] as usize, size[1] as usize, channels as usize); let mut res = vec![0; width * height]; let stride = width * chan...
{ let (width, height) = (size[0] as usize, size[1] as usize); let capacity = width * height * 4; let stride = width; let mut res = Vec::with_capacity(capacity); for y in 0..height { for x in 0..width { res.push(255); res.push(255); res.push(255); ...
identifier_body
lib.rs
#[macro_use] extern crate matches; #[macro_use] extern crate log; /// Simple Rpc Module. /// See the submodules for information on how to set up a server and a client. pub mod rpc; /// Common code between structs. // TODO: This probably should not all be public pub mod common; /// /// Raft Server /// pub mod server;...
include!(concat!(env!("OUT_DIR"), "/raft_capnp.rs")); }
random_line_split
main.rs
/* Commented to avoid compile errors an failed build badges on TravisCI, extern crate orbclient; extern crate orbclient_window_shortcuts; use orbclient::{Window, Renderer, EventOption, Color}; use orbclient_window_shortcuts::shortcut::{Comparator, GenericShortcutId, Shortcut, CommonId, Shortcuts}; fn window() -> orb...
{ /* let mut window = window(); let scs = Shortcuts::new(); //Quit Shortcut with ShortcutId from CommonId let mut quit_k: Vec<u8> = Vec::new(); quit_k.push(orbclient::event::K_CTRL); quit_k.push(orbclient::event::K_Q); quit_k.sort(); let mut decrease_k = Vec::new(); decrease_k.pu...
identifier_body
main.rs
/* Commented to avoid compile errors an failed build badges on TravisCI, extern crate orbclient; extern crate orbclient_window_shortcuts; use orbclient::{Window, Renderer, EventOption, Color}; use orbclient_window_shortcuts::shortcut::{Comparator, GenericShortcutId, Shortcut, CommonId, Shortcuts}; fn window() -> orb...
() { /* let mut window = window(); let scs = Shortcuts::new(); //Quit Shortcut with ShortcutId from CommonId let mut quit_k: Vec<u8> = Vec::new(); quit_k.push(orbclient::event::K_CTRL); quit_k.push(orbclient::event::K_Q); quit_k.sort(); let mut decrease_k = Vec::new(); decrease_k...
main
identifier_name
main.rs
/* Commented to avoid compile errors an failed build badges on TravisCI,
use orbclient_window_shortcuts::shortcut::{Comparator, GenericShortcutId, Shortcut, CommonId, Shortcuts}; fn window() -> orbclient::Window { let (width, height) = orbclient::get_display_size().unwrap(); let mut window = Window::new_flags(0, 0, width / 2, height / 2, "Shortcuts Example", &[orbclient::WindowFlag...
extern crate orbclient; extern crate orbclient_window_shortcuts; use orbclient::{Window, Renderer, EventOption, Color};
random_line_split
pyqt4.py
# -*- coding: utf-8 -*- # Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com> # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 2.1 of the License, ...
(self, monitor, parent=None): """ Observe the given ``monitor`` (a :class:`~pyudev.Monitor`): ``parent`` is the parent :class:`~PyQt4.QtCore.QObject` of this object. It is passed unchanged to the inherited constructor of :class:`~PyQt4.QtCore.QObject`. """ QObje...
__init__
identifier_name
pyqt4.py
# -*- coding: utf-8 -*- # Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com> # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 2.1 of the License, ...
class QUDevMonitorObserver(QObject, QUDevMonitorObserverMixin): """An observer for device events integrating into the :mod:`PyQt4` mainloop. .. deprecated:: 0.17 Will be removed in 1.0. Use :class:`MonitorObserver` instead. """ #: emitted upon arbitrary device events deviceEvent = pyqt...
""" Observe the given ``monitor`` (a :class:`~pyudev.Monitor`): ``parent`` is the parent :class:`~PyQt4.QtCore.QObject` of this object. It is passed unchanged to the inherited constructor of :class:`~PyQt4.QtCore.QObject`. """ QObject.__init__(self, parent) self...
identifier_body
pyqt4.py
# -*- coding: utf-8 -*- # Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com> # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 2.1 of the License, ...
:mod:`PyQt4.QtCore` from PyQt4\_ must be available when importing this module. .. _PyQt4: http://riverbankcomputing.co.uk/software/pyqt/intro .. moduleauthor:: Sebastian Wiesner <lunaryorn@gmail.com> """ from __future__ import (print_function, division, unicode_literals, ab...
:class:`MonitorObserver` integrates device monitoring into the PyQt4\_ mainloop by turning device events into Qt signals.
random_line_split
.ycm_extra_conf.py
# Generated by YCM Generator at 2019-06-21 11:57:11.711058 # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publis...
def FlagsForFile( filename, **kwargs ): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = GetCompilationInfoForFile( filename ) if not compilation_info: return None final_flags = MakeRe...
if IsHeaderFile( filename ): basename = os.path.splitext( filename )[ 0 ] for extension in SOURCE_EXTENSIONS: replacement_file = basename + extension if os.path.exists( replacement_file ): compilation_info = database.GetCompilationInfoForFile( replacement_file ) if compilat...
identifier_body
.ycm_extra_conf.py
# Generated by YCM Generator at 2019-06-21 11:57:11.711058 # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publis...
return new_flags def IsHeaderFile( filename ): extension = os.path.splitext( filename )[ 1 ] return extension in [ '.H', '.h', '.hxx', '.hpp', '.hh' ] def GetCompilationInfoForFile( filename ): # The compilation_commands.json file generated by CMake does not have entries # for header files. So we do our ...
new_flag = flag if make_next_absolute: make_next_absolute = False if not flag.startswith( '/' ): new_flag = os.path.join( working_directory, flag ) for path_flag in path_flags: if flag == path_flag: make_next_absolute = True break if flag.startswith( path_flag ...
conditional_block
.ycm_extra_conf.py
# Generated by YCM Generator at 2019-06-21 11:57:11.711058 # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publis...
( filename, **kwargs ): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = GetCompilationInfoForFile( filename ) if not compilation_info: return None final_flags = MakeRelativePathsInFlagsA...
FlagsForFile
identifier_name
.ycm_extra_conf.py
# Generated by YCM Generator at 2019-06-21 11:57:11.711058 # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. # # Here's the license text for this file: # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publis...
# For more information, please refer to <http://unlicense.org/> import os import ycm_core flags = [ '-x', 'c++', '-I../../utils/', ] # Set this to the absolute path to the folder (NOT the file!) containing the # compile_commands.json file to use that instead of 'flags'. See here for # more details: http...
# OTHER DEALINGS IN THE SOFTWARE. #
random_line_split
ZmFolderPropsDialog.js
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Web Client * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Zimbra, Inc. * * The contents of this file are subject to the Zimbra Public License * Version 1.3 ("License"); you may not use this file except in * compliance with the License. You m...
ZmFolderPropsDialog.ADD_SHARE_BUTTON = ++DwtDialog.LAST_BUTTON; ZmFolderPropsDialog.SHARES_HEIGHT = "9em"; // Tab identifiers ZmFolderPropsDialog.TABKEY_PROPERTIES = "PROPERTIES_TAB"; ZmFolderPropsDialog.TABKEY_RETENTION = "RETENTION_TAB"; // Public methods ZmFolderPropsDialog.prototype.toString = function() { ...
ZmFolderPropsDialog.prototype.constructor = ZmFolderPropsDialog; // Constants
random_line_split
flashes.js
export default { mutations: { // add adds a flash message. payload is an object with keys “id”, // “message” and “type”. add(state, p
oad) { let flash = { id: payload.id, message: payload.message, type: payload.type }; state.flashes.push(flash); }, // clear deletes all flash messages that have the provided id. If id is // empty, all flash messages are deleted, regardless of id. clear(state, id = "") { if (!id) { s...
ayl
identifier_name
flashes.js
export default { mutations: { // add adds a flash message. payload is an object with keys “id”, // “message” and “type”. add(state, payload) { let fla
r deletes all flash messages that have the provided id. If id is // empty, all flash messages are deleted, regardless of id. clear(state, id = "") { if (!id) { state.flashes = []; return; } for (let i = 0; i < state.flashes.length; i++) { if (state.flashes[i].id === id) { state.flashes.sp...
sh = { id: payload.id, message: payload.message, type: payload.type }; state.flashes.push(flash); }, // clea
identifier_body
flashes.js
export default { mutations: { // add adds a flash message. payload is an object with keys “id”, // “message” and “type”. add(state, payload) { let flash = { id: payload.id, message: payload.message, type: payload.type }; state.flashes.push(flash); }, // clear deletes all flash messages ...
t i = 0; i < state.flashes.length; i++) { if (state.flashes[i].id === id) { state.flashes.splice(i, 1); } } } }, namespaced: true, state: { flashes: [] } };
flashes = []; return; } for (le
conditional_block
flashes.js
export default { mutations: { // add adds a flash message. payload is an object with keys “id”, // “message” and “type”. add(state, payload) { let flash = { id: payload.id, message: payload.message, type: payload.type }; state.flashes.push(flash); }, // clear deletes all flash messages ...
namespaced: true, state: { flashes: [] } };
} } },
random_line_split
shiny_status_binding.js
// This file is part of Codeface. Codeface is free software: you can
// License as published by the Free Software Foundation, version 2. // // 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 GNU General Public License for more // details. // ...
// redistribute it and/or modify it under the terms of the GNU General Public
random_line_split
adsense.js
/** * Copyright 2015 The AMP HTML 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 require...
(global, data) { checkData(data, ['adClient', 'adSlot', 'adHost', 'adtest', 'tagOrigin']); if (global.context.clientId) { // Read by GPT for GA/GPT integration. global.gaGlobal = { vid: global.context.clientId, hid: global.context.pageViewId, }; } const s = global.document.createElement(...
adsense
identifier_name
adsense.js
/** * Copyright 2015 The AMP HTML 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 require...
{ checkData(data, ['adClient', 'adSlot', 'adHost', 'adtest', 'tagOrigin']); if (global.context.clientId) { // Read by GPT for GA/GPT integration. global.gaGlobal = { vid: global.context.clientId, hid: global.context.pageViewId, }; } const s = global.document.createElement('script'); s....
identifier_body
adsense.js
/** * Copyright 2015 The AMP HTML 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 require...
if (data['adHost']) { i.setAttribute('data-ad-host', data['adHost']); } if (data['adtest']) { i.setAttribute('data-adtest', data['adtest']); } if (data['tagOrigin']) { i.setAttribute('data-tag-origin', data['tagOrigin']); } i.setAttribute('data-page-url', global.context.canonicalUrl); i.set...
{ i.setAttribute('data-ad-slot', data['adSlot']); }
conditional_block
adsense.js
/** * Copyright 2015 The AMP HTML 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 require...
* @param {!Window} global * @param {!Object} data */ export function adsense(global, data) { checkData(data, ['adClient', 'adSlot', 'adHost', 'adtest', 'tagOrigin']); if (global.context.clientId) { // Read by GPT for GA/GPT integration. global.gaGlobal = { vid: global.context.clientId, hid: g...
import {checkData} from '../../3p/3p'; /**
random_line_split
RightToolbar.ts
/********************************************************************* * Copyright (c) 2019 Red Hat, Inc. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifi...
(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { } async waitToolbar(timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) { Logger.debug('RightToolbar.waitToolbar'); await this.driverHelper.waitVisibility(By.css('div.theia-app-right'), timeout); } asyn...
constructor
identifier_name
RightToolbar.ts
/********************************************************************* * Copyright (c) 2019 Red Hat, Inc. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifi...
}
random_line_split
proc_txt.py
import numpy as np import sys import os from utils import * from utils_procs import * # extract letters and spaces, and transform to lower case # how: python proc_txt.py input_file_name # read input args # _, input_fname = 'temp', 'poetry_2' _, input_fname = sys.argv # constant input_path = '../story/' train_test_r...
# create shuffling text_shufw = shuffle_words_in_state(text) text_shufs = shuffle_states_in_story(text) # conver to lower case [text, text_shufw, text_shufs] = to_lower_case([text, text_shufw, text_shufs]) # save word level representation get_word_level_rep(text, os.path.join(output_path, 'shuffle_none'), train_test_...
output_path = input_path make_output_cond_dirs(output_path) # remove pun markers... text = str2cleanstr(text)
random_line_split
proc_txt.py
import numpy as np import sys import os from utils import * from utils_procs import * # extract letters and spaces, and transform to lower case # how: python proc_txt.py input_file_name # read input args # _, input_fname = 'temp', 'poetry_2' _, input_fname = sys.argv # constant input_path = '../story/' train_test_r...
(text, output_path, train_test_ratio): # convert to word-level representation indices, _, words_dict = text_2_one_hot(text) index_string = list_of_int_to_int_string(indices) # save .npz word file and its dictionary save_list_of_int_to_npz(indices, words_dict, output_path, train_test_ratio) save_dict(words_...
get_word_level_rep
identifier_name
proc_txt.py
import numpy as np import sys import os from utils import * from utils_procs import * # extract letters and spaces, and transform to lower case # how: python proc_txt.py input_file_name # read input args # _, input_fname = 'temp', 'poetry_2' _, input_fname = sys.argv # constant input_path = '../story/' train_test_r...
# read input text file input_path = os.path.join(input_path,input_fname) print('Input text from <%s>' % os.path.abspath(input_path)) input_file_path = os.path.join(input_path, input_fname + '.txt') input_file = open(input_file_path, 'r') text = input_file.read() # get output dir name and makr output dirs output_pat...
indices, _, words_dict = text_2_one_hot(text) index_string = list_of_int_to_int_string(indices) # save .npz word file and its dictionary save_list_of_int_to_npz(indices, words_dict, output_path, train_test_ratio) save_dict(words_dict, output_path) # write to output file - char level write2file(text, 'chars...
identifier_body
pythoncad_qt.py
#!/usr/bin/env python # # This is only needed for Python v2 but is harmless for Python v3. # import PyQt5.sip as sip sip.setapi('QString', 2) # from PyQt5 import QtCore, QtGui, QtWidgets # import sys import os import sqlite3 as sqlite # # this is needed for me to use unpickle objects # sys.path.append(os.path.join(os.g...
def getPythonCAD(): app = QtWidgets.QApplication(sys.argv) # Splash screen splashPath = os.path.join(os.getcwd(), 'icons', 'splashScreen1.png') splash_pix = QtGui.QPixmap(splashPath) splash = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) ...
sys.path.append(os.path.join(genericPath, 'Interface')) # from Interface.cadwindow import CadWindowMdi
random_line_split
pythoncad_qt.py
#!/usr/bin/env python # # This is only needed for Python v2 but is harmless for Python v3. # import PyQt5.sip as sip sip.setapi('QString', 2) # from PyQt5 import QtCore, QtGui, QtWidgets # import sys import os import sqlite3 as sqlite # # this is needed for me to use unpickle objects # sys.path.append(os.path.join(os.g...
(): app = QtWidgets.QApplication(sys.argv) # Splash screen splashPath = os.path.join(os.getcwd(), 'icons', 'splashScreen1.png') splash_pix = QtGui.QPixmap(splashPath) splash = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show()...
getPythonCAD
identifier_name
pythoncad_qt.py
#!/usr/bin/env python # # This is only needed for Python v2 but is harmless for Python v3. # import PyQt5.sip as sip sip.setapi('QString', 2) # from PyQt5 import QtCore, QtGui, QtWidgets # import sys import os import sqlite3 as sqlite # # this is needed for me to use unpickle objects # sys.path.append(os.path.join(os.g...
if __name__ == '__main__': w, app = getPythonCAD() sys.exit(app.exec_())
app = QtWidgets.QApplication(sys.argv) # Splash screen splashPath = os.path.join(os.getcwd(), 'icons', 'splashScreen1.png') splash_pix = QtGui.QPixmap(splashPath) splash = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() w ...
identifier_body
pythoncad_qt.py
#!/usr/bin/env python # # This is only needed for Python v2 but is harmless for Python v3. # import PyQt5.sip as sip sip.setapi('QString', 2) # from PyQt5 import QtCore, QtGui, QtWidgets # import sys import os import sqlite3 as sqlite # # this is needed for me to use unpickle objects # sys.path.append(os.path.join(os.g...
w, app = getPythonCAD() sys.exit(app.exec_())
conditional_block
name.py
#!~/envs/udacity_python3_mongodb # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. In the previous quiz you recognized that the "name" value can be an array (or list in Python terms). It would make it easier to process and qu...
def test(): data = process_file(CITIES_DATA) print("Printing 20 results:") for n in range(20): pprint.pprint(data[n]["name"]) assert data[14]["name"] == ['Negtemiut', 'Nightmute'] assert data[9]["name"] == ['Pell City Alabama'] assert data[3]["name"] == ['Kumhari'] if __name__ == ...
data = [] with open(filename, "r") as f: reader = csv.DictReader(f) # Skipping the extra metadata for i in range(3): l = reader.__next__() # Processing file for line in reader: # Calling your function to fix the area value if "name" in li...
identifier_body
name.py
#!~/envs/udacity_python3_mongodb # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. In the previous quiz you recognized that the "name" value can be an array (or list in Python terms). It would make it easier to process and qu...
elif name == 'NULL': return [] else: return [name] def process_file(filename): data = [] with open(filename, "r") as f: reader = csv.DictReader(f) # Skipping the extra metadata for i in range(3): l = reader.__next__() # Processing file ...
values = name.strip('{,}').split('|') return values
conditional_block
name.py
#!~/envs/udacity_python3_mongodb # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. In the previous quiz you recognized that the "name" value can be an array (or list in Python terms). It would make it easier to process and qu...
(name): if re.match(r'^{', name): values = name.strip('{,}').split('|') return values elif name == 'NULL': return [] else: return [name] def process_file(filename): data = [] with open(filename, "r") as f: reader = csv.DictReader(f) # Skipping the e...
fix_name
identifier_name
name.py
#!~/envs/udacity_python3_mongodb # -*- coding: utf-8 -*- """ In this problem set you work with cities infobox data, audit it, come up with a cleaning idea and then clean it up. In the previous quiz you recognized that the "name" value can be an array (or list in Python terms). It would make it easier to process and qu...
""" import codecs import csv import pprint import re DIR_DATA = 'datasets/' CITIES_DATA = DIR_DATA + 'cities.csv' def fix_name(name): if re.match(r'^{', name): values = name.strip('{,}').split('|') return values elif name == 'NULL': return [] else: return [name] def pro...
The rest of the code is just an example on how this function can be used.
random_line_split
__init__.py
# postgresql/__init__.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from . import base, psycopg2, pg8000, pypostgresql, zxjdbc base.dialect = psyc...
__all__ = ( 'INTEGER', 'BIGINT', 'SMALLINT', 'VARCHAR', 'CHAR', 'TEXT', 'NUMERIC', 'FLOAT', 'REAL', 'INET', 'CIDR', 'UUID', 'BIT', 'MACADDR', 'OID', 'DOUBLE_PRECISION', 'TIMESTAMP', 'TIME', 'DATE', 'BYTEA', 'BOOLEAN', 'INTERVAL', 'ARRAY', 'ENUM', 'dialect', 'Any', 'All', 'array', 'HSTORE', 'hstore',...
random_line_split
string_utils.rs
//! Various utilities for string operations. /// Join items of a collection with separator. pub trait JoinWithSeparator<S> { /// Result type of the operation type Output; /// Join items of `self` with `separator`. fn join(self, separator: S) -> Self::Output; } impl<S, S2, X> JoinWithSeparator<S2> for X wher...
<S: AsRef<str>, T: Iterator<Item = S>>(it: T) -> String { it.map(|x| if char_at(x.as_ref(), 0).is_digit(10) { x.as_ref().to_uppercase() } else { format!("{}{}", x.as_ref()[0..1].to_uppercase(), x.as_ref()[1..].to_lowercase()) }) .join("...
iterator_to_class_case
identifier_name
string_utils.rs
//! Various utilities for string operations. /// Join items of a collection with separator. pub trait JoinWithSeparator<S> { /// Result type of the operation type Output; /// Join items of `self` with `separator`. fn join(self, separator: S) -> Self::Output; } impl<S, S2, X> JoinWithSeparator<S2> for X wher...
str.push_str(&part); } str } fn iterator_to_upper_case_words<S: AsRef<str>, T: Iterator<Item = S>>(it: T) -> String { it.map(|x| x.as_ref().to_uppercase()).join("_") } #[cfg_attr(feature="clippy", allow(needless_range_loop))] fn replace_all_sub_vecs(parts: &mut Vec<String>, needle: Vec<&str>) { let mut a...
{ str.push('_'); }
conditional_block
string_utils.rs
//! Various utilities for string operations. /// Join items of a collection with separator. pub trait JoinWithSeparator<S> { /// Result type of the operation type Output; /// Join items of `self` with `separator`. fn join(self, separator: S) -> Self::Output; } impl<S, S2, X> JoinWithSeparator<S2> for X wher...
#[cfg_attr(feature="clippy", allow(needless_range_loop))] fn replace_all_sub_vecs(parts: &mut Vec<String>, needle: Vec<&str>) { let mut any_found = true; while any_found { any_found = false; if parts.len() + 1 >= needle.len() { // TODO: maybe rewrite this for i in 0..parts.len() + 1 - needle.l...
{ it.map(|x| x.as_ref().to_uppercase()).join("_") }
identifier_body
string_utils.rs
//! Various utilities for string operations. /// Join items of a collection with separator. pub trait JoinWithSeparator<S> { /// Result type of the operation type Output; /// Join items of `self` with `separator`. fn join(self, separator: S) -> Self::Output; } impl<S, S2, X> JoinWithSeparator<S2> for X wher...
replace_all_sub_vecs(&mut parts, vec!["3", "d"]); replace_all_sub_vecs(&mut parts, vec!["4", "d"]); let mut str = String::new(); for (i, part) in parts.into_iter().enumerate() { if part.is_empty() { continue; } if i > 0 && !(part.chars().all(|c| c.is_digit(10)) && !ends_with_digit(&str)) { ...
let mut parts: Vec<_> = it.map(|x| x.as_ref().to_lowercase()).collect(); replace_all_sub_vecs(&mut parts, vec!["na", "n"]); replace_all_sub_vecs(&mut parts, vec!["open", "g", "l"]); replace_all_sub_vecs(&mut parts, vec!["i", "o"]); replace_all_sub_vecs(&mut parts, vec!["2", "d"]);
random_line_split
test_register_deregister.rs
use mio::*; use mio::tcp::*; use bytes::SliceBuf; use super::localhost; const SERVER: Token = Token(0); const CLIENT: Token = Token(1); struct TestHandler { server: TcpListener, client: TcpStream, state: usize, } impl TestHandler { fn new(srv: TcpListener, cli: TcpStream) -> TestHandler { Tes...
} impl Handler for TestHandler { type Timeout = usize; type Message = (); fn ready(&mut self, event_loop: &mut EventLoop<TestHandler>, token: Token, events: EventSet) { if events.is_readable() { self.handle_read(event_loop, token, events); } if events.is_writable() { ...
{ debug!("handle_write; token={:?}; state={:?}", token, self.state); assert!(token == CLIENT, "unexpected token {:?}", token); assert!(self.state == 1, "unexpected state {}", self.state); self.state = 2; event_loop.deregister(&self.client).unwrap(); event_loop.timeout_m...
identifier_body
test_register_deregister.rs
use mio::*; use mio::tcp::*; use bytes::SliceBuf; use super::localhost; const SERVER: Token = Token(0); const CLIENT: Token = Token(1); struct TestHandler { server: TcpListener, client: TcpStream, state: usize, } impl TestHandler { fn new(srv: TcpListener, cli: TcpStream) -> TestHandler { Tes...
let addr = localhost(); let server = TcpListener::bind(&addr).unwrap(); info!("register server socket"); event_loop.register(&server, SERVER, EventSet::readable(), PollOpt::edge()).unwrap(); let client = TcpStream::connect(&addr).unwrap(); // Register client socket only as writable event...
random_line_split