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
property_client.py
# This code is licensed under the MIT License (see LICENSE file for details) import collections import threading import traceback import zmq from ..util import trie class PropertyClient(threading.Thread): """A client for receiving property updates in a background thread. The background thread is automaticall...
subscribe_prefix.__doc__ = PropertyClient.subscribe_prefix.__doc__ def unsubscribe_prefix(self, property_prefix, callback): super().unsubscribe_prefix(property_prefix, callback) self.connected.wait() self.socket.unsubscribe(property_prefix) unsubscribe_prefix.__doc__ = PropertyClie...
self.connected.wait() self.socket.subscribe(property_prefix) super().subscribe_prefix(property_prefix, callback)
identifier_body
property_client.py
# This code is licensed under the MIT License (see LICENSE file for details) import collections import threading import traceback import zmq from ..util import trie class PropertyClient(threading.Thread): """A client for receiving property updates in a background thread. The background thread is automaticall...
def run(self): """Thread target: do not call directly.""" self.running = True while True: property_name, value = self._receive_update() self.properties[property_name] = value for callbacks in [self.callbacks[property_name]] + list(self.prefix_callbacks.val...
for property_prefix, callbacks in other.prefix_callbacks.items(): for callback, valueonly in callbacks: self.subscribe_prefix(property_prefix, callback, valueonly)
random_line_split
property_client.py
# This code is licensed under the MIT License (see LICENSE file for details) import collections import threading import traceback import zmq from ..util import trie class PropertyClient(threading.Thread): """A client for receiving property updates in a background thread. The background thread is automaticall...
(self, property_prefix, callback): """Unregister an exactly matching, previously registered callback. If the same callback function is registered multiple times with identical property_prefix parameters, only one registration is removed.""" if property_prefix is None: raise ...
unsubscribe_prefix
identifier_name
d3d11on12.rs
// Copyright © 2017 winapi-rs developers // 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. // All files in the project carrying such notice may not be copied, modi...
ppResources: *mut *mut ID3D11Resource, NumResources: UINT, ) -> (), }} DEFINE_GUID!{IID_ID3D11On12Device, 0x85611e73, 0x70a9, 0x490e, 0x96, 0x14, 0xa9, 0xe3, 0x02, 0x77, 0x79, 0x04}
fn AcquireWrappedResources(
random_line_split
tree.rs
use ai; use ai::value; use ai::StatelessAI; use game; use game::Position2; pub fn recursive_judgement( state: &game::State, my_color: game::Color, depth: u8, value_function: value::Simple, ) -> i32 { if depth == 0 || !state.victory_state.active() { value_function.value_of(state, my_color...
else { values.min() }.unwrap() } } pub struct TreeJudgementAI { search_depth: u8, value_function: value::Simple, } impl TreeJudgementAI { pub fn new(depth: u8, value_function: value::Simple) -> TreeJudgementAI { TreeJudgementAI { search_depth: depth, ...
{ values.max() }
conditional_block
tree.rs
use ai; use ai::value; use ai::StatelessAI; use game; use game::Position2; pub fn recursive_judgement( state: &game::State, my_color: game::Color, depth: u8, value_function: value::Simple, ) -> i32 { if depth == 0 || !state.victory_state.active() { value_function.value_of(state, my_color...
} impl StatelessAI for TreeJudgementAI { fn action(&self, state: &game::State) -> Position2 { let my_color = state.current_color; let graded_actions = state.legal_actions().map(|action| { let mut new_state = state.clone(); new_state.execute(action); let value =...
{ TreeJudgementAI { search_depth: depth, value_function, } }
identifier_body
tree.rs
use ai; use ai::value; use ai::StatelessAI; use game; use game::Position2; pub fn recursive_judgement( state: &game::State, my_color: game::Color, depth: u8, value_function: value::Simple, ) -> i32 { if depth == 0 || !state.victory_state.active() { value_function.value_of(state, my_color)...
let value = recursive_judgement(&new_state, my_color, depth - 1, value_function); value }); if state.current_color == my_color { values.max() } else { values.min() }.unwrap() } } pub struct TreeJudgementAI { search_depth: u8, ...
random_line_split
tree.rs
use ai; use ai::value; use ai::StatelessAI; use game; use game::Position2; pub fn
( state: &game::State, my_color: game::Color, depth: u8, value_function: value::Simple, ) -> i32 { if depth == 0 || !state.victory_state.active() { value_function.value_of(state, my_color) } else { let values = state.legal_actions().map(|action| { let mut new_state = ...
recursive_judgement
identifier_name
SettingsListItemColorPicker.js
import PropTypes from 'prop-types' import React from 'react' import { Button } from '@material-ui/core' import shallowCompare from 'react-addons-shallow-compare' import { withStyles } from '@material-ui/core/styles' import SettingsListItem from './SettingsListItem' import ColorPickerButton from './ColorPickerButton' c...
static propTypes = { labelText: PropTypes.string.isRequired, IconClass: PropTypes.func, disabled: PropTypes.bool, value: PropTypes.string, onChange: PropTypes.func, showClear: PropTypes.bool.isRequired, ClearIconClass: PropTypes.func, clearLabelText: PropTypes.string } static defa...
// Class /* **************************************************************************/
random_line_split
SettingsListItemColorPicker.js
import PropTypes from 'prop-types' import React from 'react' import { Button } from '@material-ui/core' import shallowCompare from 'react-addons-shallow-compare' import { withStyles } from '@material-ui/core/styles' import SettingsListItem from './SettingsListItem' import ColorPickerButton from './ColorPickerButton' c...
render () { const { classes, labelText, IconClass, disabled, value, onChange, showClear, ClearIconClass, clearLabelText, ...passProps } = this.props return ( <SettingsListItem {...passProps}> <ColorPickerButton buttonPr...
{ return shallowCompare(this, nextProps, nextState) }
identifier_body
SettingsListItemColorPicker.js
import PropTypes from 'prop-types' import React from 'react' import { Button } from '@material-ui/core' import shallowCompare from 'react-addons-shallow-compare' import { withStyles } from '@material-ui/core/styles' import SettingsListItem from './SettingsListItem' import ColorPickerButton from './ColorPickerButton' c...
}}> {ClearIconClass ? ( <ClearIconClass className={classes.buttonIcon} /> ) : undefined} {clearLabelText} </Button> ) : undefined} </SettingsListItem> ) } } export default SettingsListItemColorPicker
{ onChange(undefined) }
conditional_block
SettingsListItemColorPicker.js
import PropTypes from 'prop-types' import React from 'react' import { Button } from '@material-ui/core' import shallowCompare from 'react-addons-shallow-compare' import { withStyles } from '@material-ui/core/styles' import SettingsListItem from './SettingsListItem' import ColorPickerButton from './ColorPickerButton' c...
() { const { classes, labelText, IconClass, disabled, value, onChange, showClear, ClearIconClass, clearLabelText, ...passProps } = this.props return ( <SettingsListItem {...passProps}> <ColorPickerButton buttonProps={{ var...
render
identifier_name
ClientConnectionManager.ts
import * as Promise from 'bluebird'; import Address = require('../Address'); import ClientConnection = require('./ClientConnection'); import InvocationService = require('./InvocationService'); import {GroupConfig, ClientNetworkConfig} from '../Config'; import ConnectionAuthenticator = require('./ConnectionAuthentic...
if (this.establishedConnections.hasOwnProperty(addressStr)) { var conn = this.establishedConnections[addressStr]; conn.close(); delete this.establishedConnections[addressStr]; this.onConnectionClosed(conn); } } shutdown() { for (var pendi...
{ this.pendingConnections[addressStr].reject(null); }
conditional_block
ClientConnectionManager.ts
import * as Promise from 'bluebird'; import Address = require('../Address'); import ClientConnection = require('./ClientConnection'); import InvocationService = require('./InvocationService'); import {GroupConfig, ClientNetworkConfig} from '../Config'; import ConnectionAuthenticator = require('./ConnectionAuthentic...
shutdown() { for (var pending in this.pendingConnections) { this.pendingConnections[pending].reject(new Error('Client is shutting down!')); } for (var conn in this.establishedConnections) { this.establishedConnections[conn].close(); } } private onCo...
{ var addressStr = Address.encodeToString(address); if (this.pendingConnections.hasOwnProperty(addressStr)) { this.pendingConnections[addressStr].reject(null); } if (this.establishedConnections.hasOwnProperty(addressStr)) { var conn = this.establishedConnections[a...
identifier_body
ClientConnectionManager.ts
import * as Promise from 'bluebird'; import Address = require('../Address'); import ClientConnection = require('./ClientConnection'); import InvocationService = require('./InvocationService'); import {GroupConfig, ClientNetworkConfig} from '../Config'; import ConnectionAuthenticator = require('./ConnectionAuthentic...
export = ClientConnectionManager;
random_line_split
ClientConnectionManager.ts
import * as Promise from 'bluebird'; import Address = require('../Address'); import ClientConnection = require('./ClientConnection'); import InvocationService = require('./InvocationService'); import {GroupConfig, ClientNetworkConfig} from '../Config'; import ConnectionAuthenticator = require('./ConnectionAuthentic...
() { for (var pending in this.pendingConnections) { this.pendingConnections[pending].reject(new Error('Client is shutting down!')); } for (var conn in this.establishedConnections) { this.establishedConnections[conn].close(); } } private onConnectionClosed...
shutdown
identifier_name
mkin.js
function completeWriteDocument(ret_obj) { var error = ret_obj['error']; var message = ret_obj['message']; var document_srl = ret_obj['document_srl']; var url; if(!document_srl) { url = current_url.setQuery('act',''); } else { url = current_url.setQuery('document_srl',...
function completeWriteReply(ret_obj) { alert(ret_obj['message']); var url = request_uri.setQuery('mid', current_mid).setQuery('document_srl', ret_obj['document_srl']).setQuery('act','dispKinView'); if(typeof(xeVid)!='undefined') url = url.setQuery('vid', xeVid); location.href = url; } function doDelet...
location.href = url; }
random_line_split
mkin.js
function completeWriteDocument(ret_obj)
function completeWriteReply(ret_obj) { alert(ret_obj['message']); var url = request_uri.setQuery('mid', current_mid).setQuery('document_srl', ret_obj['document_srl']).setQuery('act','dispKinView'); if(typeof(xeVid)!='undefined') url = url.setQuery('vid', xeVid); location.href = url; } function doDel...
{ var error = ret_obj['error']; var message = ret_obj['message']; var document_srl = ret_obj['document_srl']; var url; if(!document_srl) { url = current_url.setQuery('act',''); } else { url = current_url.setQuery('document_srl',document_srl).setQuery('act',''); } ...
identifier_body
mkin.js
function
(ret_obj) { var error = ret_obj['error']; var message = ret_obj['message']; var document_srl = ret_obj['document_srl']; var url; if(!document_srl) { url = current_url.setQuery('act',''); } else { url = current_url.setQuery('document_srl',document_srl).setQuery('act','...
completeWriteDocument
identifier_name
postoffice.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use std::collections::BTreeSet; use std::iter::FromIterator; use tokio::{fs, io::AsyncWriteExt}; async fn write_config(r...
() -> Result<BTreeSet<String>, ImlAgentError> { let conf_file = env::get_var("POSTMAN_CONF_PATH"); Ok(fs::read_to_string(conf_file) .await? .lines() .map(|s| s.to_string()) .collect()) } pub async fn route_add(mailbox: String) -> Result<(), ImlAgentError> { let mut conf = re...
read_config
identifier_name
postoffice.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use std::collections::BTreeSet; use std::iter::FromIterator; use tokio::{fs, io::AsyncWriteExt}; async fn write_config(r...
{ let mut conf = read_config().await?; if conf.remove(&mailbox) { write_config(conf).await } else { Ok(()) } }
identifier_body
postoffice.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use std::collections::BTreeSet; use std::iter::FromIterator; use tokio::{fs, io::AsyncWriteExt}; async fn write_config(r...
Ok(()) } async fn read_config() -> Result<BTreeSet<String>, ImlAgentError> { let conf_file = env::get_var("POSTMAN_CONF_PATH"); Ok(fs::read_to_string(conf_file) .await? .lines() .map(|s| s.to_string()) .collect()) } pub async fn route_add(mailbox: String) -> Result<(), ImlA...
let rt: Vec<String> = Vec::from_iter(routes); file.write_all(rt.join("\n").as_bytes()).await?; file.write(b"\n").await?;
random_line_split
postoffice.rs
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. use crate::{agent_error::ImlAgentError, env}; use std::collections::BTreeSet; use std::iter::FromIterator; use tokio::{fs, io::AsyncWriteExt}; async fn write_config(r...
else { Ok(()) } }
{ write_config(conf).await }
conditional_block
3_16_exercise_springs.rs
// The Nature of Code // Daniel Shiffman // http://natureofcode.com // // Example 3-16: Exercise Springs use nannou::prelude::*; fn main() { nannou::app(model).update(update).run(); } // Spring Type describes an anchor point that can connect to "Bob" objects via a spring // Thank you: http://www.myphysicslab.com/...
fn drag(&mut self, mx: f32, my: f32) { if self.dragging { self.position.x = mx + self.drag_offset.x; self.position.y = my - self.drag_offset.y; } } } struct Model { b1: Bob, b2: Bob, b3: Bob, s1: Spring, s2: Spring, s3: Spring, } fn model(app: ...
{ self.dragging = false; }
identifier_body
3_16_exercise_springs.rs
// The Nature of Code // Daniel Shiffman // http://natureofcode.com // // Example 3-16: Exercise Springs use nannou::prelude::*; fn main() { nannou::app(model).update(update).run(); } // Spring Type describes an anchor point that can connect to "Bob" objects via a spring // Thank you: http://www.myphysicslab.com/...
(&self, draw: &Draw, a: &Bob, b: &Bob) { draw.line() .start(a.position) .end(b.position) .color(BLACK) .stroke_weight(2.0); } } struct Bob { position: Point2, velocity: Vector2, acceleration: Vector2, mass: f32, damping: f32, drag_offs...
display
identifier_name
3_16_exercise_springs.rs
// The Nature of Code // Daniel Shiffman // http://natureofcode.com
// Example 3-16: Exercise Springs use nannou::prelude::*; fn main() { nannou::app(model).update(update).run(); } // Spring Type describes an anchor point that can connect to "Bob" objects via a spring // Thank you: http://www.myphysicslab.com/spring2d.html struct Spring { // Rest length and spring constant ...
//
random_line_split
3_16_exercise_springs.rs
// The Nature of Code // Daniel Shiffman // http://natureofcode.com // // Example 3-16: Exercise Springs use nannou::prelude::*; fn main() { nannou::app(model).update(update).run(); } // Spring Type describes an anchor point that can connect to "Bob" objects via a spring // Thank you: http://www.myphysicslab.com/...
} fn stop_dragging(&mut self) { self.dragging = false; } fn drag(&mut self, mx: f32, my: f32) { if self.dragging { self.position.x = mx + self.drag_offset.x; self.position.y = my - self.drag_offset.y; } } } struct Model { b1: Bob, b2: Bob, ...
{ self.dragging = true; self.drag_offset.x = self.position.x - mx; self.drag_offset.y = self.position.y - my; }
conditional_block
auth.rs
use std::os; pub enum Credentials { BasicCredentials(String, String) } impl<'r> Credentials { pub fn aws_access_key_id(&'r self) -> &'r str { match *self { BasicCredentials(ref key, _) => key.as_slice() } } pub fn aws_secret_access_key(&'r self) -> &'r str { match *self { BasicCredent...
}
{ match (os::getenv("AWS_ACCESS_KEY_ID"), os::getenv("AWS_SECRET_ACCESS_KEY")) { (Some(key), Some(secret)) => Ok(BasicCredentials(key, secret)), _ => Err("Could not find AWS credentials".to_string()) } }
identifier_body
auth.rs
use std::os;
impl<'r> Credentials { pub fn aws_access_key_id(&'r self) -> &'r str { match *self { BasicCredentials(ref key, _) => key.as_slice() } } pub fn aws_secret_access_key(&'r self) -> &'r str { match *self { BasicCredentials(_, ref secret) => secret.as_slice() } } } pub trait Credentials...
pub enum Credentials { BasicCredentials(String, String) }
random_line_split
auth.rs
use std::os; pub enum Credentials { BasicCredentials(String, String) } impl<'r> Credentials { pub fn aws_access_key_id(&'r self) -> &'r str { match *self { BasicCredentials(ref key, _) => key.as_slice() } } pub fn
(&'r self) -> &'r str { match *self { BasicCredentials(_, ref secret) => secret.as_slice() } } } pub trait CredentialsProvider { fn get_credentials(&mut self) -> Result<Credentials,String>; } pub struct DefaultCredentialsProvider; impl CredentialsProvider for DefaultCredentialsProvider { fn get_c...
aws_secret_access_key
identifier_name
checkerboard.rs
use crate::noise_fns::NoiseFn; /// Noise function that outputs a checkerboard pattern. /// /// This noise function can take one input, size, and outputs 2<sup>size</sup>-sized /// blocks of alternating values. The values of these blocks alternate between /// -1.0 and 1.0. /// /// This noise function is not very useful...
() -> Self { Self { size: 1 << Checkerboard::DEFAULT_SIZE, } } } // These impl's should be made generic over Point, but there is no higher Point // type. Keep the code the same anyway. impl NoiseFn<[f64; 2]> for Checkerboard { fn get(&self, point: [f64; 2]) -> f64 { calculat...
default
identifier_name
checkerboard.rs
use crate::noise_fns::NoiseFn; /// Noise function that outputs a checkerboard pattern. /// /// This noise function can take one input, size, and outputs 2<sup>size</sup>-sized /// blocks of alternating values. The values of these blocks alternate between /// -1.0 and 1.0. /// /// This noise function is not very useful...
}
{ 1.0 }
conditional_block
checkerboard.rs
use crate::noise_fns::NoiseFn; /// Noise function that outputs a checkerboard pattern. /// /// This noise function can take one input, size, and outputs 2<sup>size</sup>-sized /// blocks of alternating values. The values of these blocks alternate between /// -1.0 and 1.0. /// /// This noise function is not very useful...
} } } // These impl's should be made generic over Point, but there is no higher Point // type. Keep the code the same anyway. impl NoiseFn<[f64; 2]> for Checkerboard { fn get(&self, point: [f64; 2]) -> f64 { calculate_checkerboard(&point, self.size) } } impl NoiseFn<[f64; 3]> for Checkerbo...
fn default() -> Self { Self { size: 1 << Checkerboard::DEFAULT_SIZE,
random_line_split
checkerboard.rs
use crate::noise_fns::NoiseFn; /// Noise function that outputs a checkerboard pattern. /// /// This noise function can take one input, size, and outputs 2<sup>size</sup>-sized /// blocks of alternating values. The values of these blocks alternate between /// -1.0 and 1.0. /// /// This noise function is not very useful...
{ let result = point .iter() .map(|&a| a.floor() as usize) .fold(0, |a, b| (a & size) ^ (b & size)); if result > 0 { -1.0 } else { 1.0 } }
identifier_body
tests.py
from __future__ import unicode_literals from operator import attrgetter from django.db import models from django.test import TestCase from .models import Answer, Dimension, Entity, Post, Question class OrderWithRespectToTests(TestCase): @classmethod def setUpTestData(cls): cls.q1 = Question.object...
count = 0 for field in Foo._meta.local_fields: if isinstance(field, models.OrderWrt): count += 1 self.assertEqual(count, 1) class TestOrderWithRespectToOneToOnePK(TestCase): def test_set_order(self): e = Entity.objects.create() d = Dimension.o...
def test_recursive_ordering(self): p1 = Post.objects.create(title='1') p2 = Post.objects.create(title='2') p1_1 = Post.objects.create(title="1.1", parent=p1) p1_2 = Post.objects.create(title="1.2", parent=p1) Post.objects.create(title="2.1", parent=p2) p1_3 = Post.objects...
identifier_body
tests.py
from __future__ import unicode_literals from operator import attrgetter from django.db import models from django.test import TestCase from .models import Answer, Dimension, Entity, Post, Question class OrderWithRespectToTests(TestCase): @classmethod def setUpTestData(cls): cls.q1 = Question.object...
self.assertEqual(count, 1) class TestOrderWithRespectToOneToOnePK(TestCase): def test_set_order(self): e = Entity.objects.create() d = Dimension.objects.create(entity=e) c1 = d.component_set.create() c2 = d.component_set.create() d.set_component_order([c1.id, c2.i...
count += 1
conditional_block
tests.py
from __future__ import unicode_literals from operator import attrgetter from django.db import models from django.test import TestCase from .models import Answer, Dimension, Entity, Post, Question class OrderWithRespectToTests(TestCase): @classmethod def setUpTestData(cls): cls.q1 = Question.object...
attrgetter("text") ) class OrderWithRespectToTests2(TestCase): def test_recursive_ordering(self): p1 = Post.objects.create(title='1') p2 = Post.objects.create(title='2') p1_1 = Post.objects.create(title="1.1", parent=p1) p1_2 = Post.objects.create(title="1.2", ...
],
random_line_split
tests.py
from __future__ import unicode_literals from operator import attrgetter from django.db import models from django.test import TestCase from .models import Answer, Dimension, Entity, Post, Question class OrderWithRespectToTests(TestCase): @classmethod def setUpTestData(cls): cls.q1 = Question.object...
(self): class Bar(models.Model): pass class Foo(models.Model): bar = models.ForeignKey(Bar) order = models.OrderWrt() class Meta: order_with_respect_to = 'bar' count = 0 for field in Foo._meta.local_fields: i...
test_duplicate_order_field
identifier_name
currencyConversion.js
//currency conversion class for handling all currency conversion operations var CurrencyConverter = (function () { function CurrencyConverter()
CurrencyConverter.prototype.CurrencyConverter = function () { }; //sets the currencies CurrencyConverter.prototype.setCurrencies = function (currencyFrom, currencyTo) { if (this.checkCurrencies(currencyFrom, currencyTo)) { this.currencyFrom = currencyFrom; this.currencyT...
{ this.giveError = false; }
identifier_body
currencyConversion.js
//currency conversion class for handling all currency conversion operations var CurrencyConverter = (function () { function
() { this.giveError = false; } CurrencyConverter.prototype.CurrencyConverter = function () { }; //sets the currencies CurrencyConverter.prototype.setCurrencies = function (currencyFrom, currencyTo) { if (this.checkCurrencies(currencyFrom, currencyTo)) { this.currencyFrom ...
CurrencyConverter
identifier_name
currencyConversion.js
//currency conversion class for handling all currency conversion operations var CurrencyConverter = (function () { function CurrencyConverter() { this.giveError = false; } CurrencyConverter.prototype.CurrencyConverter = function () { }; //sets the currencies CurrencyConverter.prototype.s...
if (currencies.indexOf(currencyTo) != -1) { currencyToValid = true; } else { currencyToValid = false; } return currencyFromValid && currencyToValid; }; //sets the amount of currency to be converted CurrencyConverter.prototype.setAmount = funct...
{ currencyFromValid = false; }
conditional_block
currencyConversion.js
//currency conversion class for handling all currency conversion operations var CurrencyConverter = (function () { function CurrencyConverter() { this.giveError = false; } CurrencyConverter.prototype.CurrencyConverter = function () { }; //sets the currencies CurrencyConverter.prototype.s...
this.currencyFromValue = Number(data["rates"][this.currencyFrom]); this.currencyToValue = Number(data["rates"][this.currencyTo]); this.currencyRatio = this.currencyToValue / this.currencyFromValue; this.finalResult = String((Number(this.currencyAmount) * this.currencyRati...
return; } if (!this.giveError) {
random_line_split
previewContentProvider.ts
tributionProvider } from '../markdownExtensions'; import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from '../security'; import { basename, dirname, isAbsolute, join } from '../util/path'; import { WebviewResourceProvider } from '../util/resources'; import { MarkdownPreviewConfiguration, MarkdownPrev...
( provider: WebviewResourceProvider, resource: vscode.Uri, nonce: string ): string { const rule = provider.cspSource; switch (this.cspArbiter.getSecurityLevelForResource(resource)) { case MarkdownPreviewSecurityLevel.AllowInsecureContent: return `<meta http-equiv="Content-Security-Policy" content="def...
getCsp
identifier_name
previewContentProvider.ts
tributionProvider } from '../markdownExtensions'; import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from '../security'; import { basename, dirname, isAbsolute, join } from '../util/path'; import { WebviewResourceProvider } from '../util/resources'; import { MarkdownPreviewConfiguration, MarkdownPrev...
private getScripts(resourceProvider: WebviewResourceProvider, nonce: string): string { const out: string[] = []; for (const resource of this.contributionProvider.contributions.previewScripts) { out.push(`<script async src="${escapeAttribute(resourceProvider.asWebviewUri(resource))}" nonce="${nonce}" ...
{ const baseStyles: string[] = []; for (const resource of this.contributionProvider.contributions.previewStyles) { baseStyles.push(`<link rel="stylesheet" type="text/css" href="${escapeAttribute(resourceProvider.asWebviewUri(resource))}">`); } return `${baseStyles.join('\n')} ${this.computeCustomStyleShe...
identifier_body
previewContentProvider.ts
'Some content has been disabled in this document'), cspAlertMessageTitle: localize( 'preview.securityMessage.title', 'Potentially unsafe or insecure content has been disabled in the Markdown preview. Change the Markdown preview security setting to allow insecure content or enable scripts'), cspAlertMessageLabel...
let text = '';
random_line_split
previewContentProvider.ts
tributionProvider } from '../markdownExtensions'; import { ContentSecurityPolicyArbiter, MarkdownPreviewSecurityLevel } from '../security'; import { basename, dirname, isAbsolute, join } from '../util/path'; import { WebviewResourceProvider } from '../util/resources'; import { MarkdownPreviewConfiguration, MarkdownPrev...
// Use a workspace relative path if there is a workspace const root = vscode.workspace.getWorkspaceFolder(resource); if (root) { return resourceProvider.asWebviewUri(vscode.Uri.joinPath(root.uri, href)).toString(); } // Otherwise look relative to the markdown file return resourceProvider.asWebviewUri(...
{ return resourceProvider.asWebviewUri(vscode.Uri.file(href)).toString(); }
conditional_block
expr-match-struct.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 ...
(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) } fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } } fn test_tag() { let rs = match true { true => { mood::happy } false => { mood::sad } }; assert_eq!(rs, mood::happy); } pub fn main() { test_rec(); test_tag(); }...
eq
identifier_name
expr-match-struct.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 ...
pub fn main() { test_rec(); test_tag(); }
{ let rs = match true { true => { mood::happy } false => { mood::sad } }; assert_eq!(rs, mood::happy); }
identifier_body
expr-match-struct.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 ...
#[deriving(Show)] enum mood { happy, sad, } impl PartialEq for mood { fn eq(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) } fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } } fn test_tag() { let rs = match true { true => { mood::happy } false => { mood::sad }...
assert_eq!(rs.i, 100); }
random_line_split
git-host-info.js
'use strict' var gitHosts = module.exports = { github: { // First two are insecure and generally shouldn't be used any more, but // they are still supported. 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], 'domain': 'github.com', 'treepath': 'tree', 'filetemplate': 'ht...
gitHosts[name][key] = gitHostDefaults[key] }) gitHosts[name].protocols_re = RegExp('^(' + gitHosts[name].protocols.map(function (protocol) { return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1') }).join('|') + '):$') }) function formatHashFragment (fragment) { return fragment.toLowerCase().rep...
Object.keys(gitHosts).forEach(function (name) { Object.keys(gitHostDefaults).forEach(function (key) { if (gitHosts[name][key]) return
random_line_split
git-host-info.js
'use strict' var gitHosts = module.exports = { github: { // First two are insecure and generally shouldn't be used any more, but // they are still supported. 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], 'domain': 'github.com', 'treepath': 'tree', 'filetemplate': 'ht...
(fragment) { return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-') }
formatHashFragment
identifier_name
git-host-info.js
'use strict' var gitHosts = module.exports = { github: { // First two are insecure and generally shouldn't be used any more, but // they are still supported. 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], 'domain': 'github.com', 'treepath': 'tree', 'filetemplate': 'ht...
{ return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-') }
identifier_body
threads.rs
//! Threading code. use std::mem; use remacs_macros::lisp_fn; use remacs_sys::{current_thread, thread_state}; use buffers::LispBufferRef; use lisp::{ExternalPtr, LispObject}; use lisp::defsubr; pub type ThreadStateRef = ExternalPtr<thread_state>; pub struct ThreadState {} impl ThreadState { pub fn current_buf...
/// Return t if THREAD is alive, or nil if it has exited. #[lisp_fn] pub fn thread_alive_p(thread: ThreadStateRef) -> bool { thread.is_alive() } include!(concat!(env!("OUT_DIR"), "/threads_exports.rs"));
{ thread.name() }
identifier_body
threads.rs
//! Threading code. use std::mem; use remacs_macros::lisp_fn; use remacs_sys::{current_thread, thread_state}; use buffers::LispBufferRef; use lisp::{ExternalPtr, LispObject}; use lisp::defsubr; pub type ThreadStateRef = ExternalPtr<thread_state>; pub struct ThreadState {} impl ThreadState { pub fn current_buf...
(thread: ThreadStateRef) -> bool { thread.is_alive() } include!(concat!(env!("OUT_DIR"), "/threads_exports.rs"));
thread_alive_p
identifier_name
threads.rs
//! Threading code. use std::mem; use remacs_macros::lisp_fn; use remacs_sys::{current_thread, thread_state}; use buffers::LispBufferRef; use lisp::{ExternalPtr, LispObject}; use lisp::defsubr; pub type ThreadStateRef = ExternalPtr<thread_state>; pub struct ThreadState {} impl ThreadState { pub fn current_buf...
#[lisp_fn] pub fn thread_name(thread: ThreadStateRef) -> LispObject { thread.name() } /// Return t if THREAD is alive, or nil if it has exited. #[lisp_fn] pub fn thread_alive_p(thread: ThreadStateRef) -> bool { thread.is_alive() } include!(concat!(env!("OUT_DIR"), "/threads_exports.rs"));
} /// Return the name of the THREAD. /// The name is the same object that was passed to `make-thread'.
random_line_split
bad-lit-suffixes.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 ...
() {} extern "C"suffix //~ ERROR ABI spec with a suffix is invalid {} fn main() { ""suffix; //~ ERROR str literal with a suffix is invalid b""suffix; //~ ERROR binary str literal with a suffix is invalid r#""#suffix; //~ ERROR str literal with a suffix is invalid br#""#suffix; //~ ERROR binary str...
foo
identifier_name
bad-lit-suffixes.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 ...
1234i1024; //~ ERROR invalid width `1024` for integer literal 1234f1024; //~ ERROR invalid width `1024` for float literal 1234.5f1024; //~ ERROR invalid width `1024` for float literal 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal 0b101suffix; //~ ERROR invalid suffix `suffix` fo...
1234u1024; //~ ERROR invalid width `1024` for integer literal
random_line_split
bad-lit-suffixes.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 ...
extern "C"suffix //~ ERROR ABI spec with a suffix is invalid {} fn main() { ""suffix; //~ ERROR str literal with a suffix is invalid b""suffix; //~ ERROR binary str literal with a suffix is invalid r#""#suffix; //~ ERROR str literal with a suffix is invalid br#""#suffix; //~ ERROR binary str lite...
{}
identifier_body
generic-fn.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 ...
pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); assert!((x == y)); b = id::<char>(a); debug!(b); assert!((a == b)); ...
random_line_split
generic-fn.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 = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); assert!((x == y)); b = id::<char>(a); debug!(b); assert!((a == b)); q = id::<Tr...
identifier_body
generic-fn.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 = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); assert!((x == y)); b = id::<char>(a); debug!(b); assert!((a == b)); q = id::...
main
identifier_name
istanbul-reports-tests.ts
create('clover'); create('clover', { file: 'foo', projectRoot: 'bar' }); create('cobertura'); create('cobertura', { file: 'foo', projectRoot: 'bar' }); create('html-spa'); create('html-spa', { skipEmpty: true, metricsToShow: ['branches', 'lines', 'statements'] }); create('html-spa', { linkMapper: { getPa...
import { create } from 'istanbul-reports';
random_line_split
filterScopeIdsCollector.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the ""Software""), to deal * in the Software without restric...
let jlen = valueTuple.length; debug.assert(jlen === this.keyExprsCount, "keys count and values count should match"); for (let value of valueTuple) { result = value.accept(this); if (!result) return this.unsu...
if (this.keyExprsCount !== this.fieldExprs.length) return this.unsupportedSQExpr(); let values = expr.values; for (let valueTuple of values) {
random_line_split
filterScopeIdsCollector.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the ""Software""), to deal * in the Software without restric...
return createDataViewScopeIdentity(compoundSQExpr); } public visitOr(expr: SQOrExpr): boolean { if (this.keyExprsCount !== null) return this.unsupportedSQExpr(); this.isRoot = false; return expr.left.accept(this) && expr.right.accept(this...
let equalsExpr = SQExprBuilder.equal(fieldExprs[i], valueExprs[i]); if (!compoundSQExpr) compoundSQExpr = equalsExpr; else compoundSQExpr = SQExprBuilder.and(compoundSQExpr, equalsExpr); }
conditional_block
filterScopeIdsCollector.ts
/* * Power BI Visualizations * * Copyright (c) Microsoft Corporation * All rights reserved. * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the ""Software""), to deal * in the Software without restric...
xpr: SQExpr): boolean { return this.unsupportedSQExpr(); } private unsupportedSQExpr(): boolean { return false; } } class FindComparandVisitor extends DefaultSQExprVisitor<SQConstantExpr> { public visitAnd(expr: SQAndExpr): SQConstantExpr { r...
sitDefault(e
identifier_name
Radio.js
'use strict'; var _get = require('babel-runtime/helpers/get')['default']; var _inherits = require('babel-runtime/helpers/inherits')['default']; var _createClass = require('babel-runtime/helpers/create-class')['default']; var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; var _exten...
() { _classCallCheck(this, Radio); _get(Object.getPrototypeOf(Radio.prototype), 'constructor', this).apply(this, arguments); } _createClass(Radio, [{ key: 'getValue', value: function getValue() { return this.refs.enhancedSwitch.getValue(); } }, { key: 'setChecked', value: funct...
Radio
identifier_name
Radio.js
'use strict'; var _get = require('babel-runtime/helpers/get')['default']; var _inherits = require('babel-runtime/helpers/inherits')['default']; var _createClass = require('babel-runtime/helpers/create-class')['default']; var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; var _exten...
_createClass(Radio, [{ key: 'getValue', value: function getValue() { return this.refs.enhancedSwitch.getValue(); } }, { key: 'setChecked', value: function setChecked(newCheckedValue) { this.refs.enhancedSwitch.setSwitched(newCheckedValue); } }, { key: 'isChecked', val...
{ _classCallCheck(this, Radio); _get(Object.getPrototypeOf(Radio.prototype), 'constructor', this).apply(this, arguments); }
identifier_body
Radio.js
'use strict'; var _get = require('babel-runtime/helpers/get')['default']; var _inherits = require('babel-runtime/helpers/inherits')['default']; var _createClass = require('babel-runtime/helpers/create-class')['default']; var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default']; var _exten...
} }]); return Radio; })(_react2['default'].Component); exports['default'] = Radio; module.exports = exports['default'];
return _react2['default'].createElement(_EnhancedSwitch2['default'], _extends({}, this.props, enhancedSwitchProps));
random_line_split
getDoc.js
import { check } from "meteor/check"; import processDoc from "./processDoc"; /** * getDoc * fetch repo profile from github and store in RepoData collection * @param {Object} doc - mongo style selector for the doc * @returns {undefined} returns */ function
(options) { check(options, Object); // get repo details const docRepo = ReDoc.Collections.Repos.findOne({ repo: options.repo }); // we need to have a repo if (!docRepo) { console.log(`redoc/getDocSet: Failed to load repo data for ${options.repo}`); return false; } // TOC item for this doc...
getDoc
identifier_name
getDoc.js
import { check } from "meteor/check"; import processDoc from "./processDoc"; /** * getDoc * fetch repo profile from github and store in RepoData collection * @param {Object} doc - mongo style selector for the doc * @returns {undefined} returns */ function getDoc(options) { check(options, Object); // get ...
// TOC item for this doc const tocItem = ReDoc.Collections.TOC.findOne({ alias: options.alias, repo: options.repo }); processDoc({ branch: options.branch, repo: options.repo, alias: options.alias, docRepo, tocItem }); } export default getDoc; export { flushDocCache };
{ console.log(`redoc/getDocSet: Failed to load repo data for ${options.repo}`); return false; }
conditional_block
getDoc.js
import { check } from "meteor/check"; import processDoc from "./processDoc"; /** * getDoc * fetch repo profile from github and store in RepoData collection * @param {Object} doc - mongo style selector for the doc * @returns {undefined} returns */ function getDoc(options)
processDoc({ branch: options.branch, repo: options.repo, alias: options.alias, docRepo, tocItem }); } export default getDoc; export { flushDocCache };
{ check(options, Object); // get repo details const docRepo = ReDoc.Collections.Repos.findOne({ repo: options.repo }); // we need to have a repo if (!docRepo) { console.log(`redoc/getDocSet: Failed to load repo data for ${options.repo}`); return false; } // TOC item for this doc const t...
identifier_body
getDoc.js
import { check } from "meteor/check"; import processDoc from "./processDoc"; /** * getDoc * fetch repo profile from github and store in RepoData collection * @param {Object} doc - mongo style selector for the doc * @returns {undefined} returns */ function getDoc(options) { check(options, Object); // get ...
} export default getDoc; export { flushDocCache };
docRepo, tocItem });
random_line_split
stripe.js
$('#renseignements').removeClass("disabled"); $('#renseignements').addClass("active"); $('#commande a').append(' <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'); $('#paiement').removeClass("disabled"); $('#paiement').addClass("active"); $('#renseignements a').append(' <span class="glyphicon glyphicon-...
card.on('change', function(event) { setOutcome(event); }); document.querySelector('form').addEventListener('submit', function(e) { e.preventDefault(); stripe.createToken(card).then(setOutcome); });
random_line_split
stripe.js
$('#renseignements').removeClass("disabled"); $('#renseignements').addClass("active"); $('#commande a').append(' <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'); $('#paiement').removeClass("disabled"); $('#paiement').addClass("active"); $('#renseignements a').append(' <span class="glyphicon glyphicon...
} card.on('change', function(event) { setOutcome(event); }); document.querySelector('form').addEventListener('submit', function(e) { e.preventDefault(); stripe.createToken(card).then(setOutcome); });
{ errorElement.textContent = result.error.message; errorElement.classList.add('visible'); }
conditional_block
stripe.js
$('#renseignements').removeClass("disabled"); $('#renseignements').addClass("active"); $('#commande a').append(' <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'); $('#paiement').removeClass("disabled"); $('#paiement').addClass("active"); $('#renseignements a').append(' <span class="glyphicon glyphicon...
card.on('change', function(event) { setOutcome(event); }); document.querySelector('form').addEventListener('submit', function(e) { e.preventDefault(); stripe.createToken(card).then(setOutcome); });
{ var successElement = document.querySelector('.success'); var errorElement = document.querySelector('.error'); successElement.classList.remove('visible'); errorElement.classList.remove('visible'); if (result.token) { document.querySelector('.token').value = result.token.id; successElement.classList....
identifier_body
stripe.js
$('#renseignements').removeClass("disabled"); $('#renseignements').addClass("active"); $('#commande a').append(' <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>'); $('#paiement').removeClass("disabled"); $('#paiement').addClass("active"); $('#renseignements a').append(' <span class="glyphicon glyphicon...
(result) { var successElement = document.querySelector('.success'); var errorElement = document.querySelector('.error'); successElement.classList.remove('visible'); errorElement.classList.remove('visible'); if (result.token) { document.querySelector('.token').value = result.token.id; successElement.c...
setOutcome
identifier_name
physics.rs
p.rotation += PI / 20.0; } if p.rot == Right{ p.rotation -= PI / 20.0; } } pub fn accel(p: &mut game::Player){ //mut player:&mut player would allow to play w/ pointer let (acc, amod) = accel_compute(p.dir, p.accel, p.accel_mod); if p.velocity >= -0.15 && p.velocity <= 0.15 { ...
pub fn rotate(p: &mut game::Player){ use std::f32::consts::PI; if p.rot == Left{
random_line_split
physics.rs
.rotation += PI / 20.0; } if p.rot == Right{ p.rotation -= PI / 20.0; } } pub fn accel(p: &mut game::Player){ //mut player:&mut player would allow to play w/ pointer let (acc, amod) = accel_compute(p.dir, p.accel, p.accel_mod); if p.velocity >= -0.15 && p.velocity <= 0.15 { p.veloc...
() { let a = Vector2::new(1f32, 1f32); let b = Vector2::new(-1f32, -1f32); let c = Vector2::new(-1f32, 1f32); let d = Vector2::new(1f32, -1f32); assert_eq!(intersect((a, b), (c, d)), Some(Vector2::new(0f32, 0f32))); } /// Determines if two Sprites collide, assuming tha...
test_intersect
identifier_name
physics.rs
.rotation += PI / 20.0; } if p.rot == Right{ p.rotation -= PI / 20.0; } } pub fn accel(p: &mut game::Player){ //mut player:&mut player would allow to play w/ pointer let (acc, amod) = accel_compute(p.dir, p.accel, p.accel_mod); if p.velocity >= -0.15 && p.velocity <= 0.15 { p.veloc...
let pairs = [(0, 1), (1, 2), (2, 3), (3, 0)]; // which indices form lines we care about? let &Sprite {x, y, width, height, .. } = a; let apoints = [ amat.mul_v(&Vector2::new(x, y)), amat.mul_v(&Vector2::new(x + width, y)), amat.mul_v(&Vector2::new(x + width, ...
{ // make lists of points making up each sprite, transformed with the // rotation let mut arot = a.rot; let mut brot = b.rot; // make sure their slopes aren't NaN :( if arot % (PI / 4.0) == 0.0 { arot += 0.01; } if brot % (PI / 4.0) == 0.0 ...
identifier_body
physics.rs
.rotation += PI / 20.0; } if p.rot == Right{ p.rotation -= PI / 20.0; } } pub fn accel(p: &mut game::Player){ //mut player:&mut player would allow to play w/ pointer let (acc, amod) = accel_compute(p.dir, p.accel, p.accel_mod); if p.velocity >= -0.15 && p.velocity <= 0.15 { p.veloc...
} } None } #[test] fn test_intersect() { let a = Vector2::new(1f32, 1f32); let b = Vector2::new(-1f32, -1f32); let c = Vector2::new(-1f32, 1f32); let d = Vector2::new(1f32, -1f32); assert_eq!(intersect((a, b), (c, d)), Some(Vector2::ne...
{ debug!("It's within the first line's y values"); if y >= min(b1.y, b2.y) && y <= max(b1.y, b2.y) { debug!("It's within the second line's y values"); return Some(Vector2::new(x, y)); } }
conditional_block
login.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { Store } from "@ngrx/store"; import { loginActions } from '../Store/actions'; @Component({ selector: 'cdp-login', styleUrls: [ './login.styles.css' ], templateUrl: "login.component.tmpl.html" }) export class LoginCompon...
if (!this.form[inputType].initial) { this.form[inputType].initial = true; } this.form[inputType].value ? this.form[inputType].valid = true : this.form[inputType].valid = false; this.validateForm(); } }
this.form.userPassword.valid; } validateInput(inputType: string): void {
random_line_split
login.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { Store } from "@ngrx/store"; import { loginActions } from '../Store/actions'; @Component({ selector: 'cdp-login', styleUrls: [ './login.styles.css' ], templateUrl: "login.component.tmpl.html" }) export class LoginCompon...
($event: any): void { const { userName : {value : user}, userPassword : {value : password} } = this.form; $event.preventDefault(); this.store.dispatch(new loginActions.fetchLoginAction({user, password})); } validateForm(): void { this.form.valid = this.form.userName.initial && ...
submitForm
identifier_name
login.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { Store } from "@ngrx/store"; import { loginActions } from '../Store/actions'; @Component({ selector: 'cdp-login', styleUrls: [ './login.styles.css' ], templateUrl: "login.component.tmpl.html" }) export class LoginCompon...
}
{ if (!this.form[inputType].initial) { this.form[inputType].initial = true; } this.form[inputType].value ? this.form[inputType].valid = true : this.form[inputType].valid = false; this.validateForm(); }
identifier_body
login.component.ts
import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { Store } from "@ngrx/store"; import { loginActions } from '../Store/actions'; @Component({ selector: 'cdp-login', styleUrls: [ './login.styles.css' ], templateUrl: "login.component.tmpl.html" }) export class LoginCompon...
this.form[inputType].value ? this.form[inputType].valid = true : this.form[inputType].valid = false; this.validateForm(); } }
{ this.form[inputType].initial = true; }
conditional_block
cmp.rs
// Copyright 2012-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-MI...
impl Ord for Ordering { #[inline] fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) } } macro_rules! totalord_impl( ($t:ty) => { impl TotalOrd for $t { #[inline] fn cmp(&self, other: &$t) -> Ordering { if *self < *other { Less } ...
}
random_line_split
cmp.rs
// Copyright 2012-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-MI...
} /// Trait for equality comparisons where `a == b` and `a != b` are strict inverses. pub trait TotalEq { fn equals(&self, other: &Self) -> bool; } macro_rules! totaleq_impl( ($t:ty) => { impl TotalEq for $t { #[inline] fn equals(&self, other: &$t) -> bool { *self == *other } ...
{ !self.eq(other) }
identifier_body
cmp.rs
// Copyright 2012-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-MI...
(&self, other: &Self) -> bool { !self.eq(other) } } /// Trait for equality comparisons where `a == b` and `a != b` are strict inverses. pub trait TotalEq { fn equals(&self, other: &Self) -> bool; } macro_rules! totaleq_impl( ($t:ty) => { impl TotalEq for $t { #[inline] fn equal...
ne
identifier_name
static-mut-not-pat.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
// except according to those terms. // Constants (static variables) can be used to match in patterns, but mutable // statics cannot. This ensures that there's some form of error if this is // attempted. static mut a: int = 3; fn main() { // If they can't be matched against, then it's possible to capture the same...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed
random_line_split
static-mut-not-pat.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 ...
() { // If they can't be matched against, then it's possible to capture the same // name as a variable, hence this should be an unreachable pattern situation // instead of spitting out a custom error about some identifier collisions // (we should allow shadowing) match 4i { a => {} //~ ERROR...
main
identifier_name
lib.rs
>; } pub trait ProgressiveWebMetric { fn get_navigation_start(&self) -> Option<u64>; fn set_navigation_start(&mut self, time: u64); fn get_time_profiler_chan(&self) -> &ProfilerChan; fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64); fn get_url(&self) -> &ServoUrl; ...
(&self) -> Option<u64> { self.time_to_interactive.get() } pub fn needs_tti(&self) -> bool { self.get_tti().is_none() } } impl ProgressiveWebMetric for InteractiveMetrics { fn get_navigation_start(&self) -> Option<u64> { self.navigation_start } fn set_navigation_start(&...
get_tti
identifier_name
lib.rs
} pub trait ProgressiveWebMetric { fn get_navigation_start(&self) -> Option<u64>; fn set_navigation_start(&mut self, time: u64); fn get_time_profiler_chan(&self) -> &ProfilerChan; fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64); fn get_url(&self) -> &ServoUrl; } ...
} fn set_metric<U: ProgressiveWebMetric>( pwm: &U, metadata: Option<TimerMetadata>, metric_type: ProgressiveWebMetricType, category: ProfilerCategory, attr: &Cell<Option<u64>>, metric_time: Option<u64>, url: &ServoUrl, ) { let navigation_start = match pwm.get_navigation_start() { ...
{ *self as f64 / 1000000. }
identifier_body
lib.rs
>; } pub trait ProgressiveWebMetric { fn get_navigation_start(&self) -> Option<u64>; fn set_navigation_start(&mut self, time: u64); fn get_time_profiler_chan(&self) -> &ProfilerChan; fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64); fn get_url(&self) -> &ServoUrl; ...
pub fn get_dom_content_loaded(&self) -> Option<u64> { self.dom_content_loaded.get() } pub fn get_main_thread_available(&self) -> Option<u64> { self.main_thread_available.get() } // can set either dlc or tti first, but both must be set to actually calc metric // when the second ...
if self.main_thread_available.get().is_none() { self.main_thread_available.set(Some(time)); } }
random_line_split
Privacy.js
style={styles}> <Popup modal overlayStyle={{ background: 'rgba(255,255,255,0.98' }} contentStyle={contentStyle} closeOnDocumentClick={false} trigger={open => <BurgerIcon open={open} />} > {close => <Menu close={close} />} </Popup> </div> <div c...
<h3>Analytics</h3> <p> We may use third-party Service Providers to monitor and analyze the use of our Service. </p> <ul> <li> <p> <strong>Google Analytics</strong> </p> <p> Google Analytics is a web analytics service o...
or use it for any other purpose. </p>
random_line_split
server.js
/** * Runs a webserver and socket server for visualizating interactions with TJBot */ var ip = require('ip'); var express = require("express") var config = require('./config.js') var path = require("path") var app = express(); var http = require('http'); var exports = module.exports = {}; // routes var routes = requ...
} } exports.sendEvent = sendEvent; exports.wss = wss
{ clients.delete(key); }
conditional_block
server.js
/** * Runs a webserver and socket server for visualizating interactions with TJBot */ var ip = require('ip'); var express = require("express") var config = require('./config.js') var path = require("path") var app = express(); var http = require('http'); var exports = module.exports = {}; // routes var routes = requ...
var WebSocket = require('ws'); var wss = new WebSocket.Server({ server }); var clients = new Map(); wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { }); clients.set(ws._socket._handle.fd, ws); //clients.push({id: ws._socket._handle.fd , client: }); // ws.s...
app.use(express.static('public')); app.use('/', routes);
random_line_split
lib.js
var ArrayProto = Array.prototype; var ObjProto = Object.prototype; var escapeMap = { '&': '&amp;', '"': '&quot;', "'": '&#39;', "<": '&lt;', ">": '&gt;' }; var escapeRegex = /[&"'<>]/g; var lookupEscape = function(ch) { return escapeMap[ch]; }; var exports = module.exports = {}; exports.wit...
} for(;fromIndex < length; fromIndex++) { if (arr[fromIndex] === searchElement) { return fromIndex; } } return -1; }; if(!Array.prototype.map) { Array.prototype.map = function() { throw new Error("map is unimplemented for this j...
{ fromIndex = 0; }
conditional_block
lib.js
var ArrayProto = Array.prototype; var ObjProto = Object.prototype; var escapeMap = { '&': '&amp;', '"': '&quot;', "'": '&#39;', "<": '&lt;', ">": '&gt;' }; var escapeRegex = /[&"'<>]/g; var lookupEscape = function(ch) { return escapeMap[ch]; }; var exports = module.exports = {}; exports.wit...
next(); }; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill exports.indexOf = Array.prototype.indexOf ? function (arr, searchElement, fromIndex) { return Array.prototype.indexOf.call(arr, searchElement, fromIndex); } : function (arr, s...
{ i++; var k = keys[i]; if(i < len) { iter(k, obj[k], i, len, next); } else { cb(); } }
identifier_body
lib.js
var ArrayProto = Array.prototype; var ObjProto = Object.prototype; var escapeMap = { '&': '&amp;', '"': '&quot;', "'": '&#39;', "<": '&lt;', ">": '&gt;' }; var escapeRegex = /[&"'<>]/g; var lookupEscape = function(ch) { return escapeMap[ch]; }; var exports = module.exports = {}; exports.wit...
() { i++; var k = keys[i]; if(i < len) { iter(k, obj[k], i, len, next); } else { cb(); } } next(); }; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill exports.indexOf = Array.prot...
next
identifier_name
lib.js
var ArrayProto = Array.prototype; var ObjProto = Object.prototype; var escapeMap = { '&': '&amp;', '"': '&quot;', "'": '&#39;', "<": '&lt;', ">": '&gt;' }; var escapeRegex = /[&"'<>]/g; var lookupEscape = function(ch) { return escapeMap[ch]; }; var exports = module.exports = {}; exports.wit...
exports.isFunction = function(obj) { return ObjProto.toString.call(obj) == '[object Function]'; }; exports.isArray = Array.isArray || function(obj) { return ObjProto.toString.call(obj) == '[object Array]'; }; exports.isString = function(obj) { return ObjProto.toString.call(obj) == '[object String]'; }; ...
exports.escape = function(val) { return val.replace(escapeRegex, lookupEscape); };
random_line_split
test_registry.py
#!/usr/bin/env python """ """ # Standard library modules. import unittest import logging # Third party modules. # Local modules. from pyhmsa_gui.util.testcase import TestCaseQApp, QTest from pyhmsa_gui.util.registry import \ (iter_entry_points, iter_condition_widget_classes, iter_condition_widgets, ite...
pass def testiter_exporters(self): pass def testiter_preferences_widget_classes(self): pass if __name__ == '__main__': #pragma: no cover logging.getLogger().setLevel(logging.DEBUG) unittest.main()
def testiter_importers(self): pass def testiter_exporter_classes(self):
random_line_split