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
roulette.component.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
(services) { this.services = services; this.a = 3000 / (Math.pow(20 * this.services.timba.players.length, 35)); this.totalRounds = 20 * this.services.timba.players.length; this.initialRounds = 10 * this.services.timba.players.length; this.accRounds = 15 * this.services.timba.play...
RouletteComponent
identifier_name
roulette.component.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
RouletteComponent.prototype.addPlayerRoulette = function (i) { if (i < this.services.timba.players.length) { $("#roulette").append("<div id=\"roulette" + i + "\" class=\"roulette-cell\" style=\"transition:opacity 0.5s ease-in-out;opacity:0;transform: rotate(" + i * 360 / this.services.timba.play...
$("#" + n).css("opacity", "0"); }, 1000); };
random_line_split
roulette.component.js
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Refl...
RouletteComponent.prototype.ngOnInit = function () { var _this = this; $("#welcome").css("opacity", "1"); setTimeout(function () { $("#welcome").css("opacity", "0"); setTimeout(function () { _this.addPlayerRoulette(0); _this.addPlayerR...
{ this.services = services; this.a = 3000 / (Math.pow(20 * this.services.timba.players.length, 35)); this.totalRounds = 20 * this.services.timba.players.length; this.initialRounds = 10 * this.services.timba.players.length; this.accRounds = 15 * this.services.timba.players.length;...
identifier_body
ethertype.rs
use core::convert::TryFrom; use num_enum::TryFromPrimitive; use serde::{Deserialize, Serialize}; /// https://en.wikipedia.org/wiki/EtherType#Examples #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TryFromPrimitive, Deserialize, Serialize, )] #[repr(u16)]...
pub fn from_bytes(bytes: &[u8]) -> Self { let n = u16::from_be_bytes([bytes[0], bytes[1]]); Self::try_from(n).unwrap_or_else(|_| panic!("Unknwn EtherType {:04x}", n)) } pub fn to_bytes(self) -> [u8; 2] { u16::to_be_bytes(self as u16) } }
EthernetFlowControl = 0x8808, EthernetSlowProtocol = 0x8809, } impl EtherType {
random_line_split
ethertype.rs
use core::convert::TryFrom; use num_enum::TryFromPrimitive; use serde::{Deserialize, Serialize}; /// https://en.wikipedia.org/wiki/EtherType#Examples #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TryFromPrimitive, Deserialize, Serialize, )] #[repr(u16)]...
(bytes: &[u8]) -> Self { let n = u16::from_be_bytes([bytes[0], bytes[1]]); Self::try_from(n).unwrap_or_else(|_| panic!("Unknwn EtherType {:04x}", n)) } pub fn to_bytes(self) -> [u8; 2] { u16::to_be_bytes(self as u16) } }
from_bytes
identifier_name
ethertype.rs
use core::convert::TryFrom; use num_enum::TryFromPrimitive; use serde::{Deserialize, Serialize}; /// https://en.wikipedia.org/wiki/EtherType#Examples #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TryFromPrimitive, Deserialize, Serialize, )] #[repr(u16)]...
}
{ u16::to_be_bytes(self as u16) }
identifier_body
__init__.py
# Copyright 2008 German Aerospace Center (DLR) # # 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 agre...
from webdav.acp.Ace import ACE from webdav.acp.GrantDeny import GrantDeny from webdav.acp.Privilege import Privilege from webdav.acp.Principal import Principal __version__ = "$LastChangedRevision: 2 $"
from webdav.acp.Acl import ACL
random_line_split
validators.py
## This file is part of Invenio. ## Copyright (C) 2012 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later version. ## ## Inv...
(val): """ Test if argument is an ISSN number """ val = val.replace("-", "").replace(" ", "") if len(val) != 8: return False r = sum([(8 - i) * (_convert_x_to_10(x)) for i, x in enumerate(val)]) return not (r % 11) def is_all_uppercase(val): """ Returns true if more than 75% of the cha...
is_issn
identifier_name
validators.py
## This file is part of Invenio. ## Copyright (C) 2012 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later version. ## ## Inv...
def is_isbn10(val): """ Test if argument is an ISBN-10 number Courtesy Wikipedia: http://en.wikipedia.org/wiki/International_Standard_Book_Number """ val = val.replace("-", "").replace(" ", "") if len(val) != 10: return False r = sum([(10 - i) * (_convert_x_to_10(x)) for i, x...
return 10
conditional_block
validators.py
## This file is part of Invenio. ## Copyright (C) 2012 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later version. ## ## Inv...
Courtesy Wikipedia: http://en.wikipedia.org/wiki/International_Standard_Book_Number """ val = val.replace("-", "").replace(" ", "") if len(val) != 10: return False r = sum([(10 - i) * (_convert_x_to_10(x)) for i, x in enumerate(val)]) return not (r % 11) def is_isbn13(val): """...
random_line_split
validators.py
## This file is part of Invenio. ## Copyright (C) 2012 CERN. ## ## Invenio 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 2 of the ## License, or (at your option) any later version. ## ## Inv...
def is_issn(val): """ Test if argument is an ISSN number """ val = val.replace("-", "").replace(" ", "") if len(val) != 8: return False r = sum([(8 - i) * (_convert_x_to_10(x)) for i, x in enumerate(val)]) return not (r % 11) def is_all_uppercase(val): """ Returns true if more than ...
""" Test if argument is an ISBN-10 or ISBN-13 number """ return is_isbn10(val) or is_isbn13(val)
identifier_body
GetSliceTags.py
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.SliceTags import SliceTag, SliceTags from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Nodes import Nodes from PLC.Slices import Slice, Slices from PL...
if return_fields is not None and 'slice_tag_id' not in return_fields: return_fields.append('slice_tag_id') added_fields = True else: added_fields = False slice_tags = SliceTags(self.api, slice_tag_filter, return_fields) # Filter out slice attributes that are...
identifier_body
GetSliceTags.py
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.SliceTags import SliceTag, SliceTags from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Nodes import Nodes
from PLC.Auth import Auth class GetSliceTags(Method): """ Returns an array of structs containing details about slice and sliver attributes. An attribute is a sliver attribute if the node_id field is set. If slice_tag_filter is specified and is an array of slice attribute identifiers, or a struct of...
from PLC.Slices import Slice, Slices
random_line_split
GetSliceTags.py
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.SliceTags import SliceTag, SliceTags from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Nodes import Nodes from PLC.Slices import Slice, Slices from PL...
(self, auth, slice_tag_filter = None, return_fields = None): # If we are not admin, make sure to only return our own slice # and sliver attributes. # if isinstance(self.caller, Person) and \ # 'admin' not in self.caller['roles']: # # Get slices that we are able to view # ...
call
identifier_name
GetSliceTags.py
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.SliceTags import SliceTag, SliceTags from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Nodes import Nodes from PLC.Slices import Slice, Slices from PL...
else: added_fields = False slice_tags = SliceTags(self.api, slice_tag_filter, return_fields) # Filter out slice attributes that are not viewable # if isinstance(self.caller, Person) and \ # 'admin' not in self.caller['roles']: # slice_tags = [slice_tag ...
return_fields.append('slice_tag_id') added_fields = True
conditional_block
parser.ts
import {Reporter} from './index'; export class Parser { ch: string = ""; // current character aheadchars: string[] = []; at: number = 0; // index of the current character line: number = 0; // current line atline: number = 0; // index of the first character of the line reporter: Reporter; source: () => st...
(ch: string) { return !Parser.isSpaceChar(ch); } static isSpaceChar(ch: string) { return ch === ' ' || ch === '\t'; } static isNotLineChar(ch: string) { return !Parser.isLineChar(ch); } static isLineChar(ch: string) { return ch === '\n'; } static isNotAnySpaceChar(ch: string) { return !Parser.isAnyS...
isNotSpaceChar
identifier_name
parser.ts
import {Reporter} from './index'; export class Parser { ch: string = ""; // current character aheadchars: string[] = []; at: number = 0; // index of the current character line: number = 0; // current line atline: number = 0; // index of the first character of the line reporter: Reporter; source: () => st...
ret += this.ch; this.next(); } if (ret.length < minLength) this.error(`expecting to match ${predicate.name} x (${ret.length}/${minLength}), received: ${this.ch}`); return ret; } skip(predicate: (ch: string) => boolean, minLength: number = 0) : number { let count = 0; while (th...
while(predicate: (ch: string) => boolean, minLength: number) : string { let ret = ""; while (this.ch && predicate(this.ch)) {
random_line_split
parser.ts
import {Reporter} from './index'; export class Parser { ch: string = ""; // current character aheadchars: string[] = []; at: number = 0; // index of the current character line: number = 0; // current line atline: number = 0; // index of the first character of the line reporter: Reporter; source: () => st...
static isNotWordChar(ch: string) { return !Parser.isWordChar(ch); } static isWordChar(ch: string) { return ch === '_' || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ('0' <= ch && ch <= '9'); } static isNotSpaceChar(ch: string) { return !Parser.isSpaceChar(ch); } static isSpa...
{ return '0' <= ch && ch <= '9'; }
identifier_body
parser.ts
import {Reporter} from './index'; export class Parser { ch: string = ""; // current character aheadchars: string[] = []; at: number = 0; // index of the current character line: number = 0; // current line atline: number = 0; // index of the first character of the line reporter: Reporter; source: () => st...
if (count < minLength) this.error(`expecting to match ${predicate.name} x (${count}/${minLength}), received: ${this.ch}`); return count; } }
{ this.next(); count++; }
conditional_block
setup.py
import os import sys import glob try: import numpy except ImportError: print "You need to have numpy installed on your system to run setup.py. Sorry!" sys.exit() try: from Cython.Distutils import build_ext except ImportError: print "You need to have Cython installed on your system to run setup.py....
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() include_dirs_for_concoct = [numpy.get_include(), '/opt/local/include/'] setup( name = "anvio", version = open('VERSION').read(...
del os.link
conditional_block
setup.py
import os import sys import glob try: import numpy except ImportError: print "You need to have numpy installed on your system to run setup.py. Sorry!" sys.exit() try: from Cython.Distutils import build_ext except ImportError: print "You need to have Cython installed on your system to run setup.py....
'Programming Language :: C', 'Topic :: Scientific/Engineering', ], )
'Operating System :: MacOS', 'Operating System :: POSIX', 'Programming Language :: Python :: 2.7', 'Programming Language :: JavaScript',
random_line_split
settings.py
SECRET_KEY = 'asdf' DATABASES = { 'default': { 'NAME': 'test.db', 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.staticfiles', 'revproxy', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessi...
}, }
'handlers': ['null'], 'propagate': False, },
random_line_split
InternalLinkModalView.js
import ModalView from 'OpenOrchestra/Service/Modal/View/ModalView' import FormBuilder from 'OpenOrchestra/Service/Form/Model/FormBuilder' import InternalLinkFormView from 'OpenOrchestra/Service/Tinymce/Plugins/InternalLink/View/InternalLinkFormView' /** * InternalLinkModalView */ class InternalLi...
({editor, data}) { super.initialize(); this._editor = editor; this._data = data; } /** * render internal link modal form */ render() { let template = this._renderTemplate('Tinymce/InternalLink/internalLinkForm'); this.$el.html(template); let $formRe...
initialize
identifier_name
InternalLinkModalView.js
import ModalView from 'OpenOrchestra/Service/Modal/View/ModalView' import FormBuilder from 'OpenOrchestra/Service/Form/Model/FormBuilder' import InternalLinkFormView from 'OpenOrchestra/Service/Tinymce/Plugins/InternalLink/View/InternalLinkFormView' /** * InternalLinkModalView */ class InternalLi...
} export default InternalLinkModalView
{ let template = this._renderTemplate('Tinymce/InternalLink/internalLinkForm'); this.$el.html(template); let $formRegion = $('.modal-body', this.$el); this._displayLoader($formRegion); let url = Routing.generate('open_orchestra_backoffice_internal_link_form'); FormBuilde...
identifier_body
InternalLinkModalView.js
import ModalView from 'OpenOrchestra/Service/Modal/View/ModalView' import FormBuilder from 'OpenOrchestra/Service/Form/Model/FormBuilder' import InternalLinkFormView from 'OpenOrchestra/Service/Tinymce/Plugins/InternalLink/View/InternalLinkFormView' /** * InternalLinkModalView */ class InternalLi...
} export default InternalLinkModalView
}, this._data); return this; }
random_line_split
mix_panel.js
App.addChild('MixPanel', { el: 'body', activate: function(){ this.VISIT_MIN_TIME = 10000; this.user = null; this.controller = this.$el.data('controller'); this.action = this.$el.data('action'); this.user = this.$el.data('user'); if(window.mixpanel){ this.detectLogin(); this.star...
var opt = $.fn.extend(default_options, opt); mixpanel.track(text, opt); }, mixPanelEvent: function(target, event, text, options){ var self = this; this.$(target).on(event, function(){ self.track(text, options); }); }, trackVisit: function(eventName){ var self = this; wi...
{ default_options.user_id = this.user.id; default_options.created = this.user.created_at; default_options.last_login = this.user.last_sign_in_at; default_options.contributions = this.user.total_contributed_projects; default_options.has_contributions = (this.user.total_contributed_projects ...
conditional_block
mix_panel.js
App.addChild('MixPanel', { el: 'body', activate: function(){ this.VISIT_MIN_TIME = 10000; this.user = null; this.controller = this.$el.data('controller'); this.action = this.$el.data('action'); this.user = this.$el.data('user'); if(window.mixpanel){ this.detectLogin(); this.star...
}, trackFacebookShare: function() { var self = this; this.$('a#facebook_share').on('click', function(event){ self.track('Share a project', { ref: $(event.currentTarget).data('title'), social_network: 'Facebook' }); }); }, trackOnFacebookLike: function() { var self = this; FB.Event.s...
self.track('Share a project', { ref: $(event.currentTarget).data('title'), social_network: 'Twitter' }); });
random_line_split
Lungo.Attributes.js
/** * Object with data-attributes (HTML5) with a special <markup> * * @namespace Lungo * @class Attributes * * @author Javier Jimenez Villar <javi@tapquo.com> || @soyjavi * @author Guillermo Pascual <pasku@tapquo.com> || @pasku1 */ Lungo.Attributes = { count: { selector: '*', html: '<span c...
</div>' }, label: { selector: '*', html: '<abbr>{{value}}</abbr>' }, icon: { selector: '*', html: '<span class="icon {{value}}"></span>' }, image: { selector: '*', html: '<img src="{{value}}" class="icon" />' }, title: { ...
selector: '*', html: '<div class="progress">\ <span class="bar"><span class="value" style="width:{{value}};"></span></span>\
random_line_split
bytes.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::types::{Intern, RawInternKey}; use fnv::FnvHashMap; use lazy_static::lazy_static; use parking_lot::RwLock; use serde::{D...
} } fn new_buffer() -> &'static mut [u8] { Box::leak(Box::new([0; Self::BUFFER_SIZE])) } pub fn get(&self, value: &[u8]) -> Option<RawInternKey> { self.table.get(value).cloned() } // Copy the byte slice into 'static memory by appending it to a buffer, if there is room....
random_line_split
bytes.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::types::{Intern, RawInternKey}; use fnv::FnvHashMap; use lazy_static::lazy_static; use parking_lot::RwLock; use serde::{D...
() -> Self { Self { buffer: Some(Self::new_buffer()), items: Default::default(), table: Default::default(), } } fn new_buffer() -> &'static mut [u8] { Box::leak(Box::new([0; Self::BUFFER_SIZE])) } pub fn get(&self, value: &[u8]) -> Option<Raw...
new
identifier_name
bytes.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::types::{Intern, RawInternKey}; use fnv::FnvHashMap; use lazy_static::lazy_static; use parking_lot::RwLock; use serde::{D...
// Copy the byte slice into 'static memory by appending it to a buffer, if there is room. // If the buffer fills up and the value is small, start over with a new buffer. // If the value is large, just give it its own memory. fn alloc(&mut self, value: &[u8]) -> &'static [u8] { let len = value....
{ self.table.get(value).cloned() }
identifier_body
bytes.rs
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::types::{Intern, RawInternKey}; use fnv::FnvHashMap; use lazy_static::lazy_static; use parking_lot::RwLock; use serde::{D...
} let (mem, remaining) = buffer.split_at_mut(len); mem.copy_from_slice(value); self.buffer = Some(remaining); mem } pub fn intern(&mut self, value: &[u8]) -> RawInternKey { // If there's an existing value return it if let Some(prev) = self.get(&value) ...
{ buffer = Self::new_buffer() }
conditional_block
ad-banner.component.ts
// #docregion import { Component, Input, AfterViewInit, ViewChild, ComponentFactoryResolver, OnDestroy } from '@angular/core'; import { AdDirective } from './ad.directive'; import { AdItem } from './ad-item'; import { AdComponent } from './ad.component'; @Component({ selector: 'add-banner', // #docregion ad-...
() { clearInterval(this.interval); } loadComponent() { this.currentAddIndex = (this.currentAddIndex + 1) % this.ads.length; let adItem = this.ads[this.currentAddIndex]; let componentFactory = this._componentFactoryResolver.resolveComponentFactory(adItem.component); let viewContainerRef = this...
ngOnDestroy
identifier_name
ad-banner.component.ts
// #docregion import { Component, Input, AfterViewInit, ViewChild, ComponentFactoryResolver, OnDestroy } from '@angular/core'; import { AdDirective } from './ad.directive'; import { AdItem } from './ad-item'; import { AdComponent } from './ad.component';
<h3>Advertisements</h3> <template ad-host></template> </div> ` // #enddocregion ad-host }) export class AdBannerComponent implements AfterViewInit, OnDestroy { @Input() ads: AdItem[]; currentAddIndex: number = -1; @ViewChild(AdDirective) adHost...
@Component({ selector: 'add-banner', // #docregion ad-host template: ` <div class="ad-banner">
random_line_split
ad-banner.component.ts
// #docregion import { Component, Input, AfterViewInit, ViewChild, ComponentFactoryResolver, OnDestroy } from '@angular/core'; import { AdDirective } from './ad.directive'; import { AdItem } from './ad-item'; import { AdComponent } from './ad.component'; @Component({ selector: 'add-banner', // #docregion ad-...
}
{ this.interval = setInterval(() => { this.loadComponent(); }, 3000); }
identifier_body
handler.py
# -*- coding: utf-8 -*- """signal handlers registered by the imager_profile app""" from __future__ import unicode_literals from django.conf import settings from django.db.models.signals import post_save from django.db.models.signals import pre_delete from django.dispatch import receiver from imager_profile.models impor...
@receiver(pre_delete, sender=settings.AUTH_USER_MODEL) def remove_imager_profile(sender, **kwargs): try: kwargs['instance'].profile.delete() except (KeyError, AttributeError): msg = ( "ImagerProfile instance not deleted for {}. " "Perhaps it does not exist?" ) ...
try: new_profile = ImagerProfile(user=kwargs['instance']) new_profile.save() except (KeyError, ValueError): logger.error('Unable to create ImagerProfile for User instance.')
conditional_block
handler.py
# -*- coding: utf-8 -*- """signal handlers registered by the imager_profile app""" from __future__ import unicode_literals from django.conf import settings from django.db.models.signals import post_save from django.db.models.signals import pre_delete
import logging logger = logging.getLogger(__name__) @receiver(post_save, sender=settings.AUTH_USER_MODEL) def ensure_imager_profile(sender, **kwargs): """Create and save an ImagerProfile after every new User is created.""" if kwargs.get('created', False): try: new_profile = ImagerProfile...
from django.dispatch import receiver from imager_profile.models import ImagerProfile
random_line_split
handler.py
# -*- coding: utf-8 -*- """signal handlers registered by the imager_profile app""" from __future__ import unicode_literals from django.conf import settings from django.db.models.signals import post_save from django.db.models.signals import pre_delete from django.dispatch import receiver from imager_profile.models impor...
@receiver(pre_delete, sender=settings.AUTH_USER_MODEL) def remove_imager_profile(sender, **kwargs): try: kwargs['instance'].profile.delete() except (KeyError, AttributeError): msg = ( "ImagerProfile instance not deleted for {}. " "Perhaps it does not exist?" ) ...
"""Create and save an ImagerProfile after every new User is created.""" if kwargs.get('created', False): try: new_profile = ImagerProfile(user=kwargs['instance']) new_profile.save() except (KeyError, ValueError): logger.error('Unable to create ImagerProfile for Us...
identifier_body
handler.py
# -*- coding: utf-8 -*- """signal handlers registered by the imager_profile app""" from __future__ import unicode_literals from django.conf import settings from django.db.models.signals import post_save from django.db.models.signals import pre_delete from django.dispatch import receiver from imager_profile.models impor...
(sender, **kwargs): """Create and save an ImagerProfile after every new User is created.""" if kwargs.get('created', False): try: new_profile = ImagerProfile(user=kwargs['instance']) new_profile.save() except (KeyError, ValueError): logger.error('Unable to cre...
ensure_imager_profile
identifier_name
LayersSVGIcon.tsx
// This is a generated file from running the "createIcons" script. This file should not be updated manually. import { forwardRef } from "react"; import { SVGIcon, SVGIconProps } from "@react-md/icon"; export const LayersSVGIcon = forwardRef<SVGSVGElement, SVGIconProps>( function LayersSVGIcon(props, ref) { retu...
);
random_line_split
driver.py
# Copyright (C) 2011 Google Inc. All rights reserved. # Copyright (c) 2015, 2016 Apple Inc. 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...
(self, test_name, timeout, image_hash, should_run_pixel_test, should_dump_jsconsolelog_in_stderr=None, args=None): self.test_name = test_name self.timeout = timeout # in ms self.image_hash = image_hash self.should_run_pixel_test = should_run_pixel_test self.should_dump_jsconsole...
__init__
identifier_name
driver.py
# Copyright (C) 2011 Google Inc. All rights reserved. # Copyright (c) 2015, 2016 Apple Inc. 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...
return False def _process_stdout_line(self, block, line): if (self._read_header(block, line, 'Content-Type: ', 'content_type') or self._read_header(block, line, 'Content-Transfer-Encoding: ', 'encoding') or self._read_header(block, line, 'Content-Length: ', '_content_length...
value = line.split()[1] if header_filter: value = header_filter(value) setattr(block, header_attr, value) return True
conditional_block
driver.py
# Copyright (C) 2011 Google Inc. All rights reserved. # Copyright (c) 2015, 2016 Apple Inc. 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...
if out_line: assert not out_seen_eof out_line, out_seen_eof = self._strip_eof(out_line) if err_line: assert not self.err_seen_eof err_line, self.err_seen_eof = self._strip_eof(err_line) if out_line: self...
if self._server_process.timed_out or self.has_crashed(): break
random_line_split
driver.py
# Copyright (C) 2011 Google Inc. All rights reserved. # Copyright (c) 2015, 2016 Apple Inc. 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...
def _setup_environ_for_test(self): environment = self._port.setup_environ_for_server(self._server_name) environment = self._setup_environ_for_driver(environment) return environment def _start(self, pixel_tests, per_test_args): self.stop() # Each driver process should b...
build_root_path = str(self._port._build_path()) self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) self._append_environment_variable_path(environment, 'DYLD_FRAM...
identifier_body
init-res-into-things.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn test_tup() { let i = &Cell::new(0); { let _a = (r(i), 0); } assert_eq!(i.get(), 1); } fn test_unique() { let i = &Cell::new(0); { let _a = box r(i); } assert_eq!(i.get(), 1); } fn test_unique_rec() { let i = &Cell::new(0); { let _a = box BoxR { ...
let i = &Cell::new(0); { let _a = t::t0(r(i)); } assert_eq!(i.get(), 1);
random_line_split
init-res-into-things.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<'a> { i: &'a Cell<int>, } struct BoxR<'a> { x: r<'a> } #[unsafe_destructor] impl<'a> Drop for r<'a> { fn drop(&mut self) { self.i.set(self.i.get() + 1) } } fn r(i: &Cell<int>) -> r { r { i: i } } fn test_rec() { let i = &Cell::new(0); { let _a = BoxR {x: r(i)}; ...
r
identifier_name
settings.component.ts
/* * This file is part of *** M y C o R e *** * See http://www.mycore.de/ for details. * * MyCoRe 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)...
else { localStorage.setItem("comHistorySize", defaultComHSize + ""); } var storageAutoScroll = localStorage.getItem("autoScroll"); if (storageAutoScroll != undefined && storageAutoScroll != ""){ defaultAutoScroll = (storageAutoScroll == "true"); } else { localStorage.setItem("...
{ defaultComHSize = parseInt(storageComHSize); }
conditional_block
settings.component.ts
/* * This file is part of *** M y C o R e *** * See http://www.mycore.de/ for details. * * MyCoRe 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)...
(private _communicationService: CommunicationService, private _restService: RESTService){ this._restService.continueIfOneFails.subscribe( value => this.settings.continueIfOneFails = value ); } ngOnInit() { this.settings = this.getSetti...
constructor
identifier_name
settings.component.ts
/* * This file is part of *** M y C o R e *** * See http://www.mycore.de/ for details. * * MyCoRe 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)...
} var storageAutoScroll = localStorage.getItem("autoScroll"); if (storageAutoScroll != undefined && storageAutoScroll != ""){ defaultAutoScroll = (storageAutoScroll == "true"); } else { localStorage.setItem("autoScroll", defaultAutoScroll + ""); } var storageContinueIfOneFails ...
random_line_split
settings.component.ts
/* * This file is part of *** M y C o R e *** * See http://www.mycore.de/ for details. * * MyCoRe 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)...
deleteCommandHistory() { this._communicationService.setCommandHistory([]); localStorage.removeItem("commandHistory"); } private getSettingsFromCookie(defaultHSize: number, defaultComHSize: number, defaultAutoScroll: boolean, defaultContinueIfOneFails: boolean) { var storageHSize = localStorage.getI...
{ if (localStorage.getItem("continueIfOneFails") != event.srcElement.checked + "") { localStorage.setItem("continueIfOneFails", event.srcElement.checked); } this._restService.setContinueIfOneFails(event.srcElement.checked); }
identifier_body
heatmap.data.ts
import { Dictionary } from '../../../models/json/dictionary'; /** * Reuse of HTML DOM Rect class, added here to shut Typescript up. */ export interface DOMRect { width: number; height: number; } /** * Specifies border settings for a component. The color can be a class (prefixed with '.') or color name. */...
stacked?: boolean, } /** * Options specific to the use of colors in the headers, batches and cells. */ interface ColorRules { /** * This is the default array colors for the batches and their headers. The list of colors rotates for each batch * (not each column). The defaults are reddish-brown heade...
* The future feature will draw the batches in blocks, instead of in columns. This will hopefully allow better * distribution to reduce open space, may be a better visualization for some types of data, and allow greater * freedom when trying to reserve space for the minimap without overlaying the data. ...
random_line_split
heatmap.data.ts
import { Dictionary } from '../../../models/json/dictionary'; /** * Reuse of HTML DOM Rect class, added here to shut Typescript up. */ export interface DOMRect { width: number; height: number; } /** * Specifies border settings for a component. The color can be a class (prefixed with '.') or color name. */...
(options: HeatmapOptions): [number, number] { if (!options || !options.zoom || !options.zoom.zoomExtent || (options.zoom.zoomExtent.length < 2)) { return null; } let zoom = options.zoom.zoomExtent.map(extent => Math.max(.01, 1 / extent)).sort((a, b) => a - b); return zoom as ...
reciprocateZoom
identifier_name
heatmap.data.ts
import { Dictionary } from '../../../models/json/dictionary'; /** * Reuse of HTML DOM Rect class, added here to shut Typescript up. */ export interface DOMRect { width: number; height: number; } /** * Specifies border settings for a component. The color can be a class (prefixed with '.') or color name. */...
} export const DEFAULT_OPTIONS: HeatmapOptions = { view: { component: '', headerHeight: 48, minSidePadding: 1, minBottomPadding: 1, }, color: { batchColors: [ {header: {bg: '#e3f2fd', fg: '#333'}, body: {bg: '#e3f2fd', fg: 'black'}}, {head...
{ if (!options || !options.zoom || !options.zoom.zoomExtent || (options.zoom.zoomExtent.length < 2)) { return null; } let zoom = options.zoom.zoomExtent.map(extent => Math.max(.01, 1 / extent)).sort((a, b) => a - b); return zoom as [number, number]; }
identifier_body
heatmap.data.ts
import { Dictionary } from '../../../models/json/dictionary'; /** * Reuse of HTML DOM Rect class, added here to shut Typescript up. */ export interface DOMRect { width: number; height: number; } /** * Specifies border settings for a component. The color can be a class (prefixed with '.') or color name. */...
merged.hover.delay = Math.max(1, merged.hover.delay); if (merged.text.headers && merged.text.headers.fontSize) { merged.text.headers.fontSize = Math.max(0, merged.text.headers.fontSize); } if (merged.text.cells && merged.text.cells.fontSize) { merged.text.cells....
{ merged.hover.color.bg = (merged.hover.color.bg.length > 0) ? merged.hover.color.bg[0] : 'transparent'; }
conditional_block
kindck-inherited-copy-bound.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 ...
() { let x = box 3is; take_param(&x); //~ ERROR `core::marker::Copy` is not implemented } fn b() { let x = box 3is; let y = &x; let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented } fn main() { }
a
identifier_name
kindck-inherited-copy-bound.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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Test that Cop...
random_line_split
kindck-inherited-copy-bound.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 ...
fn a() { let x = box 3is; take_param(&x); //~ ERROR `core::marker::Copy` is not implemented } fn b() { let x = box 3is; let y = &x; let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented } fn main() { }
{ }
identifier_body
axfs.py
"""A parser for axfs file system images""" from stat import * import zlib from . import * from ..io import * from ..util import * AxfsHeader = Struct('AxfsHeader', [ ('magic', Struct.STR % 4), ('signature', Struct.STR % 16), ('digest', Struct.STR % 40), ('blockSize', Struct.INT32), ('files', Struct.INT64), ('s...
(file): header = AxfsHeader.unpack(file) return header and header.magic == axfsHeaderMagic and header.signature == axfsHeaderSignature def readAxfs(file): header = AxfsHeader.unpack(file) if header.magic != axfsHeaderMagic or header.signature != axfsHeaderSignature: raise Exception('Wrong magic') regions = {} ...
isAxfs
identifier_name
axfs.py
"""A parser for axfs file system images""" from stat import * import zlib from . import * from ..io import * from ..util import * AxfsHeader = Struct('AxfsHeader', [ ('magic', Struct.STR % 4), ('signature', Struct.STR % 16), ('digest', Struct.STR % 40), ('blockSize', Struct.INT32), ('files', Struct.INT64), ('s...
def readAxfs(file): header = AxfsHeader.unpack(file) if header.magic != axfsHeaderMagic or header.signature != axfsHeaderSignature: raise Exception('Wrong magic') regions = {} tables = {} for i, k in enumerate(axfsRegions): region = AxfsRegionDesc.unpack(file, parse64be(header.regions[i*8:(i+1)*8])) regio...
header = AxfsHeader.unpack(file) return header and header.magic == axfsHeaderMagic and header.signature == axfsHeaderSignature
identifier_body
axfs.py
"""A parser for axfs file system images""" from stat import * import zlib from . import * from ..io import * from ..util import * AxfsHeader = Struct('AxfsHeader', [ ('magic', Struct.STR % 4), ('signature', Struct.STR % 16), ('digest', Struct.STR % 40), ('blockSize', Struct.INT32), ('files', Struct.INT64), ('s...
def readInode(id, path=''): size = tables['fileSize'][id] nameOffset = tables['nameOffset'][id] mode = tables['modes'][tables['modeIndex'][id]] uid = tables['uids'][tables['modeIndex'][id]] gid = tables['gids'][tables['modeIndex'][id]] numEntries = tables['numEntries'][id] arrayIndex = tables['arrayInd...
region = AxfsRegionDesc.unpack(file, parse64be(header.regions[i*8:(i+1)*8])) regions[k] = FilePart(file, region.offset, region.size) if i >= 4: regionData = regions[k].read() tables[k] = [sum([ord(regionData[j*region.maxIndex+i:j*region.maxIndex+i+1]) << (8*j) for j in range(region.tableByteDepth)]) for i in ...
conditional_block
axfs.py
"""A parser for axfs file system images""" from stat import *
import zlib from . import * from ..io import * from ..util import * AxfsHeader = Struct('AxfsHeader', [ ('magic', Struct.STR % 4), ('signature', Struct.STR % 16), ('digest', Struct.STR % 40), ('blockSize', Struct.INT32), ('files', Struct.INT64), ('size', Struct.INT64), ('blocks', Struct.INT64), ('mmapSize', S...
random_line_split
example-nrf24-recv.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Example program to receive packets from the radio link # import virtGPIO as GPIO from lib_nrf24 import NRF24 import time pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7], [0xc2, 0xc2, 0xc2, 0xc2, 0xc2]] radio2 = NRF24(GPIO, GPIO.SpiDev()) radio2.begin(9, 7) radio2.setRetries(1...
radio2.writeAckPayload(1, akpl_buf, len(akpl_buf)) print ("Loaded payload reply:"), print (akpl_buf) else: print ("(No return payload)")
random_line_split
example-nrf24-recv.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Example program to receive packets from the radio link # import virtGPIO as GPIO from lib_nrf24 import NRF24 import time pipes = [[0xe7, 0xe7, 0xe7, 0xe7, 0xe7], [0xc2, 0xc2, 0xc2, 0xc2, 0xc2]] radio2 = NRF24(GPIO, GPIO.SpiDev()) radio2.begin(9, 7) radio2.setRetries(1...
else: print ("(No return payload)")
radio2.writeAckPayload(1, akpl_buf, len(akpl_buf)) print ("Loaded payload reply:"), print (akpl_buf)
conditional_block
NotificationsMenu.tsx
import { AnalyticsSchema } from "v2/Artsy/Analytics" import { useTracking } from "v2/Artsy/Analytics/useTracking" import React, { useContext } from "react" import { graphql } from "react-relay" import { SystemContext } from "v2/Artsy" import { get } from "v2/Utils/get" import { LoadProgressRenderer, renderWithLoa...
> <Flex alignItems="center"> <Box width={40} height={40} bg="black5" mr={1}> <Image src={image.resized.url} width={40} height={40} style={{ objectFit: "cover", ...
}}
random_line_split
autocomplete_test.py
# coding: utf-8 # Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to...
@pytest.fixture def create_two_autocomplete_parameters(): with app.app_context(): autocomplete_param1 = models.AutocompleteParameter('europe', 'OSM', 'BANO', 'OSM', 'OSM', [8, 9]) autocomplete_param2 = models.AutocompleteParameter('france', 'OSM', 'OSM', 'FUSIO', 'OSM', [8, 9]) models.db....
job = models.Job() dataset = models.DataSet() dataset.type = dset_type dataset.family_type = 'autocomplete_{}'.format(dataset.type) dataset.name = '/path/to/dataset_{}'.format(i) models.db.session.add(dataset) job.autocomplete_params_id = autocom...
conditional_block
autocomplete_test.py
# coding: utf-8 # Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to...
def test_get_last_datasets_autocomplete(create_autocomplete_parameter): """ we query the loaded datasets of idf we loaded 3 datasets, but by default we should get one by family_type, so one for bano, one for osm """ resp = api_get('/v0/autocomplete_parameters/idf/last_datasets') assert len(r...
resp = api_get('/v0/autocomplete_parameters/') assert len(resp) == 2 resp = api_get('/v0/autocomplete_parameters/france') assert resp['name'] == 'france' _, status = api_delete('/v0/autocomplete_parameters/france', check=False, no_json=True) assert status == 204 _, status = api_get('/v0/autoco...
identifier_body
autocomplete_test.py
# coding: utf-8 # Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to...
resp = api_get('/v0/autocomplete_parameters/europe/poi_types') assert not resp # check GET of newly defined france conf resp = api_get('/v0/autocomplete_parameters/france/poi_types') test_minimal_conf(resp) # check DELETE of france conf resp, code = api_delete('/v0/autocomplete_parameters/...
# check that the conf on europe is still empty
random_line_split
autocomplete_test.py
# coding: utf-8 # Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public transport: # a non ending quest to...
(create_two_autocomplete_parameters, autocomplete_parameter_json): resp = api_get('/v0/autocomplete_parameters/france') assert resp['name'] == 'france' assert resp['street'] == 'OSM' assert resp['address'] == 'OSM' assert resp['poi'] == 'FUSIO' assert resp['admin'] == 'OSM' assert resp['admi...
test_put_autocomplete
identifier_name
CommentRenderer.js
pinion.backend.renderer.CommentRenderer = (function($) { var constr; // public API -- constructor constr = function(settings, backend) { var _this = this, data = settings.data; this.$element = $("<div class='pinion-backend-renderer-CommentRenderer'></d...
constructor: pinion.backend.renderer.CommentRenderer, init: function() { this.info.id = this.settings.data.id; }, reset: function() { this.$element.removeClass("pinion-activated"); } } return constr; }(jQuery));
random_line_split
CommentRenderer.js
pinion.backend.renderer.CommentRenderer = (function($) { var constr; // public API -- constructor constr = function(settings, backend) { var _this = this, data = settings.data; this.$element = $("<div class='pinion-backend-renderer-CommentRenderer'>...
else { _this.setDirty(); } _this.$element.toggleClass("pinion-activated") }); // RENDERER BAR var bar = []; if(pinion.hasPermission("comment", "approve comment")) { bar.push($activate); } ...
{ _this.setClean(); }
conditional_block
HotController.js
import webpack from "webpack" import { spawn } from "child_process" import appRootDir from "app-root-dir" import path from "path" import { createNotification } from "./util" import HotServerManager from "./HotServerManager" import HotClientManager from "./HotClientManager" import ConfigFactory from "../webpack/Confi...
this.startServer() this.timeout = 0 } startServer = () => { if (this.server) { this.server.kill() this.server = null createNotification({ title: "Hot Server", level: "info", message: "Restarting server..." }) } const newServer = spawn("node",...
{ if (this.serverTryTimeout) { clearTimeout(this.serverTryTimeout) } this.serverTryTimeout = setTimeout(this.tryStartServer, this.timeout) this.timeout += 100 return }
conditional_block
HotController.js
import webpack from "webpack" import { spawn } from "child_process" import appRootDir from "app-root-dir" import path from "path" import { createNotification } from "./util" import HotServerManager from "./HotServerManager" import HotClientManager from "./HotClientManager" import ConfigFactory from "../webpack/Confi...
() { // First the hot client server. Then dispose the hot node server. return safeDisposer(this.hotClientManager).then(() => safeDisposer(this.hotServerManager)).catch((error) => { console.error(error) }) } }
dispose
identifier_name
HotController.js
import webpack from "webpack" import { spawn } from "child_process" import appRootDir from "app-root-dir" import path from "path" import { createNotification } from "./util" import HotServerManager from "./HotServerManager" import HotClientManager from "./HotClientManager" import ConfigFactory from "../webpack/Confi...
this.server = newServer } dispose() { // First the hot client server. Then dispose the hot node server. return safeDisposer(this.hotClientManager).then(() => safeDisposer(this.hotServerManager)).catch((error) => { console.error(error) }) } }
})
random_line_split
HotController.js
import webpack from "webpack" import { spawn } from "child_process" import appRootDir from "app-root-dir" import path from "path" import { createNotification } from "./util" import HotServerManager from "./HotServerManager" import HotClientManager from "./HotClientManager" import ConfigFactory from "../webpack/Confi...
export default class HotController { constructor() { this.hotClientManager = null this.hotServerManager = null this.clientIsBuilding = false this.serverIsBuilding = false this.timeout = 0 const createClientManager = () => { return new Promise((resolve) => { const...
{ try { const webpackConfig = ConfigFactory({ target: name === "server" ? "node" : "web", mode: "development" }) // Offering a special status handling until Webpack offers a proper `done()` callback // See also: https://github.com/webpack/webpack/issues/4243 webpackConfig.plugins.push...
identifier_body
displayfield.ts
import {Component,ViewChild,ElementRef,ComponentFactoryResolver,ViewContainerRef,forwardRef,ContentChildren,QueryList} from '@angular/core'; import { base } from './base'; // Ext Class - Ext.form.field.Display export class displayfieldMetaData { public static XTYPE: string = 'displayfield'; public static INPUTNAMES: ...
extends base { constructor(eRef:ElementRef,resolver:ComponentFactoryResolver,vcRef:ViewContainerRef) { super(eRef,resolver,vcRef,displayfieldMetaData); } //@ContentChildren(base,{read:ViewContainerRef}) extbaseRef:QueryList<ViewContainerRef>; @ContentChildren(base,{read: base}) extbaseRef: QueryList<base>; @Vie...
displayfield
identifier_name
displayfield.ts
import {Component,ViewChild,ElementRef,ComponentFactoryResolver,ViewContainerRef,forwardRef,ContentChildren,QueryList} from '@angular/core'; import { base } from './base'; // Ext Class - Ext.form.field.Display export class displayfieldMetaData { public static XTYPE: string = 'displayfield'; public static INPUTNAMES: ...
//@ContentChildren(base,{read:ViewContainerRef}) extbaseRef:QueryList<ViewContainerRef>; @ContentChildren(base,{read: base}) extbaseRef: QueryList<base>; @ViewChild('dynamic',{read:ViewContainerRef}) dynamicRef:ViewContainerRef; ngAfterContentInit() {this.AfterContentInit(this.extbaseRef);} ngOnInit() {this.OnIni...
{ super(eRef,resolver,vcRef,displayfieldMetaData); }
identifier_body
displayfield.ts
import {Component,ViewChild,ElementRef,ComponentFactoryResolver,ViewContainerRef,forwardRef,ContentChildren,QueryList} from '@angular/core'; import { base } from './base'; // Ext Class - Ext.form.field.Display export class displayfieldMetaData { public static XTYPE: string = 'displayfield'; public static INPUTNAMES: ...
{name:'deactivate',parameters:'displayfield'}, {name:'destroy',parameters:'displayfield'}, {name:'dirtychange',parameters:'displayfield,isDirty'}, {name:'disable',parameters:'displayfield'}, {name:'enable',parameters:'displayfield'}, {name:'errorchange',parameters:'displayfield,error'}, {name:'focus',para...
{name:'change',parameters:'displayfield,newValue,oldValue'},
random_line_split
index.js
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.definePrope...
_createClass(MarkovChain, [{ key: 'start', value: function start(sentence, callback) { this.parse(sentence, callback); } }, { key: 'parse', value: function parse(sentence, callback) { var _this = this; mecab.parse(this.text, function (err, result) { _this.dictionary ...
{ _classCallCheck(this, MarkovChain); this.text = text; this.result = null; this.dictionary = {}; this.output = 'output'; }
identifier_body
index.js
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.definePrope...
value: function objKeys(obj) { var r = []; for (var i in obj) { r.push(i); } return r; } }, { key: 'choiceWord', value: function choiceWord(obj) { var ks = this.objKeys(obj); var i = this.rnd(ks.length); return ks[i]; } }, { key: 'rnd', ...
return this.output; } } }, { key: 'objKeys',
random_line_split
index.js
'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.definePrope...
(text) { _classCallCheck(this, MarkovChain); this.text = text; this.result = null; this.dictionary = {}; this.output = 'output'; } _createClass(MarkovChain, [{ key: 'start', value: function start(sentence, callback) { this.parse(sentence, callback); } }, { key: 'parse',...
MarkovChain
identifier_name
extradhcpopt_db.py
# Copyright (c) 2013 OpenStack Foundation. # 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...
port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id', ondelete="CASCADE"), nullable=False) opt_name = sa.Column(sa.String(64), nullable=False) opt_value = sa.Column(sa.String(255), nullable=False) ip_version = sa.Column(sa.Integer, server_default='4...
random_line_split
extradhcpopt_db.py
# Copyright (c) 2013 OpenStack Foundation. # 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...
def _get_port_extra_dhcp_opts_binding(self, context, port_id): query = self._model_query(context, ExtraDhcpOpt) binding = query.filter(ExtraDhcpOpt.port_id == port_id) return [{'opt_name': r.opt_name, 'opt_value': r.opt_value, 'ip_version': r.ip_version} fo...
port[edo_ext.EXTRADHCPOPTS] = self._get_port_extra_dhcp_opts_binding( context, port['id'])
identifier_body
extradhcpopt_db.py
# Copyright (c) 2013 OpenStack Foundation. # 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...
else: if self._is_valid_opt_value( upd_rec['opt_name'], upd_rec['opt_value']): ip_version = upd_rec.get('ip_version', 4) db = ExtraDhcpOpt( ...
if upd_rec['opt_value'] is None: context.session.delete(opt) else: if (self._is_valid_opt_value( opt['opt_name'], upd_rec['opt_value']) and ...
conditional_block
extradhcpopt_db.py
# Copyright (c) 2013 OpenStack Foundation. # 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...
(self, opt_name, opt_value): # If the dhcp opt is blank-able, it shouldn't be saved to the DB in # case that the value is None if opt_name in edo_ext.VALID_BLANK_EXTRA_DHCP_OPTS: return opt_value is not None # Otherwise, it shouldn't be saved to the DB in case that the valu...
_is_valid_opt_value
identifier_name
index.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {connect} from 'react-redux'; import {Link} from 'react-router'; import {DoLogin} from '../actions'; interface LoginPanelProps { doLogin: (username: string, password: string) => void; } export class LoginPanel extends React.Component<L...
<div> <label>Password</label> <input type="password" ref="password" /> </div> <div> <button type="submit" onClick={this.handleLogin.bind(this)}>Submit</button> </div> <div> ...
random_line_split
index.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import {connect} from 'react-redux'; import {Link} from 'react-router'; import {DoLogin} from '../actions'; interface LoginPanelProps { doLogin: (username: string, password: string) => void; } export class LoginPanel extends React.Component<L...
(): HTMLInputElement { return ReactDOM.findDOMNode<HTMLInputElement>(this.refs.username); } public passwordInput(): HTMLInputElement { return ReactDOM.findDOMNode<HTMLInputElement>(this.refs.password); } public handleLogin(e: Event) { e.preventDefault(); const username:...
usernameInput
identifier_name
frenchmap.py
# -*- coding: utf-8 -*- # This file is part of pygal # # A python svg graph plotting library # Copyright © 2012-2014 Kozea # # This library is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version...
'72': u("Aquitaine"), '73': u("Midi-Pyrénées"), '74': u("Limousin"), '82': u("Rhône-Alpes"), '83': u("Auvergne"), '91': u("Languedoc-Roussillon"), '93': u("Provence-Alpes-Côte d'Azur"), '94': u("Corse"), '01': u("Guadeloupe"), '02': u("Martinique"), '03': u("Guyane"), '04...
'54': u("Poitou-Charentes"),
random_line_split
frenchmap.py
# -*- coding: utf-8 -*- # This file is part of pygal # # A python svg graph plotting library # Copyright © 2012-2014 Kozea # # This library is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version...
FrenchMapRegions Departments = FrenchMapDepartments DEPARTMENTS_REGIONS = { "01": "82", "02": "22", "03": "83", "04": "93", "05": "93", "06": "93", "07": "82", "08": "21", "09": "73", "10": "21", "11": "91", "12": "73", "13": "93", "14": "25", "15": "83"...
egions =
identifier_name
frenchmap.py
# -*- coding: utf-8 -*- # This file is part of pygal # # A python svg graph plotting library # Copyright © 2012-2014 Kozea # # This library is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version...
values = values.items() regions = defaultdict(int) for department, value in values: regions[DEPARTMENTS_REGIONS[department]] += value return list(regions.items())
identifier_body
frenchmap.py
# -*- coding: utf-8 -*- # This file is part of pygal # # A python svg graph plotting library # Copyright © 2012-2014 Kozea # # This library is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version...
nd(map) class FrenchMapRegions(FrenchMapDepartments): """French regions map""" x_labels = list(REGIONS.keys()) area_names = REGIONS area_prefix = 'a' svg_map = REG_MAP kind = 'region' class FrenchMap(ChartCollection): Regions = FrenchMapRegions Departments = FrenchMapDepartments DE...
(' ') cls.append('color-%d' % i) area.set('class', ' '.join(cls)) area.set('style', 'fill-opacity: %f' % (ratio)) metadata = serie.metadata.get(j) if metadata: node = decorate(self.svg, area, met...
conditional_block
opt_name.rs
//! Test optional prefix. extern crate flame; extern crate flamer; use flamer::{flame, noflame}; #[flame("top")] fn a() { let l = Lower {}; l.a(); } #[flame] fn b()
#[noflame] fn c() { b() } pub struct Lower; impl Lower { #[flame("lower")] pub fn a(self) { // nothing to do here } } #[test] fn main() { c(); let spans = flame::spans(); assert_eq!(1, spans.len()); let roots = &spans[0]; println!("{:?}",roots); // if more than 2 roo...
{ a() }
identifier_body
opt_name.rs
//! Test optional prefix. extern crate flame;
fn a() { let l = Lower {}; l.a(); } #[flame] fn b() { a() } #[noflame] fn c() { b() } pub struct Lower; impl Lower { #[flame("lower")] pub fn a(self) { // nothing to do here } } #[test] fn main() { c(); let spans = flame::spans(); assert_eq!(1, spans.len()); let ...
extern crate flamer; use flamer::{flame, noflame}; #[flame("top")]
random_line_split
opt_name.rs
//! Test optional prefix. extern crate flame; extern crate flamer; use flamer::{flame, noflame}; #[flame("top")] fn a() { let l = Lower {}; l.a(); } #[flame] fn b() { a() } #[noflame] fn
() { b() } pub struct Lower; impl Lower { #[flame("lower")] pub fn a(self) { // nothing to do here } } #[test] fn main() { c(); let spans = flame::spans(); assert_eq!(1, spans.len()); let roots = &spans[0]; println!("{:?}",roots); // if more than 2 roots, a() was flame...
c
identifier_name
sort7.js
// Check sorting of array sub field SERVER-480. t = db.jstests_sort7; t.drop(); // Compare indexed and unindexed sort order for an array embedded field. t.save({a: [{x: 2}]}); t.save({a: [{x: 1}]}); t.save({a: [{x: 3}]});
// Now check when there are two objects in the array. t.remove({}); t.save({a: [{x: 2}, {x: 3}]}); t.save({a: [{x: 1}, {x: 4}]}); t.save({a: [{x: 3}, {x: 2}]}); unindexed = t.find().sort({"a.x": 1}).toArray(); t.ensureIndex({"a.x": 1}); indexed = t.find().sort({"a.x": 1}).hint({"a.x": 1}).toArray(); assert.eq(unindexe...
unindexed = t.find().sort({"a.x": 1}).toArray(); t.ensureIndex({"a.x": 1}); indexed = t.find().sort({"a.x": 1}).hint({"a.x": 1}).toArray(); assert.eq(unindexed, indexed);
random_line_split
builtin.rs
use env::UserEnv; use getopts::Options; use std::collections::HashMap; use std::env; use std::io; use std::io::prelude::*; use std::path::{Component, Path, PathBuf}; use job; const SUCCESS: io::Result<i32> = Ok(0); pub trait Builtin { fn run(&mut self, args: &[String], env: &mut UserEnv) -> io::Result<i32>; ...
(&self) -> TestList<Self> { vec![ test!("cd, no args", cd_with_no_args), test!("cd, absolute arg", cd_with_absolute_arg), test!("cd, relative arg", cd_with_relative_arg), test!("cd, previous dir", cd_previous_directory), ] }...
tests
identifier_name
builtin.rs
use env::UserEnv; use getopts::Options; use std::collections::HashMap; use std::env; use std::io; use std::io::prelude::*; use std::path::{Component, Path, PathBuf}; use job; const SUCCESS: io::Result<i32> = Ok(0); pub trait Builtin { fn run(&mut self, args: &[String], env: &mut UserEnv) -> io::Result<i32>; ...
Component::CurDir => continue, _ => normalized_path.push(c.as_os_str()), }; } normalized_path } impl Builtin for Cd { fn run(&mut self, args: &[String], env: &mut UserEnv) -> io::Result<i32> { if args.len() == 0 { let home = env.get("HOME"); ...
{ normalized_path.pop(); }
conditional_block
builtin.rs
use env::UserEnv; use getopts::Options; use std::collections::HashMap; use std::env; use std::io; use std::io::prelude::*; use std::path::{Component, Path, PathBuf}; use job; const SUCCESS: io::Result<i32> = Ok(0); pub trait Builtin { fn run(&mut self, args: &[String], env: &mut UserEnv) -> io::Result<i32>; ...
} fn pwd(_args: &[String], env: &mut UserEnv) -> io::Result<i32> { println!("{}", env.get("PWD")); SUCCESS } fn echo(args: &[String], _env: &mut UserEnv) -> io::Result<i32> { let mut opts = Options::new(); opts.optflag("n", "", "Suppress new lines"); let matches = match opts.parse(args) { ...
{ Box::new(self.clone()) }
identifier_body
builtin.rs
use env::UserEnv; use getopts::Options; use std::collections::HashMap; use std::env; use std::io; use std::io::prelude::*; use std::path::{Component, Path, PathBuf}; use job; const SUCCESS: io::Result<i32> = Ok(0); pub trait Builtin { fn run(&mut self, args: &[String], env: &mut UserEnv) -> io::Result<i32>; ...
let fixture = BuiltinTests::new(); test_fixture_runner(fixture); } }
#[test] fn builtin_tests() {
random_line_split
matlab-to-python.py
# Autogenerated with SMOP version 0.23 # main.py ../../assessing-mininet/MATLAB/load_function.m ../../assessing-mininet/MATLAB/process_complete_test_set.m ../../assessing-mininet/MATLAB/process_single_testfile.m ../../assessing-mininet/MATLAB/ProcessAllLogsMain.m from __future__ import division from numpy import arang...
def load_octave_decoded_file_as_matrix(file_name): with open(file_name, 'r') as f: return [ map(float,line.strip().split(' ')) for line in f ] def get_test_bitrate(crosstraffic): if crosstraffic: return arange(4,6,0.25) else: return arange(8,12,0.5) def process_complete_test_set(f...
return ''.join(args)
identifier_body
matlab-to-python.py
# Autogenerated with SMOP version 0.23 # main.py ../../assessing-mininet/MATLAB/load_function.m ../../assessing-mininet/MATLAB/process_complete_test_set.m ../../assessing-mininet/MATLAB/process_single_testfile.m ../../assessing-mininet/MATLAB/ProcessAllLogsMain.m from __future__ import division from numpy import arang...
mean_bitrate[ii]=mean(parsed_data) std_dev_bitrate[ii]=std(parsed_data) mean_delay[ii]=mean(parsed_data[:,2]) std_dev_delay[ii]=std(parsed_data[:,2]) mean_jitter[ii]=mean(parsed_data[:,3]) std_dev_jitter[ii]=std(parsed_data[:,3]) mean_packetloss[ii]=mean(parsed_da...
current_picture_file_name=strcat(f,'.jpg') matrix_to_process=load_octave_decoded_file_as_matrix(f) parsed_data=process_single_testfile(matrix_to_process,current_picture_file_name,output_format)
random_line_split