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
watchman.js
'use strict'; const denodeify = require('denodeify'); const path = require('../fastpath'); const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting.html'; function watchmanRecReadDir(roots, {ignore, fileWatcher, exts})
return Promise.all( uniqueWatchers.map(watcher => { const watchedRoot = watcher.watchProjectInfo.root; // Build up an expression to filter the output by the relevant roots. const dirExpr = ['anyof']; for (let i = 0; i < roots.length; i++) { const root =...
{ const files = []; return Promise.all( roots.map( root => fileWatcher.getWatcherForRoot(root) ) ).then( watchers => { // All watchman roots for all watches we have. const watchmanRoots = watchers.map( watcher => watcher.watchProjectInfo.root ); // Actual unique ...
identifier_body
watchman.js
'use strict'; const denodeify = require('denodeify'); const path = require('../fastpath'); const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting.html'; function watchmanRecReadDir(roots, {ignore, fileWatcher, exts}) { const files = []; return Promise.all( roots.map( root => file...
const cmd = denodeify(watcher.client.command.bind(watcher.client)); return cmd(['query', watchedRoot, { suffix: exts, expression: ['allof', ['type', 'f'], 'exists', dirExpr], fields: ['name'], }]).then(resp => { if ('warning' in resp) { ...
{ const root = roots[i]; if (isDescendant(watchedRoot, root)) { dirExpr.push(['dirname', path.relative(watchedRoot, root)]); } }
conditional_block
watchman.js
'use strict'; const denodeify = require('denodeify'); const path = require('../fastpath'); const watchmanURL = 'https://facebook.github.io/watchman/docs/troubleshooting.html'; function watchmanRecReadDir(roots, {ignore, fileWatcher, exts}) { const files = []; return Promise.all( roots.map( root => file...
(root, child) { return child.startsWith(root); } module.exports = watchmanRecReadDir;
isDescendant
identifier_name
ExceptionSyntax.ts
import { Import } from "../../Imports/Import"; /** * Metadata on a language's exception syntax. */ export class
{ /** * End of a try, catch or finally block. */ public blockEnd: string; /** * The keyword used for "catch". */ public catch: string; /** * Links alias and ExceptionType in catchstart statement. */ public catchStartLink: string; /** * Middle of catchst...
ExceptionSyntax
identifier_name
ExceptionSyntax.ts
import { Import } from "../../Imports/Import"; /** * Metadata on a language's exception syntax. */ export class ExceptionSyntax { /** * End of a try, catch or finally block. */ public blockEnd: string; /** * The keyword used for "catch". */ public catch: string; /** * L...
/** * Whether a langauge requires exception type. */ public requiresExceptionType: boolean; /** * The keyword used for "throw". */ public throw: string; /** * Middle of a throw line. */ public throwMiddle: string; /** * End of a throw line. */ p...
public requiredImports: Import[];
random_line_split
app.js
angular.element(document).ready(function() { angular.module( 'ripplecharts', [ 'templates-app', 'templates-common', 'ripplecharts.landing', 'ripplecharts.markets', 'ripplecharts.manage-currencies', 'ripplecharts.manage-gateways', 'ripplecharts.multimarkets', 'ripplecharts.activeAccoun...
$scope.ledgerLabel = "connecting..."; remote.request_ledger('closed', handleLedger); //get current ledger; remote.on("disconnect", function(){ $scope.ledgerLabel = "reconnecting..."; $scope.ledgerIndex = ""; $scope.connectionStatus = "disconnected"; $scope.$apply(); ...
{ if (obj) { var totalCoins = obj.ledger.total_coins, totalCoinsXrp = [commas(parseInt(totalCoins.slice(0, -6), 10)), totalCoins.slice(-6, -4)].join("."); $scope.ledgerLabel = "Ledger #:"; $scope.ledgerIndex = commas(parseInt(obj.ledger.ledger_index, 10)); $scope.totalC...
identifier_body
app.js
angular.element(document).ready(function() { angular.module( 'ripplecharts', [ 'templates-app', 'templates-common', 'ripplecharts.landing', 'ripplecharts.markets', 'ripplecharts.manage-currencies', 'ripplecharts.manage-gateways', 'ripplecharts.multimarkets', 'ripplecharts.activeAccount...
}) .controller( 'AppCtrl', function AppCtrl ( $scope, $location ) { $scope.theme = store.get('theme') || Options.theme || 'dark'; $scope.$watch('theme', function(){store.set('theme', $scope.theme)}); $scope.toggleTheme = function(){ if ($scope.theme == 'dark') $scope.theme = 'light'; else ...
random_line_split
app.js
angular.element(document).ready(function() { angular.module( 'ripplecharts', [ 'templates-app', 'templates-common', 'ripplecharts.landing', 'ripplecharts.markets', 'ripplecharts.manage-currencies', 'ripplecharts.manage-gateways', 'ripplecharts.multimarkets', 'ripplecharts.activeAccoun...
(err, obj) { if (obj) { var totalCoins = obj.ledger.total_coins, totalCoinsXrp = [commas(parseInt(totalCoins.slice(0, -6), 10)), totalCoins.slice(-6, -4)].join("."); $scope.ledgerLabel = "Ledger #:"; $scope.ledgerIndex = commas(parseInt(obj.ledger.ledger_index, 10)); $s...
handleLedger
identifier_name
plando.py
from web.backend.utils import loadPresetsList, transition2isolver, getAddressesToRead from graph.graph_utils import vanillaTransitions, vanillaBossesTransitions, vanillaEscapeTransitions, GraphUtils from logic.logic import Logic from utils.version import displayedVersion from gluon.html import OPTGROUP class Plando(o...
def run(self): # init session if self.session.plando is None: self.session.plando = { "state": {}, "preset": "regular", "seed": None, "startLocation": "Landing Site", # rando params "rando"...
self.session = session self.request = request self.cache = cache # required for GraphUtils access to access points Logic.factory('vanilla')
identifier_body
plando.py
from web.backend.utils import loadPresetsList, transition2isolver, getAddressesToRead from graph.graph_utils import vanillaTransitions, vanillaBossesTransitions, vanillaEscapeTransitions, GraphUtils from logic.logic import Logic from utils.version import displayedVersion from gluon.html import OPTGROUP class Plando(o...
curSession=self.session.plando, addresses=addresses, startAPs=startAPs, version=displayedVersion)
random_line_split
plando.py
from web.backend.utils import loadPresetsList, transition2isolver, getAddressesToRead from graph.graph_utils import vanillaTransitions, vanillaBossesTransitions, vanillaEscapeTransitions, GraphUtils from logic.logic import Logic from utils.version import displayedVersion from gluon.html import OPTGROUP class Plando(o...
(self): # init session if self.session.plando is None: self.session.plando = { "state": {}, "preset": "regular", "seed": None, "startLocation": "Landing Site", # rando params "rando": {}, ...
run
identifier_name
plando.py
from web.backend.utils import loadPresetsList, transition2isolver, getAddressesToRead from graph.graph_utils import vanillaTransitions, vanillaBossesTransitions, vanillaEscapeTransitions, GraphUtils from logic.logic import Logic from utils.version import displayedVersion from gluon.html import OPTGROUP class Plando(o...
# generate list of addresses to read in the ROM addresses = getAddressesToRead(plando=True) startAPs = GraphUtils.getStartAccessPointNamesCategory() startAPs = [OPTGROUP(_label="Standard", *startAPs["regular"]), OPTGROUP(_label="Custom", *startAPs["custom"]), ...
escapeAPs += [transition2isolver(src), transition2isolver(dest)]
conditional_block
OncoKbFeedback.tsx
import * as React from 'react'; import { Modal } from 'react-bootstrap'; interface IOncoKbFeedbackProps { showFeedback: boolean; hugoSymbol?: string; alteration?: string; userEmailAddress?: string; handleFeedbackClose: () => void; } export default class OncoKbFeedback extends React.Component< ...
marginHeight={0} marginWidth={0} > <i className="fa fa-spinner fa-pulse fa-2x" /> </iframe> </Modal.Body> </Modal> ); } }
random_line_split
OncoKbFeedback.tsx
import * as React from 'react'; import { Modal } from 'react-bootstrap'; interface IOncoKbFeedbackProps { showFeedback: boolean; hugoSymbol?: string; alteration?: string; userEmailAddress?: string; handleFeedbackClose: () => void; } export default class
extends React.Component< IOncoKbFeedbackProps, {} > { public render() { const url = 'https://docs.google.com/forms/d/1lt6TtecxHrhIE06gAKVF_JW4zKFoowNFzxn6PJv4g7A/viewform'; const geneParam = `entry.1744186665=${this.props.hugoSymbol || ''}`; const alterationParam = `entr...
OncoKbFeedback
identifier_name
LocalizedText.ts
"use strict"; module OrganizationRegister { export class LocalizedText implements Affecto.Base.IModel { private locTitle: string = ""; constructor(public languageCode: string, public localizedValue: string, public isRequired?: boolean) { } public get localized...
{ switch (this.languageCode) { case "fi": title = "suomeksi"; break; case "sv": title = "ruotsiksi"; break; case "en": ...
random_line_split
LocalizedText.ts
"use strict"; module OrganizationRegister { export class LocalizedText implements Affecto.Base.IModel { private locTitle: string = ""; constructor(public languageCode: string, public localizedValue: string, public isRequired?: boolean) { } public get localized...
alue: string) { this.locTitle = value; } } }
calizedTitle(v
identifier_name
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
impl ::DialogTrait for MessageDialog {}
impl ::BinTrait for MessageDialog {} impl ::WindowTrait for MessageDialog {}
random_line_split
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
<T: ::WidgetTrait>(&self) -> Option<T> { let tmp_pointer = unsafe { ffi::gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(self.unwrap_widget())) }; if tmp_pointer.is_null() { None } else { Some(::FFIWidget::wrap_widget(tmp_pointer)) } } } impl_drop!(Me...
get_message_area
identifier_name
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
pub fn get_message_area<T: ::WidgetTrait>(&self) -> Option<T> { let tmp_pointer = unsafe { ffi::gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(self.unwrap_widget())) }; if tmp_pointer.is_null() { None } else { Some(::FFIWidget::wrap_widget(tmp_pointer)) ...
{ unsafe { ffi::gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(self.unwrap_widget()), markup.to_glib_none().0) } }
identifier_body
capture_block.rs
use std::io::Write; use liquid_core::error::ResultLiquidExt; use liquid_core::model::Value; use liquid_core::Language; use liquid_core::Renderable; use liquid_core::Result; use liquid_core::Runtime; use liquid_core::Template; use liquid_core::{BlockReflection, ParseBlock, TagBlock, TagTokenIter}; #[derive(Copy, Clone...
(&self, _writer: &mut dyn Write, runtime: &dyn Runtime) -> Result<()> { let mut captured = Vec::new(); self.template .render_to(&mut captured, runtime) .trace_with(|| self.trace().into())?; let output = String::from_utf8(captured).expect("render only writes UTF-8"); ...
render_to
identifier_name
capture_block.rs
use std::io::Write; use liquid_core::error::ResultLiquidExt; use liquid_core::model::Value; use liquid_core::Language; use liquid_core::Renderable; use liquid_core::Result; use liquid_core::Runtime; use liquid_core::Template; use liquid_core::{BlockReflection, ParseBlock, TagBlock, TagTokenIter}; #[derive(Copy, Clone...
use liquid_core::model::Scalar; use liquid_core::parser; use liquid_core::runtime; use liquid_core::runtime::RuntimeBuilder; fn options() -> Language { let mut options = Language::default(); options .blocks .register("capture".to_string(), CaptureBlock.into(...
mod test { use super::*;
random_line_split
real_server_pooling.py
from python_kemptech_api import * # Specify the LoadMaster connection credentials here: loadmaster_ip = "" username = "" password = "" vs_ip_1 = "" vs_ip_2 = "" rs_ip_1 = "" rs_ip_2 = "" vs_port = "" rs_port = "" class RealServerPool(object): healthcheck_parameters = [ "checktype", "checkport", ...
(self, vs): [rs.delete() for rs in vs.servers.values()] for rs in self.rs: new_rs = vs.create_real_server(rs.rs, rs.rsport) # Apply other settings new_rs.save() for attr in self.rs_parameters: print("attr: {}".format(attr)) ...
apply
identifier_name
real_server_pooling.py
from python_kemptech_api import * # Specify the LoadMaster connection credentials here: loadmaster_ip = "" username = "" password = "" vs_ip_1 = "" vs_ip_2 = "" rs_ip_1 = "" rs_ip_2 = "" vs_port = "" rs_port = "" class RealServerPool(object): healthcheck_parameters = [ "checktype", "checkport", ...
vs.update() # Create the LoadMaster object lm = LoadMaster(loadmaster_ip, username, password) # Delete all the existing VSs [vs.delete() for vs in lm.vs.values()] # Create a new VS vs = lm.create_virtual_service(vs_ip_1, vs_port, "tcp") vs.save() # Configure some healthcheck options vs.checktype = 'HTTPS' v...
[rs.delete() for rs in vs.servers.values()] for rs in self.rs: new_rs = vs.create_real_server(rs.rs, rs.rsport) # Apply other settings new_rs.save() for attr in self.rs_parameters: print("attr: {}".format(attr)) if hasattr(rs, att...
identifier_body
real_server_pooling.py
from python_kemptech_api import * # Specify the LoadMaster connection credentials here: loadmaster_ip = "" username = "" password = "" vs_ip_1 = "" vs_ip_2 = "" rs_ip_1 = "" rs_ip_2 = "" vs_port = "" rs_port = ""
class RealServerPool(object): healthcheck_parameters = [ "checktype", "checkport", "checkurl", "checkheaders", "checkuse1_1", "checkuseget", "checkpostdata", "checkpattern", "checkcodes", "matchlen", "enhancedhealthchecks", ...
random_line_split
real_server_pooling.py
from python_kemptech_api import * # Specify the LoadMaster connection credentials here: loadmaster_ip = "" username = "" password = "" vs_ip_1 = "" vs_ip_2 = "" rs_ip_1 = "" rs_ip_2 = "" vs_port = "" rs_port = "" class RealServerPool(object): healthcheck_parameters = [ "checktype", "checkport", ...
self.checktype = None self.checkport = None self.checkurl = None self.checkheaders = None self.checkuse1_1 = None self.checkuseget = None self.checkpostdata = None self.checkpattern = None self.checkcodes = Non...
if isinstance(rs, RealServer): self.rs.append(rs) else: ip, port = rs.split(":") mock_lm = {"endpoint": "", "ip_address": "", "vs": ""} self.rs.append(RealServer(mock_lm, ip, port))
conditional_block
home-states.js
file, You can obtain one at http://www.appverse.mobi/licenses/apl_v2.0.pdf. [^] Redistribution and use in source and binary forms, with or without modification, are permitted provided that the conditions of the AppVerse Public License v2.0 are met. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTOR...
/* Copyright (c) 2015 GFT Appverse, S.L., Sociedad Unipersonal. This Source Code Form is subject to the terms of the Appverse Public License Version 2.0 (“APL v2.0”). If a copy of the APL was not distributed with this
random_line_split
region_PG.py
"""Auto-generated file, do not edit by hand. PG metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_PG = PhoneMetadata(id='PG', country_code=675, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='[1-9]\\d{6,7}', possible_length=(7, 8)),...
toll_free=PhoneNumberDesc(national_number_pattern='180\\d{4}', example_number='1801234', possible_length=(7,)), voip=PhoneNumberDesc(national_number_pattern='27[568]\\d{4}', example_number='2751234', possible_length=(7,)), number_format=[NumberFormat(pattern='(\\d{3})(\\d{4})', format='\\1 \\2', leading_dig...
random_line_split
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
Action::Skip => (), Action::Abort => { return; } }; } ssa.clear_mark(node); } // Remove empty blocks and redirect control flows. let blocks = ssa.blocks(); for bl...
{ ssa.remove_value(*node); }
conditional_block
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
<T: FnMut(Box<dyn Change>) -> Action>(&self, ssa: &mut SSAStorage, mut policy: T) { for node in &ssa.values() { if !ssa.is_marked(node) { match policy(Box::new(RemoveValue(*node))) { Action::Apply => { ssa.remove_value(*node); ...
sweep
identifier_name
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
// Remove empty blocks and redirect control flows. let blocks = ssa.blocks(); for block in &blocks { // Do not touch start or exit nodes if *block == entry_node_err!(ssa) || *block == exit_node_err!(ssa) { continue; } let remove_bl...
random_line_split
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
} impl FuncAnalyzer for DCE { fn analyze<T: FnMut(Box<dyn Change>) -> Action>( &mut self, rfn: &mut RadecoFunction, policy: Option<T>, ) -> Option<Box<dyn AnalyzerResult>> { self.mark(rfn.ssa_mut()); self.sweep( rfn.ssa_mut(), policy.expect("A po...
{ self }
identifier_body
CollectionRightsObjectFactory.ts
// Copyright 2016 The Oppia 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 //
// distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Factory for creating and mutating instances of f...
// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software
random_line_split
CollectionRightsObjectFactory.ts
// Copyright 2016 The Oppia 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 ap...
// Returns the owner names of the collection. This property is immutable. getOwnerNames(): string[] { return cloneDeep(this._ownerNames); } // Returns the reference to the internal ownerNames array; this function is // only meant to be used for Angular bindings and should never be used in // code. Pl...
{ if (this.canEdit() && this.canUnpublish()) { this._isPrivate = true; } else { throw new Error('User is not allowed to unpublish this collection.'); } }
identifier_body
CollectionRightsObjectFactory.ts
// Copyright 2016 The Oppia 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 ap...
} // Sets isPrivate to true only if canUnpublish and canEdit are both true. setPrivate(): void { if (this.canEdit() && this.canUnpublish()) { this._isPrivate = true; } else { throw new Error('User is not allowed to unpublish this collection.'); } } // Returns the owner names of the ...
{ throw new Error('User is not allowed to edit this collection.'); }
conditional_block
CollectionRightsObjectFactory.ts
// Copyright 2016 The Oppia 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 ap...
(): CollectionRights { return new CollectionRights({ owner_names: [], collection_id: null, can_edit: null, can_unpublish: null, is_private: null }); } } angular.module('oppia').factory( 'CollectionRightsObjectFactory', downgradeInjectable(CollectionRightsObjectFactory));
createEmptyCollectionRights
identifier_name
index.js
var crypto = require('crypto'); var Canvas = require('canvas'); var _ = require('lodash'); var bu = require('./bufutil'); var fmt = require('util').format; var unpack = require('./unpack'); var bright = require('./bright'); function
(buf, len) { if (len > 64) throw new Error(fmt("sha512 can only generate 64B of data: %dB requested", len)); return _(crypto.createHash('sha512').update(buf).digest()) .groupBy(function (x, k) { return Math.floor(k/len); }) .reduce(bu.xor); } function idhash(str, n, minFill, maxFill) { var buf = new Buffer...
fprint
identifier_name
index.js
var crypto = require('crypto'); var Canvas = require('canvas'); var _ = require('lodash'); var bu = require('./bufutil'); var fmt = require('util').format; var unpack = require('./unpack'); var bright = require('./bright'); function fprint(buf, len) { if (len > 64) throw new Error(fmt("sha512 can only generate 64B ...
return c; } retricon.defaults = { pixelSize: 10, bgColor: null, pixelPadding: 0, imagePadding: 0, tiles: 5, minFill: 0.3, maxFill: 0.90, pixelColor: 0 }; retricon.style = { github: { pixelSize: 70, bgColor: '#F0F0F0', pixelPadding: -1, imagePadding: 35, tiles: 5 }, gravatar: { tiles: 8, bgCo...
random_line_split
index.js
var crypto = require('crypto'); var Canvas = require('canvas'); var _ = require('lodash'); var bu = require('./bufutil'); var fmt = require('util').format; var unpack = require('./unpack'); var bright = require('./bright'); function fprint(buf, len) { if (len > 64) throw new Error(fmt("sha512 can only generate 64B ...
if (! _.isNull(opts.bgColor)) ctx.fillRect(0, 0, csize, csize); var drawOp = ctx.fillRect.bind(ctx); if (_.isString(opts.pixelColor)) { ctx.fillStyle = opts.pixelColor; } else if (_.isNumber(opts.pixelColor)) { ctx.fillStyle = '#' + id.colors[opts.pixelColor]; } else { drawOp = ctx.clearRect.bind(ctx);...
{ opts = _.merge({}, retricon.defaults, opts); var dimension = opts.tiles; var pixelSize = opts.pixelSize; var border = opts.pixelPadding; var mid = Math.ceil(dimension / 2); var id = idhash(str, mid * dimension, opts.minFill, opts.maxFill); var pic = reflect(id, dimension); var csize = (pixelSize * dimensi...
identifier_body
index.js
var crypto = require('crypto'); var Canvas = require('canvas'); var _ = require('lodash'); var bu = require('./bufutil'); var fmt = require('util').format; var unpack = require('./unpack'); var bright = require('./bright'); function fprint(buf, len) { if (len > 64) throw new Error(fmt("sha512 can only generate 64B ...
} return pic; } function retricon(str, opts) { opts = _.merge({}, retricon.defaults, opts); var dimension = opts.tiles; var pixelSize = opts.pixelSize; var border = opts.pixelPadding; var mid = Math.ceil(dimension / 2); var id = idhash(str, mid * dimension, opts.minFill, opts.maxFill); var pic = reflect(...
{ var p = (row * mid) + col; if (col>=mid) { var d = mid - (odd ? 1 : 0) - col; var ad = Math.abs(d); p = (row * mid) + mid - 1 - ad; } pic[row][col] = id.pixels[p]; // console.error(fmt("looking for %d, of %d for %d,%d", p, id.pixels.length, row, col)) }
conditional_block
0003_auto__add_unique_category_name.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'Category', fields ['name'] db.create_unique(u'website_category', ['name'])
def backwards(self, orm): # Removing unique constraint on 'Category', fields ['name'] db.delete_unique(u'website_category', ['name']) models = { u'website.category': { 'Meta': {'object_name': 'Category'}, 'description': ('django.db.models.fields.TextField', [], ...
random_line_split
0003_auto__add_unique_category_name.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'Category', fields ['name']
def backwards(self, orm): # Removing unique constraint on 'Category', fields ['name'] db.delete_unique(u'website_category', ['name']) models = { u'website.category': { 'Meta': {'object_name': 'Category'}, 'description': ('django.db.models.fields.TextField', [...
db.create_unique(u'website_category', ['name'])
identifier_body
0003_auto__add_unique_category_name.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'Category', fields ['name'] db.create_unique(u'website_category', ['name']) ...
(self, orm): # Removing unique constraint on 'Category', fields ['name'] db.delete_unique(u'website_category', ['name']) models = { u'website.category': { 'Meta': {'object_name': 'Category'}, 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}...
backwards
identifier_name
Rename.ts
import * as standardNames from '../../msg/names.json'; export class
{ private names = new Map<string, string>(); private unnames = new Map<string, string>(); public constructor(pairs: Array<[string, string]> = []) { if (pairs.length === 0) { pairs = standardNames as any; } for (const pair of pairs) { if (pair[0]) { this.add(pair[0], pair[1]); ...
Rename
identifier_name
Rename.ts
import * as standardNames from '../../msg/names.json'; export class Rename { private names = new Map<string, string>(); private unnames = new Map<string, string>(); public constructor(pairs: Array<[string, string]> = []) { if (pairs.length === 0) { pairs = standardNames as any; } for (const pa...
for (let i = 0; i <= src.length; i++) { const active = (i < src.length) ? letter.test(src.charAt(i)) : !prevActive; if (active !== prevActive) { if (i !== base) { const part = src.substr(base, i - base); base = i; parts.push(prevActive ? this.get(part) : part); ...
const letter = new RegExp(/[-a-zA-Z0-9.:!]/);
random_line_split
Rename.ts
import * as standardNames from '../../msg/names.json'; export class Rename { private names = new Map<string, string>(); private unnames = new Map<string, string>(); public constructor(pairs: Array<[string, string]> = [])
public add(src: string, dest: string) { this.names.set(src, dest); this.unnames.set(dest, src); } public get(src: string): string { if (src.charAt(0) === ':') { return src; } if (this.names.has(src)) { return this.names.get(src); } const parts = src.split(':'); const next = pa...
{ if (pairs.length === 0) { pairs = standardNames as any; } for (const pair of pairs) { if (pair[0]) { this.add(pair[0], pair[1]); } } }
identifier_body
Rename.ts
import * as standardNames from '../../msg/names.json'; export class Rename { private names = new Map<string, string>(); private unnames = new Map<string, string>(); public constructor(pairs: Array<[string, string]> = []) { if (pairs.length === 0) { pairs = standardNames as any; } for (const p...
return parts.join(''); } public unrenameWithinString(src: string): string { const parts: string[] = []; let base: number = 0; let prevActive: boolean = false; const letter = new RegExp(/[-a-zA-Z0-9.:!]/); for (let i = 0; i <= src.length; i++) { const active = (i < src.length) ? lette...
{ const active = (i < src.length) ? letter.test(src.charAt(i)) : !prevActive; if (active !== prevActive) { if (i !== base) { const part = src.substr(base, i - base); base = i; parts.push(prevActive ? this.get(part) : part); } } prevActive = active; ...
conditional_block
search.py
from itertools import repeat from xmodule.course_module import CourseDescriptor from .exceptions import (ItemNotFoundError, NoPathToItem) from . import Location def path_to_location(modulestore, course_id, location):
of this location in that sequence. Otherwise, position will be None. TODO (vshnayder): Not true yet. ''' def flatten(xs): '''Convert lisp-style (a, (b, (c, ()))) list into a python list. Not a general flatten function. ''' p = [] while xs != (): p.append(xs[...
''' Try to find a course_id/chapter/section[/position] path to location in modulestore. The courseware insists that the first level in the course is chapter, but any kind of module can be a "section". location: something that can be passed to Location course_id: Search for paths in this course. ...
identifier_body
search.py
from itertools import repeat from xmodule.course_module import CourseDescriptor from .exceptions import (ItemNotFoundError, NoPathToItem) from . import Location def path_to_location(modulestore, course_id, location): ''' Try to find a course_id/chapter/section[/position] path to location in modulestore....
n = len(path) course_id = CourseDescriptor.location_to_id(path[0]) # pull out the location names chapter = path[1].name if n > 1 else None section = path[2].name if n > 2 else None # Figure out the position position = None # This block of code will find the position of a module within a...
random_line_split
search.py
from itertools import repeat from xmodule.course_module import CourseDescriptor from .exceptions import (ItemNotFoundError, NoPathToItem) from . import Location def path_to_location(modulestore, course_id, location): ''' Try to find a course_id/chapter/section[/position] path to location in modulestore....
position = "_".join(position_list) return (course_id, chapter, section, position)
category = path[path_index].category if category == 'sequential' or category == 'videosequence': section_desc = modulestore.get_instance(course_id, path[path_index]) child_locs = [c.location for c in section_desc.get_children()] # positions are 1-indexed, and ...
conditional_block
search.py
from itertools import repeat from xmodule.course_module import CourseDescriptor from .exceptions import (ItemNotFoundError, NoPathToItem) from . import Location def path_to_location(modulestore, course_id, location): ''' Try to find a course_id/chapter/section[/position] path to location in modulestore....
(xs): '''Convert lisp-style (a, (b, (c, ()))) list into a python list. Not a general flatten function. ''' p = [] while xs != (): p.append(xs[0]) xs = xs[1] return p def find_path_to_course(): '''Find a path up the location graph to a node wit...
flatten
identifier_name
download_entered_data_test.py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re class DownloadEnteredDataTest(unittest.TestCase): def setUp(self)...
return alert_text finally: self.accept_next_alert = True def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main()
alert.dismiss()
conditional_block
download_entered_data_test.py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException
self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://kc.kbtdev.org/" self.verificationErrors = [] self.accept_next_alert = True def test_download_entered_data(self): # Open KoBoCAT. driver = self.driver driver.get(...
import unittest, time, re class DownloadEnteredDataTest(unittest.TestCase): def setUp(self):
random_line_split
download_entered_data_test.py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re class DownloadEnteredDataTest(unittest.TestCase): def setUp(self)...
(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException: return False return True def is_alert_present(self): try: self.driver.switch_to_alert() except NoAlertPresentException: return False return True def close_alert_a...
is_element_present
identifier_name
download_entered_data_test.py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import unittest, time, re class DownloadEnteredDataTest(unittest.TestCase): def setUp(self)...
if __name__ == "__main__": unittest.main()
self.driver.quit() self.assertEqual([], self.verificationErrors)
identifier_body
neuron.py
import h5py import sys import os.path as op from fos import * import numpy as np a=np.loadtxt(op.join(op.dirname(__file__), "data", "rat-basal-forebrain.swc") ) pos = a[:,2:5].astype( np.float32 ) radius = a[:,5].astype( np.float32 ) * 4 # extract parent connectivity and create full connectivity parents = a[1:,6] - ...
w.add_scene( scene ) w.refocus_camera()
random_line_split
check_name_request.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
(Model): """CheckNameRequest. :param name: Workspace collection name :type name: str :param type: Resource type. Default value: "Microsoft.PowerBI/workspaceCollections" . :type type: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 't...
CheckNameRequest
identifier_name
check_name_request.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
"""CheckNameRequest. :param name: Workspace collection name :type name: str :param type: Resource type. Default value: "Microsoft.PowerBI/workspaceCollections" . :type type: str """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type':...
identifier_body
check_name_request.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
_attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } def __init__(self, name=None, type="Microsoft.PowerBI/workspaceCollections"): self.name = name self.type = type
:param type: Resource type. Default value: "Microsoft.PowerBI/workspaceCollections" . :type type: str """
random_line_split
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263. // pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn
(f: Box<dyn FnMut(&usize)>) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any...
ok
identifier_name
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263.
// pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn ok(f: Box<dyn FnMut(&usize)>) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should...
random_line_split
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263. // pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn ok(f: Box<dyn FnMut(&usize)>)
// This version is the same as above, except that here, g's type is // inferred. fn ok_inferred(f: Box<dyn FnMut(&usize)>) { let mut g: Box<dyn for<'r> FnMut(&'r usize)> = Box::new(|_| {}); g = f; } pub fn main() { }
{ // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any context that expects g's ty...
identifier_body
editortool.py
depths import DepthOffset from pymclevel import BoundingBox from config import config from albow.translate import _ class EditorTool(object): surfaceBuild = False panel = None optionsPanel = None toolIconName = None worldTooltipText = None previewRenderer = None tooltipText = "???" ...
def drawTerrainPreview(self, origin): if self.previewRenderer is None: return self.previewRenderer.origin = map(lambda a, b: a - b, origin, self.level.bounds.origin) GL.glPolygonOffset(DepthOffset.ClonePreview, DepthOffset.ClonePreview) GL.glEnable(GL.GL_POLYGON_OFFSET...
pass
identifier_body
editortool.py
from depths import DepthOffset from pymclevel import BoundingBox from config import config from albow.translate import _ class EditorTool(object): surfaceBuild = False panel = None optionsPanel = None toolIconName = None worldTooltipText = None previewRenderer = None tooltipText = "???" ...
return True def __init__(self, editor): self.editor = editor self.__hotkey = None @property def hotkey(self): return _(self.__hotkey) @hotkey.setter def hotkey(self, k): self.__hotkey = k def toolReselected(self): pass def toolSelected(sel...
def toolEnabled(self):
random_line_split
editortool.py
depths import DepthOffset from pymclevel import BoundingBox from config import config from albow.translate import _ class EditorTool(object): surfaceBuild = False panel = None optionsPanel = None toolIconName = None worldTooltipText = None previewRenderer = None tooltipText = "???" ...
return None def selectionBoxForCorners(self, p1, p2): ''' considers p1,p2 as the marked corners of a selection. returns a BoundingBox containing all the blocks within.''' if self.editor.level is None: return None p1, p2 = list(p1), list(p2) # d = [(a-...
return (self.editor.selectionTool.bottomLeftPoint, self.editor.selectionTool.topRightPoint)
conditional_block
editortool.py
depths import DepthOffset from pymclevel import BoundingBox from config import config from albow.translate import _ class EditorTool(object): surfaceBuild = False panel = None optionsPanel = None toolIconName = None worldTooltipText = None previewRenderer = None tooltipText = "???" ...
(self, amount=1, blocksOnly=False): pass def swap(self, amount=1): pass def mouseDown(self, evt, pos, direction): '''pos is the coordinates of the block under the cursor, direction indicates which face is under it. the tool performs its action on the specified block'''...
mirror
identifier_name
util.ts
.js'; import {WaitableEvent} from './waitable_event.js'; /** * Creates a canvas element for 2D drawing. * * @param params Size of the canvas. * @param params.width Width of the canvas. * @param params.height Height of the canvas. * @return Returns canvas element and the context for 2D drawing. */ export functio...
/** * Gets default facing according to device mode. */ export function getDefaultFacing(): Facing { return state.get(state.State.TABLET) ? Facing.ENVIRONMENT : Facing.USER; } /** * Toggle checked value of element. */ export function toggleChecked( element: HTMLInputElement, checked: boolean): void { eleme...
}); }
random_line_split
util.ts
.js'; import {WaitableEvent} from './waitable_event.js'; /** * Creates a canvas element for 2D drawing. * * @param params Size of the canvas. * @param params.width Width of the canvas. * @param params.height Height of the canvas. * @return Returns canvas element and the context for 2D drawing. */ export functio...
{ private intervalId: number|null = null; private readonly delayTimeoutId: number; /** * @param callback Callback to be triggered in fixed interval. * @param delayMs Delay milliseconds at start. * @param intervalMs Interval in milliseconds. */ constructor(callback: () => void, delayMs: number, in...
DelayInterval
identifier_name
util.ts
of the canvas. * @param params.width Width of the canvas. * @param params.height Height of the canvas. * @return Returns canvas element and the context for 2D drawing. */ export function newDrawingCanvas( {width, height}: {width: number, height: number}): {canvas: HTMLCanvasElement, ctx: CanvasRenderingCon...
{ throw new Error('cannot share'); }
conditional_block
util.ts
.js'; import {WaitableEvent} from './waitable_event.js'; /** * Creates a canvas element for 2D drawing. * * @param params Size of the canvas. * @param params.width Width of the canvas. * @param params.height Height of the canvas. * @return Returns canvas element and the context for 2D drawing. */ export functio...
for (const element of getElements('i18n-text')) { element.textContent = getMessage(element, 'i18n-text'); } for (const element of getElements('i18n-tooltip-true')) { element.setAttribute( 'tooltip-true', getMessage(element, 'i18n-tooltip-true')); } for (const element of getElements('i18n-too...
{ element.setAttribute('aria-label', getMessage(element, attr)); }
identifier_body
app.js
require.config({ paths: {   "jquery": "jquery.min", "bootstrap": "bootstrap.min", "TweenMax": "TweenMax.min", // "indicators": "debug.addIndicators", "velocity": "velocity.min", "animationVelocity": "animation.velocity.min", "ScrollMagic": "ScrollMagic.min" }, shim: {   'bootstrap': { deps: ['jquery'...
element = $(selector); offset = element.offset(); offsetTop = offset.top + verticalOffset; console.log($('#navbar').height()); $('html, body').animate({ scrollTop: offsetTop - ($('#navbar').height()/2) }, time); } $('.site-arrow-down').click(function() { scrollToElement(...
function scrollToElement(selector, time, verticalOffset) { time = typeof(time) != 'undefined' ? time : 1000; verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;
random_line_split
app.js
require.config({ paths: {   "jquery": "jquery.min", "bootstrap": "bootstrap.min", "TweenMax": "TweenMax.min", // "indicators": "debug.addIndicators", "velocity": "velocity.min", "animationVelocity": "animation.velocity.min", "ScrollMagic": "ScrollMagic.min" }, shim: {   'bootstrap': { deps: ['jquery'...
'.site-arrow-down').click(function() { scrollToElement('#features'); }); $('a.qq-chat').on('click', function() { $('iframe[allowtransparency="true"]').contents().find('div#launchBtn').click(); }) $('[data-toggle="popover"]').tooltip() }); });
time = typeof(time) != 'undefined' ? time : 1000; verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0; element = $(selector); offset = element.offset(); offsetTop = offset.top + verticalOffset; console.log($('#navbar').height()); $('html, body').animate({ ...
identifier_body
app.js
require.config({ paths: {   "jquery": "jquery.min", "bootstrap": "bootstrap.min", "TweenMax": "TweenMax.min", // "indicators": "debug.addIndicators", "velocity": "velocity.min", "animationVelocity": "animation.velocity.min", "ScrollMagic": "ScrollMagic.min" }, shim: {   'bootstrap': { deps: ['jquery'...
tor, time, verticalOffset) { time = typeof(time) != 'undefined' ? time : 1000; verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0; element = $(selector); offset = element.offset(); offsetTop = offset.top + verticalOffset; console.log($('#navbar').height()); $(...
ToElement(selec
identifier_name
icmp_exfiltration.py
#!/usr/bin/python import os import sys import zlib import time import datetime import base64 from socket import * from impacket import ImpactPacket """ Constants """ READ_BINARY = "rb" WRITE_BINARY = "wb" READ_FROM_SOCK = 7000 ICMP_HEADER_SIZE = 27 DATA_SEPARATOR = "::" DATA_TERMINATOR = "\x12\x13\x...
(ip_addr, saving_location="."): """ init_listener will start a listener for incoming ICMP packets on a specified ip_addr to receive the packets. It will then save a log file and the incoming information to the given path. If none given it will generate one itself. :param ip_addr: The local IP address to bind the...
init_listener
identifier_name
icmp_exfiltration.py
#!/usr/bin/python import os import sys import zlib import time import datetime import base64 from socket import * from impacket import ImpactPacket """ Constants """ READ_BINARY = "rb" WRITE_BINARY = "wb" READ_FROM_SOCK = 7000 ICMP_HEADER_SIZE = 27 DATA_SEPARATOR = "::" DATA_TERMINATOR = "\x12\x13\x...
if __name__ == "__main__": sys.stdout.write("This is meant to be a module for python and not a stand alone executable\n")
current_file += data[28:data.find(DATA_TERMINATOR)] log_fh.write("Received packet %s" % i + "\n") i += 1
conditional_block
icmp_exfiltration.py
#!/usr/bin/python import os import sys import zlib import time import datetime import base64 from socket import * from impacket import ImpactPacket """ Constants """ READ_BINARY = "rb" WRITE_BINARY = "wb" READ_FROM_SOCK = 7000 ICMP_HEADER_SIZE = 27 DATA_SEPARATOR = "::" DATA_TERMINATOR = "\x12\x13\x...
# Resetting counters files_received = 0 i = 0 current_file = "" # init log file: current_time_as_string = str(datetime.datetime.now()).replace(":",".").replace(" ", "-")[:-7] log_fh = open(LOGFILE_BASENAME + current_time_as_string + LOGFILE_EXT, WRITE_BINARY) log_fh.write("Started logging at %s\n\n" % current_...
sys.stderr.write("Could not start listening.\nProbably not root.\n") raise
random_line_split
icmp_exfiltration.py
#!/usr/bin/python import os import sys import zlib import time import datetime import base64 from socket import * from impacket import ImpactPacket """ Constants """ READ_BINARY = "rb" WRITE_BINARY = "wb" READ_FROM_SOCK = 7000 ICMP_HEADER_SIZE = 27 DATA_SEPARATOR = "::" DATA_TERMINATOR = "\x12\x13\x...
# Create Raw Socket s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP) s.setsockopt(IPPROTO_IP, IP_HDRINCL, 1) # Create IP Packet ip = ImpactPacket.IP() ip.set_ip_src(src_ip_addr) ip.set_ip_dst(ip_addr) # ICMP on top of IP icmp = ImpactPacket.ICMP() icmp.set_icmp_type(icmp.ICMP_ECHO) seq_id = 0 # Calculate Fil...
""" send_file will send a file to the ip_addr given. A file path is required to send the file. Max packet size can be determined automatically. :param ip_addr: IP Address to send the file to. :param src_ip_addr: IP Address to spoof from. Default it 127.0.0.1. :param file_path: Path of the file to send. :param ma...
identifier_body
auth-guard.service.spec.ts
import {inject, TestBed} from '@angular/core/testing'; import {Router, RouterModule} from '@angular/router'; import {AuthGuardService} from './auth-guard.service'; import {LoginService} from './login.service'; class LoginServiceMock { private _loggedIn = false; logIn(email, password) { this._loggedIn = true;...
() { this._loggedIn = false; } loggedIn() { return this._loggedIn; } } describe('AuthGuardService', () => { beforeEach(() => { const router = { navigate: jasmine.createSpy('navigate') }; TestBed.configureTestingModule({ providers: [ {provide: Router, useValue: router},...
logOut
identifier_name
auth-guard.service.spec.ts
import {inject, TestBed} from '@angular/core/testing'; import {Router, RouterModule} from '@angular/router'; import {AuthGuardService} from './auth-guard.service'; import {LoginService} from './login.service'; class LoginServiceMock { private _loggedIn = false; logIn(email, password)
logOut() { this._loggedIn = false; } loggedIn() { return this._loggedIn; } } describe('AuthGuardService', () => { beforeEach(() => { const router = { navigate: jasmine.createSpy('navigate') }; TestBed.configureTestingModule({ providers: [ {provide: Router, useValue...
{ this._loggedIn = true; }
identifier_body
auth-guard.service.spec.ts
import {inject, TestBed} from '@angular/core/testing'; import {Router, RouterModule} from '@angular/router'; import {AuthGuardService} from './auth-guard.service'; import {LoginService} from './login.service'; class LoginServiceMock { private _loggedIn = false; logIn(email, password) { this._loggedIn = true;...
return this._loggedIn; } } describe('AuthGuardService', () => { beforeEach(() => { const router = { navigate: jasmine.createSpy('navigate') }; TestBed.configureTestingModule({ providers: [ {provide: Router, useValue: router}, {provide: LoginService, useClass: LoginServi...
} loggedIn() {
random_line_split
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
{ let mut app = Core::new(); app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #[cf...
identifier_body
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #[cfg(feature = "devel")] app.add_...
fn main() { let mut app = Core::new();
random_line_split
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
() { let mut app = Core::new(); app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #...
main
identifier_name
index.tsx
import config from '@automattic/calypso-config'; import { ReactElement, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { logToLogstash } from 'calypso/lib/logstash'; import StepWrapper from 'calypso/signup/step-wrapper'; import { recordTracksEvent } from 'calypso/state/analytics...
return ( <StepWrapper className="transfer__step-wrapper" flowName="woocommerce-install" hideBack={ ! hasFailed } backUrl={ `/woocommerce-installation/${ domain }` } hideNext={ true } hideSkip={ true } hideFormattedHeader={ true } isWideLayout={ props.isReskinned } stepContent={ <> ...
{ goToStep( 'confirm' ); return null; }
conditional_block
index.tsx
import config from '@automattic/calypso-config'; import { ReactElement, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { logToLogstash } from 'calypso/lib/logstash'; import StepWrapper from 'calypso/signup/step-wrapper'; import { recordTracksEvent } from 'calypso/state/analytics...
) } { ! isAtomic && ( <TransferSite onFailure={ handleTransferFailure } trackRedirect={ trackRedirect } /> ) } </> } { ...props } /> ); }
random_line_split
index.tsx
import config from '@automattic/calypso-config'; import { ReactElement, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { logToLogstash } from 'calypso/lib/logstash'; import StepWrapper from 'calypso/signup/step-wrapper'; import { recordTracksEvent } from 'calypso/state/analytics...
error: failureInfo.error, } ) ); logToLogstash( { feature: 'calypso_client', message: failureInfo.error, severity: config( 'env_id' ) === 'production' ? 'error' : 'debug', blog_id: siteId, properties: { env: config( 'env_id' ), type: 'calypso_woocommerce_dashboard_snag_error', act...
{ const dispatch = useDispatch(); // selectedSiteId is set by the controller whenever site is provided as a query param. const siteId = useSelector( getSelectedSiteId ) as number; const isAtomic = useSelector( ( state ) => isAtomicSite( state, siteId ) ); const domain = useSelector( ( state ) => getSiteDomain( sta...
identifier_body
index.tsx
import config from '@automattic/calypso-config'; import { ReactElement, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { logToLogstash } from 'calypso/lib/logstash'; import StepWrapper from 'calypso/signup/step-wrapper'; import { recordTracksEvent } from 'calypso/state/analytics...
( props: WooCommerceInstallProps ): ReactElement | null { const dispatch = useDispatch(); // selectedSiteId is set by the controller whenever site is provided as a query param. const siteId = useSelector( getSelectedSiteId ) as number; const isAtomic = useSelector( ( state ) => isAtomicSite( state, siteId ) ); con...
Transfer
identifier_name
tasks.py
# -*- coding: utf-8 -*- """ Base version of package/tasks.py, created by version 0.3.0 of package/root/dir> dk-tasklib install (it should reside in the root directory of your package) This file defines tasks for the Invoke tool: http://www.pyinvoke.org Basic usage:: inv -l # list all availabl...
if buildall or js: build_js(ctx, force) if HAVE_SETTINGS and (force or changed(ctx.pkg.django_static)): collectstatic(ctx, DJANGO_SETTINGS_MODULE, force=force) @task def watch(ctx): """Automatically run build whenever a relevant file changes. """ watcher = Watcher(ctx) watch...
if WARN_ABOUT_SETTINGS: warnings.warn( "autodoc might need a dummy settings file in the root of " "your package. Since it runs in a separate process you cannot" "use settings.configure()" ) doctools.build(ctx, force=force)
conditional_block
tasks.py
# -*- coding: utf-8 -*- """ Base version of package/tasks.py, created by version 0.3.0 of package/root/dir> dk-tasklib install (it should reside in the root directory of your package) This file defines tasks for the Invoke tool: http://www.pyinvoke.org Basic usage:: inv -l # list all availabl...
(ctx, less=False, docs=False, js=False, force=False): """Build everything and collectstatic. """ specified = any([less, docs, js]) buildall = not specified if buildall or less: less_fname = ctx.pkg.source_less / ctx.pkg.name + '.less' if less_fname.exists(): lessc.LessRu...
build
identifier_name
tasks.py
# -*- coding: utf-8 -*- """ Base version of package/tasks.py, created by version 0.3.0 of package/root/dir> dk-tasklib install (it should reside in the root directory of your package) This file defines tasks for the Invoke tool: http://www.pyinvoke.org Basic usage:: inv -l # list all availabl...
if buildall or docs: if WARN_ABOUT_SETTINGS: warnings.warn( "autodoc might need a dummy settings file in the root of " "your package. Since it runs in a separate process you cannot" "use settings.configure()" ) doctools.build(ct...
random_line_split
tasks.py
# -*- coding: utf-8 -*- """ Base version of package/tasks.py, created by version 0.3.0 of package/root/dir> dk-tasklib install (it should reside in the root directory of your package) This file defines tasks for the Invoke tool: http://www.pyinvoke.org Basic usage:: inv -l # list all availabl...
if WARN_ABOUT_SETTINGS: warnings.warn( "autodoc might need a dummy settings file in the root of " "your package. Since it runs in a separate process you cannot" "use settings.configure()" ) doctools.build(ctx, force=force) if b...
"""Build everything and collectstatic. """ specified = any([less, docs, js]) buildall = not specified if buildall or less: less_fname = ctx.pkg.source_less / ctx.pkg.name + '.less' if less_fname.exists(): lessc.LessRule( ctx, src='{pkg.source_...
identifier_body
UsersCard.tsx
/** * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
import UserForm from '../UserFormDialog/UserForm'; import { AuthHeader } from './header/AuthHeader'; import UsersTable from './table/UsersTable'; export type UserCardProps = PropsFromDispatch & PropsFromState; export const UsersCard: React.FC<UserCardProps> = ({ openAuthUserDialog, authUserDialogData, }) => { re...
import { RemoteResult, createRemoteDataLoaded } from '../../../store/utils'; import { AuthUser } from '../types';
random_line_split
home.js
/* * Author: Joeri Nicolaes * ====================== */ import 'babel-polyfill'; import React from 'react'; import ReactDom from 'react-dom'; import HomeApp from './HomeApp'; import FooterApp from './FooterApp'; import HeaderApp from './HeaderApp'; // read attribute sent via script and convert String into list o...
<HomeApp userProps={serverConfig.user} loggedInAtStart={serverConfig.loggedIn} availablePois={serverConfig.poiList} availablePoiTypes={serverConfig.poiTypes} reservationStatus={serverConfig.reservationStatus} linktodirections={serverConfig.linktodirections}/>, document.getElementById("content") );
random_line_split
builtin-superkinds-capabilities-transitive.rs
// Copyright 2013 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 ...
trait Foo : Bar { } impl <T: Send> Foo for T { } impl <T: Send> Bar for T { } fn foo<T: Foo>(val: T, chan: comm::Chan<T>) { chan.send(val); } fn main() { let (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
trait Bar : Send { }
random_line_split
builtin-superkinds-capabilities-transitive.rs
// Copyright 2013 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 (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
main
identifier_name
builtin-superkinds-capabilities-transitive.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn main() { let (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
{ chan.send(val); }
identifier_body
login.component.ts
import { Component, OnInit } from "@angular/core"; import { AuthService } from "../../services/auth.service"; import { Router } from "@angular/router"; import { FlashMessagesService } from "angular2-flash-messages"; import { ValidateService } from "../../services/validate.service"; import { User } from "../../models/u...
ngOnInit() {} onLoginSubmit() { if (this.valid(this.username)) { const creds = { username: this.username, password: this.password }; this.authUser(creds); } else { this.flashMessage.show( "Invalid Username: Use Alphanumeric Characters Only", { cssCl...
{}
identifier_body
login.component.ts
import { Component, OnInit } from "@angular/core"; import { AuthService } from "../../services/auth.service"; import { Router } from "@angular/router"; import { FlashMessagesService } from "angular2-flash-messages"; import { ValidateService } from "../../services/validate.service"; import { User } from "../../models/u...
} valid(field: string): boolean { return this.validateService.validateField(field); } authUser(creds: object) { this.authService.authenticateUser(creds).subscribe(data => { if (data.success) { this.authService.storeUserData(data.token, data.user); this.flashMessage.show("Login S...
{ this.flashMessage.show( "Invalid Username: Use Alphanumeric Characters Only", { cssClass: "alert-danger", timeout: 10000 } ); this.router.navigate(["/login"]); }
conditional_block
login.component.ts
import { Component, OnInit } from "@angular/core"; import { AuthService } from "../../services/auth.service"; import { Router } from "@angular/router"; import { FlashMessagesService } from "angular2-flash-messages"; import { ValidateService } from "../../services/validate.service"; import { User } from "../../models/u...
ngOnInit() {} onLoginSubmit() { if (this.valid(this.username)) { const creds = { username: this.username, password: this.password }; this.authUser(creds); } else { this.flashMessage.show( "Invalid Username: Use Alphanumeric Characters Only", { cssCla...
random_line_split
login.component.ts
import { Component, OnInit } from "@angular/core"; import { AuthService } from "../../services/auth.service"; import { Router } from "@angular/router"; import { FlashMessagesService } from "angular2-flash-messages"; import { ValidateService } from "../../services/validate.service"; import { User } from "../../models/u...
() {} onLoginSubmit() { if (this.valid(this.username)) { const creds = { username: this.username, password: this.password }; this.authUser(creds); } else { this.flashMessage.show( "Invalid Username: Use Alphanumeric Characters Only", { cssClass: "alert-...
ngOnInit
identifier_name
layoutwidget.py
class LayoutWidget: """ All top-level layout widgets and all widgets that may be set in an overlay must comply with this API. """ # Title is only required for windows, not overlay components title = "" keyctx = "" def
(self): """ Returns the object responding to key input. Usually self, but may be a wrapped object. """ return self def focus_changed(self): """ The view focus has changed. Layout objects should implement the API rather than directly su...
key_responder
identifier_name