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
lib.rs
value as a binary strings. pub fn value_binary_string(&self) -> String { format!("{:#01$b}", self.value, self.width + 2) } } impl Display for FieldInfo { fn fmt(&self, f: &mut Formatter) -> fmt::Result { if self.width == 1 { write!( f, "{}: {}", ...
None,
random_line_split
stock.ts
import { Component } from '@angular/core'; import {ModalController} from 'ionic-angular'; import {RawMaterial, RawMaterialProvider} from "../../providers/raw-material/raw-material"; import {Observable} from "rxjs/Observable"; import {NewStockPage} from "../new-stock/new-stock"; import 'rxjs/add/operator/do' /**
* See http://ionicframework.com/docs/components/#navigation for more info * on Ionic pages and navigation. */ @Component({ selector: 'page-stock', templateUrl: 'stock.html', }) export class StockPage { rawMaterials: Observable<RawMaterial[]>; loading: boolean; constructor(private rawMaterialProvider: RawM...
* Generated class for the StockPage page. *
random_line_split
stock.ts
import { Component } from '@angular/core'; import {ModalController} from 'ionic-angular'; import {RawMaterial, RawMaterialProvider} from "../../providers/raw-material/raw-material"; import {Observable} from "rxjs/Observable"; import {NewStockPage} from "../new-stock/new-stock"; import 'rxjs/add/operator/do' /** * Gen...
{ rawMaterials: Observable<RawMaterial[]>; loading: boolean; constructor(private rawMaterialProvider: RawMaterialProvider, public modalCtrl: ModalController) { this.loading = true; this.rawMaterials = this.rawMaterialProvider.getRawMaterials().do( () => { this.loading = false;}, ...
StockPage
identifier_name
stock.ts
import { Component } from '@angular/core'; import {ModalController} from 'ionic-angular'; import {RawMaterial, RawMaterialProvider} from "../../providers/raw-material/raw-material"; import {Observable} from "rxjs/Observable"; import {NewStockPage} from "../new-stock/new-stock"; import 'rxjs/add/operator/do' /** * Gen...
} openAddNewStockModal(rawMaterial?: any) { let modal = this.modalCtrl.create(NewStockPage, { rawMaterial: rawMaterial }); modal.present(); } }
{ this.rawMaterials = this.rawMaterialProvider.getRawMaterials(searchName); }
conditional_block
stock.ts
import { Component } from '@angular/core'; import {ModalController} from 'ionic-angular'; import {RawMaterial, RawMaterialProvider} from "../../providers/raw-material/raw-material"; import {Observable} from "rxjs/Observable"; import {NewStockPage} from "../new-stock/new-stock"; import 'rxjs/add/operator/do' /** * Gen...
}
{ let modal = this.modalCtrl.create(NewStockPage, { rawMaterial: rawMaterial }); modal.present(); }
identifier_body
mod.rs
// Copyright 2017 The Xyrosource Team. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except acco...
() -> slog::Logger { let drain = slog_term::streamer().compact().build().fuse(); Logger::root(drain, o!("version" => VERSION)) }
setup
identifier_name
mod.rs
// Copyright 2017 The Xyrosource Team. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except acco...
pub fn setup() -> slog::Logger { let drain = slog_term::streamer().compact().build().fuse(); Logger::root(drain, o!("version" => VERSION)) }
use self::version::VERSION;
random_line_split
mod.rs
// Copyright 2017 The Xyrosource Team. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except acco...
{ let drain = slog_term::streamer().compact().build().fuse(); Logger::root(drain, o!("version" => VERSION)) }
identifier_body
test_read_only.py
import pytest from flex.constants import ( STRING, BOOLEAN, INTEGER, ) from flex.error_messages import MESSAGES from flex.exceptions import ValidationError from flex.loading.definitions.schema import schema_validator from tests.utils import ( assert_path_not_in_errors, assert_message_in_errors, ) ...
assert_path_not_in_errors('readOnly', errors)
errors = {}
conditional_block
test_read_only.py
import pytest from flex.constants import ( STRING, BOOLEAN, INTEGER, ) from flex.error_messages import MESSAGES from flex.exceptions import ValidationError from flex.loading.definitions.schema import schema_validator from tests.utils import ( assert_path_not_in_errors, assert_message_in_errors, ) ...
err.value.detail, 'readOnly.type', ) def test_read_only_with_valid_value(): try: schema_validator({'readOnly': True}) except ValidationError as err: errors = err.detail else: errors = {} assert_path_not_in_errors('readOnly', errors)
random_line_split
test_read_only.py
import pytest from flex.constants import ( STRING, BOOLEAN, INTEGER, ) from flex.error_messages import MESSAGES from flex.exceptions import ValidationError from flex.loading.definitions.schema import schema_validator from tests.utils import ( assert_path_not_in_errors, assert_message_in_errors, ) ...
(value): with pytest.raises(ValidationError) as err: schema_validator({'readOnly': value}) assert_message_in_errors( MESSAGES['type']['invalid'], err.value.detail, 'readOnly.type', ) def test_read_only_with_valid_value(): try: schema_validator({'readOnly': True...
test_read_only_with_invalid_types
identifier_name
test_read_only.py
import pytest from flex.constants import ( STRING, BOOLEAN, INTEGER, ) from flex.error_messages import MESSAGES from flex.exceptions import ValidationError from flex.loading.definitions.schema import schema_validator from tests.utils import ( assert_path_not_in_errors, assert_message_in_errors, ) ...
def test_read_only_with_valid_value(): try: schema_validator({'readOnly': True}) except ValidationError as err: errors = err.detail else: errors = {} assert_path_not_in_errors('readOnly', errors)
with pytest.raises(ValidationError) as err: schema_validator({'readOnly': value}) assert_message_in_errors( MESSAGES['type']['invalid'], err.value.detail, 'readOnly.type', )
identifier_body
pilare-restrictions.js
(function() { var checkVersion = Dagaz.Model.checkVersion; Dagaz.Model.checkVersion = function(design, name, value) { if (name != "pilare-restrictions") { checkVersion(design, name, value); } } var CheckInvariants = Dagaz.Model.CheckInvariants; Dagaz.Model.CheckInvariants = function(board) { ...
var pos = null; _.each(design.allPositions(), function(p) { var piece = board.getPiece(p); if (piece === null) return; var v = piece.getValue(1); if (v === null) return; pos = p; }); if (pos !== null) { Dagaz.View.getView().current = [pos]; _.each(board.moves,...
random_line_split
pilare-restrictions.js
(function() { var checkVersion = Dagaz.Model.checkVersion; Dagaz.Model.checkVersion = function(design, name, value) { if (name != "pilare-restrictions") { checkVersion(design, name, value); } } var CheckInvariants = Dagaz.Model.CheckInvariants; Dagaz.Model.CheckInvariants = function(board) { ...
}); } CheckInvariants(board); } })();
{ if (m.actions[0][0][0] != pos) { m.failed = true; return; } if (m.actions[0][1][0] == board.lastf) { m.failed = true; return; } }
conditional_block
test_console_auth_tokens.py
# Copyright 2013 Cloudbase Solutions Srl # # 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 l...
self.flags(enabled=True, group='rdp') uuid = self._post_server() token = self._get_console_token(uuid) response = self._do_get('os-console-auth-tokens/%s' % token) subs = self._get_regexes() subs["uuid"] = uuid subs["host"] = r"[\w\.\-]+" subs["port"] = "[0-9]+...
identifier_body
test_console_auth_tokens.py
# Copyright 2013 Cloudbase Solutions Srl # # 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 l...
(self, data): return jsonutils.loads(data)["console"]["url"] def _get_console_token(self, uuid): response = self._do_post('servers/%s/action' % uuid, 'get-rdp-console-post-req', {'action': 'os-getRDPConsole'}) url = self._ge...
_get_console_url
identifier_name
test_console_auth_tokens.py
# Copyright 2013 Cloudbase Solutions Srl # # 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 l...
ADMIN_API = True extension_name = "os-console-auth-tokens" extra_extensions_to_load = ["os-remote-consoles"] def _get_console_url(self, data): return jsonutils.loads(data)["console"]["url"] def _get_console_token(self, uuid): response = self._do_post('servers/%s/action' % uuid, ...
random_line_split
rate_limit.rs
// Copyright 2016 The Grin Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
/// Get a mutable reference to the inner sink. pub fn get_mut(&mut self) -> &mut R { &mut self.reader } /// Consumes this combinator, returning the underlying sink. /// /// Note that this may discard intermediate state of this combinator, so /// care should be taken to avoid losing resources when this is ca...
{ &self.reader }
identifier_body
rate_limit.rs
// Copyright 2016 The Grin Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
(&mut self, buf: &mut [u8]) -> io::Result<usize> { // Check passed Time let time_passed = self.last_check.elapsed(); self.last_check = Instant::now(); self.allowed += time_passed.as_secs() as usize * self.max as usize; // Throttle if self.allowed > self.max as usize { self.allowed = self.max as usize; ...
read
identifier_name
rate_limit.rs
// Copyright 2016 The Grin Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
assert_eq!(cursor.position(), 8); } #[test] fn should_throttle_read() { let buf = vec![1; 64]; let mut t_buf = ThrottledReader::new(Cursor::new(buf), 8); let mut dst = Cursor::new(vec![0; 64]); for _ in 0..16 { let _ = t_buf.read_buf(&mut dst); } assert_eq!(dst.position(), 8); } }
let _ = t_buf.write_buf(&mut Cursor::new(vec![1; 8])); } let cursor = t_buf.into_inner();
random_line_split
rate_limit.rs
// Copyright 2016 The Grin Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agree...
res } fn flush(&mut self) -> io::Result<()> { self.writer.flush() } } impl<T: AsyncWrite> AsyncWrite for ThrottledWriter<T> { fn shutdown(&mut self) -> Poll<(), io::Error> { self.writer.shutdown() } } #[cfg(test)] mod test { use super::*; use std::io::Cursor; #[test] fn should_throttle_write() { l...
{ self.allowed -= n; }
conditional_block
0070-check_recommended_services.ts
#!/usr/bin/env perl use strict; use warnings; use Test::More; use FindBin; BEGIN { unshift @::INC, "$FindBin::Bin/lib", "$FindBin::Bin/../../src/backend/build", "/usr/lib/build" ; } use OBS::Test::Utils; use Build::Rpm; my $test_count = 6; my $max_wait = 300; my @daemons = qw/obsdodup obssigner obs...
$max_wait--; sleep 1; } foreach my $srv ( @daemons ) { is($srv_state{$srv} || 'timeout','active',"Checking recommended service '$srv' status"); } exit 0;
{ last; }
conditional_block
0070-check_recommended_services.ts
#!/usr/bin/env perl use strict; use warnings; use Test::More; use FindBin; BEGIN { unshift @::INC, "$FindBin::Bin/lib", "$FindBin::Bin/../../src/backend/build", "/usr/lib/build" ; } use OBS::Test::Utils; use Build::Rpm; my $test_count = 6; my $max_wait = 300; my @daemons = qw/obsdodup obssigner obs...
exit 0;
foreach my $srv ( @daemons ) { is($srv_state{$srv} || 'timeout','active',"Checking recommended service '$srv' status"); }
random_line_split
markdown.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 ...
{text} <script type="text/javascript"> window.playgroundUrl = "{playground}"; </script> {after_content} </body> </html>"#, title = Escape(title), css = css, in_header = external_html.in_header, before_content = external_html.before_content, text = rendered...
<![endif]--> {before_content} <h1 class="title">{title}</h1>
random_line_split
markdown.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 ...
(input: &str, mut output: Path, matches: &getopts::Matches, external_html: &ExternalHtml, include_toc: bool) -> int { let input_p = Path::new(input); output.push(input_p.filestem().unwrap()); output.set_extension("html"); let mut css = String::new(); for name in matches.opt_strs("mark...
render
identifier_name
markdown.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 ...
/// Render `input` (e.g. "foo.md") into an HTML file in `output` /// (e.g. output = "bar" => "bar/foo.html"). pub fn render(input: &str, mut output: Path, matches: &getopts::Matches, external_html: &ExternalHtml, include_toc: bool) -> int { let input_p = Path::new(input); output.push(input_p.fil...
{ let mut metadata = Vec::new(); for line in s.lines() { if line.starts_with("%") { // remove %<whitespace> metadata.push(line.slice_from(1).trim_left()) } else { let line_start_byte = s.subslice_offset(line); return (metadata, s.slice_from(line_st...
identifier_body
markdown.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 ...
Ok(f) => f }; let (metadata, text) = extract_leading_metadata(input_str.as_slice()); if metadata.len() == 0 { let _ = writeln!(&mut io::stderr(), "invalid markdown file: expecting initial line with `% ...TITLE...`"); return 5; } let title = metadata...
{ let _ = writeln!(&mut io::stderr(), "error opening `{}` for writing: {}", output.display(), e); return 4; }
conditional_block
eqPattern.py
from pattern import Pattern import itertools import random import colorsys import time class EqPattern(Pattern): def __init__(self, meter_color=(255,100,50), background_color=(0,50,255)): self.meter_r = meter_color[0] self.meter_g = meter_color[1] self.meter_b = meter_color[2] self...
led_strip.put_pixels(pixel_colors)
random_line_split
eqPattern.py
from pattern import Pattern import itertools import random import colorsys import time class
(Pattern): def __init__(self, meter_color=(255,100,50), background_color=(0,50,255)): self.meter_r = meter_color[0] self.meter_g = meter_color[1] self.meter_b = meter_color[2] self.bg_r = background_color[0] self.bg_g = background_color[1] self.bg_b = background_colo...
EqPattern
identifier_name
eqPattern.py
from pattern import Pattern import itertools import random import colorsys import time class EqPattern(Pattern): def __init__(self, meter_color=(255,100,50), background_color=(0,50,255)): self.meter_r = meter_color[0] self.meter_g = meter_color[1] self.meter_b = meter_color[2] self...
def next_frame(self, octopus, data): beat_channel = int(round(self.beat_channel)) t = time.time() if data.beats[beat_channel] and t > self.next_shift: self.next_shift = t + 60.0/self.max_bpm shift = self.max_hue_shift*(2*random.random() - 1) if int(r...
color_scaled = [x/255.0 for x in color] hsv = list(colorsys.rgb_to_hsv(color_scaled[0], color_scaled[1], color_scaled[2])) hsv[0] += hue_shift % 1 return tuple([int(x*255) for x in colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2])])
identifier_body
eqPattern.py
from pattern import Pattern import itertools import random import colorsys import time class EqPattern(Pattern): def __init__(self, meter_color=(255,100,50), background_color=(0,50,255)): self.meter_r = meter_color[0] self.meter_g = meter_color[1] self.meter_b = meter_color[2] self...
pixel_colors = [] n_meter_pixels = int(len(led_strip.pixels)*float(level)) pixel_colors.extend([meter_color for x in range(n_meter_pixels)]) n_background_pixels = len(led_strip.pixels) - n_meter_pixels pixel_colors.extend([background_color for x in range...
conditional_block
index.js
import React from 'react' import {Modal, Form, Input, notification, DatePicker} from 'antd' import {connect} from 'dva' import styles from './index.less' import moment from 'moment' import {routerRedux} from 'dva/router' const FormItem = Form.Item; const {RangePicker} = DatePicker; class OrderModalForm extends React...
)(OrderModalForm));
s)(Form.create(
identifier_name
index.js
import React from 'react' import {Modal, Form, Input, notification, DatePicker} from 'antd' import {connect} from 'dva' import styles from './index.less' import moment from 'moment' import {routerRedux} from 'dva/router' const FormItem = Form.Item; const {RangePicker} = DatePicker; class OrderModalForm extends React...
endTime: moment(values.time[1]._d).format('YYYY-MM-DD'), } }) this.setOrderCancel(); } }) } setOrderCancel = () => { this.setState({ visible: false }) } disabledDate = (current) ...
remark: values.remark, name: values.orderName, beginTime: moment(values.time[0]._d).format('YYYY-MM-DD'),
random_line_split
index.js
import React from 'react' import {Modal, Form, Input, notification, DatePicker} from 'antd' import {connect} from 'dva' import styles from './index.less' import moment from 'moment' import {routerRedux} from 'dva/router' const FormItem = Form.Item; const {RangePicker} = DatePicker; class OrderModalForm extends React...
visible: true }) } setOrderOk = () => { this.props.form.validateFields((err, values) => { if (!err) { this.props.dispatch({ type: 'cart/createOrder', payload: { remark: values.remark, ...
{ notification.error({ message: "选好车空空如也", description: "请选择点账号再来下单吧" }) return; } this.setState({
conditional_block
index.js
import React from 'react' import {Modal, Form, Input, notification, DatePicker} from 'antd' import {connect} from 'dva' import styles from './index.less' import moment from 'moment' import {routerRedux} from 'dva/router' const FormItem = Form.Item; const {RangePicker} = DatePicker; class OrderModalForm extends React...
odalForm));
identifier_body
atanh.ts
/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
export const atanh = op({atanh_});
{ const $x = convertToTensor(x, 'x', 'atanh'); const inputs: AtanhInputs = {x: $x}; return ENGINE.runKernel(Atanh, inputs as {} as NamedTensorMap); }
identifier_body
atanh.ts
/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
* * x.atanh().print(); // or tf.atanh(x) * ``` * @param x The input tensor. * * @doc {heading: 'Operations', subheading: 'Basic math'} */ function atanh_<T extends Tensor>(x: T|TensorLike): T { const $x = convertToTensor(x, 'x', 'atanh'); const inputs: AtanhInputs = {x: $x}; return ENGINE.runKernel(Atan...
random_line_split
atanh.ts
/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
<T extends Tensor>(x: T|TensorLike): T { const $x = convertToTensor(x, 'x', 'atanh'); const inputs: AtanhInputs = {x: $x}; return ENGINE.runKernel(Atanh, inputs as {} as NamedTensorMap); } export const atanh = op({atanh_});
atanh_
identifier_name
ConfigCheck.py
# -*- coding: utf-8 -*- ############################################################################# # File : ConfigCheck.py # Package : rpmlint # Author : Frederic Lepied # Created on : Sun Oct 3 21:48:20 1999 # Purpose : ################################################################...
if c not in noreplace_files: printWarning(pkg, "conffile-without-noreplace-flag", c) # Create an object to enable the auto registration of the test check = ConfigCheck() # Add information about checks addDetails( 'score-file-must-not-be-conffile', """A file in /var/lib/games/ is a config...
printWarning(pkg, "non-etc-or-var-file-marked-as-conffile", c)
conditional_block
ConfigCheck.py
# -*- coding: utf-8 -*- ############################################################################# # File : ConfigCheck.py # Package : rpmlint # Author : Frederic Lepied # Created on : Sun Oct 3 21:48:20 1999 # Purpose : ################################################################...
(AbstractCheck.AbstractCheck): def __init__(self): AbstractCheck.AbstractCheck.__init__(self, "ConfigCheck") def check_binary(self, pkg): config_files = pkg.configFiles() noreplace_files = pkg.noreplaceFiles() for c in config_files: if c.startswith("/var/lib/games/...
ConfigCheck
identifier_name
ConfigCheck.py
# -*- coding: utf-8 -*- ############################################################################# # File : ConfigCheck.py # Package : rpmlint # Author : Frederic Lepied # Created on : Sun Oct 3 21:48:20 1999 # Purpose : ################################################################...
# Create an object to enable the auto registration of the test check = ConfigCheck() # Add information about checks addDetails( 'score-file-must-not-be-conffile', """A file in /var/lib/games/ is a configuration file. Store your conf files in /etc instead.""", 'non-etc-or-var-file-marked-as-conffile', """A file not ...
def __init__(self): AbstractCheck.AbstractCheck.__init__(self, "ConfigCheck") def check_binary(self, pkg): config_files = pkg.configFiles() noreplace_files = pkg.noreplaceFiles() for c in config_files: if c.startswith("/var/lib/games/"): printError(pkg, ...
identifier_body
ConfigCheck.py
# -*- coding: utf-8 -*- ############################################################################# # File : ConfigCheck.py # Package : rpmlint # Author : Frederic Lepied # Created on : Sun Oct 3 21:48:20 1999 # Purpose : ################################################################...
printWarning(pkg, "conffile-without-noreplace-flag", c) # Create an object to enable the auto registration of the test check = ConfigCheck() # Add information about checks addDetails( 'score-file-must-not-be-conffile', """A file in /var/lib/games/ is a configuration file. Store your conf files in /etc...
printError(pkg, "score-file-must-not-be-conffile", c) elif not c.startswith("/etc/") and not c.startswith("/var/"): printWarning(pkg, "non-etc-or-var-file-marked-as-conffile", c) if c not in noreplace_files:
random_line_split
FreakshareCom.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from module.plugins.Hoster import Hoster from module.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" ...
pyfile.name = self.get_file_name() pyfile.size = self.get_file_size() self.wait() return True def download_html(self): self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session self.html = self.load(self.pyfile.url)...
self.setWait(self.get_waiting_time())
random_line_split
FreakshareCom.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from module.plugins.Hoster import Hoster from module.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" ...
(self): self.multiDL = False self.req_opts = [] def process(self, pyfile): self.pyfile = pyfile pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/") if self.account: self.html = self.load(pyfile.url, cookies=False) pyfile.name = sel...
setup
identifier_name
FreakshareCom.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from module.plugins.Hoster import Hoster from module.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" ...
def get_file_size(self): size = 0 if self.html is None: self.download_html() if not self.wantReconnect: file_size_check = re.search( r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) if file...
if self.html is None: self.download_html() if not self.wantReconnect: file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) if file_name is not None: file_name = file_name.group(1) else: ...
identifier_body
FreakshareCom.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from module.plugins.Hoster import Hoster from module.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" ...
def get_file_size(self): size = 0 if self.html is None: self.download_html() if not self.wantReconnect: file_size_check = re.search( r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) if file...
return self.pyfile.url
conditional_block
SdmlConfiguration.py
# SecuML # Copyright (C) 2016 ANSSI # # SecuML is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # SecuML is distributed in the hope t...
(self): conf = SemiSupervisedProjectionConfiguration.toJson(self) conf['__type__'] = 'SdmlConfiguration' return conf DimensionReductionConfFactory.getFactory().registerClass('SdmlConfiguration', SdmlConfiguration)
toJson
identifier_name
SdmlConfiguration.py
# SecuML # Copyright (C) 2016 ANSSI # # SecuML is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # SecuML is distributed in the hope t...
DimensionReductionConfFactory.getFactory().registerClass('SdmlConfiguration', SdmlConfiguration)
conf = SemiSupervisedProjectionConfiguration.toJson(self) conf['__type__'] = 'SdmlConfiguration' return conf
identifier_body
SdmlConfiguration.py
# SecuML # Copyright (C) 2016 ANSSI # # SecuML is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # SecuML is distributed in the hope t...
# You should have received a copy of the GNU General Public License along # with SecuML. If not, see <http://www.gnu.org/licenses/>. from SecuML.core.DimensionReduction.Algorithms.Projection.Sdml import Sdml from SecuML.core.DimensionReduction.Configuration import DimensionReductionConfFactory from .SemiSupervisedPro...
# GNU General Public License for more details. #
random_line_split
all.js
/** * @license * Copyright 2013 Google Inc. All rights reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
goog.require('e2e.hash.Sha256'); /** @suppress {extraRequire} intentional import */ goog.require('e2e.hash.Sha384'); /** @suppress {extraRequire} intentional import */ goog.require('e2e.hash.Sha512');
/** @suppress {extraRequire} intentional import */ goog.require('e2e.hash.Sha1'); /** @suppress {extraRequire} intentional import */ goog.require('e2e.hash.Sha224'); /** @suppress {extraRequire} intentional import */
random_line_split
media_object.py
""" TODO: Add docstring """ import re import pexpect class MediaObject(object): """Represents an encodable object""" def __init__(self, input_filename, output_filename): self.input_filename = input_filename self.output_filename = output_filename
def get_media_duration(self): """ Spawns an avprobe process to get the media duration. Spawns an avprobe process and saves the output to a list, then uses regex to find the duration of the media and return it as an integer. """ info_process = pexpect.spawn("/usr/bi...
self.media_duration = self.get_media_duration() # INFO: All other media information could potentially be put here too
random_line_split
media_object.py
""" TODO: Add docstring """ import re import pexpect class MediaObject(object): """Represents an encodable object""" def __init__(self, input_filename, output_filename): self.input_filename = input_filename self.output_filename = output_filename self.media_duration = self.get_media_d...
# Not found so it's possible the process terminated early or an update # broke the regex. Unlikely but we must return something just in case. return -1
regex_match = regex_group.search(line) if regex_match: # Return the total duration in seconds return ((int(regex_match.group(1)) * 3600) + # Hours (int(regex_match.group(2)) * 60) + # Minutes int(regex_match.group(3)) + ...
conditional_block
media_object.py
""" TODO: Add docstring """ import re import pexpect class MediaObject(object):
# number in form 00:00:00:00 regex_group = re.compile(".*?Duration: .*?(\\d+):(\\d+):(\\d+).(\\d+)", re.IGNORECASE | re.DOTALL) # Exits as soon as duration is found # PERF: Perform some tests to find the min number of lines # certain not to contai...
"""Represents an encodable object""" def __init__(self, input_filename, output_filename): self.input_filename = input_filename self.output_filename = output_filename self.media_duration = self.get_media_duration() # INFO: All other media information could potentially be put here too...
identifier_body
media_object.py
""" TODO: Add docstring """ import re import pexpect class MediaObject(object): """Represents an encodable object""" def
(self, input_filename, output_filename): self.input_filename = input_filename self.output_filename = output_filename self.media_duration = self.get_media_duration() # INFO: All other media information could potentially be put here too def get_media_duration(self): """ ...
__init__
identifier_name
mod.rs
pub mod default; pub mod plugged;
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] pub enum Tag { Encrypted(Vec<u8>, Vec<u8>), PlainText(Vec<u8>, String) } #[derive(Debug)] pub enum TagName { OfEncrypted(Vec<u8>), OfPlain(Vec<u8>), } #[derive(Clone, Debug)] pub struct StorageRecord { pub id: Vec<u8>, pub value: Option<E...
use errors::prelude::*; use services::wallet::language; use services::wallet::wallet::EncryptedValue;
random_line_split
mod.rs
pub mod default; pub mod plugged; use errors::prelude::*; use services::wallet::language; use services::wallet::wallet::EncryptedValue; #[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)] pub enum
{ Encrypted(Vec<u8>, Vec<u8>), PlainText(Vec<u8>, String) } #[derive(Debug)] pub enum TagName { OfEncrypted(Vec<u8>), OfPlain(Vec<u8>), } #[derive(Clone, Debug)] pub struct StorageRecord { pub id: Vec<u8>, pub value: Option<EncryptedValue>, pub type_: Option<Vec<u8>>, pub tags: Option...
Tag
identifier_name
delay.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function
() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var async_1 = require('../scheduler/async'); var isDate_1 = require('../util/isDate'); var Subscriber_1 = require('../Subscriber'); var Notification_1 = require('../Notification'); /** * Delays the...
__
identifier_name
delay.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var async_1 = require('../scheduler/async'); var...
if (this.active === false) { this._schedule(scheduler); } }; DelaySubscriber.prototype._next = function (value) { this.scheduleNotification(Notification_1.Notification.createNext(value)); }; DelaySubscriber.prototype._error = function (err) { this.errored = tr...
return; } var scheduler = this.scheduler; var message = new DelayMessage(scheduler.now() + this.delay, notification); this.queue.push(message);
random_line_split
delay.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var async_1 = require('../scheduler/async'); var...
DelaySubscriber.dispatch = function (state) { var source = state.source; var queue = source.queue; var scheduler = state.scheduler; var destination = state.destination; while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { queue.shift().notificatio...
{ _super.call(this, destination); this.delay = delay; this.scheduler = scheduler; this.queue = []; this.active = false; this.errored = false; }
identifier_body
delay.js
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var async_1 = require('../scheduler/async'); var...
}; DelaySubscriber.prototype._next = function (value) { this.scheduleNotification(Notification_1.Notification.createNext(value)); }; DelaySubscriber.prototype._error = function (err) { this.errored = true; this.queue = []; this.destination.error(err); }; DelaySub...
{ this._schedule(scheduler); }
conditional_block
drop-env.rs
// Copyright 2017 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 ...
(&mut self) { A.fetch_add(1, Ordering::SeqCst); } } fn main() { t1(); t2(); t3(); } fn t1() { let b = B; let mut foo = || { yield; drop(b); }; let n = A.load(Ordering::SeqCst); drop(unsafe { foo.resume() }); assert_eq!(A.load(Ordering::SeqCst), n); ...
drop
identifier_name
drop-env.rs
// Copyright 2017 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 ...
impl Drop for B { fn drop(&mut self) { A.fetch_add(1, Ordering::SeqCst); } } fn main() { t1(); t2(); t3(); } fn t1() { let b = B; let mut foo = || { yield; drop(b); }; let n = A.load(Ordering::SeqCst); drop(unsafe { foo.resume() }); assert_eq!(A.loa...
struct B;
random_line_split
drop-env.rs
// Copyright 2017 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 t2() { let b = B; let mut foo = || { yield b; }; let n = A.load(Ordering::SeqCst); drop(unsafe { foo.resume() }); assert_eq!(A.load(Ordering::SeqCst), n + 1); drop(foo); assert_eq!(A.load(Ordering::SeqCst), n + 1); } fn t3() { let b = B; let foo = || { yiel...
{ let b = B; let mut foo = || { yield; drop(b); }; let n = A.load(Ordering::SeqCst); drop(unsafe { foo.resume() }); assert_eq!(A.load(Ordering::SeqCst), n); drop(foo); assert_eq!(A.load(Ordering::SeqCst), n + 1); }
identifier_body
all-downloads-unified-init.js
/* 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/. */ (function(Mozilla){ 'use strict'; function onLoad() { var browserHelpContent = document.getElemen...
Mozilla.run(onLoad); })(window.Mozilla);
random_line_split
all-downloads-unified-init.js
/* 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/. */ (function(Mozilla){ 'use strict'; function onLoad() { var browserHelpContent = document.getElemen...
} Mozilla.run(onLoad); })(window.Mozilla);
{ installerHelpIcon[i].addEventListener('click', function(e) { e.preventDefault(); showHelpModal.call(this, installerHelpContent, e.target.textContent, 'Get Installer Help'); }, false); }
conditional_block
all-downloads-unified-init.js
/* 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/. */ (function(Mozilla){ 'use strict'; function onLoad() { var browserHelpContent = document.getElemen...
(modalContent, modalTitle, eventLabel) { Mzp.Modal.createModal(this, modalContent, { title: modalTitle, className: 'help-modal' }); window.dataLayer.push({ 'event': 'in-page-interaction', 'eAction': 'link click', ...
showHelpModal
identifier_name
all-downloads-unified-init.js
/* 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/. */ (function(Mozilla){ 'use strict'; function onLoad() { var browserHelpContent = document.getElemen...
Mozilla.FirefoxDownloader.init(); // Browser help modal. browserHelpIcon.addEventListener('click', function(e) { e.preventDefault(); showHelpModal.call(this, browserHelpContent, browserHelpIcon.textContent, 'Get Browser Help'); }, false); // Installer ...
{ Mzp.Modal.createModal(this, modalContent, { title: modalTitle, className: 'help-modal' }); window.dataLayer.push({ 'event': 'in-page-interaction', 'eAction': 'link click', 'eLabel': eventLabel ...
identifier_body
local_data.rs
} let task: *mut Task = Local::unsafe_borrow(); match &mut (*task).storage { // If the at_exit function is already set, then we just need to take // a loan out on the TLD map stored inside &LocalStorage(Some(ref mut map_ptr)) => { return Some(map_ptr); } // ...
fn le(&self, other: &Ref<T>) -> bool { (**self).le(&**other) } fn gt(&self, other: &Ref<T>) -> bool { (**self).gt(&**other) } fn ge(&self, other: &Ref<T>) -> bool { (**self).ge(&**other) } } impl<T: cmp::Ord + 'static> cmp::Ord for Ref<T> { fn cmp(&self, other: &Ref<T>) -> cmp::Ordering { (**s...
{ (**self).lt(&**other) }
identifier_body
local_data.rs
'static>(key: Key<T>) -> uint { key as *const _ as uint } impl<T: 'static> KeyValue<T> { /// Replaces a value in task local data. /// /// If this key is already present in TLD, then the previous value is /// replaced with the provided data, and then returned. /// /// # Panics /// /...
// the contained value is valid; drop it ptr::read(&(*value_box).value); } // the box will be deallocated by the guard }
random_line_split
local_data.rs
order to insert // our data if the key isn't present, we need to let the match end first. let data = match (map.get_mut(&keyval), data) { (None, Some(data)) => { // The key doesn't exist and we need to insert it. To make borrowck // happy, return it up a scop...
test_tls_overwrite
identifier_name
ProcessBranch.py
from Node import * from Pin import * from Utilities import getQuotedString ### # FUNCTION : Handle Branch nodes ### def
(lines, buildMode, nodeNumber, OUTPUT_FOLDER): node = Node("Branch", buildMode) inObject = False pinName = "" pinType = "" pinSide = "" for line in lines: line = line.strip(" ") if inObject: if line.startswith("PinName="): print("-Name : " + line) pinName = getQuotedString(line) if line.startsw...
processBranch
identifier_name
ProcessBranch.py
from Node import * from Pin import * from Utilities import getQuotedString ### # FUNCTION : Handle Branch nodes ### def processBranch(lines, buildMode, nodeNumber, OUTPUT_FOLDER): node = Node("Branch", buildMode) inObject = False pinName = "" pinType = "" pinSide = "" for line in lines: line = line.strip(" "...
PinType = "" pinSide = "" # print("Out Object") # print(">" + line + "<"); print(node) node.writeNode(nodeNumber, OUTPUT_FOLDER)
inObject = False if pinSide != "": pin = Pin(pinName, pinType) node.addPin(pin, pinSide) pinName = ""
random_line_split
ProcessBranch.py
from Node import * from Pin import * from Utilities import getQuotedString ### # FUNCTION : Handle Branch nodes ### def processBranch(lines, buildMode, nodeNumber, OUTPUT_FOLDER):
if line.startswith("Begin Object Name="): inObject = True pinName = "" PinType = "" pinSide = "Left" print("In Object") if line.startswith("End Object"): inObject = False if pinSide != "": pin = Pin(pinName, pinType) node.addPin(pin, pinSide) pinName = "" PinType = "" pinSid...
node = Node("Branch", buildMode) inObject = False pinName = "" pinType = "" pinSide = "" for line in lines: line = line.strip(" ") if inObject: if line.startswith("PinName="): print("-Name : " + line) pinName = getQuotedString(line) if line.startswith("PinType="): print("-Type : " + line) ...
identifier_body
ProcessBranch.py
from Node import * from Pin import * from Utilities import getQuotedString ### # FUNCTION : Handle Branch nodes ### def processBranch(lines, buildMode, nodeNumber, OUTPUT_FOLDER): node = Node("Branch", buildMode) inObject = False pinName = "" pinType = "" pinSide = "" for line in lines: line = line.strip(" "...
if line.startswith("Begin Object Name="): inObject = True pinName = "" PinType = "" pinSide = "Left" print("In Object") if line.startswith("End Object"): inObject = False if pinSide != "": pin = Pin(pinName, pinType) node.addPin(pin, pinSide) pinName = "" PinType = "" pinSi...
if line.startswith("PinName="): print("-Name : " + line) pinName = getQuotedString(line) if line.startswith("PinType="): print("-Type : " + line) pinType = getQuotedString(line) if line.startswith("Direction=EGPD_Output"): print("-Direction : " + line) pinSide = "Right" if line.startswi...
conditional_block
Raw.py
# -*- coding: utf-8 -*- # +---------------------------------------------------------------------------+ # | 01001110 01100101 01110100 01111010 01101111 01100010 | # | | # | Netzob : Inferring communication prot...
if len(data) % 8 != 0: return False return True
False
conditional_block
Raw.py
# -*- coding: utf-8 -*- # +---------------------------------------------------------------------------+ # | 01001110 01100101 01110100 01111010 01101111 01100010 | # | | # | Netzob : Inferring communication prot...
ctType): """Raw netzob data type expressed in bytes. For instance, we can use this type to parse any raw field of 2 bytes: >>> from netzob.all import * >>> f = Field(Raw(nbBytes=2)) or with a specific value (default is little endianness) >>> f = Field(Raw('\x01\x02\x03')) >>> print f.dom...
tra
identifier_name
Raw.py
# -*- coding: utf-8 -*- # +---------------------------------------------------------------------------+ # | 01001110 01100101 01110100 01111010 01101111 01100010 | # | | # | Netzob : Inferring communication prot...
staticmethod def canParse(data): """Computes if specified data can be parsed as raw which is always the case if the data is at least 1 length and aligned on a byte. >>> from netzob.all import * >>> Raw.canParse(TypeConverter.convert("hello netzob", ASCII, BitArray)) True Th...
data @
identifier_body
Raw.py
# -*- coding: utf-8 -*- # +---------------------------------------------------------------------------+ # | 01001110 01100101 01110100 01111010 01101111 01100010 | # | | # | Netzob : Inferring communication prot...
>>> from netzob.all import * >>> Raw.canParse(TypeConverter.convert("hello netzob", ASCII, BitArray)) True The ascii table is defined from 0 to 127: >>> Raw.canParse(TypeConverter.convert(128, Decimal, BitArray, src_sign=AbstractType.SIGN_UNSIGNED)) True :param ...
"""Computes if specified data can be parsed as raw which is always the case if the data is at least 1 length and aligned on a byte.
random_line_split
failure.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 ...
line: uint) -> !; } let (file, line) = *file_line; unsafe { begin_unwind(fmt, file, line) } }
#[allow(ctypes)] extern { #[lang = "begin_unwind"] fn begin_unwind(fmt: &fmt::Arguments, file: &'static str,
random_line_split
failure.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 ...
(expr_file_line: &(&'static str, &'static str, uint)) -> ! { let (expr, file, line) = *expr_file_line; let ref file_line = (file, line); format_args!(|args| -> () { begin_unwind(args, file_line); }, "{}", expr); unsafe { intrinsics::abort() } } #[cold] #[inline(never)] #[lang="fail_bounds_...
fail_
identifier_name
failure.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 ...
{ #[allow(ctypes)] extern { #[lang = "begin_unwind"] fn begin_unwind(fmt: &fmt::Arguments, file: &'static str, line: uint) -> !; } let (file, line) = *file_line; unsafe { begin_unwind(fmt, file, line) } }
identifier_body
test_compression.py
import asyncio import functools import random import time from testing import Client from testing import default_test_setup from testing import gen_data from testing import gen_points from testing import gen_series from testing import InsertError from testing import PoolError from testing import QueryError from testing...
n=0.8, timeout=0, points=self.GEN_POINTS) # Check the result await self.assertSeries(self.client0, series) self.client0.close() result = await self.server0.stop() self.assertTrue(result) await self.server0.st...
await self.assertSeries(self.client0, series) for i in range(40): await self.client0.insert_some_series( series,
random_line_split
test_compression.py
import asyncio import functools import random import time from testing import Client from testing import default_test_setup from testing import gen_data from testing import gen_points from testing import gen_series from testing import InsertError from testing import PoolError from testing import QueryError from testing...
(self, client): result = await client.query('select * from "series float"') self.assertEqual(result['series float'], self.series_float) result = await client.query('select * from "series int"') self.assertEqual(result['series int'], self.series_int) result = await client.query...
_test_series
identifier_name
test_compression.py
import asyncio import functools import random import time from testing import Client from testing import default_test_setup from testing import gen_data from testing import gen_points from testing import gen_series from testing import InsertError from testing import PoolError from testing import QueryError from testing...
# Check the result await self.assertSeries(self.client0, series) self.client0.close() result = await self.server0.stop() self.assertTrue(result) await self.server0.start(sleep=20) await self.client0.connect() # Check the result after rebooting the se...
await self.client0.insert_some_series( series, n=0.8, timeout=0, points=self.GEN_POINTS)
conditional_block
test_compression.py
import asyncio import functools import random import time from testing import Client from testing import default_test_setup from testing import gen_data from testing import gen_points from testing import gen_series from testing import InsertError from testing import PoolError from testing import QueryError from testing...
'series float', 10000, 'float', self.series_float[0][0], self.series_float[-1][0]], [ 'series int', 10000, 'integer', self.series_int[0][0], sel...
title = 'Test compression' GEN_POINTS = functools.partial( gen_points, n=100, time_precision=TIME_PRECISION) async def _test_series(self, client): result = await client.query('select * from "series float"') self.assertEqual(result['series float'], self.series_float) result = ...
identifier_body
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
match self.states[t.pc] { Range(lo, hi) => if lo <= c && c <= hi { if follow(t.with_pc(1 + t.pc), self.index, self.states, &mut self.next) { self.matched = true; // Cut off lower priority threads brea...
self.index.mutate_or_set(0, |i| 1 + i); self.matched = false; // Run through all the threads for t in self.threads.iter() {
random_line_split
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
}, Jump(..) | Save(..) => unreachable!() } } // Swap the thread buffers swap(&mut self.threads, &mut self.next); self.next.clear(); } /// Determine if we have a match, given the existing input. pub fn is_match(&self) -> bool { ...
{ self.matched = true; // Cut off lower priority threads break }
conditional_block
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
/// Add a thread to the list, if one with the same `pc` is not /// already present. fn add(&mut self, t: Thread) { if self.indices.insert(t.pc) { self.threads.push(t); } } /// Iterate over the list of threads. fn iter<'a>(&'a self) -> std::vec::Items<'a, Thread> { ...
{ self.threads.clear(); self.indices.clear(); }
identifier_body
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
(t: Thread, index: Option<u64>, states: &[Inst], threads: &mut ThreadList) -> bool { if t.pc == states.len() { true } else { match states[t.pc] { Jump(ref exits) => { let mut matched = false; for &exit in exits.iter() { matched |= f...
follow
identifier_name
glob.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
// Glob with Expression return matchExpression(<IExpression>arg1, path, siblings); } function matchExpression(expression: IExpression, path: string, siblings?: string[]): string /* the matching pattern */ { let patterns = Object.getOwnPropertyNames(expression); let basename: string; for (let i = 0; i < patterns...
{ var regExp = globToRegExp(arg1); return regExp && regExp.test(path); }
conditional_block
glob.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
let regEx = ''; // Split up into segments for each slash found let segments = splitGlobAware(pattern, '/'); // Special case where we only have globstars if (segments.every(s => s === '**')) { regEx = '.*'; } // Build regex over segments else { let previousSegmentWasGlobStar = false; segments.forEach((...
return ''; }
random_line_split
glob.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
if (value && typeof (<SiblingClause>value).when === 'string') { if (!siblings || !siblings.length) { continue; // pattern is malformed or we don't have siblings } if (!basename) { basename = strings.rtrim(paths.basename(path), paths.extname(path)); } let clause = <SiblingClause>value;...
{ let patterns = Object.getOwnPropertyNames(expression); let basename: string; for (let i = 0; i < patterns.length; i++) { let pattern = patterns[i]; let value = expression[pattern]; if (value === false) { continue; // pattern is disabled } // Pattern matches path if (match(pattern, path)) { // ...
identifier_body
glob.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(pattern: string): RegExp { if (!pattern) { return null; } // Whitespace trimming pattern = pattern.trim(); // Check cache if (CACHE[pattern]) { let cached = CACHE[pattern]; cached.lastIndex = 0; // reset RegExp to its initial state to reuse it! return cached; } let regEx = parseRegExp(pattern); /...
globToRegExp
identifier_name
MapEvictAllCodec.ts
/* * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
const initialFrame = Frame.createInitialFrame(REQUEST_INITIAL_FRAME_SIZE); clientMessage.addFrame(initialFrame); clientMessage.setMessageType(REQUEST_MESSAGE_TYPE); clientMessage.setPartitionId(-1); StringCodec.encode(clientMessage, name); return clientMessage; } }
random_line_split
MapEvictAllCodec.ts
/* * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
(name: string): ClientMessage { const clientMessage = ClientMessage.createForEncode(); clientMessage.setRetryable(false); const initialFrame = Frame.createInitialFrame(REQUEST_INITIAL_FRAME_SIZE); clientMessage.addFrame(initialFrame); clientMessage.setMessageType(REQUEST_MESSAGE...
encodeRequest
identifier_name
aiplatform_generated_aiplatform_v1_vizier_service_complete_trial_sync.py
# -*- coding: utf-8 -*- # Copyright 2020 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...
# To install the latest published package dependency, execute the following: # python3 -m pip install google-cloud-aiplatform # [START aiplatform_generated_aiplatform_v1_VizierService_CompleteTrial_sync] from google.cloud import aiplatform_v1 def sample_complete_trial(): # Create a client client = aiplat...
# Generated code. DO NOT EDIT! # # Snippet for CompleteTrial # NOTE: This snippet has been automatically generated for illustrative purposes only. # It may require modifications to work in your environment.
random_line_split
aiplatform_generated_aiplatform_v1_vizier_service_complete_trial_sync.py
# -*- coding: utf-8 -*- # Copyright 2020 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...
(): # Create a client client = aiplatform_v1.VizierServiceClient() # Initialize request argument(s) request = aiplatform_v1.CompleteTrialRequest( name="name_value", ) # Make the request response = client.complete_trial(request=request) # Handle the response print(response)...
sample_complete_trial
identifier_name
aiplatform_generated_aiplatform_v1_vizier_service_complete_trial_sync.py
# -*- coding: utf-8 -*- # Copyright 2020 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...
# [END aiplatform_generated_aiplatform_v1_VizierService_CompleteTrial_sync]
client = aiplatform_v1.VizierServiceClient() # Initialize request argument(s) request = aiplatform_v1.CompleteTrialRequest( name="name_value", ) # Make the request response = client.complete_trial(request=request) # Handle the response print(response)
identifier_body
MagicMeter.ts
import Game from '../../Game'; import GuiItem from './GuiItem'; import Hud from '../Hud'; export default class MagicMeter extends GuiItem { background: Phaser.Sprite; valueSprite: Phaser.Sprite; maxHeight: number; constructor(game: Game, parent: Hud, x: number, y: number, value: number = 0) { ...
(val: any) { super.setValue(val); this.valueSprite.height = this.maxHeight * val; this.valueSprite.position.y = (this.maxHeight - this.valueSprite.height) + (4 * this.valueSprite.scale.y); return this; } }
setValue
identifier_name
MagicMeter.ts
import Game from '../../Game'; import GuiItem from './GuiItem';
export default class MagicMeter extends GuiItem { background: Phaser.Sprite; valueSprite: Phaser.Sprite; maxHeight: number; constructor(game: Game, parent: Hud, x: number, y: number, value: number = 0) { super(game, parent, x, y, 'magic', value); this.background = game.add.sprite(0, 0...
import Hud from '../Hud';
random_line_split