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
expired-medicines.module.ts
import { NgModule } from '@angular/core'; import { ExpiredMedicinesComponent } from './expired-medicines.component'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AlertModule, ButtonsModule...
{ }
ExpiredMedicinesModule
identifier_name
expired-medicines.module.ts
import { NgModule } from '@angular/core'; import { ExpiredMedicinesComponent } from './expired-medicines.component'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AlertModule, ButtonsModule...
export class ExpiredMedicinesModule { }
random_line_split
Header.tsx
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
render() { const { onSearchClick, onAuthorSearchClick, hideSearchIcon, children, } = this.props; const { isFocused, isUserFocused } = this.state; return ( <header role="banner"> <div {...css(STYLES.bar)}> <div {...css(STYLES.childrenContainer)}> ...
{ this.setState({ isUserFocused: false }); }
identifier_body
Header.tsx
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
() { this.setState({ isFocused: true }); } @autobind onBlur() { this.setState({ isFocused: false }); } @autobind onUserFocus() { this.setState({ isUserFocused: true }); } @autobind onUserBlur() { this.setState({ isUserFocused: false }); } render() { const { onSearchCl...
onFocus
identifier_name
Header.tsx
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
render() { const { onSearchClick, onAuthorSearchClick, hideSearchIcon, children, } = this.props; const { isFocused, isUserFocused } = this.state; return ( <header role="banner"> <div {...css(STYLES.bar)}> <div {...css(STYLES.childrenContainer)}> ...
onUserBlur() { this.setState({ isUserFocused: false }); }
random_line_split
cssnamespacerule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding; use dom::bindings::codegen::Bindings::CSSNamespaceR...
namespacerule: Arc<Locked<NamespaceRule>>) -> DomRoot<CSSNamespaceRule> { reflect_dom_object(box CSSNamespaceRule::new_inherited(parent_stylesheet, namespacerule), window, CSSNamespaceRuleBinding::Wrap) } } impl CSSNamespaceRuleMethods fo...
#[allow(unrooted_must_root)] pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet,
random_line_split
cssnamespacerule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding; use dom::bindings::codegen::Bindings::CSSNamespaceR...
(&self) -> DOMString { let guard = self.cssrule.shared_lock().read(); self.namespacerule.read_with(&guard).to_css_string(&guard).into() } }
get_css
identifier_name
cssnamespacerule.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::CSSNamespaceRuleBinding; use dom::bindings::codegen::Bindings::CSSNamespaceR...
}
{ let guard = self.cssrule.shared_lock().read(); self.namespacerule.read_with(&guard).to_css_string(&guard).into() }
identifier_body
base.py
# -*- coding: utf-8 -*- # # This file is part of the jabber.at homepage (https://github.com/jabber-at/hp). # # This project 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...
else: with self.assertRaises(NoSuchElementException): self.find(selector) def assertDisplayed(self, elem): if isinstance(elem, str): elem = self.find(elem) self.assertTrue(elem.is_displayed()) def assertNotDisplayed(self, elem): if isins...
with self.assertRaises(TimeoutException): WebDriverWait(self.selenium, wait).until(lambda d: self.find(selector))
conditional_block
base.py
# -*- coding: utf-8 -*- # # This file is part of the jabber.at homepage (https://github.com/jabber-at/hp). # # This project 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...
def assertDisplayed(self, elem): if isinstance(elem, str): elem = self.find(elem) self.assertTrue(elem.is_displayed()) def assertNotDisplayed(self, elem): if isinstance(elem, str): elem = self.find(elem) self.assertFalse(elem.is_displayed()) def as...
"""Assert that no element with the passed selector is present on the page.""" if wait: with self.assertRaises(TimeoutException): WebDriverWait(self.selenium, wait).until(lambda d: self.find(selector)) else: with self.assertRaises(NoSuchElementException): ...
identifier_body
base.py
# -*- coding: utf-8 -*- # # This file is part of the jabber.at homepage (https://github.com/jabber-at/hp). # # This project 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...
# when an element gets focus, it turns blue: wait = WebDriverWait(self.selenium, 10) wait.until(self.wait_for_css_property(elem, 'border-top-color', 'rgb(128, 189, 255)')) def wait_for_invalid(self, elem): wait = WebDriverWait(self.selenium, 10) wait.until(self.wait_for_css_...
WebDriverWait(self.selenium, wait).until( lambda driver: self.selenium.execute_script('return arguments[0].checkValidity() === true', form)) def wait_for_focus(self, elem):
random_line_split
base.py
# -*- coding: utf-8 -*- # # This file is part of the jabber.at homepage (https://github.com/jabber-at/hp). # # This project 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...
(cls): cls.selenium.quit() if VIRTUAL_DISPLAY: cls.vdisplay.stop() super().tearDownClass() class wait_for_css_property(object): def __init__(self, elem, prop, value): self.elem = elem self.prop = prop self.value = value def __...
tearDownClass
identifier_name
browser.py
# -*- coding: utf-8 -*- # Copyright 2012 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from splinter.driver.webdriver.firefox import WebDriver as FirefoxWebDriver from splinter.driver.webdriver.remote import WebDriver as Re...
""" Returns a driver instance for the given name. When working with ``firefox``, it's possible to provide a profile name and a list of extensions. If you don't provide any driver_name, then ``firefox`` will be used. If there is no driver registered with the provided ``driver_name``, this func...
identifier_body
browser.py
# -*- coding: utf-8 -*- # Copyright 2012 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from splinter.driver.webdriver.firefox import WebDriver as FirefoxWebDriver from splinter.driver.webdriver.remote import WebDriver as Re...
def Browser(driver_name='firefox', *args, **kwargs): """ Returns a driver instance for the given name. When working with ``firefox``, it's possible to provide a profile name and a list of extensions. If you don't provide any driver_name, then ``firefox`` will be used. If there is no driver ...
import django # noqa from splinter.driver.djangoclient import DjangoClient _DRIVERS['django'] = DjangoClient except ImportError: pass
random_line_split
browser.py
# -*- coding: utf-8 -*- # Copyright 2012 splinter authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from splinter.driver.webdriver.firefox import WebDriver as FirefoxWebDriver from splinter.driver.webdriver.remote import WebDriver as Re...
(driver_name='firefox', *args, **kwargs): """ Returns a driver instance for the given name. When working with ``firefox``, it's possible to provide a profile name and a list of extensions. If you don't provide any driver_name, then ``firefox`` will be used. If there is no driver registered wi...
Browser
identifier_name
quality_control3.py
#!/usr/bin/python -tt # Updated version of clipping adapters from sequences # Used cutadapt on combined sequences and removes first 13 bases with fastx_clipper # Website: https://code.google.com/p/cutadapt/ # Updated on: 09/26/2013
# Directories for input and output input_dir = "/home/chris/transcriptome/fastq/qc/fastx/" output_dir = "/home/chris/transcriptome/fastq/qc/fastx/" fastq_orig = sorted(glob.glob1(input_dir, "*.fastq")) orig = len(list(fastq_orig)) print "Input Directory: %s" % (input_dir) print "Output Directory: %s" % (output_dir) ...
# Import OS features to run external programs import os import glob
random_line_split
quality_control3.py
#!/usr/bin/python -tt # Updated version of clipping adapters from sequences # Used cutadapt on combined sequences and removes first 13 bases with fastx_clipper # Website: https://code.google.com/p/cutadapt/ # Updated on: 09/26/2013 # Import OS features to run external programs import os import glob # Directories for ...
print "Analyzing %s..." % (fastq_orig[files]) fastqfile_in = input_dir + fastq_orig[files] sample_name = os.path.splitext(os.path.basename(fastq_orig[files]))[0] # Remove adapters from sequences and keep score above 30, with a min length of 51 # Any other sequences will be discarded. This may be modified in future...
conditional_block
lazyproxy.py
class LazyProxy(object): def __init__(self, original_module, original_class, init_args): self._original_module = original_module self._original_class = original_class self._original_init_args = init_args self._instance = None def __getattr__(self, name): if self._instanc...
return getattr(self._instance, name) def __init_class__(self): import importlib module = importlib.import_module(self._original_module) class_ = getattr(module, self._original_class) if self._original_init_args is not None: for index, arg in enumerate(self._or...
self.__init_class__()
conditional_block
lazyproxy.py
class LazyProxy(object): def __init__(self, original_module, original_class, init_args):
def __getattr__(self, name): if self._instance is None: self.__init_class__() return getattr(self._instance, name) def __init_class__(self): import importlib module = importlib.import_module(self._original_module) class_ = getattr(module, self._original_cl...
self._original_module = original_module self._original_class = original_class self._original_init_args = init_args self._instance = None
identifier_body
lazyproxy.py
class LazyProxy(object): def __init__(self, original_module, original_class, init_args): self._original_module = original_module self._original_class = original_class self._original_init_args = init_args self._instance = None def
(self, name): if self._instance is None: self.__init_class__() return getattr(self._instance, name) def __init_class__(self): import importlib module = importlib.import_module(self._original_module) class_ = getattr(module, self._original_class) if self...
__getattr__
identifier_name
lazyproxy.py
class LazyProxy(object): def __init__(self, original_module, original_class, init_args): self._original_module = original_module self._original_class = original_class self._original_init_args = init_args self._instance = None def __getattr__(self, name): if self._instanc...
import inspect args = inspect.getargspec(class_.__init__)[0] if args[0] == 'self': args.pop(0) argument_dict = dict(zip(args, self._original_init_args)) self._instance = class_(**argument_dict) else: self._instance = class_...
for index, arg in enumerate(self._original_init_args): if arg[:1] == '@': from resources.lib.di.requiredfeature import RequiredFeature self._original_init_args[index] = RequiredFeature(arg[1:]).request()
random_line_split
angelloModelSpec.js
describe('Service: angelloModel', function() { //load module for service beforeEach(module('Angello')); var modelService; beforeEach(inject(function(angelloModel) { modelService = angelloModel; })); describe('#getStatuses', function() { it('should return seven different statuses', function() { expect(m...
toContain('Bug'); }); }); describe('#getStories', function() { it('should return six different stories', function() { expect(modelService.getStories().length).toBe(6); }); it('should return stories that have a description property', function() { modelService.getStories().forEach(functi...
random_line_split
rm.py
# # Copyright 2013, 2018-2020 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Remove blocks module """ import os import re import sys import glob import logging from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_bl...
else: filebase = os.path.splitext(filename)[0] ed.delete_entry('add_executable', filebase) ed.delete_entry('target_link_libraries', filebase) ed.delete_entry('GR_ADD_TEST', filebase) ed.remove_double_newlines() ...
(base, ext) = os.path.splitext(filename) if ext == '.cc': ed.remove_value( 'list', filename, to_ignore_start=f'APPEND test_{modname_}_sources') self.scm.mark_file_updated(ed.filename)
conditional_block
rm.py
# # Copyright 2013, 2018-2020 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Remove blocks module """ import os import re import sys import glob import logging from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_bl...
(self): """ Go, go, go! """ # This portion will be covered by the CLI if not self.cli: self.validate() else: from ..cli import cli_input def _remove_cc_test_case(filename=None, ed=None): """ Special function that removes the occurrences of a q...
run
identifier_name
rm.py
# # Copyright 2013, 2018-2020 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Remove blocks module """ import os import re import sys import glob import logging from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_bl...
def run(self): """ Go, go, go! """ # This portion will be covered by the CLI if not self.cli: self.validate() else: from ..cli import cli_input def _remove_cc_test_case(filename=None, ed=None): """ Special function that removes the occur...
""" Validates the arguments """ ModTool._validate(self) if not self.info['pattern'] or self.info['pattern'].isspace(): raise ModToolException("Incorrect blockname (Regex)!")
identifier_body
rm.py
# # Copyright 2013, 2018-2020 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Remove blocks module """ import os import re import sys
logger = logging.getLogger(__name__) class ModToolRemove(ModTool): """ Remove block (delete files and remove Makefile entries) """ name = 'remove' description = 'Remove a block from a module.' def __init__(self, blockname=None, **kwargs): ModTool.__init__(self, blockname, **kwargs) s...
import glob import logging from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_block_names from .base import ModTool, ModToolException
random_line_split
mod.rs
//! Text layout logic. //! //! Currently, this crate is used primarily by the `draw.text()` API but will also play an //! important role in future GUI work. pub mod cursor; pub mod font; pub mod glyph; pub mod layout; pub mod line; pub mod rt { //! Re-exported RustType geometric types. pub use rusttype::{gpu_c...
} /// Align the top edge of the text with the top edge of its bounding rectangle. pub fn align_top(self) -> Self { self.map_layout(|l| l.align_top()) } /// Align the middle of the text with the middle of the bounding rect along the y axis.. /// /// This is the default behaviour. ...
/// Specify how the whole text should be aligned along the y axis of its bounding rectangle pub fn y_align(self, align: Align) -> Self { self.map_layout(|l| l.y_align(align))
random_line_split
mod.rs
//! Text layout logic. //! //! Currently, this crate is used primarily by the `draw.text()` API but will also play an //! important role in future GUI work. pub mod cursor; pub mod font; pub mod glyph; pub mod layout; pub mod line; pub mod rt { //! Re-exported RustType geometric types. pub use rusttype::{gpu_c...
<'a> { text: Cow<'a, str>, layout_builder: layout::Builder, } /// An instance of some multi-line text and its layout. #[derive(Clone)] pub struct Text<'a> { text: Cow<'a, str>, font: Font, layout: Layout, line_infos: Vec<line::Info>, rect: geom::Rect, } /// An iterator yielding each line w...
Builder
identifier_name
mod.rs
//! Text layout logic. //! //! Currently, this crate is used primarily by the `draw.text()` API but will also play an //! important role in future GUI work. pub mod cursor; pub mod font; pub mod glyph; pub mod layout; pub mod line; pub mod rt { //! Re-exported RustType geometric types. pub use rusttype::{gpu_c...
} impl<'a> Text<'a> { /// Produce an iterator yielding information about each line. pub fn line_infos(&self) -> &[line::Info] { &self.line_infos } /// The full string of text as a slice. pub fn text(&self) -> &str { &self.text } /// The layout parameters for this text ins...
{ let text = self.text; let layout = self.layout_builder.build(); #[allow(unreachable_code)] let font = layout.font.clone().unwrap_or_else(|| { #[cfg(feature = "notosans")] { return font::default_notosans(); } let assets = c...
identifier_body
types.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation ...
@property def album_types(self): return self._types() def _types(self): if not self.config.exists(): return {} mytypes = {} for key, value in self.config.items(): if value.get() == 'int': mytypes[key] = types.INTEGER eli...
return self._types()
identifier_body
types.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation ...
(self): return self._types() def _types(self): if not self.config.exists(): return {} mytypes = {} for key, value in self.config.items(): if value.get() == 'int': mytypes[key] = types.INTEGER elif value.get() == 'float': ...
album_types
identifier_name
types.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation ...
else: raise ConfigValueError( u"unknown type '{0}' for the '{1}' field" .format(value, key)) return mytypes
mytypes[key] = library.DateType()
conditional_block
types.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2015, Thomas Scholtes. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the
# the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. from __future__ import (division, absolute_import, print_function, unicode_literals) from beets.plugins import BeetsPlugin from beets...
# "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to
random_line_split
dht22_pt.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
pin = &pin; timer = &timer; }", |cx, failed, pt| { let mut builder = Builder::new(pt.clone()); pt.get_by_name("timer").unwrap().set_type_name("T".to_string()); pt.get_by_name("pin").unwrap().set_type_name("P".to_string()); super::mutate_pin(&mut builder, cx, pt.get_by_name(...
dht@dht22 {
random_line_split
dht22_pt.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
#[cfg(test)] mod test { use std::ops::Deref; use builder::Builder; use test_helpers::{assert_equal_source, with_parsed}; use hamcrest::{assert_that, is, equal_to}; #[test] fn builds_lpc17xx_pt() { with_parsed(" timer@timer; pin@pin; dht@dht22 { pin = &pin; timer = &t...
{ if !node.expect_no_subnodes(cx) {return} if !node.expect_attributes(cx, &[("pin", node::RefAttribute), ("timer", node::RefAttribute)]) { return } let pin_node_name = node.get_ref_attr("pin").unwrap(); let timer_node_name = node.get_ref_attr("timer").unwrap(); let pin = TokenString(pin_node_na...
identifier_body
dht22_pt.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
if !node.expect_attributes(cx, &[("pin", node::RefAttribute), ("timer", node::RefAttribute)]) { return } let pin_node_name = node.get_ref_attr("pin").unwrap(); let timer_node_name = node.get_ref_attr("timer").unwrap(); let pin = TokenString(pin_node_name); let timer = TokenString(timer_node_na...
{return}
conditional_block
dht22_pt.rs
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com> // // 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.o...
(builder: &mut Builder, cx: &mut ExtCtxt, node: Rc<node::Node>) { if !node.expect_no_subnodes(cx) {return} if !node.expect_attributes(cx, &[("pin", node::RefAttribute), ("timer", node::RefAttribute)]) { return } let pin_node_name = node.get_ref_attr("pin").unwrap(); let timer_node_name = node.get_...
build_dht22
identifier_name
CommandSaveImage.js
/** * Command to save an image in an active window. */ qx.Class.define("skel.Command.Save.CommandSaveImage", { extend : skel.Command.Command, type : "singleton", /** * Constructor. */ construct : function() { this.base( arguments, "Save...", null ); this.setEnabled( false )...
/** * Returns whether or not the user is allowed to save images. * @return {boolean} - true if images can be saved; false otherwise. */ isSaveAvailable : function(){ return this.m_saveAvailable; }, /** * Reset whether save...
},
random_line_split
CommandSaveImage.js
/** * Command to save an image in an active window. */ qx.Class.define("skel.Command.Save.CommandSaveImage", { extend : skel.Command.Command, type : "singleton", /** * Constructor. */ construct : function() { this.base( arguments, "Save...", null ); this.setEnabled( false )...
} } }, /** * Returns whether or not save is supported based on both the application security * and the window that is selected. * @return {boolean} - true is save is supported; false otherwise. */ _isCmdSupported : functio...
{ qx.event.message.Bus.dispatch(new qx.event.message.Message( "showFileSaver", activeWins[i])); break; }
conditional_block
forms.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
try: api.snapshot_create(request, data['instance_id'], data['name']) # NOTE(gabriel): This API call is only to display a pretty name. instance = api.server_get(request, data['instance_id']) vals = {"name": data['name'], "inst": instance.name} messages.success(...
identifier_body
forms.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
LOG = logging.getLogger(__name__) class CreateSnapshot(forms.SelfHandlingForm): tenant_id = forms.CharField(widget=forms.HiddenInput()) instance_id = forms.CharField(label=_("Instance ID"), widget=forms.TextInput( attrs={'readonly': 'r...
random_line_split
forms.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
(forms.SelfHandlingForm): tenant_id = forms.CharField(widget=forms.HiddenInput()) instance_id = forms.CharField(label=_("Instance ID"), widget=forms.TextInput( attrs={'readonly': 'readonly'})) name = forms.CharField(max_length="20", l...
CreateSnapshot
identifier_name
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class
(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Movement', fields=[ ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_...
Migration
identifier_name
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
]
),
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration):
dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Movement', fields=[ ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), ...
identifier_body
test_editor.py
def test_basic_editor(scratch_tree): sess = scratch_tree.edit('/') assert sess.id == '' assert sess.path == '/' assert sess.record is not None
assert sess['body'] == 'Hello World!' sess['body'] = 'A new body' sess.commit() assert sess.closed with open(sess.get_fs_path()) as f: assert f.read().splitlines() == [ '_model: page', '---', 'title: Index', '---', 'body: A new b...
assert sess['_model'] == 'page' assert sess['title'] == 'Index'
random_line_split
test_editor.py
def test_basic_editor(scratch_tree): sess = scratch_tree.edit('/') assert sess.id == '' assert sess.path == '/' assert sess.record is not None assert sess['_model'] == 'page' assert sess['title'] == 'Index' assert sess['body'] == 'Hello World!' sess['body'] = 'A new body' sess.com...
sess = scratch_tree.edit('/', alt='de') assert sess.id == '' assert sess.path == '/' assert sess.record is not None assert sess['_model'] == 'page' assert sess['title'] == 'Index' assert sess['body'] == 'Hello World!' sess['body'] = 'Hallo Welt!' sess.commit() assert sess.closed ...
identifier_body
test_editor.py
def test_basic_editor(scratch_tree): sess = scratch_tree.edit('/') assert sess.id == '' assert sess.path == '/' assert sess.record is not None assert sess['_model'] == 'page' assert sess['title'] == 'Index' assert sess['body'] == 'Hello World!' sess['body'] = 'A new body' sess.com...
(scratch_tree, scratch_pad): sess = scratch_tree.edit('/', alt='de') assert sess.id == '' assert sess.path == '/' assert sess.record is not None assert sess['_model'] == 'page' assert sess['title'] == 'Index' assert sess['body'] == 'Hello World!' sess['body'] = 'Hallo Welt!' sess....
test_create_alt
identifier_name
mousetrap.d.ts
// Type definitions for Mousetrap 1.5.x // Project: http://craig.is/killing/mice // Definitions by: Dániel Tar <https://github.com/qcz> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface ExtendedKeyboardEvent extends KeyboardEvent { returnValue: boolean; // IE returnValue } interface Mou...
stopCallback: (e: ExtendedKeyboardEvent, element: Element, combo: string) => boolean; bind(keys: string|string[], callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; unbind(keys: string|string[], action?: string): void; trigger(keys: string, action?: string): void; re...
interface MousetrapInstance {
random_line_split
messageport.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use crate::dom::bindings::c...
/// <https://html.spec.whatwg.org/multipage/#dom-messageport-close> fn Close(&self) { if self.detached.get() { return; } self.detached.set(true); self.global().close_message_port(self.message_port_id()); } /// <https://html.spec.whatwg.org/multipage/#handle...
{ if self.detached.get() { return; } self.global().start_message_port(self.message_port_id()); }
identifier_body
messageport.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use crate::dom::bindings::c...
(owner: &GlobalScope) -> DomRoot<MessagePort> { let port_id = MessagePortId::new(); reflect_dom_object(Box::new(MessagePort::new_inherited(port_id)), owner, Wrap) } /// Create a new port for an incoming transfer-received one. fn new_transferred( owner: &GlobalScope, transfer...
new
identifier_name
messageport.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use crate::dom::bindings::c...
Ok(()) } } impl MessagePortMethods for MessagePort { /// <https://html.spec.whatwg.org/multipage/#dom-messageport-postmessage> fn PostMessage( &self, cx: SafeJSContext, message: HandleValue, transfer: CustomAutoRooterGuard<Vec<*mut JSObject>>, ) -> ErrorResult ...
{ let mut ports = Vec::with_capacity(ports_len); ports.push(transferred_port); *message_ports = Some(ports); }
conditional_block
messageport.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use crate::dom::bindings::c...
ports.push(transferred_port); } else { let mut ports = Vec::with_capacity(ports_len); ports.push(transferred_port); *message_ports = Some(ports); } Ok(()) } } impl MessagePortMethods for MessagePort { /// <https://html.spec.whatwg.org/mul...
// Store the DOM port where it will be passed along to script in the message-event. if let Some(ports) = message_ports.as_mut() {
random_line_split
text.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% from data import Method %> <% data.new_style_struct("Tex...
"computed::TextOverflow::get_initial_value()", animation_value_type="discrete", boxed=True, flags="APPLIES_TO_PLACEHOLDER", spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow")} $...
${helpers.predefined_type("text-overflow", "TextOverflow",
random_line_split
language.py
# -*- coding: utf-8 -*- # enzyme - Video metadata parser # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # Copyright 2003-2006 Dirk Meyer <dischi@freevo.org> # # This file is part of enzyme. # # enzyme is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public Lice...
return code, u'Unknown (%r)' % code # Parsed from http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt codes = ( ('aar', 'aa', u'Afar'), ('abk', 'ab', u'Abkhazian'), ('ace', u'Achinese'), ('ach', u'Acoli'), ('ada', u'Adangme'), ('ady', u'Adyghe'), ('afa', u'Afro-Asiatic '), ('afh', ...
return code, spec[-1]
conditional_block
language.py
# -*- coding: utf-8 -*- # enzyme - Video metadata parser # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # Copyright 2003-2006 Dirk Meyer <dischi@freevo.org> # # This file is part of enzyme. # # enzyme is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public Lice...
(code): """ Transform the given (2- or 3-letter) language code to a human readable language name. The return value is a 2-tuple containing the given language code and the language name. If the language code cannot be resolved, name will be 'Unknown (<code>)'. """ if not code: retur...
resolve
identifier_name
language.py
# -*- coding: utf-8 -*- # enzyme - Video metadata parser # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # Copyright 2003-2006 Dirk Meyer <dischi@freevo.org> # # This file is part of enzyme. # # enzyme is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public Lice...
# Parsed from http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt codes = ( ('aar', 'aa', u'Afar'), ('abk', 'ab', u'Abkhazian'), ('ace', u'Achinese'), ('ach', u'Acoli'), ('ada', u'Adangme'), ('ady', u'Adyghe'), ('afa', u'Afro-Asiatic '), ('afh', u'Afrihili'), ('afr', 'af', u'Afrikaan...
""" Transform the given (2- or 3-letter) language code to a human readable language name. The return value is a 2-tuple containing the given language code and the language name. If the language code cannot be resolved, name will be 'Unknown (<code>)'. """ if not code: return None, None...
identifier_body
language.py
# -*- coding: utf-8 -*- # enzyme - Video metadata parser # Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com> # Copyright 2003-2006 Dirk Meyer <dischi@freevo.org> # # This file is part of enzyme. # # enzyme is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public Lice...
('chr', u'Cherokee'), ('chu', 'cu', u'Church Slavic'), ('chv', 'cv', u'Chuvash'), ('chy', u'Cheyenne'), ('cmc', u'Chamic languages'), ('cop', u'Coptic'), ('cor', 'kw', u'Cornish'), ('cos', 'co', u'Corsican'), ('cpe', u'Creoles and pidgins, English based '), ('cpf', u'Creoles and pidgins, F...
('chp', u'Chipewyan'),
random_line_split
test_util.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {AotCompilerHost, AotCompilerOptions, GeneratedFile, createAotCompiler, toTypeScript} from '@angular/compiler...
remove(files: string[]) { // Remove the files from the list of scripts. const fileSet = new Set(files); this.scriptNames = this.scriptNames.filter(f => fileSet.has(f)); // Remove files from written files files.forEach(f => this.writtenFiles.delete(f)); } // ts.ModuleResolutionHost fileEx...
{ this.assumeExists.add(fileName); }
identifier_body
test_util.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {AotCompilerHost, AotCompilerOptions, GeneratedFile, createAotCompiler, toTypeScript} from '@angular/compiler...
if (options.compileAngular) { const emittingHost = new EmittingCompilerHost([], {emitMetadata: true}); emittingHost.addScript('@angular/core/index.ts', minCoreIndex); const emittingProgram = ts.createProgram(emittingHost.scripts, settings, emittingHost); emittingProgram.emit(); emittin...
compileAngular: true }) { let angularFiles = new Map<string, string>(); beforeAll(() => {
random_line_split
test_util.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {AotCompilerHost, AotCompilerOptions, GeneratedFile, createAotCompiler, toTypeScript} from '@angular/compiler...
const tsSettings = {...settings, ...tsOptions}; const program = ts.createProgram(host.scriptNames.slice(0), tsSettings, host); preCompile(program); const {compiler, reflector} = createAotCompiler(aotHost, options); const analyzedModules = compiler.analyzeModulesSync(program.getSourceFiles().map(sf => s...
{ aotHost.hideMetadata(); aotHost.tsFilesOnly(); }
conditional_block
test_util.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {AotCompilerHost, AotCompilerOptions, GeneratedFile, createAotCompiler, toTypeScript} from '@angular/compiler...
(fileName: string): string { return fileName; } useCaseSensitiveFileNames(): boolean { return false; } getNewLine(): string { return '\n'; } // Private methods private getFileContent(fileName: string): string|undefined { if (this.overrides.has(fileName)) { return this.overrides.get(fileName); ...
getCanonicalFileName
identifier_name
socialevents.client.routes.js
'use strict'; // Setting up route angular.module('socialevents').config(['$stateProvider', function($stateProvider) { // SocialEvents state routing $stateProvider. state('listSocialEvents', { url: '/socialevents', templateUrl: 'modules/socialevents/views/list-socialevents.client.view.html' }).
templateUrl: 'modules/socialevents/views/create-socialevent.client.view.html' }). state('viewSocialEvent', { url: '/socialevents/:socialeventId', templateUrl: 'modules/socialevents/views/view-socialevent.client.view.html' }). state('editSocialEvent', { url: '/socialevents/:socialeventId/edit', te...
state('createSocialEvent', { url: '/socialevents/create',
random_line_split
round_trip.rs
// Copyright 2017 GFX Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law o...
() { let sponza: Obj = Obj::load("test_assets/sponza.obj").unwrap(); let mut obj = Vec::new(); sponza.data.write_to_buf(&mut obj).unwrap(); let sponza_round_trip = ObjData::load_buf(obj.as_slice()).unwrap(); assert_eq!(sponza_round_trip, sponza.data); } #[test] fn round_trip_sponza_with_mtl() { ...
round_trip_sponza_no_mtls
identifier_name
round_trip.rs
// Copyright 2017 GFX Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law o...
let mut obj = Vec::new(); sponza.data.write_to_buf(&mut obj).unwrap(); let sponza_round_trip = ObjData::load_buf(obj.as_slice()).unwrap(); assert_eq!(sponza_round_trip, sponza.data); } #[test] fn round_trip_sponza_with_mtl() { let mut sponza: Obj = Obj::load("test_assets/sponza.obj").unwrap(); ...
#[test] fn round_trip_sponza_no_mtls() { let sponza: Obj = Obj::load("test_assets/sponza.obj").unwrap();
random_line_split
round_trip.rs
// Copyright 2017 GFX Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law o...
{ let mut sponza: Obj = Obj::load("test_assets/sponza.obj").unwrap(); sponza.load_mtls().unwrap(); // Write obj to string, and then load it from that string to create a round trip Obj instance. let mut obj = Vec::new(); sponza.data.write_to_buf(&mut obj).unwrap(); let mut sponza_round_trip: Obj...
identifier_body
simple_net.py
__author__ = 'Ehsan' from mininet.node import CPULimitedHost from mininet.topo import Topo from mininet.net import Mininet from mininet.log import setLogLevel, info from mininet.node import RemoteController from mininet.cli import CLI """ Instructions to run the topo: 1. Go to directory where this fil is. 2. ru...
s2 = self.addSwitch('s2', dpid="0000000000000002") s3 = self.addSwitch('s3', dpid="0000000000000003") s4 = self.addSwitch('s4', dpid="0000000000000004") # Add links self.addLink(h1, s1) self.addLink(h2, s2) self.addLink(h3, s3) self.addLink(h4, s4) ...
random_line_split
simple_net.py
__author__ = 'Ehsan' from mininet.node import CPULimitedHost from mininet.topo import Topo from mininet.net import Mininet from mininet.log import setLogLevel, info from mininet.node import RemoteController from mininet.cli import CLI """ Instructions to run the topo: 1. Go to directory where this fil is. 2. ru...
def run(): c = RemoteController('c', '192.168.56.1', 6633) net = Mininet(topo=SimplePktSwitch(), host=CPULimitedHost, controller=None) net.addController(c) net.start() CLI(net) net.stop() # if the script is run directly (sudo custom/optical.py): if __name__ == '__main__': setLogLevel('i...
"""Create custom topo.""" # Initialize topology # It uses the constructor for the Topo cloass super(SimplePktSwitch, self).__init__(**opts) # Add hosts and switches h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost...
identifier_body
simple_net.py
__author__ = 'Ehsan' from mininet.node import CPULimitedHost from mininet.topo import Topo from mininet.net import Mininet from mininet.log import setLogLevel, info from mininet.node import RemoteController from mininet.cli import CLI """ Instructions to run the topo: 1. Go to directory where this fil is. 2. ru...
(Topo): """Simple topology example.""" def __init__(self, **opts): """Create custom topo.""" # Initialize topology # It uses the constructor for the Topo cloass super(SimplePktSwitch, self).__init__(**opts) # Add hosts and switches h1 = self.addHost('h1') ...
SimplePktSwitch
identifier_name
simple_net.py
__author__ = 'Ehsan' from mininet.node import CPULimitedHost from mininet.topo import Topo from mininet.net import Mininet from mininet.log import setLogLevel, info from mininet.node import RemoteController from mininet.cli import CLI """ Instructions to run the topo: 1. Go to directory where this fil is. 2. ru...
setLogLevel('info') run()
conditional_block
PersonCreateForm.js
import React, { Component } from 'react'; import { withFormik, Form, Field, FieldArray } from 'formik'; import * as Yup from 'yup'; import { TextField, MaskedTextField, PrimaryButton, DefaultButton } from 'office-ui-fabric-react'; import { PersonCreateFormArray } from './PersonCreateFormArray'; import { PersonCreateFor...
setSubmitting(false); } })(PersonCreateForm); export { formikEnhancer as PersonCreateForm };
insertDocFunc({ firstName, middleName, lastName, nickNames, phoneNumbers, organizations, emailAddresses, employers, socialLinks, relations });
random_line_split
PersonCreateForm.js
import React, { Component } from 'react'; import { withFormik, Form, Field, FieldArray } from 'formik'; import * as Yup from 'yup'; import { TextField, MaskedTextField, PrimaryButton, DefaultButton } from 'office-ui-fabric-react'; import { PersonCreateFormArray } from './PersonCreateFormArray'; import { PersonCreateFor...
, validationSchema: Yup.object().shape({ firstName: Yup.string().required("First name is required.") }), handleSubmit: (values, { props, setSubmitting }) => { const { firstName, middleName, lastName, nickNames, phoneNumbers, organizations, emailAddresses, employers, socialLinks, relations } = values; const { i...
{ return { firstName: firstName || '', middleName: middleName || '', lastName: lastName || '', nickNames: nickNames || [''], phoneNumbers: phoneNumbers || [''], organizations: organizations || [''], emailAddresses: emailAddresses || [''], employers: employers || [''], socialLinks: socialLin...
identifier_body
PersonCreateForm.js
import React, { Component } from 'react'; import { withFormik, Form, Field, FieldArray } from 'formik'; import * as Yup from 'yup'; import { TextField, MaskedTextField, PrimaryButton, DefaultButton } from 'office-ui-fabric-react'; import { PersonCreateFormArray } from './PersonCreateFormArray'; import { PersonCreateFor...
extends Component { render() { const { values, touched, errors, dirty, handleChange, handleBlur, handleSubmit, handleReset, isSubmitting } = this.props; return ( <div> <Form> <div className="ms-fontSize-18">Create a person</div> <TextField name="firstName" ...
PersonCreateForm
identifier_name
xtract_frames.py
#!/usr/bin/env python3 # # extract and fix frames from buggy apng animation # # https://github.com/eight04/pyAPNG import apng from struct import pack, unpack # patch the buggy picture sizes def fix(w, h, i): if w == 1280:
if w > 200: w //= 10 if h > 100: h //= 10 if i == 17: w, h = 180, 73 return w, h im = apng.APNG.open("p1ng") i = 0 for png, control in im.frames: w, h = unpack(">I", png.chunks[0][1][8:12])[0], unpack(">I", png.chunks[0][1][12:16])[0] w, h = fix(w, h, i) png.chunks[...
w, h = 180, 75
conditional_block
xtract_frames.py
#!/usr/bin/env python3 # # extract and fix frames from buggy apng animation # # https://github.com/eight04/pyAPNG import apng from struct import pack, unpack # patch the buggy picture sizes def
(w, h, i): if w == 1280: w, h = 180, 75 if w > 200: w //= 10 if h > 100: h //= 10 if i == 17: w, h = 180, 73 return w, h im = apng.APNG.open("p1ng") i = 0 for png, control in im.frames: w, h = unpack(">I", png.chunks[0][1][8:12])[0], unpack(">I", png.chunks[0][1]...
fix
identifier_name
xtract_frames.py
#!/usr/bin/env python3 # # extract and fix frames from buggy apng animation # # https://github.com/eight04/pyAPNG import apng from struct import pack, unpack # patch the buggy picture sizes def fix(w, h, i):
im = apng.APNG.open("p1ng") i = 0 for png, control in im.frames: w, h = unpack(">I", png.chunks[0][1][8:12])[0], unpack(">I", png.chunks[0][1][12:16])[0] w, h = fix(w, h, i) png.chunks[0] = ('IHDR', apng.make_chunk("IHDR", pack(">I", w) + pack(">I", h) + b'\x08\x06\x00\x00\x00')) png.save("%02d.png" %...
if w == 1280: w, h = 180, 75 if w > 200: w //= 10 if h > 100: h //= 10 if i == 17: w, h = 180, 73 return w, h
identifier_body
xtract_frames.py
#!/usr/bin/env python3
# extract and fix frames from buggy apng animation # # https://github.com/eight04/pyAPNG import apng from struct import pack, unpack # patch the buggy picture sizes def fix(w, h, i): if w == 1280: w, h = 180, 75 if w > 200: w //= 10 if h > 100: h //= 10 if i == 17: w, ...
#
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import jsonfield.fields import model_utils.fields class Migration(migrations.Migration):
dependencies = [ ('travel_times', '0002_auto_20150717_1221'), ] operations = [ migrations.CreateModel( name='Report', fields=[ ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), ('created', m...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import jsonfield.fields import model_utils.fields class
(migrations.Migration): dependencies = [ ('travel_times', '0002_auto_20150717_1221'), ] operations = [ migrations.CreateModel( name='Report', fields=[ ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), ...
Migration
identifier_name
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import jsonfield.fields import model_utils.fields class Migration(migrations.Migration): dependencies = [ ('travel_times', '0002_auto_20150717_1221'), ] operatio...
('modified', model_utils.fields.AutoLastModifiedField(editable=False, default=django.utils.timezone.now, verbose_name='modified')), ('postcode', models.CharField(max_length=14)), ('place_name', models.CharField(max_length=255, blank=True)), ('location_json...
fields=[ ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), ('created', model_utils.fields.AutoCreatedField(editable=False, default=django.utils.timezone.now, verbose_name='created')),
random_line_split
funcs.js
/** * XTemplate 所有的扩展函数集合,用于处理html中常见的格式转换,默认值等处理。 * 如果需要自行扩展,请使用window.Render的addFunc函数 * * @class Render.funcs */ (function (r, undefined) { 'use strict'; /** * 指定输出的默认值,如果有值就原样输出,如果空或是null,就输出默认值。 * * 示例: * * {name|default,'小明'} * * @method default * @param va...
dotLen = dot.length; } var strLength = str.replace(chineseRegex, "**").length; for (var i = 0; i < strLength; i++) { singleChar = str.charAt(i).toString(); if (singleChar.match(chineseRegex) !== null) { newLength += 2; } else { ...
var newStr = ""; var chineseRegex = /[^\x00-\xff]/g; var singleChar = ""; var dotLen = 0; if (dot) {
random_line_split
funcs.js
/** * XTemplate 所有的扩展函数集合,用于处理html中常见的格式转换,默认值等处理。 * 如果需要自行扩展,请使用window.Render的addFunc函数 * * @class Render.funcs */ (function (r, undefined) { 'use strict'; /** * 指定输出的默认值,如果有值就原样输出,如果空或是null,就输出默认值。 * * 示例: * * {name|default,'小明'} * * @method default * @param va...
i < strLength; i++) { singleChar = str.charAt(i).toString(); if (singleChar.match(chineseRegex) !== null) { newLength += 2; } else { newLength++; } if (newLength + dotLen > len) { if (dotLen > 0) { ...
str.replace(chineseRegex, "**").length; for (var i = 0;
conditional_block
frontend_test_utils.py
import atexit, datetime, os, tempfile, unittest import common from autotest_lib.frontend import setup_test_environment from autotest_lib.frontend import thread_local from autotest_lib.frontend.afe import models, model_attributes from autotest_lib.client.common_lib import global_config from autotest_lib.client.common_li...
acl_group = models.AclGroup.objects.create(name='my_acl') acl_group.users.add(models.User.current_user()) self.hosts = [models.Host.objects.create(hostname=hostname) for hostname in ('host1', 'host2', 'host3', 'host4', 'host5', 'host6', ...
models.DroneSet.objects.create( name=models.DroneSet.default_drone_set_name())
conditional_block
frontend_test_utils.py
import atexit, datetime, os, tempfile, unittest import common from autotest_lib.frontend import setup_test_environment from autotest_lib.frontend import thread_local from autotest_lib.frontend.afe import models, model_attributes from autotest_lib.client.common_lib import global_config from autotest_lib.client.common_li...
(self, fill_data=True): self.god = mock.mock_god(ut=self) setup_test_environment.set_up() global_config.global_config.override_config_value( 'AUTOTEST_WEB', 'parameterized_jobs', 'False') if fill_data: self._fill_in_test_data() def _frontend_common_teard...
_frontend_common_setup
identifier_name
frontend_test_utils.py
import atexit, datetime, os, tempfile, unittest import common from autotest_lib.frontend import setup_test_environment from autotest_lib.frontend import thread_local from autotest_lib.frontend.afe import models, model_attributes from autotest_lib.client.common_lib import global_config from autotest_lib.client.common_li...
def _fill_in_test_data(self): """Populate the test database with some hosts and labels.""" if models.DroneSet.drone_sets_enabled(): models.DroneSet.objects.create( name=models.DroneSet.default_drone_set_name()) acl_group = models.AclGroup.objects.create(name='my_...
identifier_body
frontend_test_utils.py
import atexit, datetime, os, tempfile, unittest import common from autotest_lib.frontend import setup_test_environment from autotest_lib.frontend import thread_local from autotest_lib.frontend.afe import models, model_attributes from autotest_lib.client.common_lib import global_config from autotest_lib.client.common_li...
self.label8.atomic_group = atomic_group2 self.label8.save() for hostnum in xrange(4,7): # host5..host7 self.hosts[hostnum].labels.add(self.label4) # an atomic group lavel self.hosts[hostnum].labels.add(self.label6) # a normal label self.hosts[6].labels.add(self...
self.hosts[1].labels.add(self.labels[1]) # label2 self.label6 = self.labels[5] self.label7 = self.labels[6] self.label8 = self.labels[7]
random_line_split
workletglobalscope.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::globalsc...
executor: WorkletExecutor, init: &WorkletGlobalScopeInit, ) -> DomRoot<WorkletGlobalScope> { match *self { WorkletGlobalScopeType::Test => DomRoot::upcast(TestWorkletGlobalScope::new( runtime, pipeline_id, base_url, ...
&self, runtime: &Runtime, pipeline_id: PipelineId, base_url: ServoUrl,
random_line_split
workletglobalscope.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::globalsc...
{ /// A servo-specific testing worklet Test, /// A paint worklet Paint, } impl WorkletGlobalScopeType { /// Create a new heap-allocated `WorkletGlobalScope`. pub fn new( &self, runtime: &Runtime, pipeline_id: PipelineId, base_url: ServoUrl, executor: Wor...
WorkletGlobalScopeType
identifier_name
workletglobalscope.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::globalsc...
} /// A task which can be performed in the context of a worklet global. pub enum WorkletTask { Test(TestWorkletTask), Paint(PaintWorkletTask), }
{ match *self { WorkletGlobalScopeType::Test => DomRoot::upcast(TestWorkletGlobalScope::new( runtime, pipeline_id, base_url, executor, init, )), WorkletGlobalScopeType::Paint => DomRoot::upcast(Pa...
identifier_body
event.rs
/** * Flow - Realtime log analyzer * Copyright (C) 2016 Daniel Mircea * * 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 ve...
pub fn construct(&self, current_navigation_state: &NavigationState) -> Event { let mut result = self.create_global_event(); if result.is_none() { result = match *current_navigation_state { NavigationState::Menu => self.create_menu_event(), NavigationSta...
{ EventBuilder { input: input, key: key, } }
identifier_body
event.rs
/** * Flow - Realtime log analyzer * Copyright (C) 2016 Daniel Mircea * * 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 ve...
} fn create_input_event(&self) -> Option<Event> { match self.input { Input::Kb(Key::Left, None) => { Some(Event::Search(SearchAction::ReadInput(KEY_LEFT_SEQ.to_vec()))) } Input::Kb(Key::Right, None) => { Some(Event::Search(SearchAction...
Input::Kb(Key::Home, None) => Some(Event::ScrollContents(Offset::Top)), Input::Kb(Key::End, None) => Some(Event::ScrollContents(Offset::Bottom)), Input::Resize => Some(Event::Resize), _ => None, }
random_line_split
event.rs
/** * Flow - Realtime log analyzer * Copyright (C) 2016 Daniel Mircea * * 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 ve...
(&self) -> Option<Event> { match self.input { Input::Kb(Key::Char('n'), Some(Modifier::Alt(_))) => { Some(Event::Search(SearchAction::FindNextMatch)) } Input::Kb(Key::Char('p'), Some(Modifier::Alt(_))) => { Some(Event::Search(SearchAction::Find...
create_search_event
identifier_name
retext.py
#!/usr/bin/env python3 # ReText # Copyright 2011-2012 Dmitry Shachnev # 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 2 of the License, or # (at your option) any later version. ...
app.installTranslator(RtTranslator) app.installTranslator(QtTranslator) if settings.contains('appStyleSheet'): stylename = readFromSettings('appStyleSheet', str) sheetfile = QFile(stylename) sheetfile.open(QIODevice.ReadOnly) app.setStyleSheet(QTextStream(sheetfile).readAll()) sheetfile.close() window = R...
random_line_split
retext.py
#!/usr/bin/env python3 # ReText # Copyright 2011-2012 Dmitry Shachnev # 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 2 of the License, or # (at your option) any later version. ...
(): app = QApplication(sys.argv) app.setOrganizationName("ReText project") app.setApplicationName("ReText") RtTranslator = QTranslator() for path in datadirs: if RtTranslator.load('retext_'+QLocale.system().name(), path+'/locale'): break QtTranslator = QTranslator() QtTranslator.load("qt_"+QLocale.system()....
main
identifier_name
retext.py
#!/usr/bin/env python3 # ReText # Copyright 2011-2012 Dmitry Shachnev # 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 2 of the License, or # (at your option) any later version. ...
window = ReTextWindow() window.show() fileNames = [QFileInfo(arg).canonicalFilePath() for arg in sys.argv[1:]] for fileName in fileNames: try: fileName = QString.fromUtf8(fileName) except: # Not needed for Python 3 pass if QFile.exists(fileName): window.openFileWrapper(fileName) signal.signal(si...
stylename = readFromSettings('appStyleSheet', str) sheetfile = QFile(stylename) sheetfile.open(QIODevice.ReadOnly) app.setStyleSheet(QTextStream(sheetfile).readAll()) sheetfile.close()
conditional_block
retext.py
#!/usr/bin/env python3 # ReText # Copyright 2011-2012 Dmitry Shachnev # 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 2 of the License, or # (at your option) any later version. ...
if __name__ == '__main__': main()
app = QApplication(sys.argv) app.setOrganizationName("ReText project") app.setApplicationName("ReText") RtTranslator = QTranslator() for path in datadirs: if RtTranslator.load('retext_'+QLocale.system().name(), path+'/locale'): break QtTranslator = QTranslator() QtTranslator.load("qt_"+QLocale.system().name(...
identifier_body
repo_pool.py
#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Lice...
def is_it_up(host, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect((host, port)) s.close() except: print "host: %s:%s DOWN" % (host, port) return False print "host: %s:%s UP" % (host, port) return True # hmm ...
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24])
identifier_body
repo_pool.py
#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Lice...
else: poolMembers.append(mip) except Error, v: print "no master will become master, %s" % v if (pooled == False): # setup the repository print "setup repo" print server.mount_repository_fs(repomount, repo) ...
pooled = True
conditional_block
repo_pool.py
#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Lice...
# import os, sys, subprocess, socket, fcntl, struct from socket import gethostname from xml.dom.minidom import parseString from xmlrpclib import ServerProxy, Error def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), ...
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License.
random_line_split
repo_pool.py
#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Lice...
(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24]) def is_it_up(host, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
get_ip_address
identifier_name