file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
connection_wrapper.py
import logging import time from django.conf import settings from django.core.mail import get_connection as dj_get_connection logger = logging.getLogger(__name__) class BackendWrapper(object): """A wrapper around Django's Email Backend, providing hooks for instrumentation and testing. """ def __ini...
def send_messages(self, email_messages): # check settings hook for rewriting email recipient, act accordingly if settings.EMAIL_REWRITE_RECIPIENT: for message in email_messages: message.to = [settings.EMAIL_REWRITE_RECIPIENT] # send the messages t = time...
random_line_split
log.rs
//! Logger implementation use std::fs::File; use std::io::Write; use std::fs::OpenOptions; use std::path::PathBuf; use std::collections::HashMap; use std::sync::{Mutex, MutexGuard}; use std::borrow::Borrow; use std; /// Logger category. Logger can be configured to save /// messages of each category to a separate file...
/// Returns false if messages of `category` are ignored. This function /// can be used to skip expensive construction of messages. pub fn is_on(&self, category: LoggerCategory) -> bool { self.settings(category).is_on() } /// Lazy-log. If messages of `category` are not ignored, calls the passed closure ...
{ self.category_settings = value; self.files.clear(); }
identifier_body
log.rs
//! Logger implementation use std::fs::File; use std::io::Write; use std::fs::OpenOptions; use std::path::PathBuf; use std::collections::HashMap; use std::sync::{Mutex, MutexGuard}; use std::borrow::Borrow; use std; /// Logger category. Logger can be configured to save /// messages of each category to a separate file...
} /// Log a message `text` to `category`. pub fn log<T: Borrow<str>>(&mut self, category: LoggerCategory, text: T) { self.llog(category, move || text); } /// Returns settings for `category`. fn settings(&self, category: LoggerCategory) -> &LoggerSettings { if let Some(data) = self.category_settin...
{ if !self.files.contains_key(&category) { let file = OpenOptions::new() .write(true) .create(true) .append(true) .open(path) .unwrap_or_else(|err| panic!("failed to open log file '{}': {}", path.display(), err)); self.files.ins...
conditional_block
log.rs
//! Logger implementation use std::fs::File; use std::io::Write; use std::fs::OpenOptions; use std::path::PathBuf; use std::collections::HashMap; use std::sync::{Mutex, MutexGuard}; use std::borrow::Borrow; use std; /// Logger category. Logger can be configured to save /// messages of each category to a separate file...
default_logger().llog(category, f); } /// Convenience method to check if `category` is enabled in the default logger. pub fn is_on(category: LoggerCategory) -> bool { default_logger().is_on(category) }
pub fn llog<T: Borrow<str>, F: FnOnce() -> T>(category: LoggerCategory, f: F) {
random_line_split
log.rs
//! Logger implementation use std::fs::File; use std::io::Write; use std::fs::OpenOptions; use std::path::PathBuf; use std::collections::HashMap; use std::sync::{Mutex, MutexGuard}; use std::borrow::Borrow; use std; /// Logger category. Logger can be configured to save /// messages of each category to a separate file...
<T: Borrow<str>>(category: LoggerCategory, text: T) { default_logger().log(category, text); } /// Convenience method to lazy-log messages to the default logger and specified `category`. /// If messages of `category` are not ignored, calls the passed closure /// and uses its output value as a message in that category...
log
identifier_name
TabbedPane.js
/**
var openmdao = (typeof openmdao === "undefined" || !openmdao ) ? {} : openmdao ; openmdao.TabbedPane = function(id) { jQuery("#"+id+" dl").css({ 'margin': '0', 'width': '100%', 'position': 'relative' }); jQuery("#"+id+" dt").css({ 'top':'0', 'margin': '0', 'p...
* a tabbed pane based on a definition list */
random_line_split
learning_unit.py
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
class ExternalLearningUnitDetailedSerializer(LearningUnitDetailedSerializer): local_url = serializers.CharField(source='externallearningunityear.url') local_code = serializers.CharField(source='externallearningunityear.external_acronym') class Meta(LearningUnitDetailedSerializer.Meta): model = Le...
f getattr(learning_unit_year, "summary_status", False): return SummaryStatus.MODIFIED.value elif learning_unit_year.summary_locked: return SummaryStatus.BLOCKED.value return SummaryStatus.NOT_MODIFIED.value
identifier_body
learning_unit.py
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
LearningUnitDetailedSerializer.Meta): model = LearningUnitYear fields = LearningUnitDetailedSerializer.Meta.fields + ( 'local_code', 'local_url' )
eta(
identifier_name
learning_unit.py
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
class LearningUnitDetailedSerializer(LearningUnitSerializer): periodicity_text = serializers.CharField(source='get_periodicity_display', read_only=True) quadrimester_text = serializers.CharField(source='get_quadrimester_display', read_only=True) language = serializers.CharField(source='language.code', re...
def get_has_proposal(self, learning_unit_year): return getattr(learning_unit_year, "has_proposal", None)
random_line_split
learning_unit.py
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
return SummaryStatus.NOT_MODIFIED.value class ExternalLearningUnitDetailedSerializer(LearningUnitDetailedSerializer): local_url = serializers.CharField(source='externallearningunityear.url') local_code = serializers.CharField(source='externallearningunityear.external_acronym') class Meta(Learning...
eturn SummaryStatus.BLOCKED.value
conditional_block
jquery.json-call.js
// jsonCall: a jQuery plugin that makes it easy to make an API // request to a URL with JSON in BOTH directions. // // Copyright 2013 P'unk Avenue LLC // // Please see: // // https://github.com/punkave/jquery-json-call // // For complete documentation. (function( $ ) { // This is correct - we're adding a function ca...
url: url, processData: false, contentType: 'application/json', data: JSON.stringify(data), dataType: options.dataType || 'json', success: success, async: options.async, }); if (failure) { ajax.fail(failure); } }; })( jQuery );
options = options || {}; var ajax = $.ajax({ type: 'POST',
random_line_split
jquery.json-call.js
// jsonCall: a jQuery plugin that makes it easy to make an API // request to a URL with JSON in BOTH directions. // // Copyright 2013 P'unk Avenue LLC // // Please see: // // https://github.com/punkave/jquery-json-call // // For complete documentation. (function( $ ) { // This is correct - we're adding a function ca...
options = options || {}; var ajax = $.ajax({ type: 'POST', url: url, processData: false, contentType: 'application/json', data: JSON.stringify(data), dataType: options.dataType || 'json', success: success, async: options.async, }); if (failure) { aj...
{ // No options argument passed, shift the others over failure = success; success = data; data = options; options = undefined; }
conditional_block
htmldatalistelement.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::HTMLDataListElementBinding; use dom::bindings::codegen::Bindings::HTMLDataLi...
} impl HTMLDataListElementMethods for HTMLDataListElement { // https://html.spec.whatwg.org/multipage/#dom-datalist-options fn Options(&self) -> DomRoot<HTMLCollection> { #[derive(JSTraceable, MallocSizeOf)] struct HTMLDataListOptionsFilter; impl CollectionFilter for HTMLDataListOption...
{ Node::reflect_node( Box::new(HTMLDataListElement::new_inherited( local_name, prefix, document, )), document, HTMLDataListElementBinding::Wrap, ) }
identifier_body
htmldatalistelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public
use dom::bindings::codegen::Bindings::HTMLDataListElementBinding::HTMLDataListElementMethods; use dom::bindings::inheritance::Castable; use dom::bindings::root::DomRoot; use dom::document::Document; use dom::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlelement::HTMLElement...
* 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::HTMLDataListElementBinding;
random_line_split
htmldatalistelement.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::HTMLDataListElementBinding; use dom::bindings::codegen::Bindings::HTMLDataLi...
(&self, elem: &Element, _root: &Node) -> bool { elem.is::<HTMLOptionElement>() } } let filter = Box::new(HTMLDataListOptionsFilter); let window = window_from_node(self); HTMLCollection::create(&window, self.upcast(), filter) } }
filter
identifier_name
conf.py
/g'" mytag = sp.Popen(cmd, shell=True, stdout=sp.PIPE).stdout.read().strip() tags.add (mytag) ################################################################################ ## print "* Generating resource configuration docs: resources.rst" print "* using tag: %s" % mytag try: os.remove("{0}/resources.rst"....
html_theme = "armstrong" html_theme_path = ["_themes", ] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { "collapsiblesidebar" : "true", } # Add any paths that contain custom themes...
random_line_split
conf.py
/g'" mytag = sp.Popen(cmd, shell=True, stdout=sp.PIPE).stdout.read().strip() tags.add (mytag) ################################################################################ ## print "* Generating resource configuration docs: resources.rst" print "* using tag: %s" % mytag try: os.remove("{0}/resources.rst"....
resources_rst.write("* **Default values** for ComputePilotDescription attributes:\n\n") resources_rst.write(" * ``queue : {0}``\n".format(default_queue)) resources_rst.write(" * ``sandbox : {0}``\n".format(working_dir)) resources_rst.write(" * ``access_sche...
resources_rst.write("* **Note** : {0}\n".format(resource_config["notes"]))
conditional_block
res.py
"""SoundRTS resource manager""" import os from lib.resource import ResourceLoader import config import options from paths import MAPS_PATHS def get_all_packages_paths(): """return the default "maps and mods" paths followed by the paths of the active packages""" return MAPS_PATHS # + package_manager.get_pack...
return result def available_soundpacks(): return available_mods(is_a_soundpack)
result.append(mod)
conditional_block
res.py
"""SoundRTS resource manager""" import os from lib.resource import ResourceLoader import config import options from paths import MAPS_PATHS def get_all_packages_paths(): """return the default "maps and mods" paths followed by the paths of the active packages""" return MAPS_PATHS # + package_manager.get_pack...
(): w = [] _add_official_multi(w) _add_custom_multi(w) _move_recommended_maps(w) return w _multi_maps = None _mods_at_the_previous_multi_maps_update = None def worlds_multi(): global _multi_maps, _mods_at_the_previous_multi_maps_update if _multi_maps is None or _mods_at_the_previous_mult...
_get_worlds_multi
identifier_name
res.py
"""SoundRTS resource manager""" import os from lib.resource import ResourceLoader import config import options from paths import MAPS_PATHS def get_all_packages_paths(): """return the default "maps and mods" paths followed by the paths of the active packages""" return MAPS_PATHS # + package_manager.get_pack...
def is_a_soundpack(path): for name in ("rules.txt", "ai.txt"): if os.path.isfile(os.path.join(path, name)): return False return True def is_a_mod(path): return not is_a_soundpack(path) def available_mods(check_mod_type=is_a_mod): result = [] for path in get_all_packages_path...
# mods
random_line_split
res.py
"""SoundRTS resource manager""" import os from lib.resource import ResourceLoader import config import options from paths import MAPS_PATHS def get_all_packages_paths(): """return the default "maps and mods" paths followed by the paths of the active packages""" return MAPS_PATHS # + package_manager.get_pack...
def _get_worlds_multi(): w = [] _add_official_multi(w) _add_custom_multi(w) _move_recommended_maps(w) return w _multi_maps = None _mods_at_the_previous_multi_maps_update = None def worlds_multi(): global _multi_maps, _mods_at_the_previous_multi_maps_update if _multi_maps is None or _m...
from definitions import Style style = Style() style.load(get_text_file("ui/style", append=True, localize=True)) for n in reversed(style.get("parameters", "recommended_maps")): for m in reversed(w[:]): # reversed so the custom map is after the official map if m.get_name()[:-4] == n: ...
identifier_body
resource_loader.py
# Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ResourceFinder is a helper class for finding resources given their name.""" import codecs import os from py_vulcanize import module from py_vulcaniz...
(self, requested_module_name): """Finds a module javascript file and returns a Resource, or none.""" js_resource = self._FindResourceGivenNameAndSuffix( requested_module_name, '.js', return_resource=True) html_resource = self._FindResourceGivenNameAndSuffix( requested_module_name, '.html', r...
FindModuleResource
identifier_name
resource_loader.py
# Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ResourceFinder is a helper class for finding resources given their name.""" import codecs import os from py_vulcanize import module from py_vulcaniz...
return html_resource def LoadModule(self, module_name=None, module_filename=None, excluded_scripts=None): assert bool(module_name) ^ bool(module_filename), ( 'Must provide either module_name or module_filename.') if module_filename: resource = self.FindResource(module_file...
return js_resource
conditional_block
resource_loader.py
# Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ResourceFinder is a helper class for finding resources given their name.""" import codecs import os from py_vulcanize import module from py_vulcaniz...
def FindResourceGivenRelativePath(self, relative_path, binary=False): """Returns a Resource for the given relative path.""" absolute_path = None for script_path in self.source_paths: absolute_path = os.path.join(script_path, relative_path) if os.path.exists(absolute_path): return res...
"""Returns a Resource for the given absolute path.""" candidate_paths = [] for source_path in self.source_paths: if absolute_path.startswith(source_path): candidate_paths.append(source_path) if len(candidate_paths) == 0: return None # Sort by length. Longest match wins. candidat...
identifier_body
resource_loader.py
# Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ResourceFinder is a helper class for finding resources given their name.""" import codecs import os from py_vulcanize import module from py_vulcaniz...
f.close() return absolute_path, contents
f = codecs.open(absolute_path, mode='r', encoding='utf-8') contents = f.read()
random_line_split
compat.py
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """Python 2<->3 compatibility module""" import sys def print_(template, *args, **kwargs): template = str(template) if args: template ...
from urllib import unquote iteritems = lambda d: d.iteritems() dictkeys = lambda d: d.keys() def reraise(t, e, tb): exec('raise t, e, tb', dict(t=t, e=e, tb=tb)) else: basestring = str from configparser import ConfigParser from urllib.parse import unquote iteritems = lambda d: d...
if sys.version_info < (3, 0): basestring = basestring from ConfigParser import ConfigParser
random_line_split
compat.py
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """Python 2<->3 compatibility module""" import sys def print_(template, *args, **kwargs): template = str(template) if args: template ...
(t, e, tb): exec('raise t, e, tb', dict(t=t, e=e, tb=tb)) else: basestring = str from configparser import ConfigParser from urllib.parse import unquote iteritems = lambda d: d.items() dictkeys = lambda d: list(d.keys()) def reraise(t, e, tb): raise e.with_traceback(tb)
reraise
identifier_name
compat.py
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """Python 2<->3 compatibility module""" import sys def print_(template, *args, **kwargs): template = str(template) if args:
elif kwargs: template = template % kwargs sys.stdout.writelines(template) if sys.version_info < (3, 0): basestring = basestring from ConfigParser import ConfigParser from urllib import unquote iteritems = lambda d: d.iteritems() dictkeys = lambda d: d.keys() def reraise(t, e, ...
template = template % args
conditional_block
compat.py
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """Python 2<->3 compatibility module""" import sys def print_(template, *args, **kwargs): template = str(template) if args: template ...
else: basestring = str from configparser import ConfigParser from urllib.parse import unquote iteritems = lambda d: d.items() dictkeys = lambda d: list(d.keys()) def reraise(t, e, tb): raise e.with_traceback(tb)
exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
identifier_body
list-tag.enum.ts
export enum ListTag { // Expansion tags A_REALM_REBORN = 'A_REALM_REBORN', HEAVENSWARD = 'HEAVENSWARD', STORMBLOOD = 'STORMBLOOD', SHADOWBRINGERS = 'SHADOWBRINGERS', // Theme tags GEAR = 'Gear', CONSUMABLE = 'Consumable', LOG = 'Log', LEVE = 'Leve', GLAMOUR = 'Glamour', HOUSING = 'Housing', ...
CRAFTER = 'Crafter', GATHERER = 'Gatherer', PLD = 'PLD', WAR = 'WAR', DRK = 'DRK', GNB = 'GNB', WHM = 'WHM', SCH = 'SCH', AST = 'AST', MNK = 'MNK', DRG = 'DRG', NIN = 'NIN', SAM = 'SAM', BRD = 'BRD', MCH = 'MCH', DNC = 'DNC', BLM = 'BLM', SMN = 'SMN', RDM = 'RDM', BLU = 'BLU...
HEALER = 'Healer', MELEE = 'Melee', RANGED = 'Ranged', CASTER = 'Caster',
random_line_split
hr.rs
use regex::Regex; use parser::Block; use parser::Block::Hr; pub fn parse_hr(lines: &[&str]) -> Option<(Block, usize)> { let HORIZONTAL_RULE = Regex::new(r"^(===+)$|^(---+)$").unwrap(); if HORIZONTAL_RULE.is_match(lines[0]){ return Some((Hr, 1)); } return None; } #[cfg(test)] mod test { us...
}
{ assert_eq!(parse_hr(&vec!["a-------"]), None); assert_eq!(parse_hr(&vec!["--- a"]), None); assert_eq!(parse_hr(&vec!["--a-"]), None); assert_eq!(parse_hr(&vec!["-------====--------------"]), None); assert_eq!(parse_hr(&vec!["a======"]), None); assert_eq!(parse_hr(&vec!...
identifier_body
hr.rs
use regex::Regex; use parser::Block; use parser::Block::Hr; pub fn parse_hr(lines: &[&str]) -> Option<(Block, usize)> { let HORIZONTAL_RULE = Regex::new(r"^(===+)$|^(---+)$").unwrap();
return Some((Hr, 1)); } return None; } #[cfg(test)] mod test { use super::parse_hr; use parser::Block::Hr; #[test] fn finds_hr() { assert_eq!(parse_hr(&vec!["-------"]).unwrap(), (Hr, 1)); assert_eq!(parse_hr(&vec!["---"]).unwrap(), (Hr, 1)); assert_eq!(parse_hr...
if HORIZONTAL_RULE.is_match(lines[0]){
random_line_split
hr.rs
use regex::Regex; use parser::Block; use parser::Block::Hr; pub fn parse_hr(lines: &[&str]) -> Option<(Block, usize)> { let HORIZONTAL_RULE = Regex::new(r"^(===+)$|^(---+)$").unwrap(); if HORIZONTAL_RULE.is_match(lines[0]){ return Some((Hr, 1)); } return None; } #[cfg(test)] mod test { us...
() { assert_eq!(parse_hr(&vec!["a-------"]), None); assert_eq!(parse_hr(&vec!["--- a"]), None); assert_eq!(parse_hr(&vec!["--a-"]), None); assert_eq!(parse_hr(&vec!["-------====--------------"]), None); assert_eq!(parse_hr(&vec!["a======"]), None); assert_eq!(parse_hr(&v...
no_false_positives
identifier_name
hr.rs
use regex::Regex; use parser::Block; use parser::Block::Hr; pub fn parse_hr(lines: &[&str]) -> Option<(Block, usize)> { let HORIZONTAL_RULE = Regex::new(r"^(===+)$|^(---+)$").unwrap(); if HORIZONTAL_RULE.is_match(lines[0])
return None; } #[cfg(test)] mod test { use super::parse_hr; use parser::Block::Hr; #[test] fn finds_hr() { assert_eq!(parse_hr(&vec!["-------"]).unwrap(), (Hr, 1)); assert_eq!(parse_hr(&vec!["---"]).unwrap(), (Hr, 1)); assert_eq!(parse_hr(&vec!["---------------------------...
{ return Some((Hr, 1)); }
conditional_block
virtualPageRowModel.d.ts
// Type definitions for ag-grid v6.2.1 // Project: http://www.ag-grid.com/ // Definitions by: Niall Crosby <https://github.com/ceolter/> // Definitions: https://github.com/borisyankov/DefinitelyTyped import { RowNode } from "../../entities/rowNode"; import { IRowModel } from "../../interfaces/iRowModel"; import { IData...
implements IRowModel { private gridOptionsWrapper; private filterManager; private sortController; private selectionController; private eventService; private context; private destroyFunctions; private virtualPageCache; private datasource; init(): void; private addEventListene...
VirtualPageRowModel
identifier_name
virtualPageRowModel.d.ts
// Type definitions for ag-grid v6.2.1 // Project: http://www.ag-grid.com/ // Definitions by: Niall Crosby <https://github.com/ceolter/> // Definitions: https://github.com/borisyankov/DefinitelyTyped import { RowNode } from "../../entities/rowNode"; import { IRowModel } from "../../interfaces/iRowModel"; import { IData...
getVirtualRowCount(): number; isMaxRowFound(): boolean; setVirtualRowCount(rowCount: number, maxRowFound?: boolean): void; getVirtualPageState(): any; }
addItems(items: any[]): void; refreshVirtualPageCache(): void; purgeVirtualPageCache(): void;
random_line_split
gui_laveqed.py
tkFont.Font(self.text_widget, self.text_widget.cget("font")) # self.bold_font = tkFont.Font(self.text_widget, self.text_widget.cget("font")) # self.bold_font.configure(weight="bold") # self.text_widget.tag_configure('bold',font=self.bold_font) # #self.text_widget.tag_configure('plain',font=...
(self, win, x=APP_WIN_WIDTH, y=APP_WIN_HEIGHT): win.update_idletasks() width = x height = y x = (win.winfo_screenwidth() // 2) - (width // 2) y = (win.winfo_screenheight() // 2) - (height // 2) win.geometry('{}x{}+{}+{}'.format(width, height, x, y)) def load_svg(sel...
center
identifier_name
gui_laveqed.py
self.top_frame.pack(side='top',fill='both', expand=True, padx=4, pady=4) self.png_frame=Label(self.top_frame,anchor='center') self.png_frame.pack(fill='both', expand=True, padx=4, pady=4) self.bottom_frame=LabelFrame(self.main_frame,relief=FLAT) self.bottom_frame.pack(s...
self.top_frame=LabelFrame(self.main_frame,relief=FLAT)
random_line_split
gui_laveqed.py
Success!)') # If opening failed, put a blank image the same size as SVGLOGOFILE else: # Note, this should never occurs now... Left here because print('Loading svg file\t:\t'+filename+' (Failed!)') self.tk_image = ImageTk.PhotoImage('RGBA') self.image=Image.new('RGB'...
text.tag_remove(i,'1.0','end')
conditional_block
gui_laveqed.py
# self.text_widget=Text(self.text_frame,bd=2,padx=4,pady=4,\ # wrap=WORD,font=(FONTNAME,14),undo=True) # self.text_widget.pack(fill='both',expand=True,padx=4,pady=4) # # Color tags for syntax highlight # self.text_widget.tag_configure('red',foreground='red') # self.te...
self.text_widget=Text(self.text_frame,bd=2,padx=4,pady=4,\ wrap=WORD,font=(FONTNAME,14),undo=True) self.text_widget.pack(fill='both',expand=True,padx=4,pady=4) self.bold_font = tkFont.Font(self.text_widget, self.text_widget.cget("font")) self.bold_font.configure(weight="bold") ...
identifier_body
comments.js
'use strict'; var _ = require('underscore'), path = require('path'), Promise = require('bluebird'), errorHelper = require(path.join(global.__libdir, 'errorHelper')), recallHelper = require(path.join(global.__libdir, 'recallHelper')), mongoAdapter = require(path.join(global.__adptsdir, 'mongo')); /** * Adds a co...
if (!obj.name || !_.isString(obj.name)) { throw errorHelper.getValidationError('Invalid name'); } if (obj.location && !_.isString(obj.location)) { throw errorHelper.getValidationError('Invalid location'); } if (obj.location && !recallHelper.isValidState(obj.location)) { throw errorHelper.getValid...
{ throw errorHelper.getValidationError('Invalid recallnumber'); }
conditional_block
comments.js
'use strict'; var _ = require('underscore'), path = require('path'), Promise = require('bluebird'), errorHelper = require(path.join(global.__libdir, 'errorHelper')), recallHelper = require(path.join(global.__libdir, 'recallHelper')),
/** * Adds a comment to a recall * @param {Object} obj The params object. * @param {String} obj.recallnumber The recall number. * @param {String} obj.name The user's name. * @param {String} [obj.location] The location of the user. * @param {String} obj.comment The comment. * @returns {Promise<Object>} */ export...
mongoAdapter = require(path.join(global.__adptsdir, 'mongo'));
random_line_split
cy.js
var $mod$364 = core.VW.Ecma2015.Utils.module(require('../moment')); exports.default = $mod$364.default.defineLocale('cy', { months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), ...
} else if (b > 0) { output = lookup[b]; } return number + output; }, week: { dow: 1, doy: 4 } });
} else { output = 'ain'; }
random_line_split
cy.js
var $mod$364 = core.VW.Ecma2015.Utils.module(require('../moment')); exports.default = $mod$364.default.defineLocale('cy', { months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'), monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'), ...
else if (b > 0) { output = lookup[b]; } return number + output; }, week: { dow: 1, doy: 4 } });
if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) { output = 'fed'; } else { output = 'ain'; } }
conditional_block
dm-index3.js
ent().addClass('active').siblings('.active').removeClass('active') .children('.active').removeClass('active'); $content.addClass('iactive') //隐藏原来显示的content .siblings().removeClass('iactive'); $('div.menu-root div.selected').html($a.html()+"<img src='kstrap/images/triangle_down_17.gif'/>"); $(...
//恢复原选中菜单样式 .par
conditional_block
dm-index3.js
" marginHeight="0"></iframe></div>'); $search_tab.append(add_iframe); DM.tab.add($search_tab, add_iframe); var add_tab_li = add_iframe.data('tab_title'); add_tab_li.attr('data-tab-menuid',menuid);//如果存在menuid则存放menuid为引用 Tools.submit2BlankWindow(open_url, params, "iframe-"+menuid); current_ifra...
identifier_name
dm-index3.js
this); //遍历子系统左侧菜单节点 $ct.find('ul.sub-menu-ul').find('a').each(function(){ var $this = $(this); if($this.attr('data-menuid') == menuid){ $menu_a = $this; return false; } }); //找到对应的菜单节点就退出遍历了 if($menu_a!=null){ //保存一下菜单节点所在的子系统工作区的tab面板引用 $menu_a.data('k-tab', $c...
random_line_split
dm-index3.js
" marginHeight="0"></iframe></div>'); $search_tab.append(add_iframe); DM.tab.add($search_tab, add_iframe); var add_tab_li = add_iframe.data('tab_title'); add_tab_li.attr('data-tab-menuid',menuid);//如果存在menuid则存放menuid为引用 Tools.submit2BlankWindow(open_url, params, "iframe-"+menuid); current_ifra...
identifier_body
apps.py
from django.apps import AppConfig from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType class AppConfig(AppConfig): name = '.'.join(__name__.split('.')[:-1]) label = 'icekit_plugins_iiif' verbose_name = "...
User = get_user_model() try: # this doesn't work if migrations haven't been updated, resulting # in "RuntimeError: Error creating new content types. Please make # sure contenttypes is migrated before trying to migrate apps # individually." content_ty...
identifier_body
apps.py
from django.apps import AppConfig from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType class AppConfig(AppConfig): name = '.'.join(__name__.split('.')[:-1]) label = 'icekit_plugins_iiif' verbose_name = "...
(self): # Create custom permission pointing to User, because we have no other # model to hang it off for now... # TODO This is a hack, find a better way User = get_user_model() try: # this doesn't work if migrations haven't been updated, resulting # in "R...
ready
identifier_name
apps.py
from django.apps import AppConfig from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType class AppConfig(AppConfig): name = '.'.join(__name__.split('.')[:-1]) label = 'icekit_plugins_iiif' verbose_name = "IIIF Basics" def ready(self): # Create custom permission pointing to User, because we have no other # model to...
random_line_split
share.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HttpModule } from '@angular/http'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { SharedActions } from '../shared/share-actions'; import...
{}
SharedModule
identifier_name
share.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HttpModule } from '@angular/http'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { SharedActions } from '../shared/share-actions'; import...
SharedDirectives, SharedPipes, ], providers: [ HttpModule, SharedActions, SharedServices, ] }) export class SharedModule {}
random_line_split
wifi-olsr-flowmon.py
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
else: num_nodes_side = int(cmd.NumNodesSide) for xi in range(num_nodes_side): for yi in range(num_nodes_side): node = ns.network.Node() nodes.append(node) internet.Install(ns.network.NodeContainer(node)) mobility = ns.mobility.ConstantPosition...
num_nodes_side = NUM_NODES_SIDE
conditional_block
wifi-olsr-flowmon.py
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
for i in range(st.packetSizeHistogram.GetNBins () ): print >> os, " ",i,"(", st.packetSizeHistogram.GetBinStart (i), "-", \ st.packetSizeHistogram.GetBinEnd (i), "): ", st.packetSizeHistogram.GetBinCount (i) for reason, drops in enumerate(st.packetsDropped): ...
print >> os, " Tx Bytes: ", st.txBytes print >> os, " Rx Bytes: ", st.rxBytes print >> os, " Tx Packets: ", st.txPackets print >> os, " Rx Packets: ", st.rxPackets print >> os, " Lost Packets: ", st.lostPackets if st.rxPackets > 0: print >> os, " Mean{Delay}: ",...
identifier_body
wifi-olsr-flowmon.py
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
(os, st): print >> os, " Tx Bytes: ", st.txBytes print >> os, " Rx Bytes: ", st.rxBytes print >> os, " Tx Packets: ", st.txPackets print >> os, " Rx Packets: ", st.rxPackets print >> os, " Lost Packets: ", st.lostPackets if st.rxPackets > 0: print >> os, ...
print_stats
identifier_name
wifi-olsr-flowmon.py
# -*- Mode: Python; -*- # Copyright (c) 2009 INESC Porto # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, #...
list_routing.Add(olsr_routing, 100) internet.SetRoutingHelper(list_routing) ipv4Addresses = ns.internet.Ipv4AddressHelper() ipv4Addresses.SetBase(ns.network.Ipv4Address("10.0.0.0"), ns.network.Ipv4Mask("255.255.255.0")) port = 9 # Discard port(RFC 863) onOffHelper = ns.applications.OnOffHelp...
static_routing = ns.internet.Ipv4StaticRoutingHelper() list_routing.Add(static_routing, 0)
random_line_split
mod.rs
use core::creature::Creature; use core::renderer::{Renderable, RGB}; use core::time::Time; use core::world::dungeon::map::{self, Pos, Tile}; #[derive(Clone)] pub enum Money { Copper, Silver, Electrum, Gold, Quartz, Platinum, Mithril, Scale, Onyx, Tourmaline, Emerald, Ruby, Sapphire, Topaz,...
} /// /// Implement the `Renderable` trait for `Item`, mostly just getters and setters /// impl Renderable for Item { #[inline] fn get_bg(&self) -> RGB { self.bg } #[inline] fn get_fg(&self) -> RGB { self.fg } #[inline] fn get_glyph(&self) -> char { self.glyph } #[inline] fn get_...
{ Item { name, glyph, pos, fg, bg, quantity, property } }
identifier_body
mod.rs
use core::creature::Creature; use core::renderer::{Renderable, RGB}; use core::time::Time; use core::world::dungeon::map::{self, Pos, Tile}; #[derive(Clone)] pub enum Money { Copper, Silver, Electrum, Gold, Quartz, Platinum, Mithril, Scale, Onyx, Tourmaline, Emerald, Ruby, Sapphire, Topaz, ...
self.glyph = glyph } #[inline] fn set_id(&mut self, name: &'static str) { self.name = name; } } impl Time for Item { fn take_turn(&mut self, _map: &map::Grid<Tile>, _player: &Creature) { } }
#[inline] fn set_glyph(&mut self, glyph: char) {
random_line_split
mod.rs
use core::creature::Creature; use core::renderer::{Renderable, RGB}; use core::time::Time; use core::world::dungeon::map::{self, Pos, Tile}; #[derive(Clone)] pub enum
{ Copper, Silver, Electrum, Gold, Quartz, Platinum, Mithril, Scale, Onyx, Tourmaline, Emerald, Ruby, Sapphire, Topaz, Diamond, } pub fn money_value(money: &Money) -> f32 { match money { Money::Copper => 0.01, Money::Silver => 0.1, Money::Electrum => 0.5, Money::Gold | M...
Money
identifier_name
responsiveFlexOrder.demo.ts
import {Component} from '@angular/core';
styleUrls : [ '../../assets/css/material2.css' ], template: ` <md-card class="card-demo" > <md-card-title>Responsive Flex Ordering</md-card-title> <md-card-subtitle>Add the flex-order directive to a layout child to set its order position within the layout container:</md-card-subtitle> <m...
@Component({ selector: 'demo-responsive-flex-order',
random_line_split
responsiveFlexOrder.demo.ts
import {Component} from '@angular/core'; @Component({ selector: 'demo-responsive-flex-order', styleUrls : [ '../../assets/css/material2.css' ], template: ` <md-card class="card-demo" > <md-card-title>Responsive Flex Ordering</md-card-title> <md-card-subtitle>Add the flex-order directive to ...
{ }
DemoResponsiveFlexOrder
identifier_name
library_document.py
from typing import TYPE_CHECKING import arrow import requests from io import BytesIO from pyEchosign.utils.request_parameters import get_headers from pyEchosign.utils.handle_response import check_error if TYPE_CHECKING: from .account import EchosignAccount class LibraryDocument(object): """ Represents ...
(self): return self.name PERSONAL = 'PERSONAL' SHARED = 'SHARED' GLOBAL = 'GLOBAL' scope = None @classmethod def json_to_agreement(cls, account, json_data): echosign_id = json_data.get('libraryDocumentId') template_type = json_data.get('libraryTemplateTypes') mo...
__repr__
identifier_name
library_document.py
from typing import TYPE_CHECKING import arrow import requests from io import BytesIO from pyEchosign.utils.request_parameters import get_headers from pyEchosign.utils.handle_response import check_error if TYPE_CHECKING: from .account import EchosignAccount class LibraryDocument(object): """ Represents ...
def __repr__(self): return self.name PERSONAL = 'PERSONAL' SHARED = 'SHARED' GLOBAL = 'GLOBAL' scope = None @classmethod def json_to_agreement(cls, account, json_data): echosign_id = json_data.get('libraryDocumentId') template_type = json_data.get('libraryTemplateTy...
random_line_split
library_document.py
from typing import TYPE_CHECKING import arrow import requests from io import BytesIO from pyEchosign.utils.request_parameters import get_headers from pyEchosign.utils.handle_response import check_error if TYPE_CHECKING: from .account import EchosignAccount class LibraryDocument(object): """ Represents ...
self._message = None self._security_options = None def __str__(self): return self.name def __repr__(self): return self.name PERSONAL = 'PERSONAL' SHARED = 'SHARED' GLOBAL = 'GLOBAL' scope = None @classmethod def json_to_agreement(cls, account, json_da...
self.account = account self.echosign_id = echosign_id if 'DOCUMENT' in template_type: self.document = True if 'FORM_FIELD_LAYER' in template_type: self.form_field_layer = True self.name = name date = arrow.get(modified_date) self.modified_date = da...
identifier_body
library_document.py
from typing import TYPE_CHECKING import arrow import requests from io import BytesIO from pyEchosign.utils.request_parameters import get_headers from pyEchosign.utils.handle_response import check_error if TYPE_CHECKING: from .account import EchosignAccount class LibraryDocument(object): """ Represents ...
if 'FORM_FIELD_LAYER' in template_type: self.form_field_layer = True self.name = name date = arrow.get(modified_date) self.modified_date = date.datetime self.scope = scope self.fully_retrieved = False self.document = False self.form_field_laye...
self.document = True
conditional_block
setup.py
import codecs import os import re import setuptools from setuptools import find_packages, setup from setuptools.command.develop import develop from setuptools.command.install import install PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") RE...
raise RuntimeError("Unable to find version in %s." % (VERSION_FILE,)) setup( name="arviz", license="Apache-2.0", version=get_version(), description="Exploratory analysis of Bayesian models", author="ArviZ Developers", url="http://github.com/arviz-devs/arviz", packages=find_packages(),...
mo = re.search(version_regex, line, re.M) if mo: return mo.group(1)
conditional_block
setup.py
import codecs import os import re import setuptools from setuptools import find_packages, setup from setuptools.command.develop import develop from setuptools.command.install import install PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") RE...
(): lines = open(VERSION_FILE, "rt").readlines() version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]" for line in lines: mo = re.search(version_regex, line, re.M) if mo: return mo.group(1) raise RuntimeError("Unable to find version in %s." % (VERSION_FILE,)) setup( nam...
get_version
identifier_name
setup.py
import codecs import os import re import setuptools from setuptools import find_packages, setup from setuptools.command.develop import develop from setuptools.command.install import install PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") RE...
setup( name="arviz", license="Apache-2.0", version=get_version(), description="Exploratory analysis of Bayesian models", author="ArviZ Developers", url="http://github.com/arviz-devs/arviz", packages=find_packages(), install_requires=get_requirements(), extras_require=dict(all=get_...
lines = open(VERSION_FILE, "rt").readlines() version_regex = r"^__version__ = ['\"]([^'\"]*)['\"]" for line in lines: mo = re.search(version_regex, line, re.M) if mo: return mo.group(1) raise RuntimeError("Unable to find version in %s." % (VERSION_FILE,))
identifier_body
setup.py
import codecs import os import re import setuptools from setuptools import find_packages, setup from setuptools.command.develop import develop from setuptools.command.install import install PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__)) REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt") RE...
with codecs.open(REQUIREMENTS_FILE) as buff: return buff.read().splitlines() def get_requirements_dev(): with codecs.open(REQUIREMENTS_DEV_FILE) as buff: return buff.read().splitlines() def get_requirements_optional(): with codecs.open(REQUIREMENTS_OPTIONAL_FILE) as buff: return ...
random_line_split
RecentActors.js
export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0z" /><path d="M21 5v14h2V5h-2zm-4 14h2V5h-2v14zM14 5H2c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zM8 7.75c1.24 0 2.25 1.01 2.25 2.25S9.24 12.25 8 12.25 5.75 11.24 5.75 10 6.76 7.75 8 7.75zM12.5 17h-9v-.75c0-1....
import React from 'react'; import createSvgIcon from './utils/createSvgIcon';
random_line_split
playjbd.py
#!/usr/bin/python import RPi.GPIO as GPIO import time pin = 17 first = 1 gap = 1 second = 1 def play(nra): # D Letter firstCount = 5 secondCount = nra pin = 17 first = 1 gap = 1 second = 1 firstSleepTimeOn = 0.02 firstSleepTimeOff = 0.04 secondSleepTimeOn = 0.02 secondSleepTimeOff = 0.04 gapSleepT...
time.sleep(firstSleepTimeOff); # wait for second string if (gap==1): GPIO.output(pin, GPIO.LOW) time.sleep(gapSleepTime); if (second == 1): for x in xrange(secondCount): GPIO.output(pin, GPIO.LOW) time.sleep(secondSleepTimeOn); GPIO.output(pin, GPIO.HIGH) time.sleep(secondSleepTimeOff); GP...
GPIO.output(pin, GPIO.LOW) time.sleep(firstSleepTimeOn); GPIO.output(pin, GPIO.HIGH)
random_line_split
playjbd.py
#!/usr/bin/python import RPi.GPIO as GPIO import time pin = 17 first = 1 gap = 1 second = 1 def
(nra): # D Letter firstCount = 5 secondCount = nra pin = 17 first = 1 gap = 1 second = 1 firstSleepTimeOn = 0.02 firstSleepTimeOff = 0.04 secondSleepTimeOn = 0.02 secondSleepTimeOff = 0.04 gapSleepTime = 0.1 GPIO.setmode(GPIO.BCM) GPIO.setup(pin,GPIO.OUT) if (first == 1): for x in xra...
play
identifier_name
playjbd.py
#!/usr/bin/python import RPi.GPIO as GPIO import time pin = 17 first = 1 gap = 1 second = 1 def play(nra): # D Letter
if (first == 1): for x in xrange(firstCount): GPIO.output(pin, GPIO.LOW) time.sleep(firstSleepTimeOn); GPIO.output(pin, GPIO.HIGH) time.sleep(firstSleepTimeOff); # wait for second string if (gap==1): GPIO.output(pin, GPIO.LOW) time.sleep(gapSleepTime); if (second == 1): for x in xrange(second...
firstCount = 5 secondCount = nra pin = 17 first = 1 gap = 1 second = 1 firstSleepTimeOn = 0.02 firstSleepTimeOff = 0.04 secondSleepTimeOn = 0.02 secondSleepTimeOff = 0.04 gapSleepTime = 0.1 GPIO.setmode(GPIO.BCM) GPIO.setup(pin,GPIO.OUT)
identifier_body
playjbd.py
#!/usr/bin/python import RPi.GPIO as GPIO import time pin = 17 first = 1 gap = 1 second = 1 def play(nra): # D Letter firstCount = 5 secondCount = nra pin = 17 first = 1 gap = 1 second = 1 firstSleepTimeOn = 0.02 firstSleepTimeOff = 0.04 secondSleepTimeOn = 0.02 secondSleepTimeOff = 0.04 gapSleepT...
if (second == 1): for x in xrange(secondCount): GPIO.output(pin, GPIO.LOW) time.sleep(secondSleepTimeOn); GPIO.output(pin, GPIO.HIGH) time.sleep(secondSleepTimeOff); GPIO.cleanup()
GPIO.output(pin, GPIO.LOW) time.sleep(gapSleepTime);
conditional_block
propagate-approximated-shorter-to-static-no-bound.rs
// Test a case where we are trying to prove `'x: 'y` and are forced to // approximate the shorter end-point (`'y`) to with `'static`. This is // because `'y` is higher-ranked but we know of no relations to other // regions. Note that `'static` shows up in the stderr output as `'0`. // compile-flags:-Zborrowck=mir -Zve...
where F: for<'x, 'y> FnMut( &Cell<&'a &'x u32>, // shows that 'x: 'a &Cell<&'x u32>, &Cell<&'y u32>, ), { } fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u32) {} #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { estab...
fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F)
random_line_split
propagate-approximated-shorter-to-static-no-bound.rs
// Test a case where we are trying to prove `'x: 'y` and are forced to // approximate the shorter end-point (`'y`) to with `'static`. This is // because `'y` is higher-ranked but we know of no relations to other // regions. Note that `'static` shows up in the stderr output as `'0`. // compile-flags:-Zborrowck=mir -Zve...
<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { //~^ ERROR borrowed data escapes outside of function // Only works if 'x: 'y: demand_y(x, y, x.get()) }); } fn main() {}
supply
identifier_name
propagate-approximated-shorter-to-static-no-bound.rs
// Test a case where we are trying to prove `'x: 'y` and are forced to // approximate the shorter end-point (`'y`) to with `'static`. This is // because `'y` is higher-ranked but we know of no relations to other // regions. Note that `'static` shows up in the stderr output as `'0`. // compile-flags:-Zborrowck=mir -Zve...
#[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { //~^ ERROR borrowed data escapes outside of function // Only works if 'x: 'y: demand_y(x, y, x.get()) }); } fn main() {}
{}
identifier_body
e2ePlugin.ts
/// /// Copyright 2015-2017 Red Hat, Inc. and/or its affiliates /// and other contributors as indicated by the @author tags. /// /// 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 /// /// ...
else if (input > dayRange) { let hours = input / hourRange; return Math.floor(hours / 24) + 'd ' + (hideSecondary ? '' : numberFilter(Math.floor(hours % 24), 0) + 'h'); } else if (input > hourRange) { let minutes = input / minuteRange; return Math.floor(minut...
{ let days = input / dayRange; return Math.floor(days / 7) + 'w ' + (hideSecondary ? '' : numberFilter(Math.floor(days % 7), 0) + 'd'); }
conditional_block
e2ePlugin.ts
/// /// Copyright 2015-2017 Red Hat, Inc. and/or its affiliates /// and other contributors as indicated by the @author tags. /// /// 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 /// /// ...
// Doesn't link an empty block }]); _module.filter('hkDuration', function (limitToFilter, numberFilter) { let milliRange = 1000; let secondRange = 1000 * milliRange; let minuteRange = 60 * secondRange; let hourRange = 60 * minuteRange; let dayRange = 24 * hourRange; let week...
export var _module = angular.module(E2E.pluginName, ['ui.bootstrap', 'patternfly.select']); _module.config(['$locationProvider', '$routeProvider', 'HawtioNavBuilderProvider', ($locationProvider, $routeProvider: ng.route.IRouteProvider, builder: HawtioMainNav.BuilderFactory) => {
random_line_split
astropyautosummary.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension builds off of `sphinx.ext.autosummary` to clean up some issues it presents in the Astropy docs. The main issue this fixes is the summary tables getting cut off before the end of the sentence in some cases. Note: Sphinx 1.2 appea...
(self, names): """Try to import the given names, and return a list of ``[(name, signature, summary_string, real_name), ...]``. """ from sphinx.ext.autosummary import (get_import_prefixes_from_env, import_by_name, get_documenter, mangle_signature) env = self.state.doc...
get_items
identifier_name
astropyautosummary.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension builds off of `sphinx.ext.autosummary` to clean up some issues it presents in the Astropy docs. The main issue this fixes is the summary tables getting cut off before the end of the sentence in some cases. Note: Sphinx 1.2 appea...
elif doc: summary = doc[0].strip() else: summary = '' items.append((display_name, sig, summary, real_name)) return items def setup(app): # need autosummary, of course app.setup_extension('sphinx.ext.autosummary') # Don't make ...
summary = m.group(1).strip()
conditional_block
astropyautosummary.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension builds off of `sphinx.ext.autosummary` to clean up some issues it presents in the Astropy docs. The main issue this fixes is the summary tables getting cut off before the end of the sentence in some cases. Note: Sphinx 1.2 appea...
self.warn('[astropyautosummary] failed to import %s' % name) items.append((name, '', '', name)) continue # to accommodate Sphinx v1.2.2 and v1.2.3 if len(import_by_name_values) == 3: real_name, obj, parent = import_by_name_values ...
random_line_split
astropyautosummary.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension builds off of `sphinx.ext.autosummary` to clean up some issues it presents in the Astropy docs. The main issue this fixes is the summary tables getting cut off before the end of the sentence in some cases. Note: Sphinx 1.2 appea...
app.setup_extension('sphinx.ext.autosummary') # Don't make the replacement if Sphinx is at least 1.2 if LooseVersion(sphinx.__version__) < LooseVersion('1.2.0'): # this replaces the default autosummary with the astropy one app.add_directive('autosummary', AstropyAutosummary)
identifier_body
validate.utils.ts
import { err } from './log.utils'; import { DateFormat } from './format.utils'; const NUMERIC_EXP = /^[0-9]*$/; const ALPHANUMERIC_EXP = /^[a-z0-9]*$/i; /** * Checks whether a given value is not `null` or * `undefined`. * * @export * @param {*} val * @returns boolean */ export function isValue ( val:any ) { ...
const length = val.toString().length; return min <= length && length <= max; } /** * Check wheter date is correctly formated. * * @export * @param {string} date * @param {DateFormat} format * @returns */ export function isDate ( date:string|number, format:DateFormat ) { if ( !isValue(format) ) { re...
{ err(`Expected "min" and "max" to be positive integers, got [${min}, ${max}]`); }
conditional_block
validate.utils.ts
import { err } from './log.utils'; import { DateFormat } from './format.utils'; const NUMERIC_EXP = /^[0-9]*$/; const ALPHANUMERIC_EXP = /^[a-z0-9]*$/i; /** * Checks whether a given value is not `null` or * `undefined`. * * @export * @param {*} val * @returns boolean */ export function
( val:any ) { return typeof val !== 'undefined' && val !== null; } /** * Checks whether a given value is alphanumeric. * * @export * @param {(string|number)} val * @returns boolean */ export function isAlphanumeric ( val:string|number ) { return isValue(val) && ALPHANUMERIC_EXP.test(val.toString()); } ...
isValue
identifier_name
validate.utils.ts
import { err } from './log.utils'; import { DateFormat } from './format.utils'; const NUMERIC_EXP = /^[0-9]*$/; const ALPHANUMERIC_EXP = /^[a-z0-9]*$/i; /** * Checks whether a given value is not `null` or * `undefined`. * * @export * @param {*} val * @returns boolean */ export function isValue ( val:any ) { ...
{ if ( !isValue(format) ) { return true; } return isNumeric(date) && hasLength(date, DateFormat[format].length); }
identifier_body
validate.utils.ts
import { err } from './log.utils'; import { DateFormat } from './format.utils'; const NUMERIC_EXP = /^[0-9]*$/; const ALPHANUMERIC_EXP = /^[a-z0-9]*$/i; /** * Checks whether a given value is not `null` or * `undefined`. * * @export * @param {*} val * @returns boolean */ export function isValue ( val:any ) { ...
* Check wheter date is correctly formated. * * @export * @param {string} date * @param {DateFormat} format * @returns */ export function isDate ( date:string|number, format:DateFormat ) { if ( !isValue(format) ) { return true; } return isNumeric(date) && hasLength(date, DateFormat[format].length); }
/**
random_line_split
suggest.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(a: ISuggestionItem, b: ISuggestionItem): number { if (a.suggestion.type !== b.suggestion.type) { if (a.suggestion.type === 'snippet') { return -1; } else if (b.suggestion.type === 'snippet') { return 1; } } return defaultComparator(a, b); } function snippetDownComparator(a: ISuggestionItem, b: ISuggest...
snippetUpComparator
identifier_name
suggest.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
const factory = supports.map(supports => () => { // for each support in the group ask for suggestions return Promise.all(supports.map(support => { if (!isFalsyOrEmpty(onlyFrom) && onlyFrom.indexOf(support) < 0) { return undefined; } return Promise.resolve(support.provideCompletionItems(model, positi...
// add suggestions from contributed providers - providers are ordered in groups of // equal score and once a group produces a result the process stops let hasResult = false;
random_line_split
suggest.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
function defaultComparator(a: ISuggestionItem, b: ISuggestionItem): number { let ret = 0; // check with 'sortText' if (typeof a.suggestion.sortText === 'string' && typeof b.suggestion.sortText === 'string') { ret = compareIgnoreCase(a.suggestion.sortText, b.suggestion.sortText); } // check with 'label' if (...
{ if (snippetConfig === 'none') { return suggestion => suggestion.type !== 'snippet'; } else { return () => true; } }
identifier_body
Signal.py
#!/usr/bin/python3 ################################################################################ # # Copyright 2014 Stjepan Henc <sthenc@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 Lic...
elif len(args) == 2: # args[0] is a signal, args[1] is sample freq. self.LoadWF(args(0), args(1))
random_line_split
Signal.py
#!/usr/bin/python3 ################################################################################ # # Copyright 2014 Stjepan Henc <sthenc@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 Lic...
(self, waveform, fs): self.s = waveform self.fs = fs self.sLength, self.nChans = self.s.shape def __init__(self, *args): #signal properties self.singlePrecision = 0 self.s = np.array([]) self.fs = 44100 self.sLength = 0 self.nChan...
LoadWF
identifier_name
Signal.py
#!/usr/bin/python3 ################################################################################ # # Copyright 2014 Stjepan Henc <sthenc@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 Lic...
elif len(args) == 2: # args[0] is a signal, args[1] is sample freq. self.LoadWF(args(0), args(1))
self.__dict__ = copy.deepcopy(args[0].__dict__)
conditional_block
Signal.py
#!/usr/bin/python3 ################################################################################ # # Copyright 2014 Stjepan Henc <sthenc@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 Lic...
def LoadWF(self, waveform, fs): self.s = waveform self.fs = fs self.sLength, self.nChans = self.s.shape def __init__(self, *args): #signal properties self.singlePrecision = 0 self.s = np.array([]) self.fs = 44100 self.sLength = 0 ...
self.fs, self.s = wav.read(file) self.sLength, self.nChans = self.s.shape
identifier_body
unique-send-2.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let (tx, rx) = channel(); let n = 100u; let mut expected = 0u; let _t = range(0u, n).map(|i| { expected += i; let tx = tx.clone(); Thread::scoped(move|| { child(&tx, i) }) }).collect::<Vec<_>>(); let mut actual = 0u; for _ in range(0u, n) { ...
identifier_body
unique-send-2.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 ...
(tx: &Sender<Box<uint>>, i: uint) { tx.send(box i).unwrap(); } pub fn main() { let (tx, rx) = channel(); let n = 100u; let mut expected = 0u; let _t = range(0u, n).map(|i| { expected += i; let tx = tx.clone(); Thread::scoped(move|| { child(&tx, i) }) ...
child
identifier_name
unique-send-2.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 ...
use std::thread::Thread; fn child(tx: &Sender<Box<uint>>, i: uint) { tx.send(box i).unwrap(); } pub fn main() { let (tx, rx) = channel(); let n = 100u; let mut expected = 0u; let _t = range(0u, n).map(|i| { expected += i; let tx = tx.clone(); Thread::scoped(move|| { ...
#![allow(unknown_features)] #![feature(box_syntax)] use std::sync::mpsc::{channel, Sender};
random_line_split
parsemode.py
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2016 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
(object): """This object represents a Telegram Message Parse Modes.""" MARKDOWN = 'Markdown' HTML = 'HTML'
ParseMode
identifier_name
parsemode.py
#!/usr/bin/env python # pylint: disable=R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2016 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public L...
"""This object represents a Telegram Message Parse Modes.""" MARKDOWN = 'Markdown' HTML = 'HTML'
identifier_body