file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
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 ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: |&'a &'b uint|) { // 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 } fn ordering5<'a, 'b>(a: &'a uint, b: &'b uint, x: Option<&'a &'b uint>) { ...
random_line_split
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 ...
def __setPrecision(self): '''! ''' self.__pLat=self.spinBox_2.value() self.__pLon=self.spinBox_3.value() self.__pw=self.spinBox_4.value() self.__pN=self.spinBox_5.value() def __tabChanged(self): '''! ''' if self....
'''! ''' 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
# Snap! Configuration Manager # # (C) Copyright 2011 Mo Morsi (mo@morsi.org) # # This program is free software; you can redistribute it and/or modify # 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...
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
# Snap! Configuration Manager # # (C) Copyright 2011 Mo Morsi (mo@morsi.org) # # This program is free software; you can redistribute it and/or modify # 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...
(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
# Snap! Configuration Manager # # (C) Copyright 2011 Mo Morsi (mo@morsi.org) # # This program is free software; you can redistribute it and/or modify # 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...
def verify_integrity(self): ''' verify the integrity of the current option set @raises - ArgError if the options are invalid ''' if snap.config.options.mode == None: # mode not specified raise snap.exceptions.ArgError("Must specify backup or restore") i...
''' 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
# Snap! Configuration Manager # # (C) Copyright 2011 Mo Morsi (mo@morsi.org) # # This program is free software; you can redistribute it and/or modify # 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...
def verify_integrity(self): ''' verify the integrity of the current option set @raises - ArgError if the options are invalid ''' if snap.config.options.mode == None: # mode not specified raise snap.exceptions.ArgError("Must specify backup or restore") i...
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
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bam=e()}}(function(){var define,module,exports;return...
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
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bam=e()}}(function(){var define,module,exports;return...
() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __slice = [].slice; Backbone = require('backbone'); querystring = require('querystring'); _ = require('underscore'); extend = _.extend, object = _.object, isRegExp...
ctor
identifier_name
bam.js
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bam=e()}}(function(){var define,module,exports;return...
if (view.parent) { view.unsetParent(); } this.children.push(view); return view.parent = this; }; /* Sets the parent view. */ View.prototype.setParent = function(parent) { if (this.parent) { this.unsetParent(); } this.parent = parent; return this.parent.children....
View.prototype.addChild = function(view) {
random_line_split
bam.js
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bam=e()}}(function(){var define,module,exports;return...
} 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
""" MIT License Copyright (c) 2017 Hajime Nakagami<nakagami@gmail.com> Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49) 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 withou...
(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
""" MIT License Copyright (c) 2017 Hajime Nakagami<nakagami@gmail.com> Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49) 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 withou...
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
""" MIT License Copyright (c) 2017 Hajime Nakagami<nakagami@gmail.com> Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49) 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 withou...
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
""" MIT License Copyright (c) 2017 Hajime Nakagami<nakagami@gmail.com> Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49) 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 withou...
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
#Mitch Zinser #CSCI 3202 Assignment 8 #Worked with the Wikipedia Example and Brady Auen from math import log2 #For converting numbers to log base 2 '''PIPE TO EXTERNAL FILE WITH > filename.txt''' letters = 'abcdefghijklmnopqrstuvwxyz' '''File to read in data from, change this name to read from other files''' file_name ...
(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
#Mitch Zinser #CSCI 3202 Assignment 8 #Worked with the Wikipedia Example and Brady Auen from math import log2 #For converting numbers to log base 2 '''PIPE TO EXTERNAL FILE WITH > filename.txt''' letters = 'abcdefghijklmnopqrstuvwxyz' '''File to read in data from, change this name to read from other files''' file_name ...
#Function that takes in 2 strings of equal length and returns the error percent. String 1 is the correct string, string 2 is checked for errors def error_rate(correct, check): errors = 0 for i in range(0,len(correct)): if correct[i] != check[i]: errors += 1 return errors/len(correct) if __name__ == "__mai...
'''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
#Mitch Zinser #CSCI 3202 Assignment 8 #Worked with the Wikipedia Example and Brady Auen from math import log2 #For converting numbers to log base 2 '''PIPE TO EXTERNAL FILE WITH > filename.txt''' letters = 'abcdefghijklmnopqrstuvwxyz' '''File to read in data from, change this name to read from other files''' file_name ...
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
#Mitch Zinser #CSCI 3202 Assignment 8 #Worked with the Wikipedia Example and Brady Auen from math import log2 #For converting numbers to log base 2 '''PIPE TO EXTERNAL FILE WITH > filename.txt''' letters = 'abcdefghijklmnopqrstuvwxyz' '''File to read in data from, change this name to read from other files''' file_name ...
#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
use anyhow::Result; use log::debug; // because we use zydis data structures throughout our API // make this dependency public. // this way, our users can do `use lancelot::analysis::dis::zydis` // and not have any version conflicts. pub use zydis; use crate::{ arch::Arch, module::{Module, Permissions}, ut...
#[test] fn test_format_insn() { use crate::analysis::dis::zydis; let buf = get_buf(Rsrc::K32); let pe = crate::loader::pe::PE::from_bytes(&buf).unwrap(); let mut formatter = zydis::Formatter::new(zydis::FormatterStyle::INTEL).unwrap(); struct UserData { n...
{ // 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
use anyhow::Result; use log::debug; // because we use zydis data structures throughout our API // make this dependency public. // this way, our users can do `use lancelot::analysis::dis::zydis` // and not have any version conflicts. pub use zydis; use crate::{ arch::Arch, module::{Module, Permissions}, ut...
let op: &zydis::DecodedOperand = &*ctx.operand; insn.calc_absolute_address(ctx.runtime_address, op) .expect("failed to calculate absolute address") }; if let Some(name) = userdata.names.get(&absolute_add...
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
use anyhow::Result; use log::debug; // because we use zydis data structures throughout our API // make this dependency public. // this way, our users can do `use lancelot::analysis::dis::zydis` // and not have any version conflicts. pub use zydis; use crate::{ arch::Arch, module::{Module, Permissions}, ut...
() { // 0: ff 25 06 00 00 00 +-> jmp DWORD PTR ds:0x6 // 6: 00 00 00 00 +-- dw 0x0 let module = load_shellcode32(b"\xFF\x25\x06\x00\x00\x00\x00\x00\x00\x00"); let insn = read_insn(&module, 0x0); let op = get_first_operand(&insn).unwrap(); let xref = g...
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...
credentials = get_credentials() http = credentials.authorize(httplib2.Http()) file_service = apiclient.discovery.build('drive', 'v3', http=http).files()
"""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
/*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. ...
var records = this.extractData(q.select(this.meta.record, root), true); // <-- true to return Ext.data.Record[] // TODO return Ext.data.Response instance. @see #readResponse return { success : success, records : records, totalRecords : totalRecords || reco...
{ success = this.getSuccess(root); }
conditional_block
data-xml-debug.js
/*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. * licensing@sencha.com * http://www.sencha.com/license */ /*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. ...
var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name; ef.push(this.createAccessor(map)); } this.ef = ef; }, /** * Creates a function to return some particular key of data from a response. * @param {String} key * @return {Function}...
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...
{ 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
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 20:55:19 2016 @author: ajaver """ import json import os from collections import OrderedDict import zipfile import numpy as np import pandas as pd import tables from tierpsy.helper.misc import print_flush from tierpsy.analysis.feat_create.obtainFeaturesHelper import ...
#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
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 20:55:19 2016 @author: ajaver """ import json import os from collections import OrderedDict import zipfile import numpy as np import pandas as pd import tables from tierpsy.helper.misc import print_flush from tierpsy.analysis.feat_create.obtainFeaturesHelper import ...
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
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 20:55:19 2016 @author: ajaver """ import json import os from collections import OrderedDict import zipfile import numpy as np import pandas as pd import tables from tierpsy.helper.misc import print_flush from tierpsy.analysis.feat_create.obtainFeaturesHelper import ...
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
# -*- coding: utf-8 -*- """ Created on Mon Aug 15 20:55:19 2016 @author: ajaver """ import json import os from collections import OrderedDict import zipfile import numpy as np import pandas as pd import tables from tierpsy.helper.misc import print_flush from tierpsy.analysis.feat_create.obtainFeaturesHelper import ...
(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
import { join } from 'path'; import { argv } from 'yargs'; import { Environments, InjectableDependency } from './seed.config.interfaces'; /** * The enumeration of available environments. * @type {Environments} */ export const ENVIRONMENTS: Environments = { DEVELOPMENT: 'dev', PRODUCTION: 'prod' }; /** * This...
return d.env.indexOf(env) >= 0; } /** * Returns the applications version as defined in the `package.json`. * @return {number} The applications version. */ function appVersion(): number | string { var pkg = require('../../package.json'); return pkg.version; } /** * Returns the linting configuration to be us...
{ (<any>d).env = [d.env]; }
conditional_block
seed.config.ts
import { join } from 'path'; import { argv } from 'yargs'; import { Environments, InjectableDependency } from './seed.config.interfaces'; /** * The enumeration of available environments. * @type {Environments} */ export const ENVIRONMENTS: Environments = { DEVELOPMENT: 'dev', PRODUCTION: 'prod' }; /** * This...
(): 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
import { join } from 'path'; import { argv } from 'yargs'; import { Environments, InjectableDependency } from './seed.config.interfaces'; /** * The enumeration of available environments. * @type {Environments} */ export const ENVIRONMENTS: Environments = { DEVELOPMENT: 'dev', PRODUCTION: 'prod' }; /** * This...
*/ 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
import { join } from 'path'; import { argv } from 'yargs'; import { Environments, InjectableDependency } from './seed.config.interfaces'; /** * The enumeration of available environments. * @type {Environments} */ export const ENVIRONMENTS: Environments = { DEVELOPMENT: 'dev', PRODUCTION: 'prod' }; /** * This...
/** * Returns the environment of the application. */ function getEnvironment() { let base: string[] = argv['_']; let prodKeyword = !!base.filter(o => o.indexOf(ENVIRONMENTS.PRODUCTION) >= 0).pop(); let env = (argv['env'] || '').toLowerCase(); if ((base && prodKeyword) || env === ENVIRONMENTS.PRODUCTION) { ...
{ 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...
if __name__ == '__main__': VersionBitsWarningTest().main()
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 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...
} Toggle.Skeleton = props => ( <Toggle Input={() => <Skeleton width="58px" height="30px" />} Label={() => ( <Skeleton style={{ marginLeft: '15px' }} width="150px" height="30px" /> )} {...props} /> ); export default Toggle;
{ 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
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is dist...
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
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is dist...
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
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is dist...
return palette register( "python-fu-palette-sort", N_("Sort the colors in a palette"), # FIXME: Write humanly readable help - # (I can't figure out what the plugin does, or how to use the parameters after # David's enhacements even looking at the code - # let alone someone just using GIMP...
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
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is dist...
(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