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
package.py
############################################################################## # Copyright (c) 2013-2018, 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.
# For details, see https://github.com/spack/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # 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) version 2....
# LLNL-CODE-647188 #
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2018, 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...
depends_on('r-s4vectors@0.13.17:', type=('build', 'run'), when='@2.10.5') depends_on('r-s4vectors@0.15.5:', type=('build', 'run'), when='@2.12.0') depends_on('r@3.4.0:3.4.9', when='@2.10.5:')
"""Provides efficient low-level and highly reusable S4 classes for storing, manipulating and aggregating over annotated ranges of integers. Implements an algebra of range operations, including efficient algorithms for finding overlaps and nearest neighbors. Defines efficient list-like classe...
identifier_body
reorder.rs
, &b.kind) { (&ast::ItemKind::Mod(..), &ast::ItemKind::Mod(..)) => { a.ident.as_str().cmp(&b.ident.as_str()) } (&ast::ItemKind::ExternCrate(ref a_name), &ast::ItemKind::ExternCrate(ref b_name)) => {
let result = a_orig_name.cmp(&b_orig_name); if result != Ordering::Equal { return result; } // `extern crate foo as bar;` // ^^^ Comparing this. match (a_name, b_name) { (Some(..), None) => Orde...
// `extern crate foo as bar;` // ^^^ Comparing this. let a_orig_name = a_name.map_or_else(|| a.ident.as_str(), rustc_span::Symbol::as_str); let b_orig_name = b_name.map_or_else(|| b.ident.as_str(), rustc_span::Symbol::as_str);
random_line_split
reorder.rs
( context: &RewriteContext<'_>, item: &ast::Item, shape: Shape, ) -> Option<String> { match item.kind { ast::ItemKind::ExternCrate(..) => rewrite_extern_crate(context, item, shape), ast::ItemKind::Mod(..) => rewrite_mod(context, item, shape), _ => None, } } /// Rewrite a lis...
visit_items_with_reordering
identifier_name
reorder.rs
&b.kind) { (&ast::ItemKind::Mod(..), &ast::ItemKind::Mod(..)) => { a.ident.as_str().cmp(&b.ident.as_str()) } (&ast::ItemKind::ExternCrate(ref a_name), &ast::ItemKind::ExternCrate(ref b_name)) => { // `extern crate foo as bar;` // ^^^ Comparing t...
/// Divides imports into three groups, corresponding to standard, external /// and local imports. Sorts each subgroup. fn group_imports(uts: Vec<UseTree>) -> Vec<Vec<UseTree>> { let mut std_imports = Vec::new(); let mut external_imports = Vec::new(); let mut local_imports = Vec::new(); for ut in uts....
{ crate::attr::contains_name(&item.attrs, sym::macro_use) }
identifier_body
encrypt_key_management.js
import { wrap as aesKw } from '../runtime/aeskw.js'; import * as ECDH from '../runtime/ecdhes.js'; import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js'; import { encrypt as rsaEs } from '../runtime/rsaes.js'; import { encode as base64url } from '../runtime/base64url.js'; import generateCek, { bitLength as cekLeng...
(alg, enc, key, providedCek, providedParameters = {}) { let encryptedKey; let parameters; let cek; checkKeyType(alg, key, 'encrypt'); switch (alg) { case 'dir': { cek = key; break; } case 'ECDH-ES': case 'ECDH-ES+A128KW': case 'ECDH-ES+...
encryptKeyManagement
identifier_name
encrypt_key_management.js
import { wrap as aesKw } from '../runtime/aeskw.js'; import * as ECDH from '../runtime/ecdhes.js'; import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js'; import { encrypt as rsaEs } from '../runtime/rsaes.js'; import { encode as base64url } from '../runtime/base64url.js'; import generateCek, { bitLength as cekLeng...
const { apu, apv } = providedParameters; let { epk: ephemeralKey } = providedParameters; ephemeralKey || (ephemeralKey = await ECDH.generateEpk(key)); const { x, y, crv, kty } = await exportJWK(ephemeralKey); const sharedSecret = await ECDH.deriveKey(key, eph...
{ throw new JOSENotSupported('ECDH-ES with the provided key is not allowed or not supported by your javascript runtime'); }
conditional_block
encrypt_key_management.js
import { wrap as aesKw } from '../runtime/aeskw.js'; import * as ECDH from '../runtime/ecdhes.js'; import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js'; import { encrypt as rsaEs } from '../runtime/rsaes.js'; import { encode as base64url } from '../runtime/base64url.js'; import generateCek, { bitLength as cekLeng...
case 'A256KW': { cek = providedCek || generateCek(enc); encryptedKey = await aesKw(alg, key, cek); break; } case 'A128GCMKW': case 'A192GCMKW': case 'A256GCMKW': { cek = providedCek || generateCek(enc); const { iv } = pr...
break; } case 'A128KW': case 'A192KW':
random_line_split
encrypt_key_management.js
import { wrap as aesKw } from '../runtime/aeskw.js'; import * as ECDH from '../runtime/ecdhes.js'; import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js'; import { encrypt as rsaEs } from '../runtime/rsaes.js'; import { encode as base64url } from '../runtime/base64url.js'; import generateCek, { bitLength as cekLeng...
const { x, y, crv, kty } = await exportJWK(ephemeralKey); const sharedSecret = await ECDH.deriveKey(key, ephemeralKey, alg === 'ECDH-ES' ? enc : alg, parseInt(alg.substr(-5, 3), 10) || cekLength(enc), apu, apv); parameters = { epk: { x, y, crv, kty } }; if (apu) ...
{ let encryptedKey; let parameters; let cek; checkKeyType(alg, key, 'encrypt'); switch (alg) { case 'dir': { cek = key; break; } case 'ECDH-ES': case 'ECDH-ES+A128KW': case 'ECDH-ES+A192KW': case 'ECDH-ES+A256KW': { ...
identifier_body
index.tsx
import React from 'react'; import RcSlider from 'rc-slider/lib/Slider'; import RcRange from 'rc-slider/lib/Range'; import RcHandle from 'rc-slider/lib/Handle'; import Tooltip from '../tooltip'; export interface SliderMarks { [key: number]: React.ReactNode | { style: React.CSSProperties, label: React.ReactNod...
(props) { super(props); this.state = { visibles: {}, }; } toggleTooltipVisible = (index, visible) => { this.setState(({ visibles }) => ({ visibles: { ...visibles, [index]: visible, }, })); } handleWithTooltip = ({ value, dragging, index, ...restProps }) => ...
constructor
identifier_name
index.tsx
import React from 'react'; import RcSlider from 'rc-slider/lib/Slider'; import RcRange from 'rc-slider/lib/Range'; import RcHandle from 'rc-slider/lib/Handle'; import Tooltip from '../tooltip'; export interface SliderMarks { [key: number]: React.ReactNode | { style: React.CSSProperties, label: React.ReactNod...
, }; constructor(props) { super(props); this.state = { visibles: {}, }; } toggleTooltipVisible = (index, visible) => { this.setState(({ visibles }) => ({ visibles: { ...visibles, [index]: visible, }, })); } handleWithTooltip = ({ value, dragging, index...
{ return value.toString(); }
identifier_body
index.tsx
import React from 'react'; import RcSlider from 'rc-slider/lib/Slider'; import RcRange from 'rc-slider/lib/Range'; import RcHandle from 'rc-slider/lib/Handle'; import Tooltip from '../tooltip'; export interface SliderMarks { [key: number]: React.ReactNode | { style: React.CSSProperties, label: React.ReactNod...
/>; } return <RcSlider {...restProps} handle={this.handleWithTooltip} />; } }
{ return <RcRange {...restProps} handle={this.handleWithTooltip}
conditional_block
index.tsx
import React from 'react'; import RcSlider from 'rc-slider/lib/Slider'; import RcRange from 'rc-slider/lib/Range'; import RcHandle from 'rc-slider/lib/Handle'; import Tooltip from '../tooltip'; export interface SliderMarks { [key: number]: React.ReactNode | { style: React.CSSProperties, label: React.ReactNod...
placement="top" transitionName="zoom-down" key={index} > <RcHandle {...restProps} value={value} onMouseEnter={() => this.toggleTooltipVisible(index, true)} onMouseLeave={() => this.toggleTooltipVisible(index, false)} /> </Toolti...
return ( <Tooltip prefixCls={tooltipPrefixCls} title={tipFormatter ? tipFormatter(value) : ''} visible={tipFormatter && (visibles[index] || dragging)}
random_line_split
analyzegameDialog.py
from __future__ import absolute_import import time import threading from gi.repository import Gtk from . import gamewidget from pychess.Utils.const import HINT, SPY, BLACK, WHITE from pychess.System import conf, fident from pychess.System import uistuff from pychess.System.idle_add import idle_add from pychess.System...
uistuff.keep(widgets["showEval"], "showEval") uistuff.keep(widgets["showBlunder"], "showBlunder", first_value=True) uistuff.keep(widgets["max_analysis_spin"], "max_analysis_spin", first_value=3) uistuff.keep(widgets["variation_threshold_spin"], "variation_threshold_spin", first_value=50) # Analyzin...
uistuff.keep(widgets["shouldWhite"], "shouldWhite", first_value=True) uistuff.keep(widgets["threatPV"], "threatPV")
random_line_split
analyzegameDialog.py
from __future__ import absolute_import import time import threading from gi.repository import Gtk from . import gamewidget from pychess.Utils.const import HINT, SPY, BLACK, WHITE from pychess.System import conf, fident from pychess.System import uistuff from pychess.System.idle_add import idle_add from pychess.System...
except ParsingError as e: # ParsingErrors may happen when parsing "old" lines from # analyzing engines, which haven't yet noticed their new tasks log.debug("__parseLine: Ignored (%s) from analyze...
gamemodel.add_variation(gamemodel.boards[ply - 1], pv0, comment="Treatening", score=score_str0)
conditional_block
analyzegameDialog.py
from __future__ import absolute_import import time import threading from gi.repository import Gtk from . import gamewidget from pychess.Utils.const import HINT, SPY, BLACK, WHITE from pychess.System import conf, fident from pychess.System import uistuff from pychess.System.idle_add import idle_add from pychess.System...
def abort(): stop_event.set() widgets["analyze_game"].hide() def run_analyze(button, *args): gmwidg = gamewidget.cur_gmwidg() gamemodel = gmwidg.gamemodel old_check_value = conf.get("analyzer_check", True) conf.set("analyzer_check", True) if HINT not i...
widgets["analyze_game"].hide() return True
identifier_body
analyzegameDialog.py
from __future__ import absolute_import import time import threading from gi.repository import Gtk from . import gamewidget from pychess.Utils.const import HINT, SPY, BLACK, WHITE from pychess.System import conf, fident from pychess.System import uistuff from pychess.System.idle_add import idle_add from pychess.System...
(discoverer): data = [(item[0], item[1]) for item in newGameDialog.analyzerItems] uistuff.updateCombo(widgets["ana_combobox"], data) discoverer.connect_after("all_engines_discovered", update_analyzers_store) update_analyzers_store(discoverer) uistuff.keep(widgets["ana_combobox"], "ana_combo...
update_analyzers_store
identifier_name
urls.py
"""redblue_project URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') C...
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ url(r'^red/', include('apps.red_app.urls', namespace='red_namespace')), url(r'^blue/', include('apps.blue_app.urls', namespace='blue_namespace')), ...
Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Import the include() function: from django.conf.urls import url, include
random_line_split
task.py
import argparse import json import os import shutil from .model import train_and_evaluate if __name__ == "__main__":
default="junk" ) # Sequence shape hyperparameters parser.add_argument( "--seq_len", help="Number of timesteps to include in each example.", type=int, default=30 ) # Training parameters parser.add_argument( "--train_batch_size", help="Number of examples in training...
parser = argparse.ArgumentParser() # File arguments parser.add_argument( "--train_file_pattern", help="GCS location to read training data.", required=True ) parser.add_argument( "--eval_file_pattern", help="GCS location to read evaluation data.", required=True ) parser.ad...
conditional_block
task.py
import argparse import json import os import shutil from .model import train_and_evaluate if __name__ == "__main__": parser = argparse.ArgumentParser() # File arguments parser.add_argument( "--train_file_pattern", help="GCS location to read training data.", required=True ) parser.add_argu...
) ## LSTM hyperparameters parser.add_argument( "--lstm_hidden_units", help="Hidden layer sizes to use for LSTM.", type=str, default="64,32,16" ) # Parse all arguments args = parser.parse_args() arguments = args.__dict__ # Unused args provided by service arguments.pop("job_di...
default=120
random_line_split
scene.js
var fs = require("fs"); Scene = { name : "Moving in circles", plugins: [ require("../../plugins/simulation/plugin.js"), require("../../plugins/controls/plugin.js"), //require("../../plugins/log/plugin.js"),
require("../../plugins/history/plugin.js"), ], simulation: { step: 0.03, initialize: function(){ return {x:1,y:0,time:0,iteration:0}; }, iterate: function(prev, step){ //var orth = {x:-prev.y*prev.y*prev.y*prev.y*prev.y,y:prev.x*prev.x*prev.x}; var orth = {x:-prev.y,y:prev.x}; ...
require("../../plugins/chart/plugin.js"), require("../../plugins/processing/plugin.js"),
random_line_split
range.renderer.ts
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms 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, inc...
this.changeDetectorRef.markForCheck(); } } export const RangeControlRendererTester: RankedTester = rankWith( 4, isRangeControl );
{ this.min = this.scopedSchema.minimum; this.max = this.scopedSchema.maximum; this.multipleOf = this.scopedSchema.multipleOf || 1; }
conditional_block
range.renderer.ts
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms 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, inc...
getEventValue = (event: any) => Number(event.value); mapAdditionalProps() { if (this.scopedSchema) { this.min = this.scopedSchema.minimum; this.max = this.scopedSchema.maximum; this.multipleOf = this.scopedSchema.multipleOf || 1; } this.changeDetectorRef.markForCheck(); } } export c...
{ super(jsonformsService); }
identifier_body
range.renderer.ts
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms 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, inc...
(jsonformsService: JsonFormsAngularService, private changeDetectorRef: ChangeDetectorRef) { super(jsonformsService); } getEventValue = (event: any) => Number(event.value); mapAdditionalProps() { if (this.scopedSchema) { this.min = this.scopedSchema.minimum; this.max = this.scopedSchema.maximum...
constructor
identifier_name
range.renderer.ts
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms 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, inc...
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular'; import { isRangeControl, RankedTester, rankWith } from '@jsonforms/core'; @Component({ selector: 'RangeControlRenderer', template: ` <div fxFlex fxLayout="column" [fxHide]="hidden"> <label class="mat-caption" style="color:rgb...
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { ChangeDetectionStrategy, Component, ChangeDetectorRef } from '@angular/core';
random_line_split
control-flow.rs
// Copyright 2017 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 ...
<T>(mut amt: usize, mut t: T) -> T::Return where T: Generator<Yield = ()> { loop { match unsafe { t.resume() } { GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), GeneratorState::Complete(ret) => { assert_eq!(amt, 0); return ret ...
finish
identifier_name
control-flow.rs
// Copyright 2017 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 ...
}
yield; panic!() } yield });
random_line_split
control-flow.rs
// Copyright 2017 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 ...
yield }); }
{ yield; panic!() }
conditional_block
control-flow.rs
// Copyright 2017 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 ...
fn main() { finish(1, || yield); finish(8, || { for _ in 0..8 { yield; } }); finish(1, || { if true { yield; } else { } }); finish(1, || { if false { } else { yield; } }); finish(2, || {...
{ loop { match unsafe { t.resume() } { GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), GeneratorState::Complete(ret) => { assert_eq!(amt, 0); return ret } } } }
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/. */ //! Calculate [specified][specified] and [computed values][computed] from a //! tree of DOM nodes and a set of sty...
try!(list[0].to_css(dest)); for item in list.iter().skip(1) { try!(write!(dest, ", ")); try!(item.to_css(dest)); } Ok(()) }
{ return Ok(()); }
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/. */ //! Calculate [specified][specified] and [computed values][computed] from a //! tree of DOM nodes and a set of sty...
{ if list.is_empty() { return Ok(()); } try!(list[0].to_css(dest)); for item in list.iter().skip(1) { try!(write!(dest, ", ")); try!(item.to_css(dest)); } Ok(()) }
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/. */ //! Calculate [specified][specified] and [computed values][computed] from a //! tree of DOM nodes and a set of sty...
<W, T>(dest: &mut W, list: &[T]) -> fmt::Result where W: fmt::Write, T: ToCss, { if list.is_empty() { return Ok(()); } try!(list[0].to_css(dest)); for item in list.iter().skip(1) { try...
serialize_comma_separated_list
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/. */ //! Calculate [specified][specified] and [computed values][computed] from a //! tree of DOM nodes and a set of sty...
pub mod custom_properties; pub mod data; pub mod dom; pub mod element_state; #[cfg(feature = "servo")] mod encoding_support; pub mod error_reporting; pub mod font_face; pub mod font_metrics; #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko; #[cfg(feature = "gecko")] #[allow(unsafe_code)] pub mod gecko_bind...
pub mod context;
random_line_split
deque.rs
use giftr::refs::*; //use giftr::refs::functional::Ref as Ref; use giftr::refs::imperative::Ref as Ref; use std::iter::Iterator; use std::mem::swap; use list::List; #[derive(Clone, Debug)] pub struct Deque<T: Clone> { front : Ref<List<T>>, back : Ref<List<T>>, } impl <T: Clone> Deque<T> { pub fn new() ...
() { let mut d = Deque::new(); d.push_front(2); d.push_front(1); d.push_back(3); assert_eq!(Some(1), d.pop_front()); assert_eq!(Some(2), d.pop_front()); assert_eq!(Some(3), d.pop_front()); assert_eq!(None, d.pop_front()); } #[test] fn deque_pop_back() { let mut d = Deque::new(); ...
deque_pop_front
identifier_name
deque.rs
use giftr::refs::*; //use giftr::refs::functional::Ref as Ref; use giftr::refs::imperative::Ref as Ref; use std::iter::Iterator; use std::mem::swap; use list::List; #[derive(Clone, Debug)] pub struct Deque<T: Clone> { front : Ref<List<T>>, back : Ref<List<T>>, } impl <T: Clone> Deque<T> { pub fn new() -...
} pub fn rev_iter(&self) -> Iter<T> { let mut cln = self.clone(); cln.reverse(); cln.to_iter() } } pub struct Iter<T: Clone> { deque : Ref<Deque<T>>, } impl <T: Clone> Iterator for Iter<T> { type Item = T; fn next(&mut self) -> Option<T> { self.deque.pop_front(...
pub fn iter(&self) -> Iter<T> { self.clone().to_iter()
random_line_split
deque.rs
use giftr::refs::*; //use giftr::refs::functional::Ref as Ref; use giftr::refs::imperative::Ref as Ref; use std::iter::Iterator; use std::mem::swap; use list::List; #[derive(Clone, Debug)] pub struct Deque<T: Clone> { front : Ref<List<T>>, back : Ref<List<T>>, } impl <T: Clone> Deque<T> { pub fn new() ...
} pub fn pop_back(&mut self) -> Option<T> { let back = self.back.pop_front(); if back.is_some() { back } else { // FIXME we should reshuffle here, right? self.front.pop_back() } } pub fn reverse(&mut self) { swap(&mut self.fr...
{ // FIXME we should reshuffle here, right? self.back.pop_back() }
conditional_block
models.py
from django.db import models from stdimage import StdImageField from django.core.validators import RegexValidator import datetime YEAR_CHOICES = [] for r in range(1980, (datetime.datetime.now().year+1)):
S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4thYear','4thYear')] # Create your models here. class Hostel(models.Model): HostelName = models.CharField(max_length=100, primary_key=True) HostelType = models.CharField(max_length=10) HostelSeat = models.IntegerField() HostelIma...
YEAR_CHOICES.append((r,r))
conditional_block
models.py
from django.db import models from stdimage import StdImageField from django.core.validators import RegexValidator import datetime YEAR_CHOICES = [] for r in range(1980, (datetime.datetime.now().year+1)): YEAR_CHOICES.append((r,r)) S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4t...
def __str__(self): return self.HostelName class HostelEvents(models.Model): HostelName = models.ForeignKey(Hostel) HostelEventsName = models.CharField(max_length=100) HostelEventDescription = models.TextField() def __str__(self): return self.HostelEventsName class HostelPictureGalary(models.Model): Ho...
HostelEmail = models.EmailField() phone_regex = RegexValidator(regex=r'^\+?1?\d{10,13}$', message="Phone number must be entered in the format: '+999999999'. Up to 13 digits allowed.") HostelPhoneNo = models.CharField(max_length=13,validators=[phone_regex], blank=True)
random_line_split
models.py
from django.db import models from stdimage import StdImageField from django.core.validators import RegexValidator import datetime YEAR_CHOICES = [] for r in range(1980, (datetime.datetime.now().year+1)): YEAR_CHOICES.append((r,r)) S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4t...
(models.Model): HostelName = models.ForeignKey(Hostel) HostelbodyRole = models.CharField(max_length=100) HostelbodyRoleYear = models.IntegerField(choices=YEAR_CHOICES, default=datetime.datetime.now().year) PersonName = models.CharField (max_length=10) PersonYear = models.CharField (max_length=7, choices=S_CHOICE,d...
HostelBody
identifier_name
models.py
from django.db import models from stdimage import StdImageField from django.core.validators import RegexValidator import datetime YEAR_CHOICES = [] for r in range(1980, (datetime.datetime.now().year+1)): YEAR_CHOICES.append((r,r)) S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4t...
HostelName = models.ForeignKey(Hostel) HostelbodyRole = models.CharField(max_length=100) HostelbodyRoleYear = models.IntegerField(choices=YEAR_CHOICES, default=datetime.datetime.now().year) PersonName = models.CharField (max_length=10) PersonYear = models.CharField (max_length=7, choices=S_CHOICE,default='NA') Per...
identifier_body
2111005.js
/*@author Jvlaple *Crystal of Roots */
var PQItems = Array(4001087, 4001088, 4001089, 4001090, 4001091, 4001092, 4001093); importPackage(net.sf.odinms.client); function start() { status = -1; action(1, 0, 0); } function action(mode, type, selection) { if (mode == -1) { cm.dispose(); } else { if (status >= 0 &&...
var status = 0;
random_line_split
2111005.js
/*@author Jvlaple *Crystal of Roots */ var status = 0; var PQItems = Array(4001087, 4001088, 4001089, 4001090, 4001091, 4001092, 4001093); importPackage(net.sf.odinms.client); function start() { status = -1; action(1, 0, 0); } function action(mode, type, selection)
}cm.dispose(); } } }
{ if (mode == -1) { cm.dispose(); } else { if (status >= 0 && mode == 0) { cm.sendOk("Ok, keep preservering!"); cm.dispose(); return; } if (mode == 1) status++; else status--; if (status ...
identifier_body
2111005.js
/*@author Jvlaple *Crystal of Roots */ var status = 0; var PQItems = Array(4001087, 4001088, 4001089, 4001090, 4001091, 4001092, 4001093); importPackage(net.sf.odinms.client); function start() { status = -1; action(1, 0, 0); } function action(mode, type, selection) { if (mode == -1) {...
cm.dispose(); } } }
{ eim.unregisterPlayer(cm.getPlayer()); }
conditional_block
2111005.js
/*@author Jvlaple *Crystal of Roots */ var status = 0; var PQItems = Array(4001087, 4001088, 4001089, 4001090, 4001091, 4001092, 4001093); importPackage(net.sf.odinms.client); function start() { status = -1; action(1, 0, 0); } function
(mode, type, selection) { if (mode == -1) { cm.dispose(); } else { if (status >= 0 && mode == 0) { cm.sendOk("Ok, keep preservering!"); cm.dispose(); return; } if (mode == 1) status++; else status--; ...
action
identifier_name
CallbackManager.js
/* * 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 ...
} add (callback) { this.lastCallbackId++ this.callbacks[this.lastCallbackId] = callback return this.lastCallbackId } remove (callbackId) { const callback = this.callbacks[callbackId] delete this.callbacks[callbackId] return callback } registerHook (componentId, type, hookName, hookFu...
this.callbacks = {} this.hooks = {}
random_line_split
CallbackManager.js
/* * 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 ...
return new Error(`invalid callback id "${callbackId}"`) } close () { this.callbacks = {} this.hooks = {} } }
{ try { return callback.call(null, data) } catch (error) { console.error(`[JS Framework] Failed to execute the callback function:\n ${error.toString()}`) } }
conditional_block
CallbackManager.js
/* * 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 ...
(componentId, type, hookName) { return `${type}@${hookName}#${componentId}` } /** * For general callback management of a certain Weex instance. * Because function can not passed into native, so we create callback * callback id for each function and pass the callback id into native * in fact. And when a callback...
getHookKey
identifier_name
CallbackManager.js
/* * 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 ...
}
{ this.callbacks = {} this.hooks = {} }
identifier_body
helpers.js
// Web Worker Pool // size is the max number of arguments function WorkerPool(size) { var workers = 0, jobs = []; // url: the url of the worker's js // msg: the initial message to pass to the worker // cb : the callback to recieve messages from postMessage. // return true from cb to...
(cfg) { var position = cfg.start; function nextchunk() { if (position < cfg.end) { for (var iterator = position; iterator < position+(cfg.chunk_size*cfg.step) && iterator < cfg.end; iterator += cfg.step) { cfg.inner.call(cfg.ctx, iterator)...
chunkfor
identifier_name
helpers.js
// Web Worker Pool // size is the max number of arguments function WorkerPool(size) { var workers = 0, jobs = []; // url: the url of the worker's js // msg: the initial message to pass to the worker // cb : the callback to recieve messages from postMessage. // return true from cb to...
} nextchunk(); }
{ cfg.callback.call(cfg.ctx); }
conditional_block
helpers.js
// Web Worker Pool // size is the max number of arguments function WorkerPool(size) { var workers = 0, jobs = []; // url: the url of the worker's js // msg: the initial message to pass to the worker // cb : the callback to recieve messages from postMessage. // return true from cb to...
self.get(key, cb, ctx); }); } }; // sets value for key in cache this.set = function(key, val) { cache[hash(key)] = val; }; } function hashObj(o) { var hash = []; for (var i in o) { if (o.hasOwnProperty(i)) { hash.push(o[i].toStri...
{ var cache = {}, self = this; hash = hash || function(key) { return key.toString(); }; // key: the key to lookup in the cache // cb : the method to call with the value // Takes one parameter: // val: the value in the cache for key // ctx: context for cb.call...
identifier_body
helpers.js
// Web Worker Pool // size is the max number of arguments function WorkerPool(size) { var workers = 0, jobs = []; // url: the url of the worker's js // msg: the initial message to pass to the worker // cb : the callback to recieve messages from postMessage. // return true from cb to...
hash.push(o[i].toString()); } } return hash.join('_'); } /* cfg takes: * start: the initial value * end: the (non-inclusive) max value * step: value to iterate by * chunk-size: how many iterations before setTimeout * inner: function to perform each iteration * callback: function to pe...
function hashObj(o) { var hash = []; for (var i in o) { if (o.hasOwnProperty(i)) {
random_line_split
mod.rs
/* Copyright (c) 2016 Saurav Sachidanand 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, modify, merge, publish, distribu...
AUTHORS OR COPYRIGHT 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 OTHER DEALINGS IN THE SOFTWARE. */ //! Some useful constants pub mod vmcs; pub mod vmx_cap; pub mod vmx_exit; pub...
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
random_line_split
post_example_novel.py
import argparse from nltk.corpus import brown import requests import arrow import json parser = argparse.ArgumentParser() parser.add_argument('host') args = parser.parse_args() def create_new_novel(): url = 'http://{host}/api/novel'.format(host=args.host) response = requests.post(url, json={'title': 'Test No...
if __name__ == '__main__': novel_id = create_new_novel() chapter_id = create_new_chapter(novel_id) post_example_text_to_chapter(chapter_id, args.host)
url = 'http://{host}/api/novel_token'.format(host=host) words = brown.words(categories=['news']) for ordinal, word in enumerate(words): if ordinal > 1000: break requests.post(url, json={'token': word.lower(), 'ordinal': ordinal, 'chapter_id': chapter_id})
identifier_body
post_example_novel.py
import argparse from nltk.corpus import brown import requests import arrow import json parser = argparse.ArgumentParser() parser.add_argument('host') args = parser.parse_args() def create_new_novel(): url = 'http://{host}/api/novel'.format(host=args.host) response = requests.post(url, json={'title': 'Test No...
if __name__ == '__main__': novel_id = create_new_novel() chapter_id = create_new_chapter(novel_id) post_example_text_to_chapter(chapter_id, args.host)
if ordinal > 1000: break requests.post(url, json={'token': word.lower(), 'ordinal': ordinal, 'chapter_id': chapter_id})
conditional_block
post_example_novel.py
import argparse from nltk.corpus import brown import requests import arrow import json parser = argparse.ArgumentParser() parser.add_argument('host') args = parser.parse_args() def create_new_novel(): url = 'http://{host}/api/novel'.format(host=args.host) response = requests.post(url, json={'title': 'Test No...
(novel_id): url = 'http://{host}/api/chapter'.format(host=args.host) chapter_title = 'Chapter {}'.format(arrow.utcnow()) response = requests.post(url, json={'title': chapter_title, 'novel_id': novel_id}) return json.loads(response.text)['id'] def post_example_text_to_chapter(chapter_id, host): url...
create_new_chapter
identifier_name
post_example_novel.py
import argparse from nltk.corpus import brown import requests import arrow import json parser = argparse.ArgumentParser() parser.add_argument('host') args = parser.parse_args() def create_new_novel(): url = 'http://{host}/api/novel'.format(host=args.host) response = requests.post(url, json={'title': 'Test No...
break requests.post(url, json={'token': word.lower(), 'ordinal': ordinal, 'chapter_id': chapter_id}) if __name__ == '__main__': novel_id = create_new_novel() chapter_id = create_new_chapter(novel_id) post_example_text_to_chapter(chapter_id, args.host)
random_line_split
test_least_squares_loss.py
import tensorflow as tf import hyperchamber as hc import hypergan as hg import numpy as np from hypergan.losses.least_squares_loss import LeastSquaresLoss from hypergan.ops import TensorflowOps from unittest.mock import MagicMock from tests.mocks import mock_gan loss_config = {'test': True, 'reduce':'reduce_mean', 'l...
(tf.test.TestCase): def test_config(self): with self.test_session(): loss = LeastSquaresLoss(mock_gan(), loss_config) self.assertTrue(loss.config.test) def test_create(self): with self.test_session(): gan = mock_gan() loss = LeastSquaresLoss(gan, ...
LeastSquaresLossTest
identifier_name
test_least_squares_loss.py
import tensorflow as tf import hyperchamber as hc import hypergan as hg import numpy as np from hypergan.losses.least_squares_loss import LeastSquaresLoss from hypergan.ops import TensorflowOps from unittest.mock import MagicMock from tests.mocks import mock_gan loss_config = {'test': True, 'reduce':'reduce_mean', 'l...
def test_create(self): with self.test_session(): gan = mock_gan() loss = LeastSquaresLoss(gan, loss_config) d_loss, g_loss = loss.create() d_shape = gan.ops.shape(d_loss) g_shape = gan.ops.shape(g_loss) self.assertEqual(sum(d_shape), ...
with self.test_session(): loss = LeastSquaresLoss(mock_gan(), loss_config) self.assertTrue(loss.config.test)
identifier_body
test_least_squares_loss.py
import tensorflow as tf import hyperchamber as hc import hypergan as hg import numpy as np from hypergan.losses.least_squares_loss import LeastSquaresLoss from hypergan.ops import TensorflowOps from unittest.mock import MagicMock from tests.mocks import mock_gan loss_config = {'test': True, 'reduce':'reduce_mean', 'l...
tf.test.main()
conditional_block
test_least_squares_loss.py
import tensorflow as tf import hyperchamber as hc import hypergan as hg import numpy as np from hypergan.losses.least_squares_loss import LeastSquaresLoss
from unittest.mock import MagicMock from tests.mocks import mock_gan loss_config = {'test': True, 'reduce':'reduce_mean', 'labels': [0,1,0]} class LeastSquaresLossTest(tf.test.TestCase): def test_config(self): with self.test_session(): loss = LeastSquaresLoss(mock_gan(), loss_config) ...
from hypergan.ops import TensorflowOps
random_line_split
issue-39559.rs
// Copyright 2017 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 ...
fn main() {}
//~^ ERROR no function or associated item named `dim` found for type `D` in the current scope _dummy: D, }
random_line_split
issue-39559.rs
// Copyright 2017 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 ...
<T, D: Dim> { entries: [T; D::dim()], //~^ ERROR no function or associated item named `dim` found for type `D` in the current scope _dummy: D, } fn main() {}
Vector
identifier_name
history.ts
import { IEnvironment, TypeCell, TypeHistory } from '../Types'; import { createEnvironment } from './environment'; export const manipulateHistory = (history: TypeHistory, n: number, predicate: (block: IEnvironment) => null | IEnvironment): TypeHistory => { const entry = predicate(history[n]); return entry ? ...
path.length === 0 ? null : ({ path: path.slice(1), point: point, snake: [...snake.slice(1), path[0]], }));
random_line_split
TextDocument.ts
| null = null) { if (lines instanceof TextDocument) { this.lines = lines.lines; this.byId = lines.byId; this._ranges = lines._ranges; this.length = lines.length; } else { this.byId = new Map(); if (Array.isArray(lines)) { this.lines = lines; } else if (lines) {...
return Array.from(this._ranges.values()); } else { return this.getLinesAt(at).map(line => this.getLineRange(line)); } } getLineFormat(at: number | EditorRange = this.selection as EditorRange, options?: FormattingOptions) { let to = at as number; if (Array.isArray(at)) [ at, to ] = norma...
} getLineRanges(at?: number | EditorRange) { if (at == null) {
random_line_split
TextDocument.ts
| null = null) { if (lines instanceof TextDocument) { this.lines = lines.lines; this.byId = lines.byId; this._ranges = lines._ranges; this.length = lines.length; } else { this.byId = new Map(); if (Array.isArray(lines)) { this.lines = lines; } else if (lines) {...
(at: number | EditorRange = this.selection as EditorRange, options?: FormattingOptions): AttributeMap { return { ...this.getTextFormat(at, options), ...this.getLineFormat(at, options) }; } slice(start: number = 0, end: number = Infinity): Delta { const ops: Op[] = []; const iter = LineOp.iterator(this....
getFormats
identifier_name
TextDocument.ts
null = null) { if (lines instanceof TextDocument) { this.lines = lines.lines; this.byId = lines.byId; this._ranges = lines._ranges; this.length = lines.length; } else { this.byId = new Map(); if (Array.isArray(lines)) { this.lines = lines; } else if (lines) { ...
apply(change: Delta | TextChange, selection?: EditorRange | null, throwOnError?: boolean): TextDocument { let delta: Delta; if (change instanceof TextChange) { delta = change.delta; selection = change.selection; } else { delta = change; } // If no change, do nothing if (!d...
{ const ops: Op[] = []; const iter = LineOp.iterator(this.lines); let index = 0; while (index < end && iter.hasNext()) { let nextOp: Op; if (index < start) { nextOp = iter.next(start - index); } else { nextOp = iter.next(end - index); ops.push(nextOp); } ...
identifier_body
apps-list.ts
import * as clc from "cli-color"; import * as ora from "ora"; import Table = require("cli-table"); import { Command } from "../command"; import { needProjectId } from "../projectUtils"; import { AppMetadata, AppPlatform, getAppPlatform, listFirebaseApps } from "../management/apps"; import { requireAuth } from "../requ...
(count: number = 0): void { if (count === 0) { return; } logger.info(""); logger.info(`${count} app(s) total.`); } module.exports = new Command("apps:list [platform]") .description( "list the registered apps of a Firebase project. " + "Optionally filter apps by [platform]: IOS, ANDROID or WEB (...
logAppCount
identifier_name
apps-list.ts
import * as clc from "cli-color"; import * as ora from "ora"; import Table = require("cli-table"); import { Command } from "../command"; import { needProjectId } from "../projectUtils"; import { AppMetadata, AppPlatform, getAppPlatform, listFirebaseApps } from "../management/apps"; import { requireAuth } from "../requ...
module.exports = new Command("apps:list [platform]") .description( "list the registered apps of a Firebase project. " + "Optionally filter apps by [platform]: IOS, ANDROID or WEB (case insensitive)" ) .before(requireAuth) .action(async (platform: string | undefined, options: any): Promise<AppMetadat...
{ if (count === 0) { return; } logger.info(""); logger.info(`${count} app(s) total.`); }
identifier_body
apps-list.ts
import * as clc from "cli-color"; import * as ora from "ora"; import Table = require("cli-table"); import { Command } from "../command"; import { needProjectId } from "../projectUtils"; import { AppMetadata, AppPlatform, getAppPlatform, listFirebaseApps } from "../management/apps"; import { requireAuth } from "../requ...
const tableHead = ["App Display Name", "App ID", "Platform"]; const table = new Table({ head: tableHead, style: { head: ["green"] } }); apps.forEach(({ appId, displayName, platform }) => { table.push([displayName || NOT_SPECIFIED, appId, platform]); }); logger.info(table.toString()); } function logAppC...
{ logger.info(clc.bold("No apps found.")); return; }
conditional_block
apps-list.ts
import * as clc from "cli-color"; import * as ora from "ora"; import Table = require("cli-table"); import { Command } from "../command"; import { needProjectId } from "../projectUtils"; import { AppMetadata, AppPlatform, getAppPlatform, listFirebaseApps } from "../management/apps"; import { requireAuth } from "../requ...
spinner.succeed(); logAppsList(apps); logAppCount(apps.length); return apps; });
random_line_split
wheel.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import Command from pip.index import PackageFinder from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import InstallRequirement, RequirementSet, parse_requirements from...
(self, options, args): # confirm requirements try: import wheel.bdist_wheel # Hack to make flake8 not complain about an unused import wheel.bdist_wheel except ImportError: raise CommandError( "'pip wheel' requires the 'wheel' packa...
run
identifier_name
wheel.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import Command from pip.index import PackageFinder from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import InstallRequirement, RequirementSet, parse_requirements from...
for name in options.editables: requirement_set.add_requirement( InstallRequirement.from_editable( name, default_vcs=options.default_vcs, isolated=options.isolated_mode, ...
requirement_set.add_requirement( InstallRequirement.from_line( name, None, isolated=options.isolated_mode, ) )
conditional_block
wheel.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import Command from pip.index import PackageFinder from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import InstallRequirement, RequirementSet, parse_requirements from...
try: import pkg_resources except ImportError: raise CommandError( "'pip wheel' requires setuptools >= 0.8 for dist-info support." " To fix this, run: pip install --upgrade setuptools" ) else: if not hasattr(pkg_resou...
raise CommandError( "'pip wheel' requires the 'wheel' package. To fix this, run: " "pip install wheel" )
random_line_split
wheel.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import os import warnings from pip.basecommand import Command from pip.index import PackageFinder from pip.exceptions import CommandError, PreviousBuildDirError from pip.req import InstallRequirement, RequirementSet, parse_requirements from...
%prog [options] <archive url/path> ...""" summary = 'Build wheels from your requirements.' def __init__(self, *args, **kw): super(WheelCommand, self).__init__(*args, **kw) cmd_opts = self.cmd_opts cmd_opts.add_option( '-w', '--wheel-dir', dest='wheel_dir...
""" Build Wheel archives for your requirements and dependencies. Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. For more details, see the wheel docs: http://wheel.readthedocs.org/en/latest. Requirements: setuptools>=0.8, and wheel. ...
identifier_body
advancedSearchTest.js
"use strict"; describe("Advanced Search", function () { var win, zp; before(function* () {
zp = win.ZoteroPane; }); after(function () { win.close(); }); it("should perform a search", function* () { var item = yield createDataObject('item', { setTitle: true }); var promise = waitForWindow('chrome://zotero/content/advancedSearch.xul'); zp.openAdvancedSearchWindow(); var searchWin = yield...
win = yield loadZoteroPane();
random_line_split
ifd.rs
//! Function for reading TIFF tags use std::io::{self, Read, Seek}; use std::collections::{HashMap}; use super::stream::{ByteOrder, SmartReader, EndianReader}; use self::Value::{Unsigned, List}; macro_rules! tags { {$( $tag:ident $val:expr; )*} => { /// TIFF tag #[derive(Clo...
<R: Read + Seek>(&self, decoder: &mut super::TIFFDecoder<R>) -> ::image::ImageResult<Value> { let bo = decoder.byte_order(); match (self.type_, self.count) { // TODO check if this could give wrong results // at a different endianess of file/computer. (Type::BYTE, ...
val
identifier_name
ifd.rs
//! Function for reading TIFF tags use std::io::{self, Read, Seek}; use std::collections::{HashMap}; use super::stream::{ByteOrder, SmartReader, EndianReader}; use self::Value::{Unsigned, List}; macro_rules! tags { {$( $tag:ident $val:expr; )*} => { /// TIFF tag #[derive(Clo...
pub fn val<R: Read + Seek>(&self, decoder: &mut super::TIFFDecoder<R>) -> ::image::ImageResult<Value> { let bo = decoder.byte_order(); match (self.type_, self.count) { // TODO check if this could give wrong results // at a different endianess of file/computer. ...
{ SmartReader::wrap( io::Cursor::new(self.offset.to_vec()), byte_order ) }
identifier_body
ifd.rs
//! Function for reading TIFF tags use std::io::{self, Read, Seek}; use std::collections::{HashMap}; use super::stream::{ByteOrder, SmartReader, EndianReader}; use self::Value::{Unsigned, List}; macro_rules! tags { {$( $tag:ident $val:expr; )*} => { /// TIFF tag #[derive(Clo...
} impl Tag { pub fn from_u16(n: u16) -> Tag { $(if n == $val { Tag::$tag } else)* { Tag::Unknown(n) } } } } } // Note: These tags appear in the order they are mentioned in the TIFF reference tags!{ // Baseline t...
pub enum Tag { $($tag,)* Unknown(u16)
random_line_split
dynamic-ng-bootstrap-switch.component.ts
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from "@angular/core"; import { FormGroup } from "@angular/forms"; import { DynamicFormControlComponent, DynamicFormControlLayout, DynamicFormLayout, DynamicFormLayoutService, DynamicFormValidationService, DynamicSwitchMod...
(protected layoutService: DynamicFormLayoutService, protected validationService: DynamicFormValidationService) { super(layoutService, validationService); } }
constructor
identifier_name
dynamic-ng-bootstrap-switch.component.ts
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from "@angular/core";
DynamicFormControlComponent, DynamicFormControlLayout, DynamicFormLayout, DynamicFormLayoutService, DynamicFormValidationService, DynamicSwitchModel } from "@ng-dynamic-forms/core"; @Component({ selector: "dynamic-ng-bootstrap-switch", templateUrl: "./dynamic-ng-bootstrap-switch.compone...
import { FormGroup } from "@angular/forms"; import {
random_line_split
test_period_asfreq.py
import pytest from pandas._libs.tslibs.frequencies import get_freq from pandas._libs.tslibs.period import period_asfreq, period_ordinal @pytest.mark.parametrize( "freq1,freq2,expected", [ ("D", "H", 24), ("D", "T", 1440), ("D", "S", 86400), ("D", "L", 86400000), ("D", ...
(freq, expected): # information for Jan. 1, 1970. assert period_ordinal(1970, 1, 1, 0, 0, 0, 0, 0, get_freq(freq)) == expected @pytest.mark.parametrize( "dt,expected", [ ((1970, 1, 4, 0, 0, 0, 0, 0), 1), ((1970, 1, 5, 0, 0, 0, 0, 0), 2), ((2013, 10, 6, 0, 0, 0, 0, 0), 2284), ...
test_period_ordinal_start_values
identifier_name
test_period_asfreq.py
import pytest from pandas._libs.tslibs.frequencies import get_freq from pandas._libs.tslibs.period import period_asfreq, period_ordinal @pytest.mark.parametrize( "freq1,freq2,expected", [ ("D", "H", 24), ("D", "T", 1440), ("D", "S", 86400), ("D", "L", 86400000), ("D", ...
@pytest.mark.parametrize( "freq,expected", [("A", 0), ("M", 0), ("W", 1), ("D", 0), ("B", 0)] ) def test_period_ordinal_start_values(freq, expected): # information for Jan. 1, 1970. assert period_ordinal(1970, 1, 1, 0, 0, 0, 0, 0, get_freq(freq)) == expected @pytest.mark.parametrize( "dt,expected",...
assert period_asfreq(1, get_freq(freq1), get_freq(freq2), False) == expected
identifier_body
test_period_asfreq.py
import pytest from pandas._libs.tslibs.frequencies import get_freq from pandas._libs.tslibs.period import period_asfreq, period_ordinal @pytest.mark.parametrize( "freq1,freq2,expected", [ ("D", "H", 24), ("D", "T", 1440), ("D", "S", 86400), ("D", "L", 86400000), ("D", ...
args = (2013, 10, day, 0, 0, 0, 0, 0, get_freq("B")) assert period_ordinal(*args) == expected
(8, 11418), ], ) def test_period_ordinal_business_day(day, expected):
random_line_split
blake2s.rs
2, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 ], [ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 ], [ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 ], [ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 ], [ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, ...
; } fn compress(&mut self) { let mut m = [0u32; 16]; let mut v = [0u32; 16]; let block = self.buf.as_ref(); assert!(block.len() >= BLOCK_BYTES); for i in 0..m.len() { m[i] = load32(&block[i*4..]); } for i in 0..8 { v[i] = self.h...
{0}
conditional_block
blake2s.rs
= key[i]; } b.update(block.as_ref()); b } pub fn update(&mut self, m: &[u8]) { let mut m = m; while m.len() > 0 { let left = self.buf_len; let fill = 2 * BLOCK_BYTES - left; if m.len() > fill { for i in 0..fill { ...
{ bench_chunk_size(b, 1 << 10); }
identifier_body
blake2s.rs
2, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 ], [ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 ], [ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 ], [ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 ], [ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, ...
(&mut self, inc: u32) { self.t[0] += inc; self.t[1] += if self.t[0] < inc {1} else {0}; } fn compress(&mut self) { let mut m = [0u32; 16]; let mut v = [0u32; 16]; let block = self.buf.as_ref(); assert!(block.len() >= BLOCK_BYTES); for i in 0..m.len() { ...
increment_counter
identifier_name
blake2s.rs
2, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 ], [ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 ], [ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 ], [ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 ], [ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, ...
$a = $a.wrapping_add($b).wrapping_add(m[SIGMA[$r][2*$i+0] as usize]); $d = ($d ^ $a).rotate_right(16); $c = $c.wrapping_add($d); $b = ($b ^ $c).rotate_right(12); $a = $a.wrapping_add($b).wrapping_add(m[SIGMA[$r][2*$i+1] as usize]); ...
v[14] = self.f[0] ^ IV[6]; v[15] = self.f[1] ^ IV[7]; macro_rules! g( ($r: expr, $i: expr, $a: expr, $b: expr, $c: expr, $d: expr) => ({
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/. #![crate_name = "lrs_hashmap"] #![crate_type = "lib"] #![feature(custom_derive)] #![no_std] extern crate lrs_base as...
pub use table::{Entry, VacantEntry, OccupiedEntry}; mod std { pub use fmt::std::*; } mod bucket; mod table; pub type CompactMap<Key, Value, Hasher = XxHash32, Seed = (), Allocator = Heap> where Allocator: alloc::MemPool, Hasher: hash::Hasher, Seed: Into<Hasher::Seed>+To, Key: Eq + ...
use bucket::loose::{LooseBucket}; use table::{GenericMap};
random_line_split
wsgi.py
""" WSGI config for example_project project.
Usually you will have the standard Django WSGI application here, but it also might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI middleware here, or combine a Django application with an application of another fram...
This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting.
random_line_split
performanceentry.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 dom::bindings::codegen::Bindings::PerformanceEntryBinding; use dom::bindings::codegen::Bindings::PerformanceEn...
&self.name } pub fn start_time(&self) -> f64 { self.start_time } } impl PerformanceEntryMethods for PerformanceEntry { // https://w3c.github.io/performance-timeline/#dom-performanceentry-name fn Name(&self) -> DOMString { DOMString::from(self.name.clone()) } // htt...
pub fn name(&self) -> &DOMString {
random_line_split
performanceentry.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 dom::bindings::codegen::Bindings::PerformanceEntryBinding; use dom::bindings::codegen::Bindings::PerformanceEn...
(&self) -> &DOMString { &self.name } pub fn start_time(&self) -> f64 { self.start_time } } impl PerformanceEntryMethods for PerformanceEntry { // https://w3c.github.io/performance-timeline/#dom-performanceentry-name fn Name(&self) -> DOMString { DOMString::from(self.name.cl...
name
identifier_name
tinymce16.inc.js
function tinySetup16(config) { if(!config) config = {}; var editor_selector = 'rtepro'; //if (typeof config['editor_selector'] !== 'undefined') //var editor_selector = config['editor_selector']; if (typeof config['editor_selector'] != 'undefined') config['selector'] = '.'+config['editor_selector']; // sa...
}); tinyMCE.init(config); } $().ready(function() { tinySetup16(); });
config[index] = el;
random_line_split
tinymce16.inc.js
function tinySetup16(config)
filemanager_title: "File manager" , external_plugins: { "filemanager" : ad+"/filemanager/plugin.min.js"}, extended_valid_elements: 'pre[*],script[*],style[*],section[*],iframe[*]', valid_children: "+body[meta|style|script|section|iframe],pre[section|iframe|script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*...
{ if(!config) config = {}; var editor_selector = 'rtepro'; //if (typeof config['editor_selector'] !== 'undefined') //var editor_selector = config['editor_selector']; if (typeof config['editor_selector'] != 'undefined') config['selector'] = '.'+config['editor_selector']; // safari,pagebreak,style,table,ad...
identifier_body
tinymce16.inc.js
function
(config) { if(!config) config = {}; var editor_selector = 'rtepro'; //if (typeof config['editor_selector'] !== 'undefined') //var editor_selector = config['editor_selector']; if (typeof config['editor_selector'] != 'undefined') config['selector'] = '.'+config['editor_selector']; // safari,pagebreak,style...
tinySetup16
identifier_name
start-local.task.js
import fs from 'fs'; import url from 'url'; import path from 'path'; import mime from 'mime-types'; import gulp from 'gulp'; import createServerTask from './tasks/server'; import consoleArguments from './console-arguments'; import { adminBundle } from './admin-bundle.tasks'; import { dashboardBundle } from './dashboard...
if (bundle.tasks.stylelint) { const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}scssnext/**/*.scss`, bundle.tasks.stylelint); } } done(); } export default startLocalTask;
{ const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}jsnext/**/*.js`, bundle.tasks.eslint); }
conditional_block
start-local.task.js
import fs from 'fs'; import url from 'url'; import path from 'path'; import mime from 'mime-types'; import gulp from 'gulp'; import createServerTask from './tasks/server'; import consoleArguments from './console-arguments'; import { adminBundle } from './admin-bundle.tasks'; import { dashboardBundle } from './dashboard...
const contentType = mime.lookup(extension); res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': stat.size }); rstream.pipe(res); return; } } catch (e) { ...
const rstream = fs.createReadStream(filePath); const extension = path.extname(filePath);
random_line_split
start-local.task.js
import fs from 'fs'; import url from 'url'; import path from 'path'; import mime from 'mime-types'; import gulp from 'gulp'; import createServerTask from './tasks/server'; import consoleArguments from './console-arguments'; import { adminBundle } from './admin-bundle.tasks'; import { dashboardBundle } from './dashboard...
export default startLocalTask;
{ for (const bundle of BUNDLES) { if (bundle.tasks.eslint) { const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}jsnext/**/*.js`, bundle.tasks.eslint); } if (bundle.tasks.stylelint) { const srcPath = bundle.config.srcPath; gulp.watch(`...
identifier_body
start-local.task.js
import fs from 'fs'; import url from 'url'; import path from 'path'; import mime from 'mime-types'; import gulp from 'gulp'; import createServerTask from './tasks/server'; import consoleArguments from './console-arguments'; import { adminBundle } from './admin-bundle.tasks'; import { dashboardBundle } from './dashboard...
(done) { for (const bundle of BUNDLES) { if (bundle.tasks.eslint) { const srcPath = bundle.config.srcPath; gulp.watch(`${srcPath}jsnext/**/*.js`, bundle.tasks.eslint); } if (bundle.tasks.stylelint) { const srcPath = bundle.config.srcPath; gulp....
testOnChange
identifier_name
mount.ts
/** @module ember */ import { Opaque, Option } from '@glimmer/interfaces'; import { OpcodeBuilder } from '@glimmer/opcode-compiler'; import { Tag, VersionedPathReference } from '@glimmer/reference'; import { Arguments, CurriedComponentDefinition, curry, UNDEFINED_REFERENCE, VM, } from '@glimmer/runtime'; impo...
/** The `{{mount}}` helper lets you embed a routeless engine in a template. Mounting an engine will cause an instance to be booted and its `application` template to be rendered. For example, the following template mounts the `ember-chat` engine: ```handlebars {{! application.hbs }} {{mount "ember-chat...
{ let env = vm.env as Environment; let nameRef = args.positional.at(0); let modelRef = args.named.has('model') ? args.named.get('model') : undefined; return new DynamicEngineReference(nameRef, env, modelRef); }
identifier_body