file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
middleware.py
""" Middleware to auto-expire inactive sessions after N seconds, which is configurable in settings. To enable this feature, set in a settings.py: SESSION_INACTIVITY_TIMEOUT_IN_SECS = 300 This was taken from StackOverflow (http://stackoverflow.com/questions/14830669/how-to-expire-django-session-in-5minutes) """ f...
""" Standard entry point for processing requests in Django """ if not hasattr(request, "user") or not request.user.is_authenticated: #Can't log out if not logged in return timeout_in_seconds = getattr(settings, "SESSION_INACTIVITY_TIMEOUT_IN_SECONDS", None) ...
identifier_body
middleware.py
""" Middleware to auto-expire inactive sessions after N seconds, which is configurable in settings. To enable this feature, set in a settings.py: SESSION_INACTIVITY_TIMEOUT_IN_SECS = 300 This was taken from StackOverflow (http://stackoverflow.com/questions/14830669/how-to-expire-django-session-in-5minutes) """ f...
(self, request): """ Standard entry point for processing requests in Django """ if not hasattr(request, "user") or not request.user.is_authenticated: #Can't log out if not logged in return timeout_in_seconds = getattr(settings, "SESSION_INACTIVITY_TIMEOUT...
process_request
identifier_name
middleware.py
""" Middleware to auto-expire inactive sessions after N seconds, which is configurable in settings. To enable this feature, set in a settings.py: SESSION_INACTIVITY_TIMEOUT_IN_SECS = 300 This was taken from StackOverflow (http://stackoverflow.com/questions/14830669/how-to-expire-django-session-in-5minutes) """ f...
LAST_TOUCH_KEYNAME = 'SessionInactivityTimeout:last_touch' class SessionInactivityTimeout(MiddlewareMixin): """ Middleware class to keep track of activity on a given session """ def process_request(self, request): """ Standard entry point for processing requests in Django """ ...
from django.conf import settings from django.contrib import auth from django.utils.deprecation import MiddlewareMixin
random_line_split
middleware.py
""" Middleware to auto-expire inactive sessions after N seconds, which is configurable in settings. To enable this feature, set in a settings.py: SESSION_INACTIVITY_TIMEOUT_IN_SECS = 300 This was taken from StackOverflow (http://stackoverflow.com/questions/14830669/how-to-expire-django-session-in-5minutes) """ f...
request.session[LAST_TOUCH_KEYNAME] = utc_now
time_since_last_activity = utc_now - last_touch # did we exceed the timeout limit? if time_since_last_activity > timedelta(seconds=timeout_in_seconds): # yes? Then log the user out del request.session[LAST_TOUCH_KEYNAME] auth.l...
conditional_block
defaults-vi_VN.js
/*! * Bootstrap-select v1.13.9 (https://developer.snapappointments.com/bootstrap-select) *
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) */ (function (root, factory) { if (root === undefined && window !== undefined) root = window; if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module unless amdModuleId is s...
* Copyright 2012-2019 SnapAppointments, LLC
random_line_split
lib.rs
// Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
(reg: &mut Registry) { let pass = box pass::KytheLintPass::new(box JsonEntryWriter); reg.register_late_lint_pass(pass as LateLintPassObject); }
plugin_registrar
identifier_name
lib.rs
// Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
// Load rustc as a plugin to get macros. #[macro_use] extern crate rustc; extern crate rustc_plugin; #[macro_use] extern crate log; mod kythe; mod pass; mod visitor; use kythe::writer::JsonEntryWriter; use rustc_plugin::Registry; use rustc::lint::LateLintPassObject; // Informs the compiler of the existence and imp...
extern crate rustc_serialize;
random_line_split
lib.rs
// Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
{ let pass = box pass::KytheLintPass::new(box JsonEntryWriter); reg.register_late_lint_pass(pass as LateLintPassObject); }
identifier_body
issue-24081.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 ...
() {}
main
identifier_name
issue-24081.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 ...
use std::ops::Mul; use std::ops::Div; use std::ops::Rem; type Add = bool; //~ ERROR the name `Add` is defined multiple times //~| `Add` redefined here struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times //~| `Sub` redefined here enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times ...
use std::ops::Add; use std::ops::Sub;
random_line_split
angular-locale_pa-arab.js
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "\u0627\u062a\u0648\u...
return PLURAL_CATEGORY.OTHER;} }); }]);
{ return PLURAL_CATEGORY.ONE; }
conditional_block
angular-locale_pa-arab.js
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "\u0627\u062a\u0648\u0627\u0631", ...
random_line_split
regress-474771.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var gTestfile = 'regress-474771.js...
{ enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'PASS'; jit(true); if (typeof gczeal != 'undefined') { gczeal(2); } Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); jit(false); delete Object.prototype.q; reportCompare(exp...
identifier_body
regress-474771.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var gTestfile = 'regress-474771.js...
() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'PASS'; jit(true); if (typeof gczeal != 'undefined') { gczeal(2); } Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); jit(false); delete Object.prototype.q; reportCompare(...
test
identifier_name
regress-474771.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var gTestfile = 'regress-474771.js...
gczeal(2); } Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); jit(false); delete Object.prototype.q; reportCompare(expect, actual, summary); exitFunc ('test'); }
{
random_line_split
regress-474771.js
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var gTestfile = 'regress-474771.js...
Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); jit(false); delete Object.prototype.q; reportCompare(expect, actual, summary); exitFunc ('test'); }
{ gczeal(2); }
conditional_block
nullable-pointer-size.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 ...
check_option!($T); check_fancy!($T); }} } pub fn main() { check_type!(&'static int); check_type!(Box<int>); check_type!(Gc<int>); check_type!(extern fn()); }
($T:ty) => {{
random_line_split
nullable-pointer-size.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 ...
() { check_type!(&'static int); check_type!(Box<int>); check_type!(Gc<int>); check_type!(extern fn()); }
main
identifier_name
urls.py
# -*- coding: utf-8 -*- from rest_framework.routers import (Route, DynamicDetailRoute, SimpleRouter, DynamicListRoute) from app.api.account.views import AccountViewSet from app.api.podcast.views import PodcastV...
name='{basename}-{methodnamehyphen}', initkwargs={} ), # Detail route. Route( url=r'^{prefix}/{lookup}{trailing_slash}$', mapping={ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', ...
url=r'^{prefix}/{methodnamehyphen}{trailing_slash}$',
random_line_split
urls.py
# -*- coding: utf-8 -*- from rest_framework.routers import (Route, DynamicDetailRoute, SimpleRouter, DynamicListRoute) from app.api.account.views import AccountViewSet from app.api.podcast.views import PodcastV...
(SimpleRouter): """ A router for read-only APIs, which doesn't use trailing slashes. """ routes = [ Route( url=r'^{prefix}{trailing_slash}$', mapping={ 'get': 'list', 'post': 'create' }, name='{basename}-list', ...
CustomRouter
identifier_name
urls.py
# -*- coding: utf-8 -*- from rest_framework.routers import (Route, DynamicDetailRoute, SimpleRouter, DynamicListRoute) from app.api.account.views import AccountViewSet from app.api.podcast.views import PodcastV...
router = CustomRouter() router.register(r'accounts', AccountViewSet) router.register(r'podcasts', PodcastViewSet) router.register(r'episodes', EpisodeViewSet) urlpatterns = router.urls
""" A router for read-only APIs, which doesn't use trailing slashes. """ routes = [ Route( url=r'^{prefix}{trailing_slash}$', mapping={ 'get': 'list', 'post': 'create' }, name='{basename}-list', initkwargs={'...
identifier_body
graphs_9_hdfs_indices.py
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib from pylab import * import numpy from copy_reg import remove_extension from heapq import heappush from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA colors = ["red", "green", "blue", "orange", "brown", "black",...
(): font_size= 20 fig = figure(figsize=(8, 6), dpi=80) p1 = plt.bar(range(len(algo2index)), range(len(algo2index)), 1.0, color="#7FCA9F") for algo_index in xrange(len(algos)): p1[algo_index].set_color(colors[algo_index]) fig = figure(figsize=(12, 6), dpi=80) desc = [algo for algo in algo...
draw_legend
identifier_name
graphs_9_hdfs_indices.py
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib from pylab import * import numpy from copy_reg import remove_extension from heapq import heappush from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA colors = ["red", "green", "blue", "orange", "brown", "black",...
x = int(chunks[-5]) y = float(chunks[-1]) other_trends.setdefault(algo, []).append((x, y / x)) for key in other_trends.keys(): other_trends[key].sort() draw_scatter_plot(ii_trends, other_trends)
algo += "_" + chunks[2].zfill(5)
conditional_block
graphs_9_hdfs_indices.py
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib from pylab import * import numpy from copy_reg import remove_extension from heapq import heappush from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA colors = ["red", "green", "blue", "orange", "brown", "black",...
values = values[3:-3] import numpy, math margin_err = 1.96 * numpy.std(values) / math.sqrt(len(values)) return float(sum(values)) / len(values), margin_err RESPONSE_SIZE_POS = 0 TIME_RESULT_POS = 3 MEM_CONSUMPTION_POS = 1 QUERIES_COUNT = 200000 if 1: ii_trends = {} for line in open("../test_r...
quartile = len(values) / 4
random_line_split
graphs_9_hdfs_indices.py
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib from pylab import * import numpy from copy_reg import remove_extension from heapq import heappush from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA colors = ["red", "green", "blue", "orange", "brown", "black",...
def draw_legend(): font_size= 20 fig = figure(figsize=(8, 6), dpi=80) p1 = plt.bar(range(len(algo2index)), range(len(algo2index)), 1.0, color="#7FCA9F") for algo_index in xrange(len(algos)): p1[algo_index].set_color(colors[algo_index]) fig = figure(figsize=(12, 6), dpi=80) desc = [alg...
fig = figure(figsize=(8, 6), dpi=80) grid(b=True, which='major', color='gray', axis="both", linestyle='--', zorder=-1) font_size = 20 algos = [algo for algo in ii_trends.keys()] algos.sort() plt.ylim([0, 100]) for algo_index in xrange(len(algos)): algo = algos[algo_index] x_va...
identifier_body
unboxed-closures-call-sugar-autoderef.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() { let z = call_with_2(&mut |x| x - 22); assert_eq!(z, -20); }
{ x(2) // look ma, no `*` }
identifier_body
unboxed-closures-call-sugar-autoderef.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 ...
() { let z = call_with_2(&mut |x| x - 22); assert_eq!(z, -20); }
main
identifier_name
unboxed-closures-call-sugar-autoderef.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() { let z = call_with_2(&mut |x| x - 22); assert_eq!(z, -20);
random_line_split
FindTile.js
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var GetTilesWithin = require('./GetTilesWithin'); /** * @callback FindTileCallback * * @param {Phaser.Tilemaps.Tile} value - The Tile. * @p...
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * * @return {?Phaser.Tilemaps.Tile} A Tile that matches the search, or null if no Tile found */ var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) { var tiles = GetTilesWithin(tileX, tileY,...
* @param {object} [filteringOptions] - Optional filters to apply when getting the tiles. * @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have -1 for an index. * @param {boolean} [filteringOptions.isColliding=false] - If true, only return tiles that collide on at least o...
random_line_split
lab5-b.js
var view = Ti.UI.createView({     backgroundColor:'#000',     top:0,     left:0,     width:'100%',     height:'100%',     layout:'vertical' }); // create labels, buttons, text fields var helpLabel = Titanium.UI.createLabel({ color:'#abcdef', highlightedColor:'#0f0', backgroundColor:'transparent', width:'auto', h...
iew.add(createRadioGroupButton('Fish').radioButton); view.add(createRadioGroupButton('Vegetarian').radioButton); view.add(createRadioGroupButton('Chicken').radioButton); view.add(submitButton); Ti.UI.currentWindow.add(view);
anium.UI.createView({ top: 10, left: 0, height: 50, width: 200, borderRadius: 10, backgroundColor: '#fff', index: radioGroupIndex }); var selection1 = Titanium.UI.createLabel({ text : itemName, color : '#f79e18', font : {fontSize : 40}, textAlign: 'center' }); buttonView1.add(selection1); buttonV...
identifier_body
lab5-b.js
var view = Ti.UI.createView({     backgroundColor:'#000',     top:0,     left:0,     width:'100%',     height:'100%',     layout:'vertical' }); // create labels, buttons, text fields var helpLabel = Titanium.UI.createLabel({ color:'#abcdef', highlightedColor:'#0f0', backgroundColor:'transparent', width:'auto', he...
}; }); var index = radioGroupIndex; deselect = function (i,j) { //Ti.API.log("DEBUG",'deselect:'+radioGroup[i].index); if (radioGroup[i].index != j) { radioGroup[i].radioButton.backgroundColor = '#fff'; } } radioGroupIndex = radioGroupIndex +1; var exportWidget = { radioButton: buttonView1, d...
buttonView1.backgroundColor = '#cef7ff'; radioSelected = selection1.text; Ti.API.log("DEBUG",'selection1.text'+selection1.text); for (var i=0; i < radioGroup.length; i++) { deselect(i,index);
random_line_split
lab5-b.js
var view = Ti.UI.createView({     backgroundColor:'#000',     top:0,     left:0,     width:'100%',     height:'100%',     layout:'vertical' }); // create labels, buttons, text fields var helpLabel = Titanium.UI.createLabel({ color:'#abcdef', highlightedColor:'#0f0', backgroundColor:'transparent', width:'auto', h...
adioGroupIndex +1; var exportWidget = { radioButton: buttonView1, deselect: deselect, index: index}; radioGroup.push(exportWidget); return exportWidget; } view.add(helpLabel); view.add(createRadioGroupButton('Fish').radioButton); view.add(createRadioGroupButton('Vegetarian').radioButton); view.add(cr...
Button.backgroundColor = '#fff'; } } radioGroupIndex = r
conditional_block
lab5-b.js
var view = Ti.UI.createView({     backgroundColor:'#000',     top:0,     left:0,     width:'100%',     height:'100%',     layout:'vertical' }); // create labels, buttons, text fields var helpLabel = Titanium.UI.createLabel({ color:'#abcdef', highlightedColor:'#0f0', backgroundColor:'transparent', width:'auto', h...
View1 = Titanium.UI.createView({ top: 10, left: 0, height: 50, width: 200, borderRadius: 10, backgroundColor: '#fff', index: radioGroupIndex }); var selection1 = Titanium.UI.createLabel({ text : itemName, color : '#f79e18', font : {fontSize : 40}, textAlign: 'center' }); buttonView1.add(selection1);...
temName) { var button
identifier_name
evol.colorpicker.js
/* evol.colorpicker 3.2.1 ColorPicker widget for jQuery UI https://github.com/evoluteur/colorpicker (c) 2015 Olivier Giulieri * Depends: * jquery.ui.core.js * jquery.ui.widget.js */ (function( $, undefined ) { var _idx=0, ua=window.navigator.userAgent, isIE=ua.indexOf("MSIE ")>0, _ie=isIE?'-ie':'', isMo...
}, _setOption: function(key, value) { if(key=='color'){ this._setValue(value, true); }else{ this.options[key]=value; } }, _add2History: function(c) { var iMax=history.length; // skip color if already in history for(var i=0;i<iMax;i++){ if(c==history[i]){ return; } } // limit of 28 ...
.attr('style','background-color:'+c); }
random_line_split
evol.colorpicker.js
/* evol.colorpicker 3.2.1 ColorPicker widget for jQuery UI https://github.com/evoluteur/colorpicker (c) 2015 Olivier Giulieri * Depends: * jquery.ui.core.js * jquery.ui.widget.js */ (function( $, undefined ) { var _idx=0, ua=window.navigator.userAgent, isIE=ua.indexOf("MSIE ")>0, _ie=isIE?'-ie':'', isMo...
else{ style=(color!==null)?('background-color:'+color):''; } e.addClass('colorPicker '+this._id) .wrap('<div style="width:'+(this.options.hideButton?this.element.width():this.element.width()+32)+'px;'+ (isIE?'margin-bottom:-21px;':'')+ (isMoz?'padding:1px 0;':'')+ '"></div>') .a...
{ css+=' evo-transparent'; }
conditional_block
pokelists.py
rare_pokemon = ( "Dragonite", "Flareon", "Exeggutor", "Arcanine", "Victreebel", "Magmar", "Charizard", "Nidoking", "Gengar", "Vileplume", "Rapidash", "Raichu", "Machamp", "Venusaur", "Electabuzz", "Cloyster", "Golduck", "Starmie", "Gyarados", "Jolteon", "Weezing", "Weepinbell", "Kabutops", "Vaporeon", "Lapras", "Blasto...
"Alakazam", "Magneton", "Nidoqueen", "Aerodactyl", "Snorlax", "Muk", "Poliwrath", "Omastar", "Primeape", "Kingler", "Golem", "Ninetales", "Jynx", "Haunter", "Tentacruel", "Dragonair", "Wigglytuff", "Tangela", "Ponyta", "Hypno", "Charmeleon", "Dewgong", "Persian", "Porygon", "Ivysaur", "Machoke", "Mr. Mime", "Sandslash"...
"Exeggcute", "Abra", "Diglett", "Tentacool", "Geodude", "Vulpix", "Seel", "Drowzee", "Sandshrew", "Onix", "Chansey") ultra_rare_pokemon = ( "Dragonite", "Flareon", "Exeggutor", "Arcanine", "Victreebel", "Magmar", "Charizard", "Nidoking", "Gengar", "Vileplume", "Rapidash", "Raichu", "Machamp", "Venusaur", "Electabuzz", ...
random_line_split
SaveAsDialog.tsx
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react'; import { styled } from '@csegames/linaria/react'; import * as CONFIG from 'sha...
public render() { return ( <PopupDialog style={DIALOG_SIZE}> <TabbedDialog title='save as' heading={false} onClose={this.onClose}> {(tab: DialogButton) => <DialogTab buttons={[SAVE]} onAction={this.onAction}> <Container> {this.props.label}: ...
{ super(props); this.state = { name: '' }; }
identifier_body
SaveAsDialog.tsx
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react'; import { styled } from '@csegames/linaria/react'; import * as CONFIG from 'sha...
bottom: '0', left: '0', right: '0', margin: 'auto', }; const Input = styled.input` background-color: transparent; width: 100%; border: 1px solid #333; padding: 5px; outline: none; &:focus { box-shadow: 0 0 2px ${CONFIG.MENU_HIGHLIGHT_BORDER_COLOR}; } `; interface SaveAsProps { label: strin...
random_line_split
SaveAsDialog.tsx
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react'; import { styled } from '@csegames/linaria/react'; import * as CONFIG from 'sha...
(props: SaveAsProps) { super(props); this.state = { name: '' }; } public render() { return ( <PopupDialog style={DIALOG_SIZE}> <TabbedDialog title='save as' heading={false} onClose={this.onClose}> {(tab: DialogButton) => <DialogTab buttons={[SAVE]} onAction={this.onAction...
constructor
identifier_name
test_repositories.py
import pytest from cfme.infrastructure import repositories from utils.update import update from utils.wait import TimedOutError, wait_for @pytest.mark.tier(2) @pytest.mark.meta(blockers=[1188427]) def test_repository_crud(soft_assert, random_string, request):
repo_name = 'Test Repo {}'.format(random_string) repo = repositories.Repository(repo_name, '//testhost/share/path') request.addfinalizer(repo.delete) # create repo.create() # read assert repo.exists # update with update(repo): repo.name = 'Updated {}'.format(repo_name) wi...
identifier_body
test_repositories.py
import pytest from cfme.infrastructure import repositories from utils.update import update from utils.wait import TimedOutError, wait_for @pytest.mark.tier(2) @pytest.mark.meta(blockers=[1188427]) def test_repository_crud(soft_assert, random_string, request): repo_name = 'Test Repo {}'.format(random_string) ...
# read assert repo.exists # update with update(repo): repo.name = 'Updated {}'.format(repo_name) with soft_assert.catch_assert(): assert repo.exists, 'Repository rename failed' # Only change the name back if renaming succeeded with update(repo): repo.n...
random_line_split
test_repositories.py
import pytest from cfme.infrastructure import repositories from utils.update import update from utils.wait import TimedOutError, wait_for @pytest.mark.tier(2) @pytest.mark.meta(blockers=[1188427]) def
(soft_assert, random_string, request): repo_name = 'Test Repo {}'.format(random_string) repo = repositories.Repository(repo_name, '//testhost/share/path') request.addfinalizer(repo.delete) # create repo.create() # read assert repo.exists # update with update(repo): repo.na...
test_repository_crud
identifier_name
aarch64.rs
use dynasmrt::{dynasm, DynasmApi, DynasmLabelApi}; use std::{io, slice, mem}; use std::io::Write; fn main() { let mut ops = dynasmrt::aarch64::Assembler::new().unwrap(); let string = "Hello World!"; dynasm!(ops ; .arch aarch64 ; ->hello: ; .bytes string.as_bytes() ; .align...
{ io::stdout() .write_all(unsafe { slice::from_raw_parts(buffer, length as usize) }) .is_ok() }
identifier_body
aarch64.rs
use dynasmrt::{dynasm, DynasmApi, DynasmLabelApi}; use std::{io, slice, mem}; use std::io::Write; fn main() { let mut ops = dynasmrt::aarch64::Assembler::new().unwrap(); let string = "Hello World!"; dynasm!(ops ; .arch aarch64 ; ->hello: ; .bytes string.as_bytes() ; .align...
(buffer: *const u8, length: u64) -> bool { io::stdout() .write_all(unsafe { slice::from_raw_parts(buffer, length as usize) }) .is_ok() }
print
identifier_name
aarch64.rs
use dynasmrt::{dynasm, DynasmApi, DynasmLabelApi}; use std::{io, slice, mem}; use std::io::Write; fn main() { let mut ops = dynasmrt::aarch64::Assembler::new().unwrap(); let string = "Hello World!"; dynasm!(ops ; .arch aarch64 ; ->hello: ; .bytes string.as_bytes() ; .align...
} pub extern "C" fn print(buffer: *const u8, length: u64) -> bool { io::stdout() .write_all(unsafe { slice::from_raw_parts(buffer, length as usize) }) .is_ok() }
let buf = ops.finalize().unwrap(); let hello_fn: extern "C" fn() -> bool = unsafe { mem::transmute(buf.ptr(hello)) }; assert!(hello_fn());
random_line_split
test_phone2numeric.py
from django.template.defaultfilters import phone2numeric_filter from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import render, setup class Phone2numericTests(SimpleTestCase): @setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'}) def test...
self.assertEqual(phone2numeric_filter('0800 flowers'), '0800 3569377')
identifier_body
test_phone2numeric.py
from django.template.defaultfilters import phone2numeric_filter from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import render, setup class
(SimpleTestCase): @setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'}) def test_phone2numeric01(self): output = render( 'phone2numeric01', {'a': '<1-800-call-me>', 'b': mark_safe('<1-800-call-me>')}, ) self.assertEqual(output, '&lt;1-800-225...
Phone2numericTests
identifier_name
test_phone2numeric.py
from django.template.defaultfilters import phone2numeric_filter from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import render, setup class Phone2numericTests(SimpleTestCase): @setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'}) def test...
{'a': '<1-800-call-me>', 'b': mark_safe('<1-800-call-me>')}, ) self.assertEqual(output, '<1-800-2255-63> <1-800-2255-63>') @setup({'phone2numeric03': '{{ a|phone2numeric }}'}) def test_phone2numeric03(self): output = render( 'phone2numeric03', {'a': '...
random_line_split
ironrouter.d.ts
declare module Iron { function controller(): any; interface RouterStatic { bodyParser: any; hooks: any; } var Router: RouterStatic; type HookCallback = (this: RouteController) => void; export type RouteHook = HookCallback | string; export type RouteHooks = RouteHook | RouteHook[]; type RouteCallback = (t...
put(func: RouteCallback): Route; delete(func: RouteCallback): Route; } interface RouterGoOptions { replaceState?: boolean; query?: string | { [key: string]: string | number | boolean }; } interface RouteController { stop(): void; next(): void; wait(handle: DDP.SubscriptionHandle); ready(): boolean...
get(func: RouteCallback): Route; post(func: RouteCallback): Route;
random_line_split
store.rs
pub struct StoreStats { pub num_keys: u64, pub total_memory_in_bytes: u64, } impl StoreStats { pub fn new() -> StoreStats { StoreStats { num_keys: 0, total_memory_in_bytes: 0, } } } pub trait ValueStore<K, V> { fn get(&self, key: &K) -> Option<&V>; fn se...
pub fn set(&mut self, key: K, value: V) { self.evict_keys_if_necessary(); self.eviction_policy.update_metadata_on_set(key.clone(), value.clone()); self.value_store.set(key, value); } fn evict_keys_if_necessary(&mut self) { let should_evict = self.eviction_policy.should_evi...
{ self.evict_keys_if_necessary(); self.eviction_policy.update_metadata_on_get(key.clone()); self.value_store.get(key) }
identifier_body
store.rs
pub struct StoreStats { pub num_keys: u64, pub total_memory_in_bytes: u64, } impl StoreStats { pub fn new() -> StoreStats { StoreStats { num_keys: 0, total_memory_in_bytes: 0, } } } pub trait ValueStore<K, V> { fn get(&self, key: &K) -> Option<&V>; fn se...
} }
{ let keys_to_evict = self.eviction_policy.choose_keys_to_evict(); self.value_store.delete_many(&keys_to_evict); self.eviction_policy.delete_metadata(&keys_to_evict); }
conditional_block
store.rs
pub struct StoreStats { pub num_keys: u64, pub total_memory_in_bytes: u64, } impl StoreStats { pub fn new() -> StoreStats { StoreStats { num_keys: 0, total_memory_in_bytes: 0, } }
fn set(&mut self, key: K, value: V); fn delete(&mut self, key: &K) -> bool; fn delete_many(&mut self, keys: &Vec<K>); fn clear(&mut self); fn stats(&self) -> &StoreStats; } pub trait EvictionPolicy<K, V> { // Metadata management fn update_metadata_on_get(&mut self, key: K); fn update_me...
} pub trait ValueStore<K, V> { fn get(&self, key: &K) -> Option<&V>;
random_line_split
store.rs
pub struct StoreStats { pub num_keys: u64, pub total_memory_in_bytes: u64, } impl StoreStats { pub fn new() -> StoreStats { StoreStats { num_keys: 0, total_memory_in_bytes: 0, } } } pub trait ValueStore<K, V> { fn get(&self, key: &K) -> Option<&V>; fn se...
(&mut self, key: &K) -> Option<&V> { self.evict_keys_if_necessary(); self.eviction_policy.update_metadata_on_get(key.clone()); self.value_store.get(key) } pub fn set(&mut self, key: K, value: V) { self.evict_keys_if_necessary(); self.eviction_policy.update_metadata_on_se...
get
identifier_name
transition.js
/** * @fileoverview transition parser/implementation - still WIP * * @author Tony Parisi */ goog.provide('glam.TransitionElement'); goog.require('glam.AnimationElement'); glam.TransitionElement.DEFAULT_DURATION = glam.AnimationElement.DEFAULT_DURATION; glam.TransitionElement.DEFAULT_TIMING_FUNCTION = glam.Anima...
var i, len = comps.length; for (i = 0; i < len; i++) { var comp = comps[i]; if (comp) { var params = comp.split(" "); if (params[0] == "") params.shift(); var propname = params[0]; var duration = params[1]; var timingFunction = params[2] || glam.TransitionElement.DEFAULT_TIMING_FUNCTION; var...
var comps = transition.split(",");
random_line_split
transition.js
/** * @fileoverview transition parser/implementation - still WIP * * @author Tony Parisi */ goog.provide('glam.TransitionElement'); goog.require('glam.AnimationElement'); glam.TransitionElement.DEFAULT_DURATION = glam.AnimationElement.DEFAULT_DURATION; glam.TransitionElement.DEFAULT_TIMING_FUNCTION = glam.Anima...
}
{ var comp = comps[i]; if (comp) { var params = comp.split(" "); if (params[0] == "") params.shift(); var propname = params[0]; var duration = params[1]; var timingFunction = params[2] || glam.TransitionElement.DEFAULT_TIMING_FUNCTION; var delay = params[3] || ""; duration = glam.Animat...
conditional_block
iComponent.ts
export interface IAfterGuiAttachedParams { eComponent: HTMLElement; }
export interface ICellRendererAfterGuiAttachedParams extends IAfterGuiAttachedParams { eParentOfValue: HTMLElement; eGridCell: HTMLElement; } export interface IComponent<T, Z extends IAfterGuiAttachedParams> { /** Return the DOM element of your editor, this is what the grid puts into the DOM */ getGui...
export interface IFilterAfterGuiAttachedParams extends IAfterGuiAttachedParams { hidePopup: () => void; }
random_line_split
widgets_helpers.js
if (Meteor.isClient) { Template.widgetDistanceInput.helpers({ currentDistance: function(){ var pj = Session.get('active-pj'); return pj.info.distance_target; }, currentDistanceMts: function(){ var pj = Session.get('active-pj'); return Math.floor(pj.info.distance_target * 0.3048); ...
return cmd; }, }); }
{ cmd += parseInt(Tablas.core.classes[pj.info.class].getBaseAttackBonus(pj.info.experience.level)[0]); cmd += parseInt(pj.modificadores.str); cmd += parseInt(pj.modificadores.dex); cmd += parseInt(pj.info.combat_maneuvers.defense); cmd += parseInt(Tablas.core.charSize[pj.info.siz...
conditional_block
widgets_helpers.js
if (Meteor.isClient) { Template.widgetDistanceInput.helpers({ currentDistance: function(){ var pj = Session.get('active-pj'); return pj.info.distance_target; }, currentDistanceMts: function(){ var pj = Session.get('active-pj'); return Math.floor(pj.info.distance_target * 0.3048); ...
return cmb; }, cmd: function(){ var pj = Session.get('active-pj'); var cmd = 10; if(pj){ cmd += parseInt(Tablas.core.classes[pj.info.class].getBaseAttackBonus(pj.info.experience.level)[0]); cmd += parseInt(pj.modificadores.str); cmd += parseInt(pj.modificadores.de...
cmb += parseInt(Tablas.core.classes[pj.info.class].getBaseAttackBonus(pj.info.experience.level)[0]); cmb += parseInt(pj.modificadores.str); cmb += parseInt(pj.info.combat_maneuvers.bonus); cmb += parseInt(Tablas.core.charSize[pj.info.size].special_modifier); }
random_line_split
contact-form.js
$(document).ready(function() { $('#feedbackForm input') .not('.optional,.no-asterisk') .after('<span class="glyphicon glyphicon-asterisk form-control-feedback"></span>'); $("#feedbackSubmit").click(function() { var $btn = $(this); $btn.button('loading'); contactForm.clearErrors(); //do a l...
}); }); //namespace as not to pollute global namespace var contactForm = { isValidEmail: function (email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); }, clearErrors: function () { $('#emailAlert').remove(); $('#feedbackForm .help-blo...
{ asteriskSpan.css('color', 'black'); }
conditional_block
contact-form.js
$(document).ready(function() { $('#feedbackForm input') .not('.optional,.no-asterisk') .after('<span class="glyphicon glyphicon-asterisk form-control-feedback"></span>'); $("#feedbackSubmit").click(function() { var $btn = $(this); $btn.button('loading'); contactForm.clearErrors(); //do a l...
addAjaxMessage: function(msg, isError) { $("#feedbackSubmit").after('<div id="emailAlert" class="alert alert-' + (isError ? 'danger' : 'success') + '" style="margin-top: 5px;">' + $('<div/>').text(msg).html() + '</div>'); } };
addError: function ($input) { $input.siblings('.help-block').show(); $input.parent('.form-group').addClass('has-error'); },
random_line_split
boxCap.py
""" Capturing and analyzing the box information Author: Lyu Yaopengfei Date: 23-May-2016 """ import cv2 import threading import time from PIL import Image import Lego.dsOperation as dso import Lego.imgPreprocessing as imgprep from Lego.ocr import tesserOcr capImg = None resImg = None stopFlat = 0 lock = ...
else: clickFlag = 0 cv2.destroyWindow('filted') cv2.imshow('capFrame',showImg) analyseBoxInfo(bx1,FEATURE_IMG_FOLDER) dso.dsWrite(BOX_DATA_PATH,bx1) print('\n') logFile.close() boxData.close() cap.release() cv2.destroyAllWindows()
exportLog(logFile, 'Saving '+bx1.boxname+'_'+dso.SUF_DEF[clickCnt]+' data') imgName = bx1.boxname+'_'+str(clickCnt)+'.tiff' savingPath = FEATURE_IMG_FOLDER + imgName savingPath2 = FEATURE_IMG_FOLDER + 'color/c' + imgName cv2.imwrite(savingPath, filtedCroped) c...
conditional_block
boxCap.py
""" Capturing and analyzing the box information Author: Lyu Yaopengfei Date: 23-May-2016 """ import cv2 import threading import time from PIL import Image import Lego.dsOperation as dso import Lego.imgPreprocessing as imgprep from Lego.ocr import tesserOcr capImg = None resImg = None stopFlat = 0 lock = ...
clickCnt = 0 clickFlag = 0 def detect_circle(event,x,y,flags,param): global clickFlag if event==cv2.EVENT_LBUTTONUP: clickFlag = clickFlag+1 elif event==cv2.EVENT_RBUTTONUP: clickFlag = -1 # lock.acquire() # try: # cv2.imwrite('cap.png',capImg) # finall...
global capImg global stopFlat while(1): lock.acquire() try: _,capImg = cap.read() finally: lock.release() if (stopFlat > 0): break
identifier_body
boxCap.py
""" Capturing and analyzing the box information Author: Lyu Yaopengfei Date: 23-May-2016 """ import cv2 import threading import time from PIL import Image import Lego.dsOperation as dso import Lego.imgPreprocessing as imgprep from Lego.ocr import tesserOcr capImg = None resImg = None stopFlat = 0 lock = ...
(logoAffinePos,img,idx): _, _, _, _, affinedCropedImg, rtnFlag = logoAffinePos.rcvAffinedAll(img) if (rtnFlag is False): return None,None,None,False filtedCroped = imgprep.imgFilter(affinedCropedImg) filtedCroped = cv2.cvtColor(filtedCroped,cv2.COLOR_GRAY2RGB) filtedCropedPIL = Image.fromarr...
detectImg
identifier_name
boxCap.py
""" Capturing and analyzing the box information Author: Lyu Yaopengfei Date: 23-May-2016 """ import cv2 import threading import time from PIL import Image import Lego.dsOperation as dso import Lego.imgPreprocessing as imgprep from Lego.ocr import tesserOcr capImg = None resImg = None stopFlat = 0 lock = ...
showFlag = 0 cv2.putText(showImg,'Capturing '+bx1.boxname+'_'+dso.SUF_DEF[clickCnt]+' picture',(10,250), cv2.FONT_HERSHEY_SIMPLEX, 0.5,(0,255,255),1) # fisrt time left click, detect the image and output the result elif(clickFlag is 1): if(dtrtnFlag is False):...
dtrtnFlag = False
random_line_split
ddraw.rs
// 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. // All files in the project carrying such notice may not be copied, modified, or distributed // except according ...
0xda044e00, 0x69b2, 0x11d0, 0xa1, 0xd5, 0x00, 0xaa, 0x00, 0xb8, 0xdf, 0xbb} DEFINE_GUID!{IID_IDirectDrawSurface4, 0x0b2b8630, 0xad35, 0x11d0, 0x8e, 0xa6, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} DEFINE_GUID!{IID_IDirectDrawSurface7, 0x06675a80, 0x3b9b, 0x11d2, 0xb9, 0x2f, 0x00, 0x60, 0x97, 0x97, 0xea, 0x5b} DEFI...
DEFINE_GUID!{IID_IDirectDrawSurface2, 0x57805885, 0x6eec, 0x11cf, 0x94, 0x41, 0xa8, 0x23, 0x03, 0xc1, 0x0e, 0x27} DEFINE_GUID!{IID_IDirectDrawSurface3,
random_line_split
people.init.js
$(function(){ // set-up the favs_people table if it doesn't exist $(document).ready(function(){ db.transaction( function(transaction) { transaction.executeSql( 'CREATE TABLE IF NOT EXISTS favs_people '+ ' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, given...
var peopleFavSelected = false; // mark or unmark the item as a favorite function peopleFav() { if (peopleFavSelected == true) { db.transaction( function(transaction) { transaction.executeSql( 'DELETE FROM favs_people WHERE username = ?;', [sessionStorage.username], function() { people...
random_line_split
people.init.js
$(function(){ // set-up the favs_people table if it doesn't exist $(document).ready(function(){ db.transaction( function(transaction) { transaction.executeSql( 'CREATE TABLE IF NOT EXISTS favs_people '+ ' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, given...
else { // get number of favorites db.transaction( function(transaction) { transaction.executeSql( 'SELECT * FROM favs_people ORDER BY surname;', [], function(transaction,results) { $(".pfavscount").html('<small id="pfavscount" class="counter">'+results.rows.length+'</sm...
{ $(this).removeClass('active'); }
conditional_block
people.init.js
$(function(){ // set-up the favs_people table if it doesn't exist $(document).ready(function(){ db.transaction( function(transaction) { transaction.executeSql( 'CREATE TABLE IF NOT EXISTS favs_people '+ ' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, given...
() { db.transaction( function(transaction) { transaction.executeSql( 'SELECT id FROM favs_people WHERE username = ?;', [sessionStorage.username], function(transaction,results) { if (results.rows.length > 0) { $('#people-favorite-detail-img').attr('src','/themes/'+theme+'/webkit/images/fav...
checkPeopleFav
identifier_name
people.init.js
$(function(){ // set-up the favs_people table if it doesn't exist $(document).ready(function(){ db.transaction( function(transaction) { transaction.executeSql( 'CREATE TABLE IF NOT EXISTS favs_people '+ ' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, given...
{ db.transaction( function(transaction) { transaction.executeSql( 'SELECT id FROM favs_people WHERE username = ?;', [sessionStorage.username], function(transaction,results) { if (results.rows.length > 0) { $('#people-favorite-detail-img').attr('src','/themes/'+theme+'/webkit/images/favori...
identifier_body
FunctionEntityDetails.tsx
import React, { useContext } from 'react'; import { DetailsListLayoutMode, SelectionMode, ICommandBarItemProps, IColumn } from 'office-ui-fabric-react'; import { useTranslation } from 'react-i18next'; import { AppInsightsOrchestrationTrace, AppInsightsEntityTraceDetail } from '../../../../../../../models/app-insights';...
const { entityDetails, appInsightsResourceId, currentTrace } = props; const portalContext = useContext(PortalContext); const entityContext = useContext(FunctionEntitiesContext); const instanceId = currentTrace ? currentTrace.DurableFunctionsInstanceId : ''; const { t } = useTranslation(); const getCommand...
currentTrace?: AppInsightsOrchestrationTrace; entityDetails?: AppInsightsEntityTraceDetail[]; } const FunctionEntityDetails: React.FC<FunctionEntityDetailsProps> = props => {
random_line_split
Menu.js
import React from 'react'; import { StyleSheet, Text, View, Button, Image, Dimensions, } from 'react-native'; import { StackNavigator, } from 'react-navigation'; class
extends React.Component { static navigationOptions = { title: 'Menu' } render() { const imageURI = Expo.Asset.fromModule(require('../assets/screens/menu.png')).uri; return ( <View style={{position: 'relative', alignItems: 'flex-end', justifyContent: 'center', flex: 1}}> <Text onPress={...
MenuScreen
identifier_name
Menu.js
import React from 'react'; import { StyleSheet, Text, View, Button, Image, Dimensions, } from 'react-native'; import { StackNavigator, } from 'react-navigation'; class MenuScreen extends React.Component { static navigationOptions = { title: 'Menu' } render() { const imageURI = Expo.Asset...
<Image source={{ uri: imageURI }} style={{ height: '100%', width: '100%', opacity: 0.1, position: 'absolute'}} /> <Button title="aaaaaaaaaaaa" style={{ height: 100, width: '100%', position: 'absolute', float: 'down', bottom: 0 }} onPress...
return ( <View style={{position: 'relative', alignItems: 'flex-end', justifyContent: 'center', flex: 1}}> <Text onPress={this._handlePress}>Go to Settings</Text>
random_line_split
mod.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
//! Many collections provide several constructors and methods that refer to "capacity". //! These collections are generally built on top of an array. Optimally, this array would be //! exactly the right size to fit only the elements stored in the collection, but for the //! collection to do this would be very inefficie...
//! specific collection in particular, consult its documentation for detailed discussion //! and code examples. //! //! ## Capacity Management //!
random_line_split
scheme.rs
use alloc::boxed::Box; use collections::vec::Vec; use collections::vec_deque::VecDeque; use core::ops::DerefMut; use fs::Resource; use system::error::Result; use sync::{Intex, WaitQueue}; pub trait NetworkScheme { fn add(&mut self, resource: *mut NetworkResource); fn remove(&mut self, resource: *mut Netwo...
fn write(&mut self, buf: &[u8]) -> Result<usize> { unsafe { (*self.ptr).outbound.lock().push_back(Vec::from(buf)); (*self.nic).sync(); } Ok(buf.len()) } fn sync(&mut self) -> Result<()> { unsafe { (*self.nic).sync(); } ...
{ let bytes = unsafe { (*self.nic).sync(); (*self.ptr).inbound.receive() }; let mut i = 0; while i < bytes.len() && i < buf.len() { buf[i] = bytes[i]; i += 1; } return Ok(bytes.len()); }
identifier_body
scheme.rs
use alloc::boxed::Box; use collections::vec::Vec; use collections::vec_deque::VecDeque; use core::ops::DerefMut; use fs::Resource; use system::error::Result; use sync::{Intex, WaitQueue}; pub trait NetworkScheme { fn add(&mut self, resource: *mut NetworkResource); fn remove(&mut self, resource: *mut Netwo...
(&mut self, buf: &[u8]) -> Result<usize> { unsafe { (*self.ptr).outbound.lock().push_back(Vec::from(buf)); (*self.nic).sync(); } Ok(buf.len()) } fn sync(&mut self) -> Result<()> { unsafe { (*self.nic).sync(); } Ok(()) } }...
write
identifier_name
scheme.rs
use alloc::boxed::Box; use collections::vec::Vec; use collections::vec_deque::VecDeque; use core::ops::DerefMut; use fs::Resource; use system::error::Result; use sync::{Intex, WaitQueue}; pub trait NetworkScheme { fn add(&mut self, resource: *mut NetworkResource); fn remove(&mut self, resource: *mut Netwo...
Ok(buf.len()) } fn sync(&mut self) -> Result<()> { unsafe { (*self.nic).sync(); } Ok(()) } } impl Drop for NetworkResource { fn drop(&mut self) { unsafe { (*self.nic).remove(self.ptr); } } }
(*self.ptr).outbound.lock().push_back(Vec::from(buf)); (*self.nic).sync(); }
random_line_split
Column.ts
/* Tournament grid Copyright (C) 2017 Egor Nepomnyaschih This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This...
(this.cup.gridType === GRID_TYPE_DOUBLE && this.cup.gridIndex === 0 ? 1 : 0) switch (columnsRemaining) { case 0: return locale("GRAND_FINAL"); case 1: return locale("FINAL"); case 2: return locale("SEMIFINAL"); default: return "1/" + this.matches.getLength(); } } get fullTitle() { retu...
} const columnsRemaining = this.cup.grid.getLength() - this.index -
random_line_split
Column.ts
/* Tournament grid Copyright (C) 2017 Egor Nepomnyaschih This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This...
update(column: Column) { this.matches.each((match, index) => { match.update(column.matches.get(index)); }) } static createByJson(json: any, index: number, cup: Cup, participants: Dictionary<Participant>, superfinal: boolean) { const column = new Column({ index: index, cup: cup, bo: +...
{ return (this.bo + 1) / 2; }
identifier_body
Column.ts
/* Tournament grid Copyright (C) 2017 Egor Nepomnyaschih This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This...
() { if (this.cup.gridIndex === 1) { return ""; } const columnsRemaining = this.cup.grid.getLength() - this.index - (this.cup.gridType === GRID_TYPE_DOUBLE && this.cup.gridIndex === 0 ? 1 : 0) switch (columnsRemaining) { case 0: return locale("GRAND_FINAL"); case 1: return locale("FINAL"); ...
title
identifier_name
Column.ts
/* Tournament grid Copyright (C) 2017 Egor Nepomnyaschih This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This...
return this.index - hiddenColumns - (this.superfinal ? 1 : 0); })); this.gap = this.own(this.visibleIndex.mapValue((visibleIndex) => { return Math.pow(2, visibleIndex) * (MATCH_HEIGHT + MATCH_GAP) - MATCH_HEIGHT; })); // rely on the fact that visibleIndex and gap are already computed this.offs...
{ return Math.floor(this.index / 2) - Math.floor(hiddenColumns / 2); }
conditional_block
tags.ts
// Copyright 2019 Google LLC // // 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 ...
"ubuntu", "uitableview", "umbraco", "uml", "unicode", "unit-testing", "unity3d", "unix", "url", "user-interface", "uwp", "vaadin", "vagrant", "vb.net", "vb.net-2010", "vb6", "vba", "vbscript", "verilog", "version-control", "vhdl", "...
"uber-api",
random_line_split
index.ts
import { Injectable } from '@angular/core'; import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Uid * @description * Get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC. * * @usage * ```typescript * import { Uid } from '@ionic-native/uid/ngx'; * import { AndroidPerm...
* const { hasPermission } = await this.androidPermissions.checkPermission( * this.androidPermissions.PERMISSION.READ_PHONE_STATE * ); * * if (!hasPermission) { * const result = await this.androidPermissions.requestPermission( * this.androidPermissions.PERMISSION.READ_PHONE_STATE * ); * * i...
* * async getImei() {
random_line_split
index.ts
import { Injectable } from '@angular/core'; import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Uid * @description * Get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC. * * @usage * ```typescript * import { Uid } from '@ionic-native/uid/ngx'; * import { AndroidPerm...
extends IonicNativePlugin { /** Get the device Universally Unique Identifier (UUID). */ @CordovaProperty() UUID: string; /** Get the device International Mobile Station Equipment Identity (IMEI). */ @CordovaProperty() IMEI: string; /** Get the device International mobile Subscriber Identity (IMSI). */ ...
Uid
identifier_name
state.py
# SPDX-License-Identifier: GPL-2.0+ # Copyright 2018 Google, Inc # Written by Simon Glass <sjg@chromium.org> # # Holds and modifies the state information held by binman # import hashlib import re from dtoc import fdt import os from patman import tools from patman import tout # Records the device-tree files known to ...
def AllowEntryContraction(): """Check whether post-pack contraction of entries is allowed Returns: True if contraction should be allowed, False if an exception should be raised """ return allow_entry_contraction
"""Set whether post-pack contraction of entries is allowed Args: allow: True to allow contraction, False to raise an exception """ global allow_entry_contraction allow_entry_contraction = allow
identifier_body
state.py
# SPDX-License-Identifier: GPL-2.0+ # Copyright 2018 Google, Inc # Written by Simon Glass <sjg@chromium.org> # # Holds and modifies the state information held by binman # import hashlib import re from dtoc import fdt import os from patman import tools from patman import tout # Records the device-tree files known to ...
n.AddEmptyProp('value', size) def CheckSetHashValue(node, get_data_func): hash_node = node.FindNode('hash') if hash_node: algo = hash_node.props.get('algo').value if algo == 'sha256': m = hashlib.sha256() m.update(get_data_func()) data = m.digest(...
return "Unknown hash algorithm '%s'" % algo for n in GetUpdateNodes(hash_node):
random_line_split
state.py
# SPDX-License-Identifier: GPL-2.0+ # Copyright 2018 Google, Inc # Written by Simon Glass <sjg@chromium.org> # # Holds and modifies the state information held by binman # import hashlib import re from dtoc import fdt import os from patman import tools from patman import tout # Records the device-tree files known to ...
return first def AddString(node, prop, value): """Add a new string property to affected device trees Args: prop_name: Name of property value: String value (which will be \0-terminated in the DT) """ for n in GetUpdateNodes(node): n.AddString(prop, value) def SetInt(node, ...
subnode = n.AddSubnode(name) if not first: first = subnode
conditional_block
state.py
# SPDX-License-Identifier: GPL-2.0+ # Copyright 2018 Google, Inc # Written by Simon Glass <sjg@chromium.org> # # Holds and modifies the state information held by binman # import hashlib import re from dtoc import fdt import os from patman import tools from patman import tout # Records the device-tree files known to ...
(image): """Get device tree files ready for use with a loaded image Loaded images are different from images that are being created by binman, since there is generally already an fdtmap and we read the description from that. This provides the position and size of every entry in the image with no cal...
PrepareFromLoadedData
identifier_name
delete_course.py
from __future__ import print_function from six import text_type from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from contentstore.utils import delete_course from xmodule.contentstore.django import contentstore from xm...
""" Delete a MongoDB backed course Example usage: $ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --settings=devstack $ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --keep-instructors --settings=devstack $ ./manage.py cms delete_course 'course-v1:edX...
identifier_body
delete_course.py
from __future__ import print_function from six import text_type from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey
from .prompt import query_yes_no class Command(BaseCommand): """ Delete a MongoDB backed course Example usage: $ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --settings=devstack $ ./manage.py cms delete_course 'course-v1:edX+DemoX+Demo_Course' --keep-instructors --setti...
from contentstore.utils import delete_course from xmodule.contentstore.django import contentstore from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore
random_line_split
delete_course.py
from __future__ import print_function from six import text_type from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from contentstore.utils import delete_course from xmodule.contentstore.django import contentstore from xm...
(self, *args, **options): try: # a course key may have unicode chars in it try: course_key = text_type(options['course_key'], 'utf8') # May already be decoded to unicode if coming in through tests, this is ok. except TypeError: cour...
handle
identifier_name
delete_course.py
from __future__ import print_function from six import text_type from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from contentstore.utils import delete_course from xmodule.contentstore.django import contentstore from xm...
print(u'Deleted course {}'.format(course_key))
contentstore().delete_all_course_assets(course_key) print(u'Deleted assets for course'.format(course_key))
conditional_block
unsized5.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ }
identifier_body
unsized5.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
struct S4 { f: str, //~ ERROR `core::marker::Sized` is not implemented g: usize } enum E<X: ?Sized> { V1(X, isize), //~ERROR `core::marker::Sized` is not implemented } enum F<X: ?Sized> { V2{f1: X, f: isize}, //~ERROR `core::marker::Sized` is not implemented } pub fn main() { }
}
random_line_split
unsized5.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<X: ?Sized> { f: isize, g: X, //~ ERROR `core::marker::Sized` is not implemented h: isize, } struct S3 { f: str, //~ ERROR `core::marker::Sized` is not implemented g: [usize] } struct S4 { f: str, //~ ERROR `core::marker::Sized` is not implemented g: usize } enum E<X: ?Sized> { V1(X, isi...
S2
identifier_name
mmio.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. use zinc64_core::{AddressableFaded, Chip, Ram, Shared}; pub struct Mmio { cia_1: Shared<dyn Chip>, cia_2: Shared<dyn C...
} impl Mmio { pub fn new( cia_1: Shared<dyn Chip>, cia_2: Shared<dyn Chip>, color_ram: Shared<Ram>, expansion_port: Shared<dyn AddressableFaded>, sid: Shared<dyn Chip>, vic: Shared<dyn Chip>, ) -> Self { Self { cia_1, cia_2, ...
color_ram: Shared<Ram>, expansion_port: Shared<dyn AddressableFaded>, sid: Shared<dyn Chip>, vic: Shared<dyn Chip>,
random_line_split
mmio.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. use zinc64_core::{AddressableFaded, Chip, Ram, Shared}; pub struct Mmio { cia_1: Shared<dyn Chip>, cia_2: Shared<dyn C...
(&self, address: u16) -> u8 { match address { 0xd000..=0xd3ff => self.vic.borrow_mut().read((address & 0x003f) as u8), 0xd400..=0xd7ff => self.sid.borrow_mut().read((address & 0x001f) as u8), 0xd800..=0xdbff => self.color_ram.borrow().read(address - 0xd800), 0xdc0...
read
identifier_name
custom_utils.py
############################################################################### ## Imports ############################################################################### # Django from django import template from django.forms.forms import BoundField ####################################################################...
return widget.render(name, self.value(), attrs=attrs) @register.filter(name='namelessfield') def namelessfield(field): return NamelessField(field)
name = ""
random_line_split
custom_utils.py
############################################################################### ## Imports ############################################################################### # Django from django import template from django.forms.forms import BoundField ####################################################################...
(field): return NamelessField(field)
namelessfield
identifier_name
custom_utils.py
############################################################################### ## Imports ############################################################################### # Django from django import template from django.forms.forms import BoundField ####################################################################...
return NamelessField(field)
identifier_body
custom_utils.py
############################################################################### ## Imports ############################################################################### # Django from django import template from django.forms.forms import BoundField ####################################################################...
else: attrs['id'] = self.html_initial_id name = "" return widget.render(name, self.value(), attrs=attrs) @register.filter(name='namelessfield') def namelessfield(field): return NamelessField(field)
attrs['id'] = auto_id
conditional_block