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
classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator.js
var classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator = [ [ "hasNext", "classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator.html#abcef64faf6a030a4dbf1103487b7b057", null ], [ "next", "classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator.html#a558bccd0be91f76e75d71ffcb85707f0", null ], [ "...
[ "_current", "classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator.html#a43f4a0e305d459247a96c7086b5c2baa", null ], [ "_start", "classwblut_1_1hemesh_1_1_h_e___vertex_edge_rev_circulator.html#ae35c0d512e0f0190dcf6bf41dbadc7da", null ] ];
random_line_split
dialog.js
import './field_group'; import '../dom'; frappe.provide('frappe.ui'); window.cur_dialog = null; frappe.ui.open_dialogs = [];
frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { constructor(opts) { this.display = false; this.is_dialog = true; $.extend(this, { animate: true, size: null }, opts); super(); this.make(); } make() { this.$wrapper = frappe.get_modal("", ""); this.wrapper = this.$wrapper.find('.modal-di...
random_line_split
dialog.js
import './field_group'; import '../dom'; frappe.provide('frappe.ui'); window.cur_dialog = null; frappe.ui.open_dialogs = []; frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { constructor(opts) { this.display = false; this.is_dialog = true; $.extend(this, { animate: true, size: null }, opts); ...
(click) { this.get_close_btn().on('click', click); } disable_primary_action() { this.get_primary_btn().addClass('disabled'); } enable_primary_action() { this.get_primary_btn().removeClass('disabled'); } make_head() { this.set_title(this.title); } set_title(t) { this.$wrapper.find(".modal-title").html...
set_secondary_action
identifier_name
dialog.js
import './field_group'; import '../dom'; frappe.provide('frappe.ui'); window.cur_dialog = null; frappe.ui.open_dialogs = []; frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup { constructor(opts) { this.display = false; this.is_dialog = true; $.extend(this, { animate: true, size: null }, opts); ...
set_message(text) { this.$message.removeClass('hide'); this.$body.addClass('hide'); this.$message.text(text); } clear_message() { this.$message.addClass('hide'); this.$body.removeClass('hide'); } set_primary_action(label, click) { this.has_primary_action = true; var me = this; return this.get_p...
{ return this.$wrapper.find(".modal-header .btn-primary"); }
identifier_body
Core.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## # Core of the application, implement a part of the RFC 1459: Internet Relay Chat ProtocolA (Client side). from Message import Message from Action import Action import socket import string import re import time #ssl support from ssl import SSLSocket ## # Core of the appl...
## # Read from the m_socket, if the message dest is the joined chan or the current nickname. # @note Define how the application react for the "nickname already in use" warning # @note Send Pong (Ping back) to avoid IRC Time out. # @return Return a Message Object if the read data match . # @par...
time.sleep(1) # wait 1 second, avoid the flood kick # Send the Message as an IRC Action to a channel or destination user. self.m_socket.sendall("PRIVMSG "+Message.getDest()+" :"+chr(1)+"ACTION "+Message.getText()+chr(1)+" \r\n")
identifier_body
Core.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## # Core of the application, implement a part of the RFC 1459: Internet Relay Chat ProtocolA (Client side). from Message import Message from Action import Action import socket import string import re import time #ssl support from ssl import SSLSocket ## # Core of the appl...
# Channel to connect. self.m_channel=channel ## @var m_host # IRC Server host. self.m_host=host ## @var m_port # Port to use. self.m_port=port ## @var m_name # Nickname for the IRC user. self.m_name=name ## @var m_socke...
random_line_split
Core.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## # Core of the application, implement a part of the RFC 1459: Internet Relay Chat ProtocolA (Client side). from Message import Message from Action import Action import socket import string import re import time #ssl support from ssl import SSLSocket ## # Core of the appl...
(self,Message): time.sleep(1) # wait 1 second, avoid the flood kick # Send the Message to a channel or destination user self.m_socket.sendall("PRIVMSG "+Message.getDest()+" : "+Message.getText()+" \r\n") ## # Send a Message as an IRC Action to a channel or destination user. # @para...
send2Chan
identifier_name
Core.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## # Core of the application, implement a part of the RFC 1459: Internet Relay Chat ProtocolA (Client side). from Message import Message from Action import Action import socket import string import re import time #ssl support from ssl import SSLSocket ## # Core of the appl...
except Exception as ex: print("Erreur de reception") print(ex) ## # Ends the IRC protocol # @note Close the socket # @param self Self. def quit(self): self.m_socket.close(); ## # Overload the Core class to use a SSL Socket. class secureCore(Core): def ...
self.m_socket.sendall('PONG\r\n')
conditional_block
min.js
/** min任务 ------------- min脚本,样式,图片或html ### 用法 <min src='my.js' dest='my.min.js'/> <min file='reset.css' destfile='reset.min.css'/> @class min **/ module.exports = function(bee) { bee.register('min', function(options, callback) { var path = require('path'); var minifier = requ...
var childNodes = options.childNodes; var banner, footer; options.childNodes.forEach(function(item){ if(item.name === 'banner' || item.name === 'header'){ banner = item.value.value; }else if(item.name === 'footer'){ footer = item.value.value; } }); v...
return callback(new Error('src/file and dest/destfile are required in minify task.')); }
random_line_split
min.js
/** min任务 ------------- min脚本,样式,图片或html ### 用法 <min src='my.js' dest='my.min.js'/> <min file='reset.css' destfile='reset.min.css'/> @class min **/ module.exports = function(bee) { bee.register('min', function(options, callback) { var path = require('path'); var minifier = requ...
jpeg', 'gif'].indexOf(extname) >= 0) { method = minifyImage; } if(!method){ bee.warn('the filetype of ' + src + ' cannot be minified.') return callback(); } method(src, destfile, callback); }); }
ML; } else if (['png', 'jpg', '
conditional_block
reduceRight.js
define(['../internal/arrayReduceRight', '../internal/baseCallback', '../internal/baseEachRight', '../internal/baseReduce', '../lang/isArray'], function(arrayReduceRight, baseCallback, baseEachRight, baseReduce, isArray) { /** * This method is like `_.reduce` except that it iterates over elements of * `collecti...
return reduceRight; });
{ var func = isArray(collection) ? arrayReduceRight : baseReduce; return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEachRight); }
identifier_body
reduceRight.js
define(['../internal/arrayReduceRight', '../internal/baseCallback', '../internal/baseEachRight', '../internal/baseReduce', '../lang/isArray'], function(arrayReduceRight, baseCallback, baseEachRight, baseReduce, isArray) { /** * This method is like `_.reduce` except that it iterates over elements of * `collecti...
* @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * _.reduceRight(array, function(flattened, other) { return flattened.concat(other); }, []); * ...
* @memberOf _ * @alias foldr * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
random_line_split
reduceRight.js
define(['../internal/arrayReduceRight', '../internal/baseCallback', '../internal/baseEachRight', '../internal/baseReduce', '../lang/isArray'], function(arrayReduceRight, baseCallback, baseEachRight, baseReduce, isArray) { /** * This method is like `_.reduce` except that it iterates over elements of * `collecti...
(collection, iteratee, accumulator, thisArg) { var func = isArray(collection) ? arrayReduceRight : baseReduce; return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEachRight); } return reduceRight; });
reduceRight
identifier_name
EnableProfile.tsx
import { useCallback, FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; import { useDispatch } from 'react-redux'; import { Tooltip } from '@waldur/core/Tooltip'; import { translate } from '@waldur/i18n'; import { showSuccess, showErrorResponse } from '@waldur/store/notify'; import { enableP...
return ( <Tooltip label={translate( 'Enable a profile in FreeIPA. Only enabled profiles are allowed for login into the Linux systems', )} id="freeipa-enable-profile" > <Button bsStyle="success" onClick={callback}> <i className="fa fa-toggle-off"></i> {translate('Enabl...
{ return null; }
conditional_block
EnableProfile.tsx
import { useCallback, FunctionComponent } from 'react'; import { Button } from 'react-bootstrap'; import { useDispatch } from 'react-redux'; import { Tooltip } from '@waldur/core/Tooltip'; import { translate } from '@waldur/i18n'; import { showSuccess, showErrorResponse } from '@waldur/store/notify'; import { enableP...
refreshProfile(); } catch (response) { dispatch( showErrorResponse( response, translate('Unable to enable FreeIPA profile.'), ), ); setLoading(false); } }, [dispatch, profile.uuid, setLoading, refreshProfile]); if (profile.is_active) { return ...
setLoading(false);
random_line_split
HttpActions.ts
import axios, { AxiosInstance, AxiosRequestConfig, AxiosPromise } from 'axios'; class HttpActions { private request: AxiosInstance; constructor(baseURL: string, headers?: AxiosRequestConfig['headers']) { const config: AxiosRequestConfig = { baseURL, headers, withCredentials: false, }; ...
} export { HttpActions };
{ return this.request.put(url, data, { params, ...options }); }
identifier_body
HttpActions.ts
import axios, { AxiosInstance, AxiosRequestConfig, AxiosPromise } from 'axios'; class HttpActions { private request: AxiosInstance; constructor(baseURL: string, headers?: AxiosRequestConfig['headers']) { const config: AxiosRequestConfig = { baseURL, headers, withCredentials: false, }; ...
<T>(url: string, data: any, options: AxiosRequestConfig): AxiosPromise<T> { return this.request.patch(url, data, options); } public del<T>( url: string, data: any, params: object, options: AxiosRequestConfig, ): AxiosPromise<T> { const config: AxiosRequestConfig = { url, data, params, ......
patch
identifier_name
HttpActions.ts
import axios, { AxiosInstance, AxiosRequestConfig, AxiosPromise } from 'axios'; class HttpActions { private request: AxiosInstance; constructor(baseURL: string, headers?: AxiosRequestConfig['headers']) { const config: AxiosRequestConfig = { baseURL, headers, withCredentials: false, }; ...
} public patch<T>(url: string, data: any, options: AxiosRequestConfig): AxiosPromise<T> { return this.request.patch(url, data, options); } public del<T>( url: string, data: any, params: object, options: AxiosRequestConfig, ): AxiosPromise<T> { const config: AxiosRequestConfig = { url...
} public post<T>(url: string, data?: any, options?: AxiosRequestConfig): AxiosPromise<T> { return this.request.post(url, data, options);
random_line_split
lawnchair.js
that only if (options.adapter) { adapter = Lawnchair.adapters[Lawnchair.adapters.indexOf(options.adapter)] adapter = adapter.valid() ? adapter : undefined // otherwise find the first valid adapter for this env } else { for (var i = 0, l = Lawnchair.adapters.length; i < l; i+...
t.executeSql(up, val, win, fail) } // pretty exists ? update(obj) : insert(obj) }) }); return this }, // FIXME this should be a batch insert / just getting the test to pass... batch: function...
delete(obj.key) val.unshift(JSON.stringify(obj))
random_line_split
lawnchair.js
only if (options.adapter) { adapter = Lawnchair.adapters[Lawnchair.adapters.indexOf(options.adapter)] adapter = adapter.valid() ? adapter : undefined // otherwise find the first valid adapter for this env } else { for (var i = 0, l = Lawnchair.adapters.length; i < l; i++) { ...
} t.executeSql(keys, [], win, fail) }) return this }, // you think thats air you're breathing now? save: function (obj, callback) { var that = this , id = obj.key || that.uuid() , ins = "INSERT IN...
{ var r = []; for (var i = 0, l = results.rows.length; i < l; i++) { r.push(results.rows.item(i).id); } cb.call(that, r) }
conditional_block
Stroke.d.ts
import { Color } from '../color'; import { ColorLike } from '../colorlike'; export interface Options { color?: Color | ColorLike | undefined; lineCap?: CanvasLineCap | undefined; lineJoin?: CanvasLineJoin | undefined; lineDash?: number[] | undefined; lineDashOffset?: number | undefined; miterLi...
* Get the line join type for the stroke. */ getLineJoin(): CanvasLineJoin | undefined; /** * Get the miter limit for the stroke. */ getMiterLimit(): number | undefined; /** * Get the stroke width. */ getWidth(): number | undefined; /** * Set the color. */ ...
random_line_split
Stroke.d.ts
import { Color } from '../color'; import { ColorLike } from '../colorlike'; export interface Options { color?: Color | ColorLike | undefined; lineCap?: CanvasLineCap | undefined; lineJoin?: CanvasLineJoin | undefined; lineDash?: number[] | undefined; lineDashOffset?: number | undefined; miterLi...
{ constructor(opt_options?: Options); /** * Clones the style. */ clone(): Stroke; /** * Get the stroke color. */ getColor(): Color | ColorLike; /** * Get the line cap type for the stroke. */ getLineCap(): CanvasLineCap | undefined; /** * Get the line d...
Stroke
identifier_name
__init__.py
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
from imp import reload reload(plugin) # In case we're being reloaded. # Add more reloads here if you add third-party modules and want them to be # reloaded when this plugin is reloaded. Don't forget to import them as well! if world.testing: from . import test Class = plugin.Class configure = config.configure #...
from . import config from . import plugin
random_line_split
__init__.py
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
Class = plugin.Class configure = config.configure # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
from . import test
conditional_block
mod.rs
event: X11KeyboardInputEvent { time: key_press.time, // X11's keycodes are +8 relative to the libinput keycodes // that are expected, so subtract 8 from each keycode to // match libinput. ...
&x11.log, "DRM Device does not have a render node, falling back to primary node" );
random_line_split
mod.rs
.iter() // Ensure the visual is little endian to comply with the format needed with X/ARGB8888 .filter(|visual| visual.red_mask == 0xff0000) .find(|visual| visual.class == VisualClass::TRUE_COLOR) .ok_or(CreateWindowError::NoVisual)? .visual_id; ...
(self, size: Size<u16, Logical>) -> Self { Self { size: Some(size), ..self } } /// Creates a window using the options specified in the builder. pub fn build(self, handle: &X11Handle) -> Result<Window, X11Error> { let connection = handle.connection(); ...
size
identifier_name
mod.rs
.iter() // Ensure the visual is little endian to comply with the format needed with X/ARGB8888 .filter(|visual| visual.red_mask == 0xff0000) .find(|visual| visual.class == VisualClass::TRUE_COLOR) .ok_or(CreateWindowError::NoVisual)? .visual_id; ...
let mut modifiers = modifiers.collect::<Vec<_>>(); // older dri3 versions do only support buffers with one plane. // we need to make sure, we don't accidently allocate buffers with more. if window.0.extensions.dri3 < Some((1, 2)) { modifiers.retain(|modi| modi == &DrmModifi...
{ return Err(X11Error::InvalidWindow); }
conditional_block
mod.rs
is little endian to comply with the format needed with X/ARGB8888 .filter(|visual| visual.red_mask == 0xff0000) .find(|visual| visual.class == VisualClass::TRUE_COLOR) .ok_or(CreateWindowError::NoVisual)? .visual_id; let format = match depth.depth { ...
{ let connection = handle.connection(); let inner = &mut *handle.inner.lock().unwrap(); let window = Arc::new(WindowInner::new( Arc::downgrade(&connection), &connection.setup().roots[inner.screen_number], self.size.unwrap_or_else(|| (1280, 800).into()), ...
identifier_body
format_ctree.rs
c_type, is_extern, } => format_array(name, values, c_type, is_extern, false), CTree::StdArray { ref name, ref values, ref c_type, is_extern, } => format_array(name, values, c_type, is_extern, true), ...
random_line_split
format_ctree.rs
CTree::Group(ref vec) => format_group(vec, file_name_base)?, CTree::Define { ref name, ref value, } => format_define(name, value), CTree::DefineIf { ref name, is_defined, } => { if...
{ Self { h: CCode::new(), c: contents.to_c(), } }
identifier_body
format_ctree.rs
(&self, file_name_base: &str) -> Result<CFilePair, Error> { Ok(match *self { CTree::IncludeH { ref path } => format_include_h(path), CTree::IncludeSelf => format_include_self(file_name_base), CTree::LiteralH(ref text) => CFilePair::with_h(text), CTree::LiteralC(re...
format
identifier_name
hook.py
#!/usr/bin/env python # # Copyright (C) 2011, 2012 Google Inc. # # This file is part of YouCompleteMe. # # YouCompleteMe 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 # (...
if ycm_core.HasClangSupport(): return ClangCompleter( user_options ) else: return None
identifier_body
hook.py
#!/usr/bin/env python # # Copyright (C) 2011, 2012 Google Inc. # # This file is part of YouCompleteMe. # # YouCompleteMe 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 # (...
( user_options ): if ycm_core.HasClangSupport(): return ClangCompleter( user_options ) else: return None
GetCompleter
identifier_name
hook.py
#!/usr/bin/env python # # Copyright (C) 2011, 2012 Google Inc. # # This file is part of YouCompleteMe. # # YouCompleteMe 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 # (...
else: return None
return ClangCompleter( user_options )
conditional_block
hook.py
# # This file is part of YouCompleteMe. # # YouCompleteMe 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. # # YouCompleteMe is distribu...
#!/usr/bin/env python # # Copyright (C) 2011, 2012 Google Inc.
random_line_split
unresolved-import.rs
// Copyright 2013-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...
use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] //~^ no `Baz` in `bar`. Did you mean to use `Bar`? use food::baz; //~ ERROR unresolved import `food::baz` //~^ no `baz` in `food`. Did you mean to use `bag`? use food::{beens as Foo}; //~ ERROR unresolved import `food:...
use foo::bar; //~ ERROR unresolved import `foo` [E0432] //~^ maybe a missing `extern crate foo;`?
random_line_split
unresolved-import.rs
// Copyright 2013-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...
; } } } mod m { enum MyEnum { MyVariant } use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] //~^ did you mean `self::MyEnum`? } mod items { enum Enum { Variant } use Enum::*; //~ ERROR unresolved import `Enum` [E0432] ...
foobar
identifier_name
utils.ts
import { LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery, } from '../common'; import { UIRouter } from '../router'; export const keyValsToObjectR = (accum, [key, val]) => { if (!accum.hasOwnProperty(key)) { accum[key] = val; } else if (isArray(acc...
serviceClass: { new (uiRouter?: UIRouter): LocationServices }, configurationClass: { new (uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig } ) { return function (uiRouter: UIRouter) { const service = (uiRouter.locationService = new serviceClass(uiRouter)); const configuration = (uiRouter.locationCo...
name: string, isHtml5: boolean,
random_line_split
utils.ts
import { LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery, } from '../common'; import { UIRouter } from '../router'; export const keyValsToObjectR = (accum, [key, val]) => { if (!accum.hasOwnProperty(key)) { accum[key] = val; } else if (isArray(acc...
return accum; }; export const getParams = (queryString: string): any => queryString.split('&').filter(identity).map(splitEqual).reduce(keyValsToObjectR, {}); export function parseUrl(url: string) { const orEmptyString = (x) => x || ''; const [beforehash, hash] = splitHash(url).map(orEmptyString); const [pa...
{ accum[key] = [accum[key], val]; }
conditional_block
utils.ts
import { LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery, } from '../common'; import { UIRouter } from '../router'; export const keyValsToObjectR = (accum, [key, val]) => { if (!accum.hasOwnProperty(key)) { accum[key] = val; } else if (isArray(acc...
export const buildUrl = (loc: LocationServices) => { const path = loc.path(); const searchObject = loc.search(); const hash = loc.hash(); const search = Object.keys(searchObject) .map((key) => { const param = searchObject[key]; const vals = isArray(param) ? param : [param]; return vals....
{ const orEmptyString = (x) => x || ''; const [beforehash, hash] = splitHash(url).map(orEmptyString); const [path, search] = splitQuery(beforehash).map(orEmptyString); return { path, search, hash, url }; }
identifier_body
utils.ts
import { LocationConfig, LocationServices, identity, unnestR, isArray, splitEqual, splitHash, splitQuery, } from '../common'; import { UIRouter } from '../router'; export const keyValsToObjectR = (accum, [key, val]) => { if (!accum.hasOwnProperty(key)) { accum[key] = val; } else if (isArray(acc...
( name: string, isHtml5: boolean, serviceClass: { new (uiRouter?: UIRouter): LocationServices }, configurationClass: { new (uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig } ) { return function (uiRouter: UIRouter) { const service = (uiRouter.locationService = new serviceClass(uiRouter)); cons...
locationPluginFactory
identifier_name
manager.js
/** * @package Abricos * @copyright Copyright (C) 2008 Abricos. All rights reservedd. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php */ var Component = new Brick.Component(); Component.requires = { mod:[ {name: 'slider', files: ['api.js']}, {name: 'filemanager', f...
SliderWidget.prototype = { init: function(container){ var TM = TMG.build('slider'), T = TM.data, TId = TM.idManager; container.innerHTML = T['slider']; } }; NS.SliderWidget = SliderWidget; })(); };
onSuccess: function() { } });
random_line_split
uniqueEmail.spec.js
describe('uniqueEmail directive', function() { var Users, $scope, form; function setTestValue(value)
beforeEach(function() { // Mockup Users resource angular.module('mock-Users', []).factory('Users', function() { Users = jasmine.createSpyObj('Users', ['query']); return Users; }); }); beforeEach(module('admin-users-edit-uniqueEmail', 'mock-Users')); beforeEach(inject(function($comp...
{ $scope.model.testValue = value; $scope.$digest(); }
identifier_body
uniqueEmail.spec.js
describe('uniqueEmail directive', function() { var Users, $scope, form; function
(value) { $scope.model.testValue = value; $scope.$digest(); } beforeEach(function() { // Mockup Users resource angular.module('mock-Users', []).factory('Users', function() { Users = jasmine.createSpyObj('Users', ['query']); return Users; }); }); beforeEach(module('admin-users...
setTestValue
identifier_name
uniqueEmail.spec.js
describe('uniqueEmail directive', function() { var Users, $scope, form; function setTestValue(value) { $scope.model.testValue = value; $scope.$digest(); } beforeEach(function() { // Mockup Users resource angular.module('mock-Users', []).factory('Users', function() { Users = jasmine.creat...
expect(form.testInput.$valid).toBe(false); }); it('should set model to valid if the Users callback contains no users', function() { Users.query.andCallFake(function(query, callback) { callback([]); }); form.testInput.$setViewValue('different'); expect(form.testInput.$valid).toBe(true); }...
}); form.testInput.$setViewValue('different');
random_line_split
jaccard.py
import argparse from collections import defaultdict def calculateJaccardIndex(x,z,neighbours):
if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate scores for a set of scores') parser.add_argument('--cooccurrenceFile',type=str,required=True,help='File containing cooccurrences') parser.add_argument('--occurrenceFile',type=str,required=True,help='File containing occurrences') pa...
shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined))
identifier_body
jaccard.py
import argparse from collections import defaultdict def calculateJaccardIndex(x,z,neighbours): shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate...
print "Loaded cooccurrences" print "Scoring..." with open(args.outFile,'w') as outF: for i,(x,z) in enumerate(relationsToScore): if (i%10000) == 0: print i jaccardScore = calculateJaccardIndex(x,z,neighbours) outData = [x,z,jaccardScore] outLine = "\t".join(map(str,outData)) outF.write(outLin...
x,y,count = map(int,line.strip().split()) neighbours[x].add(y) neighbours[y].add(x)
conditional_block
jaccard.py
import argparse from collections import defaultdict def calculateJaccardIndex(x,z,neighbours): shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate...
parser.add_argument('--anniVectors',type=str,help='File containing the raw ANNI vector data') parser.add_argument('--anniVectorsIndex',type=str,help='File containing the index for the ANNI vector data') parser.add_argument('--outFile',type=str,required=True,help='File to output scores to') args = parser.parse_args...
parser.add_argument('--sentenceCount',type=str,required=True,help='File containing sentence count') parser.add_argument('--relationsToScore',type=str,required=True,help='File containing relations to score')
random_line_split
jaccard.py
import argparse from collections import defaultdict def
(x,z,neighbours): shared = neighbours[x].intersection(neighbours[z]) combined = neighbours[x].union(neighbours[z]) return len(shared)/float(len(combined)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Calculate scores for a set of scores') parser.add_argument('--cooccurrenceFile',type=s...
calculateJaccardIndex
identifier_name
__openerp__.py
# -*- coding: utf-8 -*- # © 2009 Pexego/Comunitea # © 2011-2012 Iker Coranti (www.avanzosc.es) # © 2014 Juanjo Algaz (gutierrezweb.es) # © 2014-2016 Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0). { "name": "Account balance reporting engine", "version": "8.0.1.2.0", "auth...
"installable": True, }
random_line_split
electioneering_communications.js
var response_lib = require('../../lib/response_lib'); var reql = require('../../lib/request_lib'); var base = '/svc/elections/us/v3/finances'; var keyName = 'campaign-finance'; function
(keys) { this.myKeys = keys; } /* Electioneering Communications */ electioneeringCommunications.prototype.recentCommunications = function (args, callback) { var specific = reql.buildPath(args['cycle'], 'electioneering_communications'); reql.createRequest(args, callback, this.myKeys, base, specific, keyNa...
electioneeringCommunications
identifier_name
electioneering_communications.js
var response_lib = require('../../lib/response_lib'); var reql = require('../../lib/request_lib'); var base = '/svc/elections/us/v3/finances'; var keyName = 'campaign-finance'; function electioneeringCommunications (keys) { this.myKeys = keys; } /* Electioneering Communications */ electioneeringCommunications.p...
reql.createRequest(args, callback, this.myKeys, base, specific, keyName); } electioneeringCommunications.prototype.communicationsByDate = function (args, callback) { var specific = reql.buildPath(args['cycle'], 'committees', 'electioneering_communications', args['year'], arg...
electioneeringCommunications.prototype.communicationsByCommittee = function (args, callback) { var specific = reql.buildPath(args['cycle'], 'committees', args['FEC-ID'], 'electioneering_communications');
random_line_split
electioneering_communications.js
var response_lib = require('../../lib/response_lib'); var reql = require('../../lib/request_lib'); var base = '/svc/elections/us/v3/finances'; var keyName = 'campaign-finance'; function electioneeringCommunications (keys)
/* Electioneering Communications */ electioneeringCommunications.prototype.recentCommunications = function (args, callback) { var specific = reql.buildPath(args['cycle'], 'electioneering_communications'); reql.createRequest(args, callback, this.myKeys, base, specific, keyName); } electioneeringCommunication...
{ this.myKeys = keys; }
identifier_body
camera.py
config_validation as cv, entity_platform from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import ( ATTR_DIRECTION, ATTR_ENABLE, ATTR_LEVEL, ATTR_SERIAL, ATTR_SPEED, ATTR_TYPE, CONF_CAMERAS, CONF_FFMPEG_ARGUMENTS, DATA_COORDINATOR, DEFAULT_CAMER...
camera_password: str | None, camera_rtsp_stream: str | None, local_rtsp_port: int, ffmpeg_arguments: str | None, ) -> None: """Initialize a Ezviz security camera.""" super().__init__(coordinator, serial) Camera.__init__(self) self._username = camera_us...
self, hass: HomeAssistant, coordinator: EzvizDataUpdateCoordinator, serial: str, camera_username: str,
random_line_split
camera.py
_validation as cv, entity_platform from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import ( ATTR_DIRECTION, ATTR_ENABLE, ATTR_LEVEL, ATTR_SERIAL, ATTR_SPEED, ATTR_TYPE, CONF_CAMERAS, CONF_FFMPEG_ARGUMENTS, DATA_COORDINATOR, DEFAULT_CAMERA_USERN...
return 0 @property def is_on(self) -> bool: """Return true if on.""" return bool(self.data["status"]) @property def is_recording(self) -> bool: """Return true if the device is recording.""" return self.data["alarm_notify"] @property def motion_detectio...
return SUPPORT_STREAM
conditional_block
camera.py
_validation as cv, entity_platform from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import ( ATTR_DIRECTION, ATTR_ENABLE, ATTR_LEVEL, ATTR_SERIAL, ATTR_SPEED, ATTR_TYPE, CONF_CAMERAS, CONF_FFMPEG_ARGUMENTS, DATA_COORDINATOR, DEFAULT_CAMERA_USERN...
CONF_PASSWORD: camera[CONF_PASSWORD], }, ) ) # Check if importing main ezviz cloud account. hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, ...
"""Set up a Ezviz IP Camera from platform config.""" _LOGGER.warning( "Loading ezviz via platform config is deprecated, it will be automatically imported. Please remove it afterwards" ) # Check if entry config exists and skips import if it does. if hass.config_entries.async_entries(DOMAIN): ...
identifier_body
camera.py
_ARGUMENTS, DATA_COORDINATOR, DEFAULT_CAMERA_USERNAME, DEFAULT_FFMPEG_ARGUMENTS, DEFAULT_RTSP_PORT, DIR_DOWN, DIR_LEFT, DIR_RIGHT, DIR_UP, DOMAIN, SERVICE_ALARM_SOUND, SERVICE_ALARM_TRIGER, SERVICE_DETECTION_SENSITIVITY, SERVICE_PTZ, SERVICE_WAKE_DEVICE, ) from .c...
perform_wake_device
identifier_name
CheckingPackager.ts
import { AsyncTaskManager } from "builder-util" import { Arch, MacConfiguration, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "app-builder-lib/out/codeSign/macCodeSign" import MacPackager from "app-builder-lib/out/macPackager" ...
} // http://madole.xyz/babel-plugin-transform-async-to-module-method-gotcha/ return await MacPackager.prototype.pack.call(this, outDir, arch, targets, taskManager) } //noinspection JSUnusedLocalSymbols async doPack(outDir: string, appOutDir: string, platformName: string, arch: Arch, customBuildOptio...
{ this.effectiveDistOptions = await (target as DmgTarget).computeDmgOptions() break }
conditional_block
CheckingPackager.ts
import { AsyncTaskManager } from "builder-util" import { Arch, MacConfiguration, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "app-builder-lib/out/codeSign/macCodeSign" import MacPackager from "app-builder-lib/out/macPackager" ...
// skip } protected async writeUpdateInfo(appOutDir: string, outDir: string) { // ignored } }
//noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): void {
random_line_split
CheckingPackager.ts
import { AsyncTaskManager } from "builder-util" import { Arch, MacConfiguration, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "app-builder-lib/out/codeSign/macCodeSign" import MacPackager from "app-builder-lib/out/macPackager" ...
//noinspection JSUnusedLocalSymbols async doPack(outDir: string, appOutDir: string, platformName: string, arch: Arch, customBuildOptions: MacConfiguration, targets: Array<Target>) { // skip } //noinspection JSUnusedGlobalSymbols async doSign(opts: MacSignOptions): Promise<any> { this.effectiveSignO...
{ for (const target of targets) { // do not use instanceof to avoid dmg require if (target.name === "dmg") { this.effectiveDistOptions = await (target as DmgTarget).computeDmgOptions() break } } // http://madole.xyz/babel-plugin-transform-async-to-module-method-gotcha/ ...
identifier_body
CheckingPackager.ts
import { AsyncTaskManager } from "builder-util" import { Arch, MacConfiguration, Packager, Target } from "electron-builder" import SquirrelWindowsTarget from "electron-builder-squirrel-windows" import { Identity } from "app-builder-lib/out/codeSign/macCodeSign" import MacPackager from "app-builder-lib/out/macPackager" ...
(appOutDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): void { // skip } protected async writeUpdateInfo(appOutDir: string, outDir: string) { // ignored } }
packageInDistributableFormat
identifier_name
borrowck-mut-vec-as-imm-slice.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // run-pass fn...
// http://rust-lang.org/COPYRIGHT.
random_line_split
borrowck-mut-vec-as-imm-slice.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 ...
pub fn main() { assert_eq!(has_mut_vec(vec![1, 2, 3]), 6); }
{ want_slice(&v) }
identifier_body
borrowck-mut-vec-as-imm-slice.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 ...
(v: &[isize]) -> isize { let mut sum = 0; for i in v { sum += *i; } sum } fn has_mut_vec(v: Vec<isize> ) -> isize { want_slice(&v) } pub fn main() { assert_eq!(has_mut_vec(vec![1, 2, 3]), 6); }
want_slice
identifier_name
node.js
import fs from "fs"; import { parse } from "babylon"; import CodeGenerator from "../CodeGenerator"; import processTokens from "../process-tokens"; import {timeLogStart, timeLog} from "../utils"; function parseText(text) { timeLogStart("started parsing text"); let ast = parse(text, { preserveParens: t...
export function formatFile(filename) { try { timeLogStart(); const text = fs.readFileSync(filename).toString(); timeLog("finished reading file"); return formatText(text); } catch (error) { error.message = `${filename}: ${error.message}`; throw error; } }
let generator = new CodeGenerator(ast, text, tokens, semicolons); return generator.generate(); }
random_line_split
node.js
import fs from "fs"; import { parse } from "babylon"; import CodeGenerator from "../CodeGenerator"; import processTokens from "../process-tokens"; import {timeLogStart, timeLog} from "../utils"; function parseText(text) { timeLogStart("started parsing text"); let ast = parse(text, { preserveParens: t...
(text) { const { ast, tokens, semicolons } = parseText(text); let generator = new CodeGenerator(ast, text, tokens, semicolons); return generator.generate(); } export function formatFile(filename) { try { timeLogStart(); const text = fs.readFileSync(filename).toString(); timeLo...
formatText
identifier_name
node.js
import fs from "fs"; import { parse } from "babylon"; import CodeGenerator from "../CodeGenerator"; import processTokens from "../process-tokens"; import {timeLogStart, timeLog} from "../utils"; function parseText(text) { timeLogStart("started parsing text"); let ast = parse(text, { preserveParens: t...
export function formatFile(filename) { try { timeLogStart(); const text = fs.readFileSync(filename).toString(); timeLog("finished reading file"); return formatText(text); } catch (error) { error.message = `${filename}: ${error.message}`; throw error; } }
{ const { ast, tokens, semicolons } = parseText(text); let generator = new CodeGenerator(ast, text, tokens, semicolons); return generator.generate(); }
identifier_body
ppmatlab.py
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c from builtins import range def writeMeshMatlabFormat(mesh,meshFileBase): """ build array data structures for matlab finite element mesh representation and write to a file to view and play with in matlatb in matlab can then print mesh wi...
for eN in range(mesh['nElements_global']): t[0,eN]=mesh['elementNodesArray'][eN,0]+matlabBase #global node number for vertex 0 t[1,eN]=mesh['elementNodesArray'][eN,1]+matlabBase #global node number for vertex 0 t[2,eN]=mesh['elementNodesArray'][eN,2]+matlabBase #global node number f...
random_line_split
ppmatlab.py
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c from builtins import range def writeMeshMatlabFormat(mesh,meshFileBase): """ build array data structures for matlab finite element mesh representation and write to a file to view and play with in matlatb in matlab can then print mesh wi...
import os,shelve import ppmatlab,numpy.oldnumeric as numpy os.listdir('./results') filename = './results/re_forsyth2_ss_2d_pre_forsyth2_ss_2d_c0p1_n_mesh_results.dat' res = shelve.open(filename) mesh = res['mesh'] mmfile = 'forsyth2MeshMatlab' p,e,t = ppmatlab.writeMeshMatlabFormat(mesh...
conditional_block
ppmatlab.py
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c from builtins import range def writeMeshMatlabFormat(mesh,meshFileBase):
format: row 1 = start vertex number row 2 = end vertex number row 3 = start value in edge parameterization, should be 0 row 4 = end value in edge parameterization, should be 1 row 5 = global edge id, base 1 row 6 = subdomain on left? always 1 for now row 7 = subdomain on right? always ...
""" build array data structures for matlab finite element mesh representation and write to a file to view and play with in matlatb in matlab can then print mesh with pdemesh(p,e,t) where p is the vertex or point matrix e is the edge matrix, and t is the element matrix points mat...
identifier_body
ppmatlab.py
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c from builtins import range def
(mesh,meshFileBase): """ build array data structures for matlab finite element mesh representation and write to a file to view and play with in matlatb in matlab can then print mesh with pdemesh(p,e,t) where p is the vertex or point matrix e is the edge matrix, and t is the eleme...
writeMeshMatlabFormat
identifier_name
amtrak.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ amtrak Parse a trip itinerary of amtrak services copied into a text file. Running the file will take a trip.txt file and output a .json with one record for each amtrak service in the trip. You can also use the main method of the module. Both cases, the first paramete...
def main(filename='trip.txt', file_name="./json/amtrak-trip.json"): services = [add_calc_fields(service) for service in parse_services(filename)] write_services_to_json(services, file_name) if __name__ == '__main__': if len(sys.argv) == 2: main(sys.argv[1]) elif len(sys.argv)...
"""Write parsed services to a json file. Args: services (dict): Parsed services. file_name (str): Path of the json file to write in. """ with open(file_name, "w") as f: f.write(json.dumps(services, indent=4))
identifier_body
amtrak.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ amtrak Parse a trip itinerary of amtrak services copied into a text file. Running the file will take a trip.txt file and output a .json with one record for each amtrak service in the trip. You can also use the main method of the module. Both cases, the first paramete...
(self): self.name = None self.departure_station = None self.departure_state = None self.departure_city = None self.departure_date = None self.arrival_station = None self.arrival_state = None self.arrival_city = None self.arrival_date = None ...
__init__
identifier_name
amtrak.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ amtrak Parse a trip itinerary of amtrak services copied into a text file. Running the file will take a trip.txt file and output a .json with one record for each amtrak service in the trip. You can also use the main method of the module. Both cases, the first paramete...
if self._service_info_complete(): RV = copy.copy(self.__dict__) self.__init__() else: RV = None return RV def _service_info_complete(self): for value in self.__dict__.values(): if not value: return False retu...
if parser.accepts(line): key, value = parser.parse(line) if not key == "date": self.__dict__[key] = value # date could be departure or arrival, departure is always first else: if not self.departure_date: ...
conditional_block
amtrak.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ amtrak Parse a trip itinerary of amtrak services copied into a text file. Running the file will take a trip.txt file and output a .json with one record for each amtrak service in the trip. You can also use the main method of the module. Both cases, the first paramete...
import sys from modules import parsers class AmtrakServiceParser(object): """Parse Amtrak service information from confirmation email lines. Attributes: name (str): Name of the service. departure_station (str): Station where the service starts. departure_state (str): State where the...
random_line_split
admin.py
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from django.contrib.admin.options import ModelAdmin, csrf_protect_m from django.contrib.admin.views.main import SEARCH_VAR, ChangeList from django.core.exceptions import PermissionDenied from django.core.paginator imp...
if not SEARCH_VAR in request.GET: # Do the usual song and dance. return super(SearchModelAdminMixin, self).changelist_view(request, extra_context) # Do a search of just this model and populate a Changelist with the # returned bits. if not self.model in connecti...
raise PermissionDenied
conditional_block
admin.py
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from django.contrib.admin.options import ModelAdmin, csrf_protect_m from django.contrib.admin.views.main import SEARCH_VAR, ChangeList from django.core.exceptions import PermissionDenied from django.core.paginator imp...
list_display = list(self.list_display) kwargs = { 'haystack_connection': self.haystack_connection, 'request': request, 'model': self.model, 'list_display': list_display, 'list_display_links': self.list_display_links, 'list_filter':...
haystack_connection = 'default' @csrf_protect_m def changelist_view(self, request, extra_context=None): if not self.has_change_permission(request, None): raise PermissionDenied if not SEARCH_VAR in request.GET: # Do the usual song and dance. return super(Sea...
identifier_body
admin.py
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from django.contrib.admin.options import ModelAdmin, csrf_protect_m from django.contrib.admin.views.main import SEARCH_VAR, ChangeList from django.core.exceptions import PermissionDenied from django.core.paginator imp...
(SearchModelAdminMixin, ModelAdmin): pass
SearchModelAdmin
identifier_name
admin.py
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from django.contrib.admin.options import ModelAdmin, csrf_protect_m from django.contrib.admin.views.main import SEARCH_VAR, ChangeList from django.core.exceptions import PermissionDenied from django.core.paginator imp...
self.multi_page = multi_page self.paginator = paginator class SearchModelAdminMixin(object): # haystack connection to use for searching haystack_connection = 'default' @csrf_protect_m def changelist_view(self, request, extra_context=None): if not self.has_change_permission(req...
self.result_list = result_list self.can_show_all = can_show_all
random_line_split
job.py
""" A job is an object with states: CREATED, RUNNING, DONE, FAILED, CANCELLED A job can be polled for completion and reports the progress so far if it is still RUNNING. """ from connection import H2OConnection import time import sys class H2OJob(object): """ A class representing an H2O Job. """ def __init__(...
if self._100_percent: return progress = min(self.progress, 1) if progress == 1: self._100_percent = True p = int(self._progress_bar_width * progress) sys.stdout.write("\r" + self._job_type + " Progress: [%s%s] %02d%%" % ("#" * p, " " * (self._progress_bar_width - p), 100 * pr...
identifier_body
job.py
""" A job is an object with states: CREATED, RUNNING, DONE, FAILED, CANCELLED A job can be polled for completion and reports the progress so far if it is still RUNNING. """ from connection import H2OConnection import time import sys class H2OJob(object): """ A class representing an H2O Job. """ def __init__(...
def _refresh_job_view(self): jobs = H2OConnection.get_json(url_suffix="Jobs/" + self.job_key) self.job = jobs["jobs"][0] if "jobs" in jobs else jobs["job"][0] self.status = self.job["status"] self.progress = self.job["progress"] def _is_running(self): return self.status == "RUNNING" o...
if self.status == "FAILED": raise EnvironmentError("Job with key {} failed with an exception: {}".format(self.job_key, self.exception)) return self
random_line_split
job.py
""" A job is an object with states: CREATED, RUNNING, DONE, FAILED, CANCELLED A job can be polled for completion and reports the progress so far if it is still RUNNING. """ from connection import H2OConnection import time import sys class H2OJob(object): """ A class representing an H2O Job. """ def __init__(...
progress = min(self.progress, 1) if progress == 1: self._100_percent = True p = int(self._progress_bar_width * progress) sys.stdout.write("\r" + self._job_type + " Progress: [%s%s] %02d%%" % ("#" * p, " " * (self._progress_bar_width - p), 100 * progress)) sys.stdout.flush...
return
conditional_block
job.py
""" A job is an object with states: CREATED, RUNNING, DONE, FAILED, CANCELLED A job can be polled for completion and reports the progress so far if it is still RUNNING. """ from connection import H2OConnection import time import sys class H2OJob(object): """ A class representing an H2O Job. """ def
(self, jobs, job_type): if "jobs" in jobs: job = jobs["jobs"][0] else: job = jobs["job"] self.jobs = jobs self.job = job self.status = job["status"] self.job_key = job['key']['name'] self.dest_key = job['dest']['name'] self.progress = 0 self._100_percent = False self...
__init__
identifier_name
traversal.rs
```C++ /// class Foo { /// struct Bar { }; /// }; /// ``` InnerType, /// An edge from an class or struct type to an inner static variable. For /// example, the edge from `Foo` to `Foo::BAR` here: /// /// ```C++ /// class Foo { /// static const char* BAR; /// }; ...
type Extra; /// Trace all of this item's outgoing edges to other items.
random_line_split
traversal.rs
C++ /// template<typename T> /// class Foo { }; /// /// class Bar { }; /// /// using FooBar = Foo<Bar>; /// ``` TemplateArgument, /// An edge from a compound type to one of its base member types. For /// example, the edge from `Bar` to `Foo`: /// /// ```C++ /// class...
(ctx: &BindgenContext, edge: Edge) -> bool { let cc = &ctx.options().codegen_config; match edge.kind { EdgeKind::Generic => { ctx.resolve_item(edge.to).is_enabled_for_codegen(ctx) } // We statically know the kind of item that non-generic edges can point // to, so we ...
codegen_edges
identifier_name
traversal.rs
++ /// template<typename T> /// class Foo { }; /// /// class Bar { }; /// /// using FooBar = Foo<Bar>; /// ``` TemplateArgument, /// An edge from a compound type to one of its base member types. For /// example, the edge from `Bar` to `Foo`: /// /// ```C++ /// class ...
fn next(&mut self) -> Option<ItemId> { self.pop_front() } } /// Something that can receive edges from a `Trace` implementation. pub trait Tracer { /// Note an edge between items. Called from within a `Trace` implementation. fn visit_kind(&mut self, item: ItemId, kind: EdgeKind); /// A sy...
{ self.push_back(item); }
identifier_body
traversal.rs
OO; /// ``` VarType, /// An edge from a non-templated alias or typedef to the referenced type. TypeReference, } /// A predicate to allow visiting only sub-sets of the whole IR graph by /// excluding certain edges from being followed by the traversal. pub trait TraversalPredicate { /// Should the t...
{ return; }
conditional_block
index.test.ts
import { Owner } from '@ember/-internals/owner'; import CoreObject from '@ember/object/core'; import { expectTypeOf } from 'expect-type'; // Good enough for tests let owner = {} as Owner; expectTypeOf(CoreObject.create()).toEqualTypeOf<CoreObject>(); /** Newable tests */ const co1 = new CoreObject(owner); expectTyp...
/** .create tests */ const co2 = CoreObject.create(); expectTypeOf(co2.concatenatedProperties).toEqualTypeOf<string[]>(); expectTypeOf(co2.isDestroyed).toEqualTypeOf<boolean>(); expectTypeOf(co2.isDestroying).toEqualTypeOf<boolean>(); expectTypeOf(co2.destroy()).toEqualTypeOf<void>(); expectTypeOf(co2.toString()).toEqu...
expectTypeOf(co1.isDestroying).toEqualTypeOf<boolean>(); expectTypeOf(co1.destroy()).toEqualTypeOf<void>(); expectTypeOf(co1.toString()).toEqualTypeOf<string>();
random_line_split
small_crush_xorshift.rs
// A rust wrapper to a small subset of TestU01 // (http://simul.iro.umontreal.ca/testu01/tu01.html). // Copyright (C) 2015 Loïc Damien // // 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, eith...
let experiment_name = "Test of rust weak rng with small crush"; swrite::set_experiment_name(&CString::new(experiment_name).unwrap()); swrite::set_host(false); // Disable the printing of the hostname in the results let name = "weak_rng"; let c_name = CString::new(name).unwrap(); let rng = rand...
identifier_body
small_crush_xorshift.rs
// A rust wrapper to a small subset of TestU01 // (http://simul.iro.umontreal.ca/testu01/tu01.html). // Copyright (C) 2015 Loïc Damien // // 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, eith...
println!("P-values: {:?}", testu01::battery::get_pvalues()); }
// Print the p-values for the differents test of the battery:
random_line_split
small_crush_xorshift.rs
// A rust wrapper to a small subset of TestU01 // (http://simul.iro.umontreal.ca/testu01/tu01.html). // Copyright (C) 2015 Loïc Damien // // 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, eith...
) { let experiment_name = "Test of rust weak rng with small crush"; swrite::set_experiment_name(&CString::new(experiment_name).unwrap()); swrite::set_host(false); // Disable the printing of the hostname in the results let name = "weak_rng"; let c_name = CString::new(name).unwrap(); let rng = r...
ain(
identifier_name
data-mapping.js
var DataMapping = require("montage-data/logic/service/data-mapping").DataMapping, ObjectDescriptor = require("montage-data/logic/model/object-descriptor").ObjectDescriptor; describe("A DataMapping", function() { function ClassA(a, b, c, d) { this.a = a; this.b = b; this.c = c; t...
it("can be created", function () { expect(new DataMapping()).toBeDefined(); }); it("copies raw data properties by default", function () { var object = {x: 42}, random = Math.random(), data = new ClassA(1, 2, object, random), mapped = new ClassB(); ...
{ this.a = a; this.b = b; this.c = c; this.d = d; }
identifier_body
data-mapping.js
var DataMapping = require("montage-data/logic/service/data-mapping").DataMapping, ObjectDescriptor = require("montage-data/logic/model/object-descriptor").ObjectDescriptor; describe("A DataMapping", function() { function ClassA(a, b, c, d) { this.a = a; this.b = b; this.c = c; t...
(a, b, c, d) { this.a = a; this.b = b; this.c = c; this.d = d; } it("can be created", function () { expect(new DataMapping()).toBeDefined(); }); it("copies raw data properties by default", function () { var object = {x: 42}, random = Math.ran...
ClassB
identifier_name
data-mapping.js
var DataMapping = require("montage-data/logic/service/data-mapping").DataMapping, ObjectDescriptor = require("montage-data/logic/model/object-descriptor").ObjectDescriptor; describe("A DataMapping", function() { function ClassA(a, b, c, d) { this.a = a; this.b = b;
function ClassB(a, b, c, d) { this.a = a; this.b = b; this.c = c; this.d = d; } it("can be created", function () { expect(new DataMapping()).toBeDefined(); }); it("copies raw data properties by default", function () { var object = {x: 42}, ...
this.c = c; this.d = d; }
random_line_split
HTMLUtil.py
import html5lib import traceback def build_html_dom_from_str(html_str): return html5lib.parse(html_str, 'dom') def find_html_element_list_for_tag(element, tag, class_style = None): elements = element.getElementsByTagName(tag) if not class_style: return elements result = [] for e in elements: ...
if (content is None or content == '') and (content_element_text_child.childNodes is None or len(content_element_text_child.childNodes) == 0): continue content = find_element_content(content_element_text_child) if content is not None and content != '' : return conten...
random_line_split
HTMLUtil.py
import html5lib import traceback def build_html_dom_from_str(html_str):
def find_html_element_list_for_tag(element, tag, class_style = None): elements = element.getElementsByTagName(tag) if not class_style: return elements result = [] for e in elements: e_class_style = e.getAttribute('class') if e_class_style == class_style: result.append(e) ...
return html5lib.parse(html_str, 'dom')
identifier_body
HTMLUtil.py
import html5lib import traceback def build_html_dom_from_str(html_str): return html5lib.parse(html_str, 'dom') def find_html_element_list_for_tag(element, tag, class_style = None): elements = element.getElementsByTagName(tag) if not class_style: return elements result = [] for e in elements: ...
if not hasattr(content_element_text_child, 'childNodes') : continue if (content is None or content == '') and (content_element_text_child.childNodes is None or len(content_element_text_child.childNodes) == 0): continue content = find_element_content(content_elemen...
return content
conditional_block
HTMLUtil.py
import html5lib import traceback def build_html_dom_from_str(html_str): return html5lib.parse(html_str, 'dom') def find_html_element_list_for_tag(element, tag, class_style = None): elements = element.getElementsByTagName(tag) if not class_style: return elements result = [] for e in elements: ...
(element): try: content = None for content_element_text_child in element.childNodes: content = content_element_text_child.nodeValue if content is not None: content = content.strip() if content is not None and content != '' : return content ...
find_element_content
identifier_name
host_test_plugins.py
########################################################################### name = "HostTestPluginBase" # Plugin name, can be plugin class name type = "BasePlugin" # Plugin type: ResetMethod, CopyMethod etc. capabilities = [] # Capabilities names: what plugin can achieve # (e.g. reset using some ext...
(self, text): """Print error messages to the console. Args: text: Text to print. """ self.plugin_logger.prn_err(text) return False def print_plugin_info(self, text, NL=True): """Print notifications to the console. Args: text: Text to...
print_plugin_error
identifier_name
host_test_plugins.py
########################################################################### def setup(self, *args, **kwargs): """Configure plugin. This function should be called before plugin execute() method is used. """ return False def execute(self, capability, *args, **kwargs): "...
result = "Windows7"
conditional_block