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
signalfd.rs
//! Interface for the `signalfd` syscall. //! //! # Signal discarding //! When a signal can't be delivered to a process (or thread), it will become a pending signal. //! Failure to deliver could happen if the signal is blocked by every thread in the process or if //! the signal handler is still handling a previous sign...
#[test] fn check_siginfo_size() { assert_eq!(mem::size_of::<libc::signalfd_siginfo>(), SIGNALFD_SIGINFO_SIZE); } #[test] fn create_signalfd() { let mask = SigSet::empty(); let fd = SignalFd::new(&mask); assert!(fd.is_ok()); } #[test] fn create_signalfd...
use super::*; use std::mem; use libc;
random_line_split
setup.py
from distutils.core import setup long_description = """ `termtool` helps you write subcommand-based command line tools in Python. It collects several Python libraries into a declarative syntax:
* `progressbar <http://code.google.com/p/python-progressbar/>`_, a handy module for displaying progress bars. * `logging`, the simple built-in module for logging messages. """ setup( name='termtool', version='1.1', description='Declarative terminal tool programming', author='Mark Paschal', author_...
* `argparse`, the argument parsing module with subcommand support provided in the standard library in Python 2.7 and later. * `prettytable <http://code.google.com/p/python-progressbar/>`_, an easy module for building tables of information.
random_line_split
cest.py
# Copyright (C) 2013 Renato Lima - Akretion <renato.lima@akretion.com.br> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models from ..constants.fiscal import CEST_SEGMENT from ..tools import misc class
(models.Model): _name = "l10n_br_fiscal.cest" _inherit = "l10n_br_fiscal.data.product.abstract" _description = "CEST" code = fields.Char(size=9) code_unmasked = fields.Char(size=7) name = fields.Text(string="Name", required=True, index=True) item = fields.Char(string="Item", required=Tru...
Cest
identifier_name
cest.py
# Copyright (C) 2013 Renato Lima - Akretion <renato.lima@akretion.com.br> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models from ..constants.fiscal import CEST_SEGMENT from ..tools import misc class Cest(models.Model):
relation="fiscal_cest_ncm_rel", column1="cest_id", column2="ncm_id", readonly=True, string="NCMs", ) tax_definition_ids = fields.Many2many( comodel_name="l10n_br_fiscal.tax.definition", relation="tax_definition_cest_rel", column1="cest_id", ...
_name = "l10n_br_fiscal.cest" _inherit = "l10n_br_fiscal.data.product.abstract" _description = "CEST" code = fields.Char(size=9) code_unmasked = fields.Char(size=7) name = fields.Text(string="Name", required=True, index=True) item = fields.Char(string="Item", required=True) segment = fi...
identifier_body
cest.py
# Copyright (C) 2013 Renato Lima - Akretion <renato.lima@akretion.com.br> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models from ..constants.fiscal import CEST_SEGMENT from ..tools import misc class Cest(models.Model): _name = "l10n_br_fiscal.cest" _inher...
return create_super def write(self, values): write_super = super(Cest, self).write(values) do_not_write = self.env.context.get("do_not_write") if "ncms" in values.keys() and not do_not_write: self.with_context(do_not_write=True).action_search_ncms() return write...
create_super.with_context(do_not_write=True).action_search_ncms()
conditional_block
cest.py
# Copyright (C) 2013 Renato Lima - Akretion <renato.lima@akretion.com.br> # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, fields, models from ..constants.fiscal import CEST_SEGMENT from ..tools import misc class Cest(models.Model): _name = "l10n_br_fiscal.cest" _inher...
def action_search_ncms(self): ncm = self.env["l10n_br_fiscal.ncm"] for r in self: if r.ncms: domain = misc.domain_field_codes(field_codes=r.ncms) r.ncm_ids = ncm.search(domain)
self.with_context(do_not_write=True).action_search_ncms() return write_super
random_line_split
builtin-success-return-val.js
// Copyright (C) 2015 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: Return value after successful match es6id: 21.2.5.6 info: > [...] 5. Let global be ToBoolean(Get(rx, "global")). 6. ReturnIfAbrupt(global). 7. If ...
assert(Array.isArray(result)); assert.sameValue(result.index, 1); assert.sameValue(result.input, 'abcd'); assert.sameValue(result.length, 1); assert.sameValue(result[0], 'bc');
---*/ var result = /b./[Symbol.match]('abcd');
random_line_split
DialogFieldStatic.ts
///<reference path='AbstractDialogField.ts'/> /* * The MIT License (MIT) * Copyright (c) 2016 Heat Ledger Ltd. * * 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, inc...
}) class DialogFieldStaticComponent {}
</md-input-container> </ng-form> `
random_line_split
DialogFieldStatic.ts
///<reference path='AbstractDialogField.ts'/> /* * The MIT License (MIT) * Copyright (c) 2016 Heat Ledger Ltd. * * 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, inc...
($scope, name: string, _default?: any) { super($scope, name, _default || ''); this.selector('field-static'); } } @Component({ selector: 'fieldStatic', inputs: ['label','value','changed','f'], template: ` <ng-form name="userForm" layout="row" ng-show="vm.f._visible"> <md-input-container class=...
constructor
identifier_name
DialogFieldStatic.ts
///<reference path='AbstractDialogField.ts'/> /* * The MIT License (MIT) * Copyright (c) 2016 Heat Ledger Ltd. * * 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, inc...
} @Component({ selector: 'fieldStatic', inputs: ['label','value','changed','f'], template: ` <ng-form name="userForm" layout="row" ng-show="vm.f._visible"> <md-input-container class="md-block" flex ng-class="{'async-validator-pending':userForm.userField.$pending}"> <label ng-if="vm.label">{{vm...
{ super($scope, name, _default || ''); this.selector('field-static'); }
identifier_body
texture.rs
} pub struct Solid { pub m: Box<dyn MaterialModel + Sync + Send> } impl Medium for Solid { fn material_at(&self, _pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send> { &self.m } } pub struct CheckeredYPlane { pub m1: Box<dyn MaterialModel + Sync + Send>, pub m2: Box<dyn MaterialMod...
use na::{Vector3}; use material::model::MaterialModel; pub trait Medium : Sync{ fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>;
random_line_split
texture.rs
use na::{Vector3}; use material::model::MaterialModel; pub trait Medium : Sync{ fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>; } pub struct Solid { pub m: Box<dyn MaterialModel + Sync + Send> } impl Medium for Solid { fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy...
}
{ let zig = if (pt[0].abs() / self.xsize) as i32 % 2 == 0 { pt[0] > 0. } else { pt[0] <= 0. }; let zag = if (pt[2].abs() / self.zsize) as i32 % 2 == 0 { pt[2] > 0. } else { pt[2] <= 0. }; // zig XOR zag return if !zig != !zag { &self.m1 } else { &self.m2 }; }
identifier_body
texture.rs
use na::{Vector3}; use material::model::MaterialModel; pub trait Medium : Sync{ fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>; } pub struct Solid { pub m: Box<dyn MaterialModel + Sync + Send> } impl Medium for Solid { fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy...
else { pt[2] <= 0. }; // zig XOR zag return if !zig != !zag { &self.m1 } else { &self.m2 }; } }
{ pt[2] > 0. }
conditional_block
texture.rs
use na::{Vector3}; use material::model::MaterialModel; pub trait Medium : Sync{ fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>; } pub struct Solid { pub m: Box<dyn MaterialModel + Sync + Send> } impl Medium for Solid { fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy...
(m1: Box<dyn MaterialModel + Sync + Send>, m2: Box<dyn MaterialModel + Sync + Send>, xsize: f64, zsize: f64) -> CheckeredYPlane { CheckeredYPlane { m1, m2, xsize, zsize} } } impl Medium for CheckeredYPlane { fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send> { let ...
new
identifier_name
models.py
# -*- coding: utf-8 -*- # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from datetime import datetime from django.core.mail import send_mail, mail_managers from django.conf import settings from django.contrib.sit...
def price_per_items(self, items): return self.cost_const + items * self.total_per_item() class Order(models.Model): """ A person paying for a book. The payment was completed if and only if payed_at is set. """ offer = models.ForeignKey(Offer, models.CASCADE, verbose_name=_('offer')) ...
eturn self.price + self.cost_per_item
identifier_body
models.py
# -*- coding: utf-8 -*- # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from datetime import datetime from django.core.mail import send_mail, mail_managers from django.conf import settings from django.contrib.sit...
name = models.CharField(_('name'), max_length=127, blank=True) email = models.EmailField(_('email'), db_index=True) address = models.TextField(_('address'), db_index=True) payed_at = models.DateTimeField(_('payed at'), null=True, blank=True, db_index=True) language_code = models.CharField(max_length...
""" offer = models.ForeignKey(Offer, models.CASCADE, verbose_name=_('offer')) items = models.IntegerField(verbose_name=_('items'), default=1)
random_line_split
models.py
# -*- coding: utf-8 -*- # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from datetime import datetime from django.core.mail import send_mail, mail_managers from django.conf import settings from django.contrib.sit...
with override(app_settings.DEFAULT_LANGUAGE): mail_managers(subject, render_to_string(template_name, context)) # Register the Order model with django-getpaid for payments. getpaid.register_to_payment(Order, unique=False, related_name='payment') def new_payment_query_listener(sender, order=None, p...
ontext.update(extra_context)
conditional_block
models.py
# -*- coding: utf-8 -*- # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from datetime import datetime from django.core.mail import send_mail, mail_managers from django.conf import settings from django.contrib.sit...
self, subject, template_name, extra_context=None): context = { 'order': self, 'site': Site.objects.get_current(), } if extra_context: context.update(extra_context) with override(app_settings.DEFAULT_LANGUAGE): mail_managers(subject, render_...
otify_managers(
identifier_name
osyczka2.py
from model import Model from helpers.candidate import Candidate from helpers.decision import Decision class Osyczka2(Model): def __init__(self): Model.__init__(self) self.initialize_decs() def initialize_decs(self): dec = Decision('x1', 0, 10) self.decs.append(dec) de...
return False x1 = candidate.dec_vals[0] x2 = candidate.dec_vals[1] x3 = candidate.dec_vals[2] x4 = candidate.dec_vals[3] x5 = candidate.dec_vals[4] x6 = candidate.dec_vals[5] if not ((x1 + x2) >= 2): if debug: print "Faile...
def ok(self, candidate, debug=False): if len(candidate.dec_vals) != 6:
random_line_split
osyczka2.py
from model import Model from helpers.candidate import Candidate from helpers.decision import Decision class Osyczka2(Model): def __init__(self): Model.__init__(self) self.initialize_decs() def initialize_decs(self): dec = Decision('x1', 0, 10) self.decs.append(dec) de...
(self, candidate, debug=False): if len(candidate.dec_vals) != 6: return False x1 = candidate.dec_vals[0] x2 = candidate.dec_vals[1] x3 = candidate.dec_vals[2] x4 = candidate.dec_vals[3] x5 = candidate.dec_vals[4] x6 = candidate.dec_vals[5] i...
ok
identifier_name
osyczka2.py
from model import Model from helpers.candidate import Candidate from helpers.decision import Decision class Osyczka2(Model): def __init__(self): Model.__init__(self) self.initialize_decs() def initialize_decs(self): dec = Decision('x1', 0, 10) self.decs.append(dec) de...
def gen_candidate(self): for i in range(0, self.patience): decs = [dec.generate_valid_val() for dec in self.decs] can = Candidate(dec_vals=list(decs)) if self.ok(can): return can def ok(self, candidate, debug=False): if len(candidate.dec_va...
aggr = 0 self.eval(candidate) for score in candidate.scores: aggr += score return aggr
identifier_body
osyczka2.py
from model import Model from helpers.candidate import Candidate from helpers.decision import Decision class Osyczka2(Model): def __init__(self): Model.__init__(self) self.initialize_decs() def initialize_decs(self): dec = Decision('x1', 0, 10) self.decs.append(dec) de...
return False if not ((x1 + x2) <= 6): if debug: print "Failed 2" return False if not ((x2 - x1) <= 2): if debug: print "Failed 3" return False if not ((x1 - (3 * x2)) <= 2): if debug: ...
print "Failed 1"
conditional_block
test_sass_to_scss.py
import logging from unittest import TestCase from sass_to_scss import SassToSCSS class TestSassToSCSS(TestCase): def setUp(self): self.sassy = SassToSCSS(loglevel=logging.DEBUG) def trim_docstring(self, docstring): return '\n'.join(docstring.split('\n')[1:-1]) def test_double_spaces(sel...
def test_triple_nested_class(self): sass = """ @import bourbon/bourbon @import "http://fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic|Oswald:400,300,700|Droid+Sans:400,700" $teal: #00917d $serif: 'PT Serif', serif =red-text color: red background-color: $teal =rounded($amou...
self.sassy.spaces = 2 sass = """ body background: red header background: blue """ scss = """ body { background: red; header { background: blue; } } """ actual = self.sassy.convert(self.trim_docstring(sass).split('\n')) expected = self.trim_docstring(scss) self....
identifier_body
test_sass_to_scss.py
import logging from unittest import TestCase from sass_to_scss import SassToSCSS class TestSassToSCSS(TestCase): def setUp(self): self.sassy = SassToSCSS(loglevel=logging.DEBUG) def trim_docstring(self, docstring): return '\n'.join(docstring.split('\n')[1:-1]) def test_double_spaces(sel...
color: blue; } } .left { left: 0; h1 { color: red; } } } """ actual = self.sassy.convert(self.trim_docstring(sass).split('\n')) expected = self.trim_docstring(scss) self.assertEquals(expected, actual)
random_line_split
test_sass_to_scss.py
import logging from unittest import TestCase from sass_to_scss import SassToSCSS class TestSassToSCSS(TestCase): def setUp(self): self.sassy = SassToSCSS(loglevel=logging.DEBUG) def trim_docstring(self, docstring): return '\n'.join(docstring.split('\n')[1:-1]) def test_double_spaces(sel...
(self): sass = """ @import bourbon/bourbon @import "http://fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic|Oswald:400,300,700|Droid+Sans:400,700" $teal: #00917d $serif: 'PT Serif', serif =red-text color: red background-color: $teal =rounded($amount, $background_color) -moz-bo...
test_triple_nested_class
identifier_name
hooks.py
from contextlib import ContextDecorator from operator import itemgetter from wagtail.utils.apps import get_app_submodules _hooks = {} def register(hook_name, fn=None, order=0): """ Register hook for ``hook_name``. Can be used as a decorator:: @register('hook_name') def my_hook(...): ...
(self): if self.hook_name not in _hooks: _hooks[self.hook_name] = [] _hooks[self.hook_name].append((self.fn, self.order)) def __exit__(self, exc_type, exc_value, traceback): _hooks[self.hook_name].remove((self.fn, self.order)) def register_temporarily(hook_name, fn, order=0): ...
__enter__
identifier_name
hooks.py
from contextlib import ContextDecorator from operator import itemgetter from wagtail.utils.apps import get_app_submodules _hooks = {} def register(hook_name, fn=None, order=0): """ Register hook for ``hook_name``. Can be used as a decorator:: @register('hook_name') def my_hook(...): ...
if fn is None: def decorator(fn): register(hook_name, fn, order=order) return fn return decorator if hook_name not in _hooks: _hooks[hook_name] = [] _hooks[hook_name].append((fn, order)) class TemporaryHook(ContextDecorator): def __init__(self, hook_nam...
# Pretend to be a decorator if fn is not supplied
random_line_split
hooks.py
from contextlib import ContextDecorator from operator import itemgetter from wagtail.utils.apps import get_app_submodules _hooks = {} def register(hook_name, fn=None, order=0): """ Register hook for ``hook_name``. Can be used as a decorator:: @register('hook_name') def my_hook(...): ...
_hooks[self.hook_name].append((self.fn, self.order)) def __exit__(self, exc_type, exc_value, traceback): _hooks[self.hook_name].remove((self.fn, self.order)) def register_temporarily(hook_name, fn, order=0): """ Register hook for ``hook_name`` temporarily. This is useful for testing hook...
_hooks[self.hook_name] = []
conditional_block
hooks.py
from contextlib import ContextDecorator from operator import itemgetter from wagtail.utils.apps import get_app_submodules _hooks = {} def register(hook_name, fn=None, order=0): """ Register hook for ``hook_name``. Can be used as a decorator:: @register('hook_name') def my_hook(...): ...
def register_temporarily(hook_name, fn, order=0): """ Register hook for ``hook_name`` temporarily. This is useful for testing hooks. Can be used as a decorator:: def my_hook(...): pass class TestMyHook(Testcase): @hooks.register_temporarily('hook_name', my_hook)...
def __init__(self, hook_name, fn, order): self.hook_name = hook_name self.fn = fn self.order = order def __enter__(self): if self.hook_name not in _hooks: _hooks[self.hook_name] = [] _hooks[self.hook_name].append((self.fn, self.order)) def __exit__(self, exc...
identifier_body
chain.rs
// Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level // directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // optio...
, Nil => return res, } } } /// Returns a pointer to the first element in the chain. pub fn first(& self) -> Option<(& Val, & Term)> { use self::Chain::* ; match * self { Cons(ref val, ref term, _, _) => Some( (val, term) ), Nil => None, } } /** Checks if a chain is em...
{ res = Some( (val, term) ) ; chain = & ** tail }
conditional_block
chain.rs
// Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level // directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // optio...
< T, F: Fn(T, & Val, & Term, & Info) -> T >(& self, init: T, f: F) -> T { use self::Chain::* ; let mut chain = self ; let mut val = init ; while let Cons(ref v, ref trm, ref inf, ref tail) = * chain { val = f(val, v, trm, inf) ; chain = & * tail } val } /** Returns the lon...
fold
identifier_name
chain.rs
// Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level // directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // optio...
} /** Reverses a chain. */ #[inline] pub fn rev(self) -> Self { self.rev_append(Chain::Nil) } } impl<Val: Domain> Chain<Val, TermSet> { /** Maps to `Chain<Val, ()>`, calling a function on each element. */ pub fn map_to_unit< Input, F: Fn(& mut Input, Val, Term, TermSet) >(mut self, f: F, i: & mu...
self = * tail } that
random_line_split
chain.rs
// Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level // directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // optio...
/// Returns a pointer to the first element in the chain. pub fn first(& self) -> Option<(& Val, & Term)> { use self::Chain::* ; match * self { Cons(ref val, ref term, _, _) => Some( (val, term) ), Nil => None, } } /** Checks if a chain is empty. */ #[inline] pub fn is_empty(& self) ...
{ use self::Chain::* ; let mut chain = self ; let mut res = None ; loop { match * chain { Cons(ref val, ref term, _, ref tail) => { res = Some( (val, term) ) ; chain = & ** tail }, Nil => return res, } } }
identifier_body
inequalities-trend-table.component.ts
import { Component, OnChanges, Input, SimpleChanges } from '@angular/core'; import { TrendTableData, TrendTableDataFormatted, InequalityValueData } from '../inequalities'; import { FTHelperService } from '../../shared/service/helper/ftHelper.service'; import { ValueData, InequalitiesTrendsTableTooltip } from '../../typ...
} class InequalitiesTrendTableValueDataTooltip implements InequalitiesTrendsTableTooltip { ftHelper: FTHelperService; valueData: ValueData; constructor(ftHelper: FTHelperService, data: ValueData) { this.ftHelper = ftHelper; this.valueData = data; } getTooltipMessage(): any { let htmlTooltipMes...
{ this.tooltipHelper.reposition(event); }
identifier_body
inequalities-trend-table.component.ts
import { Component, OnChanges, Input, SimpleChanges } from '@angular/core'; import { TrendTableData, TrendTableDataFormatted, InequalityValueData } from '../inequalities'; import { FTHelperService } from '../../shared/service/helper/ftHelper.service'; import { ValueData, InequalitiesTrendsTableTooltip } from '../../typ...
(): string { if (this.trendTableData.length > 0) { return this.trendTableData[0].trendSource; } return ''; } getNumberOfColumnsToSpan(): number { return this.numberOfColumns + 1; } public showRecentTrendTooltip(event: MouseEvent, valueData: ValueData) { if (isDefined(valueData.Note)...
getTrendSource
identifier_name
inequalities-trend-table.component.ts
import { Component, OnChanges, Input, SimpleChanges } from '@angular/core'; import { TrendTableData, TrendTableDataFormatted, InequalityValueData } from '../inequalities'; import { FTHelperService } from '../../shared/service/helper/ftHelper.service'; import { ValueData, InequalitiesTrendsTableTooltip } from '../../typ...
numberOfColumns: number; tooltipHelper: TooltipHelper; currentTrendsTooltipHtml: string; constructor(private ftHelper: FTHelperService) { } ngOnChanges(changes: SimpleChanges) { if (changes['trendTableData']) { if (this.trendTableData.length > 0) { this.generateColumnHeaders(); thi...
columnHeaders: string[]; rowData: TrendTableDataFormatted[];
random_line_split
inequalities-trend-table.component.ts
import { Component, OnChanges, Input, SimpleChanges } from '@angular/core'; import { TrendTableData, TrendTableDataFormatted, InequalityValueData } from '../inequalities'; import { FTHelperService } from '../../shared/service/helper/ftHelper.service'; import { ValueData, InequalitiesTrendsTableTooltip } from '../../typ...
this.rowData.push(data); this.numberOfColumns = j; } this.tooltipHelper = new TooltipHelper(this.ftHelper.newTooltipManager()); } getTrendSource(): string { if (this.trendTableData.length > 0) { return this.trendTableData[0].trendSource; } return ''; } getNumberOfColum...
{ let value = this.trendTableData[j].valueData[i].ValF; if (value !== '-') { value = value + this.trendTableData[j].unitLabel; } const valF = new CommaNumber(value).unrounded(); const trendValueData = new InequalityValueData(this.ftHelper, valF, this.trendTabl...
conditional_block
remove-circle.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDefault(_SvgIcon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ContentRemoveCircle = function ContentRemoveCircle(props) { return _react2.defa...
random_line_split
remove-circle.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDe...
var ContentRemoveCircle = function ContentRemoveCircle(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z' }) ); }; ContentRemoveCircle = (0, _pure2.defa...
{ return obj && obj.__esModule ? obj : { default: obj }; }
identifier_body
remove-circle.js
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _SvgIcon = require('../../SvgIcon'); var _SvgIcon2 = _interopRequireDe...
(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ContentRemoveCircle = function ContentRemoveCircle(props) { return _react2.default.createElement( _SvgIcon2.default, props, _react2.default.createElement('path', { d: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5...
_interopRequireDefault
identifier_name
issue-14456.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
test(); let (tx, rx) = channel(); native::task::spawn(proc() { tx.send(test()); }); rx.recv(); } fn child() { io::stdout().write_line("foo").unwrap(); io::stderr().write_line("bar").unwrap(); assert_eq!(io::stdin().read_line().err().unwrap().kind, io::EndOfFile); } fn test(...
{ return child() }
conditional_block
issue-14456.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let mut p = Command::new(args.get(0).as_slice()).arg("child") .stdin(process::Ignored) .stdout(process::Ignored) .stderr(process::Ignored) .spawn().unwrap(); assert...
fn test() { let args = os::args();
random_line_split
issue-14456.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let args = os::args(); let mut p = Command::new(args.get(0).as_slice()).arg("child") .stdin(process::Ignored) .stdout(process::Ignored) .stderr(process::Ignored) ...
test
identifier_name
issue-14456.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn child() { io::stdout().write_line("foo").unwrap(); io::stderr().write_line("bar").unwrap(); assert_eq!(io::stdin().read_line().err().unwrap().kind, io::EndOfFile); } fn test() { let args = os::args(); let mut p = Command::new(args.get(0).as_slice()).arg("child") ...
{ let args = os::args(); if args.len() > 1 && args.get(1).as_slice() == "child" { return child() } test(); let (tx, rx) = channel(); native::task::spawn(proc() { tx.send(test()); }); rx.recv(); }
identifier_body
subscription.d.ts
import { PricingInstance, Tax } from '.'; import { Address } from '../address'; import { PricingPromise } from './promise'; export type PlanOptions = { quantity?: number; }; export type AddonOptions = { quantity?: number; }; export type SubscriptionPricingStateTax = { tax_type: string; region: string;
}; export type SubscriptionPricingState = { price: { now: { subtotal: string; plan: string; addons: string; setup_fee: string; discount: string; tax: string; total: string; }; next: { subtotal: string; plan: string; addons: string; setup_f...
rate: string;
random_line_split
InstrumentSelector.js
function InstrumentSelector(list) { this.instruments = list; this.currentInstrument; this.updateInstrumentView(); } InstrumentSelector.prototype.addInstrument = function (type, url, colorCode) { var l = this.instruments.push(new Instrument(type, url, colorCode)); this.createInstrumentView(l-1); } InstrumentSele...
} InstrumentSelector.prototype.createInstrumentView = function (index) { var bar = document.getElementById("instrumentBar"); var img = document.createElement("span"); img.className = "instrumentContainer"; img.id = this.instruments[index].instrumentName; img.style.backgroundImage = "url(" + this.instruments[ind...
random_line_split
InstrumentSelector.js
function
(list) { this.instruments = list; this.currentInstrument; this.updateInstrumentView(); } InstrumentSelector.prototype.addInstrument = function (type, url, colorCode) { var l = this.instruments.push(new Instrument(type, url, colorCode)); this.createInstrumentView(l-1); } InstrumentSelector.prototype.removeInstru...
InstrumentSelector
identifier_name
InstrumentSelector.js
function InstrumentSelector(list)
InstrumentSelector.prototype.addInstrument = function (type, url, colorCode) { var l = this.instruments.push(new Instrument(type, url, colorCode)); this.createInstrumentView(l-1); } InstrumentSelector.prototype.removeInstrument = function (type, url, colorCode) { this.instruments.push(new Instrument(type, url, co...
{ this.instruments = list; this.currentInstrument; this.updateInstrumentView(); }
identifier_body
InstrumentSelector.js
function InstrumentSelector(list) { this.instruments = list; this.currentInstrument; this.updateInstrumentView(); } InstrumentSelector.prototype.addInstrument = function (type, url, colorCode) { var l = this.instruments.push(new Instrument(type, url, colorCode)); this.createInstrumentView(l-1); } InstrumentSele...
} InstrumentSelector.prototype.setActiveInstrument = function (instrumentName) { this.currentInstrument = this.getInstrument(instrumentName); this.updateSelected(); } InstrumentSelector.prototype.getInstrument = function (instrumentName) { for (var i=0; i<this.instruments.length; i++) { // alert(this.instrument...
{ this.createInstrumentView(i); }
conditional_block
EmailSender.ts
/// <reference path='../typings/tsd.d.ts' /> interface IEmailTemplate { subject: string; bodyTemplate: string; vm: Object; } interface IEmailSenderOptions { api_key: string; domain: string; from: string; } class EmailSender { private options: IEmailSenderOptions; constructor (options...
(to: string, message: IEmailTemplate): void { this.send(to, message, true); } SendTemplateString(to: string, message: IEmailTemplate): void { this.send(to, message, false); } } module.exports = function(options: IEmailSenderOptions): EmailSender { return new EmailSender(options); };
SendTemplateFile
identifier_name
EmailSender.ts
/// <reference path='../typings/tsd.d.ts' /> interface IEmailTemplate { subject: string; bodyTemplate: string; vm: Object; } interface IEmailSenderOptions { api_key: string; domain: string; from: string; } class EmailSender { private options: IEmailSenderOptions; constructor (options...
SendTemplateString(to: string, message: IEmailTemplate): void { this.send(to, message, false); } } module.exports = function(options: IEmailSenderOptions): EmailSender { return new EmailSender(options); };
{ this.send(to, message, true); }
identifier_body
EmailSender.ts
/// <reference path='../typings/tsd.d.ts' /> interface IEmailTemplate { subject: string; bodyTemplate: string; vm: Object; } interface IEmailSenderOptions { api_key: string; domain: string; from: string; } class EmailSender { private options: IEmailSenderOptions; constructor (options...
to: to, message: messageSource }; mailgun.messages().sendMime(dataToSend); }); } SendTemplateFile(to: string, message: IEmailTemplate): void { this.send(to, message, true); } SendTemplateString(to: string, message: IEmailTemplat...
random_line_split
universal-cache.ts
import { Injectable, isDevMode } from '@angular/core'; @Injectable() export class CacheService { static KEY = 'CacheService'; _cache = new Map(); /** * check if there is a value in our store */ has(key: string | number): boolean { let _key = this.normalizeKey(key); return th...
/** * convert server json into out initial state */ rehydrate(json: any): void { Object.keys(json).forEach((key: string) => { let _key = this.normalizeKey(key); let value = json[_key]; this._cache.set(_key, value); }); } /** * allow JS...
return json; }
random_line_split
universal-cache.ts
import { Injectable, isDevMode } from '@angular/core'; @Injectable() export class Ca
static KEY = 'CacheService'; _cache = new Map(); /** * check if there is a value in our store */ has(key: string | number): boolean { let _key = this.normalizeKey(key); return this._cache.has(_key); } /** * store our state */ set(key: string | number, v...
cheService {
identifier_name
universal-cache.ts
import { Injectable, isDevMode } from '@angular/core'; @Injectable() export class CacheService { static KEY = 'CacheService'; _cache = new Map(); /** * check if there is a value in our store */ has(key: string | number): boolean { let _key = this.normalizeKey(key); return th...
return false; } /** * release memory refs */ clear(): void { this._cache.clear(); } /** * convert to json for the client */ dehydrate(): any { let json = {}; this._cache.forEach((value: any, key: string) => json[key] = value); return j...
this._cache.delete(_key); return true; }
conditional_block
universal-cache.ts
import { Injectable, isDevMode } from '@angular/core'; @Injectable() export class CacheService { static KEY = 'CacheService'; _cache = new Map(); /** * check if there is a value in our store */ has(key: string | number): boolean { let _key = this.normalizeKey(key); return th...
/** * convert to json for the client */ dehydrate(): any { let json = {}; this._cache.forEach((value: any, key: string) => json[key] = value); return json; } /** * convert server json into out initial state */ rehydrate(json: any): void { Object.k...
this._cache.clear(); }
identifier_body
__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) cgstudiomap <cgstudiomap@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms...
}
'installable': True,
random_line_split
gas-spill.spec.js
const Ava = require('ava') const Sinon = require('sinon') const { getCard } = require('../deck') const Junkyard = require('../junkyard') Ava.test('should cause a player to miss 2 turns.', (t) => { const announceCallback = Sinon.spy() const game = new Junkyard('player1', 'Jay', announceCallback) game.addPlayer('...
else if (player2.beforeTurn.length) { game.incrementTurn() t.is(game.discardPile.length, 0) game.incrementTurn() } else { t.fail() } t.is(game.discardPile.length, 1) t.true(announceCallback.calledWith('player:discard')) }) Ava.test('should discard when the affected player is removed', (t) => {...
{ t.is(player1.missTurns, 2) game.incrementTurn() game.incrementTurn() t.is(player1.missTurns, 1) t.is(game.discardPile.length, 0) game.incrementTurn() }
conditional_block
gas-spill.spec.js
const Ava = require('ava') const Sinon = require('sinon') const { getCard } = require('../deck') const Junkyard = require('../junkyard') Ava.test('should cause a player to miss 2 turns.', (t) => { const announceCallback = Sinon.spy() const game = new Junkyard('player1', 'Jay', announceCallback) game.addPlayer('...
Ava.test('should delay discarding', (t) => { const announceCallback = Sinon.spy() const game = new Junkyard('player1', 'Jay', announceCallback) game.addPlayer('player2', 'Kevin') game.start() const [player1, player2] = game.players const gasSpill = getCard('gas-spill') player1.hand.push(gasSpill) game.p...
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-07-25 15:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migration...
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('access_token', models.CharField(max_length=100)), ('username', models.CharField(max_length=256)), ('user', models.OneToOneField(on_delete=django.db.models....
name='GithubAccount', fields=[
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-07-25 15:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='GithubAccount', fields=[ ('id', models.AutoField(auto_created=True, primary_key=Tru...
Migration
identifier_name
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-07-25 15:51 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
]
initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='GithubAccount', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_n...
identifier_body
_collapse.js
(function ($) { /**
* Toggle the visibility of a fieldset using smooth animations. */ Drupal.toggleFieldset = function (fieldset) { var $toggle = $($(fieldset).find('[data-toggle=collapse]').data('target')); if ($toggle.length) { $toggle.collapse('toggle'); } }; /** * Scroll a given fieldset into view as much as possible. *...
random_line_split
_collapse.js
(function ($) { /** * Toggle the visibility of a fieldset using smooth animations. */ Drupal.toggleFieldset = function (fieldset) { var $toggle = $($(fieldset).find('[data-toggle=collapse]').data('target')); if ($toggle.length) { $toggle.collapse('toggle'); } }; /** * Scroll a given fieldset into view as...
var summary = $('<span class="summary"></span>'); $fieldset. bind('summaryUpdated', function () { var text = $.trim($fieldset.drupalGetSummary()); summary.html(text ? ' (' + text + ')' : ''); }) .trigger('summaryUpdated'); // Turn the legend into a clicka...
{ $fieldset.removeClass('collapsed'); }
conditional_block
pipes.ts
/* * Squidex Headless CMS * * @license * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ import { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { Subscription } from 'rxjs'; import { formatHistoryMessage, HistoryEventDto, UsersProviderService } from '@app/...
if (this.lastMessage !== event.message) { this.lastMessage = event.message; if (this.subscription) { this.subscription.unsubscribe(); } this.subscription = formatHistoryMessage(event.message, this.users).subscribe(value => { this...
return this.lastValue; }
conditional_block
pipes.ts
/* * Squidex Headless CMS * * @license * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ import { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { Subscription } from 'rxjs'; import { formatHistoryMessage, HistoryEventDto, UsersProviderService } from '@app/...
public ngOnDestroy() { if (this.subscription) { this.subscription.unsubscribe(); } } public transform(event: HistoryEventDto): string | null { if (!event) { return this.lastValue; } if (this.lastMessage !== event.message) { this....
}
identifier_body
pipes.ts
/* * Squidex Headless CMS * * @license * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ import { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { Subscription } from 'rxjs'; import { formatHistoryMessage, HistoryEventDto, UsersProviderService } from '@app/...
) { if (this.subscription) { this.subscription.unsubscribe(); } } public transform(event: HistoryEventDto): string | null { if (!event) { return this.lastValue; } if (this.lastMessage !== event.message) { this.lastMessage = event.mess...
gOnDestroy(
identifier_name
pipes.ts
/* * Squidex Headless CMS * * @license * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ import { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { Subscription } from 'rxjs'; import { formatHistoryMessage, HistoryEventDto, UsersProviderService } from '@app/...
return this.lastValue; } }
}); }
random_line_split
id.test.ts
import { testAll } from './utils'; import { Machine } from '../src'; const idMachine = Machine({ initial: 'A', states: { A: { id: 'A', initial: 'foo', states: { foo: { id: 'A_foo', on: { NEXT: '#A_bar' } }, bar: { id:...
() { return idMachine.states.A; }, get NEXT_DEEP() { return idMachine.states.A.states.foo; }, NEXT_TARGET: { get target() { return idMachine.states.B; } }, NEXT_TARGET_ARRAY: [ { get target() { ...
NEXT
identifier_name
id.test.ts
import { testAll } from './utils'; import { Machine } from '../src'; const idMachine = Machine({ initial: 'A', states: { A: { id: 'A', initial: 'foo', states: { foo: { id: 'A_foo', on: { NEXT: '#A_bar' } }, bar: { id:...
} ] } } } }); describe('State node IDs', () => { const expected = { A: { NEXT: 'A.bar', NEXT_DOT_RESOLVE: 'B.bar' }, '#A': { NEXT: 'A.bar' }, 'A.foo': { NEXT: 'A.bar' }, '#A_foo': { NEXT: 'A.bar' }, 'A.bar': { NEXT...
{ return idMachine.states.B; }
identifier_body
id.test.ts
import { testAll } from './utils'; import { Machine } from '../src'; const idMachine = Machine({ initial: 'A', states: { A: { id: 'A', initial: 'foo', states: { foo: { id: 'A_foo', on: { NEXT: '#A_bar' } }, bar: { id:...
id: 'foo' }, bar: { id: 'bar', states: { baz: {}, qux: { states: { quux: { id: '#bar.qux.quux' } } } } } } }); expect(brokenMac...
states: { foo: {
random_line_split
ncmd_server.py
#!/usr/bin/python import socket import os import time import shutil import sys import re import datetime import argparse # NCMD Libs import ncmd_print as np from ncmd_print import MessageLevel as MessageLevel import ncmd_commands as ncmds import ncmd_fileops as nfops MAX_TRANSFER_BYTES=2048 QUIT_CMD = "quit now" HOS...
# Only try and conduct file operations when validation is disabled, # or if validation is enabled, and it passes. if cmd_success: if ncmds.isMove(ncmd): for src in srcs: if not nfops.move(src, dest): cmd_success = False elif ncmds.isCopy(ncmd): for src in srcs: if not nfops.cop...
srcs_valid = validatePaths(srcs, args.validate_server_mount) dest_valid = validatePath(dest, args.validate_server_mount) cmd_success = srcs_valid and dest_valid
conditional_block
ncmd_server.py
#!/usr/bin/python import socket import os import time import shutil import sys import re import datetime import argparse # NCMD Libs import ncmd_print as np from ncmd_print import MessageLevel as MessageLevel import ncmd_commands as ncmds import ncmd_fileops as nfops MAX_TRANSFER_BYTES=2048 QUIT_CMD = "quit now" HOS...
def getArgs(): parser = argparse.ArgumentParser(description='Copy, move, remove quickly on a remotely mounted folder.') parser.add_argument('--port', type=int, help='Specify a custom port.') parser.add_argument('--validate_server_mount', type=str, help='Specify a mount on the server to validate incoming paths agai...
ncmd = conn.recv(ncmds.MAX_CMD_SIZE) quit, cmd_success = processCmd(ncmd, args) resp = processResponse(ncmd, cmd_success) if len(resp) > 0: try: conn.send(resp) except Exception as err: np.print_msg(msg, MessageLevel.ERROR) conn.close() return quit
identifier_body
ncmd_server.py
#!/usr/bin/python import socket import os import time import shutil import sys import re import datetime import argparse # NCMD Libs import ncmd_print as np from ncmd_print import MessageLevel as MessageLevel import ncmd_commands as ncmds import ncmd_fileops as nfops MAX_TRANSFER_BYTES=2048 QUIT_CMD = "quit now" HOS...
(path, server_mnt): result = False # Paths beginning with the server mount are considered 'valid' if path.find(server_mnt) == 0: result = True return result # Validate source / destination paths def validatePaths(paths, server_mnt): result = True for path in paths: if not validatePath(path, server_mnt): ...
validatePath
identifier_name
ncmd_server.py
#!/usr/bin/python import socket import os import time import shutil import sys import re import datetime import argparse # NCMD Libs import ncmd_print as np from ncmd_print import MessageLevel as MessageLevel import ncmd_commands as ncmds import ncmd_fileops as nfops MAX_TRANSFER_BYTES=2048 QUIT_CMD = "quit now" HOS...
quit, cmd_success = processCmd(ncmd, args) resp = processResponse(ncmd, cmd_success) if len(resp) > 0: try: conn.send(resp) except Exception as err: np.print_msg(msg, MessageLevel.ERROR) conn.close() return quit def getArgs(): parser = argparse.ArgumentParser(description='Copy, move, remove quickly o...
def processConnection(conn, args): ncmd = conn.recv(ncmds.MAX_CMD_SIZE)
random_line_split
loginoption.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Calendar-Indicator # # Copyright (C) 2011-2019 Lorenzo Carbonell Cerezo # lorenzo.carbonell.cerezo@gmail.com # # 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 Softw...
googlecalendar = GoogleCalendar(token_file = comun.TOKEN_FILE) if googlecalendar.do_refresh_authorization() is None: authorize_url = googlecalendar.get_authorize_url() ld = LoginDialog(authorize_url) ld.run() googlecalendar.get_authorization(ld...
conditional_block
loginoption.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Calendar-Indicator # # Copyright (C) 2011-2019 Lorenzo Carbonell Cerezo # lorenzo.carbonell.cerezo@gmail.com # # 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 Softw...
if os.path.exists(comun.TOKEN_FILE): os.remove(comun.TOKEN_FILE) else: googlecalendar = GoogleCalendar(token_file = comun.TOKEN_FILE) if googlecalendar.do_refresh_authorization() is None: authorize_url = googlecalendar.get_authorize_url() ...
def on_switch1_changed(self,widget,data): if self.switch1.get_active():
random_line_split
loginoption.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Calendar-Indicator # # Copyright (C) 2011-2019 Lorenzo Carbonell Cerezo # lorenzo.carbonell.cerezo@gmail.com # # 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 Softw...
(self): Gtk.Overlay.__init__(self) self.__set_ui() def __set_ui(self): handycolumn = Handy.Column() handycolumn.set_maximum_width(700) handycolumn.set_margin_top(24) self.add(handycolumn) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) handycolumn.add...
__init__
identifier_name
loginoption.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Calendar-Indicator # # Copyright (C) 2011-2019 Lorenzo Carbonell Cerezo # lorenzo.carbonell.cerezo@gmail.com # # 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 Softw...
self.switch1 = Gtk.Switch() self.switch1.connect('button-press-event',self.on_switch1_changed) self.switch1.connect('activate',self.on_switch1_changed) self.switch1.set_valign(Gtk.Align.CENTER) listbox0.add(SettingRow(_('Permissions for Google Calendar'), ...
def __init__(self): Gtk.Overlay.__init__(self) self.__set_ui() def __set_ui(self): handycolumn = Handy.Column() handycolumn.set_maximum_width(700) handycolumn.set_margin_top(24) self.add(handycolumn) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) han...
identifier_body
const-float-classify.rs
// compile-flags: -Zmir-opt-level=0 // run-pass #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl)] // Don't promote const fn nop<T>(x: T) -> T { x } macro_rules! const_assert { ($a:expr, $b:expr) => { { const _: () = assert!($a == $b); ...
suite_inner!(f32 $($tt)*); } fn f64() { suite_inner!(f64 $($tt)*); } } } macro_rules! suite_inner { ( $ty:ident [$( $fn:ident ),*] $val:expr => [$($out:ident),*] $( $tail:tt )* ) => { $( const_assert!($ty::$fn($val), $out); ...
( $( $tt:tt )* ) => { fn f32() {
random_line_split
const-float-classify.rs
// compile-flags: -Zmir-opt-level=0 // run-pass #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl)] // Don't promote const fn nop<T>(x: T) -> T { x } macro_rules! const_assert { ($a:expr, $b:expr) => { { const _: () = assert!($a == $b); ...
} // The result of the `is_sign` methods are not checked for correctness, since LLVM does not // guarantee anything about the signedness of NaNs. See // https://github.com/rust-lang/rust/issues/55131. suite! { [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -0....
{ false }
identifier_body
const-float-classify.rs
// compile-flags: -Zmir-opt-level=0 // run-pass #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl)] // Don't promote const fn nop<T>(x: T) -> T { x } macro_rules! const_assert { ($a:expr, $b:expr) => { { const _: () = assert!($a == $b); ...
; impl const PartialEq<NonDet> for bool { fn eq(&self, _: &NonDet) -> bool { true } fn ne(&self, _: &NonDet) -> bool { false } } // The result of the `is_sign` methods are not checked for correctness, since LLVM does not // guarantee anything about the signedness of NaNs. See // https:...
NonDet
identifier_name
objects.py
from datetime import datetime import uuid class Torrent(object): def __init__(self): self.tracker = None self.url = None self.title = None self.magnet = None self.seeders = None self.leechers = None self.size = None self.date = None self.detai...
(self): return self.title.replace('.', '.&#8203;').replace('[', '&#8203;[').replace(']', ']&#8203;') def __unicode__(self): return "%s Size: %s Seeders: %s Age: %s %s" % (self.title.ljust(60)[0:60], str(self.human_size).ljust(12), ...
html_friendly_title
identifier_name
objects.py
from datetime import datetime import uuid class Torrent(object): def __init__(self): self.tracker = None self.url = None self.title = None self.magnet = None self.seeders = None self.leechers = None self.size = None self.date = None self.detai...
elif self.size > 1000000: return "%.2f MB" % (self.size/1000000) else: return "%s KB" % (self.size/1000) @property def html_friendly_title(self): return self.title.replace('.', '.&#8203;').replace('[', '&#8203;[').replace(']', ']&#8203;') ...
return "%.2f GB" % (self.size / 1000000000)
conditional_block
objects.py
from datetime import datetime import uuid class Torrent(object): def __init__(self):
@property def human_age(self): if self.date: age = datetime.now() - self.date return "%s days" % (int(age.total_seconds()/(60*60*24))) else: return "Unknown" @property def human_size(self): if self.size: if self.size > 1000000000...
self.tracker = None self.url = None self.title = None self.magnet = None self.seeders = None self.leechers = None self.size = None self.date = None self.details = None self.uuid = uuid.uuid4().hex self._remove = False
identifier_body
objects.py
from datetime import datetime import uuid class Torrent(object): def __init__(self): self.tracker = None self.url = None self.title = None self.magnet = None self.seeders = None self.leechers = None self.size = None self.date = None self.detai...
def __unicode__(self): return "%s Size: %s Seeders: %s Age: %s %s" % (self.title.ljust(60)[0:60], str(self.human_size).ljust(12), str(self.seeders).ljust(6), self.human_age, ...
random_line_split
bootable.spec.ts
// Components import Bootable from '../index' // Utilities import { mount, Wrapper, } from '@vue/test-utils' describe('Bootable.ts', () => {
beforeEach(() => { mountFunction = (options = {}) => { return mount({ mixins: [Bootable], render: h => h('div'), }, { ...options, }) } }) it('should be booted after activation', async () => { const wrapper = mountFunction({ data: () => ({ isAct...
type Instance = InstanceType<typeof Bootable> let mountFunction: (options?: object) => Wrapper<Instance>
random_line_split
room.service.ts
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { catchError, map, tap } from 'rxjs/operators'; import { Room } from '../../models/room'; import { MessageService } ...
return this.http.get<Room[]>(`/search/findByDescription?description=${description}`) .pipe( tap(_ => this.log(`found rooms matching "${description}"`)), catchError(this.handleError<Room[]>('getRoomsByDescription', [])) ); } /** * Gets a list of rooms from the server according to a name. ...
{ return of([]); }
conditional_block
room.service.ts
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { catchError, map, tap } from 'rxjs/operators'; import { Room } from '../../models/room'; import { MessageService } ...
(room: Room): Observable<Room> { return this.http.post<Room>(this.roomsUrl, room, httpOptions) .pipe( tap((room: Room) => this.log(`added room name=${room.name}`)), catchError(this.handleError<Room>('createRoom')) ); } /** * Deletes the room from the server. * @param url - url of the r...
createRoom
identifier_name
room.service.ts
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { catchError, map, tap } from 'rxjs/operators'; import { Room } from '../../models/room'; import { MessageService } ...
/** * Logs a RoomService message with the MessageService. * @param message - message to log */ private log(message: string) { this.messageService.add('RoomService: ' + message); } }
{ return (error: any): Observable<T> => { console.error(error); this.log(`${operation} failed: ${error.message}`); return of(result as T); }; }
identifier_body
room.service.ts
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { of } from 'rxjs/observable/of'; import { catchError, map, tap } from 'rxjs/operators'; import { Room } from '../../models/room'; import { MessageService } ...
* Let the app continue. * @param operation - name of the operation that failed * @param result - optional value to return as the observable result */ private handleError<T> (operation = 'operation', result?: T) { return (error: any): Observable<T> => { console.error(error); this.log(...
/** * Handles HTTP operation that failed.
random_line_split
switch.rs
use core::cell::Cell; use core::ops::Bound; use core::sync::atomic::Ordering; use alloc::sync::Arc; use spin::RwLock; use crate::context::signal::signal_handler; use crate::context::{arch, contexts, Context, Status, CONTEXT_ID}; #[cfg(target_arch = "x86_64")] use crate::gdt; use crate::interrupt::irq::PIT_TICKS; use...
arch::CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst); } #[thread_local] static SWITCH_RESULT: Cell<Option<SwitchResult>> = Cell::new(None); unsafe fn runnable(context: &Context, cpu_id: usize) -> bool { // Switch to context if it needs to run, is not currently running, and is owned by the current CPU ...
{ // TODO: unreachable_unchecked()? core::intrinsics::abort(); }
conditional_block
switch.rs
use core::cell::Cell; use core::ops::Bound; use core::sync::atomic::Ordering; use alloc::sync::Arc; use spin::RwLock; use crate::context::signal::signal_handler; use crate::context::{arch, contexts, Context, Status, CONTEXT_ID}; #[cfg(target_arch = "x86_64")] use crate::gdt; use crate::interrupt::irq::PIT_TICKS; use...
.current() .expect("context::switch: not inside of context")); from_context_guard = from_context_lock.write(); from_context_guard.ticks += ticks as u64 + 1; // Always round ticks up } for (pid, context_lock) in contexts.iter() { let mu...
{ // TODO: Better memory orderings? //set PIT Interrupt counter to 0, giving each process same amount of PIT ticks let ticks = PIT_TICKS.swap(0, Ordering::SeqCst); // Set the global lock to avoid the unsafe operations below from causing issues while arch::CONTEXT_SWITCH_LOCK.compare_exchange_weak(f...
identifier_body
switch.rs
use core::cell::Cell; use core::ops::Bound; use core::sync::atomic::Ordering; use alloc::sync::Arc; use spin::RwLock; use crate::context::signal::signal_handler; use crate::context::{arch, contexts, Context, Status, CONTEXT_ID}; #[cfg(target_arch = "x86_64")] use crate::gdt; use crate::interrupt::irq::PIT_TICKS; use...
() -> bool { // TODO: Better memory orderings? //set PIT Interrupt counter to 0, giving each process same amount of PIT ticks let ticks = PIT_TICKS.swap(0, Ordering::SeqCst); // Set the global lock to avoid the unsafe operations below from causing issues while arch::CONTEXT_SWITCH_LOCK.compare_exch...
switch
identifier_name
switch.rs
use core::cell::Cell; use core::ops::Bound; use core::sync::atomic::Ordering; use alloc::sync::Arc; use spin::RwLock; use crate::context::signal::signal_handler; use crate::context::{arch, contexts, Context, Status, CONTEXT_ID}; #[cfg(target_arch = "x86_64")] use crate::gdt; use crate::interrupt::irq::PIT_TICKS; use...
}
random_line_split
zapwallettxes.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the zapwallettxes functionality. - start two iopd nodes - create two transactions on node 0 - one...
def run_test(self): self.log.info("Mining blocks...") self.nodes[0].generate(1) self.sync_all() self.nodes[1].generate(100) self.sync_all() # This transaction will be confirmed txid1 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 10) ...
self.setup_clean_chain = True self.num_nodes = 2
identifier_body
zapwallettxes.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the zapwallettxes functionality. - start two iopd nodes - create two transactions on node 0 - one...
(self): self.setup_clean_chain = True self.num_nodes = 2 def run_test(self): self.log.info("Mining blocks...") self.nodes[0].generate(1) self.sync_all() self.nodes[1].generate(100) self.sync_all() # This transaction will be confirmed txid1 = ...
set_test_params
identifier_name
zapwallettxes.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the zapwallettxes functionality. - start two iopd nodes - create two transactions on node 0 - one...
self.nodes[0].generate(1) self.sync_all() # This transaction will not be confirmed txid2 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 20) # Confirmed and unconfirmed transactions are now in the wallet. assert_equal(self.nodes[0].gettransaction(txid1)['tx...
random_line_split
zapwallettxes.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the zapwallettxes functionality. - start two iopd nodes - create two transactions on node 0 - one...
ZapWalletTXesTest().main()
conditional_block
Enums.py
from enum import Enum class
(Enum): """Enum containing the various types of events that can occur.""" CLIENT_READY = "CLIENT_READY" CLIENT_RESUMED = "CLIENT_RESUMED" MESSAGE_RECEIVED = "MESSAGE_RECEIVED" SERVER_MESSAGE_RECEIVED = "SERVER_MESSAGE_RECEIVED" PRIVATE_MESSAGE_RECEIVED = "PRIVATE_MESSAGE_RECEIVED" COMMAND_R...
EventType
identifier_name