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
apps.js
import assign from 'object-assign'; import { APPS_REQUEST,
const INITIAL_STATE = { fetching: false, fetched: false, data: null, errorMessage: null, errorStatus: null }; export default function(state = INITIAL_STATE, action) { switch(action.type) { case APPS_REQUEST: return assign({}, state, { fetching: true }) case APPS_SUCCESS: return assi...
APPS_SUCCESS, APPS_FAILURE, APPS_RESET } from '@/actions/action-types';
random_line_split
document_loader.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/. */ //! Tracking of pending loads in a document. //! //! <https://html.spec.whatwg.org/multipage/#the-end> use dom::b...
(&self) -> bool { // TODO: Ensure that we report blocked if parsing is still ongoing. !self.blocking_loads.is_empty() } pub fn inhibit_events(&mut self) { self.events_inhibited = true; } pub fn events_inhibited(&self) -> bool { self.events_inhibited } pub fn re...
is_blocked
identifier_name
document_loader.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/. */ //! Tracking of pending loads in a document. //! //! <https://html.spec.whatwg.org/multipage/#the-end> use dom::b...
PageSource(ServoUrl), Media, } impl LoadType { fn url(&self) -> Option<&ServoUrl> { match *self { LoadType::Image(ref url) | LoadType::Script(ref url) | LoadType::Subframe(ref url) | LoadType::Stylesheet(ref url) | LoadType::PageSource(ref...
Stylesheet(ServoUrl),
random_line_split
document_loader.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/. */ //! Tracking of pending loads in a document. //! //! <https://html.spec.whatwg.org/multipage/#the-end> use dom::b...
pub fn inhibit_events(&mut self) { self.events_inhibited = true; } pub fn events_inhibited(&self) -> bool { self.events_inhibited } pub fn resource_threads(&self) -> &ResourceThreads { &self.resource_threads } }
{ // TODO: Ensure that we report blocked if parsing is still ongoing. !self.blocking_loads.is_empty() }
identifier_body
delete-output-path.ts
import {ng} from '../../utils/process'; import {expectToFail} from '../../utils/utils'; import {deleteFile, expectFileToExist} from '../../utils/fs'; import {getGlobalVariable} from '../../utils/env'; export default function() { // Skip this in Appveyor tests. if (getGlobalVariable('argv').appveyor) { return P...
return ng('build') // This is supposed to fail since there's a missing file .then(() => deleteFile('src/app/app.component.ts')) // The build fails but we don't delete the output of the previous build. .then(() => expectToFail(() => ng('build', '--no-delete-output-path'))) .then(() => expectFileT...
{ return Promise.resolve(); }
conditional_block
delete-output-path.ts
import {ng} from '../../utils/process'; import {expectToFail} from '../../utils/utils'; import {deleteFile, expectFileToExist} from '../../utils/fs'; import {getGlobalVariable} from '../../utils/env'; export default function() { // Skip this in Appveyor tests. if (getGlobalVariable('argv').appveyor) { return P...
} return ng('build') // This is supposed to fail since there's a missing file .then(() => deleteFile('src/app/app.component.ts')) // The build fails but we don't delete the output of the previous build. .then(() => expectToFail(() => ng('build', '--no-delete-output-path'))) .then(() => expectFi...
// Skip this in ejected tests. if (getGlobalVariable('argv').eject) { return Promise.resolve();
random_line_split
generic-function.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() {()}
zzz
identifier_name
generic-function.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// debugger:finish // debugger:print *t0 // check:$1 = 1 // debugger:print *t1 // check:$2 = 2.5 // debugger:print ret // check:$3 = {{1, 2.5}, {2.5, 1}} // debugger:continue // debugger:finish // debugger:print *t0 // check:$4 = 3.5 // debugger:print *t1 // check:$5 = 4 // debugger:print ret // check:$6 = {{3.5, 4},...
// compile-flags:-Z extra-debug-info // debugger:rbreak zzz // debugger:run
random_line_split
borrowck-autoref-3261.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 ...
<T, U> { Left(T), Right(U) } struct X(Either<(uint,uint), fn()>); impl X { pub fn with<F>(&self, blk: F) where F: FnOnce(&Either<(uint, uint), fn()>) { let X(ref e) = *self; blk(e) } } fn main() { let mut x = X(Either::Right(main as fn())); (&mut x).with( |opt| { //~ ERROR can...
Either
identifier_name
borrowck-autoref-3261.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 ...
(*f)() }, _ => panic!() } }) }
|opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time match opt { &Either::Right(ref f) => { x = X(Either::Left((0, 0)));
random_line_split
borrowck-autoref-3261.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 mut x = X(Either::Right(main as fn())); (&mut x).with( |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time match opt { &Either::Right(ref f) => { x = X(Either::Left((0, 0))); (*f)() }, ...
identifier_body
models.py
from django import forms from django.db import models class Births(models.Model): year = models.IntegerField("Year") county = models.CharField("County",max_length=20) mothersAge = models.IntegerField("Mother's Age") mothersEdu = models.CharField("Mother's Education",max_length=50) source = models.U...
(self): s = "In " + self.county + " county, " + str(self.year) s += ", there were " + str(self.count) + " " s += self.topic + " (or " + str(self.rate) s += "%), according to " + self.source return s class Upload(models.Model): upfile = models.FileField(upload_to='Updates Go ...
__unicode__
identifier_name
models.py
from django import forms from django.db import models class Births(models.Model): year = models.IntegerField("Year") county = models.CharField("County",max_length=20) mothersAge = models.IntegerField("Mother's Age") mothersEdu = models.CharField("Mother's Education",max_length=50) source = models.U...
def get_fields(self): fields = [] for f in self._meta.fields: fields.append(f.name) return fields def get_names(self): names = [] for f in self._meta.fields: names.append(self._meta.get_field(f.name).verbose_name.title()) return nam...
random_line_split
models.py
from django import forms from django.db import models class Births(models.Model): year = models.IntegerField("Year") county = models.CharField("County",max_length=20) mothersAge = models.IntegerField("Mother's Age") mothersEdu = models.CharField("Mother's Education",max_length=50) source = models.U...
class Upload(models.Model): upfile = models.FileField(upload_to='Updates Go Here')
s = "In " + self.county + " county, " + str(self.year) s += ", there were " + str(self.count) + " " s += self.topic + " (or " + str(self.rate) s += "%), according to " + self.source return s
identifier_body
models.py
from django import forms from django.db import models class Births(models.Model): year = models.IntegerField("Year") county = models.CharField("County",max_length=20) mothersAge = models.IntegerField("Mother's Age") mothersEdu = models.CharField("Mother's Education",max_length=50) source = models.U...
return fields def get_names(self): names = [] for f in self._meta.fields: names.append(self._meta.get_field(f.name).verbose_name.title()) return names def __unicode__(self): s = "In " + self.county + " county, " + str(self.year) s += ", there were...
fields.append(f.name)
conditional_block
timer.spec.ts
import {provide} from 'angular2/core'; import { it, inject, injectAsync, describe, beforeEachProviders, TestComponentBuilder } from 'angular2/testing'; // Load the implementations that should be tested import {TasksService} from '../../../services/tasks'; import {PeriodsService} from '../../../services/pe...
{ post() { let response: Observable<any[]>; let mockSubscriber: Subscriber<any[]>; response = new Observable(subscriber => mockSubscriber = subscriber) .publishReplay(1) .refCount(); mockSubscriber.next([{id: '1'}, {id: '2'}]); return response; } } describe('Timer', () =...
HttpMock
identifier_name
timer.spec.ts
import {provide} from 'angular2/core'; import { it, inject, injectAsync, describe, beforeEachProviders, TestComponentBuilder } from 'angular2/testing'; // Load the implementations that should be tested import {TasksService} from '../../../services/tasks'; import {PeriodsService} from '../../../services/pe...
let mockSubscriber: Subscriber<any[]>; response = new Observable(subscriber => mockSubscriber = subscriber) .publishReplay(1) .refCount(); mockSubscriber.next([{id: '1'}, {id: '2'}]); return response; } } describe('Timer', () => { // provide our implementations or mocks to t...
//ToDo: check it class HttpMock{ post() { let response: Observable<any[]>;
random_line_split
gnatprove_unitstats.py
abstract_units[u]["flows_success"] = (100*float(f) / n) if n > 0 else 100.0 # carry over entities if details: abstract_units[u]["entities"] = uinfo["entities"] # merge rules for r,s in rule_stats.iteritems(): if not r in abstract_units[u]["rules"]: ...
main
identifier_name
gnatprove_unitstats.py
_statistics(jsondata, sorting, exclude, include, details, fh): """ Turn the JSON data into an abstract summary. """ ################# # ABSTRACT DATA ################# # we summarize the list of proofs into stats, and then keep only that abstract_units = {} for u,uinfo in jsondata.i...
if not r in total_rules: total_rules[r]=dict(stat) # deep copy of entire rule else: # rule exists. accumulate individual keys for k,v in stat.iteritems(): if not k in total_rules[r]: # k=cnt,proven,... total_rules[r]...
conditional_block
gnatprove_unitstats.py
I file """ def decode_type(t):
Bodies of functions will not appear in SPARK, only specs. Task types will not appear in SPARK, only objects packages will appear """ typ = None if t == 'K': typ = "package" # used also for generic instanc...
""" verbose type from ALI symbol. See lib-xref.ads Only handles those with would appear in *.spark files
random_line_split
gnatprove_unitstats.py
# If <name>=unit, then it's the package itself. Package with spark=spec means body not in SPARK mode # # 2) "flow" : flow analysis results. list of dicts. # each item has {"file": .., "line": .., "col": .., "rule": .., "severity": .., "entity": {"...
""" Parses all *.spark files in the given directory and creates statistics for them """ d={} for folder in folders: prefix = "" # file2unit(folder) if prefix: prefix = prefix + "." for filename in glob.glob(os.path.join(folder, '*.spark')): filebase = os.path.spli...
identifier_body
sconstest-noclean.py
#!/usr/bin/env python # # Copyright (c) 2001-2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the
# permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIE...
# "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to
random_line_split
db.py
import string # Manages Local "database" for ZBWarDrive: # This keeps track of current ZBWarDrive and Sniffing Device State. # It is different from the online logging database. class ZBScanDB: """ API to interact with the "database" storing information for the zbscanning program. """ def __init_...
def update_devices_start_capture(self, devid, channel): if devid not in self.devices: return None (devstr, devserial, _, _) = self.devices[devid] self.devices[devid] = (devstr, devserial, "Capture", channel) # Add a new network to the DB def store_networks(self, key, s...
if devid not in self.devices: return None (devstr, devserial, _, chan) = self.devices[devid] self.devices[devid] = (devstr, devserial, newstatus, chan)
identifier_body
db.py
import string # Manages Local "database" for ZBWarDrive: # This keeps track of current ZBWarDrive and Sniffing Device State. # It is different from the online logging database. class ZBScanDB: """ API to interact with the "database" storing information for the zbscanning program. """ def __init_...
(bin): return ''.join(["%02x" % ord(x) for x in bin])
toHex
identifier_name
db.py
import string # Manages Local "database" for ZBWarDrive: # This keeps track of current ZBWarDrive and Sniffing Device State. # It is different from the online logging database. class ZBScanDB: """ API to interact with the "database" storing information for the zbscanning program. """ def __init_...
# Add a new network to the DB def store_networks(self, key, spanid, source, channel, packet): if channel not in self.channels: return None # TODO note this only stores the most recent in the channel self.channels[channel] = (key, spanid, source, packet) # Return the cha...
self.devices[devid] = (devstr, devserial, "Capture", channel)
random_line_split
db.py
import string # Manages Local "database" for ZBWarDrive: # This keeps track of current ZBWarDrive and Sniffing Device State. # It is different from the online logging database. class ZBScanDB: """ API to interact with the "database" storing information for the zbscanning program. """ def __init_...
elif chan not in self.channels: raise Exception("Invalid channel") for dev in self.devices.values(): if dev[3] == chan and dev[2] == 'Capture': return True return False # end of ZBScanDB class def toHex(bin): return ''.join(["%02x" % ord(x) for x in bin])
raise Exception("None given for channel number")
conditional_block
parsers.js
'use strict'; /** * Parsers are collection of transform streams to processes incoming data * @summary The default `Parsers` are [Transform streams](https://nodejs.org/api/stream.html#stream_class_stream_transform) that process incoming data. To use the parsers, you must create them and then pipe the Serialport to the...
const Readline = SerialPort.parsers.Readline; const port = new SerialPort('/dev/tty-usbserial1'); const parser = new Readline(); port.pipe(parser); parser.on('data', console.log); port.write('ROBOT PLEASE RESPOND\n'); // Creating the parser and piping can be shortened to // const parser = port.pipe(new Readline()); ``...
* @example ```js const SerialPort = require('serialport');
random_line_split
72.py
class Solution:
else: if word1[i-1] == word2[j-1]: matrix[i][j] = matrix[i-1][j-1] else: matrix[i][j] = min(matrix[i][j-1], matrix[i-1][j], matrix[i-1][j-1]) + 1 return matrix[l1][l2]
def minDistance(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ l1 = len(word1) l2 = len(word2) if l1 == 0 and l2 != 0: return l2 if l1 != 0 and l2 == 0: return l1 matrix = [[0]*(l...
identifier_body
72.py
class
: def minDistance(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ l1 = len(word1) l2 = len(word2) if l1 == 0 and l2 != 0: return l2 if l1 != 0 and l2 == 0: return l1 matrix = [...
Solution
identifier_name
72.py
class Solution: def minDistance(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ l1 = len(word1) l2 = len(word2) if l1 == 0 and l2 != 0: return l2 if l1 != 0 and l2 == 0: return l1 ...
else: matrix[i][j] = min(matrix[i][j-1], matrix[i-1][j], matrix[i-1][j-1]) + 1 return matrix[l1][l2]
matrix[i][j] = matrix[i-1][j-1]
conditional_block
72.py
class Solution: def minDistance(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ l1 = len(word1) l2 = len(word2) if l1 == 0 and l2 != 0: return l2 if l1 != 0 and l2 == 0: return l1 ...
matrix[i][j] = matrix[i-1][j-1] else: matrix[i][j] = min(matrix[i][j-1], matrix[i-1][j], matrix[i-1][j-1]) + 1 return matrix[l1][l2]
matrix[i][j] = j elif j == 0: matrix[i][j] = i else: if word1[i-1] == word2[j-1]:
random_line_split
mac.py
#Copyright 2013 Paul Barton # #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope tha...
if self.capture: Quartz.CGEventSetType(event, Quartz.kCGEventNull) return event
self.move(x, y)
conditional_block
mac.py
#Copyright 2013 Paul Barton # #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope tha...
(x, y) = Quartz.CGEventGetLocation(event) if type in pressID: self.click(x, y, pressID.index(type), True) elif type in releaseID: self.click(x, y, releaseID.index(type), False) else: self.move(x, y) if self.capture: Quartz.CGEventSetType(e...
identifier_body
mac.py
#Copyright 2013 Paul Barton # #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope tha...
None) loopsource = Quartz.CFMachPortCreateRunLoopSource(None, tap, 0) loop = Quartz.CFRunLoopGetCurrent() Quartz.CFRunLoopAddSource(loop, loopsource, Quartz.kCFRunLoopDefaultMode) Quartz.CGEventTapEnable(tap, True) while self.state: Quartz.CFRunLoopRunIn...
Quartz.CGEventMaskBit(Quartz.kCGEventOtherMouseDown) | Quartz.CGEventMaskBit(Quartz.kCGEventOtherMouseUp), self.handler,
random_line_split
mac.py
#Copyright 2013 Paul Barton # #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope tha...
(self, proxy, type, event, refcon): (x, y) = Quartz.CGEventGetLocation(event) if type in pressID: self.click(x, y, pressID.index(type), True) elif type in releaseID: self.click(x, y, releaseID.index(type), False) else: self.move(x, y) if self....
handler
identifier_name
qrcode.py
# -*- coding: utf-8 -*- # import qrcode
#pylint: disable = E, W, R, C from PyQt6.QtGui import QImage, QPixmap,QPainter # @UnusedImport @Reimport @UnresolvedImport from PyQt6.QtCore import Qt # @UnusedImport @Reimport @UnresolvedImport except Exception: #pylint: disable = E, W, R, C from PyQt5.QtGui import QImage, QPixmap,QPainter # @Unu...
try:
random_line_split
qrcode.py
# -*- coding: utf-8 -*- # import qrcode try: #pylint: disable = E, W, R, C from PyQt6.QtGui import QImage, QPixmap,QPainter # @UnusedImport @Reimport @UnresolvedImport from PyQt6.QtCore import Qt # @UnusedImport @Reimport @UnresolvedImport except Exception: #pylint: disable = E, W, R, C from PyQ...
(self, stream, kind=None): pass def process(self): pass def drawrect_context(self, row, col, active, context): pass def QRlabel(url_str): qr = qrcode.QRCode( version=None, # 1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=4, borde...
save
identifier_name
qrcode.py
# -*- coding: utf-8 -*- # import qrcode try: #pylint: disable = E, W, R, C from PyQt6.QtGui import QImage, QPixmap,QPainter # @UnusedImport @Reimport @UnresolvedImport from PyQt6.QtCore import Qt # @UnusedImport @Reimport @UnresolvedImport except Exception: #pylint: disable = E, W, R, C from PyQ...
qr = qrcode.QRCode( version=None, # 1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=4, border=1, image_factory=QRImage) qr.add_data(url_str) qr.make(fit=True) return qr
identifier_body
pe1.rs
/// # Solve project euler 1 /// /// Add all the natural numbers below one thousand /// that are multiples of 3 or 5. pub fn with_loop(n: u32) -> u32 { let mut s: u32 = 0; for i in 1..n + 1 { if i % 3 == 0 || i % 5 == 0 { s += i; } } return s; } pub fn no_loop(n: u32) -> u32...
#[cfg(test)] mod tests { use super::*; #[test] fn test() { let cases: [u32; 5] = [ 0, 10, 100, 1000, 10000, ]; let expects: [u32; 5] = [ 0, 33, 2418, 234168, 23341668, ]; for i in 0..5 { let case = cases[i as usize]; ...
{ let s: u32 = with_loop(1000); println!("{}", s); }
identifier_body
pe1.rs
/// # Solve project euler 1 /// /// Add all the natural numbers below one thousand /// that are multiples of 3 or 5. pub fn with_loop(n: u32) -> u32 { let mut s: u32 = 0; for i in 1..n + 1 { if i % 3 == 0 || i % 5 == 0 { s += i; } } return s; } pub fn no_loop(n: u32) -> u32...
mod tests { use super::*; #[test] fn test() { let cases: [u32; 5] = [ 0, 10, 100, 1000, 10000, ]; let expects: [u32; 5] = [ 0, 33, 2418, 234168, 23341668, ]; for i in 0..5 { let case = cases[i as usize]; let expect = ex...
random_line_split
pe1.rs
/// # Solve project euler 1 /// /// Add all the natural numbers below one thousand /// that are multiples of 3 or 5. pub fn with_loop(n: u32) -> u32 { let mut s: u32 = 0; for i in 1..n + 1 { if i % 3 == 0 || i % 5 == 0
} return s; } pub fn no_loop(n: u32) -> u32 { let mut s: u32 = 0; if n > 2 { let n3: u32 = n / 3; let n5: u32 = n / 5; let n15: u32 = n / 15; s = (3 * n3 * (n3 + 1) + 5 * n5 * (n5 + 1) - 15 * n15 * (n15 + 1)) >> 1; } return s; } pub fn pe1() { let s: u32 = ...
{ s += i; }
conditional_block
pe1.rs
/// # Solve project euler 1 /// /// Add all the natural numbers below one thousand /// that are multiples of 3 or 5. pub fn
(n: u32) -> u32 { let mut s: u32 = 0; for i in 1..n + 1 { if i % 3 == 0 || i % 5 == 0 { s += i; } } return s; } pub fn no_loop(n: u32) -> u32 { let mut s: u32 = 0; if n > 2 { let n3: u32 = n / 3; let n5: u32 = n / 5; let n15: u32 = n / 15; ...
with_loop
identifier_name
mod.rs
use snafu::{ResultExt, Snafu}; use std::fs::File; use std::io::BufReader; use std::path::Path;
pub mod osm_utils; pub mod poi; pub mod street; pub type OsmPbfReader = osmpbfreader::OsmPbfReader<BufReader<File>>; /// Size of the IO buffer over input PBF file const PBF_BUFFER_SIZE: usize = 1024 * 1024; // 1MB #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("IO Error: {}", source))] IO { source:...
pub mod admin; pub mod osm_store;
random_line_split
mod.rs
use snafu::{ResultExt, Snafu}; use std::fs::File; use std::io::BufReader; use std::path::Path; pub mod admin; pub mod osm_store; pub mod osm_utils; pub mod poi; pub mod street; pub type OsmPbfReader = osmpbfreader::OsmPbfReader<BufReader<File>>; /// Size of the IO buffer over input PBF file const PBF_BUFFER_SIZE: us...
(path: &Path) -> Result<OsmPbfReader, Error> { let file = File::open(&path).context(IOSnafu)?; Ok(osmpbfreader::OsmPbfReader::new(BufReader::with_capacity( PBF_BUFFER_SIZE, file, ))) }
make_osm_reader
identifier_name
arg-helper.js
var Minimist = require('minimist'); class ArgHelper {
getArgs() { if (this.args === null) { this.args = Minimist(process.argv.slice(2)); } return this.args; } setAliases(aliases) { this.aliases = aliases; this.reverse_aliases = ObjectHelper.invert(aliases); } getValue(flag) { var args = this.getArgs(); if (args[flag] !== undefined) { return ar...
random_line_split
arg-helper.js
var Minimist = require('minimist'); class ArgHelper { getArgs() { if (this.args === null) { this.args = Minimist(process.argv.slice(2)); } return this.args; } setAliases(aliases) { this.aliases = aliases; this.reverse_aliases = ObjectHelper.invert(aliases); } getValue(flag) { var args = this.ge...
var alias = this.getAliasForFlag(flag); if (alias) { return args[alias]; } return undefined; } getOrDefault(flag, default_value) { if (!this.hasValue(flag)) { return default_value; } return this.getValue(flag); } hasValue(flag) { return this.getValue(flag) !== undefined; } getValueOf...
{ return args[flag]; }
conditional_block
arg-helper.js
var Minimist = require('minimist'); class ArgHelper { getArgs() { if (this.args === null) { this.args = Minimist(process.argv.slice(2)); } return this.args; } setAliases(aliases) { this.aliases = aliases; this.reverse_aliases = ObjectHelper.invert(aliases); } getValue(flag) { var args = this.ge...
(flag) { var flag_label = this.getFlagLabel(flag); Logger.errorAndExit(` Must specify a value for flag ${flag_label} `); } throwIncorrectTypeError(flag, type) { var flag_label = this.getFlagLabel(flag); Logger.errorAndExit(` Value for flag ${flag_label} must be of type ${type} `); } } ObjectHe...
throwOmittedValueError
identifier_name
arg-helper.js
var Minimist = require('minimist'); class ArgHelper { getArgs() { if (this.args === null) { this.args = Minimist(process.argv.slice(2)); } return this.args; } setAliases(aliases) { this.aliases = aliases; this.reverse_aliases = ObjectHelper.invert(aliases); } getValue(flag) { var args = this.ge...
getFlagLabel(flag) { var alias = this.getAliasForFlag(flag); if (alias && alias.length === 1) { return this.getFlagLabel(alias); } var label = '-' + flag; if (alias) { label += ' (--' + alias + ')'; } return label; } getAliasForFlag(flag) { if (!this.aliases) { return null; } if ...
{ if (this.isOmitted(flag)) { this.throwOmittedValueError(flag); } var value = this.getValue(flag); if (!TypeHelper.isType(value, type)) { this.throwIncorrectTypeError(value, type); } return value; }
identifier_body
eucopyright.js
return urlParams; }; EUCopyright.parseCSV = function( strData, strDelimiter ){ /* This code taken from: http://stackoverflow.com/a/1293163/114462 under CC-By-SA 3.0 */ // This will parse a delimited string into an array of // arrays. The default delimiter is the comma, but this // can be overriden i...
{ urlParams[decode(match[1])] = decode(match[2]); match = search.exec(query); }
conditional_block
eucopyright.js
strMatchedValue = arrMatches[ 3 ]; } // Now that we have our value string, let's add // it to the data array. arrData[arrData.length - 1].push(strMatchedValue); arrMatches = objPattern.exec(strData); } // Return the parsed data. return arrData ; }; EUCopyright.collectData = function() { ...
continue; // skip empty line in csv (usually last one) } for (var j = 0; j < csv[0].length; j += 1) { row[csv[0][j]] = csv[i][j]; } var answer = { option: row.Option ? parseInt(row.Option, 10) - 1 : null, answer: row.Answer, explanation: row.Explanation.rep...
var row = {}; if (csv[i].length <= 1) {
random_line_split
wallet_hd.py
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Starwels developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Hierarchical Deterministic wallet function.""" from test_framework.test_framework import StarwelsTest...
assert_equal(keypath[0:7], "m/0'/1'") if __name__ == '__main__': WalletHDTest().main ()
keypath = self.nodes[1].validateaddress(out['scriptPubKey']['addresses'][0])['hdkeypath']
conditional_block
wallet_hd.py
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Starwels developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Hierarchical Deterministic wallet function.""" from test_framework.test_framework import StarwelsTest...
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1) # send a tx and make sure its using the internal chain for the changeoutput txid = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) outs = self.nodes[1].decoderawtransaction(self.nodes[1].gettransaction(txid)['hex'])...
assert_equal(out['stop_height'], self.nodes[1].getblockcount())
random_line_split
wallet_hd.py
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Starwels developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Hierarchical Deterministic wallet function.""" from test_framework.test_framework import StarwelsTest...
def run_test (self): tmpdir = self.options.tmpdir # Make sure can't switch off usehd after wallet creation self.stop_node(1) self.assert_start_raises_init_error(1, ['-usehd=0'], 'already existing HD wallet') self.start_node(1) connect_nodes_bi(self.nodes, 0, 1) ...
self.setup_clean_chain = True self.num_nodes = 2 self.extra_args = [[], ['-keypool=0']]
identifier_body
wallet_hd.py
#!/usr/bin/env python3 # Copyright (c) 2016-2019 The Starwels developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test Hierarchical Deterministic wallet function.""" from test_framework.test_framework import StarwelsTest...
(self): tmpdir = self.options.tmpdir # Make sure can't switch off usehd after wallet creation self.stop_node(1) self.assert_start_raises_init_error(1, ['-usehd=0'], 'already existing HD wallet') self.start_node(1) connect_nodes_bi(self.nodes, 0, 1) # Make sure ...
run_test
identifier_name
es6-new-target.js
// -*- coding: utf-8 -*- // Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com> // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // ...
expect(scope.isStrict).to.be.true; expect(scope.variables).to.have.length(1); expect(scope.variables[0].name).to.be.equal('arguments'); expect(scope.references).to.have.length(0); }); }); // vim: set sw=4 ts=4 et tw=80 :
const scope = scopeManager.scopes[2]; expect(scope.type).to.be.equal('function'); expect(scope.block.type).to.be.equal('FunctionExpression');
random_line_split
namer.js
var Iconv = require("iconv").Iconv, app = require("./app"), Configurable = require("./configurable"); var iconv = new Iconv("UTF-8", "ASCII//TRANSLIT//IGNORE"); var wsReplacement = "-"; var overrides = {}; function getWhitespaceReplacement()
var Namer = function () { Configurable.call(this); }; Namer.prototype = Object.create(Configurable.prototype); Namer.prototype.wikify = function (str) { var ret = str; if (typeof ret != "string" || ret.trim() === "") { return ""; } wsReplacement = getWhitespaceReplacement(); var pc = this.getCon...
{ // For future improvements return "-"; }
identifier_body
namer.js
var Iconv = require("iconv").Iconv, app = require("./app"), Configurable = require("./configurable"); var iconv = new Iconv("UTF-8", "ASCII//TRANSLIT//IGNORE"); var wsReplacement = "-"; var overrides = {}; function getWhitespaceReplacement() { // For future improvements return "-"; } var Namer = function...
wsReplacement = getWhitespaceReplacement(); var pc = this.getConfig().pages; // Replace < and > with '' (Gollum replaces it with '-') ret = ret.replace(/[<>]/g, ''); // Replace / with '+' (Gollum replaces it with '') ret = ret.replace(/\//g, '+'); if (pc.title.asciiOnly) { ret = iconv.convert(ret...
{ return ""; }
conditional_block
namer.js
var Iconv = require("iconv").Iconv, app = require("./app"), Configurable = require("./configurable"); var iconv = new Iconv("UTF-8", "ASCII//TRANSLIT//IGNORE"); var wsReplacement = "-"; var overrides = {}; function getWhitespaceReplacement() { // For future improvements return "-"; } var Namer = function...
var pc = this.getConfig().pages; // Replace < and > with '' (Gollum replaces it with '-') ret = ret.replace(/[<>]/g, ''); // Replace / with '+' (Gollum replaces it with '') ret = ret.replace(/\//g, '+'); if (pc.title.asciiOnly) { ret = iconv.convert(ret) .toString() .rep...
random_line_split
namer.js
var Iconv = require("iconv").Iconv, app = require("./app"), Configurable = require("./configurable"); var iconv = new Iconv("UTF-8", "ASCII//TRANSLIT//IGNORE"); var wsReplacement = "-"; var overrides = {}; function
() { // For future improvements return "-"; } var Namer = function () { Configurable.call(this); }; Namer.prototype = Object.create(Configurable.prototype); Namer.prototype.wikify = function (str) { var ret = str; if (typeof ret != "string" || ret.trim() === "") { return ""; } wsReplacement = ge...
getWhitespaceReplacement
identifier_name
12148_Electricity.py
# Problem name: 12148 Electricity # Problem url: https://uva.onlinejudge.org/external/121/12148.pdf # Author: Andrey Yemelyanov import sys import math import datetime def readline(): return sys.stdin.readline().strip() def main(): while True: n_readings = int(readline()) if n_readings == 0: ...
return c if __name__=="__main__": main()
if i > 0: current_date = meter_readings[i][0] current_consumption = meter_readings[i][1] prev_date = meter_readings[i - 1][0] prev_consumption = meter_readings[i - 1][1] if prev_date + datetime.timedelta(days = 1) == current_date: c.append(curr...
conditional_block
12148_Electricity.py
# Problem name: 12148 Electricity # Problem url: https://uva.onlinejudge.org/external/121/12148.pdf # Author: Andrey Yemelyanov import sys import math import datetime def
(): return sys.stdin.readline().strip() def main(): while True: n_readings = int(readline()) if n_readings == 0: break meter_readings = [] for i in range(n_readings): reading = [int(x) for x in readline().split()] date = datetime.date(reading[...
readline
identifier_name
12148_Electricity.py
# Problem name: 12148 Electricity # Problem url: https://uva.onlinejudge.org/external/121/12148.pdf # Author: Andrey Yemelyanov import sys import math import datetime def readline(): return sys.stdin.readline().strip() def main(): while True: n_readings = int(readline()) if n_readings == 0: ...
meter_readings = [] for i in range(n_readings): reading = [int(x) for x in readline().split()] date = datetime.date(reading[2], reading[1], reading[0]) consumption = reading[3] meter_readings.append((date, consumption)) c = get_daily_consumption(me...
random_line_split
12148_Electricity.py
# Problem name: 12148 Electricity # Problem url: https://uva.onlinejudge.org/external/121/12148.pdf # Author: Andrey Yemelyanov import sys import math import datetime def readline(): return sys.stdin.readline().strip() def main():
def get_daily_consumption(meter_readings): c = [] for i in range(len(meter_readings)): if i > 0: current_date = meter_readings[i][0] current_consumption = meter_readings[i][1] prev_date = meter_readings[i - 1][0] prev_consumption = meter_readings[i - 1][...
while True: n_readings = int(readline()) if n_readings == 0: break meter_readings = [] for i in range(n_readings): reading = [int(x) for x in readline().split()] date = datetime.date(reading[2], reading[1], reading[0]) consumption = reading...
identifier_body
linkedlist_2.py
class Node: def __init__(self,data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def push(self, newdata): #in front newnode = Node(newdata) newnode.next = self.head self.head = newnode def insertAfter(self, prevnode, newdata): newnode = Node(newdata) n...
for i in xrange(0,pos-1): prev = temp temp = temp.next if(temp == None): return prev.next = temp.next temp = None def printList(self): temp = self.head while(temp): print " %d" %(temp.data) temp = temp.next def main(): print 'hello' ll = LinkedList() ll.push(1) ll.push(2) ll.push(3) l...
def deletepos(self, pos): #specific position temp = self.head
random_line_split
linkedlist_2.py
class Node: def
(self,data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def push(self, newdata): #in front newnode = Node(newdata) newnode.next = self.head self.head = newnode def insertAfter(self, prevnode, newdata): newnode = Node(newdata) newnode.next = prevnode.ne...
__init__
identifier_name
linkedlist_2.py
class Node: def __init__(self,data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def push(self, newdata): #in front newnode = Node(newdata) newnode.next = self.head self.head = newnode def insertAfter(self, prevnode, newdata):
def append(self, newdata): #at end newnode = Node(newdata) #if list is empty if self.head is None: self.head = newnode return #if not temp = self.head while(temp.next): temp = temp.next temp.next = newnode def deleteNode(self, key): #first one found temp = self.head while (temp is not ...
newnode = Node(newdata) newnode.next = prevnode.next prevnode.next = newnode
identifier_body
linkedlist_2.py
class Node: def __init__(self,data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def push(self, newdata): #in front newnode = Node(newdata) newnode.next = self.head self.head = newnode def insertAfter(self, prevnode, newdata): newnode = Node(newdata) n...
temp.next = newnode def deleteNode(self, key): #first one found temp = self.head while (temp is not None): print 'Now at:',temp.data if temp.data == key: print 'Found 3 at',temp.data break print 'prev is temp now' prev = temp temp = temp.next if(temp == None): return prev.next = te...
temp = temp.next
conditional_block
fcn_mask_for_label_names.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 from chainer import cuda import chainer.serializers as S from chainer import Variable from fcn.models import FCN32s import numpy as np import cv_bridge import jsk_apc2016_comm...
label_pred[mask_img == 0] = 0 # set bg_label label_viz = label2rgb(label_pred, bgr_img, bg_label=0) label_viz = (label_viz * 255).astype(np.uint8) debug_msg = bridge.cv2_to_imgmsg(label_viz, encoding='rgb8') debug_msg.header = img_msg.header self.pub_debug.publish(debu...
label_pred[label_pred_in_candidates == idx] = label_val
conditional_block
fcn_mask_for_label_names.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 from chainer import cuda import chainer.serializers as S from chainer import Variable from fcn.models import FCN32s import numpy as np import cv_bridge import jsk_apc2016_comm...
(self): super(self.__class__, self).__init__() # set target_names self.target_names = ['background'] + \ [datum['name'] for datum in jsk_apc2016_common.get_object_data()] n_class = len(self.target_names) assert n_class == 40 # load model ...
__init__
identifier_name
fcn_mask_for_label_names.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 from chainer import cuda import chainer.serializers as S from chainer import Variable from fcn.models import FCN32s import numpy as np import cv_bridge import jsk_apc2016_comm...
if self.tote_contents is not None: break logwarn_throttle(10, 'param ~tote_contents is not set. Waiting..') rospy.sleep(0.1) self.label_names = rospy.get_param('~label_names') jsk_logwarn('>> Param is set <<') self.pub = self.advertise('~outpu...
super(self.__class__, self).__init__() # set target_names self.target_names = ['background'] + \ [datum['name'] for datum in jsk_apc2016_common.get_object_data()] n_class = len(self.target_names) assert n_class == 40 # load model self.gpu = rosp...
identifier_body
fcn_mask_for_label_names.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 from chainer import cuda import chainer.serializers as S from chainer import Variable from fcn.models import FCN32s import numpy as np import cv_bridge import jsk_apc2016_comm...
from skimage.color import label2rgb from skimage.transform import resize class FCNMaskForLabelNames(ConnectionBasedTransport): mean_bgr = np.array((104.00698793, 116.66876762, 122.67891434)) def __init__(self): super(self.__class__, self).__init__() # set target_names self.target_na...
import rospy from sensor_msgs.msg import Image
random_line_split
length.js
// Copyright (C) 2015 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-string.prototype.valueof description: > String.prototype.valueOf.length is 0. info: | String.prototype.valueOf ( ) 17 ECMAScript Standard Built-in Objects: Every b...
verifyProperty(String.prototype.valueOf, 'length', { value: 0, writable: false, enumerable: false, configurable: true, });
[[Configurable]]: true }. includes: [propertyHelper.js] ---*/
random_line_split
vec.rs
use super::id::{Id, IdIndex, MAXIMUM_CAPACITY}; use super::slab::IdSlab; use flat::{Flat, FlatAccess, FlatAccessMut, FlatGet, FlatGetMut}; pub struct IdVec<F: Flat> { ids: IdSlab<u32>, reverse: Vec<IdIndex>, flat: F, } impl<F: Flat> IdVec<F> { pub fn new() -> Self { IdVec { ids: Id...
#[inline] pub fn get_mut<'a>( &'a mut self, id: Id<F::Element>, ) -> Option<<&'a mut F as FlatGetMut>::ElementRefMut> where &'a mut F: FlatGetMut, { // Not using `.and_then` to work around borrowck. match self.ids.get(id.cast()) { Some(&index) =>...
{ self.ids .get(id.cast()) .and_then(|&index| self.flat.flat_get(index as usize)) }
identifier_body
vec.rs
use super::id::{Id, IdIndex, MAXIMUM_CAPACITY}; use super::slab::IdSlab; use flat::{Flat, FlatAccess, FlatAccessMut, FlatGet, FlatGetMut}; pub struct IdVec<F: Flat> { ids: IdSlab<u32>, reverse: Vec<IdIndex>, flat: F, } impl<F: Flat> IdVec<F> { pub fn new() -> Self { IdVec { ids: Id...
self.flat.flat_access_mut() } } impl<T: Flat> Default for IdVec<T> { fn default() -> Self { Self::new() } }
&'a mut F: FlatAccessMut, {
random_line_split
vec.rs
use super::id::{Id, IdIndex, MAXIMUM_CAPACITY}; use super::slab::IdSlab; use flat::{Flat, FlatAccess, FlatAccessMut, FlatGet, FlatGetMut}; pub struct IdVec<F: Flat> { ids: IdSlab<u32>, reverse: Vec<IdIndex>, flat: F, } impl<F: Flat> IdVec<F> { pub fn new() -> Self { IdVec { ids: Id...
(capacity: usize) -> Self { assert!(capacity <= MAXIMUM_CAPACITY); IdVec { ids: IdSlab::with_capacity(capacity), reverse: Vec::with_capacity(capacity), flat: F::with_capacity(capacity), } } #[inline] pub fn len(&self) -> usize { self.ids.l...
with_capacity
identifier_name
custom_tests.rs
use crate::generated::{CloudWatch, CloudWatchClient, Dimension, MetricDatum, PutMetricDataInput}; use rusoto_core::param::Params; use rusoto_core::signature::SignedRequest; use rusoto_core::signature::SignedRequestPayload; use rusoto_core::Region; use rusoto_mock::*; use serde_urlencoded; #[tokio::test] async fn
() { let mock = MockRequestDispatcher::with_status(200) .with_body("") .with_request_checker(|request: &SignedRequest| { assert_eq!("POST", request.method); assert_eq!("/", request.path); if let Some(SignedRequestPayload::Buffer(ref buffer)) = request.payload { ...
should_serialize_complex_metric_data_params
identifier_name
custom_tests.rs
use crate::generated::{CloudWatch, CloudWatchClient, Dimension, MetricDatum, PutMetricDataInput}; use rusoto_core::param::Params; use rusoto_core::signature::SignedRequest; use rusoto_core::signature::SignedRequestPayload; use rusoto_core::Region; use rusoto_mock::*; use serde_urlencoded; #[tokio::test] async fn shou...
assert_eq!( params.get("MetricData.member.1.Value"), Some(&Some("1".to_owned())) ); assert_eq!( params.get("MetricData.member.1.Dimensions.member.1.Name"), Some(&Some("foo".to_owned())) ...
{ let mock = MockRequestDispatcher::with_status(200) .with_body("") .with_request_checker(|request: &SignedRequest| { assert_eq!("POST", request.method); assert_eq!("/", request.path); if let Some(SignedRequestPayload::Buffer(ref buffer)) = request.payload { ...
identifier_body
custom_tests.rs
use crate::generated::{CloudWatch, CloudWatchClient, Dimension, MetricDatum, PutMetricDataInput}; use rusoto_core::param::Params; use rusoto_core::signature::SignedRequest; use rusoto_core::signature::SignedRequestPayload; use rusoto_core::Region; use rusoto_mock::*; use serde_urlencoded; #[tokio::test] async fn shou...
Some(&Some("foo".to_owned())) ); assert_eq!( params.get("MetricData.member.1.Dimensions.member.1.Value"), Some(&Some("bar".to_owned())) ); } else { panic!("Unexpected request.payload:...
{ let params: Params = serde_urlencoded::from_bytes(buffer).unwrap(); assert_eq!( params.get("Namespace"), Some(&Some("TestNamespace".to_owned())) ); assert_eq!( params.get("MetricData.member.1.Me...
conditional_block
custom_tests.rs
use crate::generated::{CloudWatch, CloudWatchClient, Dimension, MetricDatum, PutMetricDataInput}; use rusoto_core::param::Params; use rusoto_core::signature::SignedRequest; use rusoto_core::signature::SignedRequestPayload; use rusoto_core::Region; use rusoto_mock::*; use serde_urlencoded; #[tokio::test] async fn shou...
name: "foo".to_string(), value: "bar".to_string(), }]), metric_name: "buffers".to_string(), statistic_values: None, timestamp: None, unit: Some("Bytes".to_string()), value: Some(1.0), ..Default::default() }]; let request = PutMetric...
random_line_split
index.ts
// Copyright 2018, Google, LLC. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wr...
{ return getAPI<T>('androidmanagement', versionOrOptions, VERSIONS, this); }
identifier_body
index.ts
// Copyright 2018, Google, LLC. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wr...
<T = androidmanagement_v1.Androidmanagement>( this: GoogleConfigurable, versionOrOptions: 'v1'|androidmanagement_v1.Options) { return getAPI<T>('androidmanagement', versionOrOptions, VERSIONS, this); }
androidmanagement
identifier_name
index.ts
// Copyright 2018, Google, LLC. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at //
// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governi...
random_line_split
Variables.js
/* * This file is part of the hyyan/woo-poly-integration plugin. * (c) Hyyan Abo Fakher <tiribthea4hyyan@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ (function ($, document, HYYAN_WPI_VARIABLES) { /** * Cons...
this._changeSaveBoxState(false); return false; } /** * Get current product language * * @returns {String} */ , getCurrentLanguage: function () { return this.$('#post_lang_choice').val(); } /** * Ge...
{ this._dialog.dialog('open'); /* Disable Saving */ this._changeSaveBoxState(true); return true; }
conditional_block
Variables.js
/* * This file is part of the hyyan/woo-poly-integration plugin. * (c) Hyyan Abo Fakher <tiribthea4hyyan@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ (function ($, document, HYYAN_WPI_VARIABLES) { /** * Cons...
* @param {jQuery} $ * @param {document} document * @param {object} data * * @returns {Variables} */ var Variables = function ($, document, data) { this.$ = $; this.document = document; this.data = data; this._dialog = this._createDialog(); }; V...
*
random_line_split
whoami.rs
//! `GET /_matrix/client/*/account/whoami` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami use ruma_common::{api::ruma_api, DeviceId, UserId}; ruma_api! { metadata: { description: "Get information...
} }
{ Self { user_id, device_id: None, is_guest } }
identifier_body
whoami.rs
//! `GET /_matrix/client/*/account/whoami` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami use ruma_common::{api::ruma_api, DeviceId, UserId}; ruma_api! { metadata: { description: "Get information...
(user_id: Box<UserId>, is_guest: bool) -> Self { Self { user_id, device_id: None, is_guest } } } }
new
identifier_name
whoami.rs
//! `GET /_matrix/client/*/account/whoami` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami use ruma_common::{api::ruma_api, DeviceId, UserId}; ruma_api! { metadata: { description: "Get information...
#[derive(Default)] request: {} response: { /// The id of the user that owns the access token. pub user_id: Box<UserId>, /// The device ID associated with the access token, if any. #[serde(skip_serializing_if = "Option::is_none")] pub ...
added: 1.0, }
random_line_split
test_reactor.rs
use tokio::io::Ready; use tokio::reactor::{self, Config, Reactor, Task, Tick}; use std::io; use std::sync::mpsc::{self, Sender}; #[test] fn test_internal_source_state_is_cleaned_up() { use mio::{Evented, EventSet, Poll, PollOpt, Token}; struct Foo; impl Evented for Foo { fn register(&self, _: &Po...
// Create a reactor that will only accept a single source let reactor = Reactor::new(config).unwrap(); reactor.handle().oneshot(|| { let foo = Foo; // Run this a few times, because even if we request a slab of size 1, // there could be greater capacity (usually 2 given rounding to...
} } let config = Config::new() .max_sources(1);
random_line_split
test_reactor.rs
use tokio::io::Ready; use tokio::reactor::{self, Config, Reactor, Task, Tick}; use std::io; use std::sync::mpsc::{self, Sender}; #[test] fn test_internal_source_state_is_cleaned_up() { use mio::{Evented, EventSet, Poll, PollOpt, Token}; struct Foo; impl Evented for Foo { fn register(&self, _: &Po...
(&self, _: &Poll) -> io::Result<()> { Ok(()) } } let config = Config::new() .max_sources(1); // Create a reactor that will only accept a single source let reactor = Reactor::new(config).unwrap(); reactor.handle().oneshot(|| { let foo = Foo; // Run this...
deregister
identifier_name
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='django-modeltranslation', version='0.4.0-alpha1', description='Translates Django models using a registration approach.', long_description='The modeltranslation application can be used to ' 'translate dynamic con...
license='New BSD')
requires=['django(>=1.0)'], download_url='http://django-modeltranslation.googlecode.com/files/django-modeltranslation-0.4.0-alpha1.tar.gz', classifiers=['Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License'],
random_line_split
statFeedbackContainer.ts
import { connect } from "react-redux" import rootWrapper from "../../wrappers/rootWrapper" import { StateProps, ActionProps, View } from "../../views/stats/statFeedbackView" import { fetchSessionStats, fetchSessionByName } from "../../api/fetchs" import { fetchStatsSuccess } from "../../store/stats/actions" functio...
function mapDispatchToProps(dispatch, ownProps) { return { fetchStatsSuccess: (res) => dispatch(fetchStatsSuccess(res)) } } export default rootWrapper( mapStateToProps, mapDispatchToProps, null, (props, done) => { fetchSessionByName(props.params.course, session => { ...
{ return { panic: state.stat.panic, tooSlow: state.stat.tooSlow, tooFast: state.stat.tooFast, date: state.stat.date, comments: state.stat.comments } }
identifier_body
statFeedbackContainer.ts
import { connect } from "react-redux" import rootWrapper from "../../wrappers/rootWrapper" import { StateProps, ActionProps, View } from "../../views/stats/statFeedbackView" import { fetchSessionStats, fetchSessionByName } from "../../api/fetchs" import { fetchStatsSuccess } from "../../store/stats/actions" functio...
(state, ownProps) { return { panic: state.stat.panic, tooSlow: state.stat.tooSlow, tooFast: state.stat.tooFast, date: state.stat.date, comments: state.stat.comments } } function mapDispatchToProps(dispatch, ownProps) { return { fetchStatsSuccess: (res) => dis...
mapStateToProps
identifier_name
statFeedbackContainer.ts
import { connect } from "react-redux" import rootWrapper from "../../wrappers/rootWrapper" import { StateProps, ActionProps, View } from "../../views/stats/statFeedbackView" import { fetchSessionStats, fetchSessionByName } from "../../api/fetchs" import { fetchStatsSuccess } from "../../store/stats/actions" functio...
date: state.stat.date, comments: state.stat.comments } } function mapDispatchToProps(dispatch, ownProps) { return { fetchStatsSuccess: (res) => dispatch(fetchStatsSuccess(res)) } } export default rootWrapper( mapStateToProps, mapDispatchToProps, null, (props, done) ...
tooFast: state.stat.tooFast,
random_line_split
ns_css_shadow_item.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/. */ //! Rust helpers for Gecko's `nsCSSShadowItem`. use app_units::Au; use gecko::values::{convert_rgba_to_nscolor, c...
color: self.extract_color(), horizontal: Au(self.mXOffset).into(), vertical: Au(self.mYOffset).into(), blur: Au(self.mRadius).into(), } } /// Returns this item as a simple shadow. #[inline] pub fn to_simple_shadow(&self) -> SimpleShadow { ...
fn extract_simple_shadow(&self) -> SimpleShadow { SimpleShadow {
random_line_split
ns_css_shadow_item.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/. */ //! Rust helpers for Gecko's `nsCSSShadowItem`. use app_units::Au; use gecko::values::{convert_rgba_to_nscolor, c...
} #[inline] fn extract_color(&self) -> Option<RGBAColor> { if self.mHasColor { Some(convert_nscolor_to_rgba(self.mColor)) } else { None } } /// Gets a simple shadow from this item. #[inline] fn extract_simple_shadow(&self) -> SimpleShadow { ...
{ // TODO handle currentColor // https://bugzilla.mozilla.org/show_bug.cgi?id=760345 self.mHasColor = false; self.mColor = 0; }
conditional_block
ns_css_shadow_item.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/. */ //! Rust helpers for Gecko's `nsCSSShadowItem`. use app_units::Au; use gecko::values::{convert_rgba_to_nscolor, c...
(&mut self, shadow: BoxShadow) { self.set_from_simple_shadow(shadow.base); self.mSpread = shadow.spread.to_i32_au(); self.mInset = shadow.inset; } /// Returns this item as a box shadow. #[inline] pub fn to_box_shadow(&self) -> BoxShadow { BoxShadow { base: se...
set_from_box_shadow
identifier_name
ns_css_shadow_item.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/. */ //! Rust helpers for Gecko's `nsCSSShadowItem`. use app_units::Au; use gecko::values::{convert_rgba_to_nscolor, c...
/// Sets this item from the given simple shadow. #[inline] pub fn set_from_simple_shadow(&mut self, shadow: SimpleShadow) { self.mXOffset = shadow.horizontal.to_i32_au(); self.mYOffset = shadow.vertical.to_i32_au(); self.mRadius = shadow.blur.0.to_i32_au(); self.mSpread = 0...
{ BoxShadow { base: self.extract_simple_shadow(), spread: Au(self.mSpread).into(), inset: self.mInset, } }
identifier_body
shard.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use anyhow::Error; use context::{CoreContext, PerfCounterType}; use futures_stats::TimedTryFutureExt; use std::collections::hash_map::Defau...
(shard_count: NonZeroUsize, perf_counter_type: PerfCounterType) -> Self { let semaphores = (0..shard_count.get()) .into_iter() .map(|_| Semaphore::new(1)) .collect(); Self { semaphores, perf_counter_type, } } pub fn len(&self)...
new
identifier_name
shard.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use anyhow::Error; use context::{CoreContext, PerfCounterType}; use futures_stats::TimedTryFutureExt; use std::collections::hash_map::Defau...
Ok(SemaphoreAcquisition::Acquired(permit)) } }
{ return Ok(SemaphoreAcquisition::Cancelled(r, ticket)); }
conditional_block
shard.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use anyhow::Error; use context::{CoreContext, PerfCounterType}; use futures_stats::TimedTryFutureExt; use std::collections::hash_map::Defau...
pub fn len(&self) -> usize { self.semaphores.len() } fn handle<'a>(&'a self, ctx: &'a CoreContext, key: &str) -> ShardHandle<'a> { let mut hasher = DefaultHasher::new(); key.hash(&mut hasher); let semaphore = &self.semaphores[(hasher.finish() % self.semaphores.len() as u64...
{ let semaphores = (0..shard_count.get()) .into_iter() .map(|_| Semaphore::new(1)) .collect(); Self { semaphores, perf_counter_type, } }
identifier_body