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
animation_builder.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate...
export let AnimationBuilder = class AnimationBuilder { /** * Used for DI * @param browserDetails */ constructor(browserDetails) { this.browserDetails = browserDetails; } /** * Creates a new CSS Animation * @returns {CssAnimationBuilder} */ css() { re...
}; import { Injectable } from 'angular2/src/core/di'; import { CssAnimationBuilder } from './css_animation_builder'; import { BrowserDetails } from './browser_details';
random_line_split
main.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Instantiate a BlobReader for a given Blobstore blob_key, setting the # buffer size to 1 MB. blob_reader = blobstore.BlobReader(blob_key, buffer_size=1048576) # Instantiate a BlobReader for a given Blobstore blob_key, setting the # initial read position. blob_reader = b...
bucket = app_identity.get_default_gcs_bucket_name() # Cloud Storage file names are in the format /bucket/object. filename = '/{}/blobreader_demo'.format(bucket) # Create a file in Google Cloud Storage and write something to it. with cloudstorage.open(filename, 'w') as filehandle: ...
identifier_body
main.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
(self): # Get the default Cloud Storage Bucket name and create a file name for # the object in Cloud Storage. bucket = app_identity.get_default_gcs_bucket_name() # Cloud Storage file names are in the format /bucket/object. filename = '/{}/blobreader_demo'.format(bucket) ...
get
identifier_name
main.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# [END gae_blobstore_reader] # Delete the file from Google Cloud Storage using the blob_key. blobstore.delete(blob_key) app = webapp2.WSGIApplication([ ('/', BlobreaderHandler), ('/blobreader', BlobreaderHandler)], debug=True)
self.response.write(line)
conditional_block
main.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """A sample app that operates on GCS files with blobstore API's BlobReader.""" import cloudstorage from google.appengine.api import app_iden...
# distributed under the License is distributed on an "AS IS" BASIS,
random_line_split
xml.py
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato @ redhat.com> # License: MIT # # Some XML modules may be missing and Base.{load,dumps}_impl are not overriden: # pylint: disable=import-error """XML files parser backend, should be available always. .. versionchanged:: 0.1.0 Added XML dump support. - Format to supp...
""" :param cnf: Configuration data to dump :: self.container :param kwargs: optional keyword parameters :return: string represents the configuration """ tree = container_to_etree(cnf, self.container) buf = BytesIO() etree_write(tree, buf) return b...
random_line_split
xml.py
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato @ redhat.com> # License: MIT # # Some XML modules may be missing and Base.{load,dumps}_impl are not overriden: # pylint: disable=import-error """XML files parser backend, should be available always. .. versionchanged:: 0.1.0 Added XML dump support. - Format to supp...
(anyconfig.backend.base.D2Parser): """ Parser for XML files. """ _type = "xml" _extensions = ["xml"] _open_flags = ('rb', 'wb') def load_from_string(self, content, **kwargs): """ Load config from XML snippet (a string `content`). :param content: XML snippet (a strin...
Parser
identifier_name
xml.py
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato @ redhat.com> # License: MIT # # Some XML modules may be missing and Base.{load,dumps}_impl are not overriden: # pylint: disable=import-error """XML files parser backend, should be available always. .. versionchanged:: 0.1.0 Added XML dump support. - Format to supp...
def etree_write(tree, stream): """ Write XML ElementTree `root` content into `stream`. :param tree: XML ElementTree object :param stream: File or file-like object can write to """ if _IS_OLDER_PYTHON: tree.write(stream, encoding='UTF-8') else: tree.write(stream, encoding=...
elem = ET.Element(key) container_to_etree(val, cls, elem, pprefix) return ET.ElementTree(elem)
conditional_block
xml.py
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato @ redhat.com> # License: MIT # # Some XML modules may be missing and Base.{load,dumps}_impl are not overriden: # pylint: disable=import-error """XML files parser backend, should be available always. .. versionchanged:: 0.1.0 Added XML dump support. - Format to supp...
class Parser(anyconfig.backend.base.D2Parser): """ Parser for XML files. """ _type = "xml" _extensions = ["xml"] _open_flags = ('rb', 'wb') def load_from_string(self, content, **kwargs): """ Load config from XML snippet (a string `content`). :param content: XML s...
""" Write XML ElementTree `root` content into `stream`. :param tree: XML ElementTree object :param stream: File or file-like object can write to """ if _IS_OLDER_PYTHON: tree.write(stream, encoding='UTF-8') else: tree.write(stream, encoding='UTF-8', xml_declaration=True)
identifier_body
ar-KW.ts
/** * @license * Copyright Google Inc. 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function
(n: number): number { if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; } export default [ 'ar-KW', [ ['ص', '...
plural
identifier_name
ar-KW.ts
/** * @license * Copyright Google Inc. All Rights Reserved. *
// THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number): number { if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 1...
* 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 */
random_line_split
ar-KW.ts
/** * @license * Copyright Google Inc. 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 */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number...
export default [ 'ar-KW', [ ['ص', 'م'], , ], [['ص', 'م'], , ['صباحًا', 'مساءً']], [ ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], [ 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت' ], , ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'] ], , [...
{ if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; }
identifier_body
apm_process_paraview_data.py
r""" Description: Generates 2-D data maps from OpenFoam data saved by paraview as a CSV file. The data has to be saved as point data and the following fields are expected p, points:0->2, u:0->2. An aperture map is the second main input and is used to generate the interpolation coordinates as well as convert the flow ve...
temp = sp.arange(aper_map.data_map.size, dtype=int) temp = sp.unravel_index(temp, aper_map.data_map.shape[::-1]) map_coords = sp.zeros((aper_map.data_map.size, 3), dtype=float) # # half voxel added to make map points be cell centers map_coords[:, 0] = temp[0] * avg_fact * voxel_size + voxel_size...
# generating XYZ coordinates from map to interpolate to logger.info('calculating aperture map cell center coordinates...')
random_line_split
apm_process_paraview_data.py
r""" Description: Generates 2-D data maps from OpenFoam data saved by paraview as a CSV file. The data has to be saved as point data and the following fields are expected p, points:0->2, u:0->2. An aperture map is the second main input and is used to generate the interpolation coordinates as well as convert the flow ve...
data_coords[:, 2] = para_data_dict['points:2'] # return map_coords, data_coords def save_data_maps(map_coords, data_coords, aper_map, data_dict, density): r""" Converts the raw paraview point data into a 2-D data distribution and saves the file by appending to the base_name. """ # ...
r""" Generates the coordinate arrays to use in data interpolation for coverting paraview point data into a 2-D data map. """ # # generating XYZ coordinates from map to interpolate to logger.info('calculating aperture map cell center coordinates...') temp = sp.arange(aper_map.data_map.size, d...
identifier_body
apm_process_paraview_data.py
r""" Description: Generates 2-D data maps from OpenFoam data saved by paraview as a CSV file. The data has to be saved as point data and the following fields are expected p, points:0->2, u:0->2. An aperture map is the second main input and is used to generate the interpolation coordinates as well as convert the flow ve...
# return aper_map, data_dict def generate_coordinate_arrays(aper_map, para_data_dict): r""" Generates the coordinate arrays to use in data interpolation for coverting paraview point data into a 2-D data map. """ # # generating XYZ coordinates from map to interpolate to logger.info...
data_dict[col] = data[:, i]
conditional_block
apm_process_paraview_data.py
r""" Description: Generates 2-D data maps from OpenFoam data saved by paraview as a CSV file. The data has to be saved as point data and the following fields are expected p, points:0->2, u:0->2. An aperture map is the second main input and is used to generate the interpolation coordinates as well as convert the flow ve...
(aper_map, para_data_dict): r""" Generates the coordinate arrays to use in data interpolation for coverting paraview point data into a 2-D data map. """ # # generating XYZ coordinates from map to interpolate to logger.info('calculating aperture map cell center coordinates...') temp = sp....
generate_coordinate_arrays
identifier_name
Step.tsx
import React from 'react'; import { IconName } from '@talend/icons'; import { Icon } from '../../Icon/Icon'; import * as S from './Step.style'; export type StepProps = React.PropsWithRef<any> & { /** The title of the step */ title: string; /** The optional class name */ className?: string; /** The icon element t...
); }, ); export default Step;
random_line_split
generate_date_table.py
version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FIT...
status = tokens[status_idx].strip().replace('"', '') status_tokens = [t.strip() for t in status.split(';')] status_tokens = [tt.strip() for t in status_tokens for tt in t.split(',') ] if 'illegitimate name' in s...
continue
conditional_block
generate_date_table.py
. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR...
(self, lpsn_gss_file): """Get priority of species and usbspecies from LPSN GSS file.""" priorities = {} illegitimate_names = set() with open(lpsn_gss_file, encoding='utf-8', errors='ignore') as f: csv_reader = csv.reader(f) for line_num, tokens in enumer...
parse_lpsn_gss_priorities
identifier_name
generate_date_table.py
. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR...
if sp in gss_sp_priority: output_file.write('{}\t{}\n'.format(sp, gss_sp_priority[sp])) else: output_file.write('{}\t{}\n'.format(sp, scraped_sp_priority[sp])) if sp in gss_sp_priority and sp in scraped_sp_priority: ...
"""Parse priority year from LPSN data.""" self.logger.info('Reading priority references scrapped from LPSN.') scraped_sp_priority = self.parse_lpsn_scraped_priorities(lpsn_scraped_species_info) self.logger.info(' - read priority for {:,} species.'.format(len(scraped_sp_priority))) ...
identifier_body
generate_date_table.py
along with this program. If not, see <http://www.gnu.org/licenses/>. # # # ############################################################################### __prog_name__ = 'generate_date_table.py' __prog_desc__ = 'Generate table wi...
logger_setup(args.out_dir, __prog_name__.replace('.py', '.log'), __prog_name__,
random_line_split
smooth.js
;(function($) {
sliderHeight :320, navArr :0, img_align :'left' } options=jQuery.extend({},defaults,args); this.smoothSliderSize=function(){ var wrapWidth=this.width(); var slideri=this.find('.smooth_slideri'); var slideriW; var self=this; //calculate max-width of slideri if(options.navArr==0) s...
jQuery.fn.smoothSlider=function(args){ var defaults={ sliderWidth :900,
random_line_split
data.py
__author__ = 'g10k' """Потом убрать в миграции""" # ('Регистраторы','Регистраторы'), # ('Менеджеры','Менеджеры'), # ('Проф департамент','Проф департамент'), # ('Аналитика','Аналитика'), # ('Контроль качества','Контроль качества'), import kb.models departaments = { 'Регистра...
r = info.get('color') departament, created = kb.models.Departament.objects.get_or_create(name=department_name) app_objects = kb.models.App.objects.filter(name__in=apps) departament.apps.set(app_objects, clear=True) departament.color = color departament.save()
identifier_body
data.py
__author__ = 'g10k' """Потом убрать в миграции""" # ('Регистраторы','Регистраторы'), # ('Менеджеры','Менеджеры'), # ('Проф департамент','Проф департамент'), # ('Аналитика','Аналитика'), # ('Контроль качества','Контроль качества'), import kb.models departaments = { 'Регистра...
ects.filter(name__in=apps) departament.apps.set(app_objects, clear=True) departament.color = color departament.save()
name) app_objects = kb.models.App.obj
conditional_block
data.py
__author__ = 'g10k' """Потом убрать в миграции""" # ('Регистраторы','Регистраторы'), # ('Менеджеры','Менеджеры'), # ('Проф департамент','Проф департамент'), # ('Аналитика','Аналитика'), # ('Контроль качества','Контроль качества'), import kb.models departaments = { 'Регистра...
'Контроль качества': { 'apps': ['qq'], 'color': 'pink' } } def fill_departaments(): set_apps = set() for department_name, info in departaments.items(): for app in set_apps: kb.models.App.objects.get_or_create(name=app) apps = info.get('apps') color =...
},
random_line_split
data.py
__author__ = 'g10k' """Потом убрать в миграции""" # ('Регистраторы','Регистраторы'), # ('Менеджеры','Менеджеры'), # ('Проф департамент','Проф департамент'), # ('Аналитика','Аналитика'), # ('Контроль качества','Контроль качества'), import kb.models departaments = { 'Регистра...
color = info.get('color') departament, created = kb.models.Departament.objects.get_or_create(name=department_name) app_objects = kb.models.App.objects.filter(name__in=apps) departament.apps.set(app_objects, clear=True) departament.color = color departament.save()
.get('apps')
identifier_name
day1.rs
const DIRECTIONS: &'static str = "R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, \ R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, \ L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1...
else { (vy2, vy1) }; if (vx > hx1 && vx < hx2) && (hy > vy1 && hy < vy2) { println!("({},{})", vx, hy); Some(Point { x: vx, y: hy }) } else { None } } fn is_parallel(&self, other: &Line) -> bool { (self.is_horizontal() && other.is_horizontal...
{ (vy1, vy2) }
conditional_block
day1.rs
const DIRECTIONS: &'static str = "R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, \ R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, \ L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1...
(self.is_horizontal() && other.is_horizontal()) || (self.is_vertical() && other.is_vertical()) } fn is_horizontal(&self) -> bool { self.start.y == self.end.y } fn is_vertical(&self) -> bool { self.start.x == self.end.x } } pub fn main() { let mut path = Vec::ne...
fn is_parallel(&self, other: &Line) -> bool {
random_line_split
day1.rs
const DIRECTIONS: &'static str = "R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, \ R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, \ L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1...
} pub fn main() { let mut path = Vec::new(); let mut pos = Point { x: 0, y: 0 }; let mut prev_pos; let mut intersect = None; let mut facing = N; let dirs = DIRECTIONS.split(", "); for d in dirs { prev_pos = pos; let mut x = d.chars(); let turn = x.next().unwrap();...
{ self.start.x == self.end.x }
identifier_body
day1.rs
const DIRECTIONS: &'static str = "R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, \ R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, \ L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1...
(&self) -> bool { self.start.y == self.end.y } fn is_vertical(&self) -> bool { self.start.x == self.end.x } } pub fn main() { let mut path = Vec::new(); let mut pos = Point { x: 0, y: 0 }; let mut prev_pos; let mut intersect = None; let mut facing = N; let dirs = DI...
is_horizontal
identifier_name
raw.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ pub st_dev: dev_t, pub st_mode: mode_t, pub st_nlink: nlink_t, pub st_ino: ino_t, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: dev_t, pub st_atime: time_t, pub st_atime_nsec: c_long, pub st_mtime: time_t, pub st_mtime_nsec: c_long, pub st_ctime: time_t, pub s...
stat
identifier_name
raw.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[repr(C)] pub struct stat { pub st_dev: dev_t, pub st_mode: mode_t, pub st_nlink: nlink_t, pub st_ino: ino_t, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: dev_t, pub st_atime: time_t, pub st_atime_nsec: c_long, pub st_mtime: time_t, pub st_mtime_nsec: c_long, pub s...
random_line_split
io_ops_test.py
# -*- coding: utf-8 -*- # Copyright 2015 The TensorFlow Authors. 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 # # U...
return set(tf.compat.as_bytes(files[i].name) for i in range(len(files)) if i in indices) def testMatchingFiles(self): cases = ['ABcDEF.GH', 'ABzDEF.GH', 'ABasdfjklDEF.GH', 'AB3DEF.GH', 'AB4DEF.GH', 'ABDEF.GH', 'XYZ'] files = [tempfile.NamedTemporaryFile( prefix=c, dir...
dices):
identifier_name
io_ops_test.py
# -*- coding: utf-8 -*- # Copyright 2015 The TensorFlow Authors. 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 # # U...
in__': tf.test.main()
== '__ma
conditional_block
io_ops_test.py
# -*- coding: utf-8 -*- # Copyright 2015 The TensorFlow Authors. 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 # # U...
es(self): cases = ['ABcDEF.GH', 'ABzDEF.GH', 'ABasdfjklDEF.GH', 'AB3DEF.GH', 'AB4DEF.GH', 'ABDEF.GH', 'XYZ'] files = [tempfile.NamedTemporaryFile( prefix=c, dir=self.get_temp_dir(), delete=True) for c in cases] with self.test_session(): # Test exact match without wildcards. ...
_bytes(files[i].name) for i in range(len(files)) if i in indices) def testMatchingFil
identifier_body
io_ops_test.py
# -*- coding: utf-8 -*- # Copyright 2015 The TensorFlow Authors. 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 # # U...
def testWriteFile(self): cases = ['', 'Some contents'] for contents in cases: contents = tf.compat.as_bytes(contents) with tempfile.NamedTemporaryFile(prefix='WriteFileTest', dir=self.get_temp_dir(), delete=False) as tem...
read = tf.read_file(temp.name) self.assertEqual([], read.get_shape()) self.assertEqual(read.eval(), contents) os.remove(temp.name)
random_line_split
IosCopy.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosCopy extends React.Component { render()
} };IosCopy.defaultProps = {bare: false}
{ if(this.props.bare) { return <g> <g> <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "></polygon> <g> <path d="M325.3,64H160v48v288h192h48V139L325.3,64z M368,176h-80V96h16v64h64V176z"></path> </g> </g> </g>; } return <IconBase> <g> <polygon points="144,416 144,400 14...
identifier_body
IosCopy.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosCopy extends React.Component {
() { if(this.props.bare) { return <g> <g> <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "></polygon> <g> <path d="M325.3,64H160v48v288h192h48V139L325.3,64z M368,176h-80V96h16v64h64V176z"></path> </g> </g> </g>; } return <IconBase> <g> <polygon points="144,416 144,400...
render
identifier_name
IosCopy.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosCopy extends React.Component { render() { if(this.props.bare) { return <g> <g> <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "></polygon> <g> <path d="M325.3,64H160v...
};IosCopy.defaultProps = {bare: false}
</g> </IconBase>; }
random_line_split
IosCopy.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class IosCopy extends React.Component { render() { if(this.props.bare)
return <IconBase> <g> <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "></polygon> <g> <path d="M325.3,64H160v48v288h192h48V139L325.3,64z M368,176h-80V96h16v64h64V176z"></path> </g> </g> </IconBase>; } };IosCopy.defaultProps = {bare: false}
{ return <g> <g> <polygon points="144,416 144,400 144,112 112,112 112,448 352,448 352,416 160,416 "></polygon> <g> <path d="M325.3,64H160v48v288h192h48V139L325.3,64z M368,176h-80V96h16v64h64V176z"></path> </g> </g> </g>; }
conditional_block
rdynload.rs
// automatically generated by rust-bindgen use super::boolean::*; #[allow(dead_code)] const SINGLESXP: u32 = 302; #[allow(non_camel_case_types)] pub type DL_FUNC = ::std::option::Option<extern "C" fn() -> *mut ::libc::c_void>; #[allow(non_camel_case_types)] pub type R_NativePrimitiveArgType = ::libc::c_uint; #[allow(...
} impl ::std::default::Default for R_CMethodDef { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[allow(non_camel_case_types)] pub type R_FortranMethodDef = R_CMethodDef; #[repr(C)] #[derive(Copy)] #[allow(non_snake_case)] pub struct R_CallMethodDef { pub name: *const ::libc::c_char, ...
{ *self }
identifier_body
rdynload.rs
// automatically generated by rust-bindgen use super::boolean::*; #[allow(dead_code)] const SINGLESXP: u32 = 302; #[allow(non_camel_case_types)] pub type DL_FUNC = ::std::option::Option<extern "C" fn() -> *mut ::libc::c_void>; #[allow(non_camel_case_types)] pub type R_NativePrimitiveArgType = ::libc::c_uint; #[allow(...
} } #[allow(non_camel_case_types)] pub type R_FortranMethodDef = R_CMethodDef; #[repr(C)] #[derive(Copy)] #[allow(non_snake_case)] pub struct R_CallMethodDef { pub name: *const ::libc::c_char, pub fun: DL_FUNC, pub numArgs: ::libc::c_int, } impl ::std::clone::Clone for R_CallMethodDef { fn clone(&s...
random_line_split
rdynload.rs
// automatically generated by rust-bindgen use super::boolean::*; #[allow(dead_code)] const SINGLESXP: u32 = 302; #[allow(non_camel_case_types)] pub type DL_FUNC = ::std::option::Option<extern "C" fn() -> *mut ::libc::c_void>; #[allow(non_camel_case_types)] pub type R_NativePrimitiveArgType = ::libc::c_uint; #[allow(...
{ pub name: *const ::libc::c_char, pub fun: DL_FUNC, pub numArgs: ::libc::c_int, pub types: *mut R_NativePrimitiveArgType, pub styles: *mut R_NativeArgStyle, } impl ::std::clone::Clone for R_CMethodDef { fn clone(&self) -> Self { *self } } impl ::std::default::Default for R_CMethod...
R_CMethodDef
identifier_name
component.rs
use std::comm::{TryRecvError,Empty,Disconnected}; use std::fmt; use message::{Message,MessageData}; use message::MessageData::{MsgStart}; #[deriving(PartialEq,Clone)] pub enum ComponentType { ManagerComponent, ExtractorComponent, AudioDecoderComponent, VideoDecoderComponent, ClockComponent, Aud...
{ pub component_type: ComponentType, pub mgr_sender: Option<Sender<Message>>, pub receiver: Receiver<Message>, pub sender: Option<Sender<Message>>, } impl ComponentStruct { pub fn new(component_type: ComponentType) -> ComponentStruct { let (sender, receiver) = channel::<Message>(); ...
ComponentStruct
identifier_name
component.rs
use std::comm::{TryRecvError,Empty,Disconnected}; use std::fmt; use message::{Message,MessageData}; use message::MessageData::{MsgStart}; #[deriving(PartialEq,Clone)] pub enum ComponentType { ManagerComponent, ExtractorComponent, AudioDecoderComponent, VideoDecoderComponent, ClockComponent, Aud...
component_type: component_type, mgr_sender: None, receiver: receiver, sender: Some(sender), } } pub fn set_mgr_sender(&mut self, sender: Sender<Message>) { self.mgr_sender= Some(sender); } pub fn take_sender(&mut self) -> Sender<Message> { ...
impl ComponentStruct { pub fn new(component_type: ComponentType) -> ComponentStruct { let (sender, receiver) = channel::<Message>(); ComponentStruct {
random_line_split
component.rs
use std::comm::{TryRecvError,Empty,Disconnected}; use std::fmt; use message::{Message,MessageData}; use message::MessageData::{MsgStart}; #[deriving(PartialEq,Clone)] pub enum ComponentType { ManagerComponent, ExtractorComponent, AudioDecoderComponent, VideoDecoderComponent, ClockComponent, Aud...
pub fn set_mgr_sender(&mut self, sender: Sender<Message>) { self.mgr_sender= Some(sender); } pub fn take_sender(&mut self) -> Sender<Message> { self.sender.take().unwrap() } pub fn send(&self, to: ComponentType, msg:MessageData) -> bool { match self.mgr_sender.as_ref().unwra...
{ let (sender, receiver) = channel::<Message>(); ComponentStruct { component_type: component_type, mgr_sender: None, receiver: receiver, sender: Some(sender), } }
identifier_body
codemap.rs
e.g. something defined /// completely inside libsyntax) in which case this is None. pub span: Option<Span> } /// Extra information for tracking macro expansion of spans #[deriving(Hash, Show)] pub struct ExpnInfo { /// The location of the actual macro invocation, e.g. `let x = /// foo!();` /// ...
for fm in self.files.borrow().iter() { if filename == fm.name.as_slice() {
random_line_split
codemap.rs
`bar!()` internally, and there was an /// expression inside `bar!`; the call_site of the expression in /// the expansion would point to the `bar!` invocation; that /// call_site span would have its own ExpnInfo, with the call_site /// pointing to the `foo!` invocation. pub call_site: Span, /// ...
{ let idx = self.lookup_filemap_idx(bpos); let fm = (*self.files.borrow())[idx].clone(); let offset = bpos - fm.start_pos; FileMapAndBytePos {fm: fm, pos: offset} }
identifier_body
codemap.rs
{ let call_site1 = cm.with_expn_info(sp.expn_id, |ei| ei.map(|ei| ei.call_site)); let call_site2 = cm.with_expn_info(enclosing_sp.expn_id, |ei| ei.map(|ei| ei.call_site)); match (call_site1, call_site2) { (None, _) => sp, (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => s...
else { String::from_str(src.as_slice()) }; // Append '\n' in case it's not already there. // This is a workaround to prevent CodeMap.lookup_filemap_idx from accidentally // overflowing into the next filemap in case the last byte of span is also the last // byte of f...
{ String::from_str(src.as_slice().slice_from(3)) }
conditional_block
codemap.rs
{ let call_site1 = cm.with_expn_info(sp.expn_id, |ei| ei.map(|ei| ei.call_site)); let call_site2 = cm.with_expn_info(enclosing_sp.expn_id, |ei| ei.map(|ei| ei.call_site)); match (call_site1, call_site2) { (None, _) => sp, (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => s...
{ pub fm: Rc<FileMap>, pub pos: BytePos } /// The syntax with which a macro was invoked. #[deriving(Clone, Hash, Show)] pub enum MacroFormat { /// e.g. #[deriving(...)] <item> MacroAttribute, /// e.g. `format!()` MacroBang } #[deriving(Clone, Hash, Show)] pub struct NameAndSpan { /// The name of ...
FileMapAndBytePos
identifier_name
main.rs
extern crate report; use report::report_builder::ReportBuilder; use report::report_builder::html_report_builder::HtmlReportBuilder; use report::report_builder::markdown_report_builder::MarkdownReportBuilder; fn main() { let html_report = HtmlReportBuilder::new() .with_header("Solar Deities : Hindu Mytholo...
of Solar Deities.") .with_paragraph("Ravana once went to challenge Surya, the Sun-God, to a fight. \ When he reached the Solar Region he saw that the sun was about to rise and sent an envoy \ to inform Surya of his arrival and the reason for his coming.") .finish(); println!...
random_line_split
main.rs
extern crate report; use report::report_builder::ReportBuilder; use report::report_builder::html_report_builder::HtmlReportBuilder; use report::report_builder::markdown_report_builder::MarkdownReportBuilder; fn
() { let html_report = HtmlReportBuilder::new() .with_header("Solar Deities : Hindu Mythological Story") .with_paragraph("Let us enjoy reading this Hindu Mythological Story \ of Solar Deities.") .with_paragraph("Ravana once went to challenge Surya, the Sun-God, to a fight. \ ...
main
identifier_name
main.rs
extern crate report; use report::report_builder::ReportBuilder; use report::report_builder::html_report_builder::HtmlReportBuilder; use report::report_builder::markdown_report_builder::MarkdownReportBuilder; fn main()
.with_paragraph("Third paragraph") .finish(); println!("{}", markdown_report); }
{ let html_report = HtmlReportBuilder::new() .with_header("Solar Deities : Hindu Mythological Story") .with_paragraph("Let us enjoy reading this Hindu Mythological Story \ of Solar Deities.") .with_paragraph("Ravana once went to challenge Surya, the Sun-God, to a fight. \ Whe...
identifier_body
cli.js
#!/usr/bin/env node /* Copyright (c) 2012, Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var Command = require('./command'), inputError = require('./util/input-error'), exit = process.exit; //hold a reference to original pr...
(ex) { if (!ex) { return; } if (!ex.inputError) { throw ex; // turn it into an uncaught exception } else { //don't print nasty traces but still exit(1) console.error(ex.message); console.error('Try "istanbul help" for usage'); exit(1); } } function runCommand(ar...
errHandler
identifier_name
cli.js
#!/usr/bin/env node /* Copyright (c) 2012, Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var Command = require('./command'), inputError = require('./util/input-error'), exit = process.exit; //hold a reference to original pr...
/* istanbul ignore if: untestable */ if (require.main === module) { var args = Array.prototype.slice.call(process.argv, 2); runToCompletion(args); } module.exports = { runToCompletion: runToCompletion };
{ runCommand(args, errHandler); }
identifier_body
cli.js
#!/usr/bin/env node /* Copyright (c) 2012, Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var Command = require('./command'), inputError = require('./util/input-error'), exit = process.exit; //hold a reference to original pr...
} function runCommand(args, callback) { var pos = findCommandPosition(args), command, commandArgs, commandObject; if (pos < 0) { return callback(inputError.create('Need a command to run')); } commandArgs = args.slice(0, pos); command = args[pos]; commandArgs.p...
{ //don't print nasty traces but still exit(1) console.error(ex.message); console.error('Try "istanbul help" for usage'); exit(1); }
conditional_block
cli.js
#!/usr/bin/env node /* Copyright (c) 2012, Yahoo! Inc. All rights reserved. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ var Command = require('./command'), inputError = require('./util/input-error'), exit = process.exit; //hold a reference to original pr...
commandArgs, commandObject; if (pos < 0) { return callback(inputError.create('Need a command to run')); } commandArgs = args.slice(0, pos); command = args[pos]; commandArgs.push.apply(commandArgs, args.slice(pos + 1)); try { commandObject = Command.create(comma...
function runCommand(args, callback) { var pos = findCommandPosition(args), command,
random_line_split
ScriptsSearchScope.js
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions ...
(searchId, uiSourceCode, searchMatches) { if (searchId !== this._searchId) { searchFinishedCallback(false); return; } var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode, searchMatches); searchRe...
searchCallbackWrapper
identifier_name
ScriptsSearchScope.js
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions ...
continueSearch.call(this); return uiSourceCodes.length; }, stopSearch: function() { ++this._searchId; }, /** * @param {WebInspector.SearchConfig} searchConfig */ createSearchResultsPane: function(searchConfig) { return new WebInspector.Fi...
{ if (searchId !== this._searchId) { searchFinishedCallback(false); return; } var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode, searchMatches); searchResultCallback(searchResult); if (sear...
identifier_body
ScriptsSearchScope.js
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions ...
function searchCallbackWrapper(searchId, uiSourceCode, searchMatches) { if (searchId !== this._searchId) { searchFinishedCallback(false); return; } var searchResult = new WebInspector.FileBasedSearchResultsPane.SearchResult(uiSourceCode...
random_line_split
user.server.model.js
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema, crypto = require('crypto'), validator = require('validator'), generatePassword = require('generate-password'), owasp = require('owasp-password-strength-test'); owasp.config({ allowPassphrases ...
else { return _this.findUniqueUsername(username, (suffix || 0) + 1, callback); } } else { callback(null); } }); }; /** * Generates a random passphrase that passes the owasp test. * Returns a promise that resolves with the generated passphrase, or rejects with an error if something goes w...
{ callback(possibleUsername); }
conditional_block
user.server.model.js
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema, crypto = require('crypto'), validator = require('validator'), generatePassword = require('generate-password'), owasp = require('owasp-password-strength-test'); owasp.config({ allowPassphrases ...
/** * A Validation function for local strategy properties */ var validateLocalStrategyProperty = function (property) { return ((this.provider !== 'local' && !this.updated) || property.length); }; /** * A Validation function for local strategy email */ var validateLocalStrategyEmail = function (email) { return...
random_line_split
test_check_files_menu_agreements.py
# coding: utf-8 # Copyright 2013 The Font Bakery Authors. 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 re...
path = '.' name = __name__ targets = ['metadata'] tool = 'lint' def read_metadata_contents(self): return open(self.path).read() def menufile(self, font_metadata): return '%s.menu' % font_metadata.post_script_name @tags('required') def test_menu_file_agreement(self): ...
from bakery_lint.metadata import Metadata class CheckFontsMenuAgreements(TestCase):
random_line_split
test_check_files_menu_agreements.py
# coding: utf-8 # Copyright 2013 The Font Bakery Authors. 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 re...
menufile = self.menufile(font_metadata) path = op.join(op.dirname(self.path), menufile) if not op.exists(path): self.fail('%s does not exist' % menufile) if magic.from_file(path) != 'TrueType font data': self.fail('%s is not actual TTF file' % menufi...
conditional_block
test_check_files_menu_agreements.py
# coding: utf-8 # Copyright 2013 The Font Bakery Authors. 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 re...
def menufile(self, font_metadata): return '%s.menu' % font_metadata.post_script_name @tags('required') def test_menu_file_agreement(self): """ Check fonts have corresponding menu files """ contents = self.read_metadata_contents() fm = Metadata.get_family_metadata(contents)...
return open(self.path).read()
identifier_body
test_check_files_menu_agreements.py
# coding: utf-8 # Copyright 2013 The Font Bakery Authors. 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 re...
(self): return open(self.path).read() def menufile(self, font_metadata): return '%s.menu' % font_metadata.post_script_name @tags('required') def test_menu_file_agreement(self): """ Check fonts have corresponding menu files """ contents = self.read_metadata_contents() ...
read_metadata_contents
identifier_name
views.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
(request): extra_context = {} return render_to_response('help/about.html', extra_context, context_instance=RequestContext(request))
about
identifier_name
views.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
def terms(request): extra_context = {} extra_context['termsandconditions'] = ConditionsChapter.objects.all() return render_to_response('help/terms-and-conditions.html', extra_context, context_instance=RequestContext(request)) def ...
extra_context = {} extra_context['faqs'] = FAQ.objects.all() return render_to_response('help/faqs.html', extra_context, context_instance=RequestContext(request))
identifier_body
views.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
extra_context = {} extra_context['faqs'] = FAQ.objects.all() return render_to_response('help/faqs.html', extra_context, context_instance=RequestContext(request)) def terms(request): extra_context = {} extra_context['terms...
def faqs(request):
random_line_split
currencyPairs.service-mock.ts
import { bind } from "@react-rxjs/core" import { of } from "rxjs" import { delay, distinctUntilChanged, map } from "rxjs/operators" import { CurrencyPair } from "./types" const fakeData: Record<string, CurrencyPair> = { EURUSD: { symbol: "EURUSD", ratePrecision: 5, pipsPosition: 4, base: "EUR", t...
terms: "JPY", defaultNotional: 1000000, }, EURJPY: { symbol: "EURJPY", ratePrecision: 3, pipsPosition: 2, base: "EUR", terms: "JPY", defaultNotional: 1000000, }, AUDUSD: { symbol: "AUDUSD", ratePrecision: 5, pipsPosition: 4, base: "AUD", terms: "USD", defa...
random_line_split
compound3.rs
extern crate nalgebra as na; use na::{Isometry3, Point3, RealField, Vector3}; use ncollide3d::shape::{Capsule, Compound, Cuboid, ShapeHandle}; use nphysics3d::force_generator::DefaultForceGeneratorSet; use nphysics3d::joint::DefaultJointConstraintSet; use nphysics3d::object::{ BodyPartHandle, ColliderDesc, Default...
for i in 0usize..num { for j in 0usize..num { for k in 0usize..num { let x = r!(i as f64) * shift - centerx; let y = r!(j as f64) * shift + centery; let z = r!(k as f64) * shift - centerz; // Build the rigid body. l...
random_line_split
compound3.rs
extern crate nalgebra as na; use na::{Isometry3, Point3, RealField, Vector3}; use ncollide3d::shape::{Capsule, Compound, Cuboid, ShapeHandle}; use nphysics3d::force_generator::DefaultForceGeneratorSet; use nphysics3d::joint::DefaultJointConstraintSet; use nphysics3d::object::{ BodyPartHandle, ColliderDesc, Default...
let ground_handle = bodies.insert(Ground::new()); let co = ColliderDesc::new(ground_shape) .translation(Vector3::y() * -ground_thickness) .build(BodyPartHandle(ground_handle, 0)); colliders.insert(co); /* * U-shaped geometry. */ let large_rad = r!(2.5); let small_rad ...
{ /* * World */ let mechanical_world = DefaultMechanicalWorld::new(Vector3::new(r!(0.0), r!(-9.81), r!(0.0))); let geometrical_world = DefaultGeometricalWorld::new(); let mut bodies = DefaultBodySet::new(); let mut colliders = DefaultColliderSet::new(); let joint_constraints = DefaultJ...
identifier_body
compound3.rs
extern crate nalgebra as na; use na::{Isometry3, Point3, RealField, Vector3}; use ncollide3d::shape::{Capsule, Compound, Cuboid, ShapeHandle}; use nphysics3d::force_generator::DefaultForceGeneratorSet; use nphysics3d::joint::DefaultJointConstraintSet; use nphysics3d::object::{ BodyPartHandle, ColliderDesc, Default...
() { let testbed = Testbed::<f32>::from_builders(0, vec![("Compound", init_world)]); testbed.run() }
main
identifier_name
bench-serde.rs
#![feature(test)] extern crate quick_xml; extern crate serde; extern crate serde_xml_rs; extern crate test; use serde::Deserialize; use test::Bencher; const SOURCE: &str = include_str!("../../tests/sample_rss.xml"); #[derive(Debug, Deserialize)] struct Rss { channel: Channel, } #[derive(Debug, Deserialize)] st...
b.iter(|| { let rss: Rss = quick_xml::de::from_str(SOURCE).unwrap(); assert_eq!(rss.channel.items.len(), 99); }); } #[bench] fn bench_serde_xml_rs(b: &mut Bencher) { b.iter(|| { let rss: Rss = serde_xml_rs::from_str(SOURCE).unwrap(); assert_eq!(rss.channel.items.len(), 99); ...
fn bench_serde_quick_xml(b: &mut Bencher) {
random_line_split
bench-serde.rs
#![feature(test)] extern crate quick_xml; extern crate serde; extern crate serde_xml_rs; extern crate test; use serde::Deserialize; use test::Bencher; const SOURCE: &str = include_str!("../../tests/sample_rss.xml"); #[derive(Debug, Deserialize)] struct Rss { channel: Channel, } #[derive(Debug, Deserialize)] st...
{ url: String, length: String, #[serde(rename = "type")] typ: String, } #[bench] fn bench_serde_quick_xml(b: &mut Bencher) { b.iter(|| { let rss: Rss = quick_xml::de::from_str(SOURCE).unwrap(); assert_eq!(rss.channel.items.len(), 99); }); } #[bench] fn bench_serde_xml_rs(b: &m...
Enclosure
identifier_name
test_tvl1optflow.ts
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, i...
//} } //#endif // binary file format for flow data specified here: // http://vision.middlebury.edu/flow/data/ function readOpticalFlowFromFile(flow: alvision.Mat_<alvision.Point2f>, fileName : string) : void { //TODO: implement read //ifstream file(fileName, ios_bas...
// file.write((const char*) &u.y, sizeof(float)); // }
random_line_split
test_tvl1optflow.ts
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, i...
(flow1: alvision.Mat_<alvision.Point2f>, flow2: alvision.Mat_<alvision.Point2f>): alvision.double { let sum = 0.0; let counter = 0; for (let i = 0; i < flow1.rows(); ++i) { for (let j = 0; j < flow1.cols(); ++j) { const u1 = flow1.Element(i, j); ...
calcRMSE
identifier_name
test_tvl1optflow.ts
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, i...
alvision.cvtest.TEST('Video_calcOpticalFlowDual_TVL1', 'Regression', () => { const MAX_RMSE = 0.03; const frame1_path = alvision.cvtest.TS.ptr().get_data_path() + "optflow/RubberWhale1.png"; const frame2_path = alvision.cvtest.TS.ptr().get_data_path() + "optflow/RubberWhale2.png"; const ...
{ let sum = 0.0; let counter = 0; for (let i = 0; i < flow1.rows(); ++i) { for (let j = 0; j < flow1.cols(); ++j) { const u1 = flow1.Element(i, j); const u2 = flow2.Element(i, j); if (isFlowCorrect(u1) && isFlowCorrect(u2)) {...
identifier_body
test_tvl1optflow.ts
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, i...
} return Math.sqrt(sum / (1e-9 + counter)); } alvision.cvtest.TEST('Video_calcOpticalFlowDual_TVL1', 'Regression', () => { const MAX_RMSE = 0.03; const frame1_path = alvision.cvtest.TS.ptr().get_data_path() + "optflow/RubberWhale1.png"; const frame2_path = alvision.cvte...
{ const u1 = flow1.Element(i, j); const u2 = flow2.Element(i, j); if (isFlowCorrect(u1) && isFlowCorrect(u2)) { const diff = u1.op_Substraction(u2); sum = sum.valueOf() + diff.ddot(diff).valueOf(); ++coun...
conditional_block
deriving-hash.rs
// // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::hash::{...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
random_line_split
deriving-hash.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; assert!(hash(&person1) == hash(&person1)); assert!(hash(&person1) != hash(&person2));...
main
identifier_name
issue_427.rs
#![cfg(feature = "derive")] /// HID-IO Packet Buffer Struct /// /// # Remarks /// Used to store HID-IO data chunks. Will be chunked into individual packets on transmission. #[repr(C)] #[derive(PartialEq, Clone, Debug, bincode::Encode)]
/// Type of packet (Continued is automatically set if needed) pub ptype: u32, /// Packet Id pub id: u32, /// Packet length for serialization (in bytes) pub max_len: u32, /// Payload data, chunking is done automatically by serializer pub data: [u8; H], /// Set False if buffer is not c...
pub struct HidIoPacketBuffer<const H: usize> {
random_line_split
issue_427.rs
#![cfg(feature = "derive")] /// HID-IO Packet Buffer Struct /// /// # Remarks /// Used to store HID-IO data chunks. Will be chunked into individual packets on transmission. #[repr(C)] #[derive(PartialEq, Clone, Debug, bincode::Encode)] pub struct HidIoPacketBuffer<const H: usize> { /// Type of packet (Continued is...
{ SupportedIds = 0x00, GetInfo = 0x01, TestPacket = 0x02, ResetHidIo = 0x03, Reserved = 0x04, // ... 0x0F GetProperties = 0x10, KeyState = 0x11, KeyboardLayout = 0x12, KeyLayout = 0x13, KeyShapes = 0x14, LedLayout = 0x15, FlashMode = 0x16, UnicodeText = 0x17, Un...
HidIoCommandId
identifier_name
index.stories.tsx
/* import * as React from 'react' import {Box} from '../../../../../common-adapters' import {action, storiesOf} from '../../../../../stories/storybook' import {globalStyles} from '../../../../../styles' import RetentionWarning from '.' const commonProps = { entityType: 'channel', exploding: false, onBack: action...
.add('Disabled', () => <RetentionWarning {...commonProps} />) .add('Exploding', () => <RetentionWarning {...commonProps} exploding={true} timePeriod="30 seconds" />) } export default load */ export default {}
.add('Channel', () => <RetentionWarning {...commonProps} entityType="channel" />) .add('Small team', () => <RetentionWarning {...commonProps} entityType="small team" />) .add('Big team', () => <RetentionWarning {...commonProps} entityType="big team" />)
random_line_split
random.rs
extern crate rand; use std::thread; use rand::Rng; static NTHREADS: i32 = 15; const LEN: usize = 10000; fn main() { let mut child = vec![]; //writeln!(w, "{}: {}", i, test()).unwrap() // println!("{}", i) for i in 0..NTHREADS { child.push(thread::spawn(move || { println!("{}: {}", i, test()) })); } fo...
} counter } fn rand(t: &mut Vec<bool>) { let mut rng = rand::thread_rng(); for _i in 0..t.len() { let rand: usize = rng.gen_range(0, t.len()); t[rand] = true; } } fn count(t: &Vec<bool>) -> (i32, i32) { let mut tc = 0; let mut fc = 0; for x in 0..t.len() { if t[x] { tc += 1; } else { fc += 1; ...
{ break; }
conditional_block
random.rs
extern crate rand; use std::thread; use rand::Rng; static NTHREADS: i32 = 15;
fn main() { let mut child = vec![]; //writeln!(w, "{}: {}", i, test()).unwrap() // println!("{}", i) for i in 0..NTHREADS { child.push(thread::spawn(move || { println!("{}: {}", i, test()) })); } for c in child { let _ = c.join(); } } fn test() -> i32 { let mut t: Vec<bool> = Vec::new(); for _i ...
const LEN: usize = 10000;
random_line_split
random.rs
extern crate rand; use std::thread; use rand::Rng; static NTHREADS: i32 = 15; const LEN: usize = 10000; fn main() { let mut child = vec![]; //writeln!(w, "{}: {}", i, test()).unwrap() // println!("{}", i) for i in 0..NTHREADS { child.push(thread::spawn(move || { println!("{}: {}", i, test()) })); } fo...
fn count(t: &Vec<bool>) -> (i32, i32) { let mut tc = 0; let mut fc = 0; for x in 0..t.len() { if t[x] { tc += 1; } else { fc += 1; } } (tc, fc) }
{ let mut rng = rand::thread_rng(); for _i in 0..t.len() { let rand: usize = rng.gen_range(0, t.len()); t[rand] = true; } }
identifier_body
random.rs
extern crate rand; use std::thread; use rand::Rng; static NTHREADS: i32 = 15; const LEN: usize = 10000; fn main() { let mut child = vec![]; //writeln!(w, "{}: {}", i, test()).unwrap() // println!("{}", i) for i in 0..NTHREADS { child.push(thread::spawn(move || { println!("{}: {}", i, test()) })); } fo...
(t: &Vec<bool>) -> (i32, i32) { let mut tc = 0; let mut fc = 0; for x in 0..t.len() { if t[x] { tc += 1; } else { fc += 1; } } (tc, fc) }
count
identifier_name
0016_grades_initialdata.py
# Generated by Django 2.2.12 on 2020-05-09 06:28 from django.db import migrations # Can't use fixtures because load_fixtures method is janky with django-tenant-schemas def load_initial_data(apps, schema_editor): Grade = apps.get_model('courses', 'Grade') # add some initial data if none has been created yet ...
class Migration(migrations.Migration): dependencies = [ ('courses', '0015_auto_20200508_1957'), ] operations = [ migrations.RunPython(load_initial_data), ]
Grade.objects.create( name="8", value=8 ) Grade.objects.create( name="9", value=9 ) Grade.objects.create( name="10", value=10 ) Grade.objects.create( name="11", value=11 ...
conditional_block
0016_grades_initialdata.py
# Generated by Django 2.2.12 on 2020-05-09 06:28 from django.db import migrations # Can't use fixtures because load_fixtures method is janky with django-tenant-schemas def load_initial_data(apps, schema_editor): Grade = apps.get_model('courses', 'Grade') # add some initial data if none has been created yet ...
dependencies = [ ('courses', '0015_auto_20200508_1957'), ] operations = [ migrations.RunPython(load_initial_data), ]
identifier_body
0016_grades_initialdata.py
# Generated by Django 2.2.12 on 2020-05-09 06:28 from django.db import migrations # Can't use fixtures because load_fixtures method is janky with django-tenant-schemas def load_initial_data(apps, schema_editor): Grade = apps.get_model('courses', 'Grade') # add some initial data if none has been created yet ...
(migrations.Migration): dependencies = [ ('courses', '0015_auto_20200508_1957'), ] operations = [ migrations.RunPython(load_initial_data), ]
Migration
identifier_name
0016_grades_initialdata.py
# Generated by Django 2.2.12 on 2020-05-09 06:28 from django.db import migrations # Can't use fixtures because load_fixtures method is janky with django-tenant-schemas def load_initial_data(apps, schema_editor):
if not Grade.objects.exists(): Grade.objects.create( name="8", value=8 ) Grade.objects.create( name="9", value=9 ) Grade.objects.create( name="10", value=10 ) Grade.objects.create( ...
Grade = apps.get_model('courses', 'Grade') # add some initial data if none has been created yet
random_line_split
main.rs
//! main.rs - The entry point for the Ante compiler. //! Handles command-line argument parsing and dataflow between //! each compiler phase. The compiler as a whole is separated into //! the following phases (in order): //! //! lexing -> parsing -> name resolution -> type inference -> lifetime inference -> codegen //! ...
() { let args = App::new("ante") .version("0.1.1") .author("Jake Fecher <jfecher11@gmail.com>") .about("Compiler for the Ante programming language") .arg(Arg::with_name("lex").long("lex").help("Lex the file and output the resulting list of tokens")) .arg(Arg::with_name("parse...
main
identifier_name
main.rs
//! main.rs - The entry point for the Ante compiler. //! Handles command-line argument parsing and dataflow between //! each compiler phase. The compiler as a whole is separated into //! the following phases (in order): //! //! lexing -> parsing -> name resolution -> type inference -> lifetime inference -> codegen //! ...
// Phase 5: Lifetime inference util::timing::start_time("Lifetime Inference"); lifetimes::infer(ast, &mut cache); if args.is_present("show-lifetimes") { println!("{}", ast); } // Phase 6: Codegen if error::get_error_count() == 0 { llvm::run(&filename, ast, &mut cache, ...
{ return; }
conditional_block
main.rs
//! main.rs - The entry point for the Ante compiler. //! Handles command-line argument parsing and dataflow between //! each compiler phase. The compiler as a whole is separated into //! the following phases (in order): //! //! lexing -> parsing -> name resolution -> type inference -> lifetime inference -> codegen //! ...
/// Convenience macro for unwrapping a Result or printing an error message and returning () on Err. macro_rules! expect {( $result:expr , $fmt_string:expr $( , $($msg:tt)* )? ) => ({ match $result { Ok(t) => t, Err(_) => { print!($fmt_string $( , $($msg)* )? ); return (); ...
{ let resolver = cache.name_resolvers.get_mut(0).unwrap(); let mut definitions = resolver.exports.definitions.iter().collect::<Vec<_>>(); // Make sure the output has a deterministic order for testing definitions.sort(); for (name, definition_id) in definitions { let info = &cache.definitio...
identifier_body
main.rs
//! main.rs - The entry point for the Ante compiler. //! Handles command-line argument parsing and dataflow between //! each compiler phase. The compiler as a whole is separated into //! the following phases (in order): //! //! lexing -> parsing -> name resolution -> type inference -> lifetime inference -> codegen //! ...
.arg(Arg::with_name("show-types").long("show-types").help("Print out the type of each definition")) .arg(Arg::with_name("show-lifetimes").long("show-lifetimes").help("Print out the input file annotated with inferred lifetimes of heap allocations")) .arg(Arg::with_name("file").help("The file to c...
.arg(Arg::with_name("O").short("O").value_name("level").default_value("0").validator(validate_opt_argument).help("Sets the current optimization level from 0 (no optimization) to 3 (aggressive optimization). Set to s or z to optimize for size.")) .arg(Arg::with_name("no-color").long("no-color").help("Use...
random_line_split
constants.js
import config from '@automattic/calypso-config'; import debugFactory from 'debug'; // Enable/disable ad-tracking // These should not be put in the json config as they must not differ across environments export const isGoogleAnalyticsEnabled = true; export const isGoogleAnalyticsEnhancedEcommerceEnabled = true; export ...
export const isAdRollEnabled = false; /** * Module variables */ export const debug = debugFactory( 'calypso:analytics:ad-tracking' ); export const FACEBOOK_TRACKING_SCRIPT_URL = 'https://connect.facebook.net/en_US/fbevents.js'; export const GOOGLE_GTAG_SCRIPT_URL = 'https://www.googletagmanager.com/gtag/js?id='; ex...
export const isTwitterEnabled = true; export const isLinkedinEnabled = false; export const isCriteoEnabled = false; export const isPandoraEnabled = false; export const isQuoraEnabled = false;
random_line_split
exports.rs
use crate::ty; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::Res; use rustc_hir::def_id::LocalDefId; use rustc_macros::HashStable; use rustc_span::symbol::Ident; use rustc_span::Span; use std::fmt::Debug; /// This is the replacement export map. It maps a module to all of the exports /// within. pub t...
}
{ Export { ident: self.ident, res: self.res.map_id(map), span: self.span, vis: self.vis } }
identifier_body
exports.rs
use crate::ty; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::Res; use rustc_hir::def_id::LocalDefId; use rustc_macros::HashStable; use rustc_span::symbol::Ident;
/// This is the replacement export map. It maps a module to all of the exports /// within. pub type ExportMap<Id> = FxHashMap<LocalDefId, Vec<Export<Id>>>; #[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)] pub struct Export<Id> { /// The name of the target. pub ident: Ident, /// The resol...
use rustc_span::Span; use std::fmt::Debug;
random_line_split
exports.rs
use crate::ty; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::Res; use rustc_hir::def_id::LocalDefId; use rustc_macros::HashStable; use rustc_span::symbol::Ident; use rustc_span::Span; use std::fmt::Debug; /// This is the replacement export map. It maps a module to all of the exports /// within. pub t...
<Id> { /// The name of the target. pub ident: Ident, /// The resolution of the target. pub res: Res<Id>, /// The span of the target. pub span: Span, /// The visibility of the export. /// We include non-`pub` exports for hygienic macros that get used from extern crates. pub vis: ty::V...
Export
identifier_name