file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
__init__.py | # Copyright (c) 2013 - The pycangjie authors
#
# This file is part of pycangjie, the Python bindings to libcangjie.
#
# pycangjie is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... |
expected = sorted(expected, key=operator.attrgetter('chchar', 'code'))
try:
# And compare with what pycangjie produces
results = sorted(self.cj.get_characters(input_code),
key=operator.attrgetter('chchar', 'code'))
self.assertEqual(res... | chchar, simpchar, code, frequency = item.split(", ")
chchar = chchar.split(": ")[-1].strip("'")
simpchar = simpchar.split(": ")[-1].strip("'")
code = code.split(": ")[-1].strip("'")
frequency = int(frequency.split(" ")[-1])
expected.append(cangjie._core.Cang... | conditional_block |
__init__.py | # Copyright (c) 2013 - The pycangjie authors
#
# This file is part of pycangjie, the Python bindings to libcangjie.
#
# pycangjie is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... |
class BaseTestCase(unittest.TestCase):
"""Base test class, grouping the common stuff for all our unit tests"""
def __init__(self, name):
super().__init__(name)
self.cli_cmd = ["/usr/bin/libcangjie_cli"] + self.cli_options
self.language = (cangjie.filters.BIG5 | cangjie.filters.HKSCS... | super(MetaTest, cls).__init__(name, bases, dct)
def gen_codes():
"""Generate the 702 possible input codes"""
# First, the 1-character codes
for c in string.ascii_lowercase:
yield c
# Next, the 2-characters-with-wildcard codes
for t in... | identifier_body |
__init__.py | # Copyright (c) 2013 - The pycangjie authors
#
# This file is part of pycangjie, the Python bindings to libcangjie.
#
# pycangjie is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... | import cangjie
class MetaTest(type):
"""Metaclass for our test cases
The goal is to provide every TestCase class with methods like test_a(),
test_b(), etc..., in other words, one method per potential Cangjie input
code.
Well, not quite, because that would be 12356630 methods (the number of
s... | import unittest
| random_line_split |
__init__.py | # Copyright (c) 2013 - The pycangjie authors
#
# This file is part of pycangjie, the Python bindings to libcangjie.
#
# pycangjie is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... | (cls, name, bases, dct):
super(MetaTest, cls).__init__(name, bases, dct)
def gen_codes():
"""Generate the 702 possible input codes"""
# First, the 1-character codes
for c in string.ascii_lowercase:
yield c
# Next, the 2-characters-with-wi... | __init__ | identifier_name |
java_protobuf_library.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | (self, payload=None, buildflags=None, imports=None, **kwargs):
"""
:param buildflags: Unused, and will be removed in a future release.
:param list imports: List of addresses of `jar_library <#jar_library>`_
targets which contain .proto definitions.
"""
payload = payload or Payload()
# TODO... | __init__ | identifier_name |
java_protobuf_library.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... |
self.add_labels('codegen')
@property
def imported_jar_library_specs(self):
"""List of JarLibrary specs to import.
Required to implement the ImportJarsMixin.
"""
return self.payload.import_specs
| logger.warn(" Target definition at {address} sets attribute 'buildflags' which is "
"ignored and will be removed in a future release"
.format(address=self.address.spec)) | conditional_block |
java_protobuf_library.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | class JavaProtobufLibrary(ImportJarsMixin, JvmTarget):
"""Generates a stub Java library from protobuf IDL files."""
def __init__(self, payload=None, buildflags=None, imports=None, **kwargs):
"""
:param buildflags: Unused, and will be removed in a future release.
:param list imports: List of addresses o... | random_line_split | |
java_protobuf_library.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... |
@property
def imported_jar_library_specs(self):
"""List of JarLibrary specs to import.
Required to implement the ImportJarsMixin.
"""
return self.payload.import_specs
| """
:param buildflags: Unused, and will be removed in a future release.
:param list imports: List of addresses of `jar_library <#jar_library>`_
targets which contain .proto definitions.
"""
payload = payload or Payload()
# TODO(Eric Ayers): The target needs to incorporate the settings of --gen... | identifier_body |
html_fragment.py | #!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... | (self):
super(HtmlGenerator, self).__init__()
self.colors = 16
self.bright_is_bold = False # ignored
self.has_underline = True # ignored
self.register_palette_entry(None,
_default_foreground, _default_background)
def set_terminal_properties(self, colors=None, bri... | __init__ | identifier_name |
html_fragment.py | #!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... |
if cursor >= 0:
c_off, _ign = util.calc_text_pos(s, 0, len(s), cursor)
c2_off = util.move_next_char(s, c_off, len(s))
return (html_span(html_fg, html_bg, s[:c_off]) +
html_span(html_bg, html_fg, s[c_off:c2_off]) +
html_span(html_fg, html_bg, s[c2_off:]))
else:
... | if not s: return ""
return ('<span style="color:%s;'
'background:%s%s">%s</span>' %
(fg, bg, extra, html_escape(s))) | identifier_body |
html_fragment.py | #!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... | {1: 1, 16: 0, 88:2, 256:3}[self.colors]]
if y == cy and col <= cx:
run_width = util.calc_width(run, 0,
len(run))
if col+run_width > cx:
l.append(html_span(run,
asp... | aspec = self._palette[a][ | random_line_split |
html_fragment.py | #!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... |
html_fg = "#%02x%02x%02x" % (fg_r, fg_g, fg_b)
html_bg = "#%02x%02x%02x" % (bg_r, bg_g, bg_b)
if aspec.standout:
html_fg, html_bg = html_bg, html_fg
extra = (";text-decoration:underline" * aspec.underline +
";font-weight:bold" * aspec.bold)
def html_span(fg, bg, s):
if not s... | bg_r, bg_g, bg_b = _d_bg_r, _d_bg_g, _d_bg_b | conditional_block |
userscripts.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::g... | {
let path_str = match opts::get().userscripts.clone() {
Some(p) => p,
None => return,
};
let doc = document_from_node(head);
let win = Trusted::new(doc.window());
doc.add_delayed_task(task!(UserScriptExecute: move || {
let win = win.root();
let cx = win.get_cx();
... | identifier_body | |
userscripts.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::g... | &file.to_string_lossy(),
rval.handle_mut(),
1,
);
}
}));
} | .evaluate_script_on_global_with_result(
&script_text, | random_line_split |
userscripts.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted;
use crate::dom::g... | (head: &HTMLHeadElement) {
let path_str = match opts::get().userscripts.clone() {
Some(p) => p,
None => return,
};
let doc = document_from_node(head);
let win = Trusted::new(doc.window());
doc.add_delayed_task(task!(UserScriptExecute: move || {
let win = win.root();
l... | load_script | identifier_name |
util.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 {AnimateTimings, AnimationMetadata, AnimationMetadataType, AnimationOptions, sequence, ɵStyleData} from '@angu... | unction validateStyleParams(
value: string|number, options: AnimationOptions, errors: any[]) {
const params = options.params || {};
const matches = extractStyleParams(value);
if (matches.length) {
matches.forEach(varName => {
if (!params.hasOwnProperty(varName)) {
errors.push(
`U... | ray.isArray(steps)) {
if (steps.length == 1) return steps[0];
return sequence(steps);
}
return steps as AnimationMetadata;
}
export f | identifier_body |
util.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 {AnimateTimings, AnimationMetadata, AnimationMetadataType, AnimationOptions, sequence, ɵStyleData} from '@angu... | n localVal.toString();
});
// we do this to assert that numeric values stay as they are
return str == original ? value : str;
}
export function iteratorToArray(iterator: any): any[] {
const arr: any[] = [];
let item = iterator.next();
while (!item.done) {
arr.push(item.value);
item = iterator.next... | rors.push(`Please provide a value for the animation param ${varName}`);
localVal = '';
}
retur | conditional_block |
util.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 {AnimateTimings, AnimationMetadata, AnimationMetadataType, AnimationOptions, sequence, ɵStyleData} from '@angu... | while (match = PARAM_REGEX.exec(value)) {
params.push(match[1] as string);
}
PARAM_REGEX.lastIndex = 0;
}
return params;
}
export function interpolateParams(
value: string|number, params: {[name: string]: any}, errors: any[]): string|number {
const original = value.toString();
const str =... | let params: string[] = [];
if (typeof value === 'string') {
let match: any; | random_line_split |
util.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 {AnimateTimings, AnimationMetadata, AnimationMetadataType, AnimationOptions, sequence, ɵStyleData} from '@angu... | ring|number): string[] {
let params: string[] = [];
if (typeof value === 'string') {
let match: any;
while (match = PARAM_REGEX.exec(value)) {
params.push(match[1] as string);
}
PARAM_REGEX.lastIndex = 0;
}
return params;
}
export function interpolateParams(
value: string|number, para... | leParams(value: st | identifier_name |
walker.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::fs::{self, DirEntry, Metadata};
use std::io;
use std::path::{Path, PathBuf};
use anyhow::Result;
use thiserror::Error;
use pathmat... | dir_matches: Vec<RepoPathBuf>,
results: Vec<Result<WalkEntry>>,
matcher: M,
include_directories: bool,
}
impl<M> Walker<M>
where
M: Matcher,
{
pub fn new(root: PathBuf, matcher: M, include_directories: bool) -> Result<Self> {
let mut dir_matches = vec![];
if matcher.matches_dire... | /// finding files matched by matcher
pub struct Walker<M> {
root: PathBuf, | random_line_split |
walker.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::fs::{self, DirEntry, Metadata};
use std::io;
use std::path::{Path, PathBuf};
use anyhow::Result;
use thiserror::Error;
use pathmat... | (&mut self) -> Option<Self::Item> {
match self.walk() {
Err(e) => Some(Err(e)),
Ok(()) => self.results.pop(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::fs::{create_dir_all, OpenOptions};
use std::path::PathBuf;
use tempfile::tempdir;
use pa... | next | identifier_name |
walker.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::fs::{self, DirEntry, Metadata};
use std::io;
use std::path::{Path, PathBuf};
use anyhow::Result;
use thiserror::Error;
use pathmat... |
fn match_entry(&mut self, next_dir: &RepoPathBuf, entry: DirEntry) -> Result<()> {
// It'd be nice to move all this conversion noise to a function, but having it here saves
// us from allocating filename repeatedly.
let filename = entry.file_name();
let filename = filename.to_str()... | {
let mut dir_matches = vec![];
if matcher.matches_directory(&RepoPathBuf::new())? != DirectoryMatch::Nothing {
dir_matches.push(RepoPathBuf::new());
}
let walker = Walker {
root,
dir_matches,
results: Vec::new(),
matcher,
... | identifier_body |
ctdav_n_auv.py | """
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/ctdav_n_auv.py
@author Jeff Roy
@brief Parser and particle Classes and tools for the ctdav_n_auv data
Release notes:
initial release
"""
__author__ = 'Jeff Roy'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger
log = get_logger()
... | (CtdavNAuvInstrumentParticle):
# set the data_particle_type for the DataParticle class
_data_particle_type = "ctdav_n_auv_instrument_recovered"
CTDAV_N_AUV_ID = '1181' # message ID of ctdav_n records
CTDAV_N_AUV_FIELD_COUNT = 12 # number of expected fields in an ctdav_n record
CTDAV_N_AUV_TELEMETERED_MES... | CtdavNAuvRecoveredParticle | identifier_name |
ctdav_n_auv.py | """
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/ctdav_n_auv.py
@author Jeff Roy
@brief Parser and particle Classes and tools for the ctdav_n_auv data
Release notes:
initial release
"""
__author__ = 'Jeff Roy'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger
log = get_logger()
... |
# provide message ID and # of fields to parent class
super(CtdavNAuvParser, self).__init__(stream_handle,
exception_callback,
message_map)
| message_map = CTDAV_N_AUV_RECOVERED_MESSAGE_MAP | conditional_block |
ctdav_n_auv.py | """
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/ctdav_n_auv.py
@author Jeff Roy
@brief Parser and particle Classes and tools for the ctdav_n_auv data
Release notes:
initial release
"""
__author__ = 'Jeff Roy'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger | compute_timestamp
# The structure below is a list of tuples
# Each tuple consists of
# parameter name, index into raw data parts list, encoding function
CTDAV_N_AUV_PARAM_MAP = [
# message ID is typically index 0
('mission_epoch', 1, int),
('auv_latitude', 2, float),
('auv_longitude', 3, float),
... | log = get_logger()
from mi.dataset.parser.auv_common import \
AuvCommonParticle, \
AuvCommonParser, \ | random_line_split |
ctdav_n_auv.py | """
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/ctdav_n_auv.py
@author Jeff Roy
@brief Parser and particle Classes and tools for the ctdav_n_auv data
Release notes:
initial release
"""
__author__ = 'Jeff Roy'
__license__ = 'Apache 2.0'
from mi.core.log import get_logger
log = get_logger()
... |
class CtdavNAuvTelemeteredParticle(CtdavNAuvInstrumentParticle):
# set the data_particle_type for the DataParticle class
_data_particle_type = "ctdav_n_auv_instrument"
class CtdavNAuvRecoveredParticle(CtdavNAuvInstrumentParticle):
# set the data_particle_type for the DataParticle class
_data_part... | _auv_param_map = CTDAV_N_AUV_PARAM_MAP
# must provide a parameter map for _build_parsed_values | identifier_body |
create_table_test.py | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | self.Base.metadata.create_all()
fake_cursor.execute.assert_called_with(
('\nCREATE TABLE t (\n\t'
'pk STRING, \n\t'
'p STRING, \n\t'
'PRIMARY KEY (pk, p)\n'
') CLUSTERED BY (p) INTO 3 SHARDS\n\n'),
())
def test_table_with_o... | 'crate_clustered_by': 'p',
'crate_number_of_shards': 3
}
pk = sa.Column(sa.String, primary_key=True)
p = sa.Column(sa.String, primary_key=True) | random_line_split |
create_table_test.py | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... |
def test_with_partitioned_by(self):
class DummyTable(self.Base):
__tablename__ = 't'
__table_args__ = {
'crate_partitioned_by': 'p',
'invalid_option': 1
}
pk = sa.Column(sa.String, primary_key=True)
p = sa.Column(s... | class DummyTable(self.Base):
__tablename__ = 't'
__table_args__ = {
'crate_clustered_by': 'p'
}
pk = sa.Column(sa.String, primary_key=True)
p = sa.Column(sa.String)
self.Base.metadata.create_all()
fake_cursor.execute.assert_call... | identifier_body |
create_table_test.py | # -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | (self):
self.engine = sa.create_engine('crate://')
self.Base = declarative_base(bind=self.engine)
def test_create_table_with_basic_types(self):
class User(self.Base):
__tablename__ = 'users'
string_col = sa.Column(sa.String, primary_key=True)
unicode_col ... | setUp | identifier_name |
ast_spec_utils.ts | /**
* @license
* Copyright Google LLC 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 * as html from '../../src/ml_parser/ast';
import {ParseTreeResult} from '../../src/ml_parser/html_parser';
imp... |
return humanizeNodes(parseResult.rootNodes, addSourceSpan);
}
export function humanizeDomSourceSpans(parseResult: ParseTreeResult): any[] {
return humanizeDom(parseResult, true);
}
export function humanizeNodes(nodes: html.Node[], addSourceSpan: boolean = false): any[] {
const humanizer = new _Humanizer(addSo... | {
const errorString = parseResult.errors.join('\n');
throw new Error(`Unexpected parse errors:\n${errorString}`);
} | conditional_block |
ast_spec_utils.ts | /**
* @license
* Copyright Google LLC 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 * as html from '../../src/ml_parser/ast';
import {ParseTreeResult} from '../../src/ml_parser/html_parser';
imp... | html.visitAll(this, element.children);
this.elDepth--;
}
visitAttribute(attribute: html.Attribute, context: any): any {
const res = this._appendContext(attribute, [html.Attribute, attribute.name, attribute.value]);
this.result.push(res);
}
visitText(text: html.Text, context: any): any {
co... | html.visitAll(this, element.attrs); | random_line_split |
ast_spec_utils.ts | /**
* @license
* Copyright Google LLC 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 * as html from '../../src/ml_parser/ast';
import {ParseTreeResult} from '../../src/ml_parser/html_parser';
imp... | (expansion: html.Expansion, context: any): any {
const res = this._appendContext(
expansion, [html.Expansion, expansion.switchValue, expansion.type, this.elDepth++]);
this.result.push(res);
html.visitAll(this, expansion.cases);
this.elDepth--;
}
visitExpansionCase(expansionCase: html.Expans... | visitExpansion | identifier_name |
config.ts | /* tslint:disable:no-console */
import Chalk from 'chalk'
import * as fs from 'fs-extra'
import * as _ from 'lodash'
import * as meow from 'meow'
import * as path from 'path'
export type ILogLevel = 'error'|'warning'|'log'
export type IEnv = 'development'|'testing'|'production'
interface IFlags {
help: bo... |
process.env.NODE_ENV = config.env
export default config
| {
config.env = DEFAULT_ENV
} | conditional_block |
config.ts | /* tslint:disable:no-console */
import Chalk from 'chalk'
import * as fs from 'fs-extra'
import * as _ from 'lodash'
import * as meow from 'meow'
import * as path from 'path'
export type ILogLevel = 'error'|'warning'|'log'
export type IEnv = 'development'|'testing'|'production'
interface IFlags {
help: bo... | isDev(): boolean
}
const DEFAULT_PORT = 3000
const DEFAULT_KEY = '5cdc0f5ec9c28202f1098f615edba5cd'
const DEFAULT_SECRET = 'e3b842e3b923b0fb'
const DEFAULT_CALLBACK = 'http://localhost:8000/#/login'
const DEFAULT_LOG_LEVEL: ILogLevel = 'e... | callback: string
logLevel: ILogLevel
env: IEnv
| random_line_split |
NullPoseHandler.py | #!/usr/bin/env python
"""
==========================================================
NullPose.py - Pose Handler for single region without Vicon
==========================================================
"""
import sys, time
from numpy import *
from lib.regions import *
import lib.handlers.handlerTemplates as handlerT... |
return array([x, y, o])
def setPose(self, x, y, theta):
self.x=x
self.y=y
self.theta=theta | random_line_split | |
NullPoseHandler.py | #!/usr/bin/env python
"""
==========================================================
NullPose.py - Pose Handler for single region without Vicon
==========================================================
"""
import sys, time
from numpy import *
from lib.regions import *
import lib.handlers.handlerTemplates as handlerT... | (self, executor, shared_data, initial_region):
"""
Null pose handler - used for single region operation without Vicon
initial_region (region): Starting position for robot
"""
r = executor.proj.rfiold.indexOfRegionWithName(initial_region)
center = executor.proj.rfiold.re... | __init__ | identifier_name |
NullPoseHandler.py | #!/usr/bin/env python
"""
==========================================================
NullPose.py - Pose Handler for single region without Vicon
==========================================================
"""
import sys, time
from numpy import *
from lib.regions import *
import lib.handlers.handlerTemplates as handlerT... | def __init__(self, executor, shared_data, initial_region):
"""
Null pose handler - used for single region operation without Vicon
initial_region (region): Starting position for robot
"""
r = executor.proj.rfiold.indexOfRegionWithName(initial_region)
center = executor.pr... | identifier_body | |
behaviors.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def detect(hostname):
| """
Performs CDN detection thanks to information disclosure from server error.
Parameters
----------
hostname : str
Hostname to assess
"""
print('[+] Error server detection\n')
hostname = urlparse.urlparse(hostname).netloc
regexp = re.compile('\\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{... | identifier_body | |
behaviors.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def detect(hostname):
"""
P... | Parameters
----------
hostname : str
Hostname to assess
"""
print('[+] Error server detection\n')
hostname = urlparse.urlparse(hostname).netloc
regexp = re.compile('\\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\\b')
out = commands.getoutput("host " + hostname)
addresses = regexp.f... | random_line_split | |
behaviors.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def detect(hostname):
"""
P... | res = request.do('http://' + addr.group())
if res is not None and res.status_code == 500:
CDNEngine.find(res.text.lower()) | conditional_block | |
behaviors.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import re
from utils import CDNEngine
from utils import request
if sys.version_info >= (3, 0):
import subprocess as commands
import urllib.parse as urlparse
else:
import commands
import urlparse
def | (hostname):
"""
Performs CDN detection thanks to information disclosure from server error.
Parameters
----------
hostname : str
Hostname to assess
"""
print('[+] Error server detection\n')
hostname = urlparse.urlparse(hostname).netloc
regexp = re.compile('\\b\d{1,3}\.\d{1,... | detect | identifier_name |
webpack.config.ts | import { isAbsolute, join, resolve } from 'path';
import * as dotenv from 'dotenv';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import webpack, { Configuration, RuleSetRule } from 'webpack';
import FriendlyErrorsPlugin, { Options as FriendlyErrorsOptions } from 'friendly-errors-webpack-plugin';
import B... |
export function addDuplicatesPlugin(chain: Chain) {
chain.plugin('duplicates').use(DuplicatesPlugin, [ {
verbose : true,
emitErrors: false,
} ]);
}
//endregion
//region: Plugins
chain.plugin('clean').use(CleanWebpackPlugin, [
[ 'js/', 'css/', '*.hot-update.*', 'assets/', 'vendor/' ],
... | {
chain.plugin('dashboard').use(Dashboard, [ {
port: dashboardPort,
} ]);
} | identifier_body |
webpack.config.ts | import { isAbsolute, join, resolve } from 'path';
import * as dotenv from 'dotenv';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import webpack, { Configuration, RuleSetRule } from 'webpack';
import FriendlyErrorsPlugin, { Options as FriendlyErrorsOptions } from 'friendly-errors-webpack-plugin';
import B... | // chain.resolve.alias.set(umdName, dirPath);
addAssetsLoaderForEntry(chain, name, dirPath);
chain.module.rule('ts').include.add(dirPath);
chain.module.rule('js').include.add(dirPath);
}
export function addHMR(chain: Chain, reactHotLoader: boolean = true) {
chain.plugin('hmr').use(webpack.HotModule... | [ umdName ]: [ 'codex', name ],
}); | random_line_split |
webpack.config.ts | import { isAbsolute, join, resolve } from 'path';
import * as dotenv from 'dotenv';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import webpack, { Configuration, RuleSetRule } from 'webpack';
import FriendlyErrorsPlugin, { Options as FriendlyErrorsOptions } from 'friendly-errors-webpack-plugin';
import B... |
rule
.use('ts-loader')
.loader('ts-loader')
.options(<Partial<TypescriptLoaderOptions>>{
transpileOnly : true,
configFile : tsconfig,
// happyPackMode : true,
getCustomTransformers: () => ({
before: [
... | {
addBabelToRule(chain, ruleName, babelOptions);
} | conditional_block |
webpack.config.ts | import { isAbsolute, join, resolve } from 'path';
import * as dotenv from 'dotenv';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import webpack, { Configuration, RuleSetRule } from 'webpack';
import FriendlyErrorsPlugin, { Options as FriendlyErrorsOptions } from 'friendly-errors-webpack-plugin';
import B... | (chain: Chain, ruleName: string, options: BabelLoaderOptions = {}) {
let rule = chain.module.rule(ruleName);
rule.use('babel-loader')
.loader('babel-loader')
.options(<BabelLoaderOptions>{
babelrc : false,
configFile : false,
presets : [
... | addBabelToRule | identifier_name |
gaes_stub.py | # 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 in writing, ... | # See the License for the specific language governing permissions and
# limitations under the License.
# Lint as: python3
"""Stub API calls used in gaes.py for testing.
Instead of doing real API calls, we return test JSON data.
"""
import json
from gcpdiag.queries import apis_stub
#pylint: disable=unused-argument
... | # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | random_line_split |
gaes_stub.py | # 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 in writing, ... |
else:
with open(self.json_dir / 'versions.json', encoding='utf-8') as json_file:
return json.load(json_file)
| with open(self.json_dir / 'appengine_services.json',
encoding='utf-8') as json_file:
return json.load(json_file) | conditional_block |
gaes_stub.py | # 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 in writing, ... | (self):
return AppEngineStandardApiStub('versions')
def list(self, appsId='appsId', servicesId='servicesId'):
self.json_dir = apis_stub.get_json_dir(appsId)
return self
def execute(self, num_retries=0):
if self.mock_state == 'services':
with open(self.json_dir / 'appengine_services.json',
... | versions | identifier_name |
gaes_stub.py | # 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 in writing, ... |
def execute(self, num_retries=0):
if self.mock_state == 'services':
with open(self.json_dir / 'appengine_services.json',
encoding='utf-8') as json_file:
return json.load(json_file)
else:
with open(self.json_dir / 'versions.json', encoding='utf-8') as json_file:
re... | self.json_dir = apis_stub.get_json_dir(appsId)
return self | identifier_body |
fuel-savings-calculator.ts | import {milesDrivenTimeframes} from '../reducers/fuel-savings';
import { roundNumber } from './math-helper';
import NumberFormatter from './number-formatter';
export interface ISavings {
annual: string|number;
monthly: string|number;
threeYear: string|number;
}
export interface ISettings { // TODO: Better inter... |
function calculateSavings(settings): ISavings {
const monthlySavings = this.calculateSavingsPerMonth(settings);
return {
annual: NumberFormatter.getCurrencyFormattedNumber(monthlySavings * 12),
monthly: NumberFormatter.getCurrencyFormattedNumber(monthlySavings),
threeYear: NumberFormatter.getCurrency... | {
const monthsPerYear = 12;
const weeksPerYear = 52;
switch (milesDrivenTimeframe) {
case 'week':
return (milesDriven * weeksPerYear) / monthsPerYear;
case 'month':
return milesDriven;
case 'year':
return milesDriven / monthsPerYear;
default:
throw 'Unknown milesDrivenT... | identifier_body |
fuel-savings-calculator.ts | import {milesDrivenTimeframes} from '../reducers/fuel-savings';
import { roundNumber } from './math-helper';
import NumberFormatter from './number-formatter';
export interface ISavings {
annual: string|number;
monthly: string|number;
threeYear: string|number;
}
export interface ISettings { // TODO: Better inter... | necessaryDataIsProvidedToCalculateSavings
};
export default fuelSavingsCalculator; | calculateSavingsPerMonth, | random_line_split |
fuel-savings-calculator.ts | import {milesDrivenTimeframes} from '../reducers/fuel-savings';
import { roundNumber } from './math-helper';
import NumberFormatter from './number-formatter';
export interface ISavings {
annual: string|number;
monthly: string|number;
threeYear: string|number;
}
export interface ISettings { // TODO: Better inter... | (milesDriven: number, milesDrivenTimeframe: milesDrivenTimeframes): number {
const monthsPerYear = 12;
const weeksPerYear = 52;
switch (milesDrivenTimeframe) {
case 'week':
return (milesDriven * weeksPerYear) / monthsPerYear;
case 'month':
return milesDriven;
case 'year':
return m... | calculateMilesDrivenPerMonth | identifier_name |
templates.js | angular.module('templateStore.templates',['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider.
when('/templates', {
templateUrl: 'templates/templates.html',
controller: 'TemplatesCtrl'
}).
when('/templates/:templateId', {
templateUrl: 'templates/template-details.htm... | }]); | });
$scope.setImage = function(image){
$scope.mainImage = image.name;
}
| random_line_split |
showMeMore.js | jQuery.fn.showMeMore = function (options) {
var options = $.extend({
current: 4, // number to be displayed at start
count: 4, // how many show in one click
fadeSpeed: 300, // animation speed
showButton: '', // show button (false / string)
hideButton: '', // hide button
... | }
}
showButton.click(function (event) {
event.preventDefault();
current += count;
showItem(fadeSpeed);
if (current >= quantity) {
switchButtons();
}
});
hideButton.click(function (event)... | $(list[i]).fadeOut(time);
| random_line_split |
showMeMore.js | jQuery.fn.showMeMore = function (options) {
var options = $.extend({
current: 4, // number to be displayed at start
count: 4, // how many show in one click
fadeSpeed: 300, // animation speed
showButton: '', // show button (false / string)
hideButton: '', // hide button
... |
list.hide();//hide all elements
hideButton.hide()//hide "hideButton"
if (quantity <= current) {
showButton.hide();
}
showItem(0);//show first elements
function switchButtons() {
if (enableHide == false) {
showButton.hi... | {
$(this).append('<button class="hideButton">' + options.hideButtonText + '</button>');
hideButton = $(this).find('.hideButton');
} | conditional_block |
showMeMore.js | jQuery.fn.showMeMore = function (options) {
var options = $.extend({
current: 4, // number to be displayed at start
count: 4, // how many show in one click
fadeSpeed: 300, // animation speed
showButton: '', // show button (false / string)
hideButton: '', // hide button
... |
//this function hide all elements
function hideAll(time) {
for (var i = current; i < quantity; i++) {
$(list[i]).fadeOut(time);
}
}
showButton.click(function (event) {
event.preventDefault();
current += count;
... | {
for (var i = 0; i < current; i++) {
if ($(list[i]).is(':hidden')) {
$(list[i]).fadeIn(time);
}
}
} | identifier_body |
showMeMore.js | jQuery.fn.showMeMore = function (options) {
var options = $.extend({
current: 4, // number to be displayed at start
count: 4, // how many show in one click
fadeSpeed: 300, // animation speed
showButton: '', // show button (false / string)
hideButton: '', // hide button
... | (time) {
for (var i = current; i < quantity; i++) {
$(list[i]).fadeOut(time);
}
}
showButton.click(function (event) {
event.preventDefault();
current += count;
showItem(fadeSpeed);
if (current >= quantity)... | hideAll | identifier_name |
issue-8498.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 ... | {
match &[(box 5,box 7)] {
ps => {
let (ref y, _) = ps[0];
assert!(**y == 5);
}
}
match Some(&[(box 5,)]) {
Some(ps) => {
let (ref y,) = ps[0];
assert!(**y == 5);
}
None => ()
}
match Some(&[(box 5,box 7)]) {
... | identifier_body | |
issue-8498.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 ... | } | assert!(**z == 7);
}
None => ()
} | random_line_split |
issue-8498.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 ... | () {
match &[(box 5,box 7)] {
ps => {
let (ref y, _) = ps[0];
assert!(**y == 5);
}
}
match Some(&[(box 5,)]) {
Some(ps) => {
let (ref y,) = ps[0];
assert!(**y == 5);
}
None => ()
}
match Some(&[(box 5,box 7)]) {
... | main | identifier_name |
json.rs | #![cfg(feature = "alloc")]
#[macro_use]
extern crate nom;
extern crate jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{Err, IResult, Offset, error::{VerboseError, VerboseErrorKind}};
use nom::{
character::complete::alphanumeric1 as alphanumeric,
bytes::c... | |i| tag("false")(i).map(|(i,_)| (i, false)),
|i| tag("true")(i).map(|(i,_)| (i, true))
))(input)
/*
match tag::<&'static str, &'a str, E>("false")(i) {
Ok((i, _)) => Ok((i, false)),
Err(_) => tag("true")(i).map(|(i,_)| (i, true))
}
*/
}
fn array<'a, E: ParseError<&'a str>>(i: &'a str) ->I... | fn boolean<'a, E: ParseError<&'a str>>(input: &'a str) ->IResult<&'a str, bool, E> {
alt( ( | random_line_split |
json.rs | #![cfg(feature = "alloc")]
#[macro_use]
extern crate nom;
extern crate jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{Err, IResult, Offset, error::{VerboseError, VerboseErrorKind}};
use nom::{
character::complete::alphanumeric1 as alphanumeric,
bytes::c... |
fn string<'a, E: ParseError<&'a str>>(i: &'a str) ->IResult<&'a str, &'a str, E> {
//delimitedc(i, char('\"'), parse_str, char('\"'))
let (i, _) = char('\"')(i)?;
//context("string", |i| terminatedc(i, parse_str, char('\"')))(i)
context("string", terminated(parse_str, char('\"')))(i)
}
fn boolean<'a, E: Pa... | {
escaped!(i, call!(alphanumeric), '\\', one_of!("\"n\\"))
} | identifier_body |
json.rs | #![cfg(feature = "alloc")]
#[macro_use]
extern crate nom;
extern crate jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
use nom::{Err, IResult, Offset, error::{VerboseError, VerboseErrorKind}};
use nom::{
character::complete::alphanumeric1 as alphanumeric,
bytes::c... | <'a, E: ParseError<&'a str>>(i: &'a str) ->IResult<&'a str, f64, E> {
flat_map!(i, recognize_float, parse_to!(f64))
}
fn parse_str<'a, E: ParseError<&'a str>>(i: &'a str) ->IResult<&'a str, &'a str, E> {
escaped!(i, call!(alphanumeric), '\\', one_of!("\"n\\"))
}
fn string<'a, E: ParseError<&'a str>>(i: &'a str)... | float | identifier_name |
handledisconnected.ts | module cola {
var packingOptions = {
PADDING: 10,
GOLDEN_SECTION: (1 + Math.sqrt(5)) / 2,
FLOAT_EPSILON: 0.0001,
MAX_INERATIONS: 100
};
// assign x, y to nodes while using box packing algorithm for disconnected graphs
export function applyPacking(graphs:Array<any>, w, h... | }
/**
* connected components of graph
* returns an array of {}
*/
export function separateGraphs(nodes, links) {
var marks = {};
var ways = {};
var graphs = [];
var clusters = 0;
for (var i = 0; i < links.length; i++) {
var link = links[i]... | return (real_width / real_height);
}
| identifier_body |
handledisconnected.ts | module cola {
var packingOptions = {
PADDING: 10,
GOLDEN_SECTION: (1 + Math.sqrt(5)) / 2,
FLOAT_EPSILON: 0.0001,
MAX_INERATIONS: 100
};
// assign x, y to nodes while using box packing algorithm for disconnected graphs
export function applyPacking(graphs:Array<any>, w, h... | raphs) {
graphs.forEach(function (g) {
calculate_single_bb(g)
});
function calculate_single_bb(graph) {
var min_x = Number.MAX_VALUE, min_y = Number.MAX_VALUE,
max_x = 0, max_y = 0;
graph.array.forEach(function (v... | lculate_bb(g | identifier_name |
handledisconnected.ts | module cola {
var packingOptions = {
PADDING: 10,
GOLDEN_SECTION: (1 + Math.sqrt(5)) / 2,
FLOAT_EPSILON: 0.0001,
MAX_INERATIONS: 100
};
// assign x, y to nodes while using box packing algorithm for disconnected graphs
export function applyPacking(graphs:Array<any>, w, h... | }
return graphs;
}
} | if (!adjacent) return;
for (var j = 0; j < adjacent.length; j++) {
explore_node(adjacent[j], false);
} | random_line_split |
Toolbar.js | (function (enyo, scope) {
/**
* {@link onyx.Toolbar} is a horizontal bar containing controls used to perform
* common UI actions.
*
* A toolbar customizes the styling of the controls it hosts, including buttons,
* icons, and inputs.
*
* ```
* {kind: 'onyx.Toolbar', components: [
* {kind: 'onyx.Button', cont... | * @public
*/
enyo.kind(
/** @lends onyx.Toolbar.prototype */ {
/**
* @private
*/
name: 'onyx.Toolbar',
/**
* @private
*/
classes: 'onyx onyx-toolbar onyx-toolbar-inline',
/**
* @private
*/
create: function (){
this.inherited(arguments);
//workaround for android 4.0.3 rendering g... | * @class onyx.Toolbar
* @extends enyo.Control | random_line_split |
Toolbar.js | (function (enyo, scope) {
/**
* {@link onyx.Toolbar} is a horizontal bar containing controls used to perform
* common UI actions.
*
* A toolbar customizes the styling of the controls it hosts, including buttons,
* icons, and inputs.
*
* ```
* {kind: 'onyx.Toolbar', components: [
* {kind: 'onyx.Button', cont... |
}
});
})(enyo, this);
| {
this.applyStyle('position', 'static');
} | conditional_block |
main.js | /*global require*/
'use strict';
require.config({
shim: {
underscore: {
exports: '_'
},
backbone: {
deps: [
'underscore',
'jquery'
],
exports: 'Backbone'
},
foundation: {
deps: ['jque... | Backbone.history.start();
});
function flashInitialized() {
window.mentalmodeler.appModel.start();
} | ], function ( $, Backbone, _, App ) {
window.mentalmodeler = new App(); | random_line_split |
main.js | /*global require*/
'use strict';
require.config({
shim: {
underscore: {
exports: '_'
},
backbone: {
deps: [
'underscore',
'jquery'
],
exports: 'Backbone'
},
foundation: {
deps: ['jque... | {
window.mentalmodeler.appModel.start();
} | identifier_body | |
main.js | /*global require*/
'use strict';
require.config({
shim: {
underscore: {
exports: '_'
},
backbone: {
deps: [
'underscore',
'jquery'
],
exports: 'Backbone'
},
foundation: {
deps: ['jque... | () {
window.mentalmodeler.appModel.start();
}
| flashInitialized | identifier_name |
cluster_handler.py | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | # the terms of the GNU General Public License version 2 as published by the Free
# Software Foundation. This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# Li... | # (c) 2012-2013, Baycrest Centre for Geriatric Care ("Baycrest")
#
# This program is free software; you can redistribute it and/or modify it under | random_line_split |
cluster_handler.py | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... |
else:
log_file = self.WEB_LOG_FILE
format_str += ' - %(name)s - %(message)s'
rotating_file_handler = SimpleTimedRotatingFileHandler(log_file, when, interval, backupCount)
rotating_file_handler.setFormatter(logging.Formatter(format_str))
MemoryHandler.__init__(self... | format_str += ' [proc:' + str(os.getpid()) + '] ' | conditional_block |
cluster_handler.py | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | """
Constructor for logging formatter.
"""
# Formatting string
format_str = '%(asctime)s - %(levelname)s'
if TvbProfile.current.cluster.IN_OPERATION_EXECUTION_PROCESS:
log_file = self.CLUSTER_NODES_LOG_FILE
if TvbProfile.current.cluster.IS_RUNNING_ON_CLUST... | identifier_body | |
cluster_handler.py | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... | (MemoryHandler):
"""
This is a custom rotating file handler which computes the name of the file depending on the
execution environment (web node or cluster node)
"""
# Name of the log file where code from Web application will be stored
WEB_LOG_FILE = "web_application.log"
# Name of the fi... | ClusterTimedRotatingFileHandler | identifier_name |
arrays.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | }
}
/**
* @returns a new array with all undefined or null values removed. The original array is not modified at all.
*/
export function coalesce<T>(array: T[]): T[] {
if (!array) {
return array;
}
return array.filter(e => !!e);
}
/**
* Mo... | result.splice(j, 0, element);
} | random_line_split |
arrays.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
/**
* Moves the element in the array for the provided positions.
*/
export function move(array: any[], from: number, to: number): void {
array.splice(to, 0, array.splice(from, 1)[0]);
}
/**
* @returns {{false}} if the provided object is an array
* and not empty.
*/
... | {
if (!array) {
return array;
}
return array.filter(e => !!e);
} | identifier_body |
arrays.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
};
}
/**
* Insert `insertArr` inside `target` at `insertIndex`.
* Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array
*/
export function arrayInsert<T>(target: T[], insertIndex: number, insertArr: T[]): T[] {
const before = target.s... | {
array.splice(index, 1);
} | conditional_block |
arrays.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | (start: number, deleteCount: number, toInsert: T[]): void {
if (deleteCount === 0 && toInsert.length === 0) {
return;
}
const latest = result[result.length - 1];
if (latest && latest.start + latest.deleteCount === start) {
latest.deleteCo... | pushSplice | identifier_name |
Table.d.ts | /// <reference types="react" />
import React from 'react';
import { PaginationProps } from '../pagination';
import { SpinProps } from '../spin';
import { Store } from './createStore';
import { SelectionDecorator } from './SelectionCheckboxAll';
import Column, { ColumnProps } from './Column';
import ColumnGroup from './... | <T> extends React.Component<TableProps<T>, any> {
static Column: typeof Column;
static ColumnGroup: typeof ColumnGroup;
static propTypes: {
dataSource: React.Requireable<any>;
columns: React.Requireable<any>;
prefixCls: React.Requireable<any>;
useFixedHeader: React.Requireabl... | Table | identifier_name |
Table.d.ts | /// <reference types="react" />
import React from 'react';
import { PaginationProps } from '../pagination';
import { SpinProps } from '../spin';
import { Store } from './createStore';
import { SelectionDecorator } from './SelectionCheckboxAll';
import Column, { ColumnProps } from './Column';
import ColumnGroup from './... | className?: string;
style?: React.CSSProperties;
}
export interface TableContext {
antLocale?: {
Table?: any;
};
}
export default class Table<T> extends React.Component<TableProps<T>, any> {
static Column: typeof Column;
static ColumnGroup: typeof ColumnGroup;
static propTypes: {
... | bodyStyle?: React.CSSProperties; | random_line_split |
action.py | """Provides a class for managing BIG-IP L7 Rule Action resources."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... |
elif shutdown:
self._data['shutdown'] = shutdown
else:
raise ValueError(
"Unsupported forward action, must be one of reset, "
"forward to pool, select, or shutdown.")
# Is this a redirect action?
elif data.g... | self._data['select'] = select | conditional_block |
action.py | """Provides a class for managing BIG-IP L7 Rule Action resources."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | (self, bigip):
"""Return the URI path of an action object.
Not implemented because the current implementation does
not manage Actions individually."""
raise NotImplementedError
| _uri_path | identifier_name |
action.py | """Provides a class for managing BIG-IP L7 Rule Action resources."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... |
def _uri_path(self, bigip):
"""Return the URI path of an action object.
Not implemented because the current implementation does
not manage Actions individually."""
raise NotImplementedError
| return str(self._data) | identifier_body |
action.py | """Provides a class for managing BIG-IP L7 Rule Action resources."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | self._data['httpReply'] = data.get('httpReply', True)
# Is this a setVariable action?
elif data.get('setVariable', False):
self._data['setVariable'] = True
# Set the variable name and the value
self._data['tmName'] = data.get('tmName', None)
s... | self._data['redirect'] = True
# Yes, set the location and httpReply attribute
self._data['location'] = data.get('location', None) | random_line_split |
test_Ipc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... |
class producerFinished_Test(unittest.TestCase):
def test_SmokeTest_NoArguments(self):
"producerFinished.__init__ - Called without arguments defaults to a caller of None, message of None. Checks producerFinished is a subclass of ipc"
pf=producerFinished()
self.failUnless(isinstance(pf, ipc), "pro... | def test_SmokeTest_NoArguments(self):
"wouldblock.__init__ - Called without arguments fails."
self.failUnlessRaises(TypeError, wouldblock)
def test_SmokeTest_MinArguments(self):
"wouldblock.__init__ - Stores the caller in the wouldblock message. Allows the scheduler to make a decision. Checks woul... | identifier_body |
test_Ipc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | self.failUnless(ei.exception == "exception", "Caller is not set properly by position.")
ei=errorInformation(exception="exception", message="message", caller = "caller")
self.failUnless(ei.caller == "caller", "Caller is not set properly by name.")
self.failUnless(ei.message == "message", "Caller... | random_line_split | |
test_Ipc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | (unittest.TestCase):
def test_SmokeTest(self):
"ipc - Should be derived from object."
self.failUnless(isinstance(ipc(),object), "IPC objects should also be instances of object.")
class newComponent_Test(unittest.TestCase):
def test___init__SmokeTest_NoArguments(self):
"newComponent.__init_... | ipc_Test | identifier_name |
test_Ipc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | unittest.main() | conditional_block | |
set.js | // -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// -------------------------------------------------------------------
// MarkDown tags example
//... |
$imagesContainer = $('#' + $miu[0].id + 'Images');
if('id' in imgData)
this.imagesIndex = Math.max(this.imagesIndex, imgData.id); // сохраняем максимальный id картинки
else
++this.imagesIndex;
imgData.code = 'IMAGE_' + this.imagesIndex;
imgData.name = imgData.src.slice(imgData.src.lastIndexOf('/') +... | random_line_split | |
CloudQueueIcon.js | import React from 'react';
import Icon from '../Icon';
export default class CloudQueueIcon extends Icon {
| (){return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M38.71 20.07C37.35 13.19 31.28 8 24 8c-5.78 0-10.79 3.28-13.3 8.07C4.69 16.72 0 21.81 0 28c0 6.63 5.37 12 12 12h26c5.52 0 10-4.48 10-10 0-5.28-4.11-9.56-9.29-9.93zM38 36H12c-4.42 0-8-3.58-8-8s3.58-8 8-8h1.42c1.31-4.61 ... | getSVG | identifier_name |
CloudQueueIcon.js | import React from 'react';
import Icon from '../Icon';
export default class CloudQueueIcon extends Icon {
getSVG() |
}; | {return <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M38.71 20.07C37.35 13.19 31.28 8 24 8c-5.78 0-10.79 3.28-13.3 8.07C4.69 16.72 0 21.81 0 28c0 6.63 5.37 12 12 12h26c5.52 0 10-4.48 10-10 0-5.28-4.11-9.56-9.29-9.93zM38 36H12c-4.42 0-8-3.58-8-8s3.58-8 8-8h1.42c1.31-4.61 5.... | identifier_body |
node-card.ts | import { Component, Input } from '@angular/core';
import { NodeDef } from '../models/nodeDef'
@Component({
selector: 'chix-node-card',
template: `
<a [routerLink]="['/nodes', id]">
<mat-card>
<mat-card-title-group>
<img mat-card-sm-image *ngIf="thumbnail" [src]="thumbnail"/>
<... | () {
return this.node._id;
}
get title() {
return this.node.title;
}
get description() {
return this.node.description;
}
}
| id | identifier_name |
node-card.ts | import { Component, Input } from '@angular/core';
import { NodeDef } from '../models/nodeDef'
@Component({
selector: 'chix-node-card',
template: `
<a [routerLink]="['/nodes', id]">
<mat-card>
<mat-card-title-group>
<img mat-card-sm-image *ngIf="thumbnail" [src]="thumbnail"/>
<... | export class NodeCardComponent {
@Input() node: NodeDef;
get id() {
return this.node._id;
}
get title() {
return this.node.title;
}
get description() {
return this.node.description;
}
} | random_line_split | |
metadata.ts | import {Type, DirectiveMetadata} from 'angular2/core';
import {DirectiveResolver} from 'angular2/compiler';
import {stringify} from './util';
var COMPONENT_SELECTOR = /^[\w|-]*$/;
var SKEWER_CASE = /-(\w)/g;
var directiveResolver = new DirectiveResolver();
export interface AttrProp {
prop: string;
attr: string;
... |
export function parseFields(names: string[]): AttrProp[] {
var attrProps: AttrProp[] = [];
if (names) {
for (var i = 0; i < names.length; i++) {
var parts = names[i].split(':');
var prop = parts[0].trim();
var attr = (parts[1] || parts[0]).trim();
var capitalAttr = attr.charAt(0).toUpp... | {
var resolvedMetadata: DirectiveMetadata = directiveResolver.resolve(type);
var selector = resolvedMetadata.selector;
if (!selector.match(COMPONENT_SELECTOR)) {
throw new Error('Only selectors matching element names are supported, got: ' + selector);
}
var selector = selector.replace(SKEWER_CASE, (all, l... | identifier_body |
metadata.ts | import {Type, DirectiveMetadata} from 'angular2/core';
import {DirectiveResolver} from 'angular2/compiler';
import {stringify} from './util';
var COMPONENT_SELECTOR = /^[\w|-]*$/;
var SKEWER_CASE = /-(\w)/g;
var directiveResolver = new DirectiveResolver();
export interface AttrProp {
prop: string;
attr: string;
... |
return attrProps;
}
| {
for (var i = 0; i < names.length; i++) {
var parts = names[i].split(':');
var prop = parts[0].trim();
var attr = (parts[1] || parts[0]).trim();
var capitalAttr = attr.charAt(0).toUpperCase() + attr.substr(1);
attrProps.push(<AttrProp>{
prop: prop,
attr: attr,
... | conditional_block |
metadata.ts | import {Type, DirectiveMetadata} from 'angular2/core';
import {DirectiveResolver} from 'angular2/compiler';
import {stringify} from './util';
var COMPONENT_SELECTOR = /^[\w|-]*$/;
var SKEWER_CASE = /-(\w)/g;
var directiveResolver = new DirectiveResolver();
export interface AttrProp {
prop: string;
attr: string;
... | (names: string[]): AttrProp[] {
var attrProps: AttrProp[] = [];
if (names) {
for (var i = 0; i < names.length; i++) {
var parts = names[i].split(':');
var prop = parts[0].trim();
var attr = (parts[1] || parts[0]).trim();
var capitalAttr = attr.charAt(0).toUpperCase() + attr.substr(1);
... | parseFields | identifier_name |
metadata.ts | import {Type, DirectiveMetadata} from 'angular2/core';
import {DirectiveResolver} from 'angular2/compiler';
import {stringify} from './util';
var COMPONENT_SELECTOR = /^[\w|-]*$/;
var SKEWER_CASE = /-(\w)/g;
var directiveResolver = new DirectiveResolver();
export interface AttrProp {
prop: string;
attr: string;
... | bindonAttr: string;
}
export interface ComponentInfo {
type: Type;
selector: string;
inputs: AttrProp[];
outputs: AttrProp[];
}
export function getComponentInfo(type: Type): ComponentInfo {
var resolvedMetadata: DirectiveMetadata = directiveResolver.resolve(type);
var selector = resolvedMetadata.selecto... | bracketParenAttr: string;
parenAttr: string;
onAttr: string;
bindAttr: string; | random_line_split |
package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class OclIcd(AutotoolsPackage):
"""This package aims at creating an Open Source alternative to v... | version('2.2.9', sha256='88da749bc2bd75149f0bb6e72eb4a9d74401a54f4508bc730f13cc03c57a17ed')
version('2.2.8', sha256='8a8a405c7d659b905757a358dc467f4aa3d7e4dff1d1624779065764d962a246')
version('2.2.7', sha256='b8e68435904e1a95661c385f24d6924ed28f416985c6db5a3c7448698ad5fea2')
version('2.2.6', sha256=... | version('2.2.11', sha256='c1865ef7701b8201ebc6930ed3ac757c7e5cb30f3aa4c1e742a6bc022f4f2292')
version('2.2.10', sha256='d0459fa1421e8d86aaf0a4df092185ea63bc4e1a7682d3af261ae5d3fae063c7') | random_line_split |
package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class OclIcd(AutotoolsPackage):
"""This package aims at creating an Open Source alternative to v... | (self, name, flags):
if name == 'cflags' and self.spec.satisfies('@:2.2.12'):
# https://github.com/OCL-dev/ocl-icd/issues/8
# this is fixed in version grater than 2.2.12
flags.append('-O2')
# gcc-10 change the default from -fcommon to fno-common
# This... | flag_handler | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.