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
backend.memory.js
this.recline = this.recline || {}; this.recline.Backend = this.recline.Backend || {}; this.recline.Backend.Memory = this.recline.Backend.Memory || {}; (function(my, recline) { "use strict"; my.__type__ = 'memory'; // private data - use either jQuery or Underscore Deferred depending on what is available var De...
return (_.indexOf(terms, value) >= 0); } function range(record, filter) { var fromnull = (_.isUndefined(filter.from) || filter.from === null || filter.from === ''); var tonull = (_.isUndefined(filter.to) || filter.to === null || filter.to === ''); var parse = getDataParser(f...
random_line_split
utils.py
#-*- coding: utf-8 -*- #既存のフロールールを全て一旦削除 #それらのフロールールで指定していたMatchにIPアドレス情報(サブネット)を追加 #mitigate時はなんでもPacket-Inするルールは不要なので削除したまま #mitigate後はなんでもPacket-Inするルールから突っ込んでいく import logging import socket import struct import ipaddress #packet_in_handlerにて、受け取ったパケットのipv4がsubnetに属するか調べるのに必要 def is_ipv4_belongs_to_network(ipv4, n...
ipv4 = ipaddress.ip_address(ipv4) ipv4_network = ipaddress.ip_network(cidr.decode("utf-8")) return ipv4 in ipv4_network
identifier_body
utils.py
#-*- coding: utf-8 -*- #既存のフロールールを全て一旦削除 #それらのフロールールで指定していたMatchにIPアドレス情報(サブネット)を追加 #mitigate時はなんでもPacket-Inするルールは不要なので削除したまま #mitigate後はなんでもPacket-Inするルールから突っ込んでいく import logging import socket import struct import ipaddress #packet_in_handlerにて、受け取ったパケットのipv4がsubnetに属するか調べるのに必要 def is_ipv4_belongs_to_network(ipv4, n...
cidr_value}".format(**locals()) #check ipv4 = ipaddress.ip_address(ipv4) ipv4_network = ipaddress.ip_network(cidr.decode("utf-8")) return ipv4 in ipv4_network
') cidr = "{network}/{
identifier_name
utils.py
#-*- coding: utf-8 -*- #既存のフロールールを全て一旦削除 #それらのフロールールで指定していたMatchにIPアドレス情報(サブネット)を追加 #mitigate時はなんでもPacket-Inするルールは不要なので削除したまま #mitigate後はなんでもPacket-Inするルールから突っ込んでいく import logging import socket import struct
# netmask -> CIDR network, netmask = network network_address = socket.inet_pton(socket.AF_INET, netmask) cidr_value = bin(struct.unpack('!L', network_address)[0])[2:].index('0') cidr = "{network}/{cidr_value}".format(**locals()) #check ipv4 = ipaddress.ip_address(ipv4) ipv4_network = ip...
import ipaddress #packet_in_handlerにて、受け取ったパケットのipv4がsubnetに属するか調べるのに必要 def is_ipv4_belongs_to_network(ipv4, network):
random_line_split
_password-reset-finish.component.spec.ts
import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; import { MockBackend } from '@angular/http/testing'; import { Http, BaseRequestOptions } from '@angular/http'; import { Renderer, ElementRef } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { LoginModalService } f...
let node = { focus() {} }; elementRef.nativeElement = element; spyOn(element, 'querySelector').and.returnValue(node); spyOn(node, 'focus'); comp.ngAfterViewInit(); expect(element.queryS...
random_line_split
_password-reset-finish.component.spec.ts
import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; import { MockBackend } from '@angular/http/testing'; import { Http, BaseRequestOptions } from '@angular/http'; import { Renderer, ElementRef } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { LoginModalService } f...
}; elementRef.nativeElement = element; spyOn(element, 'querySelector').and.returnValue(node); spyOn(node, 'focus'); comp.ngAfterViewInit(); expect(element.querySelector).toHaveBeenCalledWith('#password'); ...
{}
identifier_body
_password-reset-finish.component.spec.ts
import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; import { MockBackend } from '@angular/http/testing'; import { Http, BaseRequestOptions } from '@angular/http'; import { Renderer, ElementRef } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { LoginModalService } f...
() {} }; elementRef.nativeElement = element; spyOn(element, 'querySelector').and.returnValue(node); spyOn(node, 'focus'); comp.ngAfterViewInit(); expect(element.querySelector).toHaveBeenCalledWith('#password'); ...
focus
identifier_name
JSConsol.js
/*Made by *** for learning perpouses Feel free to use it as you see fit. */ var JSConsol; function Cr
{ JSConsol = function Consol() { /*create stack of functions w8 for input*/ var awaitInputStack = new Array(); /*create execution list*/ var execList = new Array(); /*create body*/ var consol = document.createElement('div'); ; (function () { ...
eateConsol()
identifier_name
JSConsol.js
/*Made by *** for learning perpouses Feel free to use it as you see fit. */ var JSConsol; function CreateConsol() { JSConsol = function Consol() { /*create stack of functions w8 for input*/ var awaitInputStack = new Array(); /*create execution list*/ var execList = new Array();...
/*Use this function to load your script*/ function loadSrcipt(src) { execList.unshift(src); } return { 'readLine': readLine, 'readLineFN': readLineFN, 'writeLine': writeLine, 'write': write, 'loadSrcipt': loadSrcipt ...
awaitInputStack.push(func); input.focus(); };
identifier_body
JSConsol.js
/*Made by *** for learning perpouses Feel free to use it as you see fit. */ var JSConsol; function CreateConsol() { JSConsol = function Consol() { /*create stack of functions w8 for input*/ var awaitInputStack = new Array(); /*create execution list*/ var execList = new Array();...
input.style.width = "100%"; input.style.fontFamily = "Consolas"; input.style.outlineWidth = '0'; input.style.margin = 0; input.style.padding = 0; input.style.fontFamily = "consolas"; input.style.fontSize = '1em'; consol.appe...
random_line_split
JSConsol.js
/*Made by *** for learning perpouses Feel free to use it as you see fit. */ var JSConsol; function CreateConsol() { JSConsol = function Consol() { /*create stack of functions w8 for input*/ var awaitInputStack = new Array(); /*create execution list*/ var execList = new Array();...
} } }()); /*private function*/ function readLine(message) { var result = window.prompt(message ? message : "PLease enter your data:",""); outputText.innerHTML += (message ? message : "PLease enter your data:") ...
var parameter = input.value; input.value = ""; writeLine(parameter); awaitInputStack.pop()(parameter); }
conditional_block
script.js
define([ "clientcore", "clientajax" ], function( jQuery ) { // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function( te...
} }; } }); });
callback(); }
random_line_split
script.js
define([ "clientcore", "clientajax" ], function( jQuery ) { // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function( te...
if ( s.crossDomain ) { s.type = "GET"; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, callback; return { send: function( _, complete ) { script = jQuery("<script>").prop...
{ s.cache = false; }
conditional_block
SBDraft2CommandInputParameterModel.ts
import {CommandInputParameter} from "../../mappings/d2sb/CommandInputParameter"; import {CommandInputRecordField} from "../../mappings/d2sb/CommandInputRecordField"; import {Expression} from "../../mappings/d2sb/Expression"; import {CommandInputParameterModel} from "../generic/CommandInputParameterModel"; import {Param...
this.isField = !!(<CommandInputRecordField> input).name; // record fields don't have ids this.isField ? serializedAttr.push("name") : serializedAttr.push("id"); if ((<CommandInputParameter> input).id && (<CommandInputParameter> input).id.charAt(0) === "#") { this.id = (<CommandInput...
const serializedAttr = ["label", "description", "inputBinding", "type", "sbg:fileTypes"]; input = input || <CommandInputParameter | CommandInputRecordField>{};
random_line_split
SBDraft2CommandInputParameterModel.ts
import {CommandInputParameter} from "../../mappings/d2sb/CommandInputParameter"; import {CommandInputRecordField} from "../../mappings/d2sb/CommandInputRecordField"; import {Expression} from "../../mappings/d2sb/Expression"; import {CommandInputParameterModel} from "../generic/CommandInputParameterModel"; import {Param...
else { base.id = this.id ? "#" + this.id : ""; return <CommandInputParameter> base; } } deserialize(input: CommandInputParameter | CommandInputRecordField): void { const serializedAttr = ["label", "description", "inputBinding", "type", "sbg:fileTypes"]; input =...
{ base.name = this.id; return <CommandInputRecordField> base; }
conditional_block
SBDraft2CommandInputParameterModel.ts
import {CommandInputParameter} from "../../mappings/d2sb/CommandInputParameter"; import {CommandInputRecordField} from "../../mappings/d2sb/CommandInputRecordField"; import {Expression} from "../../mappings/d2sb/Expression"; import {CommandInputParameterModel} from "../generic/CommandInputParameterModel"; import {Param...
(): SBDraft2CommandLineBindingModel { this.inputBinding = new SBDraft2CommandLineBindingModel({}, `${this.loc}.inputBinding`, this.eventHub); this.inputBinding.setValidationCallback(err => this.updateValidity(err)); return this.inputBinding; } addSecondaryFile(file: Expression | string)...
createInputBinding
identifier_name
test_obs_block.py
import datetime from ecl.util.util import BoolVector from ecl.util.test import TestAreaContext from tests import ResTest from res.enkf import ObsBlock class ObsBlockTest(ResTest): def test_create(self): block = ObsBlock("OBS" , 1000) self.assertTrue( isinstance( block , ObsBlock )) sel...
(self): obs_size = 10 block = ObsBlock("OBS" , obs_size) with self.assertRaises(IndexError): block[100] = (1,1) with self.assertRaises(IndexError): block[-100] = (1,1) with self.assertRaises(TypeError): block[4] = 10 with self.asser...
test_access
identifier_name
test_obs_block.py
import datetime from ecl.util.util import BoolVector from ecl.util.test import TestAreaContext from tests import ResTest from res.enkf import ObsBlock class ObsBlockTest(ResTest):
with self.assertRaises(TypeError): block[4] = (1,1,9) #------ with self.assertRaises(IndexError): v = block[100] with self.assertRaises(IndexError): v = block[-100] block[0] = (10,1) v = block[0] self.assertEqual( v , (10,1...
def test_create(self): block = ObsBlock("OBS" , 1000) self.assertTrue( isinstance( block , ObsBlock )) self.assertEqual( 1000 , block.totalSize()) self.assertEqual( 0 , block.activeSize()) def test_access(self): obs_size = 10 block = ObsBlock("OBS" , obs_size) ...
identifier_body
test_obs_block.py
import datetime from ecl.util.util import BoolVector from ecl.util.test import TestAreaContext from tests import ResTest from res.enkf import ObsBlock class ObsBlockTest(ResTest): def test_create(self): block = ObsBlock("OBS" , 1000) self.assertTrue( isinstance( block , ObsBlock )) sel...
block = ObsBlock("OBS" , obs_size) with self.assertRaises(IndexError): block[100] = (1,1) with self.assertRaises(IndexError): block[-100] = (1,1) with self.assertRaises(TypeError): block[4] = 10 with self.assertRaises(TypeError): ...
def test_access(self): obs_size = 10
random_line_split
debug.rs
use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use crate::arch::debug::Writer; use crate::event; use crate::scheme::*; use crate::sync::WaitQueue; use crate::syscall::flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}; use crate::sysca...
() -> RwLockReadGuard<'static, BTreeMap<usize, Handle>> { HANDLES.call_once(init_handles).read() } fn handles_mut() -> RwLockWriteGuard<'static, BTreeMap<usize, Handle>> { HANDLES.call_once(init_handles).write() } /// Add to the input queue pub fn debug_input(data: u8) { INPUT.call_once(init_input).send(d...
handles
identifier_name
debug.rs
use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use crate::arch::debug::Writer; use crate::event; use crate::scheme::*; use crate::sync::WaitQueue; use crate::syscall::flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}; use crate::sysca...
else { Err(Error::new(EBADF)) } } fn fevent(&self, id: usize, _flags: EventFlags) -> Result<EventFlags> { let _handle = { let handles = handles(); *handles.get(&id).ok_or(Error::new(EBADF))? }; Ok(EventFlags::empty()) } fn fpath(&se...
{ match cmd { F_GETFL => Ok(handle.flags), F_SETFL => { handle.flags = arg & ! O_ACCMODE; Ok(0) }, _ => Err(Error::new(EINVAL)) } }
conditional_block
debug.rs
use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use crate::arch::debug::Writer; use crate::event; use crate::scheme::*; use crate::sync::WaitQueue; use crate::syscall::flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}; use crate::sysca...
/// Write the `buffer` to the `file` /// /// Returns the number of bytes written fn write(&self, id: usize, buf: &[u8]) -> Result<usize> { let _handle = { let handles = handles(); *handles.get(&id).ok_or(Error::new(EBADF))? }; Writer::new().write(buf); ...
.receive_into(buf, handle.flags & O_NONBLOCK != O_NONBLOCK, "DebugScheme::read") .ok_or(Error::new(EINTR)) }
random_line_split
debug.rs
use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use crate::arch::debug::Writer; use crate::event; use crate::scheme::*; use crate::sync::WaitQueue; use crate::syscall::flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}; use crate::sysca...
// Notify readers of input updates pub fn debug_notify() { for (id, _handle) in handles().iter() { event::trigger(SCHEME_ID.load(Ordering::SeqCst), *id, EVENT_READ); } } pub struct DebugScheme; impl DebugScheme { pub fn new(scheme_id: SchemeId) -> Self { SCHEME_ID.store(scheme_id, Orderi...
{ INPUT.call_once(init_input).send(data); }
identifier_body
__init__.py
self.AddAction(MiddleButton) self.AddAction(MoveAbsolute) self.AddAction(MoveRelative) self.AddAction(RightButton) self.AddAction(RightDoubleClick) self.AddAction(GoDirection) self.AddAction(MouseWheel) @eg.LogIt def __close__(self): pass def...
def MouseCallBack(self, buttonName, buttonNum, param): if param: if self.lastMouseEvent: self.lastMouseEvent.SetShouldEnd() shouldBlock = HasActiveHandler("Mouse." + buttonName) self.mouseButtonWasBlocked[buttonNum] = shouldBlock self.lastMous...
etMouseCallback(None) self.thread.receiveQueue.put([-1])
identifier_body
__init__.py
= "pixels" text3 = "Set vertical position Y to" note = ( "Note: The coordinates X and Y are related to the monitor " '(not to the "virtual screen")' ) def __call__(self, x = None, y = None, displayNumber = None, center = False, useAlternateMethod=False): poi...
ightButton(
identifier_name
__init__.py
) self.AddAction(MiddleButton) self.AddAction(MoveAbsolute) self.AddAction(MoveRelative) self.AddAction(RightButton) self.AddAction(RightDoubleClick) self.AddAction(GoDirection) self.AddAction(MouseWheel) @eg.LogIt def __close__(self): pass d...
diff = diff - 2 * pi elif diff < -1 * pi: diff = diff + 2 * pi self.currentAngle = self.currentAngle + (diff / 20) self.speed = self.speed + (self.speed * self.acceleration * ticks) if self.speed > self.maxSpeed: ...
random_line_split
__init__.py
, maxSpeed, 4000, 32000) accelerationFactorLabel = wx.StaticText(panel, -1, text.text5) accelerationFactorSpin = eg.SpinIntCtrl(panel, -1, accelerationFactor, 1, 200) eg.EqualizeWidths((initSpeedLabel, maxSpeedLabel, accelerationFactorLabel)) panel.AddLine(initSpeedLabel, initSpeedSpin) ...
CB.SetValue(False) yCB.SetValue(False) xCtrl.SetValue(0) yCtrl.SetValue(0)
conditional_block
__init__.py
# Copyright 2013 IBM Corp. # # 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 agree...
(): # NOTE(danms): You must make sure your object gets imported in this # function in order for it to be registered by services that may # need to receive it via RPC. __import__('ironic.objects.allocation') __import__('ironic.objects.bios') __import__('ironic.objects.chassis') __import__('ir...
register_all
identifier_name
__init__.py
# Copyright 2013 IBM Corp. # # 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 agree...
__import__('ironic.objects.allocation') __import__('ironic.objects.bios') __import__('ironic.objects.chassis') __import__('ironic.objects.conductor') __import__('ironic.objects.deploy_template') __import__('ironic.objects.deployment') __import__('ironic.objects.node') __import__('ironic.obje...
identifier_body
__init__.py
# Copyright 2013 IBM Corp. # # 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 agree...
__import__('ironic.objects.chassis') __import__('ironic.objects.conductor') __import__('ironic.objects.deploy_template') __import__('ironic.objects.deployment') __import__('ironic.objects.node') __import__('ironic.objects.node_history') __import__('ironic.objects.port') __import__('ironi...
random_line_split
chat_debug.py
from twistedbot.plugins.base import PluginChatBase from twistedbot.behavior_tree import InventorySelectActive class Debug(PluginChatBase): @property def command_verb(self): return "debug" @property def help(self): return "help for debug" def command(self, sender, command, args):...
else: self.send_chat_message("unknown item %s" % item_name) else: self.send_chat_message("unknown subject") else: self.send_chat_message("debug what?") plugin = Debug
self.world.bot.behavior_tree.new_command(InventorySelectActive, itemstack=itemstack)
conditional_block
chat_debug.py
from twistedbot.plugins.base import PluginChatBase from twistedbot.behavior_tree import InventorySelectActive class Debug(PluginChatBase): @property def command_verb(self): return "debug" @property def
(self): return "help for debug" def command(self, sender, command, args): if subject: what = subject[0] if what == "inventoryselect": item_name = " ".join(subject[1:]) if not item_name: self.send_chat_message("specify item"...
help
identifier_name
chat_debug.py
from twistedbot.plugins.base import PluginChatBase from twistedbot.behavior_tree import InventorySelectActive class Debug(PluginChatBase):
self.send_chat_message("unknown item %s" % item_name) else: self.send_chat_message("unknown subject") else: self.send_chat_message("debug what?") plugin = Debug
@property def command_verb(self): return "debug" @property def help(self): return "help for debug" def command(self, sender, command, args): if subject: what = subject[0] if what == "inventoryselect": item_name = " ".join(subject[1:]) ...
identifier_body
chat_debug.py
from twistedbot.plugins.base import PluginChatBase from twistedbot.behavior_tree import InventorySelectActive class Debug(PluginChatBase): @property def command_verb(self): return "debug" @property def help(self): return "help for debug" def command(self, sender, command, args):
if subject: what = subject[0] if what == "inventoryselect": item_name = " ".join(subject[1:]) if not item_name: self.send_chat_message("specify item") return itemstack = InventorySelectActive.parse_pa...
random_line_split
TransitionGroup.d.ts
import { Component, ReactType, HTMLProps, ReactElement } from "react"; import { TransitionActions, TransitionProps } from "./Transition"; declare namespace TransitionGroup { interface IntrinsicTransitionGroupProps<T extends keyof JSX.IntrinsicElements = "div"> extends TransitionActions { component?: T|null...
extends Component<TransitionGroup.TransitionGroupProps> {} export = TransitionGroup;
TransitionGroup
identifier_name
TransitionGroup.d.ts
import { Component, ReactType, HTMLProps, ReactElement } from "react"; import { TransitionActions, TransitionProps } from "./Transition"; declare namespace TransitionGroup { interface IntrinsicTransitionGroupProps<T extends keyof JSX.IntrinsicElements = "div"> extends TransitionActions { component?: T|null...
*/ declare class TransitionGroup extends Component<TransitionGroup.TransitionGroupProps> {} export = TransitionGroup;
* list items.
random_line_split
system.rs
// Copyright 2014 The sdl2-rs Developers. // // 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 a...
}
random_line_split
functions.py
from io.endeios.example.javascripts import ABean, TestInterface from java.lang import Long def myecho(a): return a def greet(): return "Hello Python" class MyClass(TestInterface): def __init__(self): pass def getBean(self): retVal =ABean() retVal.setName("python") retVal.setNumber(101) retVal.setRe...
print("retString is "+retString+"\n") return retString def gimmeMyObject(): return MyClass()
print("partString is "+part+"\n") retString = retString + part
conditional_block
functions.py
from io.endeios.example.javascripts import ABean, TestInterface from java.lang import Long def myecho(a): return a def greet(): return "Hello Python" class MyClass(TestInterface): def __init__(self): pass def getBean(self): retVal =ABean() retVal.setName("python") retVal.setNumber(101) retVal.setRe...
def serviceableResult(self): listOfStrings = service.getStrings() print("List is "+listOfStrings.toString()+"\n") retString = "" for part in listOfStrings: print("partString is "+part+"\n") retString = retString + part print("retString is "+retString+"\n") return retString def gimm...
def getNum(self): # NOTE Long.parseLong("101") returns a java.math.BigIntger on java side... return Long(101)
random_line_split
functions.py
from io.endeios.example.javascripts import ABean, TestInterface from java.lang import Long def myecho(a): return a def greet(): return "Hello Python" class MyClass(TestInterface): def __init__(self): pass def getBean(self): retVal =ABean() retVal.setName("python") retVal.setNumber(101) retVal.setRe...
def gimmeMyObject(): return MyClass()
listOfStrings = service.getStrings() print("List is "+listOfStrings.toString()+"\n") retString = "" for part in listOfStrings: print("partString is "+part+"\n") retString = retString + part print("retString is "+retString+"\n") return retString
identifier_body
functions.py
from io.endeios.example.javascripts import ABean, TestInterface from java.lang import Long def myecho(a): return a def greet(): return "Hello Python" class MyClass(TestInterface): def __init__(self): pass def getBean(self): retVal =ABean() retVal.setName("python") retVal.setNumber(101) retVal.setRe...
(self): listOfStrings = service.getStrings() print("List is "+listOfStrings.toString()+"\n") retString = "" for part in listOfStrings: print("partString is "+part+"\n") retString = retString + part print("retString is "+retString+"\n") return retString def gimmeMyObject(): return MyCl...
serviceableResult
identifier_name
services.py
from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore from pixelated.adapter.services.mail_service import MailService from pixelated.adapter.model.mail import InputMail from pixelated.adapter.services.mail_sender import MailSender from pixelated.adapter.search import SearchEngine from pixelat...
yield self.index_all_mails() def wrap_mail_store_with_indexing_mail_store(self, leap_session): leap_session.mail_store = SearchableMailStore(leap_session.mail_store, self.search_engine) @defer.inlineCallbacks def index_all_mails(self): all_mails = yield self.mail_service.all_mails(...
self.draft_service = self.setup_draft_service(leap_session.mail_store) self.feedback_service = self.setup_feedback_service(leap_session)
random_line_split
services.py
from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore from pixelated.adapter.services.mail_service import MailService from pixelated.adapter.model.mail import InputMail from pixelated.adapter.services.mail_sender import MailSender from pixelated.adapter.search import SearchEngine from pixelat...
(self, soledad): return SearchIndexStorageKey(soledad) def setup_feedback_service(self, leap_session): return FeedbackService(leap_session)
setup_search_index_storage_key
identifier_name
services.py
from pixelated.adapter.mailstore.searchable_mailstore import SearchableMailStore from pixelated.adapter.services.mail_service import MailService from pixelated.adapter.model.mail import InputMail from pixelated.adapter.services.mail_sender import MailSender from pixelated.adapter.search import SearchEngine from pixelat...
return FeedbackService(leap_session)
identifier_body
build.py
#!/usr/bin/python import os import requests from collections import defaultdict from glob import glob def convert(dpi, equation): url = 'http://latex.codecogs.com/png.latex?' r = requests.get(url, params='\dpi{' + str(dpi) + '} ' + equation) print('HTTP response: ' + str(r.status_code)) if (r.status_...
else: for filename in glob(outputDir + "/*/*.png"): os.remove(filename) if os.path.exists(mappingFile): os.remove(mappingFile) dpis = [300, 600] for dpi in dpis: dir = outputDir + '/' + str(dpi) if not os.path.exists(dir): os.mkdir(dir) ...
os.mkdir(outputDir)
conditional_block
build.py
#!/usr/bin/python import os import requests from collections import defaultdict from glob import glob def convert(dpi, equation): url = 'http://latex.codecogs.com/png.latex?' r = requests.get(url, params='\dpi{' + str(dpi) + '} ' + equation) print('HTTP response: ' + str(r.status_code)) if (r.status_...
def writeImage(filename, data): with open(filename, 'w') as f: f.write(data) def readEquations(filepath): md = defaultdict(list) with open(filepath, "rt") as f: for line in f: l = line.strip() if l and not l.startswith('#'): key_value = l.split('=...
data = convert(dpi, w) writeImage(outputDir + '/' + str(dpi) + '/' + filename + '.png', data)
identifier_body
build.py
#!/usr/bin/python import os import requests from collections import defaultdict from glob import glob def convert(dpi, equation): url = 'http://latex.codecogs.com/png.latex?' r = requests.get(url, params='\dpi{' + str(dpi) + '} ' + equation) print('HTTP response: ' + str(r.status_code)) if (r.status_...
l = line.strip() if l and not l.startswith('#'): key_value = l.split('=') key = key_value[0].strip() value = '='.join(key_value[1:]).strip('" \t') if (len(key) > 0 and len(value) > 0): md[int(key)].append(value) ...
for line in f:
random_line_split
build.py
#!/usr/bin/python import os import requests from collections import defaultdict from glob import glob def convert(dpi, equation): url = 'http://latex.codecogs.com/png.latex?' r = requests.get(url, params='\dpi{' + str(dpi) + '} ' + equation) print('HTTP response: ' + str(r.status_code)) if (r.status_...
(outputDir, filename, w, dpi): data = convert(dpi, w) writeImage(outputDir + '/' + str(dpi) + '/' + filename + '.png', data) def writeImage(filename, data): with open(filename, 'w') as f: f.write(data) def readEquations(filepath): md = defaultdict(list) with open(filepath, "rt") as f: ...
convertAndWrite
identifier_name
phantom.rs
// https://rustbyexample.com/generics/phantom.html // http://rust-lang-ja.org/rust-by-example/generics/phantom.html use std::marker::PhantomData; // A phantom tuple struct which is generic over `A` with hidden parameter `B`. #[derive(PartialEq)] // Allow equality test for this type. struct PhantomTuple<A, B>(A, Phant...
() { // here, `f32` and `f64` are the hidden parameters. // PhantomTuple type specified as `<char, f32>`. let _tuple1: PhantomTuple<char, f32> = PhantomTuple('Q', PhantomData); // PhantomTuple type specified as `<char, f64>`. let _tuple2: PhantomTuple<char, f64> = PhantomTuple('Q', PhantomData); ...
main
identifier_name
phantom.rs
// https://rustbyexample.com/generics/phantom.html
// http://rust-lang-ja.org/rust-by-example/generics/phantom.html use std::marker::PhantomData; // A phantom tuple struct which is generic over `A` with hidden parameter `B`. #[derive(PartialEq)] // Allow equality test for this type. struct PhantomTuple<A, B>(A, PhantomData<B>); // A phantom type struct which is gene...
random_line_split
lib.rs
, Binary, Fd, Dictionary, Array, Error, } #[repr(C)] #[derive(Debug)] pub enum CallStatus { InProgress, MoreAvailable, Done, Error, Aborted, Ended } pub enum RawObject {} pub enum RawConnection {} pub enum RawClient {} pub enum RawCall {} pub struct Object { value: *mu...
RawType::Dictionary => Value::Null, RawType::Error => Value::Null, }
random_line_split
lib.rs
_void, _>(null_mut())) } #[repr(C)] #[derive(Debug)] pub enum RawType { Null, Bool, Uint64, Int64, Double, Date, String, Binary, Fd, Dictionary, Array, Error, } #[repr(C)] #[derive(Debug)] pub enum CallStatus { InProgress, MoreAvailable, Done, Error, ...
(value: &str) -> Value { Value::String(String::from(value)) } } impl From<String> for Value { fn from(value: String) -> Value { Value::String(value) } } impl From<Vec<u8>> for Value { fn from(value: Vec<u8>) -> Value { Value::Binary(value) } } impl<'a> From<&'a [Value]> fo...
from
identifier_name
scout_requests.py
=headers) else: resp = requests.get(url, timeout=TIMEOUT) json_response["content"] = resp.json() except Exception as ex: return {"message": f"An error occurred while sending a GET request to url {url} -> {ex}"} json_response["status_code"] = resp.status_code return json...
result(iterable): Ensembl formated gene lines """ chromosomes = chromosomes or CHROMOSOMES LOG.info("Fetching ensembl genes") attributes = [ "chromosome_name", "start_position", "end_position", "ensembl_gene_id", "hgnc_symbol", "hgnc_id", ] ...
Args: build(str): ['37', '38'] chromosomes(iterable(str)) Returns:
random_line_split
scout_requests.py
=headers) else: resp = requests.get(url, timeout=TIMEOUT) json_response["content"] = resp.json() except Exception as ex: return {"message": f"An error occurred while sending a GET request to url {url} -> {ex}"} json_response["status_code"] = resp.status_code return json...
if phenotype_to_genes is True: hpo_files["phenotype_to_genes"] = fetch_hpo_to_genes_to_disease() if hpo_terms is True: hpo_files["hpo_terms"] = fetch_hpo_terms() return hpo_files def fetch_mim_files(api_key, mim2genes=False, mimtitles=False, morbidmap=False, genemap2=False): """Fetch...
hpo_files["genes_to_phenotype"] = fetch_genes_to_hpo_to_disease()
conditional_block
scout_requests.py
=headers) else: resp = requests.get(url, timeout=TIMEOUT) json_response["content"] = resp.json() except Exception as ex: return {"message": f"An error occurred while sending a GET request to url {url} -> {ex}"} json_response["status_code"] = resp.status_code return json...
(): """Fetch the latest version of the map from phenotypes to genes Returns: res(list(str)): A list with the lines formatted this way: #Format: HPO-id<tab>HPO label<tab>entrez-gene-id<tab>entrez-gene-symbol\ <tab>Additional Info from G-D source<tab>G-D source <tab>disease-ID fo...
fetch_hpo_to_genes_to_disease
identifier_name
scout_requests.py
Args: url(str) Returns: decoded_data(str): Decoded response """ try: LOG.info("Requesting %s", url) response = requests.get(url, timeout=TIMEOUT) if response.status_code != 200: response.raise_for_status() LOG.info("Encoded to %s", response.encod...
"""Fetch the ensembl genes Args: build(str): ['37', '38'] chromosomes(iterable(str)) """ chromosomes = chromosomes or CHROMOSOMES LOG.info("Fetching ensembl exons") attributes = [ "chromosome_name", "ensembl_gene_id", "ensembl_transcript_id", "ensemb...
identifier_body
removeOldDellReports.py
################################################################################ # # This program is part of the DellMon Zenpack for Zenoss. # Copyright (C) 2008, 2009, 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss....
removeOldDellReports()
devReports = pack.dmd.Reports['Device Reports'] if hasattr(devReports, 'Dell DRAC Controllers'): devReports._delObject('Dell DRAC Controllers') if hasattr(devReports, 'Dell Storage Controllers'): devReports._delObject('Dell Storage Controllers')
conditional_block
removeOldDellReports.py
################################################################################ # # This program is part of the DellMon Zenpack for Zenoss. # Copyright (C) 2008, 2009, 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss....
(self, pack): if hasattr(pack.dmd.Reports, 'Device Reports'): devReports = pack.dmd.Reports['Device Reports'] if hasattr(devReports, 'Dell DRAC Controllers'): devReports._delObject('Dell DRAC Controllers') if hasattr(devReports, 'Dell Storage Controllers'): ...
migrate
identifier_name
removeOldDellReports.py
################################################################################ # # This program is part of the DellMon Zenpack for Zenoss. # Copyright (C) 2008, 2009, 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss....
devReports = pack.dmd.Reports['Device Reports'] if hasattr(devReports, 'Dell DRAC Controllers'): devReports._delObject('Dell DRAC Controllers') if hasattr(devReports, 'Dell Storage Controllers'): devReports._delObject('Dell Storage Controllers') rem...
if hasattr(pack.dmd.Reports, 'Device Reports'):
random_line_split
removeOldDellReports.py
################################################################################ # # This program is part of the DellMon Zenpack for Zenoss. # Copyright (C) 2008, 2009, 2010 Egor Puzanov. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss....
removeOldDellReports()
if hasattr(pack.dmd.Reports, 'Device Reports'): devReports = pack.dmd.Reports['Device Reports'] if hasattr(devReports, 'Dell DRAC Controllers'): devReports._delObject('Dell DRAC Controllers') if hasattr(devReports, 'Dell Storage Controllers'): devRep...
identifier_body
object-lifetime-default-default-to-static.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(t: Box<Test+'static>, mut ss: SomeStruct) { ss.u = t; } fn main() { }
d
identifier_name
object-lifetime-default-default-to-static.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
ss.u = t; } fn d(t: Box<Test+'static>, mut ss: SomeStruct) { ss.u = t; } fn main() { }
fn c(t: Box<Test>, mut ss: SomeStruct) {
random_line_split
object-lifetime-default-default-to-static.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn d(t: Box<Test+'static>, mut ss: SomeStruct) { ss.u = t; } fn main() { }
{ ss.u = t; }
identifier_body
gulpfile.js
var gulp = require('gulp'); var useref = require('gulp-useref'); var uglify = require('gulp-uglify'); var cssnano = require('gulp-cssnano'); var gulpIf = require('gulp-if'); var imagemin = require('gulp-imagemin'); var cache = require('gulp-cache'); var del = require('del'); var nodemon = require('gulp-nodemon'); var r...
runSequence('clean', ['minify', 'imgMin'], 'nodemon') });
gulp.task('default', function() {
random_line_split
preferences_v30_rc1.py
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, PreferencesV30Rc1): return False return self...
random_line_split
preferences_v30_rc1.py
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, v...
result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ))
conditional_block
preferences_v30_rc1.py
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, PreferencesV30Rc1): return False return self.__dict__ == other.__dict__ def __ne__(self, other): ...
__repr__
identifier_name
preferences_v30_rc1.py
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, PreferencesV30Rc1): return False return self.__dict__ == other.__dict__ def __ne__(s...
"""Returns the string representation of the model""" return pprint.pformat(self.to_dict())
identifier_body
critical.py
from JumpScale import j import JumpScale.baselib.watchdog.manager import JumpScale.baselib.redis import JumpScale.lib.rogerthat descr = """ critical alert """ organization = "jumpscale" enable = True REDIS_PORT = 9999 # API_KEY = j.application.config.get('rogerthat.apikey') redis_client = j.clients.credis.getRedis...
def escalateL2(watchdogevent): if watchdogevent.escalationstate == 'L1': watchdogevent.escalationstate = 'L2' contacts = redis_client.hgetall('contacts') message = str(watchdogevent) message_id = _send_message(message, [contacts['2'], contacts['3']]) watchdogevent.message_i...
if not j.tools.watchdog.manager.inAlert(watchdogevent): watchdogevent.escalationstate = 'L1' # contact1 = redis_client.hget('contacts', '1') message = str(watchdogevent) # message_id = _send_message(message, [contact1,]) # watchdogevent.message_id = message_id j.tools.wat...
identifier_body
critical.py
from JumpScale import j import JumpScale.baselib.watchdog.manager import JumpScale.baselib.redis import JumpScale.lib.rogerthat descr = """ critical alert """ organization = "jumpscale" enable = True REDIS_PORT = 9999 # API_KEY = j.application.config.get('rogerthat.apikey') redis_client = j.clients.credis.getRedis...
(watchdogevent): if watchdogevent.escalationstate == 'L2': watchdogevent.escalationstate = 'L3' contacts = redis_client.hgetall('contacts')['all'].split(',') message = str(watchdogevent) message_id = _send_message(message, contacts) watchdogevent.message_id = message_id ...
escalateL3
identifier_name
critical.py
from JumpScale import j import JumpScale.baselib.watchdog.manager import JumpScale.baselib.redis import JumpScale.lib.rogerthat descr = """ critical alert """ organization = "jumpscale" enable = True REDIS_PORT = 9999 # API_KEY = j.application.config.get('rogerthat.apikey') redis_client = j.clients.credis.getRedis...
watchdogevent.escalationstate = 'L3' contacts = redis_client.hgetall('contacts')['all'].split(',') message = str(watchdogevent) message_id = _send_message(message, contacts) watchdogevent.message_id = message_id j.tools.watchdog.manager.setAlert(watchdogevent)
conditional_block
critical.py
from JumpScale import j import JumpScale.baselib.watchdog.manager import JumpScale.baselib.redis import JumpScale.lib.rogerthat descr = """ critical alert """ organization = "jumpscale" enable = True REDIS_PORT = 9999 # API_KEY = j.application.config.get('rogerthat.apikey') redis_client = j.clients.credis.getRedisC...
def escalateL1(watchdogevent): if not j.tools.watchdog.manager.inAlert(watchdogevent): watchdogevent.escalationstate = 'L1' # contact1 = redis_client.hget('contacts', '1') message = str(watchdogevent) # message_id = _send_message(message, [contact1,]) # watchdogevent.message_...
# message_id = result['result'] # return message_id
random_line_split
completion-graph.component.spec.ts
// Copyright 2020 The Oppia Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by ap...
let $componentController; beforeEach(angular.mock.module('oppia')); beforeEach(angular.mock.inject(_$componentController_ => { $componentController = _$componentController_; })); it('should derive style values from the completion rate', () => { const completionRate = 0.65; const ctrl = ( $...
require('components/statistics-directives/completion-graph.component.ts'); describe('Completion graph', function() {
random_line_split
ajax.js
var ajax = { init: function(){ if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP'); else if (window.XMLHttpRequest) return new XMLHttpRequest(); return false; }, arrayToString: function (ar,prefix) { var out=""; for (var i in ar) {
ar[i]=this.arrayToString(ar[i], prefix+"["+i+"]"); } else { ar[i]="&"+prefix+"["+i+"]="+encodeURIComponent(ar[i]); } } for (var i in ar) { out+=ar[i]; } return out; }, formToData: function (id) { var id_len=id.length; ...
if (ar[i] instanceof Array) {
random_line_split
dashboard.js
(function($){ DashboardModel = Backbone.Model.extend({ url: "/sync" }); SyncStatusModel = Backbone.Model.extend({ url: "/sync/status" }); DeleteModel = Backbone.Model.extend(); DashboardView = Backbone.View.extend({ el: $("#form_block"), events: { "click .sync-now": "syncNow",...
"idAttribute": id }); this.model.save({}, { success: function(model, response) { $(e.currentTarget).text("Importing ...").show(); $("#progress").animate({height: 90}, 1000); }, }); var syncmodel = this.syncmodel; var self = this; s...
}); this.model = new DashboardModel({
random_line_split
dashboard.js
(function($){ DashboardModel = Backbone.Model.extend({ url: "/sync" }); SyncStatusModel = Backbone.Model.extend({ url: "/sync/status" }); DeleteModel = Backbone.Model.extend(); DashboardView = Backbone.View.extend({ el: $("#form_block"), events: { "click .sync-now": "syncNow",...
else { // error clearInterval(syncStatusInterval); $(e.currentTarget).text("Sync Now"); self.showMessage(response.message); $("#progress").animate({height: 0}, 1000); } }}); }, 5000); }, deleteNow...
{ $("#status").animate({width: response.progress + "%"}, 1000); if (response.status === "running") { var insertedRows = response.inserted_rows; var rowsToBeInserted = response.rows_to_be_inserted; $("#progress span")....
conditional_block
oop-debug.js
*/ var L = Y.Lang, A = Y.Array, OP = Object.prototype, CLONE_MARKER = "_~yuim~_", EACH = 'each', SOME = 'some', dispatch = function(o, f, c, proto, action) { if (o && o[action] && o !== Y) { return o[action].call(o, f, c); ...
random_line_split
oop-debug.js
| Any} arg or arguments to apply to the supplier * constructor when initializing. * @return {object} the augmented object * * @todo constructor optional? * @todo understanding what an instance is augmented with * @TODO best practices for overriding sequestered methods. */ Y.augme...
{ each(o, function(v, k) { if (!f || (f.call(c || this, v, k, this, o) !== false)) { if (k !== CLONE_MARKER) { if (k == 'prototype') { // skip the prototype // } else if (o[k] === o) { ...
conditional_block
test_ins.py
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard 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,...
def getVal(i): op = i.get_operands() if isinstance(op, int): return [ op ] elif i.get_name() == "lookupswitch": x = [] x.append( i.get_operands().default ) for idx in range(0, i.get_operands().npairs): off = getattr(i.get_operands(), "offset%d" % idx) ...
if got == expected: prefix = ' OK ' else: prefix = ' X ' print('\t%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))
identifier_body
test_ins.py
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard 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,...
return [-1] def check(a, values): for method in a.get_methods(): key = method.get_class_name() + " " + method.get_name() + " " + method.get_descriptor() if key not in values: continue print("CHECKING ...", method.get_class_name(), method.get_name(), method.get_descriptor...
x = [] x.append( i.get_operands().default ) for idx in range(0, i.get_operands().npairs): off = getattr(i.get_operands(), "offset%d" % idx) x.append( off ) return x
conditional_block
test_ins.py
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard 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,...
(got, expected): if got == expected: prefix = ' OK ' else: prefix = ' X ' print('\t%s got: %s expected: %s' % (prefix, repr(got), repr(expected))) def getVal(i): op = i.get_operands() if isinstance(op, int): return [ op ] elif i.get_name() == "lookupswitch": x...
test
identifier_name
test_ins.py
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard 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,...
off = getattr(i.get_operands(), "offset%d" % idx) x.append( off ) return x return [-1] def check(a, values): for method in a.get_methods(): key = method.get_class_name() + " " + method.get_name() + " " + method.get_descriptor() if key not in values: ...
x.append( i.get_operands().default ) for idx in range(0, i.get_operands().npairs):
random_line_split
clonesrv4.py
""" Clone server Model Four Author: Min RK <benjaminrk@gmail.com """ import zmq from kvsimple import KVMsg # simple struct for routing information for a key-value snapshot class Route: def __init__(self, socket, identity, subtree): self.socket = socket # ROUTER socket to send to self.iden...
(): # context and sockets ctx = zmq.Context() snapshot = ctx.socket(zmq.ROUTER) snapshot.bind("tcp://*:5556") publisher = ctx.socket(zmq.PUB) publisher.bind("tcp://*:5557") collector = ctx.socket(zmq.PULL) collector.bind("tcp://*:5558") sequence = 0 kvmap = {} poller = zmq....
main
identifier_name
clonesrv4.py
""" Clone server Model Four Author: Min RK <benjaminrk@gmail.com """ import zmq from kvsimple import KVMsg # simple struct for routing information for a key-value snapshot class Route: def __init__(self, socket, identity, subtree): self.socket = socket # ROUTER socket to send to self.iden...
main()
conditional_block
clonesrv4.py
""" Clone server Model Four Author: Min RK <benjaminrk@gmail.com """ import zmq from kvsimple import KVMsg # simple struct for routing information for a key-value snapshot class Route: def __init__(self, socket, identity, subtree):
def send_single(key, kvmsg, route): """Send one state snapshot key-value pair to a socket""" # check front of key against subscription subtree: if kvmsg.key.startswith(route.subtree): # Send identity of recipient first route.socket.send(route.identity, zmq.SNDMORE) kvmsg.s...
self.socket = socket # ROUTER socket to send to self.identity = identity # Identity of peer who requested state self.subtree = subtree # Client subtree specification
identifier_body
clonesrv4.py
""" Clone server Model Four Author: Min RK <benjaminrk@gmail.com """ import zmq from kvsimple import KVMsg # simple struct for routing information for a key-value snapshot class Route: def __init__(self, socket, identity, subtree): self.socket = socket # ROUTER socket to send to self.iden...
if collector in items: kvmsg = KVMsg.recv(collector) sequence += 1 kvmsg.sequence = sequence kvmsg.send(publisher) kvmsg.store(kvmap) print "I: publishing update %5d" % sequence # Execute state snapshot request if s...
break # Interrupted # Apply state update sent from client
random_line_split
DropBox.ts
import GameUI from "./GameUI"; /** * 掉落盒子脚本,实现盒子碰撞及回收流程 */ export default class DropBox extends Laya.Script { /**盒子等级 */ level: number = 1; /**等级文本对象引用 */ private _text: Laya.Text; /**刚体对象引用 */ private _rig: Laya.RigidBody constructor() { super(); } onEnable(): void { ...
ani.removeSelf(); Laya.Pool.recover("effect", ani); } return ani; } onDisable(): void { //盒子被移除时,回收盒子到对象池,方便下次复用,减少对象创建开销。 Laya.Pool.recover("dropBox", this.owner); } }
identifier_name
DropBox.ts
import GameUI from "./GameUI"; /** * 掉落盒子脚本,实现盒子碰撞及回收流程 */ export default class DropBox extends Laya.Script { /**盒子等级 */ level: number = 1; /**等级文本对象引用 */ private _text: Laya.Text; /**刚体对象引用 */ private _rig: Laya.RigidBody constructor() { super(); } onEnable(): void { ...
r(other: any, self: any, contact: any): void { var owner: Laya.Sprite = this.owner as Laya.Sprite; if (other.label === "buttle") { //碰撞到子弹后,增加积分,播放声音特效 if (this.level > 1) { this.level--; this._text.changeText(this.level + ""); ...
er.getComponent(Laya.RigidBody); this.level = Math.round(Math.random() * 5) + 1; this._text = this.owner.getChildByName("levelTxt") as Laya.Text; this._text.text = this.level + ""; } onUpdate(): void { //让持续盒子旋转 (this.owner as Laya.Sprite).rotation++; } ...
identifier_body
DropBox.ts
import GameUI from "./GameUI"; /** * 掉落盒子脚本,实现盒子碰撞及回收流程 */ export default class DropBox extends Laya.Script { /**盒子等级 */ level: number = 1; /**等级文本对象引用 */ private _text: Laya.Text; /**刚体对象引用 */ private _rig: Laya.RigidBody constructor() { super(); } onEnable(): void { ...
GameUI.instance.stopGame(); } } /**使用对象池创建爆炸动画 */ createEffect(): Laya.Animation { let ani: Laya.Animation = new Laya.Animation(); ani.loadAnimation("test/TestAni.ani"); ani.on(Laya.Event.COMPLETE, null, recover); function recover(): void { ...
owner.parent.addChild(effect); effect.play(0, true); owner.removeSelf(); Laya.SoundManager.playSound("sound/destroy.wav"); } } GameUI.instance.addScore(1); } else if (other.label === "grou...
conditional_block
DropBox.ts
import GameUI from "./GameUI"; /** * 掉落盒子脚本,实现盒子碰撞及回收流程 */ export default class DropBox extends Laya.Script { /**盒子等级 */ level: number = 1; /**等级文本对象引用 */ private _text: Laya.Text; /**刚体对象引用 */ private _rig: Laya.RigidBody constructor() { super(); } onEnable(): void { ...
GameUI.instance.addScore(1); } else if (other.label === "ground") { //只要有一个盒子碰到地板,则停止游戏 owner.removeSelf(); GameUI.instance.stopGame(); } } /**使用对象池创建爆炸动画 */ createEffect(): Laya.Animation { let ani: Laya.Animation = new Laya...
random_line_split
promise.js
/* eslint no-use-before-define:0 */ 'use strict'; var RSVP = require('rsvp'); var Promise = RSVP.Promise; module.exports = PromiseExt; // Utility functions on the native CTOR need some massaging module.exports.hash = function () { return this.resolve(RSVP.hash.apply(null, arguments)); }; module.exports.denodei...
PromiseExt.prototype = Object.create(Promise.prototype); PromiseExt.prototype.constructor = PromiseExt; PromiseExt.prototype._superConstructor = Promise; Object.setPrototypeOf(PromiseExt, Promise); PromiseExt.prototype.returns = function (value) { return this.then(function () { return value; }); }; PromiseE...
{ this._superConstructor(resolver, label); }
identifier_body
promise.js
/* eslint no-use-before-define:0 */ 'use strict'; var RSVP = require('rsvp'); var Promise = RSVP.Promise; module.exports = PromiseExt; // Utility functions on the native CTOR need some massaging module.exports.hash = function () { return this.resolve(RSVP.hash.apply(null, arguments)); }; module.exports.denodei...
return Constructor.filter(values, mapFn); }); };
random_line_split
promise.js
/* eslint no-use-before-define:0 */ 'use strict'; var RSVP = require('rsvp'); var Promise = RSVP.Promise; module.exports = PromiseExt; // Utility functions on the native CTOR need some massaging module.exports.hash = function () { return this.resolve(RSVP.hash.apply(null, arguments)); }; module.exports.denodei...
(resolver, label) { this._superConstructor(resolver, label); } PromiseExt.prototype = Object.create(Promise.prototype); PromiseExt.prototype.constructor = PromiseExt; PromiseExt.prototype._superConstructor = Promise; Object.setPrototypeOf(PromiseExt, Promise); PromiseExt.prototype.returns = function (value) { ret...
PromiseExt
identifier_name
__main__.py
# This file is part of pyplink. # # The MIT License (MIT) # # Copyright (c) 2014 Louis-Philippe Lemieux Perreault # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, includ...
# The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE ...
# furnished to do so, subject to the following conditions: #
random_line_split
struct-style-enum.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() {()}
zzz
identifier_name
struct-style-enum.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// 0b0101100101011001 = 22873 // 0b01011001 = 89 let case3 = Case3 { a: 0, b: 6438275382588823897 }; let univariant = TheOnlyCase { a: -1 }; zzz(); // #break } fn zzz() {()}
{ // In order to avoid endianness trouble all of the following test values consist of a single // repeated byte. This way each interpretation of the union should look the same, no matter if // this is a big or little endian machine. // 0b0111110001111100011111000111110001111100011111000111110001111100...
identifier_body
struct-style-enum.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// gdb-command:print case3 // gdb-check:$3 = {{RUST$ENUM$DISR = Case3, a = 0, b = 22873, c = 22873, d = 22873, e = 22873}, {RUST$ENUM$DISR = Case3, a = 0, b = 1499027801, c = 1499027801}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}} // gdb-command:print univariant // gdb-check:$4 = {{a = -1}} // === LLD...
// gdb-command:print case2 // gdb-check:$2 = {{RUST$ENUM$DISR = Case2, a = 0, b = 4369, c = 4369, d = 4369, e = 4369}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, a = 0, b = 1229782938247303441}}
random_line_split
button.rs
#![feature(used)] #![no_std] extern crate cortex_m; extern crate panic_abort; extern crate stm32f30x_hal as hal; use hal::prelude::*; use hal::stm32f30x; use hal::spi::Spi; fn main() { let cp = cortex_m::Peripherals::take().unwrap(); let dp = stm32f30x::Peripherals::take().unwrap(); let mut flash = dp.F...
} }
{ led.set_high(); }
conditional_block
button.rs
#![feature(used)] #![no_std] extern crate cortex_m; extern crate panic_abort; extern crate stm32f30x_hal as hal; use hal::prelude::*; use hal::stm32f30x; use hal::spi::Spi; fn
() { let cp = cortex_m::Peripherals::take().unwrap(); let dp = stm32f30x::Peripherals::take().unwrap(); let mut flash = dp.FLASH.constrain(); let mut rcc = dp.RCC.constrain(); let clocks = rcc.cfgr.freeze(&mut flash.acr); let mut gpiob = dp.GPIOB.split(&mut rcc.ahb); let mut gpioc = dp.GP...
main
identifier_name
button.rs
#![feature(used)] #![no_std] extern crate cortex_m; extern crate panic_abort; extern crate stm32f30x_hal as hal; use hal::prelude::*; use hal::stm32f30x; use hal::spi::Spi; fn main() { let cp = cortex_m::Peripherals::take().unwrap();
let clocks = rcc.cfgr.freeze(&mut flash.acr); let mut gpiob = dp.GPIOB.split(&mut rcc.ahb); let mut gpioc = dp.GPIOC.split(&mut rcc.ahb); // Set up Pins let mut button = gpiob.pb8 .into_pull_up_input(&mut gpiob.moder, &mut gpiob.pupdr); let mut led = gpioc.pc13 .into_push_...
let dp = stm32f30x::Peripherals::take().unwrap(); let mut flash = dp.FLASH.constrain(); let mut rcc = dp.RCC.constrain();
random_line_split