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 |
|---|---|---|---|---|
grin.rs | as secp;
use std::thread;
use std::io::Read;
use std::fs::File;
use std::time::Duration;
use clap::{Arg, App, SubCommand, ArgMatches};
use daemonize::Daemonize;
use secp::Secp256k1;
use config::GlobalConfig;
use wallet::WalletConfig;
use core::global;
fn start_from_config_file(mut global_config: GlobalConfig) {
... |
if server_args.is_present("mine") {
server_config.mining_config.as_mut().unwrap().enable_mining = true;
}
if let Some(wallet_url) = server_args.value_of("wallet_url") {
server_config
.mining_config
.as_mut()
.unwrap()
.wallet_receiver_url = wallet_url.to_string();
}
if let Some(seeds) = server_... | {
let default_ip = "127.0.0.1";
server_config.api_http_addr = format!("{}:{}", default_ip, api_port);
} | conditional_block |
grin.rs | as secp;
use std::thread;
use std::io::Read;
use std::fs::File;
use std::time::Duration;
use clap::{Arg, App, SubCommand, ArgMatches};
use daemonize::Daemonize;
use secp::Secp256k1;
use config::GlobalConfig;
use wallet::WalletConfig;
use core::global;
fn start_from_config_file(mut global_config: GlobalConfig) {
... | .takes_value(true))))
.get_matches();
match args.subcommand() {
// server commands and options
("server", Some(server_args)) => {
server_command(server_args);
}
// client commands and options
("client", Some(client_args)) => {
match client_args.subcommand() {
... | .index(1))
.arg(Arg::with_name("dest")
.help("Send the transaction to the provided server")
.short("d")
.long("dest") | random_line_split |
control_area.py | #------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | # Virtual property. The generating unit specificaitons for the control area.
pass # control_area_generating_unit
# >>> control_area.references
# <<< control_area.operations
# @generated
# >>> control_area.operations
# EOF --------------------------------------------------------------------... | """ A <b>control area </b>is a grouping of <b>generating units</b> and/or loads and a cutset of tie lines (as <b>terminals</b>) which may be used for a variety of purposes including automatic generation control, powerflow solution area interchange control specification, and input to load forecasting. Note that any nu... | identifier_body |
control_area.py | #------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#----------------------... | # ANY WARRANTY; without even the implied warranty of MERCHANDABILITY or FITNESS | random_line_split |
control_area.py | #------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | (IdentifiedObject):
""" A <b>control area </b>is a grouping of <b>generating units</b> and/or loads and a cutset of tie lines (as <b>terminals</b>) which may be used for a variety of purposes including automatic generation control, powerflow solution area interchange control specification, and input to load forecas... | ControlArea | identifier_name |
startup_ip.py | import subprocess
import smtplib | from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'rk.ryan.king@gmail.com'
gmail_user = 'rk.ryan.king@gmail.com'
gmail_password = 'nzwaahcmdzjchxsz'
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(... | import socket | random_line_split |
technique_sid_target.py |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | # To pass intermediate you need to pass basic, this object could also include additional
# tests that were specific to the intermediate badge.
def JudgeSuperior(self, context):
# if baseline fails, no point in further checking
if (self.status_baseline == False):
self.status... | def __init__(self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
self.attrVal = _attrVal
self.dataToCheck = _data
self.status_baseline = False
self.status_superior = False
self.status_exemplary = False
self.... | identifier_body |
technique_sid_target.py | # Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... |
class SimpleJudgingObject:
def __init__(self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
self.attrVal = _attrVal
self.dataToCheck = _data
self.status_baseline = False
self.status_superior = False
self.statu... | tagLst = ['library_materials', 'material', 'extra', 'technique']
attrName = 'profile'
attrVal = ''
dataToCheck = ''
| random_line_split |
technique_sid_target.py |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | (self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
self.attrVal = _attrVal
self.dataToCheck = _data
self.status_baseline = False
self.status_superior = False
self.status_exemplary = False
self.__assistant ... | __init__ | identifier_name |
technique_sid_target.py |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... |
if ( self.__assistant.CompareRenderedImages(context) ):
self.__assistant.CompareImagesAgainst(context, "_reference_material_extra_element_names")
# Check for preservation of element data
self.__assistant.FullPreservation(context, self.tagList, self.attrName)
... | self.status_superior = self.status_baseline
return self.status_superior | conditional_block |
ConstructorStartCommand.ts | import { Command } from "./Command";
import { CommandResult } from "./CommandResult";
import { LineResults } from "./LineResults";
import { Parameter } from "./Parameters/Parameter";
import { RepeatingParameters } from "./Parameters/RepeatingParameters";
import { SingleParameter } from "./Parameters/SingleParameter";
... |
if (this.language.properties.classes.constructorUsesKeyword) {
declaration += this.language.properties.classes.constructorKeyword;
} else {
declaration += parameters[1];
}
declaration += "(";
if (this.language.properties.classes.constructorTakesThis) {
... | let declaration: string = "";
let output: CommandResult[]; | random_line_split |
ConstructorStartCommand.ts | import { Command } from "./Command";
import { CommandResult } from "./CommandResult";
import { LineResults } from "./LineResults";
import { Parameter } from "./Parameters/Parameter";
import { RepeatingParameters } from "./Parameters/RepeatingParameters";
import { SingleParameter } from "./Parameters/SingleParameter";
... |
}
declaration += ")";
output = [new CommandResult(declaration, 0)];
this.addLineEnder(output, this.language.properties.functions.defineStartRight, 1);
return new LineResults(output, false);
}
/**
* Generates a string for a parameter.
*
* @param parame... | {
declaration += ", ";
declaration += this.generateParameterVariable(parameters, i);
} | conditional_block |
ConstructorStartCommand.ts | import { Command } from "./Command";
import { CommandResult } from "./CommandResult";
import { LineResults } from "./LineResults";
import { Parameter } from "./Parameters/Parameter";
import { RepeatingParameters } from "./Parameters/RepeatingParameters";
import { SingleParameter } from "./Parameters/SingleParameter";
... | if (parameters.length > 3) {
declaration += this.generateParameterVariable(parameters, 2);
for (let i: number = 4; i < parameters.length; i += 2) {
declaration += ", ";
declaration += this.generateParameterVariable(parameters, i);
}
}
... | {
let declaration: string = "";
let output: CommandResult[];
if (this.language.properties.classes.constructorUsesKeyword) {
declaration += this.language.properties.classes.constructorKeyword;
} else {
declaration += parameters[1];
}
declaration +... | identifier_body |
ConstructorStartCommand.ts | import { Command } from "./Command";
import { CommandResult } from "./CommandResult";
import { LineResults } from "./LineResults";
import { Parameter } from "./Parameters/Parameter";
import { RepeatingParameters } from "./Parameters/RepeatingParameters";
import { SingleParameter } from "./Parameters/SingleParameter";
... | (parameters: string[]): LineResults {
let declaration: string = "";
let output: CommandResult[];
if (this.language.properties.classes.constructorUsesKeyword) {
declaration += this.language.properties.classes.constructorKeyword;
} else {
declaration += parameters[... | render | identifier_name |
0022_add_activity_types.py | # Generated by Django 3.0.9 on 2020-08-16 20:47
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [ | operations = [
migrations.CreateModel(
name='ActivityType',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
('group', models.ForeignKey(on_de... | ('groups', '0042_auto_20200507_1258'),
('activities', '0021_remove_activity_feedback_as_sum'),
]
| random_line_split |
0022_add_activity_types.py | # Generated by Django 3.0.9 on 2020-08-16 20:47
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class | (migrations.Migration):
dependencies = [
('groups', '0042_auto_20200507_1258'),
('activities', '0021_remove_activity_feedback_as_sum'),
]
operations = [
migrations.CreateModel(
name='ActivityType',
fields=[
('id', models.AutoField(primary_key... | Migration | identifier_name |
0022_add_activity_types.py | # Generated by Django 3.0.9 on 2020-08-16 20:47
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
| 'abstract': False,
},
),
migrations.AddField(
model_name='activity',
name='activity_type',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='activities.ActivityType'),
),
... | dependencies = [
('groups', '0042_auto_20200507_1258'),
('activities', '0021_remove_activity_feedback_as_sum'),
]
operations = [
migrations.CreateModel(
name='ActivityType',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
... | identifier_body |
AllTests.py | # Copyright (C) 2014 Adam Schubert <adam.schubert@sg1-game.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
# (at your option) any later version.
#
# Th... | # along with this program. If not, see <http://www.gnu.org/licenses/>.
__author__="Adam Schubert <adam.schubert@sg1-game.net>"
__date__ ="$12.10.2014 1:49:02$"
from tests.UserTest import *
from tests.ApiTest import *
from tests.ClanTest import *
from tests.CharacterTest import *
from tests.ServerTest import *
from t... | # 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.
#
# You should have received a copy of the GNU General Public License | random_line_split |
eth_filter.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | (client: &Arc<C>, miner: &Arc<M>) -> Self {
EthFilterClient {
client: Arc::downgrade(client),
miner: Arc::downgrade(miner),
polls: Mutex::new(PollManager::new()),
}
}
fn active(&self) -> Result<(), Error> {
// TODO: only call every 30s at most.
take_weak!(self.client).keep_alive();
Ok(())
}
}
im... | new | identifier_name |
eth_filter.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
let logs = limit_logs(logs, filter.limit);
Ok(logs)
},
// just empty array
_ => Ok(Vec::new()),
}
}
fn uninstall_filter(&self, index: Index) -> Result<bool, Error> {
try!(self.active());
self.polls.lock().remove_poll(&index.value());
Ok(true)
}
}
| {
let best_block = take_weak!(self.client).chain_info().best_block_number;
logs.extend(pending_logs(&*take_weak!(self.miner), best_block, &filter));
} | conditional_block |
eth_filter.rs | // Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... | use std::sync::{Arc, Weak};
use std::collections::HashSet;
use jsonrpc_core::*;
use ethcore::miner::MinerService;
use ethcore::filter::Filter as EthcoreFilter;
use ethcore::client::{BlockChainClient, BlockID};
use util::Mutex;
use v1::traits::EthFilter;
use v1::types::{BlockNumber, Index, Filter, FilterChanges, Log, H2... | //! Eth Filter RPC implementation
| random_line_split |
metavelvet.py | ##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... |
except OSError, err:
raise EasyBuildError("Copying %s to installation dir %s failed: %s", srcfile, destdir, err)
def sanity_check_step(self):
"""Custom sanity check for MetaVelvet."""
custom_paths = {
'files': ['bin/meta-velvetg'],
... | srcfile = os.path.join(srcdir, filename)
shutil.copy2(srcfile, destdir) | conditional_block |
metavelvet.py | ##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... |
def install_step(self):
"""
Install by copying files to install dir
"""
srcdir = self.cfg['start_dir']
destdir = os.path.join(self.installdir, 'bin')
srcfile = None
# Get executable files: for i in $(find . -maxdepth 1 -type f -perm +111 -print | sed -e 's/\... | """
No configure
"""
pass | identifier_body |
metavelvet.py | ##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... |
class EB_MetaVelvet(ConfigureMake):
"""
Support for building MetaVelvet
"""
def configure_step(self):
"""
No configure
"""
pass
def install_step(self):
"""
Install by copying files to install dir
"""
srcdir = self.cfg['start_dir']
... | from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.build_log import EasyBuildError
| random_line_split |
metavelvet.py | ##
# This file is an EasyBuild reciPY as per https://github.com/hpcugent/easybuild
#
# Copyright:: Copyright 2012-2017 Uni.Lu/LCSB, NTUA
# Authors:: Cedric Laczny <cedric.laczny@uni.lu>, Fotis Georgatos <fotis@cern.ch>, Kenneth Hoste
# License:: MIT/GPL
# $Id$
#
# This work implements a part of the HPCBIOS project ... | (self):
"""
No configure
"""
pass
def install_step(self):
"""
Install by copying files to install dir
"""
srcdir = self.cfg['start_dir']
destdir = os.path.join(self.installdir, 'bin')
srcfile = None
# Get executable files: for ... | configure_step | identifier_name |
GetWebPage.py | from urllib.request import urlopen
for line in urlopen('https://secure.ecs.soton.ac.uk/status/'):
line = line.decode('utf-8') # Decoding the binary data to text.
if 'Core Priority Devices' in line: #look for 'Core Priority Devices' To find the line of text with the list of issues
linesIWant = line.spl... | logfile.writelines(issues)
logfile.close() | logfile=open('newlog.txt','w') | random_line_split |
GetWebPage.py | from urllib.request import urlopen
for line in urlopen('https://secure.ecs.soton.ac.uk/status/'):
line = line.decode('utf-8') # Decoding the binary data to text.
if 'Core Priority Devices' in line: #look for 'Core Priority Devices' To find the line of text with the list of issues
linesIWant = line.spl... |
logfile=open('newlog.txt','w')
logfile.writelines(issues)
logfile.close()
| if 'machine' in f:
machineName=f.split('<b>')[1].split('</b>')[0]
if 'state_2' in f:
service=f.split('<td>')[2].split('</td>')[0]
problem=f.split('<td>')[3].split('</td>')[0]
issues.append(service+','+machineName+','+problem+'\n')
elif 'sta... | conditional_block |
jquery.ui.datepicker-ms.min.js | /*! jQuery UI - v1.10.2 - 2013-03-14 | }); | * http://jqueryui.com
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
jQuery(function (e) {
e.datepicker.regional.ms = {closeText: "Tutup", prevText: "<Sebelum", nextText: "Selepas>", currentText: "hari ini", monthNames: ["Januari", "Februari", "Mac", "April", "Mei", "Jun", "J... | random_line_split |
ChannelTableContents.ts |
export default gql`
query ChannelTableContentsSet(
$id: ID!
$page: Int!
$per: Int!
$sort: Sorts
$direction: SortDirection
$type: ConnectableTypeEnum
$user_id: ID
$includeConnection: Boolean!
) {
channel(id: $id) {
__typename
id
counts {
contents(type: $... | import { gql } from '@apollo/client'
import { connectableContextMenuChannelFragment } from 'v2/components/ConnectableContextMenu/fragments/connectableContextMenu'
import { tableRowFragment } from 'v2/components/Table/fragments/tableRow' | random_line_split | |
01c_quick_example.rs | #[macro_use]
extern crate clap;
fn main() | // > A list flag
// = Uses "-l" (usage is "$ myapp test -l"
// > A help flag (automatically generated by clap
// = Uses "-h" or "--help" (full usage "$ myapp test -h" or "$ myapp test --help")
// > A version flag (automatically generated... | {
// This example shows how to create an application with several arguments using macro builder.
// It combines the simplicity of the from_usage methods and the performance of the Builder Pattern.
//
// The example below is functionally identical to the one in 01a_quick_example.rs and 01b_quick_example.... | identifier_body |
01c_quick_example.rs | #[macro_use]
extern crate clap;
fn main() {
// This example shows how to create an application with several arguments using macro builder.
// It combines the simplicity of the from_usage methods and the performance of the Builder Pattern.
//
// The example below is functionally identical to the one in ... | (author: "Kevin K. <kbknapp@gmail.com>")
(about: "Does awesome things")
(@arg CONFIG: -c --config +takes_value "Sets a custom config file")
(@arg INPUT: +required "Sets the input file to use")
(@arg debug: -d ... "Sets the level of debugging information")
(@subcommand tes... | random_line_split | |
01c_quick_example.rs | #[macro_use]
extern crate clap;
fn main() {
// This example shows how to create an application with several arguments using macro builder.
// It combines the simplicity of the from_usage methods and the performance of the Builder Pattern.
//
// The example below is functionally identical to the one in ... |
}
// more program logic goes here...
}
| {
println!("Printing normally...");
} | conditional_block |
01c_quick_example.rs | #[macro_use]
extern crate clap;
fn | () {
// This example shows how to create an application with several arguments using macro builder.
// It combines the simplicity of the from_usage methods and the performance of the Builder Pattern.
//
// The example below is functionally identical to the one in 01a_quick_example.rs and 01b_quick_examp... | main | identifier_name |
pt.js | /*! Element Plus v2.0.3 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ElementPlusLocalePt... | noData: "Sem dados"
},
pagination: {
goto: "Ir para",
pagesize: "/pagina",
total: "Total {total}",
pageClassifier: ""
},
messagebox: {
title: "Mensagem",
confirm: "Confirmar",
cancel: "Cancelar",
error: "Erro!"
},
... | noMatch: "Sem correspond\xEAncia",
loading: "A carregar",
placeholder: "Selecione", | random_line_split |
revertExplorer.ts | import { Uri, window } from "vscode";
import { checkAndPromptDepth, confirmRevert } from "../input/revert";
import { Command } from "./command";
export class | extends Command {
constructor() {
super("svn.revertExplorer");
}
public async execute(_mainUri?: Uri, allUris?: Uri[]) {
if (!allUris) {
return;
}
const uris = allUris;
if (uris.length === 0 || !(await confirmRevert())) {
return;
}
const depth = await checkAndPromptDept... | RevertExplorer | identifier_name |
revertExplorer.ts | import { Uri, window } from "vscode";
import { checkAndPromptDepth, confirmRevert } from "../input/revert"; |
export class RevertExplorer extends Command {
constructor() {
super("svn.revertExplorer");
}
public async execute(_mainUri?: Uri, allUris?: Uri[]) {
if (!allUris) {
return;
}
const uris = allUris;
if (uris.length === 0 || !(await confirmRevert())) {
return;
}
const dept... | import { Command } from "./command"; | random_line_split |
revertExplorer.ts | import { Uri, window } from "vscode";
import { checkAndPromptDepth, confirmRevert } from "../input/revert";
import { Command } from "./command";
export class RevertExplorer extends Command {
constructor() {
super("svn.revertExplorer");
}
public async execute(_mainUri?: Uri, allUris?: Uri[]) {
if (!allUr... |
const paths = resources.map(resource => resource.fsPath);
try {
await repository.revert(paths, depth);
} catch (error) {
console.log(error);
window.showErrorMessage("Unable to revert");
}
});
}
}
| {
return;
} | conditional_block |
grids.js | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err;... | (_ref) {
var scene = _ref.scene;
var width = scene.width,
height = scene.height,
grids = scene.grids;
var renderedGrids = grids.entrySeq().map(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
gridID = _ref3[0],
grid = _ref3[1];
switch (grid.type) {
case 'horizo... | Grids | identifier_name |
grids.js | var _slicedToArray = function () { function sliceIterator(arr, i) | return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
import React from 'react';
import PropTypes from 'prop-types';
import GridHorizont... | { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } fina... | identifier_body |
grids.js | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err;... |
return React.createElement(
'g',
null,
renderedGrids
);
}
Grids.propTypes = {
scene: PropTypes.object.isRequired
}; | console.warn('grid ' + grid.type + ' not allowed');
}
}).toList(); | random_line_split |
dictionary.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 http://opensource.org/licenses/MIT>, at ... |
value.unwrap()
}
/// A convenience function to retrieve `CFType` instances.
#[inline]
pub unsafe fn get_CFType(&self, key: *const c_void) -> CFType {
let value: CFTypeRef = mem::transmute(self.get(key));
TCFType::wrap_under_get_rule(value)
}
}
#[link(name = "CoreFoundation... | {
panic!("No entry found for key {:p}", key);
} | conditional_block |
dictionary.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 http://opensource.org/licenses/MIT>, at ... | (&self, key: *const c_void) -> *const c_void {
let value = self.find(key);
if value.is_none() {
panic!("No entry found for key {:p}", key);
}
value.unwrap()
}
/// A convenience function to retrieve `CFType` instances.
#[inline]
pub unsafe fn get_CFType(&self,... | get | identifier_name |
dictionary.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 http://opensource.org/licenses/MIT>, at ... |
#[inline]
pub fn find(&self, key: *const c_void) -> Option<*const c_void> {
unsafe {
let mut value: *const c_void = ptr::null();
if CFDictionaryGetValueIfPresent(self.obj, key, &mut value) != 0 {
Some(value)
} else {
None
... | {
unsafe {
CFDictionaryContainsKey(self.obj, key) != 0
}
} | identifier_body |
dictionary.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 http://opensource.org/licenses/MIT>, at ... |
#[inline]
unsafe fn wrap_under_get_rule(reference: CFDictionaryRef) -> CFDictionary {
let reference: CFDictionaryRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
... | } | random_line_split |
formatting.js | (function() {
CodeMirror.extendMode("css", {
commentStart: "/*",
commentEnd: "*/",
newlineAfterToken: function(type, content) {
return /^[;{}]$/.test(content);
}
});
CodeMirror.extendMode("javascript", {
commentStart: "/*",
commentEnd: "*/",
... | () {
out += "\n";
atSol = true;
++lines;
}
for (var i = 0; i < text.length; ++i) {
var stream = new CodeMirror.StringStream(text[i], tabSize);
while (!stream.eol()) {
var inner = CodeMirror.innerMode(outer, state);
... | newline | identifier_name |
formatting.js | (function() {
CodeMirror.extendMode("css", {
commentStart: "/*",
commentEnd: "*/",
newlineAfterToken: function(type, content) {
return /^[;{}]$/.test(content);
}
});
CodeMirror.extendMode("javascript", {
commentStart: "/*",
commentEnd: "*/",
... |
for (var i = 0; i < text.length; ++i) {
var stream = new CodeMirror.StringStream(text[i], tabSize);
while (!stream.eol()) {
var inner = CodeMirror.innerMode(outer, state);
var style = outer.token(stream, state), cur = stream.current();
st... | {
out += "\n";
atSol = true;
++lines;
} | identifier_body |
formatting.js | (function() {
CodeMirror.extendMode("css", {
commentStart: "/*",
commentEnd: "*/",
newlineAfterToken: function(type, content) {
return /^[;{}]$/.test(content);
}
});
CodeMirror.extendMode("javascript", {
commentStart: "/*",
commentEnd: "*/",
... | out += "\n";
atSol = true;
++lines;
}
for (var i = 0; i < text.length; ++i) {
var stream = new CodeMirror.StringStream(text[i], tabSize);
while (!stream.eol()) {
var inner = CodeMirror.innerMode(outer, state);
v... | function newline() { | random_line_split |
evaluation.js | import {
NEXT_STEP,
PREVIOUS_STEP,
PREPARE_EVALUATION,
SUBMIT_RESULT,
SHOW_CONFIRM_DIALOG,
CLOSE_CONFIRM_DIALOG
} from '../actions/evaluation'; | function evaluation(state = {}, action) {
switch(action.type) {
case PREPARE_EVALUATION:
return Object.assign({}, state, {
totalStep: action.totalStep,
stepCounts: action.stepCounts,
content: action.content,
question: action.question,
step: action.step,
tracks: action.tracks... | random_line_split | |
evaluation.js |
import {
NEXT_STEP,
PREVIOUS_STEP,
PREPARE_EVALUATION,
SUBMIT_RESULT,
SHOW_CONFIRM_DIALOG,
CLOSE_CONFIRM_DIALOG
} from '../actions/evaluation';
function | (state = {}, action) {
switch(action.type) {
case PREPARE_EVALUATION:
return Object.assign({}, state, {
totalStep: action.totalStep,
stepCounts: action.stepCounts,
content: action.content,
question: action.question,
step: action.step,
tracks: action.tracks,
initialValu... | evaluation | identifier_name |
evaluation.js |
import {
NEXT_STEP,
PREVIOUS_STEP,
PREPARE_EVALUATION,
SUBMIT_RESULT,
SHOW_CONFIRM_DIALOG,
CLOSE_CONFIRM_DIALOG
} from '../actions/evaluation';
function evaluation(state = {}, action) | case SUBMIT_RESULT:
return Object.assign({}, state, {
results: action.results
});
case SHOW_CONFIRM_DIALOG:
return Object.assign({}, state, {
showConfirmDialog: true
});
case CLOSE_CONFIRM_DIALOG:
return Object.assign({}, state, {
showConfirmDialog: false
});
default:
... | {
switch(action.type) {
case PREPARE_EVALUATION:
return Object.assign({}, state, {
totalStep: action.totalStep,
stepCounts: action.stepCounts,
content: action.content,
question: action.question,
step: action.step,
tracks: action.tracks,
initialValues: action.initValues... | identifier_body |
views.py | #
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF T... |
gigapans = ["/gigapan/%d" % int(gigapan_id) for gigapan_id in ids]
proxies = settings.GIGAPAN_PROXIES
blaster = getattr(settings, 'GIGAPAN_BLASTER', None)
if len(proxies) > len(gigapans):
mapping = {} # gigapan -> [proxy]
gigapan_index = 0
for proxy in proxies:
mapp... | return 'http://%s:5873%s' % (settings.GIGAPAN_SERVER, gigapan) | identifier_body |
views.py | #
# The OpenDiamond Platform for Interactive Search | # Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS SOFTWARE CONSTITUTES
# RECIPIENT'S ACCEPTANCE OF T... | # | random_line_split |
views.py | #
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF T... | (gigapan):
return 'http://%s:5873%s' % (settings.GIGAPAN_SERVER, gigapan)
gigapans = ["/gigapan/%d" % int(gigapan_id) for gigapan_id in ids]
proxies = settings.GIGAPAN_PROXIES
blaster = getattr(settings, 'GIGAPAN_BLASTER', None)
if len(proxies) > len(gigapans):
mapping = {} # gigapan ->... | full_url | identifier_name |
views.py | #
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF T... |
else:
url = "http://api.gigapan.org/beta/gigapans/page/1/matching/"
url += "%s/most_popular.json" % quote_plus(query)
text = str(urlopen(url).read())
data = json.loads(text)
ids = [id for id, _ in data[u'items']]
if ids:
choicefor... | api_url = ('http://api.gigapan.org/beta/gigapans/%d.json' %
int(query))
try:
# Check that the ID is valid
urlopen(api_url)
ids = [query]
except HTTPError:
ids = [] | conditional_block |
range_value_accessor.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 {Directive, ElementRef, Renderer2, StaticProvider, forwardRef} from '@angular/core';
import {ControlValueAcc... | useExisting: forwardRef(() => RangeValueAccessor),
multi: true
};
/**
* The accessor for writing a range value and listening to changes that is used by the
* `NgModel`, `FormControlDirective`, and `FormControlName` directives.
*
* ### Example
* ```
* <input type="range" [(ngModel)]="age" >
* ```
*/
@Di... | export const RANGE_VALUE_ACCESSOR: StaticProvider = {
provide: NG_VALUE_ACCESSOR, | random_line_split |
range_value_accessor.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 {Directive, ElementRef, Renderer2, StaticProvider, forwardRef} from '@angular/core';
import {ControlValueAcc... |
setDisabledState(isDisabled: boolean): void {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
}
}
| { this.onTouched = fn; } | identifier_body |
range_value_accessor.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 {Directive, ElementRef, Renderer2, StaticProvider, forwardRef} from '@angular/core';
import {ControlValueAcc... | implements ControlValueAccessor {
onChange = (_: any) => {};
onTouched = () => {};
constructor(private _renderer: Renderer2, private _elementRef: ElementRef) {}
writeValue(value: any): void {
this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value));
}
registerOnChange(f... | RangeValueAccessor | identifier_name |
autotranslate.py | #
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | self.component_update(component)
| n
| conditional_block |
autotranslate.py | #
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | Addon):
events = (EVENT_COMPONENT_UPDATE, EVENT_DAILY)
name = "weblate.autotranslate.autotranslate"
verbose = _("Automatic translation")
description = _(
"Automatically translates strings using machine translation or "
"other components."
)
settings_form = AutoAddonForm
multi... | ranslateAddon(Base | identifier_name |
autotranslate.py | #
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | ttings.BACKGROUND_TASKS == "never":
return
today = date.today()
if settings.BACKGROUND_TASKS == "monthly" and component.id % 30 != today.day:
return
if (
settings.BACKGROUND_TASKS == "weekly"
and component.id % 7 != today.weekday()
):
... | identifier_body | |
autotranslate.py | #
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | )
)
def daily(self, component):
# Translate every component less frequenctly to reduce load.
# The translation is anyway triggered on update, so it should
# not matter that much that we run this less often.
if settings.BACKGROUND_TASKS == "never":
ret... |
def component_update(self, component):
transaction.on_commit(
lambda: auto_translate_component.delay(
component.pk, **self.instance.configuration | random_line_split |
mod.rs | // Copyright (C) 2020 Markus Ebner <info@ebner-markus.de>
//
// 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distrib... | {
gst::Element::register(
Some(plugin),
"gifenc",
gst::Rank::Primary,
GifEnc::static_type(),
)
} | identifier_body | |
mod.rs | // Copyright (C) 2020 Markus Ebner <info@ebner-markus.de>
// | // 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use glib::prelude::... | random_line_split | |
mod.rs | // Copyright (C) 2020 Markus Ebner <info@ebner-markus.de>
//
// 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distrib... | (plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(
Some(plugin),
"gifenc",
gst::Rank::Primary,
GifEnc::static_type(),
)
}
| register | identifier_name |
index.ts | // Make sure the Acorn Parser (used by Webpack) can parse ES-Stage3 code
// This must be at the top BEFORE webpack is loaded so that we can extend
// and replace the parser before webpack uses it
// Based on the issue: https://github.com/webpack/webpack/issues/10216
import stage3 from 'acorn-stage3';
// we use require... |
// apply configs from dependencies
// todo: allow opt-out
applyExternalConfigs();
webpackChains
.splice(0)
.sort((a, b) => {
return a.order - b.order;
})
.forEach(({ chainFn, plugin }) => {
try {
chainFn(config, env);
} catch (err) {
if (plugin) {
// catch and print errors from plug... | {
useConfig(determineProjectFlavor());
} | conditional_block |
index.ts | // Make sure the Acorn Parser (used by Webpack) can parse ES-Stage3 code
// This must be at the top BEFORE webpack is loaded so that we can extend
// and replace the parser before webpack uses it
// Based on the issue: https://github.com/webpack/webpack/issues/10216
import stage3 from 'acorn-stage3';
// we use require... | (_env: IWebpackEnv) {
hasInitialized = true;
if (_env) {
env = _env;
}
}
/**
* Explicitly specify the base config to use.
* Calling this will opt-out from automatic flavor detection.
*
* Useful when the flavor cannot be detected due to the project structure
* for example in a custom monorepo.
*
* @param co... | init | identifier_name |
index.ts | // Make sure the Acorn Parser (used by Webpack) can parse ES-Stage3 code
// This must be at the top BEFORE webpack is loaded so that we can extend
// and replace the parser before webpack uses it
// Based on the issue: https://github.com/webpack/webpack/issues/10216
import stage3 from 'acorn-stage3';
// we use require... | return config;
} | random_line_split | |
index.ts | // Make sure the Acorn Parser (used by Webpack) can parse ES-Stage3 code
// This must be at the top BEFORE webpack is loaded so that we can extend
// and replace the parser before webpack uses it
// Based on the issue: https://github.com/webpack/webpack/issues/10216
import stage3 from 'acorn-stage3';
// we use require... |
/**
* Merge an object into the resolved chain config.
*
* @param mergeFn An object or a function that optionally returns an object (can mutate the object directly and return nothing)
*/
export function mergeWebpack(
mergeFn: (
config: Partial<webpack.Configuration>,
env: IWebpackEnv
) => any | Partial<webpa... | {
webpackChains.push({
order: options?.order || 0,
chainFn,
plugin: currentPlugin,
});
} | identifier_body |
TestWatchpointConditionAPI.py | """
Test watchpoint condition API.
"""
import os, time
import unittest2
import lldb
import lldbutil
from lldbtest import *
class WatchpointConditionAPITestCase(TestBase):
mydir = os.path.join("python_api", "watchpoint", "condition")
def setUp(self):
# Call super's setUp().
TestBase.setUp(sel... | (self):
"""Do watchpoint condition API to set condition as 'global==5'."""
exe = os.path.join(os.getcwd(), self.exe_name)
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c.
... | watchpoint_condition_api | identifier_name |
TestWatchpointConditionAPI.py | """
Test watchpoint condition API.
"""
import os, time
import unittest2
import lldb
import lldbutil
from lldbtest import *
class WatchpointConditionAPITestCase(TestBase):
| self.setTearDownCleanup(dictionary=self.d)
self.watchpoint_condition_api()
@expectedFailureFreeBSD('llvm.org/pr16706') # Watchpoints fail on FreeBSD
@dwarf_test
def test_watchpoint_cond_api_with_dwarf(self):
"""Test watchpoint condition API."""
self.buildDwarf(dictionary=sel... | mydir = os.path.join("python_api", "watchpoint", "condition")
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
self.line = line_number(self.source, '// ... | identifier_body |
TestWatchpointConditionAPI.py | """
Test watchpoint condition API.
"""
import os, time
import unittest2
import lldb
import lldbutil
from lldbtest import *
class WatchpointConditionAPITestCase(TestBase):
mydir = os.path.join("python_api", "watchpoint", "condition")
def setUp(self):
# Call super's setUp().
TestBase.setUp(sel... |
# Now create a breakpoint on main.c.
breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at t... | # Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET) | random_line_split |
TestWatchpointConditionAPI.py | """
Test watchpoint condition API.
"""
import os, time
import unittest2
import lldb
import lldbutil
from lldbtest import *
class WatchpointConditionAPITestCase(TestBase):
mydir = os.path.join("python_api", "watchpoint", "condition")
def setUp(self):
# Call super's setUp().
TestBase.setUp(sel... | import atexit
lldb.SBDebugger.Initialize()
atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest2.main() | conditional_block | |
view-admin-add-users.component.ts | import { Component, OnInit } from '@angular/core';
import { LoginService } from '../../services/login.service';
import { BackendService } from '../../services/backend.service';
import { Router } from '@angular/router';
import { SidePanelGroupsComponent } from '../../bars/side-panel-groups/side-panel-groups.component';
... |
if(flag==false){
this.inactiveUsers[count_inactive]=this.receivedUsers[i];
count_inactive++;
}
}
}
handleGroupChosen(x:Group){
this.activeUsers=[];
this.inactiveUsers=[];
this.chosenGroup=x;
this._backendService.getActiveUsers(x.id)
.subscribe(response=>... | {
if(j==0) {flag=false;}
if (this.receivedUsers[i].id==this.receivedActiveUsers[j].id)
{
this.activeUsers[count_active]=this.receivedActiveUsers[j];
count_active++;
flag=true;
}
} | conditional_block |
view-admin-add-users.component.ts | import { Component, OnInit } from '@angular/core';
import { LoginService } from '../../services/login.service';
import { BackendService } from '../../services/backend.service';
import { Router } from '@angular/router';
import { SidePanelGroupsComponent } from '../../bars/side-panel-groups/side-panel-groups.component';
... | this.divideUsers();
error=>{
alert(error);
};
});
}
delete(i:number){
var user=this.activeUsers[i];
this._backendService.removeUserFromGroup(user.id,this.chosenGroup.id).subscribe(response=>
{
this.inactiveUsers=[];
this.activeUse... | this.receivedActiveUsers=response; | random_line_split |
view-admin-add-users.component.ts | import { Component, OnInit } from '@angular/core';
import { LoginService } from '../../services/login.service';
import { BackendService } from '../../services/backend.service';
import { Router } from '@angular/router';
import { SidePanelGroupsComponent } from '../../bars/side-panel-groups/side-panel-groups.component';
... |
add(i:number){
var user=this.inactiveUsers[i];
this._backendService.addUserToGroup(user.id,this.chosenGroup.id)
.subscribe(response=>
{
this.inactiveUsers=[];
this.activeUsers=[];
this.handleGroupChosen(this.chosenGroup);
});
/*
this.inactiv... | {
var user=this.activeUsers[i];
this._backendService.removeUserFromGroup(user.id,this.chosenGroup.id).subscribe(response=>
{
this.inactiveUsers=[];
this.activeUsers=[];
this.handleGroupChosen(this.chosenGroup);
});
// this.activeUsers.splice(i,1);
// thi... | identifier_body |
view-admin-add-users.component.ts | import { Component, OnInit } from '@angular/core';
import { LoginService } from '../../services/login.service';
import { BackendService } from '../../services/backend.service';
import { Router } from '@angular/router';
import { SidePanelGroupsComponent } from '../../bars/side-panel-groups/side-panel-groups.component';
... | (x:Group){
this.activeUsers=[];
this.inactiveUsers=[];
this.chosenGroup=x;
this._backendService.getActiveUsers(x.id)
.subscribe(response=>{
this.receivedActiveUsers=response;
this.divideUsers();
error=>{
alert(error);
};
});
}
delete(i:numbe... | handleGroupChosen | identifier_name |
Utils.js | /**
* Slices arrays.
* @param array
* @param pos
* @returns {string}
*/
var arraySlicer = function (array, pos) {
return array.slice(0, pos).concat(array.slice(pos + 1, array.length));
};
/**
* https://en.wikipedia.org/wiki/Cosine_similarity
* https://en.wikipedia.org/wiki/Canberra_distance
* https://en.w... | r1, arr2) {
var INTERVAL = 70;
/*var sum1 = 0;
var sum2 = 0;
var sum3 = 0;
var canberra = 0;
var Czekanowski1 = 0;
var Czekanowski2 = 0;
*/
var intervalCount = 0;
for (var i = 0; i < arr1.length && i < arr2.length; i++) {
/*sum1 += arr1[i] * arr2[i];
sum2... | tanceFunction(ar | identifier_name |
Utils.js | /**
* Slices arrays.
* @param array
* @param pos
* @returns {string}
*/
var arraySlicer = function (array, pos) {
return array.slice(0, pos).concat(array.slice(pos + 1, array.length));
};
/**
* https://en.wikipedia.org/wiki/Cosine_similarity
* https://en.wikipedia.org/wiki/Canberra_distance
* https://en.w... | */
if (Math.abs(arr1[i] - arr2[i]) > INTERVAL) {
intervalCount++;
}
}
/*var similarity = (sum1 / (Math.sqrt(sum2) * Math.sqrt(sum3)));
var distance = Math.acos(similarity) * 2 / Math.PI;
var Sørensen = (2 * Czekanowski1) / Czekanowski2;
return [similarity, ... | var INTERVAL = 70;
/*var sum1 = 0;
var sum2 = 0;
var sum3 = 0;
var canberra = 0;
var Czekanowski1 = 0;
var Czekanowski2 = 0;
*/
var intervalCount = 0;
for (var i = 0; i < arr1.length && i < arr2.length; i++) {
/*sum1 += arr1[i] * arr2[i];
sum2 += arr1[i] *... | identifier_body |
Utils.js | /**
* Slices arrays.
* @param array
* @param pos
* @returns {string}
*/
var arraySlicer = function (array, pos) {
return array.slice(0, pos).concat(array.slice(pos + 1, array.length));
};
/**
* https://en.wikipedia.org/wiki/Cosine_similarity
* https://en.wikipedia.org/wiki/Canberra_distance
* https://en.w... | */
function distanceFunction(arr1, arr2) {
var INTERVAL = 70;
/*var sum1 = 0;
var sum2 = 0;
var sum3 = 0;
var canberra = 0;
var Czekanowski1 = 0;
var Czekanowski2 = 0;
*/
var intervalCount = 0;
for (var i = 0; i < arr1.length && i < arr2.length; i++) {
/*sum1 += ... | random_line_split | |
weather.js | function httpRequest(url, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () { | };
}
xhr.send();
}
function showWeather(result) {
result = JSON.parse(result);
var list = result.list;
var table = '<table><tr><th>日期</th><th>天气</th><th>最低温度</th><th>最高温度</th></tr>';
for (var i in list) {
var d = new Date(list[i].dt * 1000);
table += '<tr>';
tabl... | if (xhr.readyState == 4) {
cb(xhr.responseText); | random_line_split |
weather.js | function | (url, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
cb(xhr.responseText);
};
}
xhr.send();
}
function showWeather(result) {
result = JSON.parse(result);
var list = result.list;
... | httpRequest | identifier_name |
weather.js | function httpRequest(url, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) | ;
}
xhr.send();
}
function showWeather(result) {
result = JSON.parse(result);
var list = result.list;
var table = '<table><tr><th>日期</th><th>天气</th><th>最低温度</th><th>最高温度</th></tr>';
for (var i in list) {
var d = new Date(list[i].dt * 1000);
table += '<tr>';
table += '<td... | {
cb(xhr.responseText);
} | conditional_block |
weather.js | function httpRequest(url, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
cb(xhr.responseText);
};
}
xhr.send();
}
function showWeather(result) | city;
city = city ? city : 'beijing';
var url = 'http://api.openweathermap.org/data/2.5/forecast/daily?q='+city+',china&lang=zh_cn';
httpRequest(url, showWeather); | {
result = JSON.parse(result);
var list = result.list;
var table = '<table><tr><th>日期</th><th>天气</th><th>最低温度</th><th>最高温度</th></tr>';
for (var i in list) {
var d = new Date(list[i].dt * 1000);
table += '<tr>';
table += '<td>'+d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate()+... | identifier_body |
buildhistory.py | import os
import unittest
import tempfile
from git import Repo
from oeqa.utils.commands import get_bb_var
from oe.buildhistory_analysis import blob_to_dict, compare_dict_blobs
class TestBlobParsing(unittest.TestCase):
def setUp(self):
import time
self.repo_path = tempfile.mkdtemp(prefix='selftest-... |
def test_compare_dict_blobs_default(self):
"""
Test default values for comparisson of git blob dictionaries
"""
defaultmap = { x : ("default", "1") for x in ["PKG", "PKGE", "PKGV", "PKGR"]}
self.commit_vars(to_add = { "foo" : "1" })
blob1 = self.repo.heads.master.... | """
Test comparisson of dictionaries extracted from git blobs
"""
changesmap = { "foo-2" : ("2", "8"), "bar" : ("","4"), "bar-2" : ("","5")}
self.commit_vars(to_add = { "foo" : "1", "foo-2" : "2", "foo-3" : "3" })
blob1 = self.repo.heads.master.commit.tree.blobs[0]
self... | identifier_body |
buildhistory.py | import os
import unittest
import tempfile
from git import Repo
from oeqa.utils.commands import get_bb_var
from oe.buildhistory_analysis import blob_to_dict, compare_dict_blobs
class | (unittest.TestCase):
def setUp(self):
import time
self.repo_path = tempfile.mkdtemp(prefix='selftest-buildhistory',
dir=get_bb_var('TOPDIR'))
self.repo = Repo.init(self.repo_path)
self.test_file = "test"
self.var_map = {}
def tearDown(self):
import ... | TestBlobParsing | identifier_name |
buildhistory.py | import os
import unittest
import tempfile
from git import Repo
from oeqa.utils.commands import get_bb_var
from oe.buildhistory_analysis import blob_to_dict, compare_dict_blobs
class TestBlobParsing(unittest.TestCase):
def setUp(self):
import time
self.repo_path = tempfile.mkdtemp(prefix='selftest-... |
with open(os.path.join(self.repo_path, self.test_file), 'w') as repo_file:
for k in self.var_map:
repo_file.write("%s = %s\n" % (k, self.var_map[k]))
self.repo.git.add("--all")
self.repo.git.commit(message=msg)
def test_blob_to_dict(self):
"""
... | self.var_map[k] = to_add[k] | conditional_block |
buildhistory.py | import os
import unittest
import tempfile
from git import Repo
from oeqa.utils.commands import get_bb_var
from oe.buildhistory_analysis import blob_to_dict, compare_dict_blobs
class TestBlobParsing(unittest.TestCase):
def setUp(self):
import time
self.repo_path = tempfile.mkdtemp(prefix='selftest-... | with open(os.path.join(self.repo_path, self.test_file), 'w') as repo_file:
for k in self.var_map:
repo_file.write("%s = %s\n" % (k, self.var_map[k]))
self.repo.git.add("--all")
self.repo.git.commit(message=msg)
def test_blob_to_dict(self):
"""
Te... | for k in to_remove:
self.var_map.pop(x,None)
for k in to_add:
self.var_map[k] = to_add[k]
| random_line_split |
angular2-image-popup.ts | import {Component, Input,Output,ElementRef,EventEmitter,OnInit} from '@angular/core';
@Component({
selector: 'ImageModal',
template: `
<div class="ng-gallery" *ngIf="showRepeat">
<div *ngFor ="let i of modalImages; let index = index">
<img src="{{ i.thumb }}" class="ng-thumb" (click)="openGaller... | nextImage() {
this.loading = true;
this.currentImageIndex++;
if(this.modalImages.length === this.currentImageIndex) {
this.currentImageIndex = 0;
}
this.openGallery(this.currentImageIndex);
}
openGallery(index) {
if(!index) {
this.currentImageIndex = 1;
}
this.currentIma... | if(this.currentImageIndex < 0) {
this.currentImageIndex = this.modalImages.length-1 ;
}
this.openGallery(this.currentImageIndex);
} | random_line_split |
angular2-image-popup.ts | import {Component, Input,Output,ElementRef,EventEmitter,OnInit} from '@angular/core';
@Component({
selector: 'ImageModal',
template: `
<div class="ng-gallery" *ngIf="showRepeat">
<div *ngFor ="let i of modalImages; let index = index">
<img src="{{ i.thumb }}" class="ng-thumb" (click)="openGaller... |
this.currentImageIndex = index;
this.opened = true;
for (var i = 0; i < this.modalImages.length; i++) {
if (i === this.currentImageIndex ) {
this.imgSrc = this.modalImages[i].img;
this.loading = false;
break;
}
}
}
}
| {
this.currentImageIndex = 1;
} | conditional_block |
angular2-image-popup.ts | import {Component, Input,Output,ElementRef,EventEmitter,OnInit} from '@angular/core';
@Component({
selector: 'ImageModal',
template: `
<div class="ng-gallery" *ngIf="showRepeat">
<div *ngFor ="let i of modalImages; let index = index">
<img src="{{ i.thumb }}" class="ng-thumb" (click)="openGaller... | implements OnInit {
public _element:any;
public opened:boolean = false;
public imgSrc:string;
public currentImageIndex:number;
public loading:boolean= false;
public showRepeat:boolean= false;
public isNav:boolean = false;
@Input('modalImages') public modalImages:any;
@Input('imagePointer') pub... | ImageModal | identifier_name |
index.js | 'use strict';
var gulp = require('gulp');
var argv = require('yargs').argv;
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var camel = require('to-camel-case');
var _gulp;
var api = {
config: config,
task: task
};
var generators = [['list', '']];
var templatesPath = './';
var gulpTaskCr... | if (path !== undefined) {
destination += path + '/';
}
if (placeholderValue !== undefined && placeholderKey === placeholder) {
return creator(placeholder, placeholderValue, destination);
}
});
});
}
function creator (placeholder, placeholderValue, dest) {
var templatePlaceholder = '_' + placeho... | random_line_split | |
index.js | 'use strict';
var gulp = require('gulp');
var argv = require('yargs').argv;
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var camel = require('to-camel-case');
var _gulp;
var api = {
config: config,
task: task
};
var generators = [['list', '']];
var templatesPath = './';
var gulpTaskCr... |
module.exports = api;
| {
var list = generators.map(function(generator){
return '\t' + generator.join(': ');
});
list.shift();
console.log('\navailable dogen tasks:\n');
console.log(list.join('\n'), '\n');
} | identifier_body |
index.js | 'use strict';
var gulp = require('gulp');
var argv = require('yargs').argv;
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var camel = require('to-camel-case');
var _gulp;
var api = {
config: config,
task: task
};
var generators = [['list', '']];
var templatesPath = './';
var gulpTaskCr... | () {
var list = generators.map(function(generator){
return '\t' + generator.join(': ');
});
list.shift();
console.log('\navailable dogen tasks:\n');
console.log(list.join('\n'), '\n');
}
module.exports = api;
| listGeneratorsToConsole | identifier_name |
index.js | 'use strict';
var gulp = require('gulp');
var argv = require('yargs').argv;
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var camel = require('to-camel-case');
var _gulp;
var api = {
config: config,
task: task
};
var generators = [['list', '']];
var templatesPath = './';
var gulpTaskCr... |
});
});
}
function creator (placeholder, placeholderValue, dest) {
var templatePlaceholder = '_' + placeholder + '_';
var reNormal = new RegExp('(' + templatePlaceholder + ')', 'gm');
var reCamelCase = new RegExp('(=' + placeholder + '=)', 'gm');
var placeholderValueCamelCase = camel(placeholderValue);
consol... | {
return creator(placeholder, placeholderValue, destination);
} | conditional_block |
rule_args.rs | extern crate peg;
peg::parser!( grammar ra() for str {
use peg::ParseLiteral;
rule number() -> i64
= n:$(['0'..='9']+) { n.parse().unwrap() }
rule commasep<T>(x: rule<T>) -> Vec<T> = v:(x() ** ",") ","? {v}
rule bracketed<T>(x: rule<T>) -> T = "[" v:x() "]" {v}
pub rule list() -> Vec<i64... | rule ident() = ['a'..='z']+
rule _ = [' ']*
pub rule ifelse() = keyword("if") _ ident() _ keyword("then") _ ident() _ keyword("else") _ ident()
pub rule repeated_a(i: usize) = ['a']*<{i}>
rule i(literal: &'static str) = input:$([_]*<{literal.len()}>) {? if input.eq_ignore_ascii_case(literal) {... | rule keyword(id: &'static str) = ##parse_string_literal(id) !['0'..='9' | 'a'..='z' | 'A'..='Z' | '_'] | random_line_split |
rule_args.rs | extern crate peg;
peg::parser!( grammar ra() for str {
use peg::ParseLiteral;
rule number() -> i64
= n:$(['0'..='9']+) { n.parse().unwrap() }
rule commasep<T>(x: rule<T>) -> Vec<T> = v:(x() ** ",") ","? {v}
rule bracketed<T>(x: rule<T>) -> T = "[" v:x() "]" {v}
pub rule list() -> Vec<i64... | () {
assert_eq!(list("1,2,3,4"), Ok(vec![1,2,3,4]));
assert_eq!(array("[1,1,2,3,5,]"), Ok(vec![1,1,2,3,5]));
assert!(ifelse("if foo then x else y").is_ok());
assert!(ifelse("iffoothenxelsey").is_err());
assert!(repeated_a("aa", 2).is_ok());
assert!(repeated_a("aaa", 2).is_err());
assert!(r... | main | identifier_name |
rule_args.rs | extern crate peg;
peg::parser!( grammar ra() for str {
use peg::ParseLiteral;
rule number() -> i64
= n:$(['0'..='9']+) { n.parse().unwrap() }
rule commasep<T>(x: rule<T>) -> Vec<T> = v:(x() ** ",") ","? {v}
rule bracketed<T>(x: rule<T>) -> T = "[" v:x() "]" {v}
pub rule list() -> Vec<i64... | {
assert_eq!(list("1,2,3,4"), Ok(vec![1,2,3,4]));
assert_eq!(array("[1,1,2,3,5,]"), Ok(vec![1,1,2,3,5]));
assert!(ifelse("if foo then x else y").is_ok());
assert!(ifelse("iffoothenxelsey").is_err());
assert!(repeated_a("aa", 2).is_ok());
assert!(repeated_a("aaa", 2).is_err());
assert!(repe... | identifier_body | |
source-map-support.ts | import * as Path from 'path'
import * as Fs from 'fs'
const fileUriToPath: (uri: string) => string = require('file-uri-to-path')
const sourceMapSupport = require('source-map-support')
/**
* This array tells the source map logic which files that we can expect to
* be able to resolve a source map for and they should ... | try {
const xhr = new XMLHttpRequest()
xhr.open('GET', path, false)
xhr.send(null)
if (xhr.readyState === 4 && xhr.status === 200) {
return { url: Path.basename(path), map: xhr.responseText }
}
} catch (error) {
return
}
return
}
// We don't have an optio... |
// We store our source maps right next to the bundle
const path = `${source}.map`
if (__DEV__ && path.startsWith('http://')) { | random_line_split |
source-map-support.ts | import * as Path from 'path'
import * as Fs from 'fs'
const fileUriToPath: (uri: string) => string = require('file-uri-to-path')
const sourceMapSupport = require('source-map-support')
/**
* This array tells the source map logic which files that we can expect to
* be able to resolve a source map for and they should ... | (error: Error, frames: ReadonlyArray<any>) {
stackFrameMap.set(error, frames)
// Ideally we'd use the default `Error.prepareStackTrace` here but it's
// undefined so V8 must doing something fancy. Instead we'll do a decent
// impression.
return error + frames.map(frame => `\n at ${frame}`).join('')
}
/**... | prepareStackTrace | identifier_name |
source-map-support.ts | import * as Path from 'path'
import * as Fs from 'fs'
const fileUriToPath: (uri: string) => string = require('file-uri-to-path')
const sourceMapSupport = require('source-map-support')
/**
* This array tells the source map logic which files that we can expect to
* be able to resolve a source map for and they should ... |
if (!frames) {
return error.stack
}
return prepareStackTraceWithSourceMap(error, frames)
}
| {
// At this point there's no guarantee that anyone has actually retrieved the
// stack on this error which means that our custom prepareStackTrace handler
// hasn't run and as a result of that we don't have the native frames stored
// in our weak map. In order to get around that we'll eagerly access th... | conditional_block |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.