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
bounding_box_tracker.ts
/** * @license * Copyright 2021 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ...
/** * Computes similarity based on intersection-over-union (IoU). See `Tracker` * for more details. */ computeSimilarity(poses: Pose[]): number[][] { if (poses.length === 0 || this.tracks.length === 0) { return [[]]; } const simMatrix = poses.map(pose => { return this.tracks.map(t...
{ super(config); }
identifier_body
steps.ts
import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MenuItem} from '../common/api'; import {Router} from '@angular/router'; @Component({ selector: 'p-steps', template: ` <div [ngClass]="{'ui-steps ui-widget ui-helper-clearfix...
if(!item.url||item.routerLink) { event.preventDefault(); } if(item.command) { if(!item.eventEmitter) { item.eventEmitter = new EventEmitter(); item.eventEmitter.subscribe(item.command); } ...
event.preventDefault(); return; }
conditional_block
steps.ts
import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MenuItem} from '../common/api'; import {Router} from '@angular/router'; @Component({ selector: 'p-steps', template: ` <div [ngClass]="{'ui-steps ui-widget ui-helper-clearfix...
} item.eventEmitter.emit({ originalEvent: event, item: item, index: i }); } if(item.routerLink) { this.router.navigate(item.routerLink); } } } @NgModule({ imports: ...
if(this.readonly) { return; } this.activeIndexChange.emit(i); if(item.disabled) { event.preventDefault(); return; } if(!item.url||item.routerLink) { event.preventDefault(); } ...
identifier_body
steps.ts
import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MenuItem} from '../common/api'; import {Router} from '@angular/router'; @Component({ selector: 'p-steps', template: ` <div [ngClass]="{'ui-steps ui-widget ui-helper-clearfix...
} if(item.command) { if(!item.eventEmitter) { item.eventEmitter = new EventEmitter(); item.eventEmitter.subscribe(item.command); } item.eventEmitter.emit({ originalEvent: event, item...
return; } if(!item.url||item.routerLink) { event.preventDefault();
random_line_split
steps.ts
import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MenuItem} from '../common/api'; import {Router} from '@angular/router'; @Component({ selector: 'p-steps', template: ` <div [ngClass]="{'ui-steps ui-widget ui-helper-clearfix...
{ }
tepsModule
identifier_name
token.rs
Enum, "enum"); (20, Extern, "extern"); (21, False, "false"); (22, Fn, "fn"); (23, For, "for"); (24, If, ...
mtwt_token_eq_test
identifier_name
token.rs
"(", RPAREN => ~")", LBRACKET => ~"[", RBRACKET => ~"]", LBRACE => ~"{", RBRACE => ~"}", POUND => ~"#", DOLLAR => ~"$", /* Literals */ LIT_CHAR(c) => { let mut res = ~"'"; char::from_u32(c).unwrap().escape_default(|c| { res.push_ch...
impl Keyword { pub fn to_ident(&self) -> Ident { match *self { $( $sk_variant => Ident { name: $sk_name, ctxt: 0 }, )* $( $rk_variant => Ident { name: $rk_name, ctxt: 0 }, )* } } } } fn mk_fresh_iden...
random_line_split
token.rs
false } } // Get the first "argument" macro_rules! first { ( $first:expr, $( $remainder:expr, )* ) => ( $first ) } // Get the last "argument" (has to be done recursively to avoid phoney local ambiguity error) macro_rules! last { ( $first:expr, $( $remainder:expr, )+ ) => ( last!( $( $remainder, )+ ) ); (...
{ @interner::StrInterner::new() }
identifier_body
ClickAndSeek.js
// ga.addEventBehavior(ga.gameEvents.MouseDown, undefined, undefined, undefined, function (e) { // var spriteClick = ga.CheckEventPosition(e.offsetX, e.offsetY); // if (spriteClick != undefined) { // if (this.lastClick != undefined) { // ...
// } // }, 1);
// }); // }, 100);
random_line_split
mod.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the F...
pub mod field_path; pub mod field_predicate; pub mod version;
pub mod field_isempty; pub mod field_istype; pub mod field_lt;
random_line_split
router.js
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
(pageInstance = page) { this.page = pageInstance } registerRoutes (routes) { routes.forEach(this.registerRoute) } registerRoute = (route) => { if (route.onEnter) { this.page(route.path, BlueprintRouter.handleEnter(route)) } if (route.onExit) { this.page.exit(route.path, Bluep...
constructor
identifier_name
router.js
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
this.page.base(location.pathname) this.page({ hashbang: true }) } stop () { page.stop() } }
} start () {
random_line_split
router.js
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
stop () { page.stop() } }
{ this.page.base(location.pathname) this.page({ hashbang: true }) }
identifier_body
router.js
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distribut...
if (route.onExit) { this.page.exit(route.path, BlueprintRouter.handleExit(route)) } } start () { this.page.base(location.pathname) this.page({ hashbang: true }) } stop () { page.stop() } }
{ this.page(route.path, BlueprintRouter.handleEnter(route)) }
conditional_block
options.py
detection_camera_rot = _matrix33_t #: Deprecated ! Don't use ! detection_camera_trans = _vector31_t #: Deprecated ! Don't use ! detection_tag_index = uint32_t #: Deprecated ! Don't use ! detection_camera_type = uint32_t #: Type of tag searched in detection # Camera parameters compute by drone...
k_mode = uint32_t ui_time = float32_t ui_theta = float32_t ui_phi = float32_t ui_psi = float32_t ui_psi_accuracy = float32_t ui_seq = int32_t @index.register(7) class Trims(OptionHeader): 'Corresponds to C struct ``navdata_trims_t``.' _attrname = 'trims' angular_rates_trim...
'Corresponds to C struct ``navdata_references_t``.' _attrname = 'references' ref_theta = int32_t ref_phi = int32_t ref_theta_I = int32_t ref_phi_I = int32_t ref_pitch = int32_t ref_roll = int32_t ref_yaw = int32_t ref_psi = int32_t vx_ref = float32_t vy_ref = float32_t ...
identifier_body
options.py
self[tag] = function return function index = OptionHeader() class Metadata(Structure): ''' Header of :py:class:`~pyardrone.navdata.NavData`. Available via :py:class:`~pyardrone.navdata.NavData`.metadata Corresponds to C struct ``navdata_t``. ''' _pack_ = 1 _attrname...
raise KeyError('Key {!r} conflict with existing item {}'.format( tag, self[tag]))
conditional_block
options.py
detection_camera_rot = _matrix33_t #: Deprecated ! Don't use ! detection_camera_trans = _vector31_t #: Deprecated ! Don't use ! detection_tag_index = uint32_t #: Deprecated ! Don't use ! detection_camera_type = uint32_t #: Type of tag searched in detection # Camera parameters compute by drone ...
(OptionHeader): ''' Timestamp Corresponds to C struct ``navdata_time_t``. ''' _attrname = 'time' #: 32 bit value where the 11 most significant bits represents the seconds, #: and the 21 least significant bits are the microseconds. time = uint32_t @index.register(2) class RawMeasure...
Time
identifier_name
options.py
detection_camera_rot = _matrix33_t #: Deprecated ! Don't use ! detection_camera_trans = _vector31_t #: Deprecated ! Don't use ! detection_tag_index = uint32_t #: Deprecated ! Don't use ! detection_camera_type = uint32_t #: Type of tag searched in detection # Camera parameters compute by drone...
gyro_temp = uint16_t phys_accs = float32_t * NB_ACCS phys_gyros = float32_t * NB_GYROS alim3V3 = uint32_t #: 3.3volt alim [LSB] vrefEpson = uint32_t #: ref volt Epson gyro [LSB] vrefIDG = uint32_t #: ref volt IDG gyro [LSB] @index.register(4) class GyrosOffsets(OptionHeader): 'Correspo...
accs_temp = float32_t
random_line_split
_refcountlist.ts
/** * @ignore */ export interface RefCount<T> { value: T; count: number; } /** * @ignore */ export interface IRefCountList<T> { clear(): void; readonly count: number; get(index: number): T; push(value: T): void; done(): void; } /** * @ignore */ export class MaxRefCountList<T> implements IRefCountL...
const res = this._list.get(index)!; const val = res.value; if (--res.count === 0) { this._list.delete(index); } return val; } push(value: T) { this._list.set(this._count++, { value: value, count: this._readerCount }); } }
{ throw new Error('Element no longer available in the buffer.'); }
conditional_block
_refcountlist.ts
/** * @ignore */ export interface RefCount<T> { value: T; count: number; } /** * @ignore */ export interface IRefCountList<T> { clear(): void; readonly count: number; get(index: number): T; push(value: T): void; done(): void; } /** * @ignore */ export class MaxRefCountList<T> implements IRefCountL...
get count() { return this._count; } get readerCount() { return this._readerCount; } set readerCount(value: number) { this._readerCount = value; } done() { this._readerCount--; } get(index: number): T { if (!this._list.has(index)) { throw new Error('Element no longer available in the buffer.'); ...
{ this._list.clear(); }
identifier_body
_refcountlist.ts
/** * @ignore */ export interface RefCount<T> { value: T; count: number; } /** * @ignore */ export interface IRefCountList<T> { clear(): void; readonly count: number; get(index: number): T; push(value: T): void; done(): void; } /** * @ignore */ export class MaxRefCountList<T> implements IRefCountL...
() { this._readerCount--; } get(index: number): T { if (!this._list.has(index)) { throw new Error('Element no longer available in the buffer.'); } const res = this._list.get(index)!; const val = res.value; if (--res.count === 0) { this._list.delete(index); } return val; } ...
done
identifier_name
_refcountlist.ts
/** * @ignore */ export interface RefCount<T> { value: T; count: number; } /** * @ignore */ export interface IRefCountList<T> { clear(): void; readonly count: number; get(index: number): T; push(value: T): void; done(): void; } /**
clear() { this._list = []; } get count() { return this._list.length; } get(index: number): T { return this._list[index]; } push(value: T) { this._list.push(value); } // tslint:disable-next-line:no-empty done() { } } /** * @ignore */ export class RefCountList<T> implements IRefCountList<T> { private _r...
* @ignore */ export class MaxRefCountList<T> implements IRefCountList<T> { private _list: T[] = [];
random_line_split
test_login.py
import unittest from leafpy import Leaf from leafpy.auth import login import vcr USERNAME = 'dummyuser' PASSWORD = 'dummypass' class LoginTests(unittest.TestCase): @vcr.use_cassette('tests/unit/cassettes/test_login.yaml', filter_post_data_parameters=['UserId','Password']) def test_login(self): ...
@vcr.use_cassette('tests/unit/cassettes/test_exeption_raised_when_bad_credentials_passed.yaml', filter_post_data_parameters=['UserId','Password']) def test_exeption_raised_when_bad_credentials_passed(self): with self.assertRaises(Exception) as w: leaf = Leaf('bad_email@domain.com'...
leaf = Leaf(VIN='vin345', custom_sessionid='csid123') assert leaf.VIN == 'vin345' assert leaf.custom_sessionid == 'csid123'
identifier_body
test_login.py
import unittest from leafpy import Leaf from leafpy.auth import login import vcr USERNAME = 'dummyuser' PASSWORD = 'dummypass' class LoginTests(unittest.TestCase): @vcr.use_cassette('tests/unit/cassettes/test_login.yaml', filter_post_data_parameters=['UserId','Password']) def test_login(self): ...
csid, VIN = login(USERNAME,PASSWORD) assert csid == 'csessid' assert VIN == 'vin123'
random_line_split
test_login.py
import unittest from leafpy import Leaf from leafpy.auth import login import vcr USERNAME = 'dummyuser' PASSWORD = 'dummypass' class LoginTests(unittest.TestCase): @vcr.use_cassette('tests/unit/cassettes/test_login.yaml', filter_post_data_parameters=['UserId','Password']) def test_login(self): ...
(self): with self.assertRaises(Exception): leaf = Leaf('username') def test_login_with_only_VIN_raises_exception(self): with self.assertRaises(Exception): leaf = Leaf(VIN='vin123') def test_login_with_only_custom_sessionid_raises_exception(self): with self.asser...
test_login_with_only_username_raises_exception
identifier_name
verbosity.py
import os from django.core.management.color import supports_color from django.utils import termcolors class VerboseCommandMixin(object): def __init__(self, *args, **kwargs): super(VerboseCommandMixin, self).__init__(*args, **kwargs) self.dry_run = False if supports_color(): o...
self.stdout.write(output)
conditional_block
verbosity.py
import os from django.core.management.color import supports_color from django.utils import termcolors class VerboseCommandMixin(object): def __init__(self, *args, **kwargs): super(VerboseCommandMixin, self).__init__(*args, **kwargs) self.dry_run = False if supports_color(): o...
if self.verbose: self.stdout.write(output)
identifier_body
verbosity.py
import os from django.core.management.color import supports_color from django.utils import termcolors class VerboseCommandMixin(object): def __init__(self, *args, **kwargs): super(VerboseCommandMixin, self).__init__(*args, **kwargs) self.dry_run = False if supports_color(): o...
(self, action, path): is_withholding_action = False non_actions = set(['create', 'append', 'revert']) if self.dry_run and action in non_actions: is_withholding_action = True if hasattr(self.style, action.upper()): s = getattr(self.style, action.upper()) ...
msg
identifier_name
verbosity.py
import os from django.core.management.color import supports_color from django.utils import termcolors class VerboseCommandMixin(object): def __init__(self, *args, **kwargs): super(VerboseCommandMixin, self).__init__(*args, **kwargs) self.dry_run = False if supports_color(): o...
if is_withholding_action: action = self.style.NOTICE('did not ') + action output = '\t{0:>25}\t{1:<}\n'.format(action, os.path.relpath(path)) self.stdout.write(output) def log(self, output): if self.verbose: self.stdout.write(output)
if hasattr(self.style, action.upper()): s = getattr(self.style, action.upper()) action = s(action)
random_line_split
Module.tsx
import React from 'react'; import BaseChecklist from 'parser/shared/modules/features/Checklist/Module'; import CastEfficiency from 'parser/shared/modules/CastEfficiency';
import AlwaysBeCasting from '../features/AlwaysBeCasting'; import Component from './Component'; import InsanityUsage from '../resources/InsanityUsage'; import ShadowWordPain from '../spells/ShadowWordPain'; import VampiricTouch from '../spells/VampiricTouch'; class Checklist extends BaseChecklist { static dependenci...
import Combatants from 'parser/shared/modules/Combatants'; import PreparationRuleAnalyzer from 'parser/shared/modules/features/Checklist/PreparationRuleAnalyzer';
random_line_split
parser.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (...
if (this.byte + width + 1 > this.size) throw 'Missing bytes, not enough data to parse variable int'; // remove the mark bit for non-id values var value = startByte; if (!id) value -= Math.pow(2, 7 - width); // for each trailing byte: shift the existing bit...
{ if (startByte >= Math.pow(2, 7 - width)) break; }
conditional_block
parser.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (...
// original 64bit float gets converted to an int for each operation). // because the mark is a 1 we can use equality operations to determine // width. when width is 0 (there are no off bits at the start of the // first byte, and the mark is in the first bit (7)) startByte...
// mark: a single 1 bit to separate the width from int data // data: the remaining bits of the first byte, plus width * bytes form // the int data (big endian). // we avoid using bit operations because they are slow in JS (the
random_line_split
parser.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props)
return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new ...
{ for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
identifier_body
parser.js
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (...
(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var EBMLParserBuffer = (function () { function EBMLParserBuffer(buffer) { _classCallCheck(this, EBMLParserBuffer); this.data = new DataView(buffer); this.size =...
_classCallCheck
identifier_name
dynamic_lib.rs
pose &str into // & and str, so we cannot usefully take ToCStr arguments by // reference (without forcing an additional & around &str). So we // are instead temporarily adding an instance for &Path, so that // we can take ToCStr as owned. When DST lands, the &Path instance // should be removed, and ...
{ let mut handle = ptr::null_mut(); GetModuleHandleExW(0 as libc::DWORD, ptr::null(), &mut handle); handle as *mut u8 }
identifier_body
dynamic_lib.rs
; use path::{Path,GenericPath}; use result::*; use slice::{AsSlice,SlicePrelude}; use str; use string::String; use vec::Vec; pub struct DynamicLibrary { handle: *mut u8 } impl Drop for DynamicLibrary { fn drop(&mut self) { match dl::check_for_errors_in(|| { unsafe { dl::close(s...
if result != expected_result { panic!("cos({}) != {} but equaled {} instead", argument, expected_result, result) } } #[test] #[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd", target_os = "drago...
let expected_result = 1.0; let result = cosine(argument);
random_line_split
dynamic_lib.rs
use path::{Path,GenericPath}; use result::*; use slice::{AsSlice,SlicePrelude}; use str; use string::String; use vec::Vec; pub struct DynamicLibrary { handle: *mut u8 } impl Drop for DynamicLibrary { fn drop(&mut self) { match dl::check_for_errors_in(|| { unsafe { dl::close(sel...
(path: &[Path]) -> Vec<u8> { let mut newvar = Vec::new(); for (i, path) in path.iter().enumerate() { if i > 0 { newvar.push(DynamicLibrary::separator()); } newvar.push_all(path.as_vec()); } return newvar; } /// Returns the environment variable for this pr...
create_path
identifier_name
test_new_tests.py
from cStringIO import StringIO import unittest import unittest2 from unittest2.test.support import resultFactory class TestUnittest(unittest2.TestCase): def assertIsSubclass(self, actual, klass): self.assertTrue(issubclass(actual, klass), "Not a subclass.") def testInheritance(self): self....
unittest2.main()
conditional_block
test_new_tests.py
from cStringIO import StringIO import unittest import unittest2 from unittest2.test.support import resultFactory class TestUnittest(unittest2.TestCase): def assertIsSubclass(self, actual, klass): self.assertTrue(issubclass(actual, klass), "Not a subclass.") def testInheritance(self): self....
suite = unittest2.TestSuite((Test('testOne'),)) result = runner.run(suite) self.assertEqual(result.testsRun, 1) self.assertEqual(len(result.errors), 0) def test_old_runner_new_case(self): runner = unittest.TextTestRunner(stream=StringIO()) class Test(unittest2.Test...
def testOne(self): pass
identifier_body
test_new_tests.py
from cStringIO import StringIO import unittest import unittest2 from unittest2.test.support import resultFactory class TestUnittest(unittest2.TestCase): def assertIsSubclass(self, actual, klass): self.assertTrue(issubclass(actual, klass), "Not a subclass.") def testInheritance(self): self....
pass suite = unittest2.TestSuite((Test('testOne'),)) result = runner.run(suite) self.assertEqual(result.testsRun, 1) self.assertEqual(len(result.errors), 0) def test_old_runner_new_case(self): runner = unittest.TextTestRunner(stream=StringIO()) class...
class Test(unittest.TestCase): def testOne(self):
random_line_split
test_new_tests.py
from cStringIO import StringIO import unittest import unittest2 from unittest2.test.support import resultFactory class
(unittest2.TestCase): def assertIsSubclass(self, actual, klass): self.assertTrue(issubclass(actual, klass), "Not a subclass.") def testInheritance(self): self.assertIsSubclass(unittest2.TestCase, unittest.TestCase) self.assertIsSubclass(unittest2.TestResult, unittest.TestResult) ...
TestUnittest
identifier_name
image-data-uri.test.js
const fs = require("fs-extra"); const assert = require("assert"); const ImageDataURI = require("../lib/image-data-uri"); const matchMediaType = /^data:([^;,]+)[;,]/; describe("ImageDataURI", () => { describe("encodeFromFile", () => { it("declares correct media type for test-file.jpg", () => { return Imag...
it("fails when media type is unknown", () => { return ImageDataURI.encodeFromFile("unknown").catch(error => { assert.equal( "ImageDataURI :: Error :: Couldn't recognize media type for file", error ); }); }); }); describe("encodeFromURL", () => { it("decla...
const m = dataURI.match(matchMediaType); assert.equal("image/svg+xml", m[1]); }); });
random_line_split
xuite.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, parse_iso8601, parse_duration, ) class XuiteIE(InfoExtractor): IE_DESC = '隨意窩Xuite影音' _REGEX_BASE...
flv_config = self._download_xml( 'http://vlog.xuite.net/flash/player?media=%s' % base64_media_id, 'flv config') prop_dict = {} for prop in flv_config.findall('./property'): prop_id = self.base64_decode_utf8(prop.attrib['id']) # CDATA may be empty in...
base64_media_id = self.base64_encode_utf8(media_id)
identifier_body
xuite.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, parse_iso8601, parse_duration, ) class XuiteIE(InfoExtractor): IE_DESC = '隨意窩Xuite影音' _REGEX_BASE...
webpage = self._download_webpage(url, video_id) error_msg = self._search_regex( r'<div id="error-message-content">([^<]+)', webpage, 'error message', default=None) if error_msg: raise ExtractorError( '%s returned error: %s' % (self.IE_NAME, error_msg...
if not prop.text: continue encoded_content = self.base64_decode_utf8(prop.text) prop_dict[prop_id] = compat_urllib_parse_unquote(encoded_content) return prop_dict def _real_extract(self, url): video_id = self._match_id(url)
conditional_block
xuite.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, parse_iso8601, parse_duration, ) class XuiteIE(InfoExtractor): IE_DESC = '隨意窩Xuite影音' _REGEX_BASE...
def _extract_flv_config(self, media_id): base64_media_id = self.base64_encode_utf8(media_id) flv_config = self._download_xml( 'http://vlog.xuite.net/flash/player?media=%s' % base64_media_id, 'flv config') prop_dict = {} for prop in flv_config.findall('./prope...
@staticmethod def base64_encode_utf8(data): return base64.b64encode(data.encode('utf-8')).decode('utf-8')
random_line_split
xuite.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, parse_iso8601, parse_duration, ) class
(InfoExtractor): IE_DESC = '隨意窩Xuite影音' _REGEX_BASE64 = r'(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?' _VALID_URL = r'https?://vlog\.xuite\.net/(?:play|embed)/(?P<id>%s)' % _REGEX_BASE64 _TESTS = [{ # Audio 'url': 'http://vlog.xuite.net/play/RGkzc1ZULTM4NjA5MTQuZmx2', ...
XuiteIE
identifier_name
test_security_group_rules_client.py
# Copyright 2015 NEC Corporation. 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 ...
def test_delete_security_group_rule(self): self.check_service_client_function( self.client.delete_security_group_rule, 'tempest.common.service_client.ServiceClient.delete', {}, status=202, group_rule_id='group-id')
random_line_split
test_security_group_rules_client.py
# Copyright 2015 NEC Corporation. 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 ...
def test_create_security_group_rule_with_bytes_body(self): self._test_create_security_group_rule(bytes_body=True) def test_delete_security_group_rule(self): self.check_service_client_function( self.client.delete_security_group_rule, 'tempest.common.service_client.Servi...
self._test_create_security_group_rule()
identifier_body
test_security_group_rules_client.py
# Copyright 2015 NEC Corporation. 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 ...
(self): self._test_create_security_group_rule(bytes_body=True) def test_delete_security_group_rule(self): self.check_service_client_function( self.client.delete_security_group_rule, 'tempest.common.service_client.ServiceClient.delete', {}, status=202, group_rule_...
test_create_security_group_rule_with_bytes_body
identifier_name
debug.rs
use core::slice; use drivers::io::{Io, Pio}; use super::Result; pub fn do_sys_debug(ptr: *const u8, len: usize) -> Result<usize> { let bytes = unsafe { slice::from_raw_parts(ptr, len) }; if unsafe { ::ENV_PTR.is_some() }
else { let serial_status = Pio::<u8>::new(0x3F8 + 5); let mut serial_data = Pio::<u8>::new(0x3F8); for byte in bytes.iter() { while !serial_status.readf(0x20) {} serial_data.write(*byte); if *byte == 8 { while !serial_status.readf(0x20) {} ...
{ ::env().console.lock().write(bytes); }
conditional_block
debug.rs
use core::slice; use drivers::io::{Io, Pio}; use super::Result; pub fn do_sys_debug(ptr: *const u8, len: usize) -> Result<usize> { let bytes = unsafe { slice::from_raw_parts(ptr, len) }; if unsafe { ::ENV_PTR.is_some() } { ::env().console.lock().write(bytes); } else { let serial_status =...
if *byte == 8 { while !serial_status.readf(0x20) {} serial_data.write(0x20); while !serial_status.readf(0x20) {} serial_data.write(8); } } } Ok(len) }
for byte in bytes.iter() { while !serial_status.readf(0x20) {} serial_data.write(*byte);
random_line_split
debug.rs
use core::slice; use drivers::io::{Io, Pio}; use super::Result; pub fn do_sys_debug(ptr: *const u8, len: usize) -> Result<usize>
} } Ok(len) }
{ let bytes = unsafe { slice::from_raw_parts(ptr, len) }; if unsafe { ::ENV_PTR.is_some() } { ::env().console.lock().write(bytes); } else { let serial_status = Pio::<u8>::new(0x3F8 + 5); let mut serial_data = Pio::<u8>::new(0x3F8); for byte in bytes.iter() { whi...
identifier_body
debug.rs
use core::slice; use drivers::io::{Io, Pio}; use super::Result; pub fn
(ptr: *const u8, len: usize) -> Result<usize> { let bytes = unsafe { slice::from_raw_parts(ptr, len) }; if unsafe { ::ENV_PTR.is_some() } { ::env().console.lock().write(bytes); } else { let serial_status = Pio::<u8>::new(0x3F8 + 5); let mut serial_data = Pio::<u8>::new(0x3F8); ...
do_sys_debug
identifier_name
schematics.ts
/** * Refer to the angular shematics library to let the dependency validator * know it is used.. * * require('@schematics/angular') */ import { schema } from '@angular-devkit/core'; import { Collection, Engine, Schematic, SchematicEngine, formats, } from '@angular-devkit/schematics'; import { FileSyst...
schematicName: string, allowPrivate?: boolean): Schematic<any, any> { return collection.createSchematic(schematicName, allowPrivate); }
export function getSchematic(collection: Collection<any, any>,
random_line_split
schematics.ts
/** * Refer to the angular shematics library to let the dependency validator * know it is used.. * * require('@schematics/angular') */ import { schema } from '@angular-devkit/core'; import { Collection, Engine, Schematic, SchematicEngine, formats, } from '@angular-devkit/schematics'; import { FileSyst...
return collection; } export function getSchematic(collection: Collection<any, any>, schematicName: string, allowPrivate?: boolean): Schematic<any, any> { return collection.createSchematic(schematicName, allowPrivate); }
{ throw new SilentError(`Invalid collection (${collectionName}).`); }
conditional_block
schematics.ts
/** * Refer to the angular shematics library to let the dependency validator * know it is used.. * * require('@schematics/angular') */ import { schema } from '@angular-devkit/core'; import { Collection, Engine, Schematic, SchematicEngine, formats, } from '@angular-devkit/schematics'; import { FileSyst...
export function getEngine(): Engine<FileSystemCollectionDesc, FileSystemSchematicDesc> { return engine; } export function getCollection(collectionName: string): Collection<any, any> { const engine = getEngine(); const collection = engine.createCollection(collectionName); if (collection === null) { throw ...
{ return engineHost; }
identifier_body
schematics.ts
/** * Refer to the angular shematics library to let the dependency validator * know it is used.. * * require('@schematics/angular') */ import { schema } from '@angular-devkit/core'; import { Collection, Engine, Schematic, SchematicEngine, formats, } from '@angular-devkit/schematics'; import { FileSyst...
() { return engineHost; } export function getEngine(): Engine<FileSystemCollectionDesc, FileSystemSchematicDesc> { return engine; } export function getCollection(collectionName: string): Collection<any, any> { const engine = getEngine(); const collection = engine.createCollection(collectionName); if (collec...
getEngineHost
identifier_name
lpurge.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use futures::future::TryFutureExt; use std::{collections::HashMap, path::PathBuf}; use tokio::fs; #[derive(serde::Deseri...
}
{ let cfg = Config { fs: "lima".to_string(), pool: "santiago".to_string(), ost: 16, freehi: 123, freelo: 60, mailbox: "foobar".to_string(), }; let file = conf_name(&cfg, "/etc/lpurge/{fs}/{ost}-{pool}.conf") .awa...
identifier_body
lpurge.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use futures::future::TryFutureExt; use std::{collections::HashMap, path::PathBuf}; use tokio::fs; #[derive(serde::Deseri...
() { let cfg = Config { fs: "lima".to_string(), pool: "santiago".to_string(), ost: 16, freehi: 123, freelo: 60, mailbox: "foobar".to_string(), }; let file = conf_name(&cfg, "/etc/lpurge/{fs}/{ost}-{pool}.conf") ....
config_name
identifier_name
lpurge.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use futures::future::TryFutureExt; use std::{collections::HashMap, path::PathBuf}; use tokio::fs; #[derive(serde::Deseri...
let cnt = c.generate_unit(socket); fs::write(file, cnt.as_bytes()).await } #[cfg(test)] mod lpurge_conf_tests { use super::*; use insta::assert_display_snapshot; use std::env; use tempfile::tempdir; #[tokio::test] async fn works() { let cfg = Config { fs: "lima"....
{ fs::create_dir_all(&parent).await?; }
conditional_block
lpurge.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use futures::future::TryFutureExt; use std::{collections::HashMap, path::PathBuf}; use tokio::fs; #[derive(serde::Deseri...
.await .expect("name could not be created"); assert_eq!( file, PathBuf::from("/etc/lpurge/lima/OST0010-santiago.conf") ); } }
random_line_split
FetchProvider.tsx
import fetch from 'isomorphic-unfetch'; import React, { createContext, useState, useEffect, useContext } from 'react'; type FetchProviderProps = { url?: string; options?: { [key: string]: any }; previewData?: any; children: React.ReactNode; }; type FetchContext<T> = { loading: boolean; error?: string; d...
} catch (error) { setError(error); setLoading(false); } }; if (!previewData) { fetchData(); } }, []); return ( <FetchProviderContext.Provider value={{ loading, error, data }}> {children} </FetchProviderContext.Provider> ); }; export const useFetch = ...
{ throw new Error('must provide a Fetch url'); }
conditional_block
FetchProvider.tsx
import fetch from 'isomorphic-unfetch'; import React, { createContext, useState, useEffect, useContext } from 'react'; type FetchProviderProps = { url?: string; options?: { [key: string]: any }; previewData?: any; children: React.ReactNode; }; type FetchContext<T> = { loading: boolean; error?: string; d...
const [error, setError] = useState<string | undefined>(); const [data, setData] = useState<any | undefined>(previewData); useEffect(() => { const fetchData = async () => { try { if (url) { const response = await fetch(url, options); const json = await response.json(); ...
children }) => { const [loading, setLoading] = useState<boolean>(!previewData);
random_line_split
coordinates-constraint-config-form.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * 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 ...
} private resetForm() { this.form.clearValidators(); removeAllFormControls(this.form); } private createForm() { this.form.addControl( CoordinatesConstraintFormControl.Format, new FormControl(this.config?.format || CoordinatesFormat.DecimalDegrees) ); this.form.addControl( ...
{ this.resetForm(); this.createForm(); }
conditional_block
coordinates-constraint-config-form.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * 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 ...
(): AbstractControl { return this.form.get(CoordinatesConstraintFormControl.Format); } public get precisionControl(): AbstractControl { return this.form.get(CoordinatesConstraintFormControl.Precision); } private createFormatItems(): SelectItemModel[] { return this.formats.map(format => ({ id...
formatControl
identifier_name
coordinates-constraint-config-form.component.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * 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 ...
return format === CoordinatesFormat.DegreesMinutesSeconds ? 0 : 6; }
function getDefaultPrecision(format: CoordinatesFormat): number {
random_line_split
spineless.js
(function() { var Application, PubSub, Request, Router, Spineless; Application = (function() { function Application() { return { controllers: {}, helpers: { _default: function(locals) { return $.extend(true, {}, locals); } } }; } ret...
() { return { parseRoute: function(route) { var hsh, str; str = route + ""; hsh = $.extend(true, {}, { controller: 'application', action: 'index' }); while (str.charAt(0) === '/') { str = str.substr(1); } ...
Router
identifier_name
spineless.js
(function() { var Application, PubSub, Request, Router, Spineless; Application = (function() { function Application() { return { controllers: {}, helpers: { _default: function(locals) { return $.extend(true, {}, locals); } } }; } ret...
if (str.length > 0) { $.each(str.split('/'), function(i, e) { if (i === 0) { hsh.controller = e; } if (i === 1) { return hsh.action = e; } }); } return hsh; }, ro...
str = str.substr(1); }
random_line_split
spineless.js
(function() { var Application, PubSub, Request, Router, Spineless; Application = (function() { function Application() { return { controllers: {}, helpers: { _default: function(locals) { return $.extend(true, {}, locals); } } }; } ret...
if (i === 1) { return hsh.action = e; } }); } return hsh; }, route: function(element) { var route, url; url = element.attr('href') || $(element).attr('data-href'); route = this.parseRoute(url); ...
{ hsh.controller = e; }
conditional_block
spineless.js
(function() { var Application, PubSub, Request, Router, Spineless; Application = (function() { function Application() { return { controllers: {}, helpers: { _default: function(locals) { return $.extend(true, {}, locals); } } }; } ret...
return Request; })(); Router = (function() { function Router() { return { parseRoute: function(route) { var hsh, str; str = route + ""; hsh = $.extend(true, {}, { controller: 'application', action: 'index' }); while...
{ var p; p = params != null ? params : {}; return { controller: $(".controller[data-controller=" + controller + "]"), view: $(".controller[data-controller=" + controller + "] .view[data-action=" + action + "]"), params: $.extend(true, p, { controller: controller, ...
identifier_body
test_sklearn_wrapper.py
import numpy as np import pandas as pd import pytest from sklearn.ensemble import ExtraTreesClassifier from sklearn.impute import SimpleImputer from sklearn.model_selection import GridSearchCV, cross_val_score from sklearn.pipeline import Pipeline from sklearn.preprocessing import FunctionTransformer, StandardScaler f...
assert X_train.shape[0] == 15 def test_sklearn_estimator(df, pipeline): # Using with estimator pipeline.fit(df['customer_id'].values, y=df.target.values) \ .predict(df['customer_id'].values) result = pipeline.score(df['customer_id'].values, df.target.values) assert isinstance(result, ...
random_line_split
test_sklearn_wrapper.py
import numpy as np import pandas as pd import pytest from sklearn.ensemble import ExtraTreesClassifier from sklearn.impute import SimpleImputer from sklearn.model_selection import GridSearchCV, cross_val_score from sklearn.pipeline import Pipeline from sklearn.preprocessing import FunctionTransformer, StandardScaler f...
@pytest.fixture(scope='module') def df(es): df = es['customers'].df df['target'] = np.random.randint(1, 3, df.shape[0]) # 1 or 2 values return df @pytest.fixture(scope='module') def pipeline(es): pipeline = Pipeline(steps=[ ('ft', DFSTransformer(entityset=es, ...
es = load_mock_customer(n_customers=15, n_products=15, n_sessions=75, n_transactions=1000, random_seed=0, return_entityset=True) return es
identifier_body
test_sklearn_wrapper.py
import numpy as np import pandas as pd import pytest from sklearn.ensemble import ExtraTreesClassifier from sklearn.impute import SimpleImputer from sklearn.model_selection import GridSearchCV, cross_val_score from sklearn.pipeline import Pipeline from sklearn.preprocessing import FunctionTransformer, StandardScaler f...
(df, pipeline): # Using with cross_val_score results = cross_val_score(pipeline, X=df['customer_id'].values, y=df.target.values, cv=2, scoring="accuracy") assert isinstance(results[0], (f...
test_sklearn_cross_val_score
identifier_name
test_interpolative.py
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. #****************************************************************************** import scipy.linalg.interpolative as pymatrixid import numpy as np from scipy.linalg import hilbert, svdvals, norm from scipy.spars...
eps = 1.0e-12 # fixed precision A = np.random.rand(16, 8) k, idx, proj = pymatrixid.interp_decomp(A, eps) assert_equal(k, A.shape[1]) P = pymatrixid.reconstruct_interp_matrix(idx, proj) B = pymatrixid.reconstruct_skel_matrix(A, k, idx) assert_allclose(A, B @ P) ...
identifier_body
test_interpolative.py
THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, ...
A_or_L = A if not lin_op else L U, S, V = pymatrixid.svd(A_or_L, eps, rand=rand) B = U * S @ V.T.conj() assert_allclose(A, B, rtol=eps, atol=1e-08) @pytest.mark.parametrize( "rand,lin_op", [(False, False), (True, False), (True, True)]) def test_svd_fixed_rank(s...
pytest.xfail("bug in external fortran code")
conditional_block
test_interpolative.py
THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, ...
(self, A): s = svdvals(A) norm_2_est = pymatrixid.estimate_spectral_norm(A) assert_allclose(norm_2_est, s[0], rtol=1e-6, atol=1e-8) def test_estimate_spectral_norm_diff(self, A): B = A.copy() B[:, 0] *= 1.2 s = svdvals(A - B) norm_2_est = pymatrixid.estimate_...
test_estimate_spectral_norm
identifier_name
test_interpolative.py
THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, ...
assert_allclose(A, B, rtol=eps, atol=1e-08) def test_estimate_spectral_norm(self, A): s = svdvals(A) norm_2_est = pymatrixid.estimate_spectral_norm(A) assert_allclose(norm_2_est, s[0], rtol=1e-6, atol=1e-8) def test_estimate_spectral_norm_diff(self, A): B = A.copy() ...
B = U * S @ V.T.conj()
random_line_split
karma.conf.js
// Karma configuration module.exports = function(config) { var configuration = { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: 'siteservice/website', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapt...
'components/login/smsConfirmationController.js', 'components/login/twoFactorAuthenticationController.js', 'components/login/forgotPasswordController.js', 'components/login/recoverAccountController.js', 'components/login/organizationInviteController.js', 'compo...
'components/login/loginController.js', 'components/login/loginService.js', 'components/login/resendSMSController.js',
random_line_split
edit-event-dispatcher.d.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { NgZone } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import * as i0 from "@angular/core...
private _lastSeenRow; private _lastSeenRowHoverOrFocus; constructor(_ngZone: NgZone); /** * Gets an Observable that emits true when the specified element's cell * is editing and false when not. */ editingCell(element: Element | EventTarget): Observable<boolean>; /** * Stops e...
/** The combined set of row hover content states organized by row. */ private readonly _hoveredContentStateDistinct; private readonly _editingAndEnabledDistinct;
random_line_split
edit-event-dispatcher.d.ts
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { NgZone } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import * as i0 from "@angular/core...
<R> { private readonly _ngZone; /** A subject that indicates which table cell is currently editing (unless it is disabled). */ readonly editing: Subject<Element | null>; /** A subject that indicates which table row is currently hovered. */ readonly hovering: Subject<Element | null>; /** A subjec...
EditEventDispatcher
identifier_name
commandSettings.js
/* * Copyright (C) 2016-2021 phantombot.github.io/PhantomBot * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * ...
// Get command settings. socket.getDBValues('get_command_settings', { tables: ['settings', 'settings', 'settings', 'settings', 'cooldownSettings', 'cooldownSettings'], keys: ['permComMsgEnabled', 'priceComMsgEnabled', 'coolDownMsgEnabled', 'pricecomMods', 'modCooldown', '...
// Function that querys all of the data we need. $(run = function() {
random_line_split
check_const.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
match expr.node { ExprLit(ref lit) => ast_util::lit_is_str(&**lit), _ => false, } } _ => false, } } match p.node { // Let through plain ~-string literals here PatLit(ref a) => if !is_str(&**a)...
random_line_split
check_const.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(&mut self, p: &Pat) { check_pat(self, p); } fn visit_expr(&mut self, ex: &Expr) { if check_expr(self, ex) { visit::walk_expr(self, ex); } } } pub fn check_crate(tcx: &ty::ctxt) { visit::walk_crate(&mut CheckCrateVisitor { tcx: tcx, in_const: false }, ...
visit_pat
identifier_name
check_const.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
ExprPath(ref pth) => { // NB: In the future you might wish to relax this slightly // to handle on-demand instantiation of functions via // foo::<bar> in a const. Currently that is only done on // a path in trans::callee that only works in block contexts. ...
{ let ety = ty::expr_ty(v.tcx, e); if !ty::type_is_numeric(ety) && !ty::type_is_unsafe_ptr(ety) { span_err!(v.tcx.sess, e.span, E0012, "can not cast to `{}` in a constant expression", ppaux::ty_to_string(v.tcx, ety)); ...
conditional_block
obj_file_io.py
# -*- coding: utf-8 -*- """ object file io is a Python object to single file I/O framework. The word 'framework' means you can use any serialization/deserialization algorithm here. - dump: dump python object to a file. - safe_dump: add atomic writing guarantee for ``dump``. - load: load python object from a file. Fe...
obj = loader_func(b.decode("utf-8"), **kwargs) else: obj = loader_func(b, **kwargs) elapsed = time.clock() - st prt_console(" Complete! Elapse %.6f sec." % elapsed, verbose) return obj def dump_func(serializer_type): """A decorator for ``_dump(dumper_func=dumper_func, **kwargs)...
lizer_type is "str":
conditional_block
obj_file_io.py
# -*- coding: utf-8 -*- """ object file io is a Python object to single file I/O framework. The word 'framework' means you can use any serialization/deserialization algorithm here. - dump: dump python object to a file. - safe_dump: add atomic writing guarantee for ``dump``. - load: load python object from a file. Fe...
if compress: b = zlib.compress(b) with atomic_write(abspath, overwrite=overwrite, mode="wb") as f: f.write(b) elapsed = time.clock() - st prt_console(" Complete! Elapse %.6f sec." % elapsed, verbose) if serializer_type is "str": return b_or_str else: return...
b_or_str = dumper_func(obj, **kwargs) if serializer_type is "str": b = b_or_str.encode("utf-8") else: b = b_or_str
random_line_split
obj_file_io.py
# -*- coding: utf-8 -*- """ object file io is a Python object to single file I/O framework. The word 'framework' means you can use any serialization/deserialization algorithm here. - dump: dump python object to a file. - safe_dump: add atomic writing guarantee for ``dump``. - load: load python object from a file. Fe...
n _load( *args, loader_func=loader_func, serializer_type=serializer_type, **kwargs ) return wrapper return outer_wrapper
retur
identifier_name
obj_file_io.py
# -*- coding: utf-8 -*- """ object file io is a Python object to single file I/O framework. The word 'framework' means you can use any serialization/deserialization algorithm here. - dump: dump python object to a file. - safe_dump: add atomic writing guarantee for ``dump``. - load: load python object from a file. Fe...
izer_type): if serializer_type not in ["binary", "str"]: raise ValueError("serializer_type has to be one of 'binary' or 'str'!") # dump, load def _dump(obj, abspath, serializer_type, dumper_func=None, compress=True, overwrite=False, verbose=False, **kwargs...
rbose`` is True. """ if verbose: logger.info(message) def _check_serializer_type(serial
identifier_body
file.service.ts
import { Injectable } from '@angular/core'; import { OctopostHttpService } from './octopost-http.service'; import { CreatedResult } from '../model/index'; import { HttpClient } from '@angular/common/http'; import { File } from '../model/file.model'; @Injectable() export class
{ constructor(private httpService: OctopostHttpService, private httpClient: HttpClient) { } public async addFile(fileToUpload: any): Promise<CreatedResult> { const input = new FormData(); input.append('file', fileToUpload); const response = await this.httpService.post('Files', input, CreatedResult); ...
FileService
identifier_name
file.service.ts
import { Injectable } from '@angular/core'; import { OctopostHttpService } from './octopost-http.service'; import { CreatedResult } from '../model/index'; import { HttpClient } from '@angular/common/http'; import { File } from '../model/file.model'; @Injectable() export class FileService { constructor(private httpS...
link: link }, CreatedResult); return reply; } public async getFile(fileId: number): Promise<File> { const url = `Files/${fileId}/Info`; return this.httpService.get(url, File); } }
random_line_split
file.service.ts
import { Injectable } from '@angular/core'; import { OctopostHttpService } from './octopost-http.service'; import { CreatedResult } from '../model/index'; import { HttpClient } from '@angular/common/http'; import { File } from '../model/file.model'; @Injectable() export class FileService { constructor(private httpS...
}
{ const url = `Files/${fileId}/Info`; return this.httpService.get(url, File); }
identifier_body
scrollline.js
var wxCharts = require('../../../utils/wxcharts.js'); var app = getApp(); var lineChart = null; var startPos = null; Page({ data: { }, touchHandler: function (e) { lineChart.scrollStart(e); }, moveHandler: function (e) { lineChart.scroll(e); }, touchEndHandler: function (e) {...
return { categories: categories, data: data } }, onLoad: function (e) { var windowWidth = 320; try { var res = wx.getSystemInfoSync(); windowWidth = res.windowWidth; } catch (e) { console.error('getSystemInfoSyn...
{ categories.push('201620162-' + (i + 1)); data.push(Math.random()*(20-10)+10); }
conditional_block
scrollline.js
var wxCharts = require('../../../utils/wxcharts.js'); var app = getApp(); var lineChart = null; var startPos = null; Page({ data: { }, touchHandler: function (e) { lineChart.scrollStart(e); }, moveHandler: function (e) { lineChart.scroll(e); }, touchEndHandler: function (e) {...
extra: { lineStyle: 'curve' } }); } });
dataPointShape: true, enableScroll: true,
random_line_split
tick-start.js
import { writeSavedTimer } from './output' import db from '../db' import { saveTimer } from '../timers' export default { builder, handler : start} const defTimersDoc = { _id: '_local/timers', timers: [] } function builder(yargs)
function start(argv) { const message = argv._[1] db.get('_local/timers') .then(timersDoc => saveTimer(db, timersDoc, message)) .catch(err => { // If the timersDoc doesn't exist, pass the defTimersDoc if (err.name === 'not_found') return saveTimer(db, defTimersDoc, message) else throw...
{ return yargs .usage('Usage: tick start [message]') .example('tick start', 'start a timer for the current time') .example('tick start "8am"', 'start a timer for 8am') .example('tick start "8am squashing bugs #dev"', 'start a timer for 8am and provide a message for the commit') }
identifier_body
tick-start.js
import { writeSavedTimer } from './output' import db from '../db' import { saveTimer } from '../timers' export default { builder, handler : start} const defTimersDoc = { _id: '_local/timers', timers: [] } function
(yargs) { return yargs .usage('Usage: tick start [message]') .example('tick start', 'start a timer for the current time') .example('tick start "8am"', 'start a timer for 8am') .example('tick start "8am squashing bugs #dev"', 'start a timer for 8am and provide a message for the commit') } function start(argv)...
builder
identifier_name
tick-start.js
import { writeSavedTimer } from './output' import db from '../db' import { saveTimer } from '../timers' export default { builder, handler : start} const defTimersDoc = { _id: '_local/timers', timers: [] } function builder(yargs) { return yargs
.example('tick start', 'start a timer for the current time') .example('tick start "8am"', 'start a timer for 8am') .example('tick start "8am squashing bugs #dev"', 'start a timer for 8am and provide a message for the commit') } function start(argv) { const message = argv._[1] db.get('_local/timers') .then...
.usage('Usage: tick start [message]')
random_line_split
timer-examples.module.ts
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; import { NativeScriptRouterModule } from "@nativescript/angular"; import { NativeScriptCommonModule } from "@nativescript/angular"; import { NativeScriptFormsModule } from "@nativescript/angular"; import { TimerExamplesComponent } from "./timer-examples.compo...
], declarations: [ TimerExamplesComponent, SetIntervalComponent, SetTimeoutComponent ] }) export class TimerExamplesModule { constructor() { } }
NativeScriptRouterModule, NativeScriptFormsModule, NativeScriptRouterModule.forChild(routerConfig)
random_line_split
timer-examples.module.ts
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; import { NativeScriptRouterModule } from "@nativescript/angular"; import { NativeScriptCommonModule } from "@nativescript/angular"; import { NativeScriptFormsModule } from "@nativescript/angular"; import { TimerExamplesComponent } from "./timer-examples.compo...
{ constructor() { } }
TimerExamplesModule
identifier_name
mod.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of System Syzygy. | ...
// ========================================================================= //
{ let view = { let visible_rect = window.visible_rect(); View::new( &mut window.resources(), visible_rect, &save_data.game_mut().column_as_icy_em, ) }; run_puzzle(window, save_data, view) }
identifier_body
mod.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of System Syzygy. | ...
( window: &mut Window, save_data: &mut SaveData, ) -> Mode { let view = { let visible_rect = window.visible_rect(); View::new( &mut window.resources(), visible_rect, &save_data.game_mut().column_as_icy_em, ) }; run_puzzle(window, save_data,...
run_column_as_icy_em
identifier_name