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
regions-free-region-ordering-callee.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a, 'b>(x: &'a &'b uint) -> &'a uint { // It is safe to assume that 'a <= 'b due to the type of x let y: &'b uint = &**x; return y; } fn ordering2<'a, 'b>(x: &'a &'b uint, y: &'a uint) -> &'b uint { // However, it is not safe to assume that 'b <= 'a &*y //~ ERROR cannot infer } fn ordering3<'a, '...
ordering1
identifier_name
regions-free-region-ordering-callee.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn ordering5<'a, 'b>(a: &'a uint, b: &'b uint, x: Option<&'a &'b uint>) { let z: Option<&'a &'b uint> = None; } fn main() {}
{ // Do not infer ordering from closure argument types. let z: Option<&'a &'b uint> = None; //~^ ERROR reference has a longer lifetime than the data it references }
identifier_body
error.rs
use crate::asm::Token; use std::fmt; #[derive(Debug, Clone)] pub enum Error { ParseError { error: String }, NoSectionDecl, MissingSection, StringConstantWithoutLabel { instr: String }, SymbolAlreadyDeclared { name: String }, InvalidDirectiveName { instr: String }, UnknownDirective { name: S...
f.write_str(&format!("Invalid directive name: {}", instr)) } Error::UnknownDirective { ref name } => { f.write_str(&format!("Unknown directive: {}", name)) } Error::UnknownSection { ref name } => { f.write_str(&format!("Unkn...
)), Error::SymbolAlreadyDeclared { ref name } => { f.write_str(&format!("Symbol {:?} declared multiple times", name)) } Error::InvalidDirectiveName { ref instr } => {
random_line_split
error.rs
use crate::asm::Token; use std::fmt; #[derive(Debug, Clone)] pub enum Error { ParseError { error: String }, NoSectionDecl, MissingSection, StringConstantWithoutLabel { instr: String }, SymbolAlreadyDeclared { name: String }, InvalidDirectiveName { instr: String }, UnknownDirective { name: S...
Error::InvalidDirectiveName { ref instr } => { f.write_str(&format!("Invalid directive name: {}", instr)) } Error::UnknownDirective { ref name } => { f.write_str(&format!("Unknown directive: {}", name)) } Error::UnknownSection ...
{ f.write_str(&format!("Symbol {:?} declared multiple times", name)) }
conditional_block
error.rs
use crate::asm::Token; use std::fmt; #[derive(Debug, Clone)] pub enum
{ ParseError { error: String }, NoSectionDecl, MissingSection, StringConstantWithoutLabel { instr: String }, SymbolAlreadyDeclared { name: String }, InvalidDirectiveName { instr: String }, UnknownDirective { name: String }, UnknownSection { name: String }, UnknownLabel { name: Strin...
Error
identifier_name
project-header.tsx
import * as React from 'react'; import clsx from 'clsx'; import Image from 'next/image'; import { ProjectMetadata } from '~/types/projects'; import { Container } from '~/components/layout'; import { PageMetaItem } from '~/components/page'; export interface ProjectHeaderProps extends React.ComponentPropsWithoutRef<'hea...
/> </div> )} <div className="space-y-4"> {tags ? ( <div className="space-x-4"> {tags.map(tag => ( <PageMetaItem key={tag}>{tag}</PageMetaItem> ))} </div> ) : null} ...
alt={title} layout="fill" objectFit="cover"
random_line_split
UTM2Geo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 17/2/2015 @author: Antonio Hermosilla Rodrigo. @contact: anherro285@gmail.com @organization: Antonio Hermosilla Rodrigo. @copyright: (C) 2015 by Antonio Hermosilla Rodrigo @version: 1.0.0 ''' import sys from PyQt4 import QtCore from PyQt4 import QtGui from ...
line+=str(round(i[1].getConvergenciaMeridianos(),self.__pw))+"," line+=str(round(i[1].getEscalaLocalPunto(),self.__pw))+"," line+=str(i[1].getZonaUTM())+"\n" g.write(line) pg.setValue(cont) cont+=1 g.close() pg.hide() d...
line+"," else: line+=str(h)+"," line+=str(i[1].getHuso())+","
random_line_split
UTM2Geo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 17/2/2015 @author: Antonio Hermosilla Rodrigo. @contact: anherro285@gmail.com @organization: Antonio Hermosilla Rodrigo. @copyright: (C) 2015 by Antonio Hermosilla Rodrigo @version: 1.0.0 ''' import sys from PyQt4 import QtCore from PyQt4 import QtGui from ...
(self, parent=None): ''' Constructor ''' super(UTM2Geo, self).__init__() #Se carga el formulario para el controlador. self.__rutaroot=normpath(getcwd() + sep + pardir) uic.loadUi(self.__rutaroot+'/Formularios/UTM2Geo.ui', self) self.__msgBoxErr=QtGui.QMess...
__init__
identifier_name
UTM2Geo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 17/2/2015 @author: Antonio Hermosilla Rodrigo. @contact: anherro285@gmail.com @organization: Antonio Hermosilla Rodrigo. @copyright: (C) 2015 by Antonio Hermosilla Rodrigo @version: 1.0.0 ''' import sys from PyQt4 import QtCore from PyQt4 import QtGui from ...
except Exception as e: self.__msgBoxErr.setText(e.__str__()) self.__msgBoxErr.exec_() return pg=QtGui.QProgressBar(pd) pd.setBar(pg) pg.setMinimum(0) pg.setMaximum(len(sal)) g=open(self.lineEdit_10.text(),'w') pd.setLab...
'''! ''' pd=QtGui.QProgressDialog() if self.lineEdit_9.text()=="": self.__msgBoxErr.setText("Debe introducir un fichero de coordenadas UTM.") self.__msgBoxErr.exec_() return if self.lineEdit_10.text()=="": self.__msgBoxErr.setText(...
identifier_body
UTM2Geo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 17/2/2015 @author: Antonio Hermosilla Rodrigo. @contact: anherro285@gmail.com @organization: Antonio Hermosilla Rodrigo. @copyright: (C) 2015 by Antonio Hermosilla Rodrigo @version: 1.0.0 ''' import sys from PyQt4 import QtCore from PyQt4 import QtGui from ...
line+=str(i[1].getHuso())+"," line+=str(round(i[1].getConvergenciaMeridianos(),self.__pw))+"," line+=str(round(i[1].getEscalaLocalPunto(),self.__pw))+"," line+=str(i[1].getZonaUTM())+"\n" g.write(line) pg.setValue(cont) cont+=1 ...
line+=str(h)+","
conditional_block
reverserlist.py
from linkedlist import SinglyLinkedListNode def reverseList(head): tail=None last=None tempNode = head while tempNode is not None: currentNode, tempNode = tempNode, tempNode.next currentNode.next = tail tail = currentNode return tail def reverseListKNode(head,k): ...
a=(i for i in xrange(1,11)) list = createList(a) printLinkedList(list) newList=reverseListKNode(list,2) printLinkedList(newList)
lastNode=None head=None for i in list: node= SinglyLinkedListNode(i) if lastNode == None: lastNode = node head = node else: lastNode.next = node lastNode=node return head
identifier_body
reverserlist.py
from linkedlist import SinglyLinkedListNode def reverseList(head): tail=None last=None tempNode = head while tempNode is not None: currentNode, tempNode = tempNode, tempNode.next currentNode.next = tail tail = currentNode return tail def reverseListKNode(head,k): ...
else: lastNode.next = node lastNode=node return head a=(i for i in xrange(1,11)) list = createList(a) printLinkedList(list) newList=reverseListKNode(list,2) printLinkedList(newList)
lastNode = node head = node
conditional_block
reverserlist.py
from linkedlist import SinglyLinkedListNode def reverseList(head): tail=None last=None tempNode = head while tempNode is not None: currentNode, tempNode = tempNode, tempNode.next currentNode.next = tail tail = currentNode return tail def reverseListKNode(head,k): ...
(list): lastNode=None head=None for i in list: node= SinglyLinkedListNode(i) if lastNode == None: lastNode = node head = node else: lastNode.next = node lastNode=node return head a=(i for i in xrange(1,11)) list = createList(a) ...
createList
identifier_name
reverserlist.py
from linkedlist import SinglyLinkedListNode def reverseList(head): tail=None last=None tempNode = head while tempNode is not None: currentNode, tempNode = tempNode, tempNode.next currentNode.next = tail tail = currentNode return tail def reverseListKNode(head,k): ...
last = None tk=k while tempNode is not None and tk > 0: currentNode,nextNode = tempNode,tempNode.next currentNode.next = last last=currentNode tempNode = nextNode tk-=1 if tempHead is not None: tempTail.next = last ...
tempNode = head
random_line_split
config.py
it under the terms of the GNU General Public License, Version 3, # as published by the Free Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Gene...
from snap.exceptions import ArgError class ConfigOptions: """Container holding all the configuration options available to the Snap system""" # modes of operation RESTORE = 0 BACKUP = 1 def __init__(self): '''initialize configuration''' # mode of operation self.mode...
from snap.options import * from snap.snapshottarget import SnapshotTarget
random_line_split
config.py
under the terms of the GNU General Public License, Version 3, # as published by the Free Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General...
(self, section='main'): '''return array of key/value pairs from the config file section @param section - the section which to retrieve the key / values from @returns - the array of key / value pairs or None if not found ''' try: return self.parser.items(secti...
__get_array
identifier_name
config.py
under the terms of the GNU General Public License, Version 3, # as published by the Free Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General...
if options.backup != False: snap.config.options.mode = ConfigOptions.BACKUP if options.log_level: snap.config.options.log_level = options.log_level if options.outputformat != None: snap.config.options.outputformat = options.outputformat if options.snap...
''' parses the command line an set them in the target ConfigOptions ''' usage = "usage: %prog [options] arg" self.parser = optparse.OptionParser(usage, version=SNAP_VERSION) self.parser.add_option('', '--restore', dest='restore', action='store_true', default=False, help='Restore...
identifier_body
config.py
under the terms of the GNU General Public License, Version 3, # as published by the Free Software Foundation # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General...
def verify_integrity(self): ''' verify the integrity of the current option set @raises - ArgError if the options are invalid ''' if snap.config.options
if type(val) == str: snap.config.options.target_backends[backend] = True val = ConfigFile.string_to_array(val) for include in val: if include[0] == '!': snap.config.options.target_excludes[backend].append(inc...
conditional_block
bam.js
{ obj = undefined; } if (typeof obj === 'object') { return map(objectKeys(obj), function(k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (isArray(obj[k])) { return map(obj[k], function(v) { return ks + encodeURIComponent(stringifyPrimitive(v)); }).joi...
var objectKeys = Object.keys || function (obj) { var res = []; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } return res; }; },{}],4:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = export...
{ if (xs.map) return xs.map(f); var res = []; for (var i = 0; i < xs.length; i++) { res.push(f(xs[i], i)); } return res; }
identifier_body
bam.js
return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); }; var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; function map (xs, f) { if (xs.map) return xs.map(f); var res = []; for (var i =...
ctor
identifier_name
bam.js
= new ctor(); child.__super__ = parent.prototype; return child; }, __slice = [].slice; Backbone = require('backbone'); querystring = require('querystring'); _ = require('underscore'); extend = _.extend, object = _.object, isRegExp = _.isRegExp, isFunction = _.isFunction, zip = _.zip, pluck = _.pluck, sortBy = _....
View.prototype.addChild = function(view) {
random_line_split
bam.js
{ obj = undefined; } if (typeof obj === 'object') { return map(objectKeys(obj), function(k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (isArray(obj[k])) { return map(obj[k], function(v) { return ks + encodeURIComponent(stringifyPrimitive(v)); }).joi...
} return ret; }; /* Take a value, and a casting definition and perform the cast */ Model.prototype._cast = function(value, cast) { var error; try { return value = this._getCastFunc(cast)(value); } catch (_error) { error = _error; return value = null; } finally { ...
{ this.trigger("change:" + derived, this._derive(definition)); }
conditional_block
main.py
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do s...
(self, orig=None): self.reset() # copy constructor if orig: assert isinstance(orig, Reversi) for i in range(8): for j in range(8): self.board[i][j] = orig.board[i][j] def count(self, bwe): "Count pieces or empty spaces in the board" assert bwe in (BLACK,...
__init__
identifier_name
main.py
this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,...
def reversible_directions(self, bw, x, y): "Can put piece on (x, y) ? Return list of reversible direction tuple" assert bw in (BLACK, WHITE) directions = [] if self.board[x][y] != EMPTY: return directions for d in itertools.product([-1, 1, 0], [-1, 1, 0]): if d == (0, 0): ...
return False if self.board[x][y] == bw: return True return self._has_my_piece(bw, x, y, delta_x, delta_y)
random_line_split
main.py
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do s...
def _reverse_piece(self, bw, x, y, delta_x, delta_y): "Reverse pieces in the direction of (delta_x, delta_y) from (x, y) untill bw." assert bw in (BLACK, WHITE) x += delta_x y += delta_y assert self.board[x][y] in (BLACK, WHITE) if self.board[x][y] == bw: return sel...
"Can put piece on (x, y) ? Return list of reversible direction tuple" assert bw in (BLACK, WHITE) directions = [] if self.board[x][y] != EMPTY: return directions for d in itertools.product([-1, 1, 0], [-1, 1, 0]): if d == (0, 0): continue nx = x + d[0] ny = y...
identifier_body
main.py
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do s...
board.put_attribute( "class", {EMPTY: 'none', BLACK: 'black', WHITE: 'white'}[r]) board.pop_tag() board.pop_tag() dom.inner("board", board) dom.set_values({ "black": reversi.count(BLACK), "white": reversi.count(WHITE) }) def acConnect(reversi, dom): reversi.pl...
r = reversi.player board.put_attribute( "style", "opacity: 0.1; background-color: white;")
conditional_block
Signature.d.ts
declare namespace jsrsasign.KJUR.crypto { /** * Signature class which is very similar to java.security.Signature class * @param params parameters for constructor * @description * As for params of constructor's argument, it can be specify following attributes: * - alg - signature algorithm n...
{ /** Current state of this signature object whether 'SIGN', 'VERIFY' or null */ static readonly state: 'SIGN' | 'VERIFY' | null; constructor(params?: { alg?: string }); /** * set signature algorithm and provider * @param alg signature algorithm name * @para...
Signature
identifier_name
Signature.d.ts
declare namespace jsrsasign.KJUR.crypto { /** * Signature class which is very similar to java.security.Signature class * @param params parameters for constructor * @description * As for params of constructor's argument, it can be specify following attributes: * - alg - signature algorithm n...
* sig.init(prvKeyPEM); * sig.updateString('aaa'); * var hSigVal = sig.sign(); * * // DSA signature validation * var sig2 = new KJUR.crypto.Signature({"alg": "SHA1withDSA"}); * sig2.init(certPEM); * sig.updateString('aaa'); * var isValid = sig2.verify(hSigVal); * * ...
* var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"});
random_line_split
common.py
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- # --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2005-2009 Skomoroh # # This program is free software...
(font): # create font name # i.e. "helvetica 12" -> ("helvetica", 12, "roman", "normal") if (TOOLKIT == 'kivy'): return "helvetica 12" from six.moves.tkinter_font import Font font_name = None try: f = Font(font=font) except Exception: print_err(_('invalid font name:...
get_font_name
identifier_name
common.py
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- # --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2005-2009 Skomoroh # # This program is free software...
def base_init_root_window(root, app): # root.wm_group(root) root.wm_title(TITLE + ' ' + VERSION) root.wm_iconname(TITLE + ' ' + VERSION) # set minsize sw, sh = (root.winfo_screenwidth(), root.winfo_screenheight()) if sw < 640 or sh < 480: root.wm_minsize(400, 300) else: roo...
random_line_split
common.py
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- # --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2005-2009 Skomoroh # # This program is free software...
canvas_padding = (0, 0) horizontal_toolbar_padding = (0, 0) vertical_toolbar_padding = (0, 1) toolbar_button_padding = (2, 2) toolbar_label_padding = (4, 4) if USE_TILE: toolbar_relief = 'flat' toolbar_borderwidth = 0 else: toolbar_relief = 'raised' toolbar_button...
identifier_body
common.py
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- # --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2005-2009 Skomoroh # # This program is free software...
from six.moves.tkinter_font import Font font_name = None try: f = Font(font=font) except Exception: print_err(_('invalid font name: ') + font) if DEBUG: traceback.print_exc() else: fa = f.actual() font_name = (fa['family'], f...
return "helvetica 12"
conditional_block
Zinser_Assignment8.py
intended letter as key, and observed letters with frequencies as value emis_freq = {} #Fill dictionary with dictionaries, and those with letter entries (init to 0) for i in letters: emis_freq[i] = {} for j in letters: emis_freq[i][j] = 0 #Transition dictionary #Dictionary that stores the first letter (t) ...
(evid, hidd, star, tran, emis): '''Spaces have a 1.0 emission prob, since they are uncorrupted''' '''Use math libraries log2 to convert to log base 2 for math. Convert back with math libraries pow(2, num) if desired''' '''Log2 can still use max. log2(0.8) > log2(0.2)''' #Create list that uses the time as the index...
furby
identifier_name
Zinser_Assignment8.py
the intended letter as key, and observed letters with frequencies as value emis_freq = {} #Fill dictionary with dictionaries, and those with letter entries (init to 0) for i in letters: emis_freq[i] = {} for j in letters: emis_freq[i][j] = 0 #Transition dictionary #Dictionary that stores the first letter ...
temp_path = {} #Iterate through all possible states that are connected to the previous state chosen for j in hidd: #Use list comprehension to iterate through states, calculate trans*emis*P[t-1] for each possible state, find max and store that in path (prob, state) = max((P[i-1][k] + log2(tran[k][j]) + log2...
'''Spaces have a 1.0 emission prob, since they are uncorrupted''' '''Use math libraries log2 to convert to log base 2 for math. Convert back with math libraries pow(2, num) if desired''' '''Log2 can still use max. log2(0.8) > log2(0.2)''' #Create list that uses the time as the index and the value is a dict to store...
identifier_body
Zinser_Assignment8.py
intended letter as key, and observed letters with frequencies as value emis_freq = {} #Fill dictionary with dictionaries, and those with letter entries (init to 0) for i in letters: emis_freq[i] = {} for j in letters: emis_freq[i][j] = 0 #Transition dictionary #Dictionary that stores the first letter (t) ...
path[i] = [i] #Run for t > 1, start at second letter for i in range(1,len(evid)): #Create new dict at end of list of dicts (dict for each time value) P.append({}) #Dict to temporarily store path for this iteration temp_path = {} #Iterate through all possible states that are connected to the previous sta...
#Create dict for t(0) (seed dict with inital entries) #Iterate through start dict (Contains all states that sequence can start with) for i in star: #Calculate probability with start[letter]*emission (add instead of multiply with log numbers) P[0][i] = log2(star[i])+log2(emis[i][evid[0]])
random_line_split
Zinser_Assignment8.py
intended letter as key, and observed letters with frequencies as value emis_freq = {} #Fill dictionary with dictionaries, and those with letter entries (init to 0) for i in letters: emis_freq[i] = {} for j in letters: emis_freq[i][j] = 0 #Transition dictionary #Dictionary that stores the first letter (t) ...
#Open the file with open(name,"r") as data_in: #Store the last char last_char = "" #Bool to see if this is the rist char first_char = True #Iterate through the file line by line for i in data_in.readlines(): #Initial #Increment the first col characters frequency in the intial dict init_freq[i[...
init_freq[i] = 0
conditional_block
ly_proxy_test.py
# Author: Jason Lu import urllib.request from bs4 import BeautifulSoup import time req_header = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', #'Accept-Language': 'en-U...
print(str(e)) continue file1.close() print(checked_num,grasp_num)
:
conditional_block
ly_proxy_test.py
# Author: Jason Lu import urllib.request from bs4 import BeautifulSoup import time req_header = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', #'Accept-Language': 'en-U...
proxyHandler = urllib.request.ProxyHandler({"http": r'http://%s:%s' % (ip, port)}) opener = urllib.request.build_opener(cookies, proxyHandler) opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like G...
if protocol == 'HTTP' or protocol == 'HTTPS': #of.write('%s=%s:%s\n' % (protocol, ip, port)) print('%s=%s:%s' % (protocol, ip, port)) grasp_num +=1
random_line_split
__init__.py
import socket from .attrtree import AttrTree from .checks import Checks config = AttrTree() # the list of checks config.install_attr('checks', Checks()) # This is the base granularity (in seconds) for polling # Each check may then individually be configured to run every N * tick config.install_attr('base_tick', 60)...
# Verbosity level (one of CRITICAL, ERROR, WARNING, INFO, DEBUG) config.install_attr('verb_level', 'INFO') # Email addresses to send to when an alert is triggered config.install_attr('emails.to', []) # The From: address config.install_attr('emails.addr_from', 'Picomon <picomon@%s>' % socket.getfqdn...
random_line_split
dis.rs
processor jumps to the code segment and offset specified with the // > target operand. Here the target operand specifies an absolute far // > address either directly with a pointer (ptr16:16 or ptr16:32) or // > indirectly with a memory location (m16:16 or m16:32). With the // > pointer method, the seg...
{ // this is a jump from addr 0x0 to itmodule: // JMP $+0; let module = load_shellcode32(b"\xEB\xFE"); let insn = read_insn(&module, 0x0); let op = get_first_operand(&insn).unwrap(); let xref = get_immediate_operand_xref(&module, 0x0, &insn, &op).unwrap(); assert...
identifier_body
dis.rs
}; // must be mapped if module.probe_va(dst, Permissions::RWX) { Ok(Some(dst)) } else { // invalid address Ok(None) } } else { // the operand is an immediate absolute address. let dst = if op.imm.is_signed { let imm =...
let absolute_address = unsafe { // safety: the insn and operands come from zydis, so we assume they contain // valid data. let insn: &zydis::DecodedInstruction = &*ctx.instruction;
random_line_split
dis.rs
401000]` // fetch the pointer, rather than the dest, // so like `0x401000`. #[allow(clippy::if_same_then_else)] pub fn get_memory_operand_ptr( va: VA, insn: &zydis::DecodedInstruction, op: &zydis::DecodedOperand, ) -> Result<Option<VA>> { if op.mem.base == zydis::Register::NONE && op.mem.index =...
test_get_memory_operand_xref_simple
identifier_name
utils.js
'use strict'; var fs = require('fs'), request = require('request'), wikiParser = require('./wikiparser'), _ = require('lodash'); var fns = { getSlugNameFor: function(str) { var slug = str.replace(/\s+/g, '-').toLowerCase(); return slug; }, extendWithJSONs: function(series) { for (var se...
else if (episode.dateObj.getTime() > nowDate && episode.dateObj.getTime() < afterDate) { showsAfter.push({ series: key, season: season.season, episode: episode}); } }); }); } }); return { showsBefore: _.sortBy(showsBefore, function(n) { return n....
{ showsBefore.push({ series: key, season: season.season, episode: episode}); }
conditional_block
utils.js
'use strict'; var fs = require('fs'), request = require('request'), wikiParser = require('./wikiparser'), _ = require('lodash'); var fns = { getSlugNameFor: function(str) { var slug = str.replace(/\s+/g, '-').toLowerCase(); return slug; }, extendWithJSONs: function(series) { for (var se...
writeJSON: function(fileName, jsonData) { return new Promise(function (fulfill, reject) { fs.writeFile(fileName, JSON.stringify(jsonData, null, 2), function(err) { if (err) { reject() } else { fulfill(); } }); }); }, findSeriesByTitle: function(titl...
},
random_line_split
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
(&self) -> &SharedStyleContext { &self.style_context } pub fn get_or_request_image_or_meta(&self, node: OpaqueNode, url: ServoUrl, use_placeholder: UsePlaceholder) ...
shared_context
identifier_name
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
pub registered_painters: &'a RegisteredPainters, /// A list of in-progress image loads to be shared with the script thread. /// A None value means that this layout was not initiated by the script thread. pub pending_images: Option<Mutex<Vec<PendingImage>>>, /// A list of nodes that have just initi...
pub webrender_image_cache: Arc<RwLock<HashMap<(ServoUrl, UsePlaceholder), WebRenderImageInfo, BuildHasherDefault<FnvHasher>>>>, /// Paint worklets
random_line_split
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
/// Layout information shared among all workers. This must be thread-safe. pub struct LayoutContext<'a> { /// The pipeline id of this LayoutContext. pub id: PipelineId, /// Bits shared by the layout and style system. pub style_context: SharedStyleContext<'a>, /// Reference to the script thread i...
{ FONT_CONTEXT_KEY.with(|r| { if let Some(ref context) = *r.borrow() { context.size_of(ops) } else { 0 } }) }
identifier_body
context.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/. */ //! Data needed by the layout thread. use fnv::FnvHasher; use gfx::display_list::{WebRenderImageInfo, OpaqueNode}...
else { 0 } }) } /// Layout information shared among all workers. This must be thread-safe. pub struct LayoutContext<'a> { /// The pipeline id of this LayoutContext. pub id: PipelineId, /// Bits shared by the layout and style system. pub style_context: SharedStyleContext<'a>, ...
{ context.size_of(ops) }
conditional_block
pretty.rs
use chrono::*; pub use super::split; pub fn pretty_short(dur: Duration) -> String { let components = split::split_duration(dur).as_vec(); let mut components_iter = components.iter().skip_while(|a| a.val() == 0); let first_component = components_iter.next(); let second_component = components_iter.next(...
(val: &split::TimePeriod) -> Option<&split::TimePeriod> { if val.val() == 0 {return None}; return Some(val); } return final_str; } pub fn pretty_full(dur: Duration) -> String { let components = split::split_duration(dur); let mut final_str = String::new(); for (i, component) in co...
has_second
identifier_name
pretty.rs
use chrono::*; pub use super::split; pub fn pretty_short(dur: Duration) -> String { let components = split::split_duration(dur).as_vec(); let mut components_iter = components.iter().skip_while(|a| a.val() == 0); let first_component = components_iter.next(); let second_component = components_iter.next(...
, // The duration is 0 None => {split::TimePeriod::Millisecond(0).to_string()}, }; fn has_second(val: &split::TimePeriod) -> Option<&split::TimePeriod> { if val.val() == 0 {return None}; return Some(val); } return final_str; } pub fn pretty_full(dur: Duration) -> Strin...
{ match second_component.and_then(has_second) { Some(y) => {format!("{} and {}", x.to_string(), y.to_string())}, None => {x.to_string()} } }
conditional_block
pretty.rs
use chrono::*; pub use super::split; pub fn pretty_short(dur: Duration) -> String { let components = split::split_duration(dur).as_vec(); let mut components_iter = components.iter().skip_while(|a| a.val() == 0); let first_component = components_iter.next(); let second_component = components_iter.next(...
assert_eq!(pretty_short(dur), final_str); } }
random_line_split
pretty.rs
use chrono::*; pub use super::split; pub fn pretty_short(dur: Duration) -> String { let components = split::split_duration(dur).as_vec(); let mut components_iter = components.iter().skip_while(|a| a.val() == 0); let first_component = components_iter.next(); let second_component = components_iter.next(...
{ let test_data = vec![ (Duration::milliseconds(0), "0 milliseconds"), (Duration::milliseconds(1), "1 millisecond"), (-Duration::milliseconds(1), "1 millisecond"), (Duration::milliseconds(200), "200 milliseconds"), (Duration::seconds(1) + Duration::milliseconds(200), "1 secon...
identifier_body
api_boilerplate.py
""" This module is responsible for doing all the authentication. Adapted from the Google API Documentation. """ from __future__ import print_function import os import httplib2 import apiclient import oauth2client try: import argparse flags = argparse.ArgumentParser( parents=[oauth2client.tools.argpar...
(): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential. """ home_dir = os.path.expanduser('~') credential_dir = ...
get_credentials
identifier_name
api_boilerplate.py
""" This module is responsible for doing all the authentication. Adapted from the Google API Documentation. """ from __future__ import print_function import os import httplib2 import apiclient import oauth2client try: import argparse flags = argparse.ArgumentParser( parents=[oauth2client.tools.argpar...
flow.user_agent = APPLICATION_NAME if flags: credentials = oauth2client.tools.run_flow(flow, store, flags) else: # Needed only for compatibility with Python 2.6 credentials = oauth2client.tools.run(flow, store) print('Storing credentials to ' + credential_path) ...
"""Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential. """ home_dir = os.path.expanduser('~') credential_dir = os.path....
identifier_body
api_boilerplate.py
""" This module is responsible for doing all the authentication. Adapted from the Google API Documentation. """ from __future__ import print_function import os import httplib2 import apiclient import oauth2client try: import argparse flags = argparse.ArgumentParser( parents=[oauth2client.tools.argpar...
print('Storing credentials to ' + credential_path) return credentials credentials = get_credentials() http = credentials.authorize(httplib2.Http()) file_service = apiclient.discovery.build('drive', 'v3', http=http).files()
credentials = oauth2client.tools.run(flow, store)
conditional_block
api_boilerplate.py
""" This module is responsible for doing all the authentication. Adapted from the Google API Documentation. """ from __future__ import print_function import os import httplib2 import apiclient import oauth2client try: import argparse flags = argparse.ArgumentParser( parents=[oauth2client.tools.argpar...
CLIENT_SECRET_FILE = 'client_secret.json' # Enter your project name here!! APPLICATION_NAME = 'API Project' def get_credentials(): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials...
random_line_split
data-xml-debug.js
Represents the name of the xml root-tag when sending <b>multiple</b> records to the server.</li> * <li>{Array} records The records being sent to the server, ie: the subject of the write-action being performed. The records parameter will be always be an array, even when only a single record is being acted upon. ...
{ success = this.getSuccess(root); }
conditional_block
data-xml-debug.js
: baseParams, records: (Ext.isArray(data[0])) ? data : [data] }); }, /** * createRecord * @protected * @param {Ext.data.Record} rec * @return {Array} Array of <tt>name:value</tt> pairs for attributes of the {@link Ext.data.Record}. See {@link Ext.data.DataWriter#toHash}...
random_line_split
index.tsx
import * as React from 'react' import * as classnames from 'classnames' import { A } from '~/components/Typography' import { ILocation } from '~/models/location' import { IRouteConfig } from '~/models/route-config' const s = require('./style.css') const classes = (currPath: string) => ({ path }: ...
const Header = ({ routes, location }: { routes: IRouteConfig[], location: ILocation }) => ( <nav className={s.nav}> <ul> {routes.map(HeaderItem(location.pathname))} </ul> </nav> ) export { Header }
random_line_split
kendo.culture.nso-ZA.js
/** * Copyright 2015 Telerik AD * * 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 ...
}, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
return window.kendo;
random_line_split
build.rs
// Copyright (C) 2016 ParadoxSpiral // // This file is part of mpv-rs. // // This library 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...
let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set"); if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" { println!("cargo:rustc-link-search={}/64/", source); } else { println!("cargo:rustc-link-search={}/32/", source); } } #[cfg(all(feature = "build_l...
random_line_split
build.rs
// Copyright (C) 2016 ParadoxSpiral // // This file is part of mpv-rs. // // This library 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...
() { let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set"); if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" { println!("cargo:rustc-link-search={}/64/", source); } else { println!("cargo:rustc-link-search={}/32/", source); } } #[cfg(all(feature = "bu...
main
identifier_name
build.rs
// Copyright (C) 2016 ParadoxSpiral // // This file is part of mpv-rs. // // This library 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...
// x86_64-unknown-linux-gnu, thus the script can't find the compiler. // TODO: When Cross-compiling to different archs is implemented, this has to be handled. env::remove_var("TARGET"); let cmd = format!( "cd {} && echo \"--enable-libmpv-shared\" > {0}/mpv_options \ && {0}/build -j{}",...
{ let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set"); let num_threads = env::var("NUM_JOBS").unwrap(); // `target` (in cfg) doesn't really mean target. It means target(host) of build script, // which is a bit confusing because it means the actual `--target` everywhere else. ...
identifier_body
build.rs
// Copyright (C) 2016 ParadoxSpiral // // This file is part of mpv-rs. // // This library 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...
} #[cfg(target_pointer_width = "32")] { if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" { panic!("Cross-compiling to different arch not yet supported"); } } // The mpv build script interprets the TARGET env var, which is set by cargo to e.g. // x86_64...
{ panic!("Cross-compiling to different arch not yet supported"); }
conditional_block
launchtree_loader.py
#!/usr/bin/env python import sys from roslaunch.xmlloader import XmlLoader, loader from rosgraph.names import get_ros_namespace from rqt_launchtree.launchtree_context import LaunchtreeContext class LaunchtreeLoader(XmlLoader): def _include_tag(self, tag, context, ros_config, default_machine, is_core, verbose): i...
(self, tag, context, ros_config, default_machine, is_test=False, verbose=True): try: if is_test: self._check_attrs(tag, context, ros_config, XmlLoader.TEST_ATTRS) (name,) = self.opt_attrs(tag, context, ('name',)) test_name, time_limit, retry = self._test_attrs(tag, context) if not name: ...
_node_tag
identifier_name
launchtree_loader.py
#!/usr/bin/env python import sys from roslaunch.xmlloader import XmlLoader, loader from rosgraph.names import get_ros_namespace from rqt_launchtree.launchtree_context import LaunchtreeContext class LaunchtreeLoader(XmlLoader): def _include_tag(self, tag, context, ros_config, default_machine, is_core, verbose): i...
if argv is None: argv = sys.argv self._launch_tag(launch, ros_config, filename) self.root_context = LaunchtreeContext(get_ros_namespace(), filename, config=ros_config) loader.load_sysargs_into_context(self.root_context, argv) if len(launch.getElementsByTagName('master')) > 0: print "WARNING: ignoring de...
identifier_body
launchtree_loader.py
#!/usr/bin/env python import sys from roslaunch.xmlloader import XmlLoader, loader from rosgraph.names import get_ros_namespace from rqt_launchtree.launchtree_context import LaunchtreeContext class LaunchtreeLoader(XmlLoader): def _include_tag(self, tag, context, ros_config, default_machine, is_core, verbose): i...
except Exception as e: pass # will be handled in super ros_config.push_level(name) result = super(LaunchtreeLoader, self)._node_tag(tag, context, ros_config, default_machine, is_test, verbose) ros_config.pop_level() return result def _rosparam_tag(self, tag, context, ros_config, verbose): param_file =...
(name,) = self.reqd_attrs(tag, context, ('name',))
random_line_split
launchtree_loader.py
#!/usr/bin/env python import sys from roslaunch.xmlloader import XmlLoader, loader from rosgraph.names import get_ros_namespace from rqt_launchtree.launchtree_context import LaunchtreeContext class LaunchtreeLoader(XmlLoader): def _include_tag(self, tag, context, ros_config, default_machine, is_core, verbose): i...
result = super(LaunchtreeLoader, self)._rosparam_tag(tag, context, ros_config, verbose) if param_file != '': ros_config.pop_level() context.add_rosparam(tag.attributes.get('command', 'load'), param_filename, level_name) return result def _load_launch(self, launch, ros_config, is_core=False, filename=Non...
param_filename = self.resolve_args(param_file, context) level_name = ros_config.push_level(param_filename, unique=True)
conditional_block
exportWCON.py
import WormStats from tierpsy.helper.params import read_unit_conversions, read_ventral_side, read_fps def getWCONMetaData(fname, READ_FEATURES=False, provenance_step='FEAT_CREATE'): def _order_metadata(metadata_dict): ordered_fields = ['strain', 'timestamp', 'gene', 'chromosome', 'allele', 'stra...
#start ordered dictionary with the basic features worm_basic = OrderedDict() worm_basic['id'] = str(worm_id) worm_basic['head'] = 'L' worm_basic['ventral'] = ventral_side worm_basic['ptail'] = worm_ven_cnt.shape[1]-1 #index starting with 0 ...
worm_dor_cnt = dorsal_contours[worm_feat_time.index] worm_ven_cnt = ventral_contours[worm_feat_time.index]
random_line_split
exportWCON.py
import WormStats from tierpsy.helper.params import read_unit_conversions, read_ventral_side, read_fps def getWCONMetaData(fname, READ_FEATURES=False, provenance_step='FEAT_CREATE'): def _order_metadata(metadata_dict): ordered_fields = ['strain', 'timestamp', 'gene', 'chromosome', 'allele', 'stra...
return worm_features def _get_ventral_side(features_file): ventral_side = read_ventral_side(features_file) if not ventral_side or ventral_side == 'unknown': ventral_type = '?' else: #we will merge the ventral and dorsal contours so the ventral contour is clockwise ven...
feature_path = worm_path + '/' + feature_name worm_features[feature_name] = fid.get_node(feature_path)[:]
conditional_block
exportWCON.py
import WormStats from tierpsy.helper.params import read_unit_conversions, read_ventral_side, read_fps def getWCONMetaData(fname, READ_FEATURES=False, provenance_step='FEAT_CREATE'): def _order_metadata(metadata_dict): ordered_fields = ['strain', 'timestamp', 'gene', 'chromosome', 'allele', 'stra...
def _get_ventral_side(features_file): ventral_side = read_ventral_side(features_file) if not ventral_side or ventral_side == 'unknown': ventral_type = '?' else: #we will merge the ventral and dorsal contours so the ventral contour is clockwise ventral_type='CW' return vent...
worm_features = OrderedDict() #add time series features for col_name, col_dat in worm_feat_time.iteritems(): if not col_name in ['worm_index', 'timestamp']: worm_features[col_name] = col_dat.values worm_path = '/features_events/worm_%i' % worm_id worm_node = fid.get_node(worm_pa...
identifier_body
exportWCON.py
import WormStats from tierpsy.helper.params import read_unit_conversions, read_ventral_side, read_fps def getWCONMetaData(fname, READ_FEATURES=False, provenance_step='FEAT_CREATE'): def _order_metadata(metadata_dict): ordered_fields = ['strain', 'timestamp', 'gene', 'chromosome', 'allele', 'stra...
(features_file, READ_FEATURES=False, IS_FOR_WCON=True): if IS_FOR_WCON: lab_prefix = '@OMG ' else: lab_prefix = '' with pd.HDFStore(features_file, 'r') as fid: if not '/features_timeseries' in fid: return {} #empty file nothing to do here features_timeseries =...
_getData
identifier_name
seed.config.ts
JavaScript files. * @type {string} */ JS_DEST = `${this.APP_DEST}/js`; /** * The version of the application as defined in the `package.json`. */ VERSION = appVersion(); /** * The name of the bundle file to includes all CSS files. * @type {string} */ CSS_PROD_BUNDLE = 'all.css'; /** ...
{ (<any>d).env = [d.env]; }
conditional_block
seed.config.ts
runtime. * The default path is `/`, which can be overriden by the `--base` flag when running `npm start`. * @type {string} */ APP_BASE = argv['base'] || '/'; /** * The flag to include templates into JS app prod file. * Per default the option is `true`, but can it can be set to false using `--inline...
(): InjectableDependency[] { return normalizeDependencies(this.NPM_DEPENDENCIES.filter(filterDependency.bind(null, this.ENV))) .concat(this.APP_ASSETS.filter(filterDependency.bind(null, this.ENV))); } /** * The configuration of SystemJS for the `dev` environment. * @type {any} */ protected SYS...
DEPENDENCIES
identifier_name
seed.config.ts
runtime. * The default path is `/`, which can be overriden by the `--base` flag when running `npm start`. * @type {string} */ APP_BASE = argv['base'] || '/'; /** * The flag to include templates into JS app prod file. * Per default the option is `true`, but can it can be set to false using `--inline...
*/ TARGET_DESKTOP_BUILD = false; /** * The directory where the bootstrap file is located. * The default directory is `app`. * @type {string} */ BOOTSTRAP_DIR = 'app'; /** * The directory where the client files are located. * The default directory is `client`. * @type {string} */ ...
random_line_split
seed.config.ts
'shims.js'; /** * The name of the bundle file to include all JavaScript application files. * @type {string} */ JS_PROD_APP_BUNDLE = 'app.js'; /** * The required NPM version to run the application. * @type {string} */ VERSION_NPM = '3.0.0'; /** * The required NodeJS version to run the ...
{ var lintConf = require('../../tslint.json'); return lintConf.rulesDirectory; }
identifier_body
tco-cross-realm-class-construct.js
/* * Copyright (c) André Bargull * Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms. * * <https://github.com/anba/es6draft> */ /*--- id: sec-function-calls-runtime-semantics-evaluation info: Check TypeError is thrown from correct realm with tco-call to class constructor from class [[...
// - The class constructor call is in a valid tail-call position, which means PrepareForTailCall is performed. // - The function call returns from `otherRealm` and proceeds the tail-call in this realm. // - Calling the class constructor throws a TypeError from the current realm, that means this realm and not `otherRea...
---*/
random_line_split
expr-block-generic-box2.rs
// Copyright 2012-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...
pub fn main() { test_vec(); }
{ fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; } test_generic::<@int>(@1, compare_vec); }
identifier_body
expr-block-generic-box2.rs
// Copyright 2012-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...
<T:Clone>(expected: T, eq: compare<T>) { let actual: T = { expected.clone() }; assert!((eq(expected, actual))); } fn test_vec() { fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; } test_generic::<@int>(@1, compare_vec); } pub fn main() { test_vec(); }
test_generic
identifier_name
expr-block-generic-box2.rs
// Copyright 2012-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...
pub fn main() { test_vec(); }
fn test_vec() { fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; } test_generic::<@int>(@1, compare_vec); }
random_line_split
p2p-versionbits-warning.py
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Copyright (c) 2016 The Bitcoin Unlimited developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.mininode import * from test_fram...
block = create_block(tip, create_coinbase(height+1), block_time) block.nVersion = nVersionToUse block.solve() peer.send_message(msg_block(block)) block_time += 1 height += 1 tip = block.sha256 peer.sync_with_ping() def test...
tip = int(tip, 16) for i in range(numblocks):
random_line_split
p2p-versionbits-warning.py
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Copyright (c) 2016 The Bitcoin Unlimited developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.mininode import * from test_fram...
self.ping_counter += 1 return received_pong class VersionBitsWarningTest(BitcoinTestFramework): def setup_chain(self): initialize_chain_clean(self.options.tmpdir, 1) def setup_network(self): self.nodes = [] self.alert_filename = os.path.join(self.options.tmpdir, "aler...
time.sleep(sleep_time) timeout -= sleep_time with mininode_lock: if self.last_pong.nonce == self.ping_counter: received_pong = True
conditional_block
p2p-versionbits-warning.py
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Copyright (c) 2016 The Bitcoin Unlimited developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.mininode import * from test_fram...
(BitcoinTestFramework): def setup_chain(self): initialize_chain_clean(self.options.tmpdir, 1) def setup_network(self): self.nodes = [] self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt") # Open and close to create zero-length file with open(self.alert_fi...
VersionBitsWarningTest
identifier_name
p2p-versionbits-warning.py
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Copyright (c) 2016 The Bitcoin Unlimited developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.mininode import * from test_fram...
tip = int(tip, 16) for i in range(numblocks): block = create_block(tip, create_coinbase(height+1), block_time) block.nVersion = nVersionToUse block.solve() peer.send_message(msg_block(block)) block_time += 1 height += 1 ...
def setup_chain(self): initialize_chain_clean(self.options.tmpdir, 1) def setup_network(self): self.nodes = [] self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt") # Open and close to create zero-length file with open(self.alert_filename, 'w') as f: ...
identifier_body
AlertControl.tsx
import * as React from 'react'; import { AccessPropertyName, Alert, AlertType } from '../Models'; import { ApplicationState, AppThunkAction } from '../store'; import { CloseAlertAction } from '../store/Alert'; export interface AlertProps { items: Alert[]; closeAlert(id: number): AppThunkAction<CloseAlertActio...
extends React.Component<AlertProps, {}> { public render() { return ( <div className="alerts"> {this.props.items.map(this.renderAlert)} </div> ); } private renderAlert = (item: Alert) => { const closeAction = (e: any) => { e.preventDefault(); ...
App
identifier_name
AlertControl.tsx
import { ApplicationState, AppThunkAction } from '../store'; import { CloseAlertAction } from '../store/Alert'; export interface AlertProps { items: Alert[]; closeAlert(id: number): AppThunkAction<CloseAlertAction>; } export default class App extends React.Component<AlertProps, {}> { public render() { ...
import * as React from 'react'; import { AccessPropertyName, Alert, AlertType } from '../Models';
random_line_split
mdColors.js
/* * @license MIT * @file * @copyright KeyW Corporation 2016 */ (function () { "use strict"; var _theme; angular .module('mdColors',['mdColors']) .config(['$mdThemingProvider', function($mdThemingProvider){ _theme = $mdThemingProvider.theme(); }]) .directive('mdStyleColor', ['$mdCo...
* @param {} element * @param {} attrs */ link: function (scope, element, attrs) { for (var p in scope.mdStyleColor) { if (scope.mdStyleColor.hasOwnProperty(p)) { var themeColors = _theme.colors; var split = (scope.mdS...
scope: { mdStyleColor: '=' }, /** * Description * @method link * @param {} scope
random_line_split
mdColors.js
/* * @license MIT * @file * @copyright KeyW Corporation 2016 */ (function () { "use strict"; var _theme; angular .module('mdColors',['mdColors']) .config(['$mdThemingProvider', function($mdThemingProvider){ _theme = $mdThemingProvider.theme(); }]) .directive('mdStyleColor', ['$mdCo...
var colorValue = $mdColorPalette[colorA][hueA] ? $mdColorPalette[colorA][hueA].value : $mdColorPalette[colorA]['500'].value; element.css(p, 'rgb('+colorValue.join(',')+')'); } } } } }]); }());
{ var themeColors = _theme.colors; var split = (scope.mdStyleColor[p] || '').split('.'); if (split.length < 2) split.unshift('primary'); var hueR = split[1] || 'hue-1'; // 'hue-1' var colorR = split[0] || 'primary'; // 'warn' ...
conditional_block
redact.test.ts
import * as samples from "../../support"; /** * Test for $redact operator * https://docs.mongodb.com/manual/reference/operator/aggregation/redact/ */ samples.runTestPipeline("operators/pipeline/redact", [ { message: "Evaluate Access at Every Document Level", input: [ { _id: 1, title:...
{ _id: 1, level: 1, acct_id: "xyz123", status: "A", }, ], }, ]);
expected: [
random_line_split
Toggle.js
import React from 'react'; import PropTypes from 'prop-types'; import generateId from 'extensions/generateId'; import Skeleton from 'skeletons/Skeleton'; import * as styles from './styles'; /** * A simple `Toggle` component thta can be turned on and off. Use `checked` to set * whether the `Toggle` is selected. */ c...
id={finalId} className={className} name={name} type="checkbox" disabled={disabled} checked={checked} value={value} required={required} onChange={onChange} {...rest} /> <Label htmlFor={finalId}>{descriptio...
{ const { className, disabled, required, name, description, onChange, Container, Input, Label, id, value, checked, ...rest } = this.props; const finalId = id || this.defaultId; return ( <Container> <Input
identifier_body
Toggle.js
import React from 'react'; import PropTypes from 'prop-types'; import generateId from 'extensions/generateId'; import Skeleton from 'skeletons/Skeleton'; import * as styles from './styles'; /** * A simple `Toggle` component thta can be turned on and off. Use `checked` to set * whether the `Toggle` is selected. */ c...
extends React.PureComponent { static propTypes = { /** * Adds a class name to the input element. */ className: PropTypes.string, /** * Adds an id to the input element. */ id: PropTypes.string, /** * The literal value this toggle represents. For example, if this toggle ...
Toggle
identifier_name
Toggle.js
import React from 'react'; import PropTypes from 'prop-types'; import generateId from 'extensions/generateId'; import Skeleton from 'skeletons/Skeleton'; import * as styles from './styles'; /** * A simple `Toggle` component thta can be turned on and off. Use `checked` to set * whether the `Toggle` is selected. */ c...
* Adds a class name to the input element. */ className: PropTypes.string, /** * Adds an id to the input element. */ id: PropTypes.string, /** * The literal value this toggle represents. For example, if this toggle * represents whether the app is in "Dark Mode", you might pr...
static propTypes = { /**
random_line_split
add-credit-card.directive.ts
/* * Copyright (c) [2015] - [2017] Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ...
nameInput: 'input[name="deskcardholder"]', // optional - defaults input[name="name"] // width: 200, // optional — default 350px formatting: true // optional - default true }); let deregistrationFn = $scope.$watch(() => { return $element.find('input[name="deskcardNumber"]').is(':visible'); },...
numberInput: 'input[name="deskcardNumber"]', // optional — default input[name="number"] expiryInput: 'input[name="deskexpires"]', // optional — default input[name="expiry"] cvcInput: 'input[name="deskcvv"]', // optional — default input[name="cvc"]
random_line_split
add-credit-card.directive.ts
/* * Copyright (c) [2015] - [2017] Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ...
{ $timeout: ng.ITimeoutService; restrict: string = 'E'; replace: boolean = false; templateUrl: string = 'app/billing/card-info/add-credit-card/add-credit-card.html'; bindToController: boolean = true; controller: string = 'AddCreditCardController'; controllerAs: string = 'addCreditCardController'; s...
AddCreditCard
identifier_name
add-credit-card.directive.ts
/* * Copyright (c) [2015] - [2017] Red Hat, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ...
} }
deregistrationFn(); this.$timeout(() => { $element.find('input[name="deskcardNumber"]').focus(); }, 100); } });
conditional_block
palette-sort.py
_PARTITIONED = 3 SELECTIONS = (SELECT_ALL, SELECT_SLICE, SELECT_AUTOSLICE, SELECT_PARTITIONED) def noop(v, i): return v def to_hsv(v, i): return v.to_hsv() def to_hsl(v, i): return v.to_hsl() def to_yiq(v, i): return rgb_to_yiq(*v[:-1]) def to_index(v, i): return (i,) def to_random(v, i):...
if selection == SELECT_ALL: entry_list = get_colors(0, num_colors) entry_list.sort(key=lambda v:v[0]) for i in range(num_colors): pdb.gimp_palette_entry_set_name (palette, i, entry_list[i][1][0]) pdb.gimp_palette_entry_set_color (palette, i, entry_list[i][1][1]) ...
result = [] for i in range(start, end): entry = (pdb.gimp_palette_entry_get_name (palette, i), pdb.gimp_palette_entry_get_color (palette, i)) index1 = channels_getter_1(entry[1], i)[channel_index] index2 = channels_getter_2(entry[1], i)[channel2_index] ...
identifier_body
palette-sort.py
_PARTITIONED = 3 SELECTIONS = (SELECT_ALL, SELECT_SLICE, SELECT_AUTOSLICE, SELECT_PARTITIONED) def noop(v, i): return v def to_hsv(v, i): return v.to_hsv() def to_hsl(v, i): return v.to_hsl() def to_yiq(v, i): return rgb_to_yiq(*v[:-1]) def to_index(v, i): return (i,) def to_random(v, i):...
def palette_sort(palette, selection, slice_expr, channel1, ascending1, channel2, ascending2, quantize, pchannel, pquantize): grain1 = quantization_grain(channel1, quantize) grain2 = quantization_grain(channel2, quantize) pgrain = quantization_grain(pchannel, pquantize) #If palette is ...
random_line_split
palette-sort.py
: pass def parse_slice(s, numcolors): """Parse a slice spec and return (start, nrows, length) All items are optional. Omitting them makes the largest possible selection that exactly fits the other items. start:nrows,length '' selects all items, as does ':' ':4,' makes a 4-row selection ...
pdb.gimp_palette_entry_set_name (palette, i, entry[1][0]) pdb.gimp_palette_entry_set_color (palette, i, entry[1][1])
conditional_block
palette-sort.py
_PARTITIONED = 3 SELECTIONS = (SELECT_ALL, SELECT_SLICE, SELECT_AUTOSLICE, SELECT_PARTITIONED) def noop(v, i): return v def to_hsv(v, i): return v.to_hsv() def to_hsl(v, i): return v.to_hsl() def to_yiq(v, i): return rgb_to_yiq(*v[:-1]) def to_index(v, i): return (i,) def to_random(v, i):...
(c): return "#%02x%02x%02x" % tuple(c[:-1]) fg = pdb.gimp_context_get_foreground() bg = pdb.gimp_context_get_background() start = find_index(fg) end = find_index(bg) if start is None: raise ValueError("Couldn't find foreground color %r in palette" % list(f...
hexcolor
identifier_name
extractMenu.ts
// Extract menu still frames. /// <reference path="../../references.ts" /> 'use strict'; import path = require('path'); import serverUtils = require('../../server/utils/index'); import utils = require('../../utils'); import editMetadataFile = require('../../server/utils/editMetadataFile'); export = extractMenu; ...
(name: string): string { return path.join(webPath, getJsonFileName(name)); } } /** * Transform the file name of a JSON file. * * @param {string} name A file name. * @return {string} */ function getJsonFileName(name: string): string { return name.replace(/\.IFO$/i, '') + '.json'; }
getWebName
identifier_name