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
blacklisted_domain_ip.py
import os import urllib.request import zipfile from _socket import timeout from http.client import IncompleteRead from io import BytesIO from urllib.parse import urlparse import _socket _socket.setdefaulttimeout(10) # set timeout def ransomware_and_malware_domain_check(list_of_domains):
list_of = urllib.request.urlopen( "https://ransomwaretracker.abuse.ch/downloads/RW_URLBL.txt").read().decode( errors='replace').strip().split("\n") except IncompleteRead: continue except timeout: list_of = "" break b...
while True: try: list_of = urllib.request.urlopen( "https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt").read().decode( errors='replace').strip().split("\n") except IncompleteRead: continue except timeout: list_of = "" ...
identifier_body
blacklisted_domain_ip.py
import os import urllib.request import zipfile from _socket import timeout from http.client import IncompleteRead from io import BytesIO from urllib.parse import urlparse import _socket _socket.setdefaulttimeout(10) # set timeout def ransomware_and_malware_domain_check(list_of_domains): while True: try:...
for i, my_domain in enumerate(list_of_domains): if mal_dom in my_domain: my_malware_domains.append(mal_dom) list_of_domains[i] = mal_dom os.remove("justdomains") mal_in_my_domains = set(mal_in_my_domains) my_malware_domains...
mal_dom = ".".join(mal_dom.split(".")[1:])
conditional_block
extract_frames.py
import cv2 import fitparse import os fname = 'V0280048.MP4' fitfile ='2018-06-01-12-13-33.fit' vidcap = cv2.VideoCapture(fname) success,image = vidcap.read() success count = 0 if success: stream = fname.split('.')[-2] os.mkdir(stream) while success: cv2.imwrite("{}/{}_frame{}.jpg".format(stream,strea...
import pandas metadata = pandas.DataFrame() for key in fields_to_extract+fields_to_convert: metadata[key]=pandas.Series(meta[key]) metadata.to_csv('{}_metadata.csv'.format(stream))
for f in m.fields: if f.name in fields_to_extract: meta[f.name].append(f.value) if f.name in fields_to_convert: meta[f.name].append(f.value*180.0/2**31)
conditional_block
extract_frames.py
import cv2 import fitparse import os fname = 'V0280048.MP4' fitfile ='2018-06-01-12-13-33.fit' vidcap = cv2.VideoCapture(fname) success,image = vidcap.read() success count = 0 if success: stream = fname.split('.')[-2] os.mkdir(stream) while success: cv2.imwrite("{}/{}_frame{}.jpg".format(stream,strea...
for key in fields_to_extract+fields_to_convert: metadata[key]=pandas.Series(meta[key]) metadata.to_csv('{}_metadata.csv'.format(stream))
random_line_split
mode.rs
//! TODO Documentation
use crate::output::Output; #[derive(Debug, Eq, PartialEq)] pub struct Mode<'output> { output_mode: *mut wlr_output_mode, phantom: PhantomData<&'output Output> } impl<'output> Mode<'output> { /// NOTE This is a lifetime defined by the user of this function, but it /// must not outlive the `Output` that...
use std::marker::PhantomData; use wlroots_sys::wlr_output_mode;
random_line_split
mode.rs
//! TODO Documentation use std::marker::PhantomData; use wlroots_sys::wlr_output_mode; use crate::output::Output; #[derive(Debug, Eq, PartialEq)] pub struct Mode<'output> { output_mode: *mut wlr_output_mode, phantom: PhantomData<&'output Output> } impl<'output> Mode<'output> { /// NOTE This is a lifeti...
(&self) -> i32 { unsafe { (*self.output_mode).refresh } } }
refresh
identifier_name
get.ts
import { RedBlackTreeStructure, isNone } from '../internals'; /** * Retrieves the value associated with the specified key * * @export * @template K The type of keys in the tree * @template V The type of values in the tree * @param {K} key The key of the entry to retrieve * @param {RedBlackTreeStructure<K, V>} t...
<K, V = null> (key: K, tree: RedBlackTreeStructure<K, V>): V|undefined { var node = tree._root, compare = tree._compare, found = false, value: V|undefined; do { if(isNone(node)) { found = true; } else { var c = compare(key, node.key); if(c === 0) { value = nod...
get
identifier_name
get.ts
import { RedBlackTreeStructure, isNone } from '../internals'; /** * Retrieves the value associated with the specified key * * @export * @template K The type of keys in the tree * @template V The type of values in the tree * @param {K} key The key of the entry to retrieve * @param {RedBlackTreeStructure<K, V>} t...
else { var c = compare(key, node.key); if(c === 0) { value = node.value; found = true; } else if(c > 0) { node = node._right; } else { node = node._left; } } } while(!found); return value; }
{ found = true; }
conditional_block
get.ts
import { RedBlackTreeStructure, isNone } from '../internals'; /** * Retrieves the value associated with the specified key * * @export * @template K The type of keys in the tree * @template V The type of values in the tree * @param {K} key The key of the entry to retrieve * @param {RedBlackTreeStructure<K, V>} t...
} } } while(!found); return value; }
{ var node = tree._root, compare = tree._compare, found = false, value: V|undefined; do { if(isNone(node)) { found = true; } else { var c = compare(key, node.key); if(c === 0) { value = node.value; found = true; } else if(c > 0) { n...
identifier_body
get.ts
import { RedBlackTreeStructure, isNone } from '../internals'; /** * Retrieves the value associated with the specified key * * @export * @template K The type of keys in the tree * @template V The type of values in the tree * @param {K} key The key of the entry to retrieve * @param {RedBlackTreeStructure<K, V>} t...
} while(!found); return value; }
node = node._left; } }
random_line_split
insertAtCaret.js
/* Copyright 2012 Twitter, Inc. and others. * * 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...
});
this.focus(); } }) }
random_line_split
insertAtCaret.js
/* Copyright 2012 Twitter, Inc. and others. * * 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...
}) } });
{ this.value += myValue; this.focus(); }
conditional_block
x86_64_rumprun_netbsd.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() -> TargetResult { let mut base = super::netbsd_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.linker = Some("x86_64-rumprun-netbsd-gcc".to_string()); base.max_atomic_width = Some(64); base.dynamic_linking ...
target
identifier_name
x86_64_rumprun_netbsd.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}) }
random_line_split
x86_64_rumprun_netbsd.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
target_os: "netbsd".to_string(), target_env: String::new(), target_vendor: "rumprun".to_string(), linker_flavor: LinkerFlavor::Gcc, options: base, }) }
{ let mut base = super::netbsd_base::opts(); base.cpu = "x86-64".to_string(); base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); base.linker = Some("x86_64-rumprun-netbsd-gcc".to_string()); base.max_atomic_width = Some(64); base.dynamic_linking = false; base.h...
identifier_body
select-template.tsx
import React from 'react'; import { TemplateItem, fetchRecommendTemplateList } from '@portal/model/actor'; import styled from 'styled-components'; import history from '@portal/history'; const TemplateListItem = styled.div` padding: 10px; border-bottom: ${(props) => props.theme.border.thin}; `; interface State { ...
() { const { list } = this.state; return ( <div> {list.map((item) => ( <TemplateListItem key={item.uuid} onClick={() => this.handleClick(item.uuid)} > {item.name} </TemplateListItem> ))} </div> ); } } export de...
render
identifier_name
select-template.tsx
import React from 'react'; import { TemplateItem, fetchRecommendTemplateList } from '@portal/model/actor'; import styled from 'styled-components'; import history from '@portal/history';
border-bottom: ${(props) => props.theme.border.thin}; `; interface State { list: TemplateItem[]; } class ActorSelectTemplate extends React.Component<{}, State> { state: State = { list: [], }; componentDidMount() { fetchRecommendTemplateList().then((list) => this.setState({ list, ...
const TemplateListItem = styled.div` padding: 10px;
random_line_split
ca.js
OC.L10N.register( "federation", { "Added to the list of trusted servers" : "Afegeix a la llista de servidors de confiança", "Server is already in the list of trusted servers." : "El servidor ja està a la llista de servidors de confiança.", "No server to federate with found" : "No s'ha trobat cap ser...
}, "nplurals=2; plural=(n != 1);");
random_line_split
model_linePredictor.js
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function Target (x, y) { this.left = x; ...
fix: fix, isReading: index > 1 }; }); describe( 'LinePredictor', function() { describe( '#get( isEnteredReadingMode, currentFixation, currentLine, offset )', function () { var line = null; var results = input.map( (item) => { console.log( '\n ===== NEW FIX =====\n' ); line = LinePredictor.get( item.isR...
LinePredictor.init( model ); var input = fixations.map( (fix, index) => { return {
random_line_split
model_linePredictor.js
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function
(x, y) { this.left = x; this.top = y; this.right = x + 100; this.bottom = y + 35; } Target.prototype.getBoundingClientRect = function () { return this; } var targets = [ new Target(0, 0), new Target(110, 0), new Target(220, 0), new Target(330, 0), new Target(440, 0), new Target(550, 0), new Target(0, 100...
Target
identifier_name
model_linePredictor.js
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function Target (x, y) { this.left = x; ...
return line; }); it( `should all fixations be mapped`, function () { let fixCount = results.reduce( (count, line) => { return count + (!line ? 1 : 0); }, 0); assert.equal( 0, fixCount ); }); it( `should 8 fixations be mapped onto line 0`, function () { let fixCount = results.reduce( (...
{ line.addFixation( item.fix ); }
conditional_block
model_linePredictor.js
'use strict'; var assert = require('chai').assert; var LinePredictor = require('../src/js/model/linePredictor.js').LinePredictor; var Geometry = require('../src/js/model/geometry.js').Geometry; var Line = require('../src/js/model/line.js').Line; Geometry.init(); Line.init(); function Target (x, y)
Target.prototype.getBoundingClientRect = function () { return this; } var targets = [ new Target(0, 0), new Target(110, 0), new Target(220, 0), new Target(330, 0), new Target(440, 0), new Target(550, 0), new Target(0, 100), new Target(110, 100), new Target(220, 100), new Target(330, 100), new Target(440,...
{ this.left = x; this.top = y; this.right = x + 100; this.bottom = y + 35; }
identifier_body
user.py
# -*- coding: utf-8 -*- """ This module implements users. """ import os from persistent import Persistent import src.core.db as db import src.core.exc as exc import src.core.utils as utils import src.core.security as security import random import time class User(object): def __init__(self): self.__set_to_none()...
def delete_files(self): """ Deletes database files related to this user. If a file doesn't exist the os.remove() call won't be executed. A list containing the deleted files paths will be returned. """ base_path = os.path.join(utils.DATABASES_PATH, name_id(self.id)+".csu_user_db") deleted = [] paths =...
""" Saves global user data to self.app_db_data. For lazy people, if save_in_appdb = True, then self.app_db_data will be saved in the application database. """ if self.app_db is None: self.connect_to_appdb() self.app_db_data = UserDataAppDB() self.app_db_data.id = self.id self.app_db_data.name = sel...
identifier_body
user.py
# -*- coding: utf-8 -*- """ This module implements users. """ import os from persistent import Persistent import src.core.db as db import src.core.exc as exc import src.core.utils as utils import src.core.security as security import random import time class User(object): def __init__(self): self.__set_to_none()...
else: self.id = id def __set_to_none(self): self.id = None self.password_hash = None self.name = None def generate_new_id(): """ Generates a new id that wasn't already in the app_db. If app_db is unavailable, the unavailable ids will be considered to be none. """ if db.app_db is not None: unavailab...
self.id = generate_new_id()
conditional_block
user.py
# -*- coding: utf-8 -*- """ This module implements users. """ import os from persistent import Persistent import src.core.db as db import src.core.exc as exc import src.core.utils as utils import src.core.security as security import random import time class User(object): def __init__(self): self.__set_to_none()...
(self, password): """ This function verifies the password argument with the loaded password hash. Returns True in case the password has been correctly verified, False otherwise. If no password hash has been loaded, None will be returned. """ self.password_verified = None if self.password_hash is not None:...
verify_password
identifier_name
user.py
# -*- coding: utf-8 -*- """ This module implements users. """ import os from persistent import Persistent import src.core.db as db import src.core.exc as exc import src.core.utils as utils import src.core.security as security import random import time class User(object): def __init__(self): self.__set_to_none()...
database. """ if self.app_db is None: self.connect_to_appdb() self.app_db_data = UserDataAppDB() self.app_db_data.id = self.id self.app_db_data.name = self.name self.app_db_data.password_hash = self.password_hash if save_in_db: self.app_db.root['Users'][self.id] = self.app_db_data def delete_fil...
Saves global user data to self.app_db_data. For lazy people, if save_in_appdb = True, then self.app_db_data will be saved in the application
random_line_split
PILTest.py
# -*- coding: utf-8 -*- from PIL import Image, ImageFont, ImageDraw def
(imagedraw,x,y,width,colour): imagedraw.ellipse((x-(width/2),y-(width/2),x+(width/2),y+(width/2)), colour) frame = Image.new("RGBA", (300,300)) frameDraw = ImageDraw.Draw(frame) #load font fontpath = "/usr/share/fonts/truetype/freefont/FreeMono.ttf" # use a truetype font font = ImageFont.truetype(fontpath, 15...
drawPoint
identifier_name
PILTest.py
# -*- coding: utf-8 -*- from PIL import Image, ImageFont, ImageDraw def drawPoint(imagedraw,x,y,width,colour): imagedraw.ellipse((x-(width/2),y-(width/2),x+(width/2),y+(width/2)), colour) frame = Image.new("RGBA", (300,300)) frameDraw = ImageDraw.Draw(frame) #load font fontpath = "/usr/share/fonts/truetype/f...
frameDraw.line((0, 20, 150, 20), fill="white", width=3) #draw a point #frameDraw.ellipse((147, 17, 153, 23), "red") drawPoint(frameDraw, 150, 20, 10, "red") frame.save("/home/pi/dev/cbb/vidGPSOverlay/testcode/pil.gif", "GIF")
#draw some text frameDraw.text((0,0),"Hello World", font=font) #draw a line
random_line_split
PILTest.py
# -*- coding: utf-8 -*- from PIL import Image, ImageFont, ImageDraw def drawPoint(imagedraw,x,y,width,colour):
frame = Image.new("RGBA", (300,300)) frameDraw = ImageDraw.Draw(frame) #load font fontpath = "/usr/share/fonts/truetype/freefont/FreeMono.ttf" # use a truetype font font = ImageFont.truetype(fontpath, 15) #draw some text frameDraw.text((0,0),"Hello World", font=font) #draw a line frameDraw.line((0, 20, 150, 20),...
imagedraw.ellipse((x-(width/2),y-(width/2),x+(width/2),y+(width/2)), colour)
identifier_body
path.rs
other packages contained /// in the directory structure reachable by the root manifest. pub fn
(path: &Path, id: &SourceId, config: &'cfg Config) -> PathSource<'cfg> { trace!("new; id={}", id); PathSource { id: id.clone(), path: path.to_path_buf(), updated: false, packages: Vec::new(), config: config, } } ...
new
identifier_name
path.rs
pkg, _) = try!(ops::read_package(&path, &self.id, self.config)); Ok(vec![pkg]) } else { ops::read_packages(&self.path, &self.id, self.config) } } /// List all files relevant to building this package inside this source. ...
{ // TODO: assert! that the PackageId is contained by the source Ok(()) }
identifier_body
path.rs
any other packages contained /// in the directory structure reachable by the root manifest. pub fn new(path: &Path, id: &SourceId, config: &'cfg Config) -> PathSource<'cfg> { trace!("new; id={}", id); PathSource { id: id.clone(), path: path.to_path_buf(),...
// .gitignore and auto-ignore files that don't matter. // // Here we're also careful to look at both tracked and untracked files as // the untracked files are often part of a build and may become relevant // as part of a future commit. let index_files = index.iter().map(|...
random_line_split
link-node-graph.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { LinkNodeGraphComponent } from './link-node-graph.component'; describe('LinkNodeGraphComponent', () => { let component: LinkNodeGraphComponent; let fixture: ComponentFixture<LinkN...
imports: [ ], declarations: [ LinkNodeGraphComponent, ], providers: [ ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(LinkNodeGraphComponent); component =...
random_line_split
view.js
var View = function(controler) { this.divisionSize = 100; this.playerElement = $('#player'); this.spotLight = $('#spotlight'); $(document).keyup( function(e){ controler.keyCodeProcessor(e); e.preventDefault(); }).bind(controler); //stopping scrolling on keydown $(document).keydown( function(e){ ...
if (location == "13"){ this.playerElement.css("background-image", "url(images/octolorde.png)"); } } View.prototype.toggleSpotlight = function() { }
{ alert("YOU WIN :D !!!!!1!!1") ; }
conditional_block
view.js
var View = function(controler) { this.divisionSize = 100; this.playerElement = $('#player'); this.spotLight = $('#spotlight'); $(document).keyup( function(e){ controler.keyCodeProcessor(e); e.preventDefault(); }).bind(controler);
//swallow e.preventDefault(); }); } View.prototype.setPlayerLocation = function(location, win) { var row = parseInt(location[1]) var col = parseInt(location[0]) var leftPosition = (row * this.divisionSize) + 'px'; this.playerElement.css('left', leftPosition); var topPosition = (col * this.divisi...
//stopping scrolling on keydown $(document).keydown( function(e){
random_line_split
branch-on-feature-toggle.tsx
import { type TFlagName, type TFlagVariation } from '@flopflip/types'; import React from 'react'; import { useFeatureToggle } from '../../hooks'; type TBranchOnFeatureToggleOptions = { flag: TFlagName; variation?: TFlagVariation; }; export default function
< OwnProps extends Record<string, unknown> >( { flag: flagName, variation: flagVariation }: TBranchOnFeatureToggleOptions, UntoggledComponent?: React.ComponentType ) { return (ToggledComponent: React.ComponentType<OwnProps>) => { const WrappedToggledComponent = (ownProps: OwnProps) => { const isFeatur...
branchOnFeatureToggle
identifier_name
branch-on-feature-toggle.tsx
import { type TFlagName, type TFlagVariation } from '@flopflip/types'; import React from 'react'; import { useFeatureToggle } from '../../hooks'; type TBranchOnFeatureToggleOptions = { flag: TFlagName; variation?: TFlagVariation; }; export default function branchOnFeatureToggle< OwnProps extends Record<string, ...
return WrappedToggledComponent; }; }
random_line_split
branch-on-feature-toggle.tsx
import { type TFlagName, type TFlagVariation } from '@flopflip/types'; import React from 'react'; import { useFeatureToggle } from '../../hooks'; type TBranchOnFeatureToggleOptions = { flag: TFlagName; variation?: TFlagVariation; }; export default function branchOnFeatureToggle< OwnProps extends Record<string, ...
{ return (ToggledComponent: React.ComponentType<OwnProps>) => { const WrappedToggledComponent = (ownProps: OwnProps) => { const isFeatureEnabled = useFeatureToggle(flagName, flagVariation); if (isFeatureEnabled) return <ToggledComponent {...ownProps} />; if (UntoggledComponent) return <Untoggle...
identifier_body
graffle.py
import pyjd from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.TabPanel import TabPanel from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.Label import Label from pyjamas.ui.HTML import HTML from pyjamas.ui import HasAlignment from pyjamas imp...
self.rect2=self.canvas.rect(200,150,30,30) self.rect2.setAttr('fill','#000') self.rect2.drag(self._move_rect,start,up) def connect(self): line={'stroke':'#fff','stroke-width':3} bg={'stroke': '#000', 'stroke-width':5} self.connection_rect...
self.rect1=self.canvas.rect(200,100,30,30) self.rect1.setAttr('fill','#000') self.rect1.drag(self._move_rect,start,up)
random_line_split
graffle.py
import pyjd from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.TabPanel import TabPanel from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.Label import Label from pyjamas.ui.HTML import HTML from pyjamas.ui import HasAlignment from pyjamas im...
if __name__ == "__main__": pyjd.setup("public/graffle.html") graffle=Graffle() RootPanel().add(graffle) graffle.draw() graffle.connect() pyjd.run()
pass
identifier_body
graffle.py
import pyjd from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.TabPanel import TabPanel from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.Label import Label from pyjamas.ui.HTML import HTML from pyjamas.ui import HasAlignment from pyjamas im...
pyjd.setup("public/graffle.html") graffle=Graffle() RootPanel().add(graffle) graffle.draw() graffle.connect() pyjd.run()
conditional_block
graffle.py
import pyjd from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.TabPanel import TabPanel from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.Label import Label from pyjamas.ui.HTML import HTML from pyjamas.ui import HasAlignment from pyjamas im...
(self,width=600,height=300): SimplePanel.__init__(self) self.canvas = Raphael(width,height) self.add(self.canvas) def draw(self): self.circle1=self.canvas.circle(50,50,25) self.circle1.setAttr('fill','#000') self.circle1.setAttrs({'cursor':'move','opacity':0.6}) ...
__init__
identifier_name
Option.tsx
import * as React from 'react'; import { RadioButton as CoreRadioButton } from 'wix-ui-core/radio-button'; import { st, classes } from './Option.st.css'; import { TPAComponentProps } from '../../types'; import { BOX_SELECTION_DATA_ATTRIBUTES, BOX_SELECTION_DATA_HOOKS, } from './dataHooks'; import classnames from 'c...
extends React.Component<OptionProps, OptionState> { static defaultProps: DefaultProps = { checked: false, disabled: false, unavailable: false, }; state = { focused: false, }; _getDataAttributes() { const { checked, disabled, unavailable } = this.props; const { focused } = this.state;...
Option
identifier_name
Option.tsx
import * as React from 'react'; import { RadioButton as CoreRadioButton } from 'wix-ui-core/radio-button'; import { st, classes } from './Option.st.css'; import { TPAComponentProps } from '../../types'; import { BOX_SELECTION_DATA_ATTRIBUTES, BOX_SELECTION_DATA_HOOKS, } from './dataHooks'; import classnames from 'c...
} }
random_line_split
Option.tsx
import * as React from 'react'; import { RadioButton as CoreRadioButton } from 'wix-ui-core/radio-button'; import { st, classes } from './Option.st.css'; import { TPAComponentProps } from '../../types'; import { BOX_SELECTION_DATA_ATTRIBUTES, BOX_SELECTION_DATA_HOOKS, } from './dataHooks'; import classnames from 'c...
}; _getAriaLabel = () => { const { children } = this.props; return this.props['aria-label'] ? this.props['aria-label'] : typeof children === 'string' ? children : null; }; render() { const { children, id, name, checked, disabled, unavaila...
{ onChange({ id }); }
conditional_block
privacy2.rs
// Copyright 2013 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 ...
//~^ ERROR: there is no //~^^ ERROR: failed to resolve } #[start] fn main(_: int, _: **u8) -> int { 3 }
random_line_split
privacy2.rs
// Copyright 2013 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 ...
{ 3 }
identifier_body
privacy2.rs
// Copyright 2013 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 ...
(_: int, _: **u8) -> int { 3 }
main
identifier_name
UnaryExistsOpPatcher.ts
import { UnaryExistsOp } from 'decaffeinate-parser/dist/nodes'; import { PatchOptions } from '../../../patchers/types'; import { SHORTEN_NULL_CHECKS } from '../../../suggestions'; import UnaryOpPatcher from './UnaryOpPatcher'; /** * Handles unary exists, e.g. `a?`. */ export default class UnaryExistsOpPatcher extend...
this.negated = !this.negated; } /** * @private */ needsTypeofCheck(): boolean { return this.expression.mayBeUnboundReference(); } /** * When we prefix with a `typeof` check we don't need parens, otherwise * delegate. */ statementNeedsParens(): boolean { if (this.needsTypeofCheck(...
id {
identifier_name
UnaryExistsOpPatcher.ts
import { UnaryExistsOp } from 'decaffeinate-parser/dist/nodes'; import { PatchOptions } from '../../../patchers/types'; import { SHORTEN_NULL_CHECKS } from '../../../suggestions'; import UnaryOpPatcher from './UnaryOpPatcher'; /** * Handles unary exists, e.g. `a?`. */ export default class UnaryExistsOpPatcher extend...
is.needsTypeofCheck()) { return false; } else { return this.expression.statementShouldAddParens(); } } }
identifier_body
UnaryExistsOpPatcher.ts
import { UnaryExistsOp } from 'decaffeinate-parser/dist/nodes'; import { PatchOptions } from '../../../patchers/types'; import { SHORTEN_NULL_CHECKS } from '../../../suggestions'; import UnaryOpPatcher from './UnaryOpPatcher'; /** * Handles unary exists, e.g. `a?`. */ export default class UnaryExistsOpPatcher extend...
* yet have a good mechanism for determining when that is, so we just make * sure they're always there. For example, this doesn't need parentheses: * * set = a? * * Because it becomes this: * * var set = typeof a !== 'undefined' && a !== null; * * But this does: * * 'set? ' + a?...
random_line_split
UnaryExistsOpPatcher.ts
import { UnaryExistsOp } from 'decaffeinate-parser/dist/nodes'; import { PatchOptions } from '../../../patchers/types'; import { SHORTEN_NULL_CHECKS } from '../../../suggestions'; import UnaryOpPatcher from './UnaryOpPatcher'; /** * Handles unary exists, e.g. `a?`. */ export default class UnaryExistsOpPatcher extend...
this.patchAsStatement(); if (addParens) { // `(a?` → `(a?)` // ^ this.insert(this.contentEnd, ')'); } } /** * EXPRESSION '?' */ patchAsStatement(): void { this.addSuggestion(SHORTEN_NULL_CHECKS); let { node: { expression }, negated } = this; ...
{ // `a?` → `(a?` // ^ this.insert(this.contentStart, '('); }
conditional_block
startInstances.py
import boto3 region = 'ap-southeast-2' instancesContainer = [] ec2 = boto3.resource('ec2', region_name=region, api_version='2016-04-01') ec2Client = boto3.client('ec2', region_name=region, api_version='2016-04-01') #Retrieve all the instances instances = ec2.instances.filter(Filters = [{'Name':'tag:Name', 'Values'...
if instancesContainer: ec2Client.stop_instances(InstanceIds=instancesContainer) print 'started your instances: ' + str(instancesContainer) else: print 'no instance need to be started'
identifier_body
startInstances.py
import boto3 region = 'ap-southeast-2' instancesContainer = [] ec2 = boto3.resource('ec2', region_name=region, api_version='2016-04-01') ec2Client = boto3.client('ec2', region_name=region, api_version='2016-04-01') #Retrieve all the instances instances = ec2.instances.filter(Filters = [{'Name':'tag:Name', 'Values'...
(event, context): if instancesContainer: ec2Client.stop_instances(InstanceIds=instancesContainer) print 'started your instances: ' + str(instancesContainer) else: print 'no instance need to be started'
lambda_handler
identifier_name
startInstances.py
import boto3 region = 'ap-southeast-2' instancesContainer = [] ec2 = boto3.resource('ec2', region_name=region, api_version='2016-04-01') ec2Client = boto3.client('ec2', region_name=region, api_version='2016-04-01') #Retrieve all the instances instances = ec2.instances.filter(Filters = [{'Name':'tag:Name', 'Values'...
def lambda_handler(event, context): if instancesContainer: ec2Client.stop_instances(InstanceIds=instancesContainer) print 'started your instances: ' + str(instancesContainer) else: print 'no instance need to be started'
instancesContainer.append(instance.instance_id) print (instance.instance_id, tag['Value'])
conditional_block
startInstances.py
import boto3 region = 'ap-southeast-2' instancesContainer = [] ec2 = boto3.resource('ec2', region_name=region, api_version='2016-04-01') ec2Client = boto3.client('ec2', region_name=region, api_version='2016-04-01') #Retrieve all the instances instances = ec2.instances.filter(Filters = [{'Name':'tag:Name', 'Values'...
def lambda_handler(event, context): if instancesContainer: ec2Client.stop_instances(InstanceIds=instancesContainer) print 'started your instances: ' + str(instancesContainer) else: print 'no instance need to be started'
random_line_split
constructors.ts
/** * @license * Copyright 2018 The Incremental DOM Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
() { open(MyElementRegister); close(); } patch(container, render); const el = container.firstChild; patch(container, render); expect(container.firstChild).to.equal(el); }); } }); });
render
identifier_name
constructors.ts
/** * @license * Copyright 2018 The Incremental DOM Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
}); });
{ it('should re-use elements with the same constructor', () => { function render() { open(MyElementRegister); close(); } patch(container, render); const el = container.firstChild; patch(container, render); expect(container.firstChild).to.equal(...
conditional_block
constructors.ts
/** * @license * Copyright 2018 The Incremental DOM Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
expect(el.constructor).to.equal(MyElementDefine); }); } }); describe('updates', () => { if (MyElementRegister) { it('should re-use elements with the same constructor', () => { function render() { open(MyElementRegister); close(); } patch(cont...
const el = container.firstChild as HTMLElement; expect(el.localName).to.equal('my-element-define');
random_line_split
constructors.ts
/** * @license * Copyright 2018 The Incremental DOM Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
patch(container, render); const el = container.firstChild; patch(container, render); expect(container.firstChild).to.equal(el); }); } }); });
{ open(MyElementRegister); close(); }
identifier_body
NodeConnectorBackground.tsx
import {Vector2, E} from "js-vextensions"; import {BaseComponent, SimpleShouldUpdate, WarnOfTransientObjectProps} from "react-vextensions"; import {HSLA} from "vwebapp-framework"; import {Fragment} from "react"; import {MapNodeL3} from "@debate-map/server-link/Source/Link"; import {GetNodeColor} from "Store/firebase_ex...
const curvedLine = style=>{ return <path //key={`connectorLine_${child._key}`} style={E( {stroke: backgroundColor.css(), strokeWidth: 3, fill: "none"}, style, )} d={`M${start.x},${start.y} C${startControl.x},${startControl.y} ${endControl.x},${endControl.y} ${end.x},${en...
endControl = endControl.Plus(middleControl).Times(0.5); // average with middle-control
random_line_split
visibility.rs
// A module named `my` mod my { // Items in modules default to private visibility. fn private_function() { println!("called `my::private_function()`"); } // Use the `pub` modifier to override default visibility. pub fn function() { println!("called `my::function()`"); } ...
// Modules allow disambiguation between items that have the same name. function(); my::function(); // Public items, including those inside nested modules, can be // accessed from outside the parent module. my::indirect_access(); my::nested::function(); // Private items of a module ...
fn main() {
random_line_split
visibility.rs
// A module named `my` mod my { // Items in modules default to private visibility. fn private_function() { println!("called `my::private_function()`"); } // Use the `pub` modifier to override default visibility. pub fn function() { println!("called `my::function()`"); } ...
// Error! `private_nested` is a private module //my::private_nested::function(); // TODO ^ Try uncommenting this line }
{ // Modules allow disambiguation between items that have the same name. function(); my::function(); // Public items, including those inside nested modules, can be // accessed from outside the parent module. my::indirect_access(); my::nested::function(); // Private items of a modul...
identifier_body
visibility.rs
// A module named `my` mod my { // Items in modules default to private visibility. fn
() { println!("called `my::private_function()`"); } // Use the `pub` modifier to override default visibility. pub fn function() { println!("called `my::function()`"); } // Items can access other items in the same module, // even when private. pub fn indirect_access(...
private_function
identifier_name
main.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
import webapp2 import urllib2 class Redirect( webapp2.RequestHandler ): def get(self): self.redirect('/ai/beat-blender/view/') app = webapp2.WSGIApplication([ ('/ai/beat-blender/view', Redirect), ('/', Redirect), ], debug=True)
import os
random_line_split
main.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
app = webapp2.WSGIApplication([ ('/ai/beat-blender/view', Redirect), ('/', Redirect), ], debug=True)
def get(self): self.redirect('/ai/beat-blender/view/')
identifier_body
main.py
#!/usr/bin/env python # # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
(self): self.redirect('/ai/beat-blender/view/') app = webapp2.WSGIApplication([ ('/ai/beat-blender/view', Redirect), ('/', Redirect), ], debug=True)
get
identifier_name
if-check.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 ...
(x: uint) -> bool { if x < 2u { return false; } else if x == 2u { return true; } else { return even(x - 2u); } } fn foo(x: uint) { if even(x) { println!("{}", x); } else { panic!(); } } pub fn main() { foo(2u); }
even
identifier_name
if-check.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 ...
panic!(); } } pub fn main() { foo(2u); }
random_line_split
if-check.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 ...
else { panic!(); } } pub fn main() { foo(2u); }
{ println!("{}", x); }
conditional_block
if-check.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 foo(x: uint) { if even(x) { println!("{}", x); } else { panic!(); } } pub fn main() { foo(2u); }
{ if x < 2u { return false; } else if x == 2u { return true; } else { return even(x - 2u); } }
identifier_body
test-goldens.ts
import * as firebaseFunctions from 'firebase-functions'; import * as firebaseAdmin from 'firebase-admin'; import * as path from 'path'; const gcs = require('@google-cloud/storage')(); /** The storage bucket to store the images. The bucket is also used by Firebase Storage. */ const bucket = gcs.bucket(firebaseFunction...
.map((file: any) => file.copy(`goldens/${path.basename(file.name)}`))); }); }); }
random_line_split
test-goldens.ts
import * as firebaseFunctions from 'firebase-functions'; import * as firebaseAdmin from 'firebase-admin'; import * as path from 'path'; const gcs = require('@google-cloud/storage')(); /** The storage bucket to store the images. The bucket is also used by Firebase Storage. */ const bucket = gcs.bucket(firebaseFunction...
(prNumber: string) { return firebaseAdmin.database().ref(`screenshot/reports/${prNumber}/results`).once('value') .then((snapshot: firebaseAdmin.database.DataSnapshot) => { const failedFilenames: string[] = []; let counter = 0; snapshot.forEach(childSnapshot => { if (childSnapshot.key &&...
copyTestImagesToGoldens
identifier_name
test-goldens.ts
import * as firebaseFunctions from 'firebase-functions'; import * as firebaseAdmin from 'firebase-admin'; import * as path from 'path'; const gcs = require('@google-cloud/storage')(); /** The storage bucket to store the images. The bucket is also used by Firebase Storage. */ const bucket = gcs.bucket(firebaseFunction...
path.basename(file.name, '.screenshot.png'))) .map((file: any) => file.copy(`goldens/${path.basename(file.name)}`))); }); }); }
{ return firebaseAdmin.database().ref(`screenshot/reports/${prNumber}/results`).once('value') .then((snapshot: firebaseAdmin.database.DataSnapshot) => { const failedFilenames: string[] = []; let counter = 0; snapshot.forEach(childSnapshot => { if (childSnapshot.key && childSnapshot.val(...
identifier_body
test-goldens.ts
import * as firebaseFunctions from 'firebase-functions'; import * as firebaseAdmin from 'firebase-admin'; import * as path from 'path'; const gcs = require('@google-cloud/storage')(); /** The storage bucket to store the images. The bucket is also used by Firebase Storage. */ const bucket = gcs.bucket(firebaseFunction...
counter++; return counter === snapshot.numChildren(); }); return failedFilenames; }).then((failedFilenames: string[]) => { return bucket.getFiles({prefix: `screenshots/${prNumber}/test`}).then((data: any) => { return Promise.all(data[0] .filter((file: any) => f...
{ failedFilenames.push(childSnapshot.key); }
conditional_block
frog_queue_videos.py
################################################################################################## # Copyright (c) 2012 Brett Dixon # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without r...
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ################################################################################################## from optparse import make_option from django.core.management.base im...
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE...
random_line_split
frog_queue_videos.py
################################################################################################## # Copyright (c) 2012 Brett Dixon # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without r...
(self, parser): parser.add_argument( 'guids', nargs='*', default=[], ) def handle(self, *args, **options): for guid in options['guids']: video = Video.objects.get(guid=guid) item = VideoQueue.objects.get_or_create(video=video)[0] ...
add_arguments
identifier_name
frog_queue_videos.py
################################################################################################## # Copyright (c) 2012 Brett Dixon # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without r...
help = 'Generated thumbnails' def add_arguments(self, parser): parser.add_argument( 'guids', nargs='*', default=[], ) def handle(self, *args, **options): for guid in options['guids']: video = Video.objects.get(guid=guid) i...
identifier_body
frog_queue_videos.py
################################################################################################## # Copyright (c) 2012 Brett Dixon # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without r...
video = Video.objects.get(guid=guid) item = VideoQueue.objects.get_or_create(video=video)[0] item.video = video item.status = VideoQueue.QUEUED item.save() self.stdout.write('Added: {}'.format(video))
conditional_block
rules.py
class Rule: ''' 规则父类 ''' def action(self,block,handler): ''' 加标记 ''' handler.start(self.type) handler.feed(block) handler.end(self.type) return True class HeadingRule(Rule): ''' 一号标题规则 ''' type='heading' def condition(self,block): ''' 判断文本块是否符合规则 ''' return not '\n' in block and len(bloc...
f,block): return block[0]=='-' def action(self,block,handler): handler.start(self.type) handler.feed(block[1:].strip()) handler.end(self.type) return True class ListRule(ListItemRule): ''' 列表规则 ''' type ='list' inside=False def condition(self,block): return True def action(self,block,handler): ...
ondition(sel
identifier_name
rules.py
class Rule: ''' 规则父类 ''' def action(self,block,handler): ''' 加标记 ''' handler.start(self.type) handler.feed(block) handler.end(self.type) return True class HeadingRule(Rule): ''' 一号标题规则 ''' type='heading' def condition(self,block): ''' 判断文本块是否符合规则 ''' return not '\n' in block and len(bloc...
k) class ListItemRule(Rule): ''' 列表项规则 ''' type='listitem' def condition(self,block): return block[0]=='-' def action(self,block,handler): handler.start(self.type) handler.feed(block[1:].strip()) handler.end(self.type) return True class ListRule(ListItemRule): ''' 列表规则 ''' type ='list' inside=Fa...
on(self,bloc
conditional_block
rules.py
class Rule: ''' 规则父类 ''' def action(self,block,handler): ''' 加标记 ''' handler.start(self.type) handler.feed(block) handler.end(self.type) return True class HeadingRule(Rule): ''' 一号标题规则 ''' type='heading' def condition(self,block): ''' 判断文本块是否符合规则 ''' return not '\n' in block and len(bloc...
first=True def condintion(self,block): if not self.first: return False self.first=False return HeadingRule.condition(self,block) class ListItemRule(Rule): ''' 列表项规则 ''' type='listitem' def condition(self,block): return block[0]=='-' def action(self,block,handler): handler.start(self.type) hand...
type='title'
random_line_split
rules.py
class Rule: ''' 规则父类 ''' def action(self,block,handler): ''' 加标记 ''' handler.start(self.type) handler.feed(block) handler.end(self.type) return True class HeadingRule(Rule): ''' 一号标题规则 ''' type='heading' def condition(self,block): ''' 判断文本块是否符合规则 ''' return not '\n' in block and len(bloc...
False def condition(self,block): return True def action(self,block,handler): if not self.inside and ListItemRule.condition(self,block): handler.start(self.type) elif self.inside and not ListItemRule.condition(self,block): handler.end(self,type) self.inside=False return False class ParagraphRule(Rul...
return block[0]=='-' def action(self,block,handler): handler.start(self.type) handler.feed(block[1:].strip()) handler.end(self.type) return True class ListRule(ListItemRule): ''' 列表规则 ''' type ='list' inside=
identifier_body
getblocktemplate_proposals.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core Developers // Copyright (c) 2015 Solarminx # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework import SolariTestFramework from solarirpc.authproxy import...
def assert_template(node, tmpl, txlist, expect): rsp = node.getblocktemplate({'data':template_to_hex(tmpl, txlist),'mode':'proposal'}) if rsp != expect: raise AssertionError('unexpected: %s' % (rsp,)) class GetBlockTemplateProposalTest(SolariTestFramework): ''' Test block proposals with getbl...
return b2x(template_to_bytes(tmpl, txlist))
identifier_body
getblocktemplate_proposals.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core Developers // Copyright (c) 2015 Solarminx # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework import SolariTestFramework from solarirpc.authproxy import...
if item[key] != value: raise AssertionError("%s : expected %s=%s"%(str(item), str(key), str(value))) num_matched = num_matched+1 if num_matched == 0: raise AssertionError("No objects matched %s"%(str(to_match))) def b2x(b): return b2a_hex(b).decode('ascii') # NO...
random_line_split
getblocktemplate_proposals.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core Developers // Copyright (c) 2015 Solarminx # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework import SolariTestFramework from solarirpc.authproxy import...
def b2x(b): return b2a_hex(b).decode('ascii') # NOTE: This does not work for signed numbers (set the high bit) or zero (use b'\0') def encodeUNum(n): s = bytearray(b'\1') while n > 127: s[0] += 1 s.append(n % 256) n //= 256 s.append(n) return bytes(s) def varlenEncode(n):...
raise AssertionError("No objects matched %s"%(str(to_match)))
conditional_block
getblocktemplate_proposals.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core Developers // Copyright (c) 2015 Solarminx # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework import SolariTestFramework from solarirpc.authproxy import...
(object_array, to_match, expected): """ Pass in array of JSON objects, a dictionary with key/value pairs to match against, and another dictionary with expected key/value pairs. """ num_matched = 0 for item in object_array: all_match = True for key,value in to_match.items(): ...
check_array_result
identifier_name
create-admin.js
const app = require('../server'); const readline = require('readline'); const { User, Role, RoleMapping, } = app.models; const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); Role.findOne({ where: { name: 'admin' } }) .then((role) => { if (!role) { console.log('No ad...
User.create(admin) .then(user => RoleMapping.create({ UserId: user.id, RoleId: role.id, }) ) .then(() => { console.log('Done!\n'); process.exit(0); }) .catch((err) => { console.error(err); process.exit(1); }); ...
if (!field) { process.stdout.write('Creating the user... ');
random_line_split
create-admin.js
const app = require('../server'); const readline = require('readline'); const { User, Role, RoleMapping, } = app.models; const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); Role.findOne({ where: { name: 'admin' } }) .then((role) => { if (!role) { console.log('No ad...
process.stdout.write(`${field}: \n`); }); });
{ process.stdout.write('Creating the user... '); User.create(admin) .then(user => RoleMapping.create({ UserId: user.id, RoleId: role.id, }) ) .then(() => { console.log('Done!\n'); process.exit(0); }) .catch((err) => { ...
conditional_block
ServiceHasResource.py
#!/usr/bin/env python """ The MIT License (MIT) Copyright (c) 2017 LeanIX GmbH 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, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR...
the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
random_line_split
ServiceHasResource.py
#!/usr/bin/env python """ The MIT License (MIT) Copyright (c) 2017 LeanIX GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,...
(self): self.swaggerTypes = { 'ID': 'str', 'resourceID': 'str', 'serviceID': 'str', 'comment': 'str', 'technicalSuitabilityID': 'str', 'costTotalAnnual': 'float', 'serviceLevelID': 'str', 'primaryTypeID': 'str' ...
__init__
identifier_name
ServiceHasResource.py
#!/usr/bin/env python """ The MIT License (MIT) Copyright (c) 2017 LeanIX GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,...
self.swaggerTypes = { 'ID': 'str', 'resourceID': 'str', 'serviceID': 'str', 'comment': 'str', 'technicalSuitabilityID': 'str', 'costTotalAnnual': 'float', 'serviceLevelID': 'str', 'primaryTypeID': 'str' } se...
identifier_body
__init__.py
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
def get_weakref(func): """Get a weak reference to bound or unbound `func`. If `func` is unbound (i.e. has no __self__ attr) get a weakref.ref, otherwise get a wrapper that simulates weakref.ref. """ if func is None: raise ValueError if not hasattr(func, '__self__'): return we...
"""Split `ible` into multiple lists of length `length`. >>> list(window(range(5), 2)) [[0, 1], [2, 3], [4]] """ if length <= 0: # pragma: NO COVER raise ValueError ible = iter(ible) while True: elts = [xx for ii, xx in zip(range(length), ible)] if elts: yiel...
identifier_body
__init__.py
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
def get_weakref(func): """Get a weak reference to bound or unbound `func`. If `func` is unbound (i.e. has no __self__ attr) get a weakref.ref, otherwise get a wrapper that simulates weakref.ref. """ if func is None: raise ValueError if not hasattr(func, '__self__'): return we...
elts = [xx for ii, xx in zip(range(length), ible)] if elts: yield elts else: break
conditional_block
__init__.py
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
items = set() for item in ible: if item not in items: items.add(item) yield item def uniq(ible): """Get a list of unique items of `ible`.""" return list(iuniq(ible)) def window(ible, length): """Split `ible` into multiple lists of length `length`. >>> list(wi...
"""Get an iterator over unique items of `ible`."""
random_line_split
__init__.py
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
(func): """Get a weak reference to bound or unbound `func`. If `func` is unbound (i.e. has no __self__ attr) get a weakref.ref, otherwise get a wrapper that simulates weakref.ref. """ if func is None: raise ValueError if not hasattr(func, '__self__'): return weakref.ref(func) ...
get_weakref
identifier_name
type_names.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}
{ if substs.types.is_empty() { return; } output.push('<'); for &type_parameter in &substs.types { push_debuginfo_type_name(cx, type_parameter, true, output); output.push_str(", "); } output.pop(); output.pop(); outpu...
identifier_body
type_names.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>, qualified: bool) -> String { let mut result = String::with_capacity(64); push_debuginfo_type_name(cx, t, qualified, &mut res...
compute_debuginfo_type_name
identifier_name
type_names.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
output.push_str(", ..."); } else { output.push_str("..."); } } output.push(')'); match sig.output { ty::FnConverging(result_type) if result_type.is_nil() => {} ty::FnConverging(r...
if sig.variadic { if !sig.inputs.is_empty() {
random_line_split
result.py
import numpy as np from . import finiteelements as fe from . import matrices from math import cos class Result: def __init__(self): pass def __init__(self, freq, u1, u2, u3, mesh, geometry): self.freq = freq self.u1 = u1 self.u2 = u2 self.u3 = u3 self.mesh ...
u_nodes = np.zeros((8)) u_nodes[0] = self.u1[element.top_left_index] u_nodes[1] = self.u1[element.top_right_index] u_nodes[2] = self.u1[element.bottom_right_index] u_nodes[3] = self.u1[element.bottom_left_index] u_nodes[4] = self.u3[element.top_left_index] u_n...
print ("x1 = {}, x2 = {}".format(x1, x3))
conditional_block