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
create-workbench-container.component.ts
import {AbstractPopupComponent} from '@common/component/abstract-popup.component'; import {Component, ElementRef, EventEmitter, Injector, OnDestroy, OnInit, Output} from '@angular/core'; import {WorkbenchConstant} from '../../../workbench.constant'; import {CreateWorkbenchModelService} from './service/create-workbench-...
extends AbstractPopupComponent implements OnInit, OnDestroy { // required workspaceId: string; createStep: WorkbenchConstant.CreateStep = WorkbenchConstant.CreateStep.SELECT; // optional folderId: string; // this only used in workspace // used in explore isAccessFromExplore: boolean; schemaName: str...
CreateWorkbenchContainerComponent
identifier_name
create-workbench-container.component.ts
import {AbstractPopupComponent} from '@common/component/abstract-popup.component'; import {Component, ElementRef, EventEmitter, Injector, OnDestroy, OnInit, Output} from '@angular/core'; import {WorkbenchConstant} from '../../../workbench.constant'; import {CreateWorkbenchModelService} from './service/create-workbench-...
this.completedPopup.emit(workbenchId); } }
closePopup(): void { this.closedPopup.emit(); } completePopup(workbenchId?: string): void {
random_line_split
canvaspattern.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 canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Binding...
origin_clean: bool, ) -> DomRoot<CanvasPattern> { reflect_dom_object( Box::new(CanvasPattern::new_inherited( surface_data, surface_size, repeat, origin_clean, )), global, CanvasPatternBind...
global: &GlobalScope, surface_data: Vec<u8>, surface_size: Size2D<i32>, repeat: RepetitionStyle,
random_line_split
canvaspattern.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 canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Binding...
{ reflector_: Reflector, surface_data: Vec<u8>, surface_size: Size2D<i32>, repeat_x: bool, repeat_y: bool, origin_clean: bool, } impl CanvasPattern { fn new_inherited( surface_data: Vec<u8>, surface_size: Size2D<i32>, repeat: RepetitionStyle, origin_clean: b...
CanvasPattern
identifier_name
canvaspattern.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 canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom::bindings::codegen::Binding...
}
{ FillOrStrokeStyle::Surface(SurfaceStyle::new( self.surface_data.clone(), self.surface_size, self.repeat_x, self.repeat_y, )) }
identifier_body
send-type-inference.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<K:Send+'static,V:Send+'static>(mut tx: Sender<Sender<Command<K, V>>>) { let (tx1, _rx) = channel(); tx.send(tx1); } pub fn main() { }
cache_server
identifier_name
send-type-inference.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} pub fn main() { }
tx.send(tx1);
random_line_split
send-type-inference.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { }
{ let (tx1, _rx) = channel(); tx.send(tx1); }
identifier_body
utils_test.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, ...
tf.test.main()
conditional_block
utils_test.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, ...
model_path = os.path.join(tf.test.get_temp_dir(), 'default') utils.save_graph_model( tf.Session(), model_path, {'x': x}, {'w': weights}, {'tag'}) self.assertTrue(os.path.isfile(os.path.join(model_path, 'saved_model.pb'))) def test_save_graph_model_kwargs(self): x = tf.placeholder(shape=[None,...
def test_save_graph_model_explicit_session(self): sess = tf.Session(graph=tf.Graph()) with sess.graph.as_default(): x = tf.placeholder(shape=[None, 10], dtype=tf.float32, name='inp') weights = tf.constant(1., shape=(10, 2), name='weights') model_path = os.path.join(tf.test.get_temp_dir(), 'expli...
identifier_body
utils_test.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): x = tf.placeholder(shape=[None, 10], dtype=tf.float32, name='inp') weights = tf.constant(1., shape=(10, 2), name='weights') model_path = os.path.join(tf.test.get_temp_dir(), 'default') utils.save_graph_model( tf.Session(), model_path, {'x': x}, {'w': weights}, {'tag'}) self.assertTru...
test_save_graph_model_default_session
identifier_name
utils_test.py
# Copyright 2021 Google LLC #
# 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, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the L...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
random_line_split
smacha_diff_test_examples.py
#!/usr/bin/env python import sys import argparse import os import unittest2 as unittest from ruamel import yaml from smacha.util import Tester import rospy import rospkg import rostest ROS_TEMPLATES_DIR = '../src/smacha_ros/templates' TEMPLATES_DIR = 'smacha_templates/smacha_test_examples' WRITE_OUTPUT_FILES = Fa...
def test_generate(self): """Test generating against baseline files""" for test_case in CONF_DICT['TEST_GENERATE']: with self.subTest(test_case=test_case): test_params = test_case.values()[0] script_file = test_params['script'] baseline =...
self.set_write_output_files(WRITE_OUTPUT_FILES) self.set_output_py_dir(OUTPUT_PY_DIR) self.set_output_yml_dir(OUTPUT_YML_DIR) self.set_debug_level(DEBUG_LEVEL) # Store the base path self._base_path = os.path.dirname(os.path.abspath(__file__)) # Call the parent construct...
identifier_body
smacha_diff_test_examples.py
#!/usr/bin/env python import sys import argparse import os import unittest2 as unittest from ruamel import yaml from smacha.util import Tester import rospy import rospkg import rostest ROS_TEMPLATES_DIR = '../src/smacha_ros/templates' TEMPLATES_DIR = 'smacha_templates/smacha_test_examples' WRITE_OUTPUT_FILES = Fa...
rospy.init_node('test_smacha_ros_generate',log_level=rospy.DEBUG) rostest.rosrun('smacha_ros', 'test_smacha_ros_generate', TestGenerate)
DEBUG_LEVEL = CONF_DICT['DEBUG_LEVEL']
conditional_block
smacha_diff_test_examples.py
#!/usr/bin/env python import sys import argparse import os import unittest2 as unittest from ruamel import yaml from smacha.util import Tester import rospy import rospkg import rostest ROS_TEMPLATES_DIR = '../src/smacha_ros/templates' TEMPLATES_DIR = 'smacha_templates/smacha_test_examples' WRITE_OUTPUT_FILES = Fa...
self.set_write_output_files(WRITE_OUTPUT_FILES) self.set_output_py_dir(OUTPUT_PY_DIR) self.set_output_yml_dir(OUTPUT_YML_DIR) self.set_debug_level(DEBUG_LEVEL) # Store the base path self._base_path = os.path.dirname(os.path.abspath(__file__)) # Call the parent c...
random_line_split
smacha_diff_test_examples.py
#!/usr/bin/env python import sys import argparse import os import unittest2 as unittest from ruamel import yaml from smacha.util import Tester import rospy import rospkg import rostest ROS_TEMPLATES_DIR = '../src/smacha_ros/templates' TEMPLATES_DIR = 'smacha_templates/smacha_test_examples' WRITE_OUTPUT_FILES = Fa...
(self, *args, **kwargs): # Set Tester member variables self.set_write_output_files(WRITE_OUTPUT_FILES) self.set_output_py_dir(OUTPUT_PY_DIR) self.set_output_yml_dir(OUTPUT_YML_DIR) self.set_debug_level(DEBUG_LEVEL) # Store the base path self._base_path = os.path....
__init__
identifier_name
slidebox.js
/*! Slidebox.JS - v1.0 - 2013-11-30 * http://github.com/trevanhetzel/slidebox * * Copyright (c) 2013 Trevan Hetzel <trevan.co>; * Licensed under the MIT license */ slidebox = function (params) { // Carousel carousel = function () { var $carousel = $(params.container).children(".carousel"), ...
}); }, // Lightbox lightbox = function () { var trigger = ".carousel li a"; // Close lightbox when pressing esc key $(document).keydown(function (e){ if (e.keyCode == 27) { closeLightbox(); } }); $(document) ...
{ moveRight(); }
conditional_block
slidebox.js
/*! Slidebox.JS - v1.0 - 2013-11-30 * http://github.com/trevanhetzel/slidebox * * Copyright (c) 2013 Trevan Hetzel <trevan.co>; * Licensed under the MIT license */ slidebox = function (params) { // Carousel carousel = function () {
$triggerRight = $(params.rightTrigger), total = $carouselItem.length, current = 0; var moveLeft = function () { if ( current > 0 ) { $carousel.animate({ "left": "+=" + params.length + "px" }, params.speed ); current--; ...
var $carousel = $(params.container).children(".carousel"), $carouselItem = $(".carousel li"), $triggerLeft = $(params.leftTrigger),
random_line_split
task.py
(Base, Conditional, Taggable, Become): """ A task is a language feature that represents a call to a module, with given arguments and other parameters. A handler is a subclass of a task. Usage: Task.load(datastructure) -> Task Task.something(...) """ # ==========================...
Task
identifier_name
task.py
int', default=0) _changed_when = FieldAttribute(isa='list', default=[]) _delay = FieldAttribute(isa='int', default=5) _delegate_to = FieldAttribute(isa='string') _delegate_facts = FieldAttribute(isa='bool', default=False) _failed_when = FieldAttribute(isa='list', default=[]) _loop = FieldAttribu...
return super(Task, self).preprocess_data(new_ds) def _load_loop_control(self, attr, ds): if not isinstance(ds, dict): raise AnsibleParserError( "the `loop_control` value must be specified as a dictionary and cannot " "be a variable itself (though it can...
display.warning("Ignoring invalid attribute: %s" % k)
conditional_block
task.py
='int', default=0) _changed_when = FieldAttribute(isa='list', default=[]) _delay = FieldAttribute(isa='int', default=5) _delegate_to = FieldAttribute(isa='string') _delegate_facts = FieldAttribute(isa='bool', default=False) _failed_when = FieldAttribute(isa='list', default=[]) _loop = FieldAttri...
def _merge_kv(self, ds): if ds is None: return "" elif isinstance(ds, string_types): return ds elif isinstance(ds, dict): buf = "" for (k, v) in iteritems(ds): if k.startswith('_'): continue ...
''' return the name of the task ''' if self._role and self.name and ("%s : " % self._role._role_name) not in self.name: return "%s : %s" % (self._role.get_name(), self.name) elif self.name: return self.name else: if self._role: return "%s : %s...
identifier_body
task.py
='int', default=0) _changed_when = FieldAttribute(isa='list', default=[]) _delay = FieldAttribute(isa='int', default=5) _delegate_to = FieldAttribute(isa='string') _delegate_facts = FieldAttribute(isa='bool', default=False) _failed_when = FieldAttribute(isa='list', default=[]) _loop = FieldAttri...
if self.action in ('setup', 'gather_facts') and 'ansible_env' in to_native(e): # ignore as fact gathering sets ansible_env pass if isinstance(value, list): for env_item in value: if isinstance(env_item, ...
try: env[k] = templar.template(v, convert_bare=False) except AnsibleUndefinedVariable as e:
random_line_split
article_queries.js
// Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. function make_element(value){ jQuery("#attribute_element").empty() if(value != ""){ if(value=='channel'){ jQuery.getJSON("/infodeploy/channels/get_all",function(...
".pagenumlist a").click(function(){ var page=$(this).attr("href").split("=")[1] pageNumQuery(page) return false; }) }) function pageNumQuery(page){ $("#search_list input[name=page]").val(page); $("#search_list input[type=submit]").click(); }
programa").empty() if(value != ""){ jQuery.getJSON("/infodeploy/programas/get_all_by_channel?channel_id="+value,function(obj){ if(obj.length > 0){ var html="" html+="<select id ='programas_id' name = 'programas[id]'>" for(idx=0;idx<obj.length;idx++){ html+="<opti...
identifier_body
article_queries.js
// Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. function make_element(value){ jQuery("#attribute_element").empty() if(value != ""){ if(value=='channel'){ jQuery.getJSON("/infodeploy/channels/get_all",function(...
="" html="<input type='text' value='' style='width:90px' name='keyword'>" jQuery("#attribute_element").append(html) } } } function get_programas(value){ jQuery("#make_programa").empty() if(value != ""){ jQuery.getJSON("/infodeploy/programas/get_all_by_channel?channel_id="+value,function(obj){ ...
{ var html="<select name='states[id]' id='states_id'><option value='displaing'>显示中</option><option value='out_of_date'>已过期</option><option value='out_of_stock'>已下架</option></select>" jQuery("#attribute_element").append(html) }else{ var html
conditional_block
article_queries.js
// Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. function make_element(value){ jQuery("#attribute_element").empty() if(value != ""){ if(value=='channel'){ jQuery.getJSON("/infodeploy/channels/get_all",function(...
for(idx=0;idx<obj.length;idx++){ html+="<option value='"+obj[idx]._id+"'>"+obj[idx].name+"</option>" } html+="</select>" } jQuery("#make_programa").append(html) }) } } $(function(){ $(".pagenumlist a").click(function(){ var page=$(this).attr("href").spl...
if(value != ""){ jQuery.getJSON("/infodeploy/programas/get_all_by_channel?channel_id="+value,function(obj){ if(obj.length > 0){ var html="" html+="<select id ='programas_id' name = 'programas[id]'>"
random_line_split
article_queries.js
// Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. function make_element(value){ jQuery("#attribute_element").empty() if(value != ""){ if(value=='channel'){ jQuery.getJSON("/infodeploy/channels/get_all",function(...
"#make_programa").empty() if(value != ""){ jQuery.getJSON("/infodeploy/programas/get_all_by_channel?channel_id="+value,function(obj){ if(obj.length > 0){ var html="" html+="<select id ='programas_id' name = 'programas[id]'>" for(idx=0;idx<obj.length;idx++){ html+...
e){ jQuery(
identifier_name
e_light.js
import * as CES from 'ces'; import * as BABYLON from '../lib/babylon'; import { c_light } from '../components/c_light'; /** * ... * @author Brendon Smith * http://seacloud9.org * LightWeight 3D System Design engine */
this.entity = new CES.Entity(); this.init(); } static defaults(){ return{ _type:'Hemispheric', e_type:'e_light', name:'Hemispheric', _position:'0,0,0', _rotation:'0,0,0', _material:{ _alpah:1.0, _texture:null, _uScale: 1.0, _vScale: 1.0, _backFaceCulling: true, ...
export class e_light{ constructor(_defaults = null){ this._defaults = _defaults == null ? this.defaults(): _defaults;
random_line_split
e_light.js
import * as CES from 'ces'; import * as BABYLON from '../lib/babylon'; import { c_light } from '../components/c_light'; /** * ... * @author Brendon Smith * http://seacloud9.org * LightWeight 3D System Design engine */ export class e_light{
(_defaults = null){ this._defaults = _defaults == null ? this.defaults(): _defaults; this.entity = new CES.Entity(); this.init(); } static defaults(){ return{ _type:'Hemispheric', e_type:'e_light', name:'Hemispheric', _position:'0,0,0', _rotation:'0,0,0', _material:{ _alpah:1.0, ...
constructor
identifier_name
e_light.js
import * as CES from 'ces'; import * as BABYLON from '../lib/babylon'; import { c_light } from '../components/c_light'; /** * ... * @author Brendon Smith * http://seacloud9.org * LightWeight 3D System Design engine */ export class e_light{ constructor(_defaults = null){ this._defaults = _defaults == null ? thi...
}
{ this.entity.addComponent(new c_light(this._defaults)); }
identifier_body
box_shadow.rs
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 api::{BorderRadius, BoxShadowClipMode, ClipMode, ColorF, DeviceIntSize, LayoutPrimitiveInfo}; use api::{LayoutRect, L...
BoxShadowClipMode::Inset => { // If the inner shadow rect contains the prim // rect, no pixels will be shadowed. if border_radius.is_zero() && shadow_rect.inflate(-blur_radius, -blur_radius).contains_rect(&prim_info.rect...
{ // Certain spread-radii make the shadow invalid. if !shadow_rect.is_well_formed_and_nonempty() { return; } // Add the box-shadow clip source. extra_clips.push(shadow_clip_source); ...
conditional_block
box_shadow.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 api::{BorderRadius, BoxShadowClipMode, ClipMode, ColorF, DeviceIntSize, LayoutPrimitiveInfo}; use api::{LayoutRe...
( corner: LayoutSize, spread_amount: f32, ) -> LayoutSize { LayoutSize::new( adjust_radius_for_box_shadow( corner.width, spread_amount ), adjust_radius_for_box_shadow( corner.height, spread_amount ), ) } fn adjust_radius_fo...
adjust_corner_for_box_shadow
identifier_name
box_shadow.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 api::{BorderRadius, BoxShadowClipMode, ClipMode, ColorF, DeviceIntSize, LayoutPrimitiveInfo}; use api::{LayoutRe...
} } fn adjust_corner_for_box_shadow( corner: LayoutSize, spread_amount: f32, ) -> LayoutSize { LayoutSize::new( adjust_radius_for_box_shadow( corner.width, spread_amount ), adjust_radius_for_box_shadow( corner.height, spread_amount...
bottom_left: adjust_corner_for_box_shadow( radius.bottom_left, spread_amount, ),
random_line_split
workorder_views.py
from django.template import RequestContext from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.contrib import messages from django.core.urlresolvers import reverse ...
elif status == 'complete': context_dict['orders'] = finished_orders header_list.pop() # Remove the blank column header over the Delete buttons header_list.insert(3, 'Finish Date') context_dict['count'] = finished_orders.count() elif status == 'terminated': context_dict[...
context_dict['orders'] = open_orders context_dict['count'] = open_orders.count()
conditional_block
workorder_views.py
from django.template import RequestContext from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.contrib import messages from django.core.urlresolvers import reverse ...
(request, id): try: order = WorkOrder.objects.get(id = id) order.remove_order() messages.add_message(request, messages.SUCCESS, "Order {} removed.".format(order.id)) except WorkOrder.DoesNotExist: messages.add_message(request, messages.ERROR, "Can't find any Work Order with ID {...
remove_work_order
identifier_name
workorder_views.py
from django.template import RequestContext from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.contrib import messages from django.core.urlresolvers import reverse ...
@csrf_exempt def get_unmatched_orders (request, ship_id): """ AJAX function to list Work Orders that have no associated Shipment. Returns Work Orders belonging to a particular Customer (shipment owner) that are unmatched and not deleted """ # TODO: Method to get unmatched orders by Acct ID ...
""" AJAX function to list Shipments that have no associated Work Order. Returns shipments belonging to a particular Customer (order owner) that are unmatched and still in storage (redundant?) """ context_dict = dict() order = WorkOrder.objects.get(id = order_id) _owner = order.owner _...
identifier_body
workorder_views.py
from django.template import RequestContext from django.shortcuts import render_to_response, HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.contrib import messages from django.core.urlresolvers import reverse ...
def remove_work_order (request, id): try: order = WorkOrder.objects.get(id = id) order.remove_order() messages.add_message(request, messages.SUCCESS, "Order {} removed.".format(order.id)) except WorkOrder.DoesNotExist: messages.add_message(request, messages.ERROR, "Can't find any...
random_line_split
mIP.py
# nv 1.2 # Modulo Identifier Protocol import json import urllib2 class Struct: def __init__(self): values = '' s = Struct() s.values = [] def geoIP(ip): response = urllib2.urlopen('http://ip-api.com/json/'+ip) dt = response.read() dt_all = json.loads(dt) #SET GEO IP------------------------------ s.values.a...
# NIx GeoIP Tool
random_line_split
mIP.py
# NIx GeoIP Tool # nv 1.2 # Modulo Identifier Protocol import json import urllib2 class Struct: def __init__(self): values = '' s = Struct() s.values = [] def geoIP(ip): response = urllib2.urlopen('http://ip-api.com/json/'+ip) dt = response.read() dt_all = json.loads(dt) #SET GEO IP-------------------------...
(): return s.values[0] def getCountry(): return s.values[1] def getCountryCode(): return s.values[2] def getRegion(): return s.values[3] def getCity(): return s.values[4] def getZip(): return s.values[5] def getLat(): return s.values[6] def getLon(): return s.values[7] def getTimezone(): return s.values[8] def...
getStatus
identifier_name
mIP.py
# NIx GeoIP Tool # nv 1.2 # Modulo Identifier Protocol import json import urllib2 class Struct: def __init__(self): values = '' s = Struct() s.values = [] def geoIP(ip): response = urllib2.urlopen('http://ip-api.com/json/'+ip) dt = response.read() dt_all = json.loads(dt) #SET GEO IP-------------------------...
def getZip(): return s.values[5] def getLat(): return s.values[6] def getLon(): return s.values[7] def getTimezone(): return s.values[8] def getISP(): return s.values[9] def getORG(): return s.values[10] def getAS(): return s.values[11] def getQuery(): return s.values[12] def getTry(): return '%43s'%'try :: n...
return s.values[4]
identifier_body
tokenizers.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
(self, text): raise NotImplementedError("Tokenizer must override tokenize() method") class DefaultTokenizer(Tokenizer): """Default tokenizer which tokenizes on whitespace.""" def __init__(self, use_stemmer=False): """Constructor for DefaultTokenizer. Args: use_stemmer: boolean, indicating whet...
tokenize
identifier_name
tokenizers.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
return tokenize.tokenize(text, self._stemmer)
identifier_body
tokenizers.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
use_stemmer: boolean, indicating whether Porter stemmer should be used to strip word suffixes to improve matching. """ self._stemmer = porter.PorterStemmer() if use_stemmer else None def tokenize(self, text): return tokenize.tokenize(text, self._stemmer)
random_line_split
char.rs
next(&mut self) -> Option<char> { self.0.take() } } #[stable(feature = "rust1", since = "1.0.0")] #[lang = "char"] impl char { /// Checks if a `char` parses as a numeric digit in the given radix. /// /// Compared to `is_numeric()`, this function only recognizes the characters /// `0-9`, `a-z` and `A-Z...
operty::XID_Start(self) } /// Re
identifier_body
char.rs
escape of a /// character, as `char`s. /// /// All characters are escaped with Rust syntax of the form `\\u{NNNN}` /// where `NNNN` is the shortest hexadecimal representation of the code /// point. /// /// # Examples /// /// ``` /// for i in '❤'.escape_unicode() { /// pr...
/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
random_line_split
char.rs
/// characters. #[stable(feature = "rust1", since = "1.0.0")] pub struct ToUppercase(Option<char>); #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for ToUppercase { type Item = char; fn next(&mut self) -> Option<char> { self.0.take() } } #[stable(feature = "rust1", since = "1.0.0")] #[lang = "ch...
f) -> EscapeUnicode { C::escape_unicode(self) } /// Returns an iterator that yields the 'default' ASCII and /// C++11-like literal escape of a character, as `char`s. /// /// The default is chosen with a bias toward producing literals that are /// legal in a variety of languages, including C++11 and...
pe_unicode(sel
identifier_name
esp32_matter_allclusters.py
# Copyright 2022 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, ...
(esp32_matter_device.Esp32MatterDevice): """Device class for Esp32MatterAllclusters devices. Matter all-clusters application running on Espressif ESP32 M5Stack platform: https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/esp32 TODO(b/204077943): WiFi PW RPC support in GDM an...
Esp32MatterAllclusters
identifier_name
esp32_matter_allclusters.py
# Copyright 2022 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, ...
TODO(b/204077943): WiFi PW RPC support in GDM and all clusters app. """ DETECT_MATCH_CRITERIA = { detect_criteria.PigweedQuery.product_name: "cp2104 usb to uart bridge controller", detect_criteria.PigweedQuery.manufacturer_name: r"silicon(_| )labs", detect_criteria.PigweedQu...
Matter all-clusters application running on Espressif ESP32 M5Stack platform: https://github.com/project-chip/connectedhomeip/tree/master/examples/all-clusters-app/esp32
random_line_split
esp32_matter_allclusters.py
# Copyright 2022 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, ...
@decorators.CapabilityDecorator(on_off_light.OnOffLightEndpoint) def on_off_light(self): """ZCL on_off light endpoint instance.""" return self.matter_endpoints.get(_ESP32_ON_OFF_LIGHT_ENDPOINT_ID) @decorators.CapabilityDecorator( color_temperature_light.ColorTemperatureLightEndpoint) def color_...
"""PwRPCWifi capability to send RPC commands.""" return self.lazy_init( pwrpc_wifi_default.PwRPCWifiDefault, device_name=self.name, switchboard_call=self.switchboard.call)
identifier_body
ListItem.d.ts
import * as React from 'react'; import { ExtendButtonBase } from '../ButtonBase'; import { OverridableComponent, OverrideProps } from '../OverridableComponent'; export interface ListItemTypeMap<P, D extends React.ElementType> { props: P & { /** * Defines the `align-items` style property. */ alignIt...
* for `ButtonBase` can then be applied to `ListItem`. */ button?: boolean; /** * The content of the component. If a `ListItemSecondaryAction` is used it must * be the last child. */ children?: React.ReactNode; /** * The container component used when a `ListItemSecondaryActi...
* Focus will also be triggered if the value changes from false to true. */ autoFocus?: boolean; /** * If `true`, the list item will be a button (using `ButtonBase`). Props intended
random_line_split
format.py
return self._subpipe.__exit__(*args, **kwargs) def __iter__(self): return iter(self._subpipe) class InputPipeProcessWrapper(object): def __init__(self, command, input_pipe=None): """ Initializes a InputPipeProcessWrapper instance. :param command: a subprocess.Popen i...
if self._input_pipe is not None: self._input_pipe.close() self._process.wait() # deadlock? if self._process.returncode not in (0, 141, 128 - 141): # 141 == 128 + 13 == 128 + SIGPIPE - normally processes exit with 128 + {reiceived SIG} # 128 - 141 == -13 == ...
os.remove(self._tmp_file)
random_line_split
format.py
return self._subpipe.__exit__(*args, **kwargs) def __iter__(self): return iter(self._subpipe) class InputPipeProcessWrapper(object): def __init__(self, command, input_pipe=None): """ Initializes a InputPipeProcessWrapper instance. :param command: a subprocess.Popen instance...
def close(self): self._finish() def __del__(self): self._finish() def __enter__(self): return self def _abort(self): """ Call _finish, but eat the exception (if any). """ try: self._finish() except KeyboardInterrupt: ...
self._process.stdout.close() if not self._original_input and os.path.exists(self._tmp_file): os.remove(self._tmp_file) if self._input_pipe is not None: self._input_pipe.close() self._process.wait() # deadlock? if self._process.returncode not in (0, 141, 128 - 1...
identifier_body
format.py
.SIGPIPE, signal.SIG_DFL) return subprocess.Popen(command, stdin=self._input_pipe, stdout=subprocess.PIPE, preexec_fn=subprocess_setup, close_fds=True) def _finish(self): ...
pipe_reader
identifier_name
format.py
return self._subpipe.__exit__(*args, **kwargs) def __iter__(self): return iter(self._subpipe) class InputPipeProcessWrapper(object): def __init__(self, command, input_pipe=None): """ Initializes a InputPipeProcessWrapper instance. :param command: a subprocess.Popen instance...
def __getattr__(self, name): if name == '_process': raise AttributeError(name) try: return getattr(self._process.stdout, name) except AttributeError: return getattr(self._input_pipe, name) def __iter__(self): for line in self._process.stdout...
self._finish()
conditional_block
modals.js
er une nouvelle semaine', noTemplate: 'Sélectionner d\'abord un modèle', defineTemplate: 'Modèle sélectionné', action: 'Créer une semaine', text: { top: 'Choisi une semaine, à laquelle sera appliquée le modèle :', bottom: 'Choisi un modèle de semaine :' } }, cancelTeam: { title: ...
toShift: 'Jusqu\'à l\'horaire', pages: { publisher: 'Proclamateur', items: 'Placement du proclamateur', occurrences: 'Évènements passés', store: 'Au sujet du stock', experiences: 'Tes expériences', prevPage: 'Aller à la page précédentes', nextPage: 'Aller à la page suiv...
expProblems: 'Mauvaise expérience', date: 'Date',
random_line_split
web_animations_driver.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 */ import {AnimationPlayer, ɵStyleData} from '@angular/animations'; import {allowPreviousPlayerStylesMerge, balancePrev...
const fill = delay == 0 ? 'both' : 'forwards'; const playerOptions: {[key: string]: string | number} = {duration, delay, fill}; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752) if (easing) { playerOp...
return this._cssKeyframesDriver.animate( element, keyframes, duration, delay, easing, previousPlayers); }
conditional_block
web_animations_driver.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 */ import {AnimationPlayer, ɵStyleData} from '@angular/animations'; import {allowPreviousPlayerStylesMerge, balancePrev...
element: any, selector: string, multi: boolean): any[] { return invokeQuery(element, selector, multi); } computeStyle(element: any, prop: string, defaultValue?: string): string { return (window.getComputedStyle(element) as any)[prop] as string; } overrideWebAnimationsSupport(supported: boolean) { this...
uery(
identifier_name
web_animations_driver.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 */ import {AnimationPlayer, ɵStyleData} from '@angular/animations'; import {allowPreviousPlayerStylesMerge, balancePrev...
let styles = player.currentSnapshot; Object.keys(styles).forEach(prop => previousStyles[prop] = styles[prop]); }); } keyframes = keyframes.map(styles => copyStyles(styles, false)); keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles); const specialSty...
const useKeyframes = !scrubberAccessRequested && !this._isNativeImpl; if (useKeyframes) { return this._cssKeyframesDriver.animate( element, keyframes, duration, delay, easing, previousPlayers); } const fill = delay == 0 ? 'both' : 'forwards'; const playerOptions: {[key: string]: str...
identifier_body
web_animations_driver.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 */ import {AnimationPlayer, ɵStyleData} from '@angular/animations'; import {allowPreviousPlayerStylesMerge, balancePrev...
if (easing) { playerOptions['easing'] = easing; } const previousStyles: {[key: string]: any} = {}; const previousWebAnimationPlayers = <WebAnimationsPlayer[]>previousPlayers.filter( player => player instanceof WebAnimationsPlayer); if (allowPreviousPlayerStylesMerge(duration, delay))...
const fill = delay == 0 ? 'both' : 'forwards'; const playerOptions: {[key: string]: string | number} = {duration, delay, fill}; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752)
random_line_split
CinematicCamera.js
import { Mesh, OrthographicCamera, PerspectiveCamera, PlaneGeometry, Scene, ShaderMaterial, UniformsUtils, WebGLRenderTarget } from 'three'; import { BokehShader } from '../shaders/BokehShader2.js'; import { BokehDepthShader } from '../shaders/BokehShader2.js'; class CinematicCamera extends PerspectiveCamera ...
( x ) { return Math.max( 0, Math.min( 1, x ) ); } // function for focusing at a distance from the camera focusAt( focusDistance = 20 ) { const focalLength = this.getFocalLength(); // distance from the camera (normal to frustrum) to focus on this.focus = focusDistance; // the nearest point from the ca...
saturate
identifier_name
CinematicCamera.js
import { Mesh, OrthographicCamera, PerspectiveCamera, PlaneGeometry, Scene, ShaderMaterial, UniformsUtils, WebGLRenderTarget } from 'three'; import { BokehShader } from '../shaders/BokehShader2.js'; import { BokehDepthShader } from '../shaders/BokehShader2.js'; class CinematicCamera extends PerspectiveCamera ...
const zfar = this.far; const znear = this.near; return - zfar * znear / ( depth * ( zfar - znear ) - zfar ); } smoothstep( near, far, depth ) { const x = this.saturate( ( depth - near ) / ( far - near ) ); return x * x * ( 3 - 2 * x ); } saturate( x ) { return Math.max( 0, Math.min( 1, x ) ); } ...
} linearize( depth ) {
random_line_split
CinematicCamera.js
import { Mesh, OrthographicCamera, PerspectiveCamera, PlaneGeometry, Scene, ShaderMaterial, UniformsUtils, WebGLRenderTarget } from 'three'; import { BokehShader } from '../shaders/BokehShader2.js'; import { BokehDepthShader } from '../shaders/BokehShader2.js'; class CinematicCamera extends PerspectiveCamera ...
this.postprocessing.bokeh_uniforms[ 'fstop' ].value = 2.8; this.postprocessing.bokeh_uniforms[ 'showFocus' ].value = 1; this.postprocessing.bokeh_uniforms[ 'focalDepth' ].value = 0.1; //console.log( this.postprocessing.bokeh_uniforms[ "focalDepth" ].value ); this.postprocessing.bokeh_uniforms[ 'znea...
{ this.postprocessing.scene = new Scene(); this.postprocessing.camera = new OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, - 10000, 10000 ); this.postprocessing.scene.add( this.postprocessing.camera ); this.postprocessing.rtTextureDe...
conditional_block
CinematicCamera.js
import { Mesh, OrthographicCamera, PerspectiveCamera, PlaneGeometry, Scene, ShaderMaterial, UniformsUtils, WebGLRenderTarget } from 'three'; import { BokehShader } from '../shaders/BokehShader2.js'; import { BokehDepthShader } from '../shaders/BokehShader2.js'; class CinematicCamera extends PerspectiveCamera ...
saturate( x ) { return Math.max( 0, Math.min( 1, x ) ); } // function for focusing at a distance from the camera focusAt( focusDistance = 20 ) { const focalLength = this.getFocalLength(); // distance from the camera (normal to frustrum) to focus on this.focus = focusDistance; // the nearest point ...
{ const x = this.saturate( ( depth - near ) / ( far - near ) ); return x * x * ( 3 - 2 * x ); }
identifier_body
errors.rs
/* Copyright 2017 Takashi Ogura 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...
See the License for the specific language governing permissions and limitations under the License. */ use std::io; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("Error: {:?}", error)] Other { error: String }, #[error("IOError: {:?}", source)] IoError { #[from] ...
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
random_line_split
errors.rs
/* Copyright 2017 Takashi Ogura 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...
(error: String) -> Error { Error::Other { error } } }
from
identifier_name
pipeline.js
/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ 'use strict'; /* global createProcessedMediaStreamTrack */ // defined in main.js /** * Wrappe...
else { await this.maybeStartPipeline_(); } } /** * Sets a new sink for the pipeline. * @param {!MediaStreamSink} mediaStreamSink */ async updateSink(mediaStreamSink) { if (this.sink_) this.sink_.destroy(); this.sink_ = mediaStreamSink; console.log( '[Pipeline] Updated sink...
{ await this.frameTransform_.init(); }
conditional_block
pipeline.js
/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ 'use strict'; /* global createProcessedMediaStreamTrack */ // defined in main.js /**
* Wrapper around createProcessedMediaStreamTrack to apply transform to a * MediaStream. * @param {!MediaStream} sourceStream the video stream to be transformed. The * first video track will be used. * @param {!FrameTransformFn} transform the transform to apply to the * sourceStream. * @param {!AbortSigna...
random_line_split
pipeline.js
/* * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ 'use strict'; /* global createProcessedMediaStreamTrack */ // defined in main.js /** * Wrappe...
(mediaStreamSource) { if (this.source_) { this.abortController_.abort(); this.abortController_ = new AbortController(); this.source_.destroy(); this.processedStream_ = null; } this.source_ = mediaStreamSource; this.source_.setDebugPath('debug.pipeline.source_'); console.log( ...
updateSource
identifier_name
Reduce.py
# coding : utf-8 #file: Reduce.py import os,os.path,re def Reduce(sourceFoler,targetFile): tempData = {} #缓存列表 p_re = re.compile(r'(.*?)(\d{1,}$)',re.IGNORECASE) #用正则表达式解析数据 for root,dirs,files in os.walk(sourceFolder): for fil in files: if fil.endswith('_map.txt'): #判断是reduce文件 sFile = open(o...
for key,value in sorted(tempData.items(),key = lambda k:k[1],reverse = True): tList.append(key + ' ' + str(value) + '\n' ) tFilename = os.path.join(sourceFolder,targetFile + '_reduce.txt') tFile = open(tFilename,'a+') #创建小文件 tFile.writelines(tList) #将列表保存到文件中 tFile.close() if __name__ == '__mai...
tList = []
random_line_split
Reduce.py
# coding : utf-8 #file: Reduce.py import os,os.path,re def Reduce(sourceFoler,targetFile): tempData = {} #缓存列表 p_re = re.compile(r'(.*?)(\d{1,}$)',re.IGNORECASE) #用正则表达式解析数据 for root,dirs,files in os.walk(sourceFolder): for fil in files: if fil.endswith('_map.txt'): #判断是reduce文件 sFile = open(o...
items(),key = lambda k:k[1],reverse = True): tList.append(key + ' ' + str(value) + '\n' ) tFilename = os.path.join(sourceFolder,targetFile + '_reduce.txt') tFile = open(tFilename,'a+') #创建小文件 tFile.writelines(tList) #将列表保存到文件中 tFile.close() if __name__ == '__main__': Reduce ('access','access')
f subdata[0][0] in tempData: tempData[subdata[0][0]] += int(subdata[0][1]) else: tempData[subdata[0][0]] = int(subdata[0][1]) dataLine = sFile.readline() #读入下一行数据 sFile.close() tList = [] for key,value in sorted(tempData.
conditional_block
Reduce.py
# coding : utf-8 #file: Reduce.py import os,os.path,re def Reduce(sourceFoler,targetFile):
tList.append(key + ' ' + str(value) + '\n' ) tFilename = os.path.join(sourceFolder,targetFile + '_reduce.txt') tFile = open(tFilename,'a+') #创建小文件 tFile.writelines(tList) #将列表保存到文件中 tFile.close() if __name__ == '__main__': Reduce ('access','access')
tempData = {} #缓存列表 p_re = re.compile(r'(.*?)(\d{1,}$)',re.IGNORECASE) #用正则表达式解析数据 for root,dirs,files in os.walk(sourceFolder): for fil in files: if fil.endswith('_map.txt'): #判断是reduce文件 sFile = open(os.path.abspath(os.path.join(root,fil)),'r') dataLine = sFile.readline() while dat...
identifier_body
Reduce.py
# coding : utf-8 #file: Reduce.py import os,os.path,re def
(sourceFoler,targetFile): tempData = {} #缓存列表 p_re = re.compile(r'(.*?)(\d{1,}$)',re.IGNORECASE) #用正则表达式解析数据 for root,dirs,files in os.walk(sourceFolder): for fil in files: if fil.endswith('_map.txt'): #判断是reduce文件 sFile = open(os.path.abspath(os.path.join(root,fil)),'r') dataLine = sFile.re...
Reduce
identifier_name
MLS_scraper_4.py
from urllib.request import urlopen from bs4 import BeautifulSoup import time # time will allow a delay in program execution # added 2 time delays: One for each page while scraping the URLs, # and one for each page while scraping the text about each player # also added get_text() in the get_player_details() function ...
(html, bsObj): global player_list tag_list = bsObj.findAll( "a", {"class":"row_link"} ) for tag in tag_list: if 'href' in tag.attrs: player_list.append(str(tag.attrs['href'])) # else: # f.write("no href\n") # delay program for 1 second time.sleep(1) get_n...
get_player_pages
identifier_name
MLS_scraper_4.py
from urllib.request import urlopen from bs4 import BeautifulSoup import time # time will allow a delay in program execution # added 2 time delays: One for each page while scraping the URLs, # and one for each page while scraping the text about each player # also added get_text() in the get_player_details() function ...
# collect all the URLs get_player_pages(html, bsObj) # collect text from each player detail page get_player_details(player_list) p.close()
new_url = "http://www.mlssoccer.com" + player html = urlopen(new_url) bsObj = BeautifulSoup(html, "html.parser") title = (bsObj.find( "div", {"class":"title"} )) print(title.get_text()) # # delay program for 2 seconds time.sleep(2)
conditional_block
MLS_scraper_4.py
from urllib.request import urlopen from bs4 import BeautifulSoup import time # time will allow a delay in program execution # added 2 time delays: One for each page while scraping the URLs, # and one for each page while scraping the text about each player # also added get_text() in the get_player_details() function ...
def get_player_details(player_list): for player in player_list: new_url = "http://www.mlssoccer.com" + player html = urlopen(new_url) bsObj = BeautifulSoup(html, "html.parser") title = (bsObj.find( "div", {"class":"title"} )) print(title.get_text()) # # delay progra...
global player_list tag_list = bsObj.findAll( "a", {"class":"row_link"} ) for tag in tag_list: if 'href' in tag.attrs: player_list.append(str(tag.attrs['href'])) # else: # f.write("no href\n") # delay program for 1 second time.sleep(1) get_next_page(html, bsOb...
identifier_body
MLS_scraper_4.py
from urllib.request import urlopen from bs4 import BeautifulSoup import time # time will allow a delay in program execution # added 2 time delays: One for each page while scraping the URLs, # and one for each page while scraping the text about each player # also added get_text() in the get_player_details() function ...
# collect text from each player detail page get_player_details(player_list) p.close()
# collect all the URLs get_player_pages(html, bsObj)
random_line_split
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { InMemoryWebApiModule } from 'angular-in-memory-web-api'; import { InMemoryDataService } from './in-memory-data.service'...
{ }
AppModule
identifier_name
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { InMemoryWebApiModule } from 'angular-in-memory-web-api'; import { InMemoryDataService } from './in-memory-data.service'...
}) export class AppModule { }
providers: [HeroService], bootstrap: [AppComponent]
random_line_split
TextInput.test.js
import React from 'react'; import userEvent from '@testing-library/user-event'; import { render, screen } from '@testing-library/react'; import TextInput from './TextInput'; let clearErrorsCallback, setDataCallback; beforeEach(() => { clearErrorsCallback = jest.fn(); setDataCallback = jest.fn(); }); describe('...
const calls = setDataCallback.mock.calls; expect(clearErrorsCallback).toHaveBeenCalledTimes(2); expect(setDataCallback).toHaveBeenCalledTimes(2); expect(calls[0]).toEqual(['text_input_test', 'h']); expect(calls[1]).toEqual(['text_input_test', 'i']); }); });
random_line_split
uicomponents.py
#!/usr/bin/env python # 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, software...
Component = namedtuple('Component', ['iOS', 'Android']) LABEL = Component(iOS='//XCUIElementTypeStaticText[{}]', Android='//android.widget.TextView[{}]') BUTTON = Component(iOS='//XCUIElementTypeButton[{}]', Android='//android.widget.Button[{}]') TEXTFIELD = Component(iOS='//XCUIElementTypeTextField[{}]', ...
identifier_body
uicomponents.py
#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License");
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing pe...
# you may not use this file except in compliance with the License. # You may obtain a copy of the License at #
random_line_split
uicomponents.py
#!/usr/bin/env python # 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, software...
: # named tuple to hold two xPath values for each platform Component = namedtuple('Component', ['iOS', 'Android']) LABEL = Component(iOS='//XCUIElementTypeStaticText[{}]', Android='//android.widget.TextView[{}]') BUTTON = Component(iOS='//XCUIElementTypeButton[{}]', Android='//android.widget.Button[{}...
UIComponents
identifier_name
037.rs
use std::str::FromStr; fn read_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).expect("Could not read stdin!"); input } fn read_one<F>() -> F where F: FromStr { read_line().trim().parse().ok().unwrap() } fn main() {
let mut prime = vec![true; limit]; prime[0] = false; prime[1] = false; // Sieve of Eratosthenes to find primes for p in 2 .. limit { if prime[p] { let mut multiple = 2 * p; while multiple < limit { prime[multiple] = false; multiple += p; } } } let mut right_truncat...
let limit = read_one::<usize>();
random_line_split
037.rs
use std::str::FromStr; fn read_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).expect("Could not read stdin!"); input } fn read_one<F>() -> F where F: FromStr { read_line().trim().parse().ok().unwrap() } fn main() { let limit = read_one::<usize>(); let mut prim...
} let mut right_truncatable = prime.clone(); let mut left_truncatable = prime.clone(); // For the algorithm we'll assume one digit primes to be truncatable for p in 10 .. limit { right_truncatable[p] &= right_truncatable[p / 10]; left_truncatable[p] &= left_truncatable[p % 10usize.pow((p as f64).log...
{ let mut multiple = 2 * p; while multiple < limit { prime[multiple] = false; multiple += p; } }
conditional_block
037.rs
use std::str::FromStr; fn read_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).expect("Could not read stdin!"); input } fn read_one<F>() -> F where F: FromStr { read_line().trim().parse().ok().unwrap() } fn
() { let limit = read_one::<usize>(); let mut prime = vec![true; limit]; prime[0] = false; prime[1] = false; // Sieve of Eratosthenes to find primes for p in 2 .. limit { if prime[p] { let mut multiple = 2 * p; while multiple < limit { prime[multiple] = false; multiple += p; ...
main
identifier_name
037.rs
use std::str::FromStr; fn read_line() -> String
fn read_one<F>() -> F where F: FromStr { read_line().trim().parse().ok().unwrap() } fn main() { let limit = read_one::<usize>(); let mut prime = vec![true; limit]; prime[0] = false; prime[1] = false; // Sieve of Eratosthenes to find primes for p in 2 .. limit { if prime[p] { let mut multiple ...
{ let mut input = String::new(); std::io::stdin().read_line(&mut input).expect("Could not read stdin!"); input }
identifier_body
locate_project.rs
use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, human, ChainError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; #[derive(RustcDecodable)] struct LocateProjectFlags { flag_manifest_path: Option<String>, } pub const USAGE: &'static str = " Usage: cargo locate-project [opt...
{ root: String } pub fn execute(flags: LocateProjectFlags, _: &mut MultiShell) -> CliResult<Option<ProjectLocation>> { let root = try!(find_root_manifest_for_cwd(flags.flag_manifest_path)); let string = try!(root.as_str() .chain_error(|| human("Your project path conta...
ProjectLocation
identifier_name
locate_project.rs
use cargo::core::MultiShell; use cargo::util::{CliResult, CliError, human, ChainError}; use cargo::util::important_paths::{find_root_manifest_for_cwd}; #[derive(RustcDecodable)] struct LocateProjectFlags { flag_manifest_path: Option<String>, } pub const USAGE: &'static str = " Usage: cargo locate-project [opt...
Ok(Some(ProjectLocation { root: string.to_string() })) }
random_line_split
list-snapshots.mock.ts
export const request = { "headers": { "Content-Type": "application/json", }, }; export const response = { "body": { "snapshots": [ { "id": '6372321', "name": "5.10 x64", "regions": [ "nyc1", "ams1", "sfo1", "nyc2", ...
], "created_at": "2014-09-26T16:40:18Z", "resource_id": 2713828, "resource_type": "droplet", "min_disk_size": 20, "size_gigabytes": 1.42, "tags": [ ] } ], "links": { "pages": { "last": "https://api.dig...
random_line_split
render_context.rs
use std::collections::{HashMap}; use std::path::{Path}; use std::sync::{Arc}; use crossbeam::sync::{MsQueue}; use glium::backend::{Facade}; use debug::{gnomon, indicator}; use inverse_kinematics::{Chain}; use model::{Model}; use unlit_model::{UnlitModel}; use render::render_frame::{RenderFrame}; pub const DEPTH_DIM...
} // TODO: don't pass in chains but make something like IntoModel // fn load_initial_models<F: Facade>(facade: &F, ik_chains: &[Chain]) -> HashMap<ModelId, Arc<Model>> { let mut map = HashMap::new(); const MODEL_PATH_STRINGS: [(ModelId, &'static str); 3] = [ (ModelId::Player, "./data/player.obj"), (ModelId::Sc...
{ (self.window_size.0 as f32) / (self.window_size.1 as f32) }
identifier_body
render_context.rs
use std::collections::{HashMap}; use std::path::{Path}; use std::sync::{Arc}; use crossbeam::sync::{MsQueue}; use glium::backend::{Facade}; use debug::{gnomon, indicator}; use inverse_kinematics::{Chain}; use model::{Model}; use unlit_model::{UnlitModel}; use render::render_frame::{RenderFrame}; pub const DEPTH_DIM...
<F: Facade>(facade: &F, q: Arc<MsQueue<RenderFrame>>, window_size: (u32, u32), ik_chains: &[Chain]) -> RenderContext { let model_map = load_initial_models(facade, ik_chains); // DEBUG let mut unlit_models = HashMap::new(); unlit_models.insert(ModelId::Gnomon, Arc::new(gnomon::model(facade))); unlit_models.in...
new
identifier_name
render_context.rs
use std::collections::{HashMap}; use std::path::{Path}; use std::sync::{Arc}; use crossbeam::sync::{MsQueue}; use glium::backend::{Facade}; use debug::{gnomon, indicator}; use inverse_kinematics::{Chain}; use model::{Model}; use unlit_model::{UnlitModel}; use render::render_frame::{RenderFrame}; pub const DEPTH_DIM...
unlit_models.insert(ModelId::Indicator, Arc::new(indicator::model(facade))); RenderContext { q: q, window_size: window_size, models: model_map, // DEBUG unlit_models: unlit_models, } } pub fn aspect_ratio(&self) -> f32 { (self.window_size.0 as f32) / (self.window_size.1 as f32) } } // TODO...
random_line_split
q_networks.py
#!/usr/bin/python import numpy as np import os import sys from keras.layers import Activation, Dense, Input from keras.layers.normalization import BatchNormalization from keras.models import Model, Sequential from keras.optimizers import RMSprop NUM_OF_HIDDEN_NEURONS = 100 QNETWORK_NAME = 'online_netw...
(self): weights = self.online_net.get_weights() for i in xrange(len(weights)): np.savetxt(QNETWORK_NAME+'/'+QNETWORK_NAME+str(i)+'.txt', weights[i]) weights = self.target_net.get_weights() for i in xrange(len(weights)): np.savetxt(TARGETNET_NAME+'/'+TARGET...
save_models
identifier_name
q_networks.py
#!/usr/bin/python import numpy as np import os import sys from keras.layers import Activation, Dense, Input from keras.layers.normalization import BatchNormalization from keras.models import Model, Sequential from keras.optimizers import RMSprop NUM_OF_HIDDEN_NEURONS = 100 QNETWORK_NAME = 'online_netw...
return self.online_net.get_weights() def init_model(self, net_name): model = Sequential() model.add(Dense(self.NUM_OF_HIDDEN_NEURONS, input_shape=(self.NUM_OF_STATES,))) model.add(Activation('relu')) model.add(Dense(self.NUM_OF_HIDDEN_NEURONS)) model.add(A...
def get_weights(self): # get weights of the online Q network
random_line_split
q_networks.py
#!/usr/bin/python import numpy as np import os import sys from keras.layers import Activation, Dense, Input from keras.layers.normalization import BatchNormalization from keras.models import Model, Sequential from keras.optimizers import RMSprop NUM_OF_HIDDEN_NEURONS = 100 QNETWORK_NAME = 'online_netw...
return model def save_models(self): weights = self.online_net.get_weights() for i in xrange(len(weights)): np.savetxt(QNETWORK_NAME+'/'+QNETWORK_NAME+str(i)+'.txt', weights[i]) weights = self.target_net.get_weights() for i in xrange(len(weights)): ...
print 'No model', filename, 'found. Creating a new model.'
conditional_block
q_networks.py
#!/usr/bin/python import numpy as np import os import sys from keras.layers import Activation, Dense, Input from keras.layers.normalization import BatchNormalization from keras.models import Model, Sequential from keras.optimizers import RMSprop NUM_OF_HIDDEN_NEURONS = 100 QNETWORK_NAME = 'online_netw...
def init_model(self, net_name): model = Sequential() model.add(Dense(self.NUM_OF_HIDDEN_NEURONS, input_shape=(self.NUM_OF_STATES,))) model.add(Activation('relu')) model.add(Dense(self.NUM_OF_HIDDEN_NEURONS)) model.add(Activation('relu')) model.add(Dens...
return self.online_net.get_weights()
identifier_body
build.rs
// // Copyright 2022 The Project Oak Authors // // 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 o...
{ generate_grpc_code( "../", &["oak_functions/proto/streaming_server.proto"], CodegenOptions { build_client: true, build_server: true, ..Default::default() }, )?; Ok(()) }
identifier_body
build.rs
// // Copyright 2022 The Project Oak Authors // // 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 o...
..Default::default() }, )?; Ok(()) }
&["oak_functions/proto/streaming_server.proto"], CodegenOptions { build_client: true, build_server: true,
random_line_split
build.rs
// // Copyright 2022 The Project Oak Authors // // 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 o...
() -> Result<(), Box<dyn std::error::Error>> { generate_grpc_code( "../", &["oak_functions/proto/streaming_server.proto"], CodegenOptions { build_client: true, build_server: true, ..Default::default() }, )?; Ok(()) }
main
identifier_name
fixunoproj.js
var fusepm = require('./fusepm'); module.exports = fixunoproj; function
() { var fn = fusepm.local_unoproj("."); fusepm.read_unoproj(fn).then(function (obj) { var inc = []; if (obj.Includes) { var re = /\//; for (var i=0; i<obj.Includes.length;i++) { if (obj.Includes[i] === '*') { inc.push('./*.ux'); inc.push('./*.uno'); inc.push('./*.uxl'); } else i...
fixunoproj
identifier_name
fixunoproj.js
var fusepm = require('./fusepm'); module.exports = fixunoproj; function fixunoproj () { var fn = fusepm.local_unoproj("."); fusepm.read_unoproj(fn).then(function (obj) { var inc = []; if (obj.Includes) { var re = /\//; for (var i=0; i<obj.Includes.length;i++) { if (obj.Includes[i] === '*') { inc....
}).catch(function (e) { console.log(e); }); }
random_line_split