file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
build_and_test.py
#!/usr/bin/env python3 # Copyright 2014, 2016 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
(argv=sys.argv[1:]): parser = argparse.ArgumentParser( description='Invoke the build tool on a workspace while enabling and ' 'running the tests') parser.add_argument( '--rosdistro-name', required=True, help='The name of the ROS distro to identify the setup fi...
main
identifier_name
build_and_test.py
#!/usr/bin/env python3 # Copyright 2014, 2016 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
if parent_result_spaces is None: parent_result_spaces = ['/opt/ros/%s' % args.rosdistro_name] if args.build_tool == 'catkin_make_isolated': devel_space = os.path.join( args.workspace_root, 'devel_isolated') ...
# for workspaces with only plain cmake packages the setup files # generated by cmi won't implicitly source the underlays
random_line_split
result-bar-chart.component.ts
import { Component, Input, OnInit, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Subscription , timer} from "rxjs"; import { VULNERABILITY_SCAN_STATUS } from '../utils'; import { VulnerabilitySummary, TagService, ScanningResultService, Tag } from '../s...
(): string { return this.jobLogService.getScanJobBaseUrl() + "/" + this.summary.job_id + "/log"; } }
viewLog
identifier_name
result-bar-chart.component.ts
import { Component, Input, OnInit, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Subscription , timer} from "rxjs"; import { VULNERABILITY_SCAN_STATUS } from '../utils'; import { VulnerabilitySummary, TagService, ScanningResultService, Tag } from '../s...
) { } ngOnInit(): void { if (this.tagStatus === "running") { this.scanNow(); } this.scanSubscription = this.channel.scanCommand$.subscribe((tagId: string) => { let myFullTag: string = this.repoName + "/" + this.tagId; if (myFullTag === tagId) { ...
private channel: ChannelService, private ref: ChangeDetectorRef, private jobLogService: JobLogService,
random_line_split
result-bar-chart.component.ts
import { Component, Input, OnInit, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Subscription , timer} from "rxjs"; import { VULNERABILITY_SCAN_STATUS } from '../utils'; import { VulnerabilitySummary, TagService, ScanningResultService, Tag } from '../s...
getSummary(): void { if (!this.repoName || !this.tagId) { return; } this.tagService.getTag(this.repoName, this.tagId) .subscribe((t: Tag) => { // To keep the same summary reference, use value copy. this.copyValue(t.scan_overview); ...
{ if (this.onSubmitting) { // Avoid duplicated submitting return; } if (!this.repoName || !this.tagId) { return; } this.onSubmitting = true; this.scanningService.startVulnerabilityScanning(this.repoName, this.tagId) .subs...
identifier_body
result-bar-chart.component.ts
import { Component, Input, OnInit, OnDestroy, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Subscription , timer} from "rxjs"; import { VULNERABILITY_SCAN_STATUS } from '../utils'; import { VulnerabilitySummary, TagService, ScanningResultService, Tag } from '../s...
}); } copyValue(newVal: VulnerabilitySummary): void { if (!this.summary || !newVal || !newVal.scan_status) { return; } this.summary.scan_status = newVal.scan_status; this.summary.job_id = newVal.job_id; this.summary.severity = newVal.severity; this.summary.c...
{ // Stop timer if (this.stateCheckTimer) { this.stateCheckTimer.unsubscribe(); this.stateCheckTimer = null; } this.retryCounter = 0; }
conditional_block
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
(CMakePackage): """Ngmlr is a long-read mapper designed to align PacBilo or Oxford Nanopore to a reference genome with a focus on reads that span structural variations.""" homepage = "https://github.com/philres/ngmlr" url = "https://github.com/philres/ngmlr/archive/v0.2.5.tar.gz" ve...
Ngmlr
identifier_name
package.py
# Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack # Please also see the NOTICE and LICENSE files for our notice and the LGPL. # # This program ...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
random_line_split
package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
"""Ngmlr is a long-read mapper designed to align PacBilo or Oxford Nanopore to a reference genome with a focus on reads that span structural variations.""" homepage = "https://github.com/philres/ngmlr" url = "https://github.com/philres/ngmlr/archive/v0.2.5.tar.gz" version('0.2.5', '1b2b...
identifier_body
s3.py
import os import mimetypes import warnings try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.conf import settings from django.core.files.base import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured try: ...
(File): def __init__(self, name, storage, mode): self._name = name self._storage = storage self._mode = mode self._is_dirty = False self.file = StringIO() self.start_range = 0 @property def size(self): if not hasattr(self, '_size'): self._...
S3StorageFile
identifier_name
s3.py
import os import mimetypes import warnings try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.conf import settings from django.core.files.base import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured try: ...
def _open(self, name, mode='rb'): name = self._clean_name(name) remote_file = S3StorageFile(name, self, mode=mode) return remote_file def _read(self, name, start_range=None, end_range=None): name = self._clean_name(name) if start_range is None: headers = {} ...
random_line_split
s3.py
import os import mimetypes import warnings try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.conf import settings from django.core.files.base import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured try: ...
else: content_str = content.read() self._put_file(name, content_str) return name def delete(self, name): name = self._clean_name(name) response = self.connection.delete(self.bucket, name) if response.http_response.status != 204: raise IOError...
content_str = ''.join(chunk for chunk in content.chunks())
conditional_block
s3.py
import os import mimetypes import warnings try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.conf import settings from django.core.files.base import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured try: ...
def _save(self, name, content): name = self._clean_name(name) content.open() if hasattr(content, 'chunks'): content_str = ''.join(chunk for chunk in content.chunks()) else: content_str = content.read() self._put_file(name, content_str) return...
name = self._clean_name(name) if start_range is None: headers = {} else: headers = {'Range': 'bytes=%s-%s' % (start_range, end_range)} response = self.connection.get(self.bucket, name, headers) if response.http_response.status not in (200, 206): raise ...
identifier_body
test_utils.py
import jps import json import time class MessageHolder(object): def __init__(self): self._saved_msg = [] def __call__(self, msg): self._saved_msg.append(msg) def get_msg(self): return self._saved_msg def test_multi_pubsub_once(): holder1 = MessageHolder() holder2 = Mes...
# todo def test_to_obj_list(): msg = '["hoge", "hogi", {"atr1": "val2", "atr2": 1.0}]' bb = jps.utils.to_obj(msg) assert len(bb) == 2 assert bb[0] == 'hoge' assert bb[1] == 'hogi' assert bb[2].atr1 == 'val2' assert bb[2].atr2 == 1.0 # json = bb.to_json() # assert json == msg def t...
# assert json == msg
random_line_split
test_utils.py
import jps import json import time class MessageHolder(object): def __init__(self): self._saved_msg = [] def __call__(self, msg): self._saved_msg.append(msg) def get_msg(self): return self._saved_msg def test_multi_pubsub_once():
def test_to_obj(): msg = '{"aa": 1, "bb": ["hoge", "hogi"], "cc": {"cc1" : 50}}' converted = jps.utils.to_obj(msg) assert converted.aa == 1 assert converted.bb[0] == 'hoge' assert converted.bb[1] == 'hogi' assert len(converted.bb) == 2 assert converted.cc.cc1 == 50 # todo: do # ...
holder1 = MessageHolder() holder2 = MessageHolder() holder3 = MessageHolder() sub1 = jps.Subscriber('test_utils1', holder1) sub2 = jps.Subscriber('test_utils2', holder2) sub3 = jps.Subscriber('test_utils3', holder3) pub = jps.utils.JsonMultiplePublisher() time.sleep(0.1) pub.publish( ...
identifier_body
test_utils.py
import jps import json import time class MessageHolder(object): def __init__(self): self._saved_msg = [] def __call__(self, msg): self._saved_msg.append(msg) def get_msg(self): return self._saved_msg def test_multi_pubsub_once(): holder1 = MessageHolder() holder2 = Mes...
(): msg = '{"aa": 1, "cc": 3, "bb": 2}' converted = jps.utils.to_obj(msg) assert converted.aa == 1 assert converted.bb == 2 assert converted.cc == 3 # works only super simple case json1 = converted.to_json() assert json1 == msg
test_to_obj_simple
identifier_name
WeekPicker.tsx
import * as React from 'react'; import * as moment from 'moment'; import Calendar from 'rc-calendar';
function formatValue(value: moment.Moment | null, format: string): string { return (value && value.format(format)) || ''; } export default class WeekPicker extends React.Component<any, any> { static defaultProps = { format: 'YYYY-Wo', allowClear: true, }; private input: any; constructor(props: any)...
import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; import Icon from '../icon';
random_line_split
WeekPicker.tsx
import * as React from 'react'; import * as moment from 'moment'; import Calendar from 'rc-calendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; import Icon from '../icon'; function
(value: moment.Moment | null, format: string): string { return (value && value.format(format)) || ''; } export default class WeekPicker extends React.Component<any, any> { static defaultProps = { format: 'YYYY-Wo', allowClear: true, }; private input: any; constructor(props: any) { super(props);...
formatValue
identifier_name
super-invocation.test.ts
/* * SonarQube JavaScript Plugin * Copyright (C) 2011-2021 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3...
* You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { rule } from 'rules/super-invocation'; import { RuleTester } from 'eslint'; const rul...
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. *
random_line_split
run_transform_on_couchdb_docs.py
'''This allows running a bit of code on couchdb docs. code should take a json python object, modify it and hand back to the code Not quite that slick yet, need way to pass in code or make this a decorator ''' import importlib from harvester.collection_registry_client import Collection from harvester.couchdb_init import...
return True return False C_CACHE = {} def update_collection_description(doc): cjson = doc['originalRecord']['collection'][0] # get collection description if 'description' not in cjson: if cjson['@id'] in C_CACHE: c = C_CACHE[cjson['@id']] else: c = Colle...
random_line_split
run_transform_on_couchdb_docs.py
'''This allows running a bit of code on couchdb docs. code should take a json python object, modify it and hand back to the code Not quite that slick yet, need way to pass in code or make this a decorator ''' import importlib from harvester.collection_registry_client import Collection from harvester.couchdb_init import...
(func, collection_key=None): '''If collection_key is none, trying to grab all of docs and modify func is a function that takes a couchdb doc in and returns it modified. (can take long time - not recommended) Function should return new document or None if no changes made ''' _couchdb = get_couchd...
run_on_couchdb_by_collection
identifier_name
run_transform_on_couchdb_docs.py
'''This allows running a bit of code on couchdb docs. code should take a json python object, modify it and hand back to the code Not quite that slick yet, need way to pass in code or make this a decorator ''' import importlib from harvester.collection_registry_client import Collection from harvester.couchdb_init import...
else: c = Collection(url_api=cjson['@id']) C_CACHE[cjson['@id']] = c doc['originalRecord']['collection'][0]['rights_status'] = c['rights_status'] doc['originalRecord']['collection'][0]['rights_statement'] = c['rights_statement'] doc['originalRecord']['collection'][0]['dcmi_type']=c['dcm...
c = C_CACHE[cjson['@id']]
conditional_block
run_transform_on_couchdb_docs.py
'''This allows running a bit of code on couchdb docs. code should take a json python object, modify it and hand back to the code Not quite that slick yet, need way to pass in code or make this a decorator ''' import importlib from harvester.collection_registry_client import Collection from harvester.couchdb_init import...
cjson = doc['originalRecord']['collection'][0] # get collection description if cjson['@id'] in C_CACHE: c = C_CACHE[cjson['@id']] else: c = Collection(url_api=cjson['@id']) C_CACHE[cjson['@id']] = c doc['originalRecord']['collection'][0]['rights_status'] = c['rights_status'] ...
identifier_body
performancepainttiming.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
fn new_inherited(metric_type: PaintMetricType, start_time: f64) -> PerformancePaintTiming { let name = match metric_type { PaintMetricType::FirstPaint => DOMString::from("first-paint"), PaintMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"), ...
impl PerformancePaintTiming {
random_line_split
performancepainttiming.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
}
{ let entry = PerformancePaintTiming::new_inherited(metric_type, start_time); reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap) }
identifier_body
performancepainttiming.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
(global: &GlobalScope, metric_type: PaintMetricType, start_time: f64) -> DomRoot<PerformancePaintTiming> { let entry = PerformancePaintTiming::new_inherited(metric_type, start_time); reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap) } }
new
identifier_name
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
storage.push(to_write); continuation = true; if cur == 0 { break; } } storage.reverse(); storage } // Write a variable length value. Return number of bytes written. pub fn write_vtime(val: u64, writer: &mut dyn Write) -> Result<u32,Error> { ...
{ // we're writing a continuation byte, so set the bit to_write |= cont_mask; }
conditional_block
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
let mut writer = SMFWriter::new_with_division_and_format (smf.format, smf.division); for track in smf.tracks.iter() { let mut length = 0; let mut saw_eot = false; let mut vec = Vec::new(); writer.start_track_header(&mut vec); for ...
} /// Create a writer that has all the tracks from the given SMF already added pub fn from_smf(smf: SMF) -> SMFWriter {
random_line_split
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
(val: u64, writer: &mut dyn Write) -> Result<u32,Error> { let storage = SMFWriter::vtime_to_vec(val); writer.write_all(&storage[..])?; Ok(storage.len() as u32) } fn start_track_header(&self, vec: &mut Vec<u8>) { vec.push(0x4D); vec.push(0x54); vec.push(0x72); ...
write_vtime
identifier_name
wysiwygs.js
"use strict"; /* global global: false */ var tinymce = require("tinymce"); var $ = require("jquery"); var ko = require("knockout"); var console = require("console"); require("./eventable.js"); ko.bindingHandlers.wysiwygOrHtml = { init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext)...
isEditorChange = true; // we failed with other ways to do this: // value($(element).html()); // value(element.innerHTML); var content = editor.getContent({ format: 'raw' }).trim(); //console.log('setup:',content); ...
// listening on keyup would increase correctness but we would need a rateLimit to avoid flooding. editor.on('change redo undo', function() { if (!isSubscriberChange) {
random_line_split
workletglobalscope.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 devtools_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; use dom::bindings::root...
.evaluate_js_on_global_with_result(&*script, rval.handle_mut()) } /// Register a paint worklet to the script thread. pub fn register_paint_worklet(&self, name: Atom, properties: Vec<Atom>, painter: Box<Painter>) { self.to_script_thread_sender .send(MainThreadScriptMsg::Regis...
debug!("Evaluating Dom."); rooted!(in (self.globalscope.get_cx()) let mut rval = UndefinedValue()); self.globalscope
random_line_split
workletglobalscope.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 devtools_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; use dom::bindings::root...
(&self) -> ServoUrl { self.base_url.clone() } /// The worklet executor. pub fn executor(&self) -> WorkletExecutor { self.executor.clone() } /// Perform a worklet task pub fn perform_a_worklet_task(&self, task: WorkletTask) { match task { WorkletTask::Test(ta...
base_url
identifier_name
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
(ticks_per_second: u32) { let events_thread = ticker(ticks_per_second, true); let _ = events_thread.join(); } pub fn ticker(ticks_per_second: u32, sleep: bool) -> thread::JoinHandle<()> { let step = Duration::from_secs(1) / ticks_per_second; let mut last_tick = Instant::now(); thread::spawn(move || { loop { ...
run
identifier_name
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
else { tick::trigger(step); events::next_tick(); last_tick = Instant::now(); events::run_events(); } } }) }
{ if sleep { thread::sleep(Duration::from_millis(1)); } }
conditional_block
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
{ let step = Duration::from_secs(1) / ticks_per_second; let mut last_tick = Instant::now(); thread::spawn(move || { loop { let current_time = Instant::now(); let next_tick = last_tick + step; if next_tick > current_time { if sleep { thread::sleep(Duration::from_millis(1)); } } else { ...
identifier_body
lib.rs
#![feature(type_macros)] //! # Goal //!
//! to systems. //! //! We want to define systems that operate on lists of components, are //! triggered by other systems through events. //! //! # Implementation //! //! For each component type there will be a list that is a tuple of an //! entity ID and the component values. There will also be a map from //! entity ...
//! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available
random_line_split
fixForgottenThisPropertyAccess.ts
/* @internal */ namespace ts.codefix { const fixId = "forgottenThisPropertyAccess"; const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; const errorCodes = [ Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, ...
(context) { const { sourceFile } = context; const info = getInfo(sourceFile, context.span.start, context.errorCode); if (!info) { return undefined; } const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, inf...
getCodeActions
identifier_name
fixForgottenThisPropertyAccess.ts
/* @internal */ namespace ts.codefix { const fixId = "forgottenThisPropertyAccess"; const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; const errorCodes = [ Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, ...
}
{ // TODO (https://github.com/Microsoft/TypeScript/issues/21246): use shared helper suppressLeadingAndTrailingTrivia(node); changes.replaceNode(sourceFile, node, createPropertyAccess(className ? createIdentifier(className) : createThis(), node)); }
identifier_body
fixForgottenThisPropertyAccess.ts
/* @internal */ namespace ts.codefix { const fixId = "forgottenThisPropertyAccess"; const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; const errorCodes = [ Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, ...
}
random_line_split
ccode.py
replacing='qwertyuiopasdfghjklzxcvbnm )([]\/{}!@#$%^&*' a='\/abcdefghijklmnopqrstuvwxyz() }{][*%$&^#@!' replacing=list(replacing) a=list(a) d={} e={} if len(replacing)==len(a): for x in range(len(a)): d[replacing[x]]=a[x] e[a[x]]=replacing[x] def encypt(dict,stri...
def decypt(dict,string): 'uncode' decode=[] for x in string: decode.append(dict[x]) return ''.join(decode) if __name__=='__main__': c=input('code:') code=encypt(e,c) decode=decypt(d,c) ...
'code' code=[] for x in string: code.append(dict[x]) return ''.join(code)
identifier_body
ccode.py
replacing='qwertyuiopasdfghjklzxcvbnm )([]\/{}!@#$%^&*' a='\/abcdefghijklmnopqrstuvwxyz() }{][*%$&^#@!' replacing=list(replacing) a=list(a) d={} e={} if len(replacing)==len(a): for x in range(len(a)): d[replacing[x]]=a[x] e[a[x]]=replacing[x] def encypt(dict,stri...
return ''.join(code) def decypt(dict,string): 'uncode' decode=[] for x in string: decode.append(dict[x]) return ''.join(decode) if __name__=='__main__': c=input('code:') code=encypt(e,c) decod...
code.append(dict[x])
conditional_block
ccode.py
replacing='qwertyuiopasdfghjklzxcvbnm )([]\/{}!@#$%^&*' a='\/abcdefghijklmnopqrstuvwxyz() }{][*%$&^#@!' replacing=list(replacing) a=list(a) d={} e={} if len(replacing)==len(a): for x in range(len(a)): d[replacing[x]]=a[x] e[a[x]]=replacing[x] def encypt(dict,stri...
c=input('code:') code=encypt(e,c) decode=decypt(d,c) print('encypts to',code) print('decypt to',decode) input()
random_line_split
ccode.py
replacing='qwertyuiopasdfghjklzxcvbnm )([]\/{}!@#$%^&*' a='\/abcdefghijklmnopqrstuvwxyz() }{][*%$&^#@!' replacing=list(replacing) a=list(a) d={} e={} if len(replacing)==len(a): for x in range(len(a)): d[replacing[x]]=a[x] e[a[x]]=replacing[x] def
(dict,string): 'code' code=[] for x in string: code.append(dict[x]) return ''.join(code) def decypt(dict,string): 'uncode' decode=[] for x in string: decode.append(dict[x]) return ''.join(decode) if __name__=='__main__': ...
encypt
identifier_name
edt_stats.py
# -*-coding:Utf-8 -* # Copyright (c) 2010 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # l...
): """Message d'accueil""" msg = \ "Entrez le |ent|nom|ff| de la stat, un signe |ent|/|ff| " \ "et la valeur pour modifier une stat.\nExemple : |cmd|force / " \ "45|ff|\n\nEntrez |ent|/|ff| pour revenir à la fenêtre parente\n\n" stats = self.objet msg ...
il(self
identifier_name
edt_stats.py
# -*-coding:Utf-8 -* # Copyright (c) 2010 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # l...
# this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior wri...
random_line_split
edt_stats.py
# -*-coding:Utf-8 -* # Copyright (c) 2010 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # l...
else: # Convertion try: valeur = int(valeur) assert valeur > 0 assert valeur >= stat.marge_min assert valeur <= stat.marge_max except (ValueError, AssertionError): sel...
e << "|err|Cette stat est introuvable.|ff|"
conditional_block
edt_stats.py
# -*-coding:Utf-8 -* # Copyright (c) 2010 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # l...
def interpreter(self, msg): """Interprétation du message""" try: nom_stat, valeur = msg.split(" / ") except ValueError: self.pere << "|err|Syntaxe invalide.|ff|" else: # On cherche la stat stat = None for t_stat in self.objet...
ssage d'accueil""" msg = \ "Entrez le |ent|nom|ff| de la stat, un signe |ent|/|ff| " \ "et la valeur pour modifier une stat.\nExemple : |cmd|force / " \ "45|ff|\n\nEntrez |ent|/|ff| pour revenir à la fenêtre parente\n\n" stats = self.objet msg += "+-" + "-" * ...
identifier_body
test_parse_mnist_fvec.py
import unittest import random, sys, time, re sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def
(cls): # assume we're at 0xdata with it's hdfs namenode h2o.init(java_heap_GB=14) @classmethod def tearDownClass(cls): h2o.tear_down_cloud() def test_parse_mnist_A_training(self): importFolderPath = "mnist" csvFilelist = [ ("mnist_training.csv.gz", 600),...
setUpClass
identifier_name
test_parse_mnist_fvec.py
import unittest import random, sys, time, re sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): # ...
trial = 0 allDelta = [] for (csvFilename, timeoutSecs) in csvFilelist: testKey2 = csvFilename + "_" + str(trial) + ".hex" start = time.time() parseResult = h2i.import_parse(bucket='home-0xdiag-datasets', path=importFolderPath+"/"+csvFilename, ...
("mnist_training.csv.gz", 600), ]
random_line_split
test_parse_mnist_fvec.py
import unittest import random, sys, time, re sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf class Basic(unittest.TestCase): def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): # ...
h2o.unit_main()
conditional_block
test_parse_mnist_fvec.py
import unittest import random, sys, time, re sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf class Basic(unittest.TestCase):
if __name__ == '__main__': h2o.unit_main()
def tearDown(self): h2o.check_sandbox_for_errors() @classmethod def setUpClass(cls): # assume we're at 0xdata with it's hdfs namenode h2o.init(java_heap_GB=14) @classmethod def tearDownClass(cls): h2o.tear_down_cloud() def test_parse_mnist_A_training(self): ...
identifier_body
regex_route_param_spec.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 {describe, it, iit, ddescribe, expect, inject, beforeEach,} from '@angular/core/testing/testing_internal'; i...
3 group names are expected.`); }); it('should take group naming into account when passing params', () => { var rec = new RegexRoutePath( '^a-([0-9]+)-b-([0-9]+)$', emptySerializer, ['complete_match', 'a', 'b']); var url = parser.parse('a-123-b-345'); var match = rec.matchUrl(url); ...
group and a name for the complete match as its first element of regex '^a-([0-9]+)-b-([0-9]+)$'. \
random_line_split
regex_route_param_spec.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 {describe, it, iit, ddescribe, expect, inject, beforeEach,} from '@angular/core/testing/testing_internal'; i...
{ describe('RegexRoutePath', () => { it('should throw when given an invalid regex', () => { expect(() => new RegexRoutePath('[abc', emptySerializer)).toThrowError(); }); it('should parse a single param using capture groups', () => { var rec = new RegexRoutePath('^(.+)$', emptySerializer); ...
identifier_body
regex_route_param_spec.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 {describe, it, iit, ddescribe, expect, inject, beforeEach,} from '@angular/core/testing/testing_internal'; i...
(params: any /** TODO #9100 */) { return new GeneratedUrl('', {}); } export function main() { describe('RegexRoutePath', () => { it('should throw when given an invalid regex', () => { expect(() => new RegexRoutePath('[abc', emptySerializer)).toThrowError(); }); it('should parse a single param usin...
emptySerializer
identifier_name
darwin.py
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008...
# Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
posix.generate(env) env['SHLIBSUFFIX'] = '.dylib' env['ENV']['PATH'] = env['ENV']['PATH'] + ':/sw/bin'
identifier_body
darwin.py
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008...
(env): posix.generate(env) env['SHLIBSUFFIX'] = '.dylib' env['ENV']['PATH'] = env['ENV']['PATH'] + ':/sw/bin' # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
generate
identifier_name
darwin.py
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008...
def generate(env): posix.generate(env) env['SHLIBSUFFIX'] = '.dylib' env['ENV']['PATH'] = env['ENV']['PATH'] + ':/sw/bin' # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
random_line_split
logging-http-interceptor.ts
import 'rxjs/add/operator/do'; import { HttpErrorResponse, HttpInterceptor } from '@angular/common/http'; import { HttpEvent, HttpEventType, HttpHandler, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Logger } from '../elec...
}
{ this.logger.log(`Http | ${req.method} (begin) - ${req.url}`); const start = Date.now(); return next.handle(req).do({ next: (event: HttpEvent<any>) => { if (event.type === HttpEventType.Response) { const duration = Date.now() - start; ...
identifier_body
logging-http-interceptor.ts
import 'rxjs/add/operator/do'; import { HttpErrorResponse, HttpInterceptor } from '@angular/common/http'; import { HttpEvent, HttpEventType, HttpHandler, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Logger } from '../elec...
} }); } }
{ this.logger.error(`Http | ${req.method} (error) - ${error.url} - ${error.statusText} - took ${duration}ms`); }
conditional_block
logging-http-interceptor.ts
import 'rxjs/add/operator/do'; import { HttpErrorResponse, HttpInterceptor } from '@angular/common/http'; import { HttpEvent, HttpEventType, HttpHandler, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Logger } from '../elec...
} } }); } }
random_line_split
logging-http-interceptor.ts
import 'rxjs/add/operator/do'; import { HttpErrorResponse, HttpInterceptor } from '@angular/common/http'; import { HttpEvent, HttpEventType, HttpHandler, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Logger } from '../elec...
implements HttpInterceptor { constructor(private logger: Logger) { } intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { this.logger.log(`Http | ${req.method} (begin) - ${req.url}`); const start = Date.now(); return next.handle(req).do({ n...
LoggingHttpInterceptor
identifier_name
Limbgrower.js
import { useBackend, useSharedState } from '../backend'; import { Box, Button, Dimmer, Icon, LabeledList, Section, Tabs } from '../components'; import { Window } from '../layouts'; export const Limbgrower = (props, context) => { const { act, data } = useBackend(context); const { reagents = [], total_reagen...
{reagent.name}: {reagent.amount}u </Box> ))} </LabeledList.Item> ))} </LabeledList> </Section> </Window.Content> </Window> ); };
<Box key={reagent.name}>
random_line_split
encodings.rs
// preprocessing pub const PRG_CONTRADICTORY_OBS: &str = include_str!("encodings/contradictory_obs.lp"); pub const PRG_GUESS_INPUTS: &str = include_str!("encodings/guess_inputs.lp"); // minimal inconsistent cores pub const PRG_MICS: &str = include_str!("encodings/mics.lp"); // basic sign consistency pub const PRG_SIG...
input(E,\"unknown\") :- exp(E). vertex(\"unknown\"). elabel(\"unknown\", V,1) :- addeddy(V). :- addeddy(U), addeddy(V),U!=V."; pub const PRG_BEST_EDGE_START: &str = " % guess one edge start to add 0{addedge(or(V),X,1); addedge(or(V),X,-1)}1 :- vertex(or(V)), edge_end(X). % add only one edge !!! :- addedge(Y1,X,...
0{addeddy(or(V))} :- vertex(or(V)). % new inputs through repair
random_line_split
linspace_test.py
# Copyright 2020 The IREE Authors # # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception from absl import app from iree.tf.support import tf_test_utils import numpy as np import tensorflow.co...
def main(argv): del argv # Unused if hasattr(tf, 'enable_v2_behavior'): tf.enable_v2_behavior() tf.test.main() if __name__ == '__main__': app.run(main)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._modules = tf_test_utils.compile_tf_module(LinspaceModule) def test_linspace(self): def linspace(module): start = np.array(10., dtype=np.float32) stop = np.array(12., dtype=np.float32) module.linspace(start, st...
identifier_body
linspace_test.py
# Copyright 2020 The IREE Authors # # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception from absl import app from iree.tf.support import tf_test_utils import numpy as np import tensorflow.co...
tf.test.main() if __name__ == '__main__': app.run(main)
tf.enable_v2_behavior()
conditional_block
linspace_test.py
# Copyright 2020 The IREE Authors # # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception from absl import app from iree.tf.support import tf_test_utils import numpy as np import tensorflow.co...
(module): start = np.array(10., dtype=np.float32) stop = np.array(12., dtype=np.float32) module.linspace(start, stop) self.compare_backends(linspace, self._modules) def main(argv): del argv # Unused if hasattr(tf, 'enable_v2_behavior'): tf.enable_v2_behavior() tf.test.main() if __n...
linspace
identifier_name
linspace_test.py
# Copyright 2020 The IREE Authors # # Licensed under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception from absl import app from iree.tf.support import tf_test_utils import numpy as np import tensorflow.co...
self.compare_backends(linspace, self._modules) def main(argv): del argv # Unused if hasattr(tf, 'enable_v2_behavior'): tf.enable_v2_behavior() tf.test.main() if __name__ == '__main__': app.run(main)
stop = np.array(12., dtype=np.float32) module.linspace(start, stop)
random_line_split
deltaPriority.ts
import Debug from 'debug' const debug = Debug('signalk-server:sourcepriorities') type Brand<K, T> = K & { __brand: T } type Context = Brand<string, 'context'> type SourceRef = Brand<string, 'sourceRef'> type Path = Brand<string, 'path'> interface SourcePriority { sourceRef: SourceRef timeout: number } export in...
const latestPrecedence = pathPrecedences.get(latest.sourceRef) || HIGHESTPRECEDENCE const incomingPrecedence = pathPrecedences.get(sourceRef) || LOWESTPRECEDENCE const latestIsFromHigherPrecedence = latestPrecedence.precedence < incomingPrecedence.precedence const isPreferred = ...
{ return true }
conditional_block
deltaPriority.ts
import Debug from 'debug' const debug = Debug('signalk-server:sourcepriorities') type Brand<K, T> = K & { __brand: T } type Context = Brand<string, 'context'> type SourceRef = Brand<string, 'sourceRef'> type Path = Brand<string, 'path'> interface SourcePriority { sourceRef: SourceRef timeout: number } export in...
return acc2 }, new Map<SourceRef, SourcePrecedenceData>() ) acc.set(path as Path, priorityIndices) return acc }, new Map<Path, PathPrecedences>() ) export const getToPreferredDelta = ( sourcePrioritiesData: SourcePrioritiesData, unknownSourceTimeout: number = 1...
})
random_line_split
vcpu_model.py
# 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 # d...
return cls.obj_from_primitive(jsonutils.loads(db_extra['vcpu_model'])) @base.NovaObjectRegistry.register class VirtCPUFeature(base.NovaObject): VERSION = '1.0' fields = { 'policy': fields.CPUFeaturePolicyField(nullable=True), 'name': fields.StringField(nullable=False), } def...
return None
conditional_block
vcpu_model.py
# 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 # d...
(self, attrname): setattr(self, attrname, None) def to_json(self): return jsonutils.dumps(self.obj_to_primitive()) @classmethod def from_json(cls, jsonstr): return cls.obj_from_primitive(jsonutils.loads(jsonstr)) @base.remotable_classmethod def get_by_instance_uuid(cls, co...
obj_load_attr
identifier_name
vcpu_model.py
# 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 # d...
@base.NovaObjectRegistry.register class VirtCPUFeature(base.NovaObject): VERSION = '1.0' fields = { 'policy': fields.CPUFeaturePolicyField(nullable=True), 'name': fields.StringField(nullable=False), } def obj_load_attr(self, attrname): setattr(self, attrname, None)
db_extra = db.instance_extra_get_by_instance_uuid( context, instance_uuid, columns=['vcpu_model']) if not db_extra or not db_extra['vcpu_model']: return None return cls.obj_from_primitive(jsonutils.loads(db_extra['vcpu_model']))
identifier_body
vcpu_model.py
# 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 # d...
return cls.obj_from_primitive(jsonutils.loads(jsonstr)) @base.remotable_classmethod def get_by_instance_uuid(cls, context, instance_uuid): db_extra = db.instance_extra_get_by_instance_uuid( context, instance_uuid, columns=['vcpu_model']) if not db_extra or not db_extra['...
def from_json(cls, jsonstr):
random_line_split
form.spec.ts
import { TestComponentBuilder, describe, expect, injectAsync, it, beforeEachProviders
import {Component, provide} from 'angular2/core'; import {DOM} from 'angular2/src/platform/dom/dom_adapter'; import {FormPage} from './form'; export function main() { beforeEachProviders(() => [ RouteRegistry, provide(Location, {useClass: SpyLocation}), provide(ROUTER_PRIMARY_COMPONENT, {useValue: FormP...
} from 'angular2/testing'; import {Location, Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT} from 'angular2/router'; import {SpyLocation} from 'angular2/src/mock/location_mock'; import {RootRouter} from 'angular2/src/router/router';
random_line_split
form.spec.ts
import { TestComponentBuilder, describe, expect, injectAsync, it, beforeEachProviders } from 'angular2/testing'; import {Location, Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT} from 'angular2/router'; import {SpyLocation} from 'angular2/src/mock/location_mock'; import {RootRouter} from 'angular2/src/rout...
@Component({ selector: 'test-cmp', directives: [FormPage], template: '<form></form>' }) class TestComponent {}
{ beforeEachProviders(() => [ RouteRegistry, provide(Location, {useClass: SpyLocation}), provide(ROUTER_PRIMARY_COMPONENT, {useValue: FormPage}), provide(Router, {useClass: RootRouter}) ]); describe('form component', () => { it('should work', injectAsync([TestComponentBuilder], (tcb: Te...
identifier_body
form.spec.ts
import { TestComponentBuilder, describe, expect, injectAsync, it, beforeEachProviders } from 'angular2/testing'; import {Location, Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT} from 'angular2/router'; import {SpyLocation} from 'angular2/src/mock/location_mock'; import {RootRouter} from 'angular2/src/rout...
() { beforeEachProviders(() => [ RouteRegistry, provide(Location, {useClass: SpyLocation}), provide(ROUTER_PRIMARY_COMPONENT, {useValue: FormPage}), provide(Router, {useClass: RootRouter}) ]); describe('form component', () => { it('should work', injectAsync([TestComponentBuilder], (tcb:...
main
identifier_name
state.js
module["exports"] = [ "Agrigento", "Alessandria", "Ancona", "Aosta", "Arezzo", "Ascoli Piceno", "Asti", "Avellino", "Bari", "Barletta-Andria-Trani", "Belluno", "Benevento", "Bergamo", "Biella", "Bologna", "Bolzano",
"Brindisi", "Cagliari", "Caltanissetta", "Campobasso", "Carbonia-Iglesias", "Caserta", "Catania", "Catanzaro", "Chieti", "Como", "Cosenza", "Cremona", "Crotone", "Cuneo", "Enna", "Fermo", "Ferrara", "Firenze", "Foggia", "Forlì-Cesena", "Frosinone", "Genova", "Gorizia", "G...
"Brescia",
random_line_split
MenuScript.js
#pragma strict /// <summary> /// Title screen script /// </summary> private var skin : GUISkin; function Start() { // Load a skin for the buttons skin = Resources.Load("GUISkin") as GUISkin; } function On
{ var buttonWidth : int = 128; var buttonHeight : int = 60; // Set the skin to use GUI.skin = skin; // Draw a button to start the game if (GUI.Button( // Center in X, 2/3 of the height in Y new Rect(Screen.width / 2 - (buttonWidth / 2), (2 * Screen.height / 3) - (buttonHeight / 2), buttonWidth, b...
GUI()
identifier_name
MenuScript.js
#pragma strict /// <summary> /// Title screen script
/// </summary> private var skin : GUISkin; function Start() { // Load a skin for the buttons skin = Resources.Load("GUISkin") as GUISkin; } function OnGUI() { var buttonWidth : int = 128; var buttonHeight : int = 60; // Set the skin to use GUI.skin = skin; // Draw a button to start the game if (GUI.Button(...
random_line_split
MenuScript.js
#pragma strict /// <summary> /// Title screen script /// </summary> private var skin : GUISkin; function Start() {
function OnGUI() { var buttonWidth : int = 128; var buttonHeight : int = 60; // Set the skin to use GUI.skin = skin; // Draw a button to start the game if (GUI.Button( // Center in X, 2/3 of the height in Y new Rect(Screen.width / 2 - (buttonWidth / 2), (2 * Screen.height / 3) - (buttonHeight / 2), ...
// Load a skin for the buttons skin = Resources.Load("GUISkin") as GUISkin; }
identifier_body
MenuScript.js
#pragma strict /// <summary> /// Title screen script /// </summary> private var skin : GUISkin; function Start() { // Load a skin for the buttons skin = Resources.Load("GUISkin") as GUISkin; } function OnGUI() { var buttonWidth : int = 128; var buttonHeight : int = 60; // Set the skin to use GUI.skin = skin...
// On Click, load the first level. Application.LoadLevel("GameScene"); // "Stage1" is the scene name } }
conditional_block
index.js
/* * Vibe * http://vibe-project.github.io/projects/vibe-protocol/ * * Copyright 2014 The Vibe Project * Licensed under the Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0
// Defines the module module.exports = { // Creates a vibe socket and establishes a connection to the server. open: require("./socket"), // Creates a vibe server. createServer: require("./server"), // Defines Transport module. transport: { // Creates a HTTP transport server. crea...
*/
random_line_split
bndstx.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn
() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 27, 28, ...
bndstx_1
identifier_name
bndstx.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn bndstx_1()
fn bndstx_2() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(RDI, RBX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &...
{ run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 27, 28, 14]...
identifier_body
bndstx.rs
use ::Reg::*; use ::RegScale::*; fn bndstx_1() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, ...
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*;
random_line_split
GXRA.py
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref ### endblock ClassImports ### block Header # NOTICE: The code generator will not replace the code in this block ### end...
**License:** `Geosoft Open License <https://geosoftgxdev.atlassian.net/wiki/spaces/GD/pages/2359406/License#License-open-lic>`_ """ ret_val = self._len() return ret_val def line(self): """ Returns current line #, 0 is the first :returns: The c...
random_line_split
GXRA.py
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref ### endblock ClassImports ### block Header # NOTICE: The code generator will not replace the code in this block ### end...
def len(self): """ Returns the total number of lines in `GXRA <geosoft.gxapi.GXRA>` :returns: # of lines in the `GXRA <geosoft.gxapi.GXRA>`. :rtype: int .. versionadded:: 5.0 **License:** `Geosoft Open License <https://geosoftgxdev.atlassian.n...
""" Get next full line from `GXRA <geosoft.gxapi.GXRA>` :param strbuff: Buffer in which to place string :type strbuff: str_ref :returns: 0 - Ok 1 - End of file :rtype: int .. versionadded:: 5.0 **License:** `...
identifier_body
GXRA.py
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref ### endblock ClassImports ### block Header # NOTICE: The code generator will not replace the code in this block ### end...
(cls, sbf, file): """ Creates `GXRA <geosoft.gxapi.GXRA>` on an `GXSBF <geosoft.gxapi.GXSBF>` :param sbf: Storage :param file: Name of the file :type sbf: GXSBF :type file: str :returns: `GXRA <geosoft.gxapi.GXRA>` Object :rtype: ...
create_sbf
identifier_name
sample_control.py
#! /usr/bin/env python """ Sample for python PCSC wrapper module: send a Control Code to a card or reader __author__ = "Ludovic Rousseau" Copyright 2007-2010 Ludovic Rousseau Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr This file is part of pyscard. pyscard is free software; you can redistribute it and...
for zreader in readers: print('Trying to Control reader:', zreader) try: hresult, hcard, dwActiveProtocol = SCardConnect( hcontext, zreader, SCARD_SHARE_DIRECT, SCARD_PROTOCOL_T0) if hresult != SCARD_S_SUCCESS: r...
raise error('No smart card readers')
conditional_block
sample_control.py
#! /usr/bin/env python """ Sample for python PCSC wrapper module: send a Control Code to a card or reader __author__ = "Ludovic Rousseau" Copyright 2007-2010 Ludovic Rousseau Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr
pyscard is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. pyscard is distributed in the hope that it will be useful, but WITHOUT ANY ...
This file is part of pyscard.
random_line_split
__init__.py
import Globals from Products.ZenModel.ZenPack import ZenPack as ZenPackBase from Products.ZenUtils.Utils import unused, zenPath import os unused(Globals) _plugins = [ 'rig_host_app_transform1.py', 'copy_server_config_file.sh', ] class ZenPack(ZenPackBase): def install(self, app): super(Zen...
(self): libexec = os.path.join(os.environ.get('ZENHOME'), 'libexec') if not os.path.isdir(libexec): # Stack installs might not have a \$ZENHOME/libexec directory. os.mkdir(libexec) # Now get the path to the file in the ZenPack's libexec directory filepath = __fil...
symlink_plugins
identifier_name
__init__.py
import Globals
from Products.ZenUtils.Utils import unused, zenPath import os unused(Globals) _plugins = [ 'rig_host_app_transform1.py', 'copy_server_config_file.sh', ] class ZenPack(ZenPackBase): def install(self, app): super(ZenPack, self).install(app) self.symlink_plugins() def symlink_plug...
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
random_line_split
__init__.py
import Globals from Products.ZenModel.ZenPack import ZenPack as ZenPackBase from Products.ZenUtils.Utils import unused, zenPath import os unused(Globals) _plugins = [ 'rig_host_app_transform1.py', 'copy_server_config_file.sh', ] class ZenPack(ZenPackBase): def install(self, app): super(Zen...
def remove(self, app, leaveObjects=False): if not leaveObjects: self.remove_plugin_symlinks() super(ZenPack, self).remove(app, leaveObjects=leaveObjects)
os.system('rm -f "%s"' % zenPath('libexec', plugin))
conditional_block
__init__.py
import Globals from Products.ZenModel.ZenPack import ZenPack as ZenPackBase from Products.ZenUtils.Utils import unused, zenPath import os unused(Globals) _plugins = [ 'rig_host_app_transform1.py', 'copy_server_config_file.sh', ] class ZenPack(ZenPackBase): def install(self, app):
def symlink_plugins(self): libexec = os.path.join(os.environ.get('ZENHOME'), 'libexec') if not os.path.isdir(libexec): # Stack installs might not have a \$ZENHOME/libexec directory. os.mkdir(libexec) # Now get the path to the file in the ZenPack's libexec directory...
super(ZenPack, self).install(app) self.symlink_plugins()
identifier_body
admin.js
jQuery(document).ready(function($) { // languages form // fills the fields based on the language dropdown list choice $('#lang_list').change(function() { value = $(this).val().split('-'); selected = $("select option:selected").text().split(' - '); $('#lang_slug').val(value[0]); $('#lang_locale').val(value[1]...
var value = $(this).val(); pll_toggle($('#pll-domains-table'), 3 == value); pll_toggle($("#pll-hide-default"), 3 > value); pll_toggle($("#pll-detect-browser"), 3 > value); pll_toggle($("#pll-rewrite"), 2 > value); pll_toggle($("#pll-url-complements"), 3 > value || $("input[name='redirect_lang']").size())...
{ test ? a.show() : a.hide(); }
identifier_body
admin.js
jQuery(document).ready(function($) { // languages form // fills the fields based on the language dropdown list choice $('#lang_list').change(function() { value = $(this).val().split('-'); selected = $("select option:selected").text().split(' - '); $('#lang_slug').val(value[0]); $('#lang_locale').val(value[1]...
pll_toggle($("#pll-url-complements"), 3 > value || $("input[name='redirect_lang']").size()); }); });
random_line_split
admin.js
jQuery(document).ready(function($) { // languages form // fills the fields based on the language dropdown list choice $('#lang_list').change(function() { value = $(this).val().split('-'); selected = $("select option:selected").text().split(' - '); $('#lang_slug').val(value[0]); $('#lang_locale').val(value[1]...
(a, test) { test ? a.show() : a.hide(); } var value = $(this).val(); pll_toggle($('#pll-domains-table'), 3 == value); pll_toggle($("#pll-hide-default"), 3 > value); pll_toggle($("#pll-detect-browser"), 3 > value); pll_toggle($("#pll-rewrite"), 2 > value); pll_toggle($("#pll-url-complements"), 3 > val...
pll_toggle
identifier_name
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NotUnderstood { pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String { String::from("NOT_UNDERSTOOD") } } impl PartialEq for NotUnders...
// Assert assert_eq!(name, "NOT_UNDERSTOOD"); } #[test] fn test_asoutgoing() { // Arrange let message = NotUnderstood { path: vec![] }; let message_ref = message.clone(); // Act let outgoing = message.as_outgoing(); // Assert assert...
let name = message.name();
random_line_split
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NotUnderstood { pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String
} impl PartialEq for NotUnderstood { fn eq(&self, other: &Self) -> bool { self.path == other.path } } #[cfg(test)] mod tests { use super::*; #[test] fn test_name() { // Arrange let message = NotUnderstood { path: vec![] }; // Act let name = message.name()...
{ String::from("NOT_UNDERSTOOD") }
identifier_body
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct
{ pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String { String::from("NOT_UNDERSTOOD") } } impl PartialEq for NotUnderstood { fn eq(&self, other: &Self) -> bool { self.path == other.path } } #[cfg(test)] mod tests { use super::*; #[test] ...
NotUnderstood
identifier_name