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 |
|---|---|---|---|---|
useMediaPicker.js | /*
* Copyright 2020 Google LLC | * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT W... | *
* Licensed under the Apache License, Version 2.0 (the "License"); | random_line_split |
useMediaPicker.js | /*
* Copyright 2020 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | ({ args, cropParams }) {
const configValue = {
capabilities: {
hasUploadMediaAction: true,
},
...args,
};
const wrapper = ({ children }) => (
<ConfigContext.Provider value={configValue}>
<SnackbarContext.Provider>{children}</SnackbarContext.Provider>
</ConfigContext.Provider>
);... | setup | identifier_name |
djbecSpec.js | 044112800746194328591365721768705212";
var pk2String = "53255436729671775084746528346843731237424359258590576875878644045356852269230";
var sk1IntHash = "3785047263979736627163772602458212674009569523367137115970539162935690024316525691811301446413093761092955240714105344418655782000506159820373323951773707";
... | var p1 = Djbec.decodepoint(signPk1);
var p2 = Dj | expect(res1).toBe(true);
expect(res2).toBe(true);
});
it('decodes points', function() { | random_line_split |
express-config.js | /*
* This file exports the configuration Express.js back to the application
* so that it can be used in other parts of the product. | */
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
exports.setup = function(app, express) {
app.set('views', path.join(__di... | random_line_split | |
highlighter.rs | /**
* Flow - Realtime log analyzer
* Copyright (C) 2016 Daniel Mircea
*
* 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 ve... |
}
}
}
| {
self.state.highlighted_line = matched_line.line;
self.state.highlighted_match = matched_line.match_index;
} | conditional_block |
highlighter.rs | /**
* Flow - Realtime log analyzer
* Copyright (C) 2016 Daniel Mircea
*
* 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 ve... | {
VisibleOrLast,
Next,
Previous,
Current,
}
pub struct LineHighlighter<'a> {
line: &'a Line,
window: WINDOW,
container_width: i32,
color_pair_id: i16,
}
impl<'a> LineHighlighter<'a> {
pub fn new(window: WINDOW,
line: &'a Line,
container_width: i32,
... | Highlight | identifier_name |
highlighter.rs | /**
* Flow - Realtime log analyzer
* Copyright (C) 2016 Daniel Mircea
*
* 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 ve... | use ui::rendered_line::RenderedLineCollection;
#[derive(PartialEq)]
pub enum Highlight {
VisibleOrLast,
Next,
Previous,
Current,
}
pub struct LineHighlighter<'a> {
line: &'a Line,
window: WINDOW,
container_width: i32,
color_pair_id: i16,
}
impl<'a> LineHighlighter<'a> {
pub fn new... | use ncurses::*;
use core::line::Line;
use ui::printer::Viewport;
use ui::content::State as ContentState; | random_line_split |
variables_66.js | var searchData=
[
['f',['f',['../unionjvalue.html#ad32f5996f5d0f5fb93fb38ef83a74eb0',1,'jvalue']]],
['far_5fpreasure',['far_preasure',['../svm-train_8cpp.html#a57ce01656059264c677404c310f3a04e',1,'far_preasure(): svm-train.cpp'],['../_2svm-train_8cpp.html#a57ce01656059264c677404c310f3a04e',1,'far_preasure():&#... | ['fu_5fcounter',['FU_Counter',['../_squirrel__pipeline_8cpp.html#ac348c2964e6239b7e1819f59092e6e8f',1,'Squirrel_pipeline.cpp']]],
['functions',['functions',['../struct___j_n_i_env.html#acef9b977efc20a861da781946c1a67f2',1,'_JNIEnv::functions()'],['../struct___java_v_m.html#aad1eb9c5f99ef136f09aba7b8c230f65',1,'_Jav... | random_line_split | |
process.rs | // This file is part of the uutils coreutils package.
//
// (c) Maciej Dziardziel <fiedzia@gmail.com>
// (c) Jian Zeng <anonymousknight96 AT gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (vars) cvar e... |
if start.elapsed() >= timeout {
break;
}
// XXX: this is kinda gross, but it's cleaner than starting a thread just to wait
// (which was the previous solution). We might want to use a different duration
// here as well
... | {
return Ok(Some(ExitStatus::from_std_status(status)));
} | conditional_block |
process.rs | // This file is part of the uutils coreutils package.
//
// (c) Maciej Dziardziel <fiedzia@gmail.com>
// (c) Jian Zeng <anonymousknight96 AT gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (vars) cvar e... |
pub fn signal(&self) -> Option<i32> {
match *self {
ExitStatus::Signal(code) => Some(code),
_ => None,
}
}
}
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ExitStatus::Code(code) => write!... | {
match *self {
ExitStatus::Code(code) => Some(code),
_ => None,
}
} | identifier_body |
process.rs | // This file is part of the uutils coreutils package.
//
// (c) Maciej Dziardziel <fiedzia@gmail.com>
// (c) Jian Zeng <anonymousknight96 AT gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (vars) cvar e... | () -> gid_t {
unsafe { libc::getegid() }
}
/// `getgid()` returns the real group ID of the calling process.
pub fn getgid() -> gid_t {
unsafe { libc::getgid() }
}
/// `getuid()` returns the real user ID of the calling process.
pub fn getuid() -> uid_t {
unsafe { libc::getuid() }
}
// This is basically sy... | getegid | identifier_name |
process.rs | // This file is part of the uutils coreutils package.
//
// (c) Maciej Dziardziel <fiedzia@gmail.com>
// (c) Jian Zeng <anonymousknight96 AT gmail.com>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (vars) cvar e... | }
// This is basically sys::unix::process::ExitStatus
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
pub enum ExitStatus {
Code(i32),
Signal(i32),
}
#[allow(clippy::trivially_copy_pass_by_ref)]
impl ExitStatus {
fn from_std_status(status: StdExitStatus) -> Self {
#[cfg(unix)]
{
u... | unsafe { libc::getuid() } | random_line_split |
npm-install.js | /*
* Copyright (c) 2013 - present Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* ... | grunt.registerTask("npm-install", "Install node_modules to the dist folder so it gets bundled with release", function () {
var packageJSON = grunt.file.readJSON("package.json");
delete packageJSON.devDependencies;
delete packageJSON.scripts; // we don't want to run post-install scripts in di... |
// task: write-config | random_line_split |
npm-install.js | /*
* Copyright (c) 2013 - present Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* ... |
});
});
};
| {
grunt.log.writeln(stdout);
done();
} | conditional_block |
demo-form.ts | import { Component } from 'angular2/core';
import {FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators,
AbstractControl, Control} from 'angular2/common';
import {CustomerService} from './../services/customer.service';
@Component({
selector: 'demo-form',
styles: [ require('./demo-form.css') ],
template: req... |
this.myForm.controls['firstName'].valueChanges.subscribe(
(value: string) => {
//console.log('name value changed: ', value);
}
);
this.myForm.valueChanges.subscribe(
(value: string) => {
//console.log('form value changed: ', value);
}
);
}
onSubmit(model) {... | random_line_split | |
demo-form.ts | import { Component } from 'angular2/core';
import {FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators,
AbstractControl, Control} from 'angular2/common';
import {CustomerService} from './../services/customer.service';
@Component({
selector: 'demo-form',
styles: [ require('./demo-form.css') ],
template: req... |
}
| {
this.customerService.createCustomer(model);
} | identifier_body |
demo-form.ts | import { Component } from 'angular2/core';
import {FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators,
AbstractControl, Control} from 'angular2/common';
import {CustomerService} from './../services/customer.service';
@Component({
selector: 'demo-form',
styles: [ require('./demo-form.css') ],
template: req... |
}
constructor(fb: FormBuilder, private customerService: CustomerService) {
this.myForm = fb.group({
firstName: ['Miro', Validators.required],
lastName: ['Bulo', Validators.required],
email: ['miro@bulo.com', Validators.required],
phone: ['+421123456798', Validators.compose([
Va... | {
return {invalidPhone: true};
} | conditional_block |
demo-form.ts | import { Component } from 'angular2/core';
import {FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators,
AbstractControl, Control} from 'angular2/common';
import {CustomerService} from './../services/customer.service';
@Component({
selector: 'demo-form',
styles: [ require('./demo-form.css') ],
template: req... | {
myForm: ControlGroup;
firstName: AbstractControl;
phoneValidator(control: Control) {
if (!control.value.match(/^\+421/)) {
return {invalidPhone: true};
}
}
constructor(fb: FormBuilder, private customerService: CustomerService) {
this.myForm = fb.group({
firstName: ['Miro', Validat... | DemoForm | identifier_name |
Field.ts | /// <reference path="../lib/jquery.d.ts"/>
/// <reference path="../lib/jquerymobile.d.ts"/>
module Wappli {
export class Field extends Widget {
private label: HTMLLabelElement;
private input: HTMLInputElement;
get Label(): string { return this.label.innerText; }
set Label(value: string) { this.label.innerText ... | () {
this.Value = this.getValue !== null ? this.getValue() : "";
}
}
} | Update | identifier_name |
compiler.py | # Copyright 2014 Cloudera 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # limitations under the License.
import sqlalchemy as sa
from ibis.sql.alchemy import unary, varargs, fixed_arity
import ibis.sql.alchemy as alch
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
import ibis.expr.types as ir
import ibis.common as com
_operation_registry = alch._operation_registry.... | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and | random_line_split |
compiler.py | # Copyright 2014 Cloudera 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
else:
left, right = map(t.translate, args)
return sa.func.coalesce(
(left.is_(None) & right.is_(None)) | (left == right),
False
)
_operation_registry.update({
ops.Cast: _cast,
ops.Substring: _substr,
ops.StrRight: _string_right,
ops.StringFind: _s... | return True | conditional_block |
compiler.py | # Copyright 2014 Cloudera 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
def _string_right(t, expr):
f = sa.func.substr
arg, length = expr.op().args
sa_arg = t.translate(arg)
sa_length = t.translate(length)
return f(sa_arg, -sa_length, sa_length)
def _string_find(t, expr):
arg, substr, start, _ = expr.op().args
if start is not None:
raise NotImpl... | f = sa.func.substr
arg, start, length = expr.op().args
sa_arg = t.translate(arg)
sa_start = t.translate(start)
if length is None:
return f(sa_arg, sa_start + 1)
else:
sa_length = t.translate(length)
return f(sa_arg, sa_start + 1, sa_length) | identifier_body |
compiler.py | # Copyright 2014 Cloudera 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | (t, expr):
f = sa.func.substr
arg, start, length = expr.op().args
sa_arg = t.translate(arg)
sa_start = t.translate(start)
if length is None:
return f(sa_arg, sa_start + 1)
else:
sa_length = t.translate(length)
return f(sa_arg, sa_start + 1, sa_length)
def _string_rig... | _substr | identifier_name |
index.ts | /*
MIT License
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of ... | Copyright (c) 2020 Looker Data Sciences, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights | random_line_split |
noop-spec.ts | import 'jest-extended';
import { TestContext, newTestExecutionConfig, WorkerContext, DataEntity } from '../../src';
import Noop from '../../src/builtin/noop/processor';
import Schema from '../../src/builtin/noop/schema';
describe('Noop Processor', () => { | const exConfig = newTestExecutionConfig();
const noop = new Noop(
context as WorkerContext,
opConfig,
exConfig
);
const schema = new Schema(context);
it('should have a Schema and Processor class', () => {
expect(Noop).not.toBeNil();
expect(Schema).not.toBeN... | const context = new TestContext('noop');
const opConfig = { _op: 'noop' }; | random_line_split |
webglshader.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, Sha... | ,
Err(error) => {
self.compilation_status.set(ShaderCompilationStatus::Failed);
debug!("Shader {} compilation failed: {}", self.id, error);
},
}
*self.info_log.borrow_mut() = Some(validator.info_log());
// TODO(... | {
debug!("Shader translated: {}", translated_source);
// NOTE: At this point we should be pretty sure that the compilation in the paint thread
// will succeed.
// It could be interesting to retrieve the info log from the paint thread though... | conditional_block |
webglshader.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, Sha... | compilation_status: Cell<ShaderCompilationStatus>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
renderer: WebGLMsgSender,
}
#[cfg(not(target_os = "android"))]
const SHADER_OUTPUT_FORMAT: Output = Output::Glsl;
#[cfg(target_os = "android")]
const SHADER_OUTPUT_FORMAT: Output = Output::Essl;
static GL... | source: DOMRefCell<Option<DOMString>>,
info_log: DOMRefCell<Option<String>>,
is_deleted: Cell<bool>,
attached_counter: Cell<u32>, | random_line_split |
webglshader.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, Sha... | (&self) -> bool {
self.compilation_status.get() == ShaderCompilationStatus::Succeeded
}
}
impl Drop for WebGLShader {
fn drop(&mut self) {
assert!(self.attached_counter.get() == 0);
self.delete();
}
}
| successfully_compiled | identifier_name |
webglshader.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, Sha... |
pub fn is_deleted(&self) -> bool {
self.is_deleted.get()
}
pub fn is_attached(&self) -> bool {
self.attached_counter.get() > 0
}
pub fn increment_attached_counter(&self) {
self.attached_counter.set(self.attached_counter.get() + 1);
}
pub fn decrement_attached_cou... | {
if !self.is_deleted.get() {
self.is_deleted.set(true);
let _ = self.renderer.send(WebGLCommand::DeleteShader(self.id));
}
} | identifier_body |
stylesheet.py | # Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... |
return stylesheet.to_tree() | stylesheet.tableStyles = wb._table_styles | random_line_split |
stylesheet.py | # Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... |
def write_stylesheet(wb):
stylesheet = Stylesheet()
stylesheet.fonts = wb._fonts
stylesheet.fills = wb._fills
stylesheet.borders = wb._borders
stylesheet.dxfs = wb._differential_styles.styles
from .numbers import NumberFormat
fmts = []
for idx, code in enumerate(wb._number_formats, B... | wb._colors = stylesheet.colors.index | conditional_block |
stylesheet.py | # Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... | (wb):
stylesheet = Stylesheet()
stylesheet.fonts = wb._fonts
stylesheet.fills = wb._fills
stylesheet.borders = wb._borders
stylesheet.dxfs = wb._differential_styles.styles
from .numbers import NumberFormat
fmts = []
for idx, code in enumerate(wb._number_formats, BUILTIN_FORMATS_MAX_SIZE... | write_stylesheet | identifier_name |
stylesheet.py | # Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... |
def _merge_named_styles(self):
"""
Merge named style names "cellStyles" with their associated styles
"cellStyleXfs"
"""
named_styles = self.cellStyles.names
for style in named_styles:
self._expand_named_style(style)
return named_styles
d... | attrs = dict(node.attrib)
for k in attrs:
del node.attrib[k]
return super(Stylesheet, cls).from_tree(node) | identifier_body |
list-and-search-books.page.spec.ts | /* tslint:disable:no-unused-variable */
import { async, ComponentFixture, fakeAsync, TestBed, getTestBed, inject, tick } from '@angular/core/testing';
import { Location } from '@angular/common';
import { Router, ActivatedRoute } from '@angular/router';
import { Http } from '@angular/http';
import { Store, StoreModule }... | service = getTestBed().get(BookService);
mockBackend = getTestBed().get(MockBackend);
utils.setupMockBackend(mockBackend);
fixture = getTestBed().createComponent(ListAndSearchBooksPage);
component = fixture.componentInstance;
}));
beforeEach(inject([TranslateService], (translateService: T... | http = getTestBed().get(Http); | random_line_split |
itembox.py | _box.connect("size-allocate", self._on_event_box_size_allocate)
self._event_box_buttons.connect(
"size-allocate", self._on_event_box_buttons_size_allocate)
self._event_box.show_all()
self._hbox_buttons.set_no_show_all(True)
@property
def widget(self):
return self._event_box
@... | # clicking and modifying the widget by the user.
item.widget,
self._get_drag_data, | random_line_split | |
itembox.py | item_widget.grab_focus()
self._vbox_items.remove(item.widget)
item.remove_item_widget()
self._items.remove(item)
def clear(self):
for unused_ in range(len(self._items)):
self.remove_item(self._items[0])
def _setup_drag(self, item):
self._drag_and_drop_context.setup_drag(
... |
def _on_event_box_leave_notify_event(self, event_box, event):
if event.detail != gtk.gdk.NOTIFY_INFERIOR:
self._hbox_buttons.hide()
def _on_event_box_size_allocate(self, event_box, allocation):
if self._is_event_box_allocated_size:
return
self._is_event_box_allocated_size = True
... | if event.detail != gtk.gdk.NOTIFY_INFERIOR:
self._hbox_buttons.show() | identifier_body |
itembox.py | item_widget.grab_focus()
self._vbox_items.remove(item.widget)
item.remove_item_widget()
self._items.remove(item)
def clear(self):
for unused_ in range(len(self._items)):
self.remove_item(self._items[0])
def _setup_drag(self, item):
self._drag_and_drop_context.setup_drag(
... | (self, widget, event, item):
if event.state & gtk.gdk.MOD1_MASK: # Alt key
key_name = gtk.gdk.keyval_name(event.keyval)
if key_name in ["Up", "KP_Up"]:
self.reorder_item(
item, self._get_item_position(item) - 1)
elif key_name in ["Down", "KP_Down"]:
self.reorder_item(... | _on_item_widget_key_press_event | identifier_name |
itembox.py | item_widget.grab_focus()
self._vbox_items.remove(item.widget)
item.remove_item_widget()
self._items.remove(item)
def clear(self):
for unused_ in range(len(self._items)):
self.remove_item(self._items[0])
def _setup_drag(self, item):
self._drag_and_drop_context.setup_drag(
... |
def _on_event_box_leave_notify_event(self, event_box, event):
if event.detail != gtk.gdk.NOTIFY_INFERIOR:
self._hbox_buttons.hide()
def _on_event_box_size_allocate(self, event_box, allocation):
if self._is_event_box_allocated_size:
return
self._is_event_box_allocated_size = True
... | self._hbox_buttons.show() | conditional_block |
cleanup_ci_test.py | from __future__ import print_function
import unittest
from kubeflow.testing import cleanup_ci
import os
import yaml
class CleanupCiTest(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.join(os.path.dirname(__file__), "test-data")
def test_wait_for_workflow(self):
with open(os.path.join(self.... | # binding to existing service account still exists.
self.assertTrue(
'serviceAccount:kfctl-in-use@kubeflow-ci.iam.gserviceaccount.com' in trimed_members)
# binding to unexist service account is deleted.
self.assertTrue(
'serviceAccount:kfctl-expired@kubeflow-ci.iam.gserviceaccoun... | # binding to non-match service account still exists as it is not created by ci tests.
self.assertTrue(
'serviceAccount:my-other-app@appspot.gserviceaccount.com'in trimed_members) | random_line_split |
cleanup_ci_test.py | from __future__ import print_function
import unittest
from kubeflow.testing import cleanup_ci
import os
import yaml
class CleanupCiTest(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.join(os.path.dirname(__file__), "test-data")
def test_wait_for_workflow(self):
with open(os.path.join(self.... |
cleanup_ci.trim_unused_bindings(iam_bindings,
['kfctl-in-use@kubeflow-ci.iam.gserviceaccount.com'],
"kubeflow-ci")
# One binding is deleted as it lost all members.
self.assertTrue(len(iam_bindings['bindings']) == 2)
tri... | self.assertTrue('serviceAccount:' + act in members) | conditional_block |
cleanup_ci_test.py | from __future__ import print_function
import unittest
from kubeflow.testing import cleanup_ci
import os
import yaml
class CleanupCiTest(unittest.TestCase):
def setUp(self):
self.test_dir = os.path.join(os.path.dirname(__file__), "test-data")
def test_wait_for_workflow(self):
| # binding to unexist service account is deleted.
self.assertTrue(
'serviceAccount:kfctl-expired@kubeflow-ci.iam.gserviceaccount.com' not in trimed_members)
if __name__ == "__main__":
unittest.main()
| with open(os.path.join(self.test_dir, "iam_bindings.yaml")) as bd:
iam_bindings = yaml.load(bd)
self.assertTrue(len(iam_bindings['bindings']) == 3)
members = iam_bindings['bindings'][0]['members']
for act in ['my-other-app@appspot.gserviceaccount.com',
'kfctl-in-use@kubeflow-ci... | identifier_body |
cleanup_ci_test.py | from __future__ import print_function
import unittest
from kubeflow.testing import cleanup_ci
import os
import yaml
class | (unittest.TestCase):
def setUp(self):
self.test_dir = os.path.join(os.path.dirname(__file__), "test-data")
def test_wait_for_workflow(self):
with open(os.path.join(self.test_dir, "iam_bindings.yaml")) as bd:
iam_bindings = yaml.load(bd)
self.assertTrue(len(iam_bindings['bindings']) == 3)
... | CleanupCiTest | identifier_name |
verify_project.rs | use crate::command_prelude::*;
use std::collections::HashMap;
use std::process;
use cargo::print_json;
pub fn cli() -> App {
subcommand("verify-project")
.about("Check correctness of crate manifest")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg_manifest_path()
}
pub ... |
if let Err(e) = args.workspace(config) {
fail("invalid", &e.to_string())
}
let mut h = HashMap::new();
h.insert("success".to_string(), "true".to_string());
print_json(&h);
Ok(())
}
| {
let mut h = HashMap::new();
h.insert(reason.to_string(), value.to_string());
print_json(&h);
process::exit(1)
} | identifier_body |
verify_project.rs | use crate::command_prelude::*;
use std::collections::HashMap;
use std::process;
use cargo::print_json;
pub fn | () -> App {
subcommand("verify-project")
.about("Check correctness of crate manifest")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg_manifest_path()
}
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
fn fail(reason: &str, value: &str) -> ! {
... | cli | identifier_name |
verify_project.rs | use crate::command_prelude::*;
use std::collections::HashMap;
use std::process;
use cargo::print_json;
pub fn cli() -> App {
subcommand("verify-project")
.about("Check correctness of crate manifest")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg_manifest_path()
}
pub ... | process::exit(1)
}
if let Err(e) = args.workspace(config) {
fail("invalid", &e.to_string())
}
let mut h = HashMap::new();
h.insert("success".to_string(), "true".to_string());
print_json(&h);
Ok(())
} | let mut h = HashMap::new();
h.insert(reason.to_string(), value.to_string());
print_json(&h); | random_line_split |
verify_project.rs | use crate::command_prelude::*;
use std::collections::HashMap;
use std::process;
use cargo::print_json;
pub fn cli() -> App {
subcommand("verify-project")
.about("Check correctness of crate manifest")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg_manifest_path()
}
pub ... |
let mut h = HashMap::new();
h.insert("success".to_string(), "true".to_string());
print_json(&h);
Ok(())
}
| {
fail("invalid", &e.to_string())
} | conditional_block |
Constant.js | /*
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless require... |
return b;
}
}
]
});
| {
b[i] = prop.adaptArrayElement.call(this, a[i], prop);
} | conditional_block |
Constant.js | /*
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless require... | function installInProto(proto) {
this.installInClass(proto);
}
]
});
foam.CLASS({
refines: 'foam.core.Model',
properties: [
{
class: 'AxiomArray',
of: 'Constant',
name: 'constants',
adapt: function(_, a, prop) {
if ( ! a ) return [];
if ( ! Array.isArray(... | value: this.value,
configurable: false
});
}, | random_line_split |
prettier-eslint.d.ts | import { PrettierConfig } from './prettier.d';
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace';
interface PrettierEslintConfig {
/**
* The path of the file being formatted
* can be used in lieu of `eslintConfig` (eslint will be used to find the
* relevant config for the file). Will al... | * @param {PrettierEslintConfig} options - Option bag for prettier-eslint.
* @returns {string} the formatted code.
*/
export type PrettierEslint = (options: PrettierEslintConfig) => string; | random_line_split | |
cmdutils.py | #
# Copyright (C) 2010 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... | (filename, directory, trace, lib):
p = loader.load_project(filename)
if trace and lib:
target = "libtraced"
elif trace:
target = "traced"
elif lib:
target = "lib"
else:
target = "release"
build_config = p.get_build_config(target)
if directory is not None:
... | export | identifier_name |
cmdutils.py | #
# Copyright (C) 2010 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... |
def main():
parser = argparse.ArgumentParser(description='Kaira gui command line controller')
parser.add_argument('--export', metavar='filename', type=str)
parser.add_argument('--output', metavar='directory', type=str)
parser.add_argument("--trace", action='store_true')
parser.add_argument('--trac... | t = tracelog.TraceLog(filename)
print t.get_runinstances_count() | identifier_body |
cmdutils.py | #
# Copyright (C) 2010 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... |
if __name__ == "__main__":
main()
| check_tracelog(args.tracelog) | conditional_block |
cmdutils.py | #
# Copyright (C) 2010 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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, version 3 of the License, or
# (at your option) any later versi... | #
# You should have received a copy of the GNU General Public License
# along with Kaira. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import sys
import paths
sys.path.append(paths.PTP_DIR)
import loader
import os
import tracelog
def export(filename, directory, trace, lib):
p = loader.load... | # GNU General Public License for more details. | random_line_split |
searchreplace.js | tinymce2Popup.requireLangPack();
var SearchReplaceDialog = {
init : function(ed) {
var t = this, f = document.forms[0], m = tinymce2Popup.getWindowArg("mode");
t.switchMode(m);
f[m + '_panel_searchstring'].value = tinymce2Popup.getWindowArg("search_string");
// Focus input field
f[m + '_panel_... | ;
// IE flags
if (ca)
fl = fl | 4;
switch (a) {
case 'all':
// Move caret to beginning of text
ed.execCommand('SelectAll');
ed.selection.collapse(true);
if (tinymce2.isIE) {
ed.focus();
r = ed.getDoc().selection.createRange();
while (r.findText(s, b ? -1 : ... | {
ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE
} | identifier_body |
searchreplace.js | tinymce2Popup.requireLangPack();
var SearchReplaceDialog = {
init : function(ed) {
var t = this, f = document.forms[0], m = tinymce2Popup.getWindowArg("mode");
t.switchMode(m);
f[m + '_panel_searchstring'].value = tinymce2Popup.getWindowArg("search_string");
// Focus input field
f[m + '_panel_... | () {
ed.selection.setContent(rs); // Needs to be duplicated due to selection bug in IE
};
// IE flags
if (ca)
fl = fl | 4;
switch (a) {
case 'all':
// Move caret to beginning of text
ed.execCommand('SelectAll');
ed.selection.collapse(true);
if (tinymce2.isIE) {
ed... | replace | identifier_name |
searchreplace.js | tinymce2Popup.requireLangPack();
var SearchReplaceDialog = {
init : function(ed) {
var t = this, f = document.forms[0], m = tinymce2Popup.getWindowArg("mode");
t.switchMode(m);
f[m + '_panel_searchstring'].value = tinymce2Popup.getWindowArg("search_string");
// Focus input field
f[m + '_panel_... | if (r.findText(s, b ? -1 : 1, fl)) {
r.scrollIntoView();
r.select();
} else
tinymce2Popup.alert(ed.getLang('searchreplace_dlg.notfound'));
tinymce2Popup.storeSelection();
} else {
if (!w.find(s, ca, b, false, false, false, false))
tinymce2Popup.alert(ed.getLang('searchreplace_dlg... | random_line_split | |
handshake.js | var crypto = require('crypto');
var lob = require('lob-enc')
var hashname = require('hashname');
var log = require("./log")("Handshake")
module.exports = {
bootstrap : handshake_bootstrap,
validate : handshake_validate,
from : handshake_from,
types : handshake_types,
collect : handshake_collect
}... | var from = handshake_from(handshake, pipe, types.link)
// if we already linked this hashname, just update w/ the new info
if(mesh.index[from.hashname])
{
log.debug('refresh link handshake')
from.sync = false; // tell .link to not auto-sync!
return mesh.link(from);
} else {
}
log.debug('... | {
handshake = handshake_bootstrap(handshake);
if (!handshake)
return false;
var valid = handshake_validate(id,handshake, message, mesh);
if (!valid)
return false;
// get all from cache w/ matching at, by type
var types = handshake_types(handshake, id);
// bail unless we have a link
if(!types.... | identifier_body |
handshake.js | var crypto = require('crypto');
var lob = require('lob-enc')
var hashname = require('hashname');
var log = require("./log")("Handshake")
module.exports = {
bootstrap : handshake_bootstrap,
validate : handshake_validate,
from : handshake_from,
types : handshake_types,
collect : handshake_collect
}... | // verify at
if(typeof handshake.json.at != 'number' || handshake.json.at <= 0)
{
log.debug('invalid handshake at',handshake.json);
return false;
}
// default the handshake type
if(typeof handshake.json.type != 'string')
handshake.json.type = 'link';
// upvert deprecated key to link type
i... | handshake.json.at = Date.now();
| random_line_split |
handshake.js | var crypto = require('crypto');
var lob = require('lob-enc')
var hashname = require('hashname');
var log = require("./log")("Handshake")
module.exports = {
bootstrap : handshake_bootstrap,
validate : handshake_validate,
from : handshake_from,
types : handshake_types,
collect : handshake_collect
}... | (handshake){
// default an at for bare key handshakes if not given
if(typeof handshake.json.at === 'undefined')
handshake.json.at = Date.now();
// verify at
if(typeof handshake.json.at != 'number' || handshake.json.at <= 0)
{
log.debug('invalid handshake at',handshake.json);
return false;
}
... | handshake_bootstrap | identifier_name |
recipes.py | plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(convergence_data[:,0],convergence_data[:,1],'o-')
ax.set_xlabel(var+' ('+unit+')')
ax.set_ylabel('E_gw = E_lda + \Delta E')
fig.savefig('%s.png'%var)
#
# by Alexandre Morlet
#
def analyse_bse(folder,var,numbexc,intexc,degenexc,ma... | exciton_spectras = sorted(exciton_spectras,key=lambda x: x[0])
exciton_energies = sorted(exciton_energies,key=lambda x: x[0])
#save a file with the exciton eneergies
output_folder = 'analyse_%s'%folder
if not os.path.isdir(output_folder): os.mkdir(output_folder)
output_file = '%s_exciton_energi... | random_line_split | |
recipes.py | plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(convergence_data[:,0],convergence_data[:,1],'o-')
ax.set_xlabel(var+' ('+unit+')')
ax.set_ylabel('E_gw = E_lda + \Delta E')
fig.savefig('%s.png'%var)
#
# by Alexandre Morlet
#
def analyse_bse(folder,var,numbexc,intexc,degenexc,ma... | (array):
return tuple([ 'D_%010d'%d for d in array.shape ])
#create missing dimensions
for v in variables_save:
for dname,d in zip( dimensions(v),v.shape ):
if dname not in list(fout.dimensions.keys()):
fout.createDimension(dname, d)
#copy variables
for v_na... | dimensions | identifier_name |
recipes.py | def dimensions(array):
return tuple([ 'D_%010d'%d for d in array.shape ])
#create missing dimensions
for v in variables_save:
for dname,d in zip( dimensions(v),v.shape ):
if dname not in list(fout.dimensions.keys()):
fout.createDimension(dname, d)
#copy variabl... | merged = variables_dict[v_name]
# create the variable
outVar = fout.createVariable(v_name, varin.datatype, dimensions(merged))
# Copy variable attributes
outVar.setncatts({k: varin.getncattr(k) for k in varin.ncattrs()})
#save outvar
outVar[:] = me... | conditional_block | |
recipes.py | plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot(convergence_data[:,0],convergence_data[:,1],'o-')
ax.set_xlabel(var+' ('+unit+')')
ax.set_ylabel('E_gw = E_lda + \Delta E')
fig.savefig('%s.png'%var)
#
# by Alexandre Morlet
#
def analyse_bse(folder,var,numbexc,intexc,degenexc,ma... | lat = YamboSaveDB.from_db_file(os.path.join(folder,'SAVE'))
#find all ndb.BS_diago_Q01 files in the folder
io = OrderedDict()
for root, dirs, files in os.walk(folder):
#get starting name of folder
basename = os.path.basename(root)
#look into folders starting with var or referenc... | """
Using ypp, you can study the convergence of BSE calculations in 2 ways:
Create a .png of all absorption spectra relevant to the variable you study
Look at the eigenvalues of the first n "bright" excitons (given a threshold intensity)
The script reads from <folder> all results from <variable> ca... | identifier_body |
content-editable.js | import Component from '@ember/component';
import { run } from "@ember/runloop";
export default Component.extend({
classNames: ['ember-content-editable'],
classNameBindings: ['clearPlaceholderOnFocus:clear-on-focus'],
attributeBindings: [
'contenteditable',
'placeholder',
'spellcheck',
'tabindex',... |
'length-exceeded'() { },
'insert-newline'() { },
paste() { }
}).reopenClass({
positionalParams: ['value']
});
function crossSupportInsertText(text) {
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
const range = document.getSelection... |
'key-down'() { }, | random_line_split |
content-editable.js | import Component from '@ember/component';
import { run } from "@ember/runloop";
export default Component.extend({
classNames: ['ember-content-editable'],
classNameBindings: ['clearPlaceholderOnFocus:clear-on-focus'],
attributeBindings: [
'contenteditable',
'placeholder',
'spellcheck',
'tabindex',... |
}
this.get('key-down')(event);
},
getSelectionLength() {
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
return range.endOffset - range.startOffset;
}
return 0;
},
pasteHandler(event) {
event.... | {
event.preventDefault();
return false;
} | conditional_block |
content-editable.js | import Component from '@ember/component';
import { run } from "@ember/runloop";
export default Component.extend({
classNames: ['ember-content-editable'],
classNameBindings: ['clearPlaceholderOnFocus:clear-on-focus'],
attributeBindings: [
'contenteditable',
'placeholder',
'spellcheck',
'tabindex',... |
crossSupportInsertText(text);
this.get('paste')(text);
}
,
enter() { },
'escape-press'() { },
'key-up'() { },
'key-press'() { },
'key-down'() { },
'length-exceeded'() { },
'insert-newline'() { },
paste() { }
}).reopenClass({
positionalParams: ['value']
});
function crossSupportIns... | {
event.preventDefault();
// replace any html formatted text with its plain text equivalent
let text = '';
if (event.clipboardData) {
text = event.clipboardData.getData('text/plain');
} else if (window.clipboardData) {
text = window.clipboardData.getData('Text');
}
// check max ... | identifier_body |
content-editable.js | import Component from '@ember/component';
import { run } from "@ember/runloop";
export default Component.extend({
classNames: ['ember-content-editable'],
classNameBindings: ['clearPlaceholderOnFocus:clear-on-focus'],
attributeBindings: [
'contenteditable',
'placeholder',
'spellcheck',
'tabindex',... | () {
this._super(...arguments);
this.set('contenteditable', !this.get('disabled'));
},
didUpdateAttrs() {
this._super(...arguments);
// if update has been initiated by a change of the dom (user entered something) we don't do anything because
// - value has already been updated by domChanged
... | didReceiveAttrs | identifier_name |
test_ddl_stress.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | tbl_name = "tmp_%s_%s" % (tbl_uniquifier, i)
# Create a partitioned and unpartitioned table
self.client.execute("create table %s (i int)" % tbl_name)
self.client.execute("create table %s_part (i int) partitioned by (j int)" %\
tbl_name)
# Add some data to each
self.client.execute... | conditional_block | |
test_ddl_stress.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | self.client.execute("alter table %s_part set cached in 'testPool'" % tbl_name)
self.client.execute("alter table %s_part set uncached" % tbl_name)
self.client.execute("alter table %s_part set cached in 'testPool'" % tbl_name)
# Drop the tables, this should remove the cache requests.
self.cl... | # Cache the data the unpartitioned table
self.client.execute("alter table %s set cached in 'testPool'" % tbl_name)
# Cache, uncache, then re-cache the data in the partitioned table. | random_line_split |
test_ddl_stress.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
@classmethod
def add_test_dimensions(cls):
super(TestDdlStress, cls).add_test_dimensions()
cls.TestMatrix.add_dimension(TestDimension('test_id', *TEST_IDS))
cls.TestMatrix.add_constraint(lambda v: v.get_value('exec_option')['batch_size'] == 0)
cls.TestMatrix.add_constraint(lambda v:\
v.ge... | return 'targeted-stress' | identifier_body |
test_ddl_stress.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | (cls):
super(TestDdlStress, cls).add_test_dimensions()
cls.TestMatrix.add_dimension(TestDimension('test_id', *TEST_IDS))
cls.TestMatrix.add_constraint(lambda v: v.get_value('exec_option')['batch_size'] == 0)
cls.TestMatrix.add_constraint(lambda v:\
v.get_value('table_format').file_format == 'te... | add_test_dimensions | identifier_name |
AddProduct.tsx | import {Button, Form, Radio} from "antd";
import React from "react";
import {connect, DispatchProp} from "react-redux";
import {RootState} from "type/state";
interface StateProps {
ui: {
types: Array<{
name: string;
value: string;
}>;
now: Date | null;
};
}
inte... | ))}
</Radio.Group>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
Create
</Button>
</Form.Item>
</Form>
</div>
);
};
co... | <Radio.Group>
{ui.types.map(type => (
<Radio.Button key={type.value} value={type.value}>
{type.name}
</Radio.Button> | random_line_split |
bases.py | typing import Optional, Callable, Any, Type, Union
import wx # type: ignore
from gooey.gui import formatters, events
from gooey.gui.util import wx_util
from gooey.python_bindings.types import FormField
from gooey.util.functional import getin, ifPresent
from gooey.gui.validators import runValidator
from goo... | (self, label, text):
raise NotImplementedError
def getWidget(self, parent: wx.Window, **options):
return self.widget_class(parent, **options)
def connectSignal(self):
raise NotImplementedError
def getSublayout(self, *args, **kwargs):
raise NotImplementedError
... | arrange | identifier_name |
bases.py | from typing import Optional, Callable, Any, Type, Union
import wx # type: ignore
from gooey.gui import formatters, events
from gooey.gui.util import wx_util
from gooey.python_bindings.types import FormField
from gooey.util.functional import getin, ifPresent
from gooey.gui.validators import runValidator
from... |
if self._options.get('help_bg_color'):
self.help_text.SetBackgroundColour(self._options.get('help_bg_color'))
if self._options.get('error_bg_color'):
self.error.SetBackgroundColour(self._options.get('error_bg_color'))
def getWidget(self, *args, **options):
re... | self.label.SetBackgroundColour(self._options.get('label_bg_color')) | conditional_block |
bases.py | typing import Optional, Callable, Any, Type, Union
import wx # type: ignore
from gooey.gui import formatters, events
from gooey.gui.util import wx_util
from gooey.python_bindings.types import FormField
from gooey.util.functional import getin, ifPresent
from gooey.gui.validators import runValidator
from goo... | def receiveChange(self, *args, **kwargs):
raise NotImplementedError
def dispatchChange(self, value, **kwargs):
raise NotImplementedError
def formatOutput(self, metatdata, value):
raise NotImplementedError
class TextContainer(BaseWidget):
# TODO: fix this busted-as... | widget_class: Any
def arrange(self, label, text):
raise NotImplementedError
def getWidget(self, parent: wx.Window, **options):
return self.widget_class(parent, **options)
def connectSignal(self):
raise NotImplementedError
def getSublayout(self, *args, **kwargs):
... | identifier_body |
bases.py | typing import Optional, Callable, Any, Type, Union
import wx # type: ignore
from gooey.gui import formatters, events
from gooey.gui.util import wx_util
from gooey.python_bindings.types import FormField
from gooey.util.functional import getin, ifPresent
from gooey.gui.validators import runValidator
from goo... |
# 1.0.7 initial_value should supersede default when both are present
if self._options.get('initial_value') is not None:
self.setValue(self._options['initial_value'])
# Checking for None instead of truthiness means False-evaluaded defaults can be used.
elif self._meta['d... | random_line_split | |
post_view.js | 'selected',
'post.hidden:post-hidden',
'post.deleted',
'groupNameClass'],
postBinding: 'content',
postTypeClass: function() {
return this.get('post.post_type') === Discourse.Site.currentProp('post_types.moderator_action') ?... | } else if(this._highlight | random_line_split | |
post_view.js | 'selected',
'post.hidden:post-hidden',
'post.deleted',
'groupNameClass'],
postBinding: 'content',
postTypeClass: function() {
return this.get('post.post_type') === Discourse.Site.currentProp('post_types.moderator_action') ? 'moderator' : 'regul... |
var post = this.get('post');
return post.get('post_number') === 1 && post.get('topic.expandable_first_post');
}.property('post.post_number', 'controller.firstPostExpanded'),
// If the cooked content changed, add the quote controls
cookedChanged: function() {
Em.run.scheduleOnce('afterRender', this,... | { return false; } | conditional_block |
slide-edge-gesture.ts | import { SlideGesture } from './slide-gesture';
import { defaults } from '../util/util';
import { pointerCoord } from '../util/dom';
import { Platform } from '../platform/platform';
/**
* @private
*/
export class SlideEdgeGesture extends SlideGesture {
public edges: Array<string>;
public maxEdgeStart: any;
pri... |
getContainerDimensions() {
return {
left: 0,
top: 0,
width: this.plt.width(),
height: this.plt.height(),
};
}
_checkEdge(edge: string, pos: any) {
switch (edge) {
case 'left': return pos.x <= this._d.left + this.maxEdgeStart;
case 'right': return pos.x >= this._d... | {
const coord = pointerCoord(ev);
this._d = this.getContainerDimensions();
return this.edges.every(edge => this._checkEdge(edge, coord));
} | identifier_body |
slide-edge-gesture.ts | import { SlideGesture } from './slide-gesture';
import { defaults } from '../util/util';
import { pointerCoord } from '../util/dom';
import { Platform } from '../platform/platform';
/**
* @private
*/
export class SlideEdgeGesture extends SlideGesture {
public edges: Array<string>;
public maxEdgeStart: any;
pri... | (plt: Platform, element: HTMLElement, opts: any = {}) {
defaults(opts, {
edge: 'left',
maxEdgeStart: 50,
});
super(plt, element, opts);
// Can check corners through use of eg 'left top'
this.edges = opts.edge.split(' ');
this.maxEdgeStart = opts.maxEdgeStart;
}
canStart(ev: any)... | constructor | identifier_name |
slide-edge-gesture.ts | import { SlideGesture } from './slide-gesture';
import { defaults } from '../util/util';
import { pointerCoord } from '../util/dom';
import { Platform } from '../platform/platform';
/**
* @private
*/
export class SlideEdgeGesture extends SlideGesture {
public edges: Array<string>;
public maxEdgeStart: any;
pri... | case 'top': return pos.y <= this._d.top + this.maxEdgeStart;
case 'bottom': return pos.y >= this._d.height - this.maxEdgeStart;
}
}
} | _checkEdge(edge: string, pos: any) {
switch (edge) {
case 'left': return pos.x <= this._d.left + this.maxEdgeStart;
case 'right': return pos.x >= this._d.width - this.maxEdgeStart; | random_line_split |
file_data_source.ts | /**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | */
export class FileDataSource extends DataSource {
/**
* Create a `FileDataSource`.
*
* @param input Local file path, or `File`/`Blob`/`Uint8Array` object to
* read. Local file only works in node environment.
* @param options Options passed to the underlying `FileChunkIterator`s,
* such as {... | * chunks. | random_line_split |
file_data_source.ts | /**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
// TODO(kangyizhang): Add LocalFileChunkIterator to split local streaming
// with file in browser.
return new FileChunkIterator(this.input as FileElement, this.options);
}
}
| {
// tslint:disable-next-line:no-require-imports
const fs = require('fs');
this.input = fs.readFileSync((this.input as string).substr(7));
} | conditional_block |
file_data_source.ts | /**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
}
| {
if (isLocalPath(this.input) && ENV.get('IS_NODE')) {
// tslint:disable-next-line:no-require-imports
const fs = require('fs');
this.input = fs.readFileSync((this.input as string).substr(7));
}
// TODO(kangyizhang): Add LocalFileChunkIterator to split local streaming
// with file in br... | identifier_body |
file_data_source.ts | /**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | (): Promise<ByteChunkIterator> {
if (isLocalPath(this.input) && ENV.get('IS_NODE')) {
// tslint:disable-next-line:no-require-imports
const fs = require('fs');
this.input = fs.readFileSync((this.input as string).substr(7));
}
// TODO(kangyizhang): Add LocalFileChunkIterator to split local s... | iterator | identifier_name |
feeds.py | from mimetypes import guess_type
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.http import Http404
from django.template import TemplateDoesNotExist, RequestContext, NodeList
from ella.core.models import Listing, Category
from ella.core.conf import core_... |
class AtomTopCategoryListings(RSSTopCategoryListings):
feed_type = Atom1Feed
subtitle = RSSTopCategoryListings.description
| fp, created = FormatedPhoto.objects.get_or_create(photo=item.publishable.photo_id, format=self.format)
return fp.image.size | conditional_block |
feeds.py | from mimetypes import guess_type
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.http import Http404
from django.template import TemplateDoesNotExist, RequestContext, NodeList
from ella.core.models import Listing, Category
from ella.core.conf import core_... | def item_link(self, item):
return item.get_absolute_url()
def item_description(self, item):
if not core_settings.RSS_DESCRIPTION_BOX_TYPE:
return item.publishable.description
p = item.publishable
box = p.box_class(p, core_settings.RSS_DESCRIPTION_BOX_TYPE, NodeList(... | random_line_split | |
feeds.py | from mimetypes import guess_type
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.http import Http404
from django.template import TemplateDoesNotExist, RequestContext, NodeList
from ella.core.models import Listing, Category
from ella.core.conf import core_... |
def link(self, obj):
return obj.get_absolute_url()
def description(self, obj):
return obj.app_data.get('syndication', {}).get('description', obj.description)
# Item metadata
###########################################################################
def item_guid(self, item):
... | return obj.app_data.get('syndication', {}).get('title', obj.title) | identifier_body |
feeds.py | from mimetypes import guess_type
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.http import Http404
from django.template import TemplateDoesNotExist, RequestContext, NodeList
from ella.core.models import Listing, Category
from ella.core.conf import core_... | (self, item):
if not hasattr(item, '__enclosure_url'):
if hasattr(item.publishable, 'feed_enclosure'):
item.__enclosure_url = item.publishable.feed_enclosure()['url']
elif self.format is not None and item.publishable.photo_id:
item.__enclosure_url = Format... | item_enclosure_url | identifier_name |
voxtree.rs | use voxel::vox::Vox;
/// voxel tree for fast traversal of content
#[derive(Clone)]
pub struct Voxtree<T>{
pub bitset:u64,
pub content:Option<T>,
pub children:Vec<Voxtree<T>>,
}
impl <T> Voxtree<T>{
pub fn new()->Self{
Voxtree{bitset:0u64, content: None, children:Vec::new()}
}
... |
fn drain(&mut self){
drop(self);
}
}
| {
self.bitset = self.bitset | location;
} | identifier_body |
voxtree.rs | use voxel::vox::Vox;
/// voxel tree for fast traversal of content
#[derive(Clone)]
pub struct Voxtree<T>{
pub bitset:u64,
pub content:Option<T>,
pub children:Vec<Voxtree<T>>,
}
impl <T> Voxtree<T>{
pub fn new()->Self{
Voxtree{bitset:0u64, content: None, children:Vec::new()}
}
... | (&mut self, location:u64){
self.bitset = self.bitset | location;
}
fn drain(&mut self){
drop(self);
}
}
| or_bitset | identifier_name |
voxtree.rs | use voxel::vox::Vox;
/// voxel tree for fast traversal of content
#[derive(Clone)]
pub struct Voxtree<T>{
pub bitset:u64,
pub content:Option<T>,
pub children:Vec<Voxtree<T>>,
}
impl <T> Voxtree<T>{
pub fn new()->Self{
Voxtree{bitset:0u64, content: None, children:Vec::new()}
}
| ///Traverse the tree and get the node at this location
///
///
pub fn get_content(&self, location:&Vec<u64>)->&Option<T>{
let voxtree = self.get_tree(location);
&voxtree.content
}
pub fn set_content(&mut self, location:&Vec<u64>, content:&mut Option<T>){
let mut... | /// | random_line_split |
logging-separate-lines.rs | // Copyright 2013-2014 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-MI... | // ignore-android
// ignore-win32
// exec-env:RUST_LOG=debug
#![feature(phase)]
#[phase(plugin, link)]
extern crate log;
use std::io::Command;
use std::os;
use std::str;
fn main() {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "child" {
debug!("fo... | random_line_split | |
logging-separate-lines.rs | // Copyright 2013-2014 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-MI... |
let p = Command::new(args[0].as_slice())
.arg("child")
.spawn().unwrap().wait_with_output().unwrap();
assert!(p.status.success());
let mut lines = str::from_utf8(p.error.as_slice()).unwrap().lines();
assert!(lines.next().unwrap().contains("foo"));
assert!(li... | {
debug!("foo");
debug!("bar");
return
} | conditional_block |
logging-separate-lines.rs | // Copyright 2013-2014 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-MI... | () {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "child" {
debug!("foo");
debug!("bar");
return
}
let p = Command::new(args[0].as_slice())
.arg("child")
.spawn().unwrap().wait_with_outp... | main | identifier_name |
logging-separate-lines.rs | // Copyright 2013-2014 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-MI... | {
let args = os::args();
let args = args.as_slice();
if args.len() > 1 && args[1].as_slice() == "child" {
debug!("foo");
debug!("bar");
return
}
let p = Command::new(args[0].as_slice())
.arg("child")
.spawn().unwrap().wait_with_output(... | identifier_body | |
BasicForm.js | Ext.form.BasicForm.override({
resetDirty: function() { | field.resetDirty();
});
},
setDefaultValues: function() {
this.items.each(function(field) {
field.setDefaultValue();
}, this);
},
clearValues: function() {
this.items.each(function(field) {
if (field.rendered) field.clearValue();
... | this.items.each(function(field) { | random_line_split |
BasicForm.js | Ext.form.BasicForm.override({
resetDirty: function() {
this.items.each(function(field) {
field.resetDirty();
});
},
setDefaultValues: function() {
this.items.each(function(field) {
field.setDefaultValue();
}, this);
},
clearValues: function() {... |
}, this);
return ret;
}
});
Ext.apply(Ext.form.VTypes, {
//E-Mail Validierung darf ab Ext 2.2 keine Bindestriche mehr haben, jetzt schon wieder
email: function(v) {
return /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(v);
},
emailMask : /[a-z0-9_\.\-@+... | {
ret[field.getName()] = field.getValue();
} | conditional_block |
lexer.js | /** Copyright 2013-2020 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see http://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the Licen... |
// Category for the Application Configuration key names
const CONFIG_KEY = ApplicationTokens.categoryToken;
// Category For the Application deployment key names
const DEPLOYMENT_KEY = DeploymentTokens.categoryToken;
createTokenFromConfig({
name: 'WHITESPACE',
pattern: /[\n\t\r \u2028\u2029]+/,
// Whitesp... | name: 'BOOLEAN',
pattern: Lexer.NA,
}); | random_line_split |
lexer.js | /** Copyright 2013-2020 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see http://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the Licen... |
// Some categories to make the grammar easier to read
const BOOLEAN = createTokenFromConfig({
name: 'BOOLEAN',
pattern: Lexer.NA,
});
// Category for the Application Configuration key names
const CONFIG_KEY = ApplicationTokens.categoryToken;
// Category For the Application deployment key names
const DEPLOYM... | {
const newToken = createTokenFromConfigCreator(config);
tokens[config.name] = newToken;
return newToken;
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.