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
protractor_webdriver.js
`Protractor`, the E2E test framework for Angular applications. * * Copyright (c) 2014 Steffen Eckardt * Licensed under the MIT license. * * @see https://github.com/seckardt/grunt-protractor-webdriver * @see https://github.com/angular/protractor * @see https://code.google.com/p/selenium/wiki/WebDriverJs * @see ...
} else if (REGEXP_EXIT_FATAL.test(out)) { // Failure -> Exit destroy(); } else if (REGEXP_SESSION_NEW.test(out)) { // As there might be race-conditions with multiple logs for // `REGEXP_SESSION_NEW` in one log statement, we have to parse // the data lines = out.split(/[\n\r]/); lines....
{ grunt.log.writeln(msg + 'Going to shut down the Selenium server'); stackTrace = out; destroy(); }
conditional_block
coerce-id.ts
import { DEBUG } from '@glimmer/env'; // Used by the store to normalize IDs entering the store. Despite the fact // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`), // it is important that internally we use strings, since IDs may be serialized // and lose type information. For exam...
(id: Coercable): string | null { if (id === null || id === undefined || id === '') { return null; } if (typeof id === 'string') { return id; } if (typeof id === 'symbol') { return id.toString(); } return '' + id; } export function ensureStringId(id: Coercable): string { let normalized: stri...
coerceId
identifier_name
coerce-id.ts
import { DEBUG } from '@glimmer/env'; // Used by the store to normalize IDs entering the store. Despite the fact // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`), // it is important that internally we use strings, since IDs may be serialized // and lose type information. For exam...
} if (typeof id === 'symbol') { return id.toString(); } return '' + id; } export function ensureStringId(id: Coercable): string { let normalized: string | null = null; if (typeof id === 'string') { normalized = id.length > 0 ? id : null; } else if (typeof id === 'number' && !isNaN(id)) { norm...
return id;
random_line_split
coerce-id.ts
import { DEBUG } from '@glimmer/env'; // Used by the store to normalize IDs entering the store. Despite the fact // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`), // it is important that internally we use strings, since IDs may be serialized // and lose type information. For exam...
if (typeof id === 'symbol') { return id.toString(); } return '' + id; } export function ensureStringId(id: Coercable): string { let normalized: string | null = null; if (typeof id === 'string') { normalized = id.length > 0 ? id : null; } else if (typeof id === 'number' && !isNaN(id)) { normali...
{ return id; }
conditional_block
coerce-id.ts
import { DEBUG } from '@glimmer/env'; // Used by the store to normalize IDs entering the store. Despite the fact // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`), // it is important that internally we use strings, since IDs may be serialized // and lose type information. For exam...
export function ensureStringId(id: Coercable): string { let normalized: string | null = null; if (typeof id === 'string') { normalized = id.length > 0 ? id : null; } else if (typeof id === 'number' && !isNaN(id)) { normalized = '' + id; } if (DEBUG && normalized === null) { throw new Error(`Exp...
{ if (id === null || id === undefined || id === '') { return null; } if (typeof id === 'string') { return id; } if (typeof id === 'symbol') { return id.toString(); } return '' + id; }
identifier_body
call.rs
//! Facilities for working with `v8::FunctionCallbackInfo` and getting the current `v8::Isolate`. use std::os::raw::c_void; use std::ptr::null_mut; use raw::{FunctionCallbackInfo, Isolate, Local}; #[repr(C)] pub struct
{ pub static_callback: *mut c_void, pub dynamic_callback: *mut c_void } impl Default for CCallback { fn default() -> Self { CCallback { static_callback: null_mut(), dynamic_callback: null_mut() } } } extern "C" { /// Sets the return value of the function c...
CCallback
identifier_name
call.rs
//! Facilities for working with `v8::FunctionCallbackInfo` and getting the current `v8::Isolate`. use std::os::raw::c_void; use std::ptr::null_mut; use raw::{FunctionCallbackInfo, Isolate, Local}; #[repr(C)] pub struct CCallback { pub static_callback: *mut c_void, pub dynamic_callback: *mut c_void } impl Def...
/// Sets the return value of the function call. #[link_name = "Neon_Call_SetReturn"] pub fn set_return(info: &FunctionCallbackInfo, value: Local); /// Gets the isolate of the function call. #[link_name = "Neon_Call_GetIsolate"] pub fn get_isolate(info: &FunctionCallbackInfo) -> *mut Isolate; ...
extern "C" {
random_line_split
Preview.d.ts
/** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ import AccSecurity = require('./preview/AccSecurity'); import Authy = require('./preview/Authy'); import BulkExports = require('./preview/BulkExports'); import DeployedDevices = require('./preview/Deploy...
extends Domain { /** * Initialize preview domain * * @param twilio - The twilio client */ constructor(twilio: Twilio); readonly acc_security: AccSecurity; readonly assistants: AssistantListInstance; readonly authorizationDocuments: AuthorizationDocumentListInstance; readonly authy: Authy; re...
Preview
identifier_name
Preview.d.ts
/** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */
import Authy = require('./preview/Authy'); import BulkExports = require('./preview/BulkExports'); import DeployedDevices = require('./preview/DeployedDevices'); import Domain = require('../base/Domain'); import HostedNumbers = require('./preview/HostedNumbers'); import Marketplace = require('./preview/Marketplace'); im...
import AccSecurity = require('./preview/AccSecurity');
random_line_split
iframe.js
// Generated by CoffeeScript 1.9.3 (function() { var iframe_template, utils; utils = require('./utils'); iframe_template = "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <script src=\...
} }; }).call(this);
return ''; } res.setHeader('Content-Type', 'text/html; charset=UTF-8'); res.setHeader('ETag', quoted_md5); return content;
random_line_split
iframe.js
// Generated by CoffeeScript 1.9.3 (function() { var iframe_template, utils; utils = require('./utils'); iframe_template = "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <script src=\...
res.setHeader('Content-Type', 'text/html; charset=UTF-8'); res.setHeader('ETag', quoted_md5); return content; } }; }).call(this);
{ res.statusCode = 304; return ''; }
conditional_block
lib.rs
#![deny(missing_docs)] //! Bootstrapped meta rules for mathematical notation. extern crate range; extern crate piston_meta; use piston_meta::Syntax; pub mod interpreter; /// Gets the syntax rules. pub fn syntax_rules() -> Syntax { use piston_meta::*; let meta_rules = bootstrap::rules(); let source = i...
let _ = load_syntax_data2(syntax, "assets/the-simpsons.txt"); } }
let _ = load_syntax_data2(syntax, "assets/option.txt"); let _ = load_syntax_data2(syntax, "assets/string.txt");
random_line_split
lib.rs
#![deny(missing_docs)] //! Bootstrapped meta rules for mathematical notation. extern crate range; extern crate piston_meta; use piston_meta::Syntax; pub mod interpreter; /// Gets the syntax rules. pub fn syntax_rules() -> Syntax { use piston_meta::*; let meta_rules = bootstrap::rules(); let source = i...
() { let syntax = "assets/syntax.txt"; let _ = load_syntax_data2(syntax, "assets/bool.txt"); let _ = load_syntax_data2(syntax, "assets/nat.txt"); let _ = load_syntax_data2(syntax, "assets/option.txt"); let _ = load_syntax_data2(syntax, "assets/string.txt"); let _ = load_s...
test_syntax
identifier_name
lib.rs
#![deny(missing_docs)] //! Bootstrapped meta rules for mathematical notation. extern crate range; extern crate piston_meta; use piston_meta::Syntax; pub mod interpreter; /// Gets the syntax rules. pub fn syntax_rules() -> Syntax { use piston_meta::*; let meta_rules = bootstrap::rules(); let source = i...
}
{ let syntax = "assets/syntax.txt"; let _ = load_syntax_data2(syntax, "assets/bool.txt"); let _ = load_syntax_data2(syntax, "assets/nat.txt"); let _ = load_syntax_data2(syntax, "assets/option.txt"); let _ = load_syntax_data2(syntax, "assets/string.txt"); let _ = load_synt...
identifier_body
day_6.rs
pub fn compress(src: &str) -> String { let mut compressed = String::new(); let mut chars = src.chars().peekable(); while let Some(c) = chars.peek().cloned() { let mut counter = 0; while let Some(n) = chars.peek().cloned() { if c == n { counter += 1; ...
#[test] fn compress_doubled_chars_string() { assert_eq!(compress("aabbcc"), "2a2b2c"); } }
{ assert_eq!(compress("abc"), "1a1b1c"); }
identifier_body
day_6.rs
pub fn compress(src: &str) -> String { let mut compressed = String::new(); let mut chars = src.chars().peekable(); while let Some(c) = chars.peek().cloned() { let mut counter = 0; while let Some(n) = chars.peek().cloned() { if c == n { counter += 1; ...
#[test] fn compress_unique_chars_string() { assert_eq!(compress("abc"), "1a1b1c"); } #[test] fn compress_doubled_chars_string() { assert_eq!(compress("aabbcc"), "2a2b2c"); } }
random_line_split
day_6.rs
pub fn compress(src: &str) -> String { let mut compressed = String::new(); let mut chars = src.chars().peekable(); while let Some(c) = chars.peek().cloned() { let mut counter = 0; while let Some(n) = chars.peek().cloned() { if c == n { counter += 1; ...
() { assert_eq!(compress("aabbcc"), "2a2b2c"); } }
compress_doubled_chars_string
identifier_name
day_6.rs
pub fn compress(src: &str) -> String { let mut compressed = String::new(); let mut chars = src.chars().peekable(); while let Some(c) = chars.peek().cloned() { let mut counter = 0; while let Some(n) = chars.peek().cloned() { if c == n
else { break; } } compressed.push_str(counter.to_string().as_str()); compressed.push(c); } compressed } #[cfg(test)] mod tests { use super::*; #[test] fn compress_empty_string() { assert_eq!(compress(""), ""); } #[test] fn c...
{ counter += 1; chars.next(); }
conditional_block
eventmgr.py
"""Listens to Treadmill server events. There is single event manager process per server node. Each server subscribes to the content of /servers/<servername> Zookeeper node. The content contains the list of all apps currently scheduled to run on the server. Applications that are scheduled to run on the server are mi...
def _check_placement(): if placement_ready.is_set(): return if zkclient.exists(z.path.placement(self._hostname)): _LOGGER.info('Placement node found.') zkclient.ChildrenWatch( z.path.placement(self._hostname), _app_wa...
"""Watch application placement.""" self._synchronize( zkclient, apps, check_existing=not placement_ready.is_set() ) return True
identifier_body
eventmgr.py
"""Listens to Treadmill server events. There is single event manager process per server node. Each server subscribes to the content of /servers/<servername> Zookeeper node. The content contains the list of all apps currently scheduled to run on the server. Applications that are scheduled to run on the server are mi...
# Graceful shutdown. _LOGGER.info('service shutdown.') watchdog_lease.remove() def _synchronize(self, zkclient, expected, check_existing=False): """Synchronize local app cache with the expected list. :param ``list`` expected: List of instances expected to be r...
_check_placement() # Refresh watchdog watchdog_lease.heartbeat() time.sleep(_HEARTBEAT_SEC) self._cache_notify(_is_ready()) if once: break
conditional_block
eventmgr.py
"""Listens to Treadmill server events. There is single event manager process per server node. Each server subscribes to the content of /servers/<servername> Zookeeper node. The content contains the list of all apps currently scheduled to run on the server. Applications that are scheduled to run on the server are mi...
(self, zkclient, app, check_existing=False): """Read the manifest and placement data from Zk and store it as YAML in <cache>/<app>. :param ``str`` app: Instance name. :param ``bool`` check_existing: Whether to check if the file already exists and is up to date. ...
_cache
identifier_name
eventmgr.py
"""Listens to Treadmill server events. There is single event manager process per server node. Each server subscribes to the content of /servers/<servername> Zookeeper node. The content contains the list of all apps currently scheduled to run on the server. Applications that are scheduled to run on the server are mi...
} extra = current_set - expected_set missing = expected_set - current_set existing = current_set & expected_set _LOGGER.info('expected : %s', ','.join(expected_set)) _LOGGER.info('actual : %s', ','.join(current_set)) _LOGGER.info('extra : %s', ','.join(extra...
for manifest in glob.glob(os.path.join(self.tm_env.cache_dir, '*'))
random_line_split
config_toml_test.py
# -*- coding: utf-8 -*- # # Copyright 2018 Vote 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 ag...
enabled = LuigiTomlParser.enabled LuigiTomlParser.enabled = False with self.assertRaises(ImportError): get_config('toml') LuigiTomlParser.enabled = enabled
identifier_body
config_toml_test.py
# -*- coding: utf-8 -*- # # Copyright 2018 Vote 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 ag...
(LuigiTestCase): def test_add_without_install(self): enabled = LuigiTomlParser.enabled LuigiTomlParser.enabled = False with self.assertRaises(ImportError): add_config_path('test/testconfig/luigi.toml') LuigiTomlParser.enabled = enabled def test_get_without_install(se...
HelpersTest
identifier_name
config_toml_test.py
# -*- coding: utf-8 -*- # # Copyright 2018 Vote 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 ag...
self.assertEqual(config.get('hdfs', 'client'), 'hadoopcli') config.set('hdfs', 'client', 'test') self.assertEqual(config.get('hdfs', 'client'), 'test') config.set('hdfs', 'check', 'test me') self.assertEqual(config.get('hdfs', 'check'), 'test me') def test_has_option(self):...
config = get_config('toml')
random_line_split
ComplexAbs.ts
/** * @license * Copyright 2020 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...
return { dataId: complexPart.dataId, dtype: complexPart.dtype, shape: complexTensor.shape }; } export function complexAbs( args: {inputs: ComplexAbsInputs, backend: MathBackendWebGL}): TensorInfo { const {inputs, backend} = args; const {x} = inputs; const xData = backend.texData.get(x.dataId...
// Returns a TensorInfo with the complex shape and the dataId of the // underlying part. We need to do this because a reshaped complex tensor is // not reflected in its parts. function makeComplexComponentTensorInfo( complexTensor: TensorInfo, complexPart: TensorInfo): TensorInfo {
random_line_split
ComplexAbs.ts
/** * @license * Copyright 2020 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...
( args: {inputs: ComplexAbsInputs, backend: MathBackendWebGL}): TensorInfo { const {inputs, backend} = args; const {x} = inputs; const xData = backend.texData.get(x.dataId); const program = new ComplexAbsProgram(x.shape); const programInputs = [ makeComplexComponentTensorInfo(x, xData.complexTensorI...
complexAbs
identifier_name
ComplexAbs.ts
/** * @license * Copyright 2020 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 const complexAbsConfig: KernelConfig = { kernelName: ComplexAbs, backendName: 'webgl', kernelFunc: complexAbs as {} as KernelFunc };
{ const {inputs, backend} = args; const {x} = inputs; const xData = backend.texData.get(x.dataId); const program = new ComplexAbsProgram(x.shape); const programInputs = [ makeComplexComponentTensorInfo(x, xData.complexTensorInfos.real), makeComplexComponentTensorInfo(x, xData.complexTensorInfos.imag...
identifier_body
android-sdk.ts
/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may...
get sdkManagerPath() { return path.join(this.directory, 'tools', 'bin', 'sdkmanager') } public findJavaBinary() { if (this.androidStudio.javaPath) { return path.join(this.androidStudio.javaPath, 'bin', 'java') } const javaHomeEnv = process.env[`${javaHomeEnvironmentVariable}`] if (jav...
{ return this.getPlatformToolsPath('adb') }
identifier_body
android-sdk.ts
/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may...
} return false } public init() { this.locateAndroidSdk() if (!this.directory) { return } let platforms: string[] = [] // android-23 android-25 android-26 android-27... const platformsDir: string = path.join(this.directory, 'platforms') let buildTools: string[] = [] // 23.0.1 ...
const dirPath = path.join(dir, 'platform-tools') if (fs.existsSync(dirPath)) { return fs.statSync(dirPath).isDirectory()
random_line_split
android-sdk.ts
/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may...
return null } public canRun(path: string, args: string[] = []) { if (!canRunSync(path, args)) { return `Android SDK file not found: ${path}.` } return null } } export class AndroidSdk { public directory: string public sdkVersions: AndroidSdkVersion[] = [] public latestVersion: Andro...
{ return `Android SDK file not found: ${path}.` }
conditional_block
android-sdk.ts
/* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may...
{ constructor( public sdk: AndroidSdk, public sdkLevel: number, public platformName: string, public buildToolsVersion: VersionOption, ) { this.sdk = sdk this.sdkLevel = sdkLevel this.platformName = platformName this.buildToolsVersion = buildToolsVersion } get buildToolsVersionN...
AndroidSdkVersion
identifier_name
test_get_program_tree_version_from_node_service.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
md = command.GetProgramTreeVersionFromNodeCommand(code="LDROI1200", year=2018) get_program_tree_version_from_node_service.get_program_tree_version_from_node(cmd) self.assertTrue(mock_domain_service.called) self.assertTrue(mock_repository_get.called)
identifier_body
test_get_program_tree_version_from_node_service.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
SimpleTestCase): @mock.patch.object(ProgramTreeVersionIdentitySearch, 'get_from_node_identity') @mock.patch.object(ProgramTreeVersionRepository, 'get') def test_domain_service_is_called(self, mock_domain_service, mock_repository_get): cmd = command.GetProgramTreeVersionFromNodeCommand(code="LDROI12...
estGetProgramTreeVersionFromNodeService(
identifier_name
test_get_program_tree_version_from_node_service.py
# ############################################################################ # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core business i...
self.assertTrue(mock_repository_get.called)
random_line_split
_postgres_builtins.py
', 'RENAME', 'REPEATABLE', 'REPLACE', 'REPLICA', 'RESET', 'RESTART', 'RESTRICT', 'RETURNING', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'ROLLUP', 'ROUTINE', 'ROUTINES', 'ROW', 'ROWS', 'RULE', 'SAVEPOINT', 'SCHEMA', 'SCHEMAS'...
with open(filename) as f: data = f.read() # Line to start/end inserting re_match = re.compile(r'^%s\s*=\s*\($.*?^\s*\)$' % constname, re.M | re.S) m = re_match.search(data) if not m: raise ValueError('Could not find existing definition for %s' % ...
identifier_body
_postgres_builtins.py
ACING', 'PLANS', 'POLICY', 'POSITION', 'PRECEDING', 'PRECISION', 'PREPARE', 'PREPARED', 'PRESERVE', 'PRIMARY', 'PRIOR', 'PRIVILEGES', 'PROCEDURAL', 'PROCEDURE', 'PROCEDURES', 'PROGRAM', 'PUBLICATION', 'QUOTE', 'RANGE', 'READ', 'REAL', '...
raise ValueError('pseudo datatypes not found')
conditional_block
_postgres_builtins.py
HEADER', 'HOLD', 'HOUR', 'IDENTITY', 'IF', 'ILIKE', 'IMMEDIATE', 'IMMUTABLE', 'IMPLICIT', 'IMPORT', 'IN', 'INCLUDE', 'INCLUDING', 'INCREMENT', 'INDEX', 'INDEXES', 'INHERIT', 'INHERITS', 'INITIALLY', 'INLINE', 'INNER', 'INOUT', 'INPU...
KEYWORDS_URL = SOURCE_URL + '/src/include/parser/kwlist.h' DATATYPES_URL = SOURCE_URL + '/doc/src/sgml/datatype.sgml'
random_line_split
_postgres_builtins.py
'LATERAL', 'LEADING', 'LEAKPROOF', 'LEAST', 'LEFT', 'LEVEL', 'LIKE', 'LIMIT', 'LISTEN', 'LOAD', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCATION', 'LOCK', 'LOCKED', 'LOGGED', 'MAPPING', 'MATCH', 'MATERIALIZED', 'MAXVALUE', 'METHOD', ...
parse_datatypes
identifier_name
Blog_LinearRegression.py
# coding: utf-8 # In[2]: # Import and read the datset import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv("C://Users//Koyel//Desktop/MieRobotAdvert.csv") dataset.head() # In[3]: dataset.describe() # In[4]: dataset.columns # In[5]: im...
predictions = lm.predict(X_test) # In[26]: plt.ylabel("likes predicted") plt.title("Likes predicated for MieRobot.com blogs",color='r') plt.scatter(y_test,predictions) # In[23]: print (lm.score) # In[19]: sns.distplot((y_test-predictions),bins=50); # In[20]: from sklearn import metrics print('MAE:', metrics...
# In[17]:
random_line_split
edit_recipe_ingredients.js
/* * Add a new ingredient form to the bottom of the formset */ function add_ingredient() { // Find the empty form var empty_form = $("#uses-formset .ingredient.empty-form"); // Clone it and remove the unneeded classes to get a new form var new_form = empty_form.clone(); new_form.removeClass('empty-form'); new...
() { // Get all ingredient forms and groups (except the empty ones) var lis = $("#uses-formset #sortable-ingredients li:not('.column-labels, .empty-form')"); // Hide the labels at the start if they are redundant because of group labels if (lis.first().hasClass("group")) { $("#uses-formset #sortable-ingredients ...
fix_ingredient_list
identifier_name
edit_recipe_ingredients.js
/* * Add a new ingredient form to the bottom of the formset */ function add_ingredient() { // Find the empty form var empty_form = $("#uses-formset .ingredient.empty-form"); // Clone it and remove the unneeded classes to get a new form var new_form = empty_form.clone(); new_form.removeClass('empty-form'); new...
// Assign the current group to this ingredient $(this).find("input.group").val(group_name); // If this ingredient is in a group, indent the form if (found_group) { $(this).css('padding-left', '50px'); } else { $(this).css('padding-left', '30px'); ...
{ // Get all ingredient forms and groups (except the empty ones) var lis = $("#uses-formset #sortable-ingredients li:not('.column-labels, .empty-form')"); // Hide the labels at the start if they are redundant because of group labels if (lis.first().hasClass("group")) { $("#uses-formset #sortable-ingredients .co...
identifier_body
edit_recipe_ingredients.js
/* * Add a new ingredient form to the bottom of the formset */ function add_ingredient() { // Find the empty form var empty_form = $("#uses-formset .ingredient.empty-form"); // Clone it and remove the unneeded classes to get a new form var new_form = empty_form.clone(); new_form.removeClass('empty-form'); new...
}); // Change a group name when the user presses enter while editing it $("#sortable-ingredients .group input").pressEnter(function() { $(this).blur(); }); // When a group name has changed, fix the ingredient list $("#sortable-ingredients .group input").blur(function() { fix_ingredient_list()...
{ // Assign the current group to this ingredient $(this).find("input.group").val(group_name); // If this ingredient is in a group, indent the form if (found_group) { $(this).css('padding-left', '50px'); } else { $(this).css('padding-left', '30px'); ...
conditional_block
edit_recipe_ingredients.js
/* * Add a new ingredient form to the bottom of the formset */ function add_ingredient() { // Find the empty form var empty_form = $("#uses-formset .ingredient.empty-form"); // Clone it and remove the unneeded classes to get a new form var new_form = empty_form.clone(); new_form.removeClass('empty-form'); new...
var group_name = ""; var found_group = false; lis.each(function() { if ($(this).hasClass("group")) { // This is a group li, all ingredients between this li and the next group li should belong to this group group_name = $(this).find(".group-name").val(); found_group = true; } else if ($(this).hasCl...
// Assign a group to every ingredient form
random_line_split
issues.ts
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
export function mockIssueChangelog(overrides: Partial<IssueChangelog> = {}): IssueChangelog { return { creationDate: '2018-10-01', isUserActive: true, user: 'luke.skywalker', userName: 'Luke Skywalker', diffs: [ { key: 'assign', newValue: 'darth.vader', oldValue: 'l...
{ return { langName: 'Javascript', name: 'RuleFoo', ...overrides }; }
identifier_body
issues.ts
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
}; } export function mockIssueChangelog(overrides: Partial<IssueChangelog> = {}): IssueChangelog { return { creationDate: '2018-10-01', isUserActive: true, user: 'luke.skywalker', userName: 'Luke Skywalker', diffs: [ { key: 'assign', newValue: 'darth.vader', oldVal...
export function mockReferencedRule(overrides: Partial<ReferencedRule> = {}): ReferencedRule { return { langName: 'Javascript', name: 'RuleFoo', ...overrides
random_line_split
issues.ts
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, o...
(overrides: Partial<IssueChangelog> = {}): IssueChangelog { return { creationDate: '2018-10-01', isUserActive: true, user: 'luke.skywalker', userName: 'Luke Skywalker', diffs: [ { key: 'assign', newValue: 'darth.vader', oldValue: 'luke.skywalker' } ], .....
mockIssueChangelog
identifier_name
WordCount.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { CharacterData, Node } from '@ephox/dom-globals'; import Tree...
return txt; }; const innerText = (node: Node, schema: Schema) => { return Env.ie ? getText(node, schema) : (node as any).innerText; }; const getTextContent = (editor: Editor) => { return editor.removed ? '' : innerText(editor.getBody(), editor.schema); }; const getCount = (editor: Editor) => { return WordG...
{ if (node.nodeType === 3) { txt += (node as CharacterData).data; } else if (isSeparator(node)) { txt += ' '; } }
conditional_block
WordCount.ts
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { CharacterData, Node } from '@ephox/dom-globals'; import Tree...
const getText = (node: Node, schema: Schema): string => { const blockElements: SchemaMap = schema.getBlockElements(); const shortEndedElements: SchemaMap = schema.getShortEndedElements(); const whiteSpaceElements = schema.getWhiteSpaceElements(); const isSeparator = (node: Node) => ( blockElements[node.node...
import { Editor } from 'tinymce/core/api/Editor'; import Env from 'tinymce/core/api/Env'; import Schema, { SchemaMap } from 'tinymce/core/api/html/Schema'; import WordGetter from './WordGetter';
random_line_split
thumbbar.py
dk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False, True)) self._text_cellrenderer.set_property('background-gdk', gtk.gdk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False, T...
# Update layout and current image selection in the thumb bar. self.update_layout_size() self.update_select() # Set height appropriate for dummy pixbufs. if not self._loaded: pixbuf_padding = 2 self._layout.set_size(0, filler.get_height() ...
self.show_all() self.hide_all()
conditional_block
thumbbar.py
.""" if (not self._window.filehandler.file_loaded or self._window.imagehandler.get_number_of_pages() == 0 or self._is_loading or self._loaded or self._stop_cacheing): return self._load(force_load) def refresh(self, *args): if not self._is_loading: ...
set_thumbnail_background
identifier_name
thumbbar.py
dk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False, True)) self._text_cellrenderer.set_property('background-gdk', gtk.gdk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False, T...
def _load(self, force_load=False): # Create empty preview thumbnails. filler = self.get_empty_thumbnail() page_count = self._window.imagehandler.get_number_of_pages() while len(self._thumbnail_liststore) < page_count: self._thumbnail_liststore.append([len(self._thumbnai...
""" Callback when a new thumbnail has been created. <pixbuf_info> is a tuple of (page, pixbuf). """ iter = self._thumbnail_liststore.iter_nth_child(None, page - 1) if iter and self._thumbnail_liststore.iter_is_valid(iter): self._thumbnail_liststore.set(iter, 0, page, 1, pixbuf) ...
identifier_body
thumbbar.py
.gdk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False, True)) self._text_cellrenderer.set_property('background-gdk', gtk.gdk.colormap_get_system().alloc_color(gtk.gdk.Color( bg_colour[0], bg_colour[1], bg_colour[2]), False,...
def thumbnail_loaded(self, page, pixbuf): """ Callback when a new thumbnail has been created. <pixbuf_info> is a tuple of (page, pixbuf). """ iter = self._thumbnail_liststore.iter_nth_child(None, page - 1) if iter and self._thumbnail_liststore.iter_is_valid(iter): self._t...
@callback.Callback
random_line_split
blame.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
import os import re import llnl.util.tty as tty from llnl.util.lang import pretty_date from llnl.util.filesystem import working_dir from llnl.util.tty.colify import colify_table import spack from spack.util.executable import which from spack.cmd import spack_is_git_repo description = "show contributors to packages"...
# # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##############################################################################
random_line_split
blame.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
match = re.match(r'^author-mail (.*)', line) if match: email = match.group(1) match = re.match(r'^author-time (.*)', line) if match: mod = int(match.group(1)) last_mod[author] = max(last_mod.setdefault(author, 0), mod) # ignore comments ...
author = match.group(1)
conditional_block
blame.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(parser, args): # make sure this is a git repo if not spack_is_git_repo(): tty.die("This spack is not a git clone. Can't use 'spack blame'") git = which('git', required=True) # Get name of file to blame blame_file = None if os.path.isfile(args.package_name): path = os.path.realp...
blame
identifier_name
blame.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
else: output = git('blame', '--line-porcelain', blame_file, output=str) lines = output.split('\n') # Histogram authors counts = {} emails = {} last_mod = {} total_lines = 0 for line in lines: match = re.match(r'^author (.*)', line) if match: ...
if not spack_is_git_repo(): tty.die("This spack is not a git clone. Can't use 'spack blame'") git = which('git', required=True) # Get name of file to blame blame_file = None if os.path.isfile(args.package_name): path = os.path.realpath(args.package_name) if path.startswith(spack...
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate serde; use euclid::default::{Point2D, Rect, Size2D}; use malloc_size_of_derive::Malloc...
if origin.y < 0 { size.height = size.height.saturating_sub(-origin.y as u32); origin.y = 0; } Rect::new(origin.to_u32(), size) .intersection(&Rect::from_size(surface)) .filter(|rect| !rect.is_empty()) }
{ size.width = size.width.saturating_sub(-origin.x as u32); origin.x = 0; }
conditional_block
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate serde; use euclid::default::{Point2D, Rect, Size2D}; use malloc_size_of_derive::Malloc...
(pixels: &[u8], size: Size2D<u32>, rect: Rect<u32>) -> Cow<[u8]> { assert!(!rect.is_empty()); assert!(Rect::from_size(size).contains_rect(&rect)); assert_eq!(pixels.len() % 4, 0); assert_eq!(size.area() as usize, pixels.len() / 4); let area = rect.size.area() as usize; let first_column_start = r...
rgba8_get_rect
identifier_name
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #[macro_use]
extern crate serde; use euclid::default::{Point2D, Rect, Size2D}; use malloc_size_of_derive::MallocSizeOf; use std::borrow::Cow; #[derive(Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, Serialize)] pub enum PixelFormat { /// Luminance channel only K8, /// Luminance + alpha KA8, /// R...
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate serde; use euclid::default::{Point2D, Rect, Size2D}; use malloc_size_of_derive::Malloc...
{ if origin.x < 0 { size.width = size.width.saturating_sub(-origin.x as u32); origin.x = 0; } if origin.y < 0 { size.height = size.height.saturating_sub(-origin.y as u32); origin.y = 0; } Rect::new(origin.to_u32(), size) .intersection(&Rect::from_size(surface)...
identifier_body
vrstageparameters.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 core::nonzero::NonZero; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRStagePara...
// https://w3c.github.io/webvr/#dom-vrstageparameters-sizez fn SizeZ(&self) -> Finite<f32> { Finite::wrap(self.parameters.borrow().size_z) } }
{ Finite::wrap(self.parameters.borrow().size_x) }
identifier_body
vrstageparameters.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 core::nonzero::NonZero; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRStagePara...
if let Ok(mut array) = array { array.update(&parameters.sitting_to_standing_transform); } } *self.parameters.borrow_mut() = parameters.clone(); } } impl VRStageParametersMethods for VRStageParameters { #[allow(unsafe_code)] // https://w3c.github.io/we...
let cx = self.global().get_cx(); typedarray!(in(cx) let array: Float32Array = self.transform.get());
random_line_split
vrstageparameters.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 core::nonzero::NonZero; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRStagePara...
} *self.parameters.borrow_mut() = parameters.clone(); } } impl VRStageParametersMethods for VRStageParameters { #[allow(unsafe_code)] // https://w3c.github.io/webvr/#dom-vrstageparameters-sittingtostandingtransform unsafe fn SittingToStandingTransform(&self, _cx: *mut JSContext) -> Non...
{ array.update(&parameters.sitting_to_standing_transform); }
conditional_block
vrstageparameters.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 core::nonzero::NonZero; use dom::bindings::cell::DomRefCell; use dom::bindings::codegen::Bindings::VRStagePara...
{ reflector_: Reflector, #[ignore_heap_size_of = "Defined in rust-webvr"] parameters: DomRefCell<WebVRStageParameters>, transform: Heap<*mut JSObject>, } unsafe_no_jsmanaged_fields!(WebVRStageParameters); impl VRStageParameters { fn new_inherited(parameters: WebVRStageParameters) -> VRStageParame...
VRStageParameters
identifier_name
standard.rs
use super::super::*; pub const TRANSPARENT: u8 = 0; pub const PINKISH_TAN: u8 = 1; pub const ORANGEY_RED: u8 = 2; pub const ROUGE: u8 = 3; pub const STRONG_PINK: u8 = 4; pub const BUBBLEGUM_PINK: u8 = 5; pub const PINK_PURPLE: u8 = 6; pub const WARM_PURPLE: u8 = 7; pub const BURGUNDY: u8 = 8; pub const NAVY_BLUE: u8 ...
() -> Vec<String> { vec![ String::from("Transparent"), String::from("Pinkish Tan"), String::from("Orangey Red"), String::from("Rouge"), String::from("Strong Pink"), String::from("Bubblegum Pink"), String::from("Pink/Purple"), String::from("Warm Purple"), String::...
names
identifier_name
standard.rs
use super::super::*; pub const TRANSPARENT: u8 = 0; pub const PINKISH_TAN: u8 = 1; pub const ORANGEY_RED: u8 = 2; pub const ROUGE: u8 = 3; pub const STRONG_PINK: u8 = 4; pub const BUBBLEGUM_PINK: u8 = 5; pub const PINK_PURPLE: u8 = 6; pub const WARM_PURPLE: u8 = 7; pub const BURGUNDY: u8 = 8; pub const NAVY_BLUE: u8 =...
String::from("Navy Blue"), String::from("Blue/Purple"), String::from("Medium Blue"), String::from("Azure"), String::from("Robin’s Egg"), String::from("Blue/Green"), String::from("Dark Aqua"), String::from("Dark Forest Green"), String::from("Black"), String::fr...
String::from("Warm Purple"), String::from("Burgundy"),
random_line_split
standard.rs
use super::super::*; pub const TRANSPARENT: u8 = 0; pub const PINKISH_TAN: u8 = 1; pub const ORANGEY_RED: u8 = 2; pub const ROUGE: u8 = 3; pub const STRONG_PINK: u8 = 4; pub const BUBBLEGUM_PINK: u8 = 5; pub const PINK_PURPLE: u8 = 6; pub const WARM_PURPLE: u8 = 7; pub const BURGUNDY: u8 = 8; pub const NAVY_BLUE: u8 ...
Color { rgba: 0xff000000 }, Color { rgba: 0xff57494a }, Color { rgba: 0xffa47b8e }, Color { rgba: 0xffffc0b7 }, Color { rgba: 0xffffffff }, Color { rgba: 0xff9cbeac }, Color { rgba: 0xff707c82 }, Color { rgba: 0xff1c3b5a }, Color { rgba: 0...
{ Palette { colors: vec![ Color { rgba: 0x00000000 }, Color { rgba: 0xff90a0d6 }, Color { rgba: 0xff1e3bfe }, Color { rgba: 0xff322ca1 }, Color { rgba: 0xff7a2ffa }, Color { rgba: 0xffda9ffb }, Color { rgba: 0xfff71ce6 }, Color { rgba: 0xf...
identifier_body
classes-simple.rs
// Copyright 2012 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. struct cat { pr...
//
random_line_split
classes-simple.rs
// Copyright 2012 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 ...
pub fn main() { let mut nyan : cat = cat(52u, 99); let mut kitty = cat(1000u, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); }
{ cat { meows: in_x, how_hungry: in_y } }
identifier_body
classes-simple.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let mut nyan : cat = cat(52u, 99); let mut kitty = cat(1000u, 2); assert_eq!(nyan.how_hungry, 99); assert_eq!(kitty.how_hungry, 2); }
main
identifier_name
launchfacebook.js
var browser = chrome; var activetabs = []; //alert("launchfacebook"); document.addEventListener('DOMContentLoaded', function () { var css_lastcouche ='.lastcouche {background-image:'+chrome.extension.getURL('src/css/internet.gif')+';}'; chrome.tabs.insertCSS(null, { code: css_lastcouche });
chrome.tabs.executeScript(null, { file: "/src/jquery-3.2.1.min.js" }); chrome.tabs.executeScript(null, { file: "/src/jquery-ui.min.js" }); document.getElementById("go").addEventListener("click", function () { window.close(); browser.tabs.executeScript(null, {file : "/src/generalfacebook.js"}); browser.tab...
chrome.tabs.insertCSS(null, { file: "/src/css/stylefacebook.css" }); chrome.tabs.executeScript(null, { file: "/src/fabric.min.js" });
random_line_split
models.py
from django.db import models from django.utils.html import format_html from sorl.thumbnail import get_thumbnail from sorl.thumbnail.fields import ImageField from sno.models import Sno class SnoGalleries(models.Model): class Meta: verbose_name = 'Фотография в галереи СНО' verbose_name_plural = 'Фот...
return format_html('<a href="{}" target="_blank"><img style="width:75px; height:75px;" src="{}"></a>', self.photo.url, img.url) photo_preview.short_description = 'Фото' def __str__(self): return '%s (%s)' % (self.name, self.sno.short_name)
p='center')
identifier_name
models.py
from django.db import models from django.utils.html import format_html from sorl.thumbnail import get_thumbnail from sorl.thumbnail.fields import ImageField from sno.models import Sno class SnoGalleries(models.Model): class Meta:
то', max_length=255, blank=True, null=True) photo = ImageField(verbose_name='Фото', max_length=255) description = models.TextField('Описание', blank=True, null=True) sno = models.ForeignKey(Sno, verbose_name='СНО', on_delete=models.CASCADE) date_created = models.DateField('Дата', auto_now_add=True) ...
verbose_name = 'Фотография в галереи СНО' verbose_name_plural = 'Фотографии в галереи СНО' name = models.CharField('Название фо
identifier_body
models.py
from django.db import models from django.utils.html import format_html from sorl.thumbnail import get_thumbnail from sorl.thumbnail.fields import ImageField from sno.models import Sno class SnoGalleries(models.Model): class Meta: verbose_name = 'Фотография в галереи СНО' verbose_name_plural = 'Фот...
def photo_preview(self): img = get_thumbnail(self.photo, '75x75', crop='center') return format_html('<a href="{}" target="_blank"><img style="width:75px; height:75px;" src="{}"></a>', self.photo.url, img.url) photo_preview.short_description = 'Фото' def __str__(...
description = models.TextField('Описание', blank=True, null=True) sno = models.ForeignKey(Sno, verbose_name='СНО', on_delete=models.CASCADE) date_created = models.DateField('Дата', auto_now_add=True)
random_line_split
lib.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/. */ // Servo, the mighty web browser engine from the future. // // This is a very simple library that wires all of Ser...
{ compositor: Box<CompositorEventListener + 'static>, } /// The in-process interface to Servo. /// /// It does everything necessary to render the web, primarily /// orchestrating the interaction between JavaScript, CSS layout, /// rendering, and the client window. /// /// Clients create a `Browser` for a given re...
Browser
identifier_name
lib.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/. */ // Servo, the mighty web browser engine from the future. // // This is a very simple library that wires all of Ser...
pub fn pinch_zoom_level(&self) -> f32 { self.compositor.pinch_zoom_level() } pub fn request_title_for_main_frame(&self) { self.compositor.title_for_main_frame() } } fn create_constellation(opts: opts::Opts, compositor_proxy: Box<CompositorProxy + Send>, ...
{ self.compositor.repaint_synchronously() }
identifier_body
lib.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/. */ // Servo, the mighty web browser engine from the future. // // This is a very simple library that wires all of Ser...
, None => () }; constellation_chan } /// Content process entry point. pub fn run_content_process(token: String) { let (unprivileged_content_sender, unprivileged_content_receiver) = ipc::channel::<UnprivilegedPipelineContent>().unwrap(); let connection_bootstrap: IpcSender<IpcSender<Unp...
{ constellation_chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap(); }
conditional_block
lib.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/. */ // Servo, the mighty web browser engine from the future. // // This is a very simple library that wires all of Ser...
devtools_chan, supports_clipboard); if cfg!(feature = "webdriver") { if let Some(port) = opts.webdriver_port { webdriver(port, constellation_chan.clone()); } ...
// as the navigation context. let constellation_chan = create_constellation(opts.clone(), compositor_proxy.clone_compositor_proxy(), time_profiler_chan.clone(), ...
random_line_split
dist.rs
//! This module implements middleware to serve the compiled emberjs //! frontend use std::error::Error; use conduit::{Request, Response, Handler}; use conduit_static::Static; use conduit_middleware::AroundMiddleware; use util::RequestProxy; // Can't derive debug because of Handler and Static. #[allow(missing_debug_i...
} impl Handler for Middleware { fn call(&self, req: &mut Request) -> Result<Response, Box<Error + Send>> { // First, attempt to serve a static file. If we're missing a static // file, then keep going. match self.dist.call(req) { Ok(ref resp) if resp.status.0 == 404 => {} ...
{ self.handler = Some(handler); }
identifier_body
dist.rs
//! This module implements middleware to serve the compiled emberjs //! frontend use std::error::Error; use conduit::{Request, Response, Handler}; use conduit_static::Static; use conduit_middleware::AroundMiddleware; use util::RequestProxy; // Can't derive debug because of Handler and Static. #[allow(missing_debug_i...
() -> Middleware { Middleware { handler: None, dist: Static::new("dist"), } } } impl AroundMiddleware for Middleware { fn with_handler(&mut self, handler: Box<Handler>) { self.handler = Some(handler); } } impl Handler for Middleware { fn call(&self, req:...
default
identifier_name
dist.rs
//! This module implements middleware to serve the compiled emberjs //! frontend use std::error::Error; use conduit::{Request, Response, Handler}; use conduit_static::Static; use conduit_middleware::AroundMiddleware; use util::RequestProxy; // Can't derive debug because of Handler and Static. #[allow(missing_debug_i...
let wants_html = req.headers() .find("Accept") .map(|accept| accept.iter().any(|s| s.contains("html"))) .unwrap_or(false); // If the route starts with /api, just assume they want the API // response. Someone is either debugging or trying to download a crate. ...
random_line_split
deviceorientation.js
goog.provide('ol.DeviceOrientation'); goog.provide('ol.DeviceOrientationProperty'); goog.require('goog.events'); goog.require('goog.math'); goog.require('ol.Object'); goog.require('ol.has'); /** * @enum {string} */ ol.DeviceOrientationProperty = { ALPHA: 'alpha', BETA: 'beta', GAMMA: 'gamma', ...
} }; /** * Enable or disable tracking of DeviceOrientation events. * @param {boolean} tracking The status of tracking changes to alpha, beta and * gamma. If true, changes are tracked and reported immediately. * @observable * @api */ ol.DeviceOrientation.prototype.setTracking = function(tracki...
{ goog.events.unlistenByKey(this.listenerKey_); this.listenerKey_ = null; }
conditional_block
deviceorientation.js
goog.provide('ol.DeviceOrientation'); goog.provide('ol.DeviceOrientationProperty'); goog.require('goog.events'); goog.require('goog.math'); goog.require('ol.Object'); goog.require('ol.has'); /** * @enum {string} */ ol.DeviceOrientationProperty = { ALPHA: 'alpha', BETA: 'beta', GAMMA: 'gamma', ...
goog.events.listen(this, ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING), this.handleTrackingChanged_, false, this); this.setTracking(goog.isDef(options.tracking) ? options.tracking : false); }; goog.inherits(ol.DeviceOrientation, ol.Object); /** * @inheritDoc */ o...
*/ this.listenerKey_ = null;
random_line_split
path2gene.py
usr/bin/python """ Small web application to retrieve genes from the tomato genome annotation involved to a specified pathways. """ import flask from flaskext.wtf import Form, TextField import ConfigParser import datetime import json import os import rdflib import urllib CONFIG = ConfigParser.ConfigParser() CONFIG...
(name): """ Search the uniprot database for pathways having the given string in their name. It returns a list of these pathways. @param name, a string, name or part of the name of the pathway to search in uniprot. @return, a list of the pathway names found for having the given string. ...
search_pathway_in_db
identifier_name
path2gene.py
usr/bin/python """ Small web application to retrieve genes from the tomato genome annotation involved to a specified pathways. """ import flask from flaskext.wtf import Form, TextField import ConfigParser import datetime import json import os import rdflib import urllib CONFIG = ConfigParser.ConfigParser() CONFIG...
@APP.route('/path/<path:pathway>') def pathway(pathway): """ Show for the given pathways all the genes found to be related. """ print 'path2gene %s -- %s -- %s' % (datetime.datetime.now(), flask.request.remote_addr, flask.request.url) if pathway.endswith('*'): genes = get_gene_of_path...
""" Search the database for pathways containing the given string. """ print 'path2gene %s -- %s -- %s' % (datetime.datetime.now(), flask.request.remote_addr, flask.request.url) pathways = search_pathway_in_db(name) core = [] for path in pathways: core.append('%s*' % path.split(';')[0...
identifier_body
path2gene.py
usr/bin/python """ Small web application to retrieve genes from the tomato genome annotation involved to a specified pathways. """ import flask from flaskext.wtf import Form, TextField import ConfigParser import datetime import json import os import rdflib import urllib CONFIG = ConfigParser.ConfigParser() CONFIG...
class PathwayForm(Form): """ Simple text field form to input the pathway of interest. """ pathway_name = TextField('Pathway name (or part of it)') def search_pathway_in_db(name): """ Search the uniprot database for pathways having the given string in their name. It returns a list of these pathways...
GRAPHS = {option: CONFIG.get('graph', option) for option in CONFIG.options('graph')}
random_line_split
path2gene.py
usr/bin/python """ Small web application to retrieve genes from the tomato genome annotation involved to a specified pathways. """ import flask from flaskext.wtf import Form, TextField import ConfigParser import datetime import json import os import rdflib import urllib CONFIG = ConfigParser.ConfigParser() CONFIG...
genes = {} for entry in data_js['results']['bindings']: genes[entry['gene']['value']] = [entry['desc']['value'], pathway] return genes def sparql_query(query, server, output_format='application/json'): """ Runs the given SPARQL query against the desired sparql endpoint and ret...
return
conditional_block
gyp_flag_compare.py
#!/usr/bin/env python # Copyright 2014 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. """Given the output of -t commands from a ninja build for a gyp and GN generated build, report on differences between the command line...
import os import shlex import subprocess import sys # Must be in src/. os.chdir(os.path.join(os.path.dirname(__file__), '..', '..', '..')) g_total_differences = 0 def FindAndRemoveArgWithValue(command_line, argname): """Given a command line as a list, remove and return the value of an option that takes a valu...
random_line_split
gyp_flag_compare.py
#!/usr/bin/env python # Copyright 2014 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. """Given the output of -t commands from a ninja build for a gyp and GN generated build, report on differences between the command line...
def MergeSpacedArgs(command_line, argname): """Combine all arguments |argname| with their values, separated by a space.""" i = 0 result = [] while i < len(command_line): arg = command_line[i] if arg == argname: result.append(arg + ' ' + command_line[i + 1]) i += 1 else: result.a...
"""Given a command line as a list, remove and return the value of an option that takes a value as a separate entry. Modifies |command_line| in place. """ if argname not in command_line: return '' location = command_line.index(argname) value = command_line[location + 1] command_line[location:location ...
identifier_body
gyp_flag_compare.py
#!/usr/bin/env python # Copyright 2014 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. """Given the output of -t commands from a ninja build for a gyp and GN generated build, report on differences between the command line...
(lines): """Turn a list of command lines into a semi-structured dict.""" flags_by_output = {} for line in lines: # TODO(scottmg): Hacky way of getting only cc for now. if 'clang' not in line: continue command_line = shlex.split(line.strip())[1:] output_name = FindAndRemoveArgWithValue(comm...
GetFlags
identifier_name
gyp_flag_compare.py
#!/usr/bin/env python # Copyright 2014 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. """Given the output of -t commands from a ninja build for a gyp and GN generated build, report on differences between the command line...
output = '' if gyp[name] != gn[name]: gyp_set = set(gyp[name]) gn_set = set(gn[name]) missing_in_gyp = gyp_set - gn_set missing_in_gn = gn_set - gyp_set missing_in_gyp -= set(dont_care_gyp) missing_in_gn -= set(dont_care_gn) if missing_in_gyp or missing_in_gn: output += ' %s diff...
dont_care_gn = []
conditional_block
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::{Parser, ParserInput}; use style::con...
<'i: 't, 't, T, F>(f: F, input: &'t mut ParserInput<'i>) -> Result<T, ParseError<'i>> where F: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>> { parse_input(|context, parser| parser.parse_entirely(|p| f(context, p)), input) } // This is a macro so that the file/line information // is preserved...
parse_entirely_input
identifier_name
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::{Parser, ParserInput}; use style::con...
mod transition_duration; mod transition_timing_function;
random_line_split
mod.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/. */ //! Tests for parsing and serialization of values/properties use cssparser::{Parser, ParserInput}; use style::con...
fn parse_input<'i: 't, 't, T, F>(f: F, input: &'t mut ParserInput<'i>) -> Result<T, ParseError<'i>> where F: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>> { let url = ::servo_url::ServoUrl::parse("http://localhost").unwrap(); let context = ParserContext::new( Origin::Author, ...
{ let mut input = ParserInput::new(s); parse_input(f, &mut input) }
identifier_body
Cite.ts
/* * Copyright (c) 2014 Jose Carlos Lama. www.typedom.org * * 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 to use, copy, modi...
extends Container<Cite, HTMLElement> { public static CITE: string = 'cite'; constructor(); constructor(id: string) constructor(attributes: Object) constructor(element: HTMLElement) constructor(idOrAttributesOrElement?: any) { super(idOrAttributesOrElement, Cite.CITE); } }
Cite
identifier_name
Cite.ts
/* * Copyright (c) 2014 Jose Carlos Lama. www.typedom.org * * 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 to use, copy, modi...
}
{ super(idOrAttributesOrElement, Cite.CITE); }
identifier_body
Cite.ts
/* * Copyright (c) 2014 Jose Carlos Lama. www.typedom.org * * 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 to use, copy, modi...
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE * OR OTH...
* * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,
random_line_split
app.js
var myApp = angular .module('myApp', []) .controller('FirstController', function FirstController($scope){ $scope.messages = [ 'Hello World!', 'This is a message from Angular' ]; }) .controller('PhoneController', function PhoneController($scope){ ...
} } }) ;
// phone: '=key'
random_line_split
server.py
""" Tornado websocket server """ import tornado.ioloop import tornado.web import tornado.websocket import os from threading import Thread from modules import noise, anomaly, message, event settings = {"static_path": os.path.join(os.path.dirname(__file__), "static")} # Runt the audio level thread Thread(target=noise....
(self, message): print("Received a message : " + message) def on_close(self): print("WebSocket closed") application = tornado.web.Application([ (r"/", IndexHandler), (r"/event", EventHandler), (r"/level", LevelHandler), (r"/ws", WebSocketHandler) ], **settings) if __name__ ==...
on_message
identifier_name