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
test_envcheckr.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_envcheckr ---------------------------------- Tests for `envcheckr` module. """ import pytest from envcheckr import envcheckr def test_parse_lines(): lines_a = envcheckr.parse_lines('tests/env') assert len(lines_a) == 3 lines_b = envcheckr.parse_li...
file_a = 'tests/env' file_b = 'tests/env.example' missing_keys = envcheckr.get_missing_keys(file_a, file_b) assert(len(missing_keys)) == 4 assert(missing_keys[0]) == 'FOOD=Pizza\n' assert(missing_keys[1]) == 'CODE=Python\n' assert(missing_keys[2]) == 'SPORT=Football\n' assert(missing_keys[3]...
identifier_body
test_envcheckr.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_envcheckr ---------------------------------- Tests for `envcheckr` module. """ import pytest from envcheckr import envcheckr def test_parse_lines(): lines_a = envcheckr.parse_lines('tests/env') assert len(lines_a) == 3 lines_b = envcheckr.parse_li...
(): lines = envcheckr.parse_lines('tests/env') assert(envcheckr.parse_key(lines[0])) == 'FRUIT' assert(envcheckr.parse_key(lines[1])) == 'DRINK' assert(envcheckr.parse_key(lines[2])) == 'ANIMAL' def test_get_missing_keys(): file_a = 'tests/env' file_b = 'tests/env.example' missing_keys = e...
test_parse_key
identifier_name
active.rs
//! Active (fully-registered) client connection handling use irc; use irc::driver::Client; use irc::send::Sender; use world::World; /// An active client pub struct Active { world: World, _out: Sender, nick: String, } impl Active { /// Creates a new `Active` pub fn new(world: World, out: Sender, ...
, _ => { irc::Op::ok(self) } } } }
{ let chan = "#foo".to_string(); let message = "hello".to_string(); let op = self.world.message(chan, self.nick.clone(), message); irc::Op::observe(op, self) }
conditional_block
active.rs
//! Active (fully-registered) client connection handling use irc; use irc::driver::Client; use irc::send::Sender; use world::World; /// An active client pub struct Active { world: World, _out: Sender, nick: String, } impl Active { /// Creates a new `Active` pub fn new(world: World, out: Sender, ...
(self, m: irc::Message) -> irc::Op<Client> { self.handle_easy(m).map(Client::Active) } fn handle_easy(mut self, m: irc::Message) -> irc::Op<Active> { debug!(" -> {:?}", m); match &m.verb[..] { b"JOIN" => { let chan = "#foo".to_string(); let o...
handle
identifier_name
active.rs
//! Active (fully-registered) client connection handling
use irc::send::Sender; use world::World; /// An active client pub struct Active { world: World, _out: Sender, nick: String, } impl Active { /// Creates a new `Active` pub fn new(world: World, out: Sender, nick: String) -> Active { Active { world: world, _out: out, nick: nick } } ...
use irc; use irc::driver::Client;
random_line_split
install_third_party.py
') THIRD_PARTY_STATIC_DIR = os.path.join(THIRD_PARTY_DIR, 'static') MANIFEST_FILE_PATH = os.path.join(os.getcwd(), 'manifest.json') # Place to download zip files for temporary storage. TMP_UNZIP_PATH = os.path.join('.', 'tmp_unzip.zip') # Check that the current directory is correct. common.require_cwd_to_be_oppia(al...
def download_and_unzip_files( source_url, target_parent_dir, zip_root_name, target_root_name): """Downloads a zip file, unzips it, and saves the result in a given dir. The download occurs only if the target directory that the zip file unzips to does not exist. NB: This function assumes that...
"""Downloads a group of files and saves them to a given directory. Each file is downloaded only if it does not already exist. Args: source_url_root: the URL to prepend to all the filenames. target_dir: the directory to save the files to. source_filenames: a list of filenames. Each filename i...
identifier_body
install_third_party.py
') THIRD_PARTY_STATIC_DIR = os.path.join(THIRD_PARTY_DIR, 'static') MANIFEST_FILE_PATH = os.path.join(os.getcwd(), 'manifest.json') # Place to download zip files for temporary storage. TMP_UNZIP_PATH = os.path.join('.', 'tmp_unzip.zip') # Check that the current directory is correct. common.require_cwd_to_be_oppia(al...
(source_url_root, target_dir, source_filenames): """Downloads a group of files and saves them to a given directory. Each file is downloaded only if it does not already exist. Args: source_url_root: the URL to prepend to all the filenames. target_dir: the directory to save the files to. s...
download_files
identifier_name
install_third_party.py
') THIRD_PARTY_STATIC_DIR = os.path.join(THIRD_PARTY_DIR, 'static') MANIFEST_FILE_PATH = os.path.join(os.getcwd(), 'manifest.json') # Place to download zip files for temporary storage. TMP_UNZIP_PATH = os.path.join('.', 'tmp_unzip.zip') # Check that the current directory is correct. common.require_cwd_to_be_oppia(al...
def validate_manifest(filepath): """This validates syntax of the manifest.json Args: filepath: the path to the json file. """ manifest_data = return_json(filepath) dependencies = manifest_data['dependencies'] for _, dependency in dependencies.items(): for _, dependency_contents ...
print '------------------------------------------' print 'There is syntax error in this dependency' print dependency_dict print 'This url %s is invalid for %s file format.' % ( dependency_url, dependency_type) print 'Exiting.' sys.exit(1)
conditional_block
install_third_party.py
_party') THIRD_PARTY_STATIC_DIR = os.path.join(THIRD_PARTY_DIR, 'static') MANIFEST_FILE_PATH = os.path.join(os.getcwd(), 'manifest.json') # Place to download zip files for temporary storage. TMP_UNZIP_PATH = os.path.join('.', 'tmp_unzip.zip') # Check that the current directory is correct. common.require_cwd_to_be_op...
# to be available as a key in the dependency_dict optional_key_pairs = DOWNLOAD_FORMATS_TO_MANIFEST_KEYS[ dependency_type]['optional_key_pairs'] for key in mandatory_keys: if key not in keys: print '------------------------------------------' print 'There is syntax er...
""" keys = dependency_dict.keys() mandatory_keys = DOWNLOAD_FORMATS_TO_MANIFEST_KEYS[ dependency_type]['mandatory_keys'] # Optional keys requires exactly one member of the pair
random_line_split
asset.py
validate(self): self.status = self.get_status() self.validate_item() self.set_missing_values() self.validate_asset_values() self.make_depreciation_schedule() self.set_accumulated_depreciation() if self.get("schedules"): self.validate_expected_value_after_useful_life() # Validate depreciation related...
@frappe.whitelist() def make_purchase_invoice(asset, item_code, gross_purchase_amount, company, posting_date): pi = frappe.new_doc("Purchase Invoice") pi.company = company pi.currency = frappe.db.get_value("Company", company, "default_currency") pi.set_posting_time = 1 pi.posting_date = posting_date pi.append("it...
random_line_split
asset.py
(self): self.status = self.get_status() self.validate_item() self.set_missing_values() self.validate_asset_values() self.make_depreciation_schedule() self.set_accumulated_depreciation() if self.get("schedules"): self.validate_expected_value_after_useful_life() # Validate depreciation related accounts...
def validate_item(self): item = frappe.db.get_value("Item", self.item_code, ["is_fixed_asset", "is_stock_item", "disabled"], as_dict=1) if not item: frappe.throw(_("Item {0} does not exist").format(self.item_code)) elif item.disabled: frappe.throw(_("Item {0} has been disabled").format(self.item_code)...
self.validate_cancellation() self.delete_depreciation_entries() self.set_status()
identifier_body
asset.py
(self): self.status = self.get_status() self.validate_item() self.set_missing_values() self.validate_asset_values() self.make_depreciation_schedule() self.set_accumulated_depreciation() if self.get("schedules"): self.validate_expected_value_after_useful_life() # Validate depreciation related accounts...
self.db_set("status", status) def get_status(self): '''Returns status based on whether it is draft, submitted, scrapped or depreciated''' if self.docstatus == 0: status = "Draft" elif self.docstatus == 1: status = "Submitted" if self.journal_entry_for_scrap: status = "Scrapped" elif flt(self....
status = self.get_status()
conditional_block
asset.py
(self): self.status = self.get_status() self.validate_item() self.set_missing_values() self.validate_asset_values() self.make_depreciation_schedule() self.set_accumulated_depreciation() if self.get("schedules"): self.validate_expected_value_after_useful_life() # Validate depreciation related accounts...
(asset, item_code, company): si = frappe.new_doc("Sales Invoice") si.company = company
make_sales_invoice
identifier_name
customer-list-page.actions.ts
import {Action} from "@ngrx/store"; import {CustomerListResource} from "../api/resources/customer-list.resource"; // Initialize Actions export const INITIALIZE_CUSTOMER_LIST = "INITIALIZE_CUSTOMER_LIST"; // Customer List Actions export const CHANGE_CUSTOMERS_PAGE = "CHANGE_CUSTOMERS_PAGE"; // Customer API Actions ex...
export class InitializeCustomerListAction implements Action { type = INITIALIZE_CUSTOMER_LIST; constructor() { } } export class ChangeCustomersPageAction implements Action { type = CHANGE_CUSTOMERS_PAGE; constructor(public payload: { pageNumber: number, pageSize: number }) { } } export class...
export const REQUEST_CUSTOMERS_FAILED = "REQUEST_CUSTOMERS_FAILED";
random_line_split
customer-list-page.actions.ts
import {Action} from "@ngrx/store"; import {CustomerListResource} from "../api/resources/customer-list.resource"; // Initialize Actions export const INITIALIZE_CUSTOMER_LIST = "INITIALIZE_CUSTOMER_LIST"; // Customer List Actions export const CHANGE_CUSTOMERS_PAGE = "CHANGE_CUSTOMERS_PAGE"; // Customer API Actions ex...
} export class ChangeCustomersPageAction implements Action { type = CHANGE_CUSTOMERS_PAGE; constructor(public payload: { pageNumber: number, pageSize: number }) { } } export class RequestCustomersAction implements Action { type = REQUEST_CUSTOMERS; constructor() { } } export class RequestC...
{ }
identifier_body
customer-list-page.actions.ts
import {Action} from "@ngrx/store"; import {CustomerListResource} from "../api/resources/customer-list.resource"; // Initialize Actions export const INITIALIZE_CUSTOMER_LIST = "INITIALIZE_CUSTOMER_LIST"; // Customer List Actions export const CHANGE_CUSTOMERS_PAGE = "CHANGE_CUSTOMERS_PAGE"; // Customer API Actions ex...
implements Action { type = CHANGE_CUSTOMERS_PAGE; constructor(public payload: { pageNumber: number, pageSize: number }) { } } export class RequestCustomersAction implements Action { type = REQUEST_CUSTOMERS; constructor() { } } export class RequestCustomersSuccessfulAction implements Action...
ChangeCustomersPageAction
identifier_name
cursor.rs
#[cfg(target_os = "android")] #[macro_use] extern crate android_glue; extern crate glutin; use glutin::{Event, ElementState, MouseCursor}; mod support; #[cfg(target_os = "android")] android_start!(main); #[cfg(not(feature = "window"))] fn main() { println!("This example requires glutin to be compiled with the `win...
() { let window = glutin::WindowBuilder::new().with_gl_profile(glutin::GlProfile::Compatibility).build().unwrap(); window.set_title("A fantastic window!"); unsafe { window.make_current() }; let context = support::load(&window); let cursors = [MouseCursor::Default, MouseCursor::Crosshair, Mo...
main
identifier_name
cursor.rs
#[cfg(target_os = "android")] #[macro_use] extern crate android_glue; extern crate glutin; use glutin::{Event, ElementState, MouseCursor}; mod support; #[cfg(target_os = "android")] android_start!(main); #[cfg(not(feature = "window"))] fn main() { println!("This example requires glutin to be compiled with the `win...
match event { Event::KeyboardInput(ElementState::Pressed, _, _) => { println!("Setting cursor to \"{:?}\"", cursors[cursor_idx]); window.set_cursor(cursors[cursor_idx]); if cursor_idx < cursors.len() - 1 { cursor_idx += 1; ...
let mut cursor_idx = 0; for event in window.wait_events() {
random_line_split
cursor.rs
#[cfg(target_os = "android")] #[macro_use] extern crate android_glue; extern crate glutin; use glutin::{Event, ElementState, MouseCursor}; mod support; #[cfg(target_os = "android")] android_start!(main); #[cfg(not(feature = "window"))] fn main() { println!("This example requires glutin to be compiled with the `win...
}, Event::Closed => break, _ => (), } context.draw_frame((0.0, 1.0, 0.0, 1.0)); window.swap_buffers(); } }
{ let window = glutin::WindowBuilder::new().with_gl_profile(glutin::GlProfile::Compatibility).build().unwrap(); window.set_title("A fantastic window!"); unsafe { window.make_current() }; let context = support::load(&window); let cursors = [MouseCursor::Default, MouseCursor::Crosshair, Mouse...
identifier_body
compositeDisposable.ts
// notice_start /* * Copyright 2015 Dev Shop Limited * * 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 applicabl...
public remove(disposable: () => void): boolean; public remove(disposable: DisposableItem): boolean; public remove(disposable: any): boolean { let i = this._disposables.findIndex(w => w.underlyingDisposable === disposable); if (1 > -1) { this._disposables.splice(i, 1); ...
{ let disposableWrapper = new DisposableWrapper(disposable); if (this._isDisposed) { disposableWrapper.dispose(); return; } this._disposables.push(disposableWrapper); return this; }
identifier_body
compositeDisposable.ts
// notice_start /* * Copyright 2015 Dev Shop Limited * * 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 applicabl...
(): boolean { return this._isDisposed; } public add(disposable: () => void): this; public add(disposable: DisposableItem): this; public add(disposable: any): this { let disposableWrapper = new DisposableWrapper(disposable); if (this._isDisposed) { disposableWrapper.d...
closed
identifier_name
compositeDisposable.ts
// notice_start /* * Copyright 2015 Dev Shop Limited * * 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 applicabl...
disposable.dispose(); } this._disposables.length = 0; } } }
if (!this._isDisposed) { this._isDisposed = true; for (let i = 0, len = this._disposables.length; i < len; i++) { let disposable = this._disposables[i];
random_line_split
compositeDisposable.ts
// notice_start /* * Copyright 2015 Dev Shop Limited * * 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 applicabl...
return false; } public unsubscribe(): void { this.dispose(); } public dispose(): void { if (!this._isDisposed) { this._isDisposed = true; for (let i = 0, len = this._disposables.length; i < len; i++) { let disposable = this._disposables[...
{ this._disposables.splice(i, 1); return true; }
conditional_block
formatUtil.js
"use strict"; const chalk = require("chalk"); const readline = require("readline"); /** * Fill screen with blank lines, move to "0" afterwards and clear screen afterwards. * Note that it is still possible to "scroll back" afterwards. * * Function performs nothing in case the stdout is NOT a TTY. */ exports.cls =...
}; /** * A less soft version of `cls` above which completely clears out the screen, * without leaving the option to scroll up again. * * Function performs nothing in case the stdout is NOT a TTY. */ exports.hardCls = function() { if (process.stdout.isTTY) { process.stdout.write( process.platform === ...
{ const blank = "\n".repeat(process.stdout.rows); console.log(blank); readline.cursorTo(process.stdout, 0, 0); readline.clearScreenDown(process.stdout); }
conditional_block
formatUtil.js
"use strict"; const chalk = require("chalk"); const readline = require("readline"); /** * Fill screen with blank lines, move to "0" afterwards and clear screen afterwards. * Note that it is still possible to "scroll back" afterwards. * * Function performs nothing in case the stdout is NOT a TTY. */ exports.cls =...
* Function performs nothing in case the stdout is NOT a TTY. */ exports.hardCls = function() { if (process.stdout.isTTY) { process.stdout.write( process.platform === "win32" ? "\x1Bc" : "\x1B[2J\x1B[3J\x1B[H" ); } }; exports.formatFirstLineMessage = function(text) { return chalk.bgWhite.black(tex...
random_line_split
TouchEvent.d.ts
import { Event } from './Event'; import { Layer } from '../display/Layer'; export declare class
extends Event { /** @event touchStart */ static readonly TOUCH_START: string; /** @event touchMove */ static readonly TOUCH_MOVE: string; /** @event touchEnd */ static readonly TOUCH_END: string; /** @event touchCancel */ static readonly TOUCH_CANCEL: string; /** @event touchTap */ ...
TouchEvent
identifier_name
TouchEvent.d.ts
import { Event } from './Event'; import { Layer } from '../display/Layer'; export declare class TouchEvent extends Event { /** @event touchStart */ static readonly TOUCH_START: string; /** @event touchMove */ static readonly TOUCH_MOVE: string; /** @event touchEnd */ static readonly TOUCH_END: s...
currentTarget: Layer; targetX: number; targetY: number; localX: number; localY: number; stageX: number; stageY: number; identifier: number; cancelBubble: boolean; protected constructor(type: string); protected $init(type: string): this; stopPropagation(): void; releas...
static readonly TOUCH_CANCEL: string; /** @event touchTap */ static readonly TOUCH_TAP: string; target: Layer;
random_line_split
NodeURL_test.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. const {assert} = chai; import * as ProtocolClient from '../../../../../front_end/core/protocol_client/protocol_client.js'; import * as Host from '../../....
it('works correctly on linux', () => { const isWindows = false; assert.isFalse(ProtocolClient.NodeURL.NodeURL.isPlatformPath('c:\\prog\\foobar.js', isWindows)); assert.isTrue(ProtocolClient.NodeURL.NodeURL.isPlatformPath('/usr/local/foobar.js', isWindows)); }); }); describe('patch', () =>...
random_line_split
config.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import logging ENV_VAR_ROOT = "IG_SERVICE" CONFIG_FILE_NAME = "trading_ig_config.py" logger = logging.getLogger(__name__) class ConfigEnvVar(object): def __init__(self, env_var_base): self.ENV_VAR_BASE = env_var_base def _env_var(self, key): ...
def get(self, key, default_value=None): env_var = self._env_var(key) return os.environ.get(env_var, default_value) def __getattr__(self, key): env_var = self._env_var(key) try: return os.environ[env_var] except KeyError: raise Exception("Environ...
return self.ENV_VAR_BASE + "_" + key.upper()
identifier_body
config.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import logging ENV_VAR_ROOT = "IG_SERVICE" CONFIG_FILE_NAME = "trading_ig_config.py" logger = logging.getLogger(__name__) class ConfigEnvVar(object): def __init__(self, env_var_base): self.ENV_VAR_BASE = env_var_base def _env_var(self, key): ...
except KeyError: raise Exception("Environment variable '%s' doesn't exist" % env_var) try: from trading_ig_config import config logger.info("import config from %s" % CONFIG_FILE_NAME) except Exception: logger.warning("can't import config from config file") try: config = Co...
try: return os.environ[env_var]
random_line_split
config.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import logging ENV_VAR_ROOT = "IG_SERVICE" CONFIG_FILE_NAME = "trading_ig_config.py" logger = logging.getLogger(__name__) class ConfigEnvVar(object): def __init__(self, env_var_base): self.ENV_VAR_BASE = env_var_base def _env_var(self, key): ...
(self, key, default_value=None): env_var = self._env_var(key) return os.environ.get(env_var, default_value) def __getattr__(self, key): env_var = self._env_var(key) try: return os.environ[env_var] except KeyError: raise Exception("Environment variable...
get
identifier_name
unittestbase.py
# 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/. import mock import os from configman import ConfigurationManager from socorro.external.elasticsearch import crashstora...
'resource.elasticsearch.backoff_delays': [1], 'resource.elasticsearch.elasticsearch_timeout': 5, 'resource.postgresql.database_name': 'socorro_integration_test' } if es_index: values_source['resource.elasticsearch.elasticsearch_index'] = es_index ...
random_line_split
unittestbase.py
# 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/. import mock import os from configman import ConfigurationManager from socorro.external.elasticsearch import crashstora...
config_manager = ConfigurationManager( [storage_config, middleware_config], app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[os.environ, values_source], argv_source=[], ) retur...
values_source['resource.elasticsearch.elasticsearch_index'] = es_index
conditional_block
unittestbase.py
# 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/. import mock import os from configman import ConfigurationManager from socorro.external.elasticsearch import crashstora...
app_name='testapp', app_version='1.0', app_description='app description', values_source_list=[os.environ, values_source], argv_source=[], ) return config_manager.get_config()
mock_logging = mock.Mock() storage_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() middleware_config = MiddlewareApp.get_required_config() middleware_config.add_option('logger', default=mock_logging) values_source = { 'logger': mock_loggi...
identifier_body
unittestbase.py
# 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/. import mock import os from configman import ConfigurationManager from socorro.external.elasticsearch import crashstora...
(self, es_index=None): mock_logging = mock.Mock() storage_config = \ crashstorage.ElasticSearchCrashStorage.get_required_config() middleware_config = MiddlewareApp.get_required_config() middleware_config.add_option('logger', default=mock_logging) values_source = { ...
get_config_context
identifier_name
webgluniformlocation.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 dom::bindings::codegen::Bindings::WebGLUn...
impl WebGLUniformLocation { fn new_inherited(id: i32) -> WebGLUniformLocation { WebGLUniformLocation { reflector_: Reflector::new(), id: id, } } pub fn new(global: GlobalRef, id: i32) -> Root<WebGLUniformLocation> { reflect_dom_object(box WebGLUniformLocatio...
pub struct WebGLUniformLocation { reflector_: Reflector, id: i32, }
random_line_split
webgluniformlocation.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 dom::bindings::codegen::Bindings::WebGLUn...
(id: i32) -> WebGLUniformLocation { WebGLUniformLocation { reflector_: Reflector::new(), id: id, } } pub fn new(global: GlobalRef, id: i32) -> Root<WebGLUniformLocation> { reflect_dom_object(box WebGLUniformLocation::new_inherited(id), global, WebGLUniformLocatio...
new_inherited
identifier_name
cssmediarule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::Parser; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bind...
(&self) -> Root<MediaList> { self.medialist() } }
Media
identifier_name
cssmediarule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::Parser; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bind...
fn Media(&self) -> Root<MediaList> { self.medialist() } }
} } impl CSSMediaRuleMethods for CSSMediaRule { // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-media
random_line_split
cssmediarule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use cssparser::Parser; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bind...
fn get_css(&self) -> DOMString { self.mediarule.read().to_css_string().into() } } impl CSSMediaRuleMethods for CSSMediaRule { // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-media fn Media(&self) -> Root<MediaList> { self.medialist() } }
{ use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleConstants; CSSRuleConstants::MEDIA_RULE }
identifier_body
make_ml_output_summary.py
#def get_var(self): # self.vars = {} #self.cps_all = np.array(self.cps_all) # varT = self.cps_all.var() # self.vars["all"]=varT # self.means = {} # meanT = self.cps_all.mean(1) # self.means["all"] = meanT # for p...
def __init__(self,name,chr,start,end,TID): self.name = name self.chr = chr self.start = start self.end = end self.frequencies_by_pop = {} self.cps_by_genome = {} self.transcript_id = TID self.TID = TID self.cps_all = [] self.pop_by_genome =...
identifier_body
make_ml_output_summary.py
OUT = open(outfile_name,'w') FOUT.write("indiv,cp,pop,cell lines fixed, cell lines in Nitrogen,coverage\n") for indiv,cp in region_info.cps_by_genome.iteritems(): pop = region_info.pop_by_genome[indiv] output = indiv in cell_line_info and cell_line_info[indiv] or "" output = "%s,%d,%s,%...
(gene_file): cps_by_TID = {} for line in open(gene_file,'r').readlines(): if len(line
get_cp_by_gene
identifier_name
make_ml_output_summary.py
OUT = open(outfile_name,'w') FOUT.write("indiv,cp,pop,cell lines fixed, cell lines in Nitrogen,coverage\n") for indiv,cp in region_info.cps_by_genome.iteritems(): pop = region_info.pop_by_genome[indiv] output = indiv in cell_line_info and cell_line_info[indiv] or "" output = "%s,%d,%s,%...
i=0 for pop,freqs in region_info.frequencies_by_pop.iteritems(): med = np.median(np.array(freqs)) sig2 = np.array(freqs).var() leg.append("%s med: %d var: %.1f"%(pop,int(med),sig2)) i+=1 for pop,hist in pop_to_hists.iteritems(): bars[pop] = ax.bar(x+k*width,hist,widt...
starty = .9 sub=.03
random_line_split
make_ml_output_summary.py
OUT = open(outfile_name,'w') FOUT.write("indiv,cp,pop,cell lines fixed, cell lines in Nitrogen,coverage\n") for indiv,cp in region_info.cps_by_genome.iteritems():
def make_simple_plot(region,region_info,outdir,cell_line_info,genome_info): plt.rc('grid',color='0.75',linestyle='l',linewidth='0.1') f=plt.figure() f.set_figwidth(6) f.set_figheight(6) axescolor = '#f6f6f6' left, width = 0.1, 0.8 rect1 = [left, 0.1, width, 0.8] #left, bottom, ...
pop = region_info.pop_by_genome[indiv] output = indiv in cell_line_info and cell_line_info[indiv] or "" output = "%s,%d,%s,%s,%f\n"%(indiv,cp,pop,output,genome_info.genomes[indiv].coverage) FOUT.write(output) print output
conditional_block
Cylinder.py
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~~...
# version __id__ = "$Id: Cylinder.py,v 1.1.1.1 2005/03/08 16:13:45 aivazis Exp $" # End of file
AbstractNode.__init__(self, attributes) self._radius = self._parse(attributes["radius"]) self._height = self._parse(attributes["height"]) return
identifier_body
Cylinder.py
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~~...
(self, parent): cylinder = pyre.geometry.solids.cylinder(radius=self._radius, height=self._height) parent.onCylinder(cylinder) return def __init__(self, document, attributes): AbstractNode.__init__(self, attributes) self._radius = self._parse(attributes["radius"]) ...
notify
identifier_name
Cylinder.py
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # <LicenseText> # # ~~~~~~~~~~~...
# version __id__ = "$Id: Cylinder.py,v 1.1.1.1 2005/03/08 16:13:45 aivazis Exp $" # End of file
AbstractNode.__init__(self, attributes) self._radius = self._parse(attributes["radius"]) self._height = self._parse(attributes["height"]) return
random_line_split
ContactPhoneTwoTone.js
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon([/*#__PURE__*/_jsx("path", { d: "M22 5H2v14h20V5zM9 6c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3zm6 12H3v-1.41C3 14.08 6.97 13 9 13s6 1.08 6 3.58V18zm2.85-4h1.64L21 16l-1.99 1.99c-...
}, "0"), /*#__PURE__*/_jsx("path", { d: "M2 21h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2zM2 5h20v14H2V5zm17.49 5L21 8l-1.99-1.99c-1.31.98-2.28 2.37-2.73 3.99-.18.64-.28 1.31-.28 2s.1 1.36.28 2c.45 1.61 1.42 3.01 2.73 3.99L21 16l-1.51-2h-1.64c-.22-.63-.35-1.3-.35-2s.13-1.37.35-2h1.6...
random_line_split
socket.js
* Socket implementation that uses flash SocketPool class as a backend. * * @author Dave Longley * * Copyright (c) 2010-2012 Digital Bazaar, Inc. */ (function() { // define forge var forge = window.forge = window.forge || {}; // define net namespace var net = { // map of flash ID to socket pool socketPools: ...
/**
random_line_split
socket.js
/** * Socket implementation that uses flash SocketPool class as a backend. * * @author Dave Longley * * Copyright (c) 2010-2012 Digital Bazaar, Inc. */ (function() { // define forge var forge = window.forge = window.forge || {}; // define net namespace var net = { // map of flash ID to socket pool socketPoo...
}; } var handler = 'window.forge.net.socketPools[\'' + spId + '\'].handler'; api.subscribe('connect', handler); api.subscribe('close', handler); api.subscribe('socketData', handler); api.subscribe('ioError', handler); api.subscribe('securityError', handler); /** * Destroys a socket pool. The so...
{ // get handler function var f; switch(e.type) { case 'connect': f = 'connected'; break; case 'close': f = 'closed'; break; case 'socketData': f = 'data'; break; default: f = 'error'; ...
conditional_block
Gruntfile.js
module.exports = function(grunt){ grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { ctags: { files: ['ctags'], tasks: ['shell:ctags'], options: { nospawn: false, }, } ...
}, options:{ stdout:true } }, }); grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['watch']); grunt.registerTask('release', ['shell:release']); };
'--sort=no --language-force=css --css-types=cis test.css' ].join('&&') }, release: { command: 'cp ctags $HOME/.ctags',
random_line_split
runtests.py
#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red if __name__ == '__main__': # Kept some files for ...
else: print(green('Coverage is {0}%'.format(percentage)))
random_line_split
runtests.py
#!/usr/bin/env python """ This script is used to run tests, create a coverage report and output the statistics at the end of the tox run. To run this script just execute ``tox`` """ import re from fabric.api import local, warn from fabric.colors import green, red if __name__ == '__main__': # Kept some files for ...
print(green('Coverage is {0}%'.format(percentage)))
conditional_block
index.d.ts
// Type definitions for linkify-it 2.0.3 // Project: https://github.com/markdown-it/linkify-it // Definitions by: Lindsey Smith <https://github.com/praxxis>, Robert Coie <https://github.com/rapropos/typed-linkify-it> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare const LinkifyIt: { ( ...
interface Match { index: number; lastIndex: number; raw: string; schema: string; text: string; url: string; } interface LinkifyIt { add(schema: string, rule: Rule): LinkifyIt; match(text: string): Match[]; normalize(raw: string): stri...
}
random_line_split
e2e.d.ts
/** * Builds and serves an Angular app, then runs end-to-end tests using Protractor. */ export interface Schema { /** * A named build target, as specified in the "configurations" section of angular.json. * Each named target is accompanied by a configuration of option defaults for that target. */ ...
*/ prod?: boolean; /** * The name of the project to build. Can be an app or a library. */ project?: string; } /** * Shows a help message for this command in the console. */ export declare type HelpUnion = boolean | HelpEnum; export declare enum HelpEnum { HelpJson = "JSON", Json = "...
random_line_split
add.js
#!/usr/bin/env node /* eslint no-console: "off" */ const Command = require('../../lib/Command'), CommandError = require('../../lib/errors/CommandError'); const COMMAND = 'add <name>'; const DESCRIPTION = 'Adds a centre.'; const USAGE = `$0 centre ${COMMAND} ${DESCRIPTION} NAME is the name to assign to...
console.log('Centre', json.data.name, 'added'); } } var command = new CentreAddCommand(); exports.command = COMMAND; exports.describe = DESCRIPTION; exports.builder = (yargs) => command.builder(yargs); exports.handler = (argv) => command.handler(argv); /* Local Variables: */ /* mode: js2 */ /* End: ...
.then((json) => this.handleJsonReply(json)) .catch((json) => console.log('Error:', json.message)); } handleJsonReply(json) {
random_line_split
add.js
#!/usr/bin/env node /* eslint no-console: "off" */ const Command = require('../../lib/Command'), CommandError = require('../../lib/errors/CommandError'); const COMMAND = 'add <name>'; const DESCRIPTION = 'Adds a centre.'; const USAGE = `$0 centre ${COMMAND} ${DESCRIPTION} NAME is the name to assign to...
json.name = this.argv.name; if (this.argv.description) { json.description = this.argv.description; } return this.connection.postRequest('centres/', json) .then((json) => this.handleJsonReply(json)) .catch((json) => console.log('Error:', json.message)); } handleJsonReply(json) {...
{ return Promise.reject(new CommandError('CentreAddCommand', 'invalid arguments')); }
conditional_block
add.js
#!/usr/bin/env node /* eslint no-console: "off" */ const Command = require('../../lib/Command'), CommandError = require('../../lib/errors/CommandError'); const COMMAND = 'add <name>'; const DESCRIPTION = 'Adds a centre.'; const USAGE = `$0 centre ${COMMAND} ${DESCRIPTION} NAME is the name to assign to...
(yargs) { return super.builder(yargs) .usage(USAGE) .string('d') .nargs('d', 1) .alias('d', 'description') .describe('d', 'the description for this centre'); } handleCommand() { var json = {}; if (this.argv._.length > 1) { return Promise.reject(new CommandError('Cen...
builder
identifier_name
gyp_node.py
#!/usr/bin/env python import glob import os import shlex import sys script_dir = os.path.dirname(__file__) node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib')) import gyp # Directory within which we want all generated files (including...
(args): rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc) if __name__ == '__main__': args = sys.argv[1:] # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. if sys.platform == 'win32': args.appen...
run_gyp
identifier_name
gyp_node.py
#!/usr/bin/env python import glob import os import shlex import sys script_dir = os.path.dirname(__file__) node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib')) import gyp # Directory within which we want all generated files (including...
if __name__ == '__main__': args = sys.argv[1:] # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. if sys.platform == 'win32': args.append(os.path.join(node_root, 'node.gyp')) common_fn = os.path.join(node_root, 'common.gy...
rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc)
identifier_body
gyp_node.py
#!/usr/bin/env python import glob import os import shlex import sys script_dir = os.path.dirname(__file__) node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib')) import gyp # Directory within which we want all generated files (including...
args.append('-Dcomponent=static_library') args.append('-Dlibrary=static_library') gyp_args = list(args) run_gyp(gyp_args)
args.extend(['--generator-output', output_dir]) # Tell make to write its output into the same dir args.extend(['-Goutput_dir=' + output_dir])
conditional_block
gyp_node.py
#!/usr/bin/env python import glob import os import shlex import sys script_dir = os.path.dirname(__file__) node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib')) import gyp # Directory within which we want all generated files (including...
args.append('-Dlibrary=static_library') gyp_args = list(args) run_gyp(gyp_args)
args.append('-Dcomponent=static_library')
random_line_split
projectfree.py
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 l...
(self, url, hostDict, hostprDict): try: sources = [] if url == None: return sources url = urlparse.urljoin(self.base_link, url) r = proxy.request(url, 'movies') links = client.parseDOM(r, 'tr') for i in links: try: ...
sources
identifier_name
projectfree.py
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 l...
sources.append({'source': host, 'quality': quality, 'language': 'en', 'url': url, 'direct': False, 'debridonly': False}) except: pass filter = [i for i in sources if i['quality'] == 'SD'] if filter: sources = filter return s...
quality = 'SD'
conditional_block
projectfree.py
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 l...
return url
identifier_body
projectfree.py
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 l...
import re,urllib,urlparse from resources.lib.modules import cleantitle from resources.lib.modules import client from resources.lib.modules import proxy class source: def __init__(self): self.priority = 0 self.language = ['en'] self.domains = ['project-free-tv.ch', 'project-free-tv.ag'] ...
'''
random_line_split
app.js
/** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'v...
app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } app.get('/', routes.index); app.get('/users', user.list); http.createServer(app).listen(app.get('port'), function() { console.log('Express server listening on...
app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(app.router);
random_line_split
app.js
/** * Module dependencies. */ var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'v...
app.get('/', routes.index); app.get('/users', user.list); http.createServer(app).listen(app.get('port'), function() { console.log('Express server listening on port ' + app.get('port')); });
{ app.use(express.errorHandler()); }
conditional_block
rmonitor_allocations_example.py
# Copyright (C) 2016- The University of Notre Dame This software is distributed # under the GNU General Public License. See the file COPYING for details. from ResourceMonitor import * import random import sys # Generate syntetic resource samples according to beta(2, 5) def beta(start, end, alpha = 2, beta = 5): ...
if __name__ == '__main__': # set seed so that we can compare runs. random.seed(42) # wall time in seconds wall_time = 1 # min memory, in MB memory_min = 50 # max memory, in MB memory_max = 10000 # number of samples to compute per category number_of_tasks = 10 # cre...
return int(random.triangular(start, end, start + mode*(end - start)))
identifier_body
rmonitor_allocations_example.py
# Copyright (C) 2016- The University of Notre Dame This software is distributed # under the GNU General Public License. See the file COPYING for details. from ResourceMonitor import * import random import sys # Generate syntetic resource samples according to beta(2, 5) def beta(start, end, alpha = 2, beta = 5): ...
(start, end, mode = 0.1): return int(random.triangular(start, end, start + mode*(end - start))) if __name__ == '__main__': # set seed so that we can compare runs. random.seed(42) # wall time in seconds wall_time = 1 # min memory, in MB memory_min = 50 # max memory, in MB memor...
triangular
identifier_name
rmonitor_allocations_example.py
# Copyright (C) 2016- The University of Notre Dame This software is distributed # under the GNU General Public License. See the file COPYING for details. from ResourceMonitor import * import random import sys # Generate syntetic resource samples according to beta(2, 5) def beta(start, end, alpha = 2, beta = 5): ...
sys.exit(0)
try: fa = categories.first_allocation(mode = 'throughput', category = name) print '%-15s: %5d' % (name, fa['memory']) except TypeError: print name + ' distribution not available.'
conditional_block
rmonitor_allocations_example.py
# Copyright (C) 2016- The University of Notre Dame This software is distributed # under the GNU General Public License. See the file COPYING for details. from ResourceMonitor import * import random import sys # Generate syntetic resource samples according to beta(2, 5) def beta(start, end, alpha = 2, beta = 5): ...
# Generate syntetic resource samples according to exp(1.25) def exponential(start, end, lambd = 1.25): return int((end - start) * random.expovariate(lambd)) + start # Generate syntetic resource samples according to triangular(0.1) def triangular(start, end, mode = 0.1): return int(random.triangular(start, end...
random_line_split
local_ptr.rs
option. This file may not be copied, modified, or distributed // except according to those terms. //! Access to a single thread-local pointer. //! //! The runtime will use this for storing ~Task. //! //! XXX: Add runtime checks for usage of inconsistent pointer types. //! and for overwriting an existing pointer. #[a...
/// Take ownership of a pointer from thread-local storage. /// /// # Safety note /// /// Does not validate the pointer type. #[inline] pub unsafe fn take<T>() -> ~T { let ptr = RT_TLS_PTR; rtassert!(!ptr.is_null()); let ptr: ~T = cast::transmute(ptr); // can...
{ RT_TLS_PTR = cast::transmute(sched) }
identifier_body
local_ptr.rs
option. This file may not be copied, modified, or distributed // except according to those terms. //! Access to a single thread-local pointer. //! //! The runtime will use this for storing ~Task. //! //! XXX: Add runtime checks for usage of inconsistent pointer types. //! and for overwriting an existing pointer. #[a...
<'a>(&'a mut self) -> &'a mut T { unsafe { let val_ptr: &mut ~T = cast::transmute(&mut self.val); let val_ptr: &'a mut T = *val_ptr; val_ptr } } } /// Borrow the thread-local value from thread-local storage. /// While the value is borrowed it is not available in ...
get
identifier_name
local_ptr.rs
// option. This file may not be copied, modified, or distributed // except according to those terms. //! Access to a single thread-local pointer. //! //! The runtime will use this for storing ~Task. //! //! XXX: Add runtime checks for usage of inconsistent pointer types. //! and for overwriting an existing pointer. #...
} else { Some(RT_TLS_PTR as *mut T) } } } /// Native implementation of having the runtime thread-local pointer. This /// implementation uses the `thread_local_storage` module to provide a /// thread-local value. pub mod native { use cast; use libc::c_void; use option::{Optio...
random_line_split
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test.support import reap_children, get_attribute, verbose # Skip test if fork does not exist. get_attribute(os, 'fork') cl...
self.wait_impl(pid) # Check this works with various levels of nested # import in the main thread for level in range(5): fork_with_import_lock(level) def tearDownModule(): reap_children() if __name__ == "__main__": unittest.main()
release = 0 in_child = False try: try: for i in range(level): imp.acquire_lock() release += 1 pid = os.fork() in_child = not pid finally: ...
identifier_body
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test.support import reap_children, get_attribute, verbose # Skip test if fork does not exist. get_attribute(os, 'fork')
def wait_impl(self, cpid): deadline = time.monotonic() + 10.0 while time.monotonic() <= deadline: # waitpid() shouldn't hang, but some of the buildbots seem to hang # in the forking tests. This is an attempt to fix the problem. spid, status = os.waitpid(cpid, os....
class ForkTest(ForkWait):
random_line_split
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test.support import reap_children, get_attribute, verbose # Skip test if fork does not exist. get_attribute(os, 'fork') cl...
os._exit(1) raise if in_child: os._exit(0) self.wait_impl(pid) # Check this works with various levels of nested # import in the main thread for level in range(5): fork_with_import_lock(level) def tearDown...
print("RuntimeError in child")
conditional_block
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test.support import reap_children, get_attribute, verbose # Skip test if fork does not exist. get_attribute(os, 'fork') cl...
(self): """Check fork() in main thread works while the main thread is doing an import""" # Issue 9573: this used to trigger RuntimeError in the child process def fork_with_import_lock(level): release = 0 in_child = False try: try: ...
test_nested_import_lock_fork
identifier_name
Icon.tsx
import classnames from 'classnames'; import * as React from 'react'; import * as styles from './Icon.scss'; enum Fills { NONE, CURRENT_COLOR, } enum Sizes { SMALL, MEDIUM, } interface Props { className?: string; fill: Fills; glyph: string; size: Sizes; } export default class Icon extends React.PureC...
(): React.ReactNode { const {className, fill, glyph, size, ...restProps} = this.props; return ( <svg className={classnames(styles.icon, className, { [styles.fillCurrentColor]: fill === Fills.CURRENT_COLOR, [styles.sizeMedium]: size === Sizes.MEDIUM, [styles.sizeSmall...
render
identifier_name
Icon.tsx
import classnames from 'classnames'; import * as React from 'react'; import * as styles from './Icon.scss'; enum Fills { NONE, CURRENT_COLOR, } enum Sizes { SMALL, MEDIUM, } interface Props { className?: string; fill: Fills;
export default class Icon extends React.PureComponent<Props> { public static defaultProps = { fill: Fills.CURRENT_COLOR, size: Sizes.MEDIUM, }; public static Fills = Fills; public static Sizes = Sizes; public render(): React.ReactNode { const {className, fill, glyph, size, ...restProps} = this....
glyph: string; size: Sizes; }
random_line_split
Icon.tsx
import classnames from 'classnames'; import * as React from 'react'; import * as styles from './Icon.scss'; enum Fills { NONE, CURRENT_COLOR, } enum Sizes { SMALL, MEDIUM, } interface Props { className?: string; fill: Fills; glyph: string; size: Sizes; } export default class Icon extends React.PureC...
}
{ const {className, fill, glyph, size, ...restProps} = this.props; return ( <svg className={classnames(styles.icon, className, { [styles.fillCurrentColor]: fill === Fills.CURRENT_COLOR, [styles.sizeMedium]: size === Sizes.MEDIUM, [styles.sizeSmall]: size === Sizes.SM...
identifier_body
click_object.rs
extern crate gtk; use gtk::{ScrolledWindow,ContainerExt,Box,Orientation,Entry,EntryExt,Frame}; use std::vec::Vec; pub trait Attachable{ fn attach<F:ContainerExt>(&self,parent: &F); } pub struct Control {} impl Control { pub fn play(&self){ println!("Play") } pub fn rew(&self){ printl...
} impl Clone for Control{ fn clone(&self)->Self{ return Control{} } } impl Copy for Control {} pub struct LabelFrame { label_box:Box, labels:Vec<Label> } impl LabelFrame{ pub fn new(labels:Vec<Label>)->LabelFrame{ let label_box=Box::new(Orientation::Vertical,0); //Add labe...
{ println!("Fast Forward") }
identifier_body
click_object.rs
extern crate gtk; use gtk::{ScrolledWindow,ContainerExt,Box,Orientation,Entry,EntryExt,Frame}; use std::vec::Vec; pub trait Attachable{ fn attach<F:ContainerExt>(&self,parent: &F); } pub struct Control {} impl Control { pub fn play(&self){ println!("Play") } pub fn rew(&self){ printl...
}
random_line_split
click_object.rs
extern crate gtk; use gtk::{ScrolledWindow,ContainerExt,Box,Orientation,Entry,EntryExt,Frame}; use std::vec::Vec; pub trait Attachable{ fn attach<F:ContainerExt>(&self,parent: &F); } pub struct Control {} impl Control { pub fn play(&self){ println!("Play") } pub fn rew(&self){ printl...
(labels:Vec<Label>)->LabelFrame{ let label_box=Box::new(Orientation::Vertical,0); //Add labels here for label in &labels{ label.attach(&label_box) } LabelFrame{label_box: label_box,labels:labels} } } impl Attachable for LabelFrame{ fn attach<F:ContainerExt>(&s...
new
identifier_name
spellbook.js
= input.length-1; i >=0; i--) { var randomIndex = Math.floor(Math.random()*(i+1)); var itemAtIndex = input[randomIndex]; input[randomIndex] = input[i]; input[i] = itemAtIndex; } return input; } } if (!Array.prototype.first) { Array.prototype.first = function() { return this[0]; ...
(date, format) { var m, d, y, i = 0, len = format.length, f; for (i; i < len; i++) { f = format[i]; if (/m/.test(f)) m = date[i]; if (/d/.test(f)) d = date[i]; if (/y/.test(f)) y = date[i]; } return ( m > 0 && m < 13 && y && y.length === 4 && d > 0 && d <= (new Date(y, m, 0))...
isDate
identifier_name
spellbook.js
if (typeof response === "function") response(); } }, interval); } else { for (var i = 0; i < self.length; i++) { interval(self[i], i); if (typeof callback === "function") { if (i === self.length - 1) callback(); } } } } } if (!Array.prototype.eachEnd) { Array.prototype.eachEnd ...
{ var encodedString = ''; for (var prop in object) { if (object.hasOwnProperty(prop)) { if (encodedString.length > 0) { encodedString += '&'; } encodedString += encodeURI(prop + '=' + object[prop]); } } return encode...
identifier_body
spellbook.js
= input.length-1; i >=0; i--) { var randomIndex = Math.floor(Math.random()*(i+1)); var itemAtIndex = input[randomIndex]; input[randomIndex] = input[i]; input[i] = itemAtIndex; } return input; } } if (!Array.prototype.first) { Array.prototype.first = function() { return this[0]; ...
} if (!Array.prototype.contains) { Array.prototype.contains = function (value) { return !!~this.indexOf(value); }; } if (!Array.prototype.each) { Array.prototype.each = function (interval, callback, response) { var self = this; var i = 0; if (typeof interval !== "function" ) { var inter = setInterval(f...
Array.prototype.inArray = function (value) { return !!~this.indexOf(value); };
random_line_split
spellbook.js
= input.length-1; i >=0; i--) { var randomIndex = Math.floor(Math.random()*(i+1)); var itemAtIndex = input[randomIndex]; input[randomIndex] = input[i]; input[i] = itemAtIndex; } return input; } } if (!Array.prototype.first) { Array.prototype.first = function() { return this[0]; ...
if (!Array.prototype.contains) { Array.prototype.contains = function (value) { return !!~this.indexOf(value); }; } if (!Array.prototype.each) { Array.prototype.each = function (interval, callback, response) { var self = this; var i = 0; if (typeof interval !== "function" ) { var inter = setInterval(fu...
{ Array.prototype.inArray = function (value) { return !!~this.indexOf(value); }; }
conditional_block
rewrite.rs
// Copyright 2015 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 ...
<'a> { pub parse_session: &'a ParseSess, pub codemap: &'a CodeMap, pub config: &'a Config, } impl<'a> RewriteContext<'a> { pub fn snippet(&self, span: Span) -> String { self.codemap.span_to_snippet(span).unwrap() } }
RewriteContext
identifier_name
rewrite.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // A generic trait ...
// http://rust-lang.org/COPYRIGHT. //
random_line_split
feedback.js
$(document).ready(function () { $('#feedback-container #close-feedback').click(function () { hideFeedback(); return false; }); $('textarea[name=comments]').focus(function () { if ($(this).val() == 'Additional comments') $(this).val(''); }); $('textarea[name=comments]').blur(function () { if (...
{ $('.thanks', form).remove(); $("input:radio[name=content-feelings]", form).attr('checked', false); $("input:radio[name=design-feelings]", form).attr('checked', false); $("input:radio[name=technical-feelings]", form).attr('checked', false); $("div.radio span").removeClass('checked'); $('textarea[name=comme...
identifier_body
feedback.js
$(document).ready(function () { $('#feedback-container #close-feedback').click(function () { hideFeedback(); return false; }); $('textarea[name=comments]').focus(function () { if ($(this).val() == 'Additional comments') $(this).val(''); }); $('textarea[name=comments]').blur(function () { if (...
$('#feedback-bar, #feedback-container #feedback-nav').removeClass('bar-active'); } }); function reset_form(form) { $('.thanks', form).remove(); $("input:radio[name=content-feelings]", form).attr('checked', false); $("input:radio[name=design-feelings]", form).attr('checked', false); $("input:radio[name=...
$('#feedback-bar, #feedback-container #feedback-nav').addClass('bar-active') return false; }); function hideFeedback() {
random_line_split
feedback.js
$(document).ready(function () { $('#feedback-container #close-feedback').click(function () { hideFeedback(); return false; }); $('textarea[name=comments]').focus(function () { if ($(this).val() == 'Additional comments') $(this).val(''); }); $('textarea[name=comments]').blur(function () { if (...
() { $('#feedback-bar, #feedback-container #feedback-nav').removeClass('bar-active'); } }); function reset_form(form) { $('.thanks', form).remove(); $("input:radio[name=content-feelings]", form).attr('checked', false); $("input:radio[name=design-feelings]", form).attr('checked', false); $("input:radio[...
hideFeedback
identifier_name
Ringtone.tsx
import React, { FunctionComponent, useState, useEffect, useRef } from 'react'; import { useIsMounted } from '../../react-hooks/useIsMounted'; import styles from './styles.scss'; import i18n from './i18n'; import { AudioFileReaderProps, RingtoneProps } from './Ringtone.interface'; const AudioFileReader: FunctionCompone...
? i18n.getString('stop', currentLocale) : i18n.getString('play', currentLocale)} </button> </div> <input ref={inputElRef} className={styles.hidden} type="file" onChange={({ currentTarget }) => { if (currentTarget.files.length) { ...
playState
identifier_name
Ringtone.tsx
import React, { FunctionComponent, useState, useEffect, useRef } from 'react'; import { useIsMounted } from '../../react-hooks/useIsMounted'; import styles from './styles.scss'; import i18n from './i18n'; import { AudioFileReaderProps, RingtoneProps } from './Ringtone.interface'; const AudioFileReader: FunctionCompone...
/> </div> ); }; export const RingTone: FunctionComponent<RingtoneProps> = ({ currentLocale, incomingAudio, incomingAudioFile, outgoingAudio, outgoingAudioFile, defaultIncomingAudio, defaultIncomingAudioFile, defaultOutgoingAudio, defaultOutgoingAudioFile, showRingToneSettings, setInc...
{() => { setPlayState(false); }}
identifier_body
Ringtone.tsx
import React, { FunctionComponent, useState, useEffect, useRef } from 'react'; import { useIsMounted } from '../../react-hooks/useIsMounted'; import styles from './styles.scss'; import i18n from './i18n'; import { AudioFileReaderProps, RingtoneProps } from './Ringtone.interface'; const AudioFileReader: FunctionCompone...
else { try { audioElRef.current.currentTime = 0; await audioElRef.current.play(); } catch (err) { if (isMountedRef.current) { console.log(err); console.log( 'Failed to pla...
{ audioElRef.current.pause(); }
conditional_block
Ringtone.tsx
import React, { FunctionComponent, useState, useEffect, useRef } from 'react'; import { useIsMounted } from '../../react-hooks/useIsMounted'; import styles from './styles.scss'; import i18n from './i18n'; import { AudioFileReaderProps, RingtoneProps } from './Ringtone.interface'; const AudioFileReader: FunctionCompone...
}, onReset: resetOutgoingAudio, }} /> </div> ); } return null; };
defaultDataUrl: defaultOutgoingAudio, onChange: ({ fileName, dataUrl }) => { setOutgoingAudio({ fileName, dataUrl });
random_line_split
Sheet.tsx
import { unstable_composeClasses as composeClasses } from '@mui/base'; import { OverridableComponent } from '@mui/types'; import { unstable_capitalize as capitalize } from '@mui/utils'; import clsx from 'clsx'; import PropTypes from 'prop-types'; import * as React from 'react'; import { useThemeProps } from '../styles'...
} = props; const ownerState = { ...props, color, component, elevation, variant, }; const classes = useUtilityClasses(ownerState); return ( <SheetRoot as={component} ownerState={ownerState} className={clsx(classes.root, className)} ref={ref} {...other} ...
elevation, ...other
random_line_split
windows.rs
use std::ffi::OsStr; const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point"; pub trait OsStrExt3 { fn from_bytes(b: &[u8]) -> &Self; fn as_bytes(&self) -> &[u8]; } pub trait OsStrExt2 { fn starts_with(&self, s: &[u8]) -> bool; fn split_at_byte(&self, b: u8) -> (&OsStr, &OsStr); fn split...
} Some(&OsStr::from_bytes(&self.val[..start])) } }
{ return Some(&OsStr::from_bytes(&self.val[self.pos + 1..start])); }
conditional_block