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 |
|---|---|---|---|---|
video-comments.component.ts | import { Subject, Subscription } from 'rxjs'
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User... |
}
private softDeleteComment (comment: VideoComment) {
comment.isDeleted = true
comment.deletedAt = new Date()
comment.text = ''
comment.account = null
}
private resetVideo () {
if (this.video.commentsEnabled === true) {
// Reset all our fields
this.highlightedThread = null
... | {
this.componentPagination.currentPage++
this.loadMoreThreads()
} | conditional_block |
video-comments.component.ts | import { Subject, Subscription } from 'rxjs'
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User... | .subscribe({
next: () => {
if (this.highlightedThread?.id === commentToDelete.id) {
commentToDelete = this.comments.find(c => c.id === commentToDelete.id)
this.highlightedThread = undefined
}
// Mark the comment as deleted
this.softDeleteCo... | random_line_split | |
video-comments.component.ts | import { Subject, Subscription } from 'rxjs'
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User... |
handleSortChange (sort: string) {
if (this.sort === sort) return
this.sort = sort
this.resetVideo()
}
handleTimestampClicked (timestamp: number) {
this.timestampClicked.emit(timestamp)
}
async onWantedToDelete (
commentToDelete: VideoComment,
title = $localize`Delete`,
message... | {
this.viewReplies(commentTree.comment.id)
} | identifier_body |
generateEventsHelper.js | args = Array.prototype.slice.call(args, 1);
// [0] = type, [1] = lib.jar [2] = blockX, [3] = classX
var File = java.io.File,
FileReader = java.io.FileReader, | clz,
ZipInputStream = java.util.zip.ZipInputStream,
zis = new ZipInputStream(new FileInputStream(args[1])),
entry = null;
var content = [
'/*********************',
'## Events Helper Module (' + FRAMEWORK + ' version)',
'The Events helper module provides a suite of functions -... | FileInputStream = java.io.FileInputStream,
FRAMEWORK = args[0],
out = java.lang.System.out,
err = java.lang.System.err,
Modifier = java.lang.reflect.Modifier, | random_line_split |
generateEventsHelper.js | args = Array.prototype.slice.call(args, 1);
// [0] = type, [1] = lib.jar [2] = blockX, [3] = classX
var File = java.io.File,
FileReader = java.io.FileReader,
FileInputStream = java.io.FileInputStream,
FRAMEWORK = args[0],
out = java.lang.System.out,
err = java.lang.System.err,
... | var fname = parts.reverse().shift().replace(/^(.)/, function (a) {
return a.toLowerCase();
});
if (!canary) {
fname = fname.replace(/Event$/, '');
}
if (canary) {
fname = fname.replace(/Hook$/, '');
}
var javaDoc = canary ? 'htt... | {
name = name.replace(/\//g, '.').replace('.class', '');
try {
clz = java.lang.Class.forName(name);
} catch (e) {
err.println('Warning: could not Class.forName("' + name + '")');
clz = engine.eval(name);
}
var isAbstract = Modifier.isAbstract(c... | conditional_block |
Migrate.js | /* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2017 Christian Boulanger
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for detai... |
}
}
manifestModel.setValidate(true);
}
if (!announceOnly) {
let compileJsonFilename = path.join(process.cwd(), "compile.json");
let replaceInFiles = [{
files: compileJsonFilename,
from: "\"qx/browser\"",
to: "\"@qooxdoo/qx/browser\""
... | {
qx.tool.compiler.Console.info(`Updated dependencies in ${manifestModel.getRelativeDataPath()}.`);
} | conditional_block |
Migrate.js | /* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2017 Christian Boulanger
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for detai... | alias: "v",
describe: "Verbose logging"
},
"quiet": {
alias: "q",
describe: "No output"
}
}
};
}
},
members: {
/**
* Announces or applies a migration
* @param {Boolean} announceOnly If true, announce the m... | return {
command: "migrate",
describe: "migrates the package system to a newer version.",
builder: {
"verbose": { | random_line_split |
main.js | $(function(){
BrowserDetect.init();
$('.minifyme').on("navminified", function() {
// $('td.expand,th.expand').toggle();
});
// Activate all popovers (if NOT mobile)
if ( !BrowserDetect.isMobile() ) {
$('[data-toggle="popover"]').popover();
}
});
$.fn.pressEnter = function(fn) {
... |
BrowserDetect =
// From http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie
{
init: function ()
{
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appV... | {
$('#left-panel').css('height',$('#main').height());
} | identifier_body |
main.js | $(function(){
BrowserDetect.init();
$('.minifyme').on("navminified", function() {
// $('td.expand,th.expand').toggle();
});
// Activate all popovers (if NOT mobile)
if ( !BrowserDetect.isMobile() ) {
$('[data-toggle="popover"]').popover();
}
});
$.fn.pressEnter = function(fn) {
... | () {
$('#left-panel').css('height',$('#main').height());
}
BrowserDetect =
// From http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie
{
init: function ()
{
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(n... | ensureHeightOfSidebar | identifier_name |
main.js | $(function(){
BrowserDetect.init();
$('.minifyme').on("navminified", function() {
// $('td.expand,th.expand').toggle(); |
// Activate all popovers (if NOT mobile)
if ( !BrowserDetect.isMobile() ) {
$('[data-toggle="popover"]').popover();
}
});
$.fn.pressEnter = function(fn) {
return this.each(function() {
$(this).bind('enterPress', fn);
$(this).keyup(function(e){
if(e.keyCode ==... | }); | random_line_split |
main.js | $(function(){
BrowserDetect.init();
$('.minifyme').on("navminified", function() {
// $('td.expand,th.expand').toggle();
});
// Activate all popovers (if NOT mobile)
if ( !BrowserDetect.isMobile() ) {
$('[data-toggle="popover"]').popover();
}
});
$.fn.pressEnter = function(fn) {
... |
}
},
searchVersion: function (dataString)
{
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser:
[
{ string: navigator.user... | {
return data[i].identity;
} | conditional_block |
float.rs | #[macro_use]
extern crate nom;
use nom::{IResult,digit};
| use std::str::FromStr;
named!(unsigned_float <f32>, map_res!(
map_res!(
recognize!(
alt!(
delimited!(digit, tag!("."), opt!(complete!(digit))) |
delimited!(opt!(digit), tag!("."), digit)
)
),
str::from_utf8
),
FromStr::from_str
));
named!(float <f32>, map!(
pair!(
o... | use std::str; | random_line_split |
float.rs | #[macro_use]
extern crate nom;
use nom::{IResult,digit};
use std::str;
use std::str::FromStr;
named!(unsigned_float <f32>, map_res!(
map_res!(
recognize!(
alt!(
delimited!(digit, tag!("."), opt!(complete!(digit))) |
delimited!(opt!(digit), tag!("."), digit)
)
),
str::from_ut... | () {
assert_eq!(unsigned_float(&b"123.456"[..]), IResult::Done(&b""[..], 123.456));
assert_eq!(unsigned_float(&b"0.123"[..]), IResult::Done(&b""[..], 0.123));
assert_eq!(unsigned_float(&b"123.0"[..]), IResult::Done(&b""[..], 123.0));
assert_eq!(unsigned_float(&b"123."[..]), IResult::Done(&b""[..], 123.0)... | unsigned_float_test | identifier_name |
float.rs | #[macro_use]
extern crate nom;
use nom::{IResult,digit};
use std::str;
use std::str::FromStr;
named!(unsigned_float <f32>, map_res!(
map_res!(
recognize!(
alt!(
delimited!(digit, tag!("."), opt!(complete!(digit))) |
delimited!(opt!(digit), tag!("."), digit)
)
),
str::from_ut... | {
assert_eq!(float(&b"123.456"[..]), IResult::Done(&b""[..], 123.456));
assert_eq!(float(&b"+123.456"[..]), IResult::Done(&b""[..], 123.456));
assert_eq!(float(&b"-123.456"[..]), IResult::Done(&b""[..], -123.456));
} | identifier_body | |
qualitative_move_base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from actionlib import SimpleActionClient
from pnp_plugin_server.pnp_simple_plugin_server import PNPSimplePluginServer
from pepper_move_base.msg import QualitativeMovePepperAction, QualitativeMovePepperResult
from pnp_msgs.msg import ActionResult
from nao_inte... | (PNPSimplePluginServer):
def __init__(self, name):
rospy.loginfo("Starting %s ..." % name)
self.listener = tf.TransformListener()
self.target_frame = rospy.get_param("~target_frame", "base_link")
with open(rospy.get_param("~config_file"),'r') as f:
self.distance =... | QualitativeMove | identifier_name |
qualitative_move_base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from actionlib import SimpleActionClient
from pnp_plugin_server.pnp_simple_plugin_server import PNPSimplePluginServer
from pepper_move_base.msg import QualitativeMovePepperAction, QualitativeMovePepperResult
from pnp_msgs.msg import ActionResult
from nao_inte... | execute_cb=self.execute_cb,
auto_start=False
)
rospy.loginfo("Creating tracker client")
self.start_client = SimpleActionClient("/start_tracking_person", TrackPersonAction)
self.start_client.wait_for_server()
rospy.loginfo("Tracker client connected")
... | ActionSpec=QualitativeMovePepperAction, | random_line_split |
qualitative_move_base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from actionlib import SimpleActionClient
from pnp_plugin_server.pnp_simple_plugin_server import PNPSimplePluginServer
from pepper_move_base.msg import QualitativeMovePepperAction, QualitativeMovePepperResult
from pnp_msgs.msg import ActionResult
from nao_inte... | target_pose.pose.orientation.w = math.cos(theta/2.)
print target_pose
self.move_client.send_goal_and_wait(MoveBaseGoal(target_pose=target_pose))
finally:
break
res = QualitativeMovePepperResul... | int_id = int(goal.id.split("_")[1])
for p in msg.person_array:
if p.id == int_id:
try:
t = self.listener.getLatestCommonTime(self.target_frame, msg.header.frame_id)
p_pose = PoseStamped(header=msg.header, pose=p.person.posit... | conditional_block |
qualitative_move_base.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from actionlib import SimpleActionClient
from pnp_plugin_server.pnp_simple_plugin_server import PNPSimplePluginServer
from pepper_move_base.msg import QualitativeMovePepperAction, QualitativeMovePepperResult
from pnp_msgs.msg import ActionResult
from nao_inte... | def execute_cb(self, goal):
self.start_client.send_goal(TrackPersonGoal(id=goal.id, no_turn=True))
try:
msg = rospy.wait_for_message("/naoqi_driver_node/people_detected", PersonDetectedArray, timeout=5.)
except rospy.ROSException as e:
rospy.logwarn(e)
sel... | def __init__(self, name):
rospy.loginfo("Starting %s ..." % name)
self.listener = tf.TransformListener()
self.target_frame = rospy.get_param("~target_frame", "base_link")
with open(rospy.get_param("~config_file"),'r') as f:
self.distance = yaml.load(f)["distances"]
... | identifier_body |
gio_futures_await.rs | extern crate gio;
extern crate glib;
use gio::prelude::*;
use futures::prelude::*;
use std::str;
// Throughout our chained futures, we convert all errors to strings
// via map_err() return them directly.
async fn read_file(file: gio::File) -> Result<(), String> {
// Try to open the file.
let strm = file
... | l.run();
c.pop_thread_default();
} | random_line_split | |
gio_futures_await.rs | extern crate gio;
extern crate glib;
use gio::prelude::*;
use futures::prelude::*;
use std::str;
// Throughout our chained futures, we convert all errors to strings
// via map_err() return them directly.
async fn read_file(file: gio::File) -> Result<(), String> {
// Try to open the file.
let strm = file
... | () {
let c = glib::MainContext::default();
let l = glib::MainLoop::new(Some(&c), false);
c.push_thread_default();
let file = gio::File::new_for_path("Cargo.toml");
let l_clone = l.clone();
let future = async move {
match read_file(file).await {
Ok(()) => (),
Er... | main | identifier_name |
gio_futures_await.rs | extern crate gio;
extern crate glib;
use gio::prelude::*;
use futures::prelude::*;
use std::str;
// Throughout our chained futures, we convert all errors to strings
// via map_err() return them directly.
async fn read_file(file: gio::File) -> Result<(), String> {
// Try to open the file.
let strm = file
... |
c.pop_thread_default();
}
| {
let c = glib::MainContext::default();
let l = glib::MainLoop::new(Some(&c), false);
c.push_thread_default();
let file = gio::File::new_for_path("Cargo.toml");
let l_clone = l.clone();
let future = async move {
match read_file(file).await {
Ok(()) => (),
Err(e... | identifier_body |
pre_parse.rs | use futures::{Stream, StreamExt, TryFutureExt};
use juniper::{
executor::{execute_validated_query_async, get_operation, resolve_validated_subscription},
graphql_object, graphql_subscription,
parser::parse_document_source,
validation::{validate_input_values, visit_all_rules, ValidatorContext},
EmptyM... | () -> UserStream {
Box::pin(futures::stream::iter(vec![Ok(User)]))
}
}
#[derive(Clone)]
pub struct User;
#[graphql_object(context = Context)]
impl User {
fn id() -> i32 {
1
}
}
type Schema = RootNode<'static, Query, EmptyMutation<Context>, Subscription>;
#[tokio::test]
async fn query_doc... | users | identifier_name |
pre_parse.rs | use futures::{Stream, StreamExt, TryFutureExt};
use juniper::{
executor::{execute_validated_query_async, get_operation, resolve_validated_subscription},
graphql_object, graphql_subscription,
parser::parse_document_source,
validation::{validate_input_values, visit_all_rules, ValidatorContext},
EmptyM... | &document,
&operation,
&root_node,
&Variables::new(),
&Context {},
)
.map_ok(|(stream, errors)| juniper_subscriptions::Connection::from_stream(stream, errors))
.await
.unwrap();
let _ = stream.next().await.unwrap();
} |
let operation = get_operation(&document, None).unwrap();
assert!(operation.item.operation_type == OperationType::Subscription);
let mut stream = resolve_validated_subscription( | random_line_split |
utilsOsType.py | """ Utility module to determine the OS Python running on
--------------------------------------------------------------------------
File: utilsOsType.py
Overview: Python module to supply functions and an enumeration to
help determine the platform type, bit size and OS cur... | (Enum):
Unknown = 0
Darwin = 1
FreeBSD = 2
Linux = 3
NetBSD = 4
Windows = 5
kFreeBSD = 6
else:
class EnumOsType(object):
values = ["Unknown",
"Darwin",
"FreeBSD",
"Linux",
"NetBSD"... | EnumOsType | identifier_name |
utilsOsType.py | """ Utility module to determine the OS Python running on
--------------------------------------------------------------------------
File: utilsOsType.py
Overview: Python module to supply functions and an enumeration to
help determine the platform type, bit size and OS cur... |
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#++---------------------------------------------------------------------------
#... | return EnumOsType.values[vI] | identifier_body |
utilsOsType.py | """ Utility module to determine the OS Python running on
--------------------------------------------------------------------------
File: utilsOsType.py
Overview: Python module to supply functions and an enumeration to
help determine the platform type, bit size and OS cur... | elif strOS.startswith("gnukfreebsd"):
eOSType = EnumOsType.kFreeBSD
return eOSType | elif strOS == "win32":
eOSType = EnumOsType.Windows | random_line_split |
utilsOsType.py | """ Utility module to determine the OS Python running on
--------------------------------------------------------------------------
File: utilsOsType.py
Overview: Python module to supply functions and an enumeration to
help determine the platform type, bit size and OS cur... |
elif strOS.startswith("openbsd"):
eOSType = EnumOsType.OpenBSD
elif strOS == "win32":
eOSType = EnumOsType.Windows
elif strOS.startswith("gnukfreebsd"):
eOSType = EnumOsType.kFreeBSD
return eOSType
| eOSType = EnumOsType.NetBSD | conditional_block |
is.js | {
"AssetAdmin.BATCHACTIONSDELETECONFIRM": "Ertu viss um að þú viljir eyða %s möppunni?",
"AssetAdmin.ConfirmDelete": "Ertu viss um að þú viljir eyða þessari möppu og skrám sem tilheyra henni",
"AssetTableField.MOVING": "Færi %s skrá(r)",
"AssetTableField.REALLYDELETE": "Ertu viss um að þú viljir eyða me... | "URLSEGMENT.OK": "Allt í lagi",
"URLSEGMENT.UpdateURL": "Update URL",
"WidgetAreaEditor.TOOMANY": "Sorry, you have reached the maximum number of widgets in this area"
} | random_line_split | |
thin.rs | use anyhow::Result;
use std::path::PathBuf;
use thinp::file_utils;
use thinp::io_engine::*;
use crate::args;
use crate::common::fixture::*;
use crate::common::process::*;
use crate::common::target::*;
use crate::common::test_dir::TestDir;
use crate::common::thin_xml_generator::{write_xml, SingleThinS};
//-----------... | (md: &PathBuf) -> Result<()> {
let args = args!["-o", &md, "--set-needs-check"];
run_ok(thin_generate_metadata_cmd(args))?;
Ok(())
}
pub fn generate_metadata_leaks(
md: &PathBuf,
nr_blocks: u64,
expected: u32,
actual: u32,
) -> Result<()> {
let nr_blocks_str = nr_blocks.to_string();
... | set_needs_check | identifier_name |
thin.rs | use anyhow::Result;
use std::path::PathBuf;
use thinp::file_utils;
use thinp::io_engine::*;
use crate::args;
use crate::common::fixture::*;
use crate::common::process::*;
use crate::common::target::*;
use crate::common::test_dir::TestDir;
use crate::common::thin_xml_generator::{write_xml, SingleThinS};
//-----------... | // Take a few snapshots.
let mut snap_id = 2;
for _i in 0..10 {
// take a snapshot
let snap_id_str = snap_id.to_string();
let args = args!["-o", &md, "--create-snap", &snap_id_str, "--origin", "1"];
run_ok(thin_generate_metadata_cmd(args))?;
// partially overwrite th... | {
let md = mk_zeroed_md(td)?;
let args = args!["-o", &md, "--format", "--nr-data-blocks", "102400"];
run_ok(thin_generate_metadata_cmd(args))?;
// Create a 2GB device
let args = args!["-o", &md, "--create-thin", "1"];
run_ok(thin_generate_metadata_cmd(args))?;
let args = args![
"-o"... | identifier_body |
diff_1C.js |
global.connectGlobals(SelfScript)
function СравнениеФайлов1С(Path1, Path2) {
var file1 = v8New("File", Path1);
var file2 = v8New("File", Path2);
if ((!file1.isFile()) & (!file2.isFile())) return null
var ext1 = file1.Extension.substr(1).toLowerCase(); //Уберем первый символ, да в нижний регист... | //engine: JScript
//uname: diff_1C
//dname: Backend к diff, типовое сравнение от 1С (mxl,txt,js,vbs)
//addin: global
| random_line_split | |
diff_1C.js | //engine: JScript
//uname: diff_1C
//dname: Backend к diff, типовое сравнение от 1С (mxl,txt,js,vbs)
//addin: global
global.connectGlobals(SelfScript)
function СравнениеФайлов1С(Path1, Path2) {
var file1 = v8New("File", Path1);
var file2 = v8New("File", Path2);
if ((!file1.isFile()) & (!file2.i... | identifier_body | ||
diff_1C.js | //engine: JScript
//uname: diff_1C
//dname: Backend к diff, типовое сравнение от 1С (mxl,txt,js,vbs)
//addin: global
global.connectGlobals(SelfScript)
function СравнениеФайлов1С(Path | w("File", Path1);
var file2 = v8New("File", Path2);
if ((!file1.isFile()) & (!file2.isFile())) return null
var ext1 = file1.Extension.substr(1).toLowerCase(); //Уберем первый символ, да в нижний регистр, этоже windows
var ext2 = file2.Extension.substr(1).toLowerCase(); //Уберем первый символ, да в ... | 1, Path2) {
var file1 = v8Ne | identifier_name |
jquery.acewidget.js | // anonymous closure - BEGIN
(function(jQuery){
// anonymous closure - BEGIN
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// include microevent.js //
/////////////////////////////////////////... | // post the message
iframeWin.postMessage(JSON.stringify(event), "*");
}
/**
* Helper for setValue event
*
* - this is a helper function on top of acewidget.send()
*
* @param {String} text the text to push in acewidget
* @param {Function} callback will be notified with the result (jsend compliant)
*/
Acewi... | callback(data)
};
} | random_line_split |
profile.module.ts | import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpModule } from '@angular/http';
import { AbstractComponent } from './components/abstract/abstract.component';
import { HeaderModule } from '../header/header.module';
import { ServicesComponent } from './components/s... |
@NgModule({
imports: [
CommonModule,
HeaderModule,
HttpModule
],
declarations: [
AbstractComponent,
ServicesComponent,
TabsComponent,
SkillsComponent,
ProgressComponent,
TimelineComponent,
ExperiencesComponent
],
exports: [ AbstractComponent, ServicesComponent, SkillsComponent, ExperiencesComp... |
import { PersonalInfoService } from './services/personal-info.service';
import { PersonalSocialService } from './services/personal-social.service'; | random_line_split |
profile.module.ts | import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpModule } from '@angular/http';
import { AbstractComponent } from './components/abstract/abstract.component';
import { HeaderModule } from '../header/header.module';
import { ServicesComponent } from './components/s... | { }
| ProfileModule | identifier_name |
ieq30pro.py | self._coords_format = re.compile(self._dec_format + self._ra_format)
self._raw_status = None
self._status_format = re.compile(
'(?P<gps>[0-2]{1})' +
'(?P<state>[0-7]{1})' +
'(?P<tracking>[0-4]{1})' +
'(?P<movement_speed>[1-9]{1})' +
'(... | self.logger.info('Creating iOptron mount')
# Regexp to match the iOptron RA/Dec format
self._ra_format = r'(?P<ra_millisecond>\d{8})'
self._dec_format = r'(?P<dec_sign>[\+\-])(?P<dec_arcsec>\d{8})' | random_line_split | |
ieq30pro.py | + self._ra_format)
self._raw_status = None
self._status_format = re.compile(
'(?P<gps>[0-2]{1})' +
'(?P<state>[0-7]{1})' +
'(?P<tracking>[0-4]{1})' +
'(?P<movement_speed>[1-9]{1})' +
'(?P<time_source>[1-3]{1})' +
'(?P<hemisphere>[... | Returns:
bool: indicating success
"""
if self.is_parked:
self.logger.info('Mount is parked')
return self._is_parked
if self.slew_to_home(blocking=True):
# The mount is currently not parking in correct position so we manually move it there... | """Slews to the park position and parks the mount.
This will first move the mount to the home position, then move the RA axis
in the direction specified at 0.9x sidereal rate (the fastest) for the number
of seconds requested. Then move the Dec axis in a similar manner. This should
be ad... | identifier_body |
ieq30pro.py | + self._ra_format)
self._raw_status = None
self._status_format = re.compile(
'(?P<gps>[0-2]{1})' +
'(?P<state>[0-7]{1})' +
'(?P<tracking>[0-4]{1})' +
'(?P<movement_speed>[1-9]{1})' +
'(?P<time_source>[1-3]{1})' +
'(?P<hemisphere>[... |
if self.is_connected and not self.is_initialized:
self.logger.info(f'Initializing {__name__} mount')
# We trick the mount into thinking it's initialized while we
# initialize otherwise the `query` method will test
# to see if initialized and be put into loop.
... | self.logger.info(f'Connecting to mount {__name__}')
self.connect() | conditional_block |
ieq30pro.py | ': 'Southern',
'1': 'Northern'
}
}
self.logger.info('Mount created')
################################################################################################
# Properties
###################################################################################... | o_position(self):
| identifier_name | |
tabs.tsx | import React, { Component } from 'react';
export interface TabsProps {
active?:number;
};
export default class | extends Component<TabsProps,any> {
static propTypes={
active:React.PropTypes.number,
};
static defaultProps={
active:0,
};
constructor(props){
super(props);
this.state=(this.init());
};
init=()=>{
const {active}=this.props;
return {
active:active,
currentTab:{
... | Tabs | identifier_name |
tabs.tsx | import React, { Component } from 'react';
export interface TabsProps { |
export default class Tabs extends Component<TabsProps,any> {
static propTypes={
active:React.PropTypes.number,
};
static defaultProps={
active:0,
};
constructor(props){
super(props);
this.state=(this.init());
};
init=()=>{
const {active}=this.props;
return {
active:active,
... | active?:number;
}; | random_line_split |
tabs.tsx | import React, { Component } from 'react';
export interface TabsProps {
active?:number;
};
export default class Tabs extends Component<TabsProps,any> {
static propTypes={
active:React.PropTypes.number,
};
static defaultProps={
active:0,
};
constructor(props){
super(props);
this.state=(this.... | ;
};
| {
return (
<article className="y-tab-page">
{this.props.children}
</article>
)
} | identifier_body |
github.js | global.electron = require('electron');
global.BrowserWindow = electron.BrowserWindow;
global.Dialog = electron.dialog;
var Fs = require('fs');
var ipc = require("electron").ipcMain;
var path = require('path');
var temp = require('temp');
var request = require('request');
var querystring = require('querystring');
var ... | {
module.exports._private = {
loadWindow: loadWindow,
checkForAPIKey: checkForAPIKey,
writeData: writeData,
postData: postData,
putData: putData,
uploadToGithub: uploadToGithub,
request: request
};
} | conditional_block | |
github.js | global.electron = require('electron');
global.BrowserWindow = electron.BrowserWindow;
global.Dialog = electron.dialog;
var Fs = require('fs');
var ipc = require("electron").ipcMain;
var path = require('path');
var temp = require('temp');
var request = require('request');
var querystring = require('querystring');
var ... | request.post(opts, function(err, resp, body) {
displayResult(body, apiKey);
});
};
var displayResult = function(result, apiKey) {
if (result.errors) {
console.log(result.errors);
githubWindow.webContents.send('errors', result.errors);
} else {
waitForDataset(result.job_url, apiKey, function(typ... | 'file[file]': Fs.createReadStream(file),
}
};
| random_line_split |
blake2b.rs | 12], $m);
G!($r,6,$v[ 2],$v[ 7],$v[ 8],$v[13], $m);
G!($r,7,$v[ 3],$v[ 4],$v[ 9],$v[14], $m);
}
));
impl Blake2b {
fn set_lastnode(&mut self) {
self.f[1] = 0xFFFFFFFFFFFFFFFF;
}
fn set_lastblock(&mut self) |
fn increment_counter(&mut self, inc : u64) {
self.t[0] += inc;
self.t[1] += if self.t[0] < inc { 1 } else { 0 };
}
fn init0(param: Blake2bParam, digest_length: u8, key: &[u8]) -> Blake2b {
assert!(key.len() <= BLAKE2B_KEYBYTES);
let mut b = Blake2b {
h: IV,
... | {
if self.last_node!=0 {
self.set_lastnode();
}
self.f[0] = 0xFFFFFFFFFFFFFFFF;
} | identifier_body |
blake2b.rs | 12], $m);
G!($r,6,$v[ 2],$v[ 7],$v[ 8],$v[13], $m);
G!($r,7,$v[ 3],$v[ 4],$v[ 9],$v[14], $m);
}
));
impl Blake2b {
fn set_lastnode(&mut self) {
self.f[1] = 0xFFFFFFFFFFFFFFFF;
}
fn set_lastblock(&mut self) {
if self.last_node!=0 {
self.set_lastnode();
}
... | (outlen: usize) -> Blake2b {
assert!(outlen > 0 && outlen <= BLAKE2B_OUTBYTES);
Blake2b::init_param(Blake2b::default_param(outlen as u8), &[])
}
fn apply_key(&mut self) {
let mut block : [u8; BLAKE2B_BLOCKBYTES] = [0; BLAKE2B_BLOCKBYTES];
copy_memory(&self.key[..self.key_length ... | new | identifier_name |
blake2b.rs | a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,... | mod mac_tests {
use blake2b::Blake2b; | random_line_split | |
blake2b.rs | 12], $m);
G!($r,6,$v[ 2],$v[ 7],$v[ 8],$v[13], $m);
G!($r,7,$v[ 3],$v[ 4],$v[ 9],$v[14], $m);
}
));
impl Blake2b {
fn set_lastnode(&mut self) {
self.f[1] = 0xFFFFFFFFFFFFFFFF;
}
fn set_lastblock(&mut self) {
if self.last_node!=0 |
self.f[0] = 0xFFFFFFFFFFFFFFFF;
}
fn increment_counter(&mut self, inc : u64) {
self.t[0] += inc;
self.t[1] += if self.t[0] < inc { 1 } else { 0 };
}
fn init0(param: Blake2bParam, digest_length: u8, key: &[u8]) -> Blake2b {
assert!(key.len() <= BLAKE2B_KEYBYTES);
... | {
self.set_lastnode();
} | conditional_block |
TypeaheadInputMulti.tsx | /* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import cx from 'classnames';
import React, { FocusEvent, KeyboardEvent, MouseEvent, ReactNode } from 'react';
import Hint from '../Hint';
import Input from '../Input';
import { isSelectable, propsW... |
onKeyDown && onKeyDown(e);
};
}
export default TypeaheadInputMulti; | random_line_split | |
TypeaheadInputMulti.tsx | /* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import cx from 'classnames';
import React, { FocusEvent, KeyboardEvent, MouseEvent, ReactNode } from 'react';
import Hint from '../Hint';
import Input from '../Input';
import { isSelectable, propsW... |
const inputNode = this._input;
if (
!inputNode ||
// Ignore if the clicked element is a child of the container, ie: a token
// or the input itself.
(e.currentTarget.contains(e.target as HTMLElement) &&
e.currentTarget !== e.target)
) {
return;
}
if (isSelecta... | {
e.currentTarget.blur();
return;
} | conditional_block |
tag_list.py | from django.template import Library, Node, Variable, VariableDoesNotExist
from django.core.urlresolvers import reverse
from job_board.views import job_list_by_tag
register = Library()
def do_populate_tags(parser,token):
"""
render a list of tags, with it's link.
the token is tag.
Arguments:
- `pa... | class PopulateTagsNode(Node):
def __init__(self,tag):
self.tag_tag = Variable(tag)
def render(self,context):
try:
_tag = self.tag_tag.resolve(context)
_font_size = _tag.font_size + 10
_font_weight = min(900,(300 + (_tag.font_size*100)))
_url = rev... | random_line_split | |
tag_list.py | from django.template import Library, Node, Variable, VariableDoesNotExist
from django.core.urlresolvers import reverse
from job_board.views import job_list_by_tag
register = Library()
def do_populate_tags(parser,token):
|
class PopulateTagsNode(Node):
def __init__(self,tag):
self.tag_tag = Variable(tag)
def render(self,context):
try:
_tag = self.tag_tag.resolve(context)
_font_size = _tag.font_size + 10
_font_weight = min(900,(300 + (_tag.font_size*100)))
_url = r... | """
render a list of tags, with it's link.
the token is tag.
Arguments:
- `parser`:
- `token`:
"""
bits = token.split_contents()
print bits
return PopulateTagsNode(bits[1]) | identifier_body |
tag_list.py | from django.template import Library, Node, Variable, VariableDoesNotExist
from django.core.urlresolvers import reverse
from job_board.views import job_list_by_tag
register = Library()
def do_populate_tags(parser,token):
"""
render a list of tags, with it's link.
the token is tag.
Arguments:
- `pa... | (self,tag):
self.tag_tag = Variable(tag)
def render(self,context):
try:
_tag = self.tag_tag.resolve(context)
_font_size = _tag.font_size + 10
_font_weight = min(900,(300 + (_tag.font_size*100)))
_url = reverse(job_list_by_tag, kwargs = {'tag_name' : _... | __init__ | identifier_name |
gameboy.rs | // This file is part of Mooneye GB.
// Copyright (C) 2014-2020 Joonas Javanainen <joonas.javanainen@gmail.com>
//
// Mooneye GB is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License... | 3 => On,
_ => Off,
}
}
}
impl Into<u8> for Color {
fn into(self) -> u8 {
match self {
Color::Off => 0,
Color::Light => 1,
Color::Dark => 2,
Color::On => 3,
}
}
}
pub const CPU_SPEED_HZ: usize = 4_194_304;
pub const HIRAM_SIZE: usize = 0x80;
pub const HIRAM_EMPTY: ... | pub fn from_u8(value: u8) -> Color {
use self::Color::*;
match value {
1 => Light,
2 => Dark, | random_line_split |
gameboy.rs | // This file is part of Mooneye GB.
// Copyright (C) 2014-2020 Joonas Javanainen <joonas.javanainen@gmail.com>
//
// Mooneye GB is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
}
pub const CPU_SPEED_HZ: usize = 4_194_304;
pub const HIRAM_SIZE: usize = 0x80;
pub const HIRAM_EMPTY: HiramData = [0; HIRAM_SIZE];
pub const ROM_BANK_SIZE: usize = 0x4000;
pub const RAM_BANK_SIZE: usize = 0x2000;
pub const SCREEN_WIDTH: usize = 160;
pub const SCREEN_HEIGHT: usize = 144;
pub const SCREEN_PIXELS: usi... | {
match self {
Color::Off => 0,
Color::Light => 1,
Color::Dark => 2,
Color::On => 3,
}
} | identifier_body |
gameboy.rs | // This file is part of Mooneye GB.
// Copyright (C) 2014-2020 Joonas Javanainen <joonas.javanainen@gmail.com>
//
// Mooneye GB is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License... | {
Off = 0,
Light = 1,
Dark = 2,
On = 3,
}
impl Color {
#[inline]
pub fn from_u8(value: u8) -> Color {
use self::Color::*;
match value {
1 => Light,
2 => Dark,
3 => On,
_ => Off,
}
}
}
impl Into<u8> for Color {
fn into(self) -> u8 {
match self {
Color::Off... | Color | identifier_name |
thunk.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 ... | }
pub fn invoke(self, arg: A) -> R {
self.invoke.invoke(arg)
}
}
pub trait Invoke<A=(),R=()> {
fn invoke(self: Box<Self>, arg: A) -> R;
}
impl<A,R,F> Invoke<A,R> for F
where F : FnOnce(A) -> R
{
fn invoke(self: Box<F>, arg: A) -> R {
let f = *self;
f(arg)
}
} | random_line_split | |
thunk.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 ... | (self, arg: A) -> R {
self.invoke.invoke(arg)
}
}
pub trait Invoke<A=(),R=()> {
fn invoke(self: Box<Self>, arg: A) -> R;
}
impl<A,R,F> Invoke<A,R> for F
where F : FnOnce(A) -> R
{
fn invoke(self: Box<F>, arg: A) -> R {
let f = *self;
f(arg)
}
}
| invoke | identifier_name |
thunk.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 ... |
}
impl<A,R> Thunk<A,R> {
pub fn with_arg<F>(func: F) -> Thunk<A,R>
where F : FnOnce(A) -> R, F : Send
{
Thunk {
invoke: box func
}
}
pub fn invoke(self, arg: A) -> R {
self.invoke.invoke(arg)
}
}
pub trait Invoke<A=(),R=()> {
fn invoke(self: Box<Se... | {
Thunk::with_arg(move|()| func())
} | identifier_body |
regionmanip.rs | new() };
wf.accumulate_from_ty(ty);
wf.out
}
impl<'a, 'tcx> Wf<'a, 'tcx> {
fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
debug!("Wf::accumulate_from_ty(ty={})",
ty.repr(self.tcx));
match ty.sty {
ty::ty_bool |
ty::ty_char |
ty::ty_int(.... |
/// Pushes a constraint that `r_a <= r_b`, due to `opt_ty`
fn push_sub_region_constraint(&mut self,
opt_ty: Option<Ty<'tcx>>,
r_a: ty::Region,
r_b: ty::Region) {
self.out.push(RegionSubRegionConstrain... | {
// Indicates that we have found borrowed content with a lifetime
// of at least `r_b`. This adds a constraint that `r_b` must
// outlive the region `r_a` on top of the stack.
//
// As an example, imagine walking a type like:
//
// &'a &'b T
// ... | identifier_body |
regionmanip.rs | new() };
wf.accumulate_from_ty(ty);
wf.out
}
impl<'a, 'tcx> Wf<'a, 'tcx> {
fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
debug!("Wf::accumulate_from_ty(ty={})",
ty.repr(self.tcx));
match ty.sty {
ty::ty_bool |
ty::ty_char |
ty::ty_int(.... | (&mut self,
ty: Ty<'tcx>,
def_id: ast::DefId,
generics: &ty::Generics<'tcx>,
substs: &Substs<'tcx>)
{
// The generic declarations from the type, appropriately
// substituted for the actual sub... | accumulate_from_adt | identifier_name |
regionmanip.rs | new() };
wf.accumulate_from_ty(ty);
wf.out
}
impl<'a, 'tcx> Wf<'a, 'tcx> {
fn accumulate_from_ty(&mut self, ty: Ty<'tcx>) {
debug!("Wf::accumulate_from_ty(ty={})",
ty.repr(self.tcx));
match ty.sty {
ty::ty_bool |
ty::ty_char |
ty::ty_int(.... |
ty::Contravariant | ty::Invariant => {
// If the parameter is contravariant or
// invariant, there may indeed be reachable
// data with this lifetime. See other case for
// more details.
... | {
// Ignore covariant or bivariant region
// parameters. To understand why, consider a
// struct `Foo<'a>`. If `Foo` contains any
// references with lifetime `'a`, then `'a` must
// be at least contr... | conditional_block |
regionmanip.rs | . We should do this after
// the fn check, then we can call this case a bug().
}
ty::ty_open(_) => {
self.tcx.sess.bug(
&format!("Unexpected type encountered while doing wf check: {}",
ty.repr(self.tcx))[]);
... | // `bounds.region_bound`:
let r_c = region_bound;
self.push_region_constraint_from_top(r_c);
// And then, in turn, to be well-formed, the | random_line_split | |
back.rs | //! Back-end module for the task queue. The back-end is running
//! on a separate thread. All it does is listening to a command
//! channel and starting new tasks when the time comes.
use std::sync::atomic::*;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Sender, Receiver, channel};
use std::collections::HashMap;... | (bran::Handle);
impl ReadyTask {
pub fn run(self) {
use bran::fiber::State;
let ReadyTask(task) = self;
match task.run() {
State::Pending(signal) => {
worker::requeue(task, signal);
}
State::PendingTimeout(_, _) => {
panic!... | ReadyTask | identifier_name |
back.rs | //! Back-end module for the task queue. The back-end is running
//! on a separate thread. All it does is listening to a command
//! channel and starting new tasks when the time comes.
use std::sync::atomic::*;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Sender, Receiver, channel};
use std::collections::HashMap;... |
/// Create a new deque
pub fn new_deque(&self) -> (usize,
deque::Worker<ReadyTask>,
Receiver<worker::Command>) {
let buffer = deque::BufferPool::new();
let (worker, stealer) = buffer.deque();
let (send, recv) = channel();... | {
// read the current active count, OR in the BLOCK
// flag if needed for the wait
match wait {
Wait::None | Wait::Active => {
self.active.store(true, Ordering::SeqCst);
}
Wait::Pending => ()
};
let mut guard = self.workers.loc... | identifier_body |
back.rs | //! Back-end module for the task queue. The back-end is running
//! on a separate thread. All it does is listening to a command
//! channel and starting new tasks when the time comes.
use std::sync::atomic::*;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::{Sender, Receiver, channel};
use std::collections::HashMap;... | /// been completed.
pub fn enqueue(back: Arc<Backend>, task: bran::Handle, after: Signal) {
after.callback(move || {
if !back.active.load(Ordering::SeqCst) {
let try_thread = worker::start(ReadyTask(task));
match try_thread {
Ok(b) => b,
... | }
});
}
/// Start a task that will run once all the Handle's have | random_line_split |
read_project_steps.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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 b... | def i_get_the_project(step, resource):
resource = world.api.get_project(resource)
world.status = resource['code']
assert world.status == HTTP_OK
world.project = resource['object'] | from bigml.api import HTTP_OK
| random_line_split |
read_project_steps.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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 b... | resource = world.api.get_project(resource)
world.status = resource['code']
assert world.status == HTTP_OK
world.project = resource['object'] | identifier_body | |
read_project_steps.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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 b... | (step, resource):
resource = world.api.get_project(resource)
world.status = resource['code']
assert world.status == HTTP_OK
world.project = resource['object']
| i_get_the_project | identifier_name |
settings_module.ts | /* Copyright 2019 The TensorFlow Authors. 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 applicable law or a... | {}
| SettingsModule | identifier_name |
settings_module.ts | /* Copyright 2019 The TensorFlow Authors. 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 applicable law or a... | import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatButtonModule} from '@angular/material/button';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatDialogModule} from '@angular/material/dialog';
import {MatIconModule} from '@angular/material/icon';
import {MatInputModule}... | random_line_split | |
webviewEditor.ts | vs/base/browser/dom';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IContextKey, IContextKeyService } from 'vs/platf... |
public withWebview(f: (element: Webview) => void): void {
if (this._webview) {
f(this._webview);
}
}
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
if (this.input && this.input instanceof WebviewEditorInput) {
if (visible) {
this.input.claimWebview(this);
} else {
... | {
super.focus();
if (!this._onFocusWindowHandler.value) {
// Make sure we restore focus when switching back to a VS Code window
this._onFocusWindowHandler.value = this._windowService.onDidChangeFocus(focused => {
if (focused && this._editorService.activeControl === this) {
this.focus();
}
});... | identifier_body |
webviewEditor.ts | vs/base/browser/dom';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IContextKey, IContextKeyService } from 'vs/platf... | (parent: HTMLElement): void {
this._editorFrame = parent;
this._content = document.createElement('div');
parent.appendChild(this._content);
}
private doUpdateContainer() {
const webviewContainer = this.input && (this.input as WebviewEditorInput).container;
if (webviewContainer && webviewContainer.parentEle... | createEditor | identifier_name |
webviewEditor.ts | 'vs/base/browser/dom';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri'; | import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { IWorkspaceContextService ... | import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; | random_line_split |
webviewEditor.ts | vs/base/browser/dom';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IContextKey, IContextKeyService } from 'vs/platf... |
super.setEditorVisible(visible, group);
}
public clearInput() {
if (this.input && this.input instanceof WebviewEditorInput) {
this.input.releaseWebview(this);
}
this._webview = undefined;
this._webviewContent = undefined;
this.pendingMessages = [];
super.clearInput();
}
setInput(input: Webvie... | {
if (visible) {
this._webviewContent.style.visibility = 'visible';
this.doUpdateContainer();
} else {
this._webviewContent.style.visibility = 'hidden';
}
} | conditional_block |
environment.js | /**
* Copyright 2016 The AMP HTML Authors. 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 require... |
}
args[0] = wrapper;
function next() {
intervals[id] = win.setTimeout.apply(win, args);
}
next();
return id;
};
const {clearInterval} = win;
win.clearInterval = function(id) {
clearInterval(id);
win.clearTimeout(intervals[id]);
delete intervals[id];
};
}
/**
* Blackh... | {
return fn.apply(this, arguments);
} | conditional_block |
environment.js | /**
* Copyright 2016 The AMP HTML Authors. 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 require... | } else if (srcdoc) {
instrumentSrcdoc(parent, node);
}
}
} catch (e) {
console./*OK*/error(e.message, e.stack);
}
}
}
/**
* Installs a mutation observer in a window to look for iframes.
* @param {!Element} node
* @param {!Window} parent
* @param {!Window} win
*/
fun... | }); | random_line_split |
environment.js | /**
* Copyright 2016 The AMP HTML Authors. 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 require... | (parent, win) {
const doc = win.document;
const {close} = doc;
doc.close = function() {
parent.ampManageWin = function(win) {
manageWin(win);
};
if (!parent.ampSeen) {
// .call does not work in Safari with document.write.
doc.write('<script>window.parent.ampManageWin(window)</script>... | instrumentDocWrite | identifier_name |
environment.js | /**
* Copyright 2016 The AMP HTML Authors. 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 require... |
/**
* Add instrumentation code to doc.write.
* @param {!Window} parent
* @param {!Window} win
*/
function instrumentDocWrite(parent, win) {
const doc = win.document;
const {close} = doc;
doc.close = function() {
parent.ampManageWin = function(win) {
manageWin(win);
};
if (!parent.ampSeen)... | {
if (win.ampSeen) {
return;
}
win.ampSeen = true;
// Instrument window.
instrumentEntryPoints(win);
// Watch for new iframes.
installObserver(win);
// Existing iframes.
maybeInstrumentsNodes(win, win.document.querySelectorAll('iframe'));
blockSyncPopups(win);
} | identifier_body |
layout.service.ts | import { Injectable } from '@angular/core';
import { Point } from '../geometry/point';
import { Rectangle } from '../geometry/rectangle';
import { IElementLink, IFlow, IFlowElement, IPort, PortType } from '../store/flow.types';
export interface IElementLayout
{
readonly id: number;
readonly name: string;
readonl... |
}
function getElemHeight(ports: IPort[], portsGap:number = sizes.portsGap, portSize:number = sizes.portSize) : number
{
const maxPortsOnSide = Math.max(countType(ports, PortType.Input), countType(ports, PortType.Output));
const height = (maxPortsOnSide + 1) * portsGap + maxPortsOnSide * portSize;
return height;... | {
const elementLayouts: IElementLayout[] = flow.elements.map(elem => layoutElement(elem, elem.position));
const linkLayouts: ILinkLayout[] = flow.elementLinks.map(link => layoutLink(link, elementLayouts));
const rect = new Rectangle( 40, 40, sizes.elemWidth, getElemHeight(flow.ports));
return {
... | identifier_body |
layout.service.ts | import { Injectable } from '@angular/core';
import { Point } from '../geometry/point';
import { Rectangle } from '../geometry/rectangle';
import { IElementLink, IFlow, IFlowElement, IPort, PortType } from '../store/flow.types';
export interface IElementLayout
{
readonly id: number;
readonly name: string;
readonl... | ({id, name, ports}: IFlowElement, offset: Point): IElementLayout
{
const {elemNameOffset, portNameOffset, elemWidth, portSize} = sizes;
const rect = new Rectangle(offset.x, offset.y, elemWidth, getElemHeight(ports));
return {
id,
name,
rect,
elemNameOffset,
portNameOffset,
portLayouts: l... | layoutElement | identifier_name |
layout.service.ts | import { Injectable } from '@angular/core';
import { Point } from '../geometry/point';
import { Rectangle } from '../geometry/rectangle';
import { IElementLink, IFlow, IFlowElement, IPort, PortType } from '../store/flow.types';
export interface IElementLayout
{
readonly id: number;
readonly name: string;
readonl... | readonly elementLayouts: IElementLayout[];
readonly linkLayouts: ILinkLayout[];
readonly portNameOffset: number;
readonly portLayouts: IPortLayout[];
}
export interface ILinkLayout
{
readonly link: IElementLink;
readonly from: Point;
readonly to: Point;
readonly path: string
}
const sizes = {
elemN... | readonly rect: Rectangle;
| random_line_split |
__init__.py | # -*- coding: UTF-8 -*-
# YaBlog
# (c) Regis FLORET
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright | # names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# W... | # notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of ... | random_line_split |
lib.rs | // Copyright 2013-2014 Jeffery Olson
//
// Licensed under the 3-Clause BSD License, see LICENSE.txt
// at the top-level of this repository.
// This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_id="p2dux#0.1"]
#![crate_type="rlib"]
#![desc = "All UX/Frontend-specific cod... | else {
self.fps_ctr += 1;
}
}
pub fn get_curr_fps(&self) -> uint { self.curr_fps }
pub fn get_ms_since(&self) -> uint { (self.now_time - self.last_time) as uint }
}
| {
self.curr_fps = self.fps_ctr;
self.fps_ctr = 0;
self.next_fps_time = self.now_time + 1000u64;
} | conditional_block |
lib.rs | // Copyright 2013-2014 Jeffery Olson
//
// Licensed under the 3-Clause BSD License, see LICENSE.txt
// at the top-level of this repository.
// This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_id="p2dux#0.1"]
#![crate_type="rlib"]
#![desc = "All UX/Frontend-specific cod... |
}
| { (self.now_time - self.last_time) as uint } | identifier_body |
lib.rs | // Copyright 2013-2014 Jeffery Olson
//
// Licensed under the 3-Clause BSD License, see LICENSE.txt
// at the top-level of this repository.
// This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_id="p2dux#0.1"]
#![crate_type="rlib"]
#![desc = "All UX/Frontend-specific cod... | {
pub last_time: u64,
pub now_time: u64,
pub next_fps_time: u64,
pub fps_ctr: uint,
pub curr_fps: uint
}
impl TimeTracker {
pub fn new() -> TimeTracker {
let curr_time = precise_time_ns() / 1000000u64;
let mut tt = TimeTracker {
last_time: curr_time,
now_... | TimeTracker | identifier_name |
lib.rs | // Copyright 2013-2014 Jeffery Olson
//
// Licensed under the 3-Clause BSD License, see LICENSE.txt
// at the top-level of this repository.
// This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_id="p2dux#0.1"]
#![crate_type="rlib"]
#![desc = "All UX/Frontend-specific cod... | pub next_fps_time: u64,
pub fps_ctr: uint,
pub curr_fps: uint
}
impl TimeTracker {
pub fn new() -> TimeTracker {
let curr_time = precise_time_ns() / 1000000u64;
let mut tt = TimeTracker {
last_time: curr_time,
now_time: curr_time,
next_fps_time: curr_t... | pub last_time: u64,
pub now_time: u64, | random_line_split |
blind_sqli_time_delay.py | '''
blind_sqli_time_delay.py
Copyright 2008 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af 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 version 2 of the License.
w3af is distributed in... | '''
# First save the original wait time
_original_wait_time = self._sendMutant( freq, analyze=False ).getWaitTime()
# Create the mutants
parameter_to_test = [ parameter, ]
statement_list = self._get_statements()
sql_commands_only = [ i.sql_command for i i... | random_line_split | |
blind_sqli_time_delay.py | '''
blind_sqli_time_delay.py
Copyright 2008 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af 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 version 2 of the License.
w3af is distributed in... | ( self ):
'''
@return: A list of statements that are going to be used to test for
blind SQL injections. The statements are objects.
'''
res = []
# MSSQL
res.append( statement("1;waitfor delay '0:0:"+str(self._wait_time)+"'--", dbms.MSSQL) )
res.ap... | _get_statements | identifier_name |
blind_sqli_time_delay.py | '''
blind_sqli_time_delay.py
Copyright 2008 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af 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 version 2 of the License.
w3af is distributed in... |
return None
def _get_statements( self ):
'''
@return: A list of statements that are going to be used to test for
blind SQL injections. The statements are objects.
'''
res = []
# MSSQL
res.append( statement("1;waitfor del... | _original_wait_time = self._sendMutant( freq, analyze=False ).getWaitTime()
response = self._sendMutant( mutant, analyze=False )
# Compare times (once again)
if response.getWaitTime() > (_original_wait_time + self._wait_time-2):
... | conditional_block |
blind_sqli_time_delay.py | '''
blind_sqli_time_delay.py
Copyright 2008 Andres Riancho
This file is part of w3af, w3af.sourceforge.net .
w3af 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 version 2 of the License.
w3af is distributed in... | def __init__(self, sql_command, dbms):
self.sql_command = sql_command
self.dbms = dbms | identifier_body | |
sha256.js | OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY O... |
function sha256_Sigma1(x) {
return (rotateRight(6, x) ^ rotateRight(11, x) ^ rotateRight(25, x));
}
function sha256_sigma0(x) {
return (rotateRight(7, x) ^ rotateRight(18, x) ^ (x >>> 3));
}
function sha256_sigma1(x) {
return (rotateRight(17, x) ^ rotateRight(19, x) ^ (x >>> 10));
}
function sha256_expand(W, j) {
... | {
return (rotateRight(2, x) ^ rotateRight(13, x) ^ rotateRight(22, x));
} | identifier_body |
sha256.js | OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY O... |
/* Compute the current intermediate hash value */
ihash[0] += a;
ihash[1] += b;
ihash[2] += c;
ihash[3] += d;
ihash[4] += e;
ihash[5] += f;
ihash[6] += g;
ihash[7] += h;
}
/* Read the next chunk of data and update the SHA256 computation */
function sha256_update(data, inputLen) {
var i, index, curpos = 0;
... | {
T1 = h + sha256_Sigma1(e) + choice(e, f, g) + K256[j];
if(j < 16) T1 += W[j];
else T1 += sha256_expand(W, j);
T2 = sha256_Sigma0(a) + majority(a, b, c);
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
} | conditional_block |
sha256.js | * 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* ======================================================================
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS '... | * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. | random_line_split | |
sha256.js | xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc... | sha256_digest | identifier_name | |
urls.py | '''
Copyright 2015
This file is part of Orbach.
Orbach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Orbach is distributed in the hope t... | router.register(r'galleries', views.GalleryViewSet)
router.register(r'image_files', views.ImageFileViewSet)
router.register(r'users', views.UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
] | router = DefaultRouter() | random_line_split |
json_error_response.py | #!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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
Unle... | class JsonErrorResponse(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Swagger model
:param dict swaggerTypes: The key is attribute name and the value is attribute type.
... | random_line_split | |
json_error_response.py | #!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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
Unle... |
return '<{name} {props}>'.format(name=__name__, props=' '.join(properties))
| properties.append('{prop}={val!r}'.format(prop=p, val=self.__dict__[p])) | conditional_block |
json_error_response.py | #!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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
Unle... | self.message = None # str
def __repr__(self):
properties = []
for p in self.__dict__:
if p != 'swaggerTypes' and p != 'attributeMap':
properties.append('{prop}={val!r}'.format(prop=p, val=self.__dict__[p]))
return '<{name} {props}>'.format(nam... | """
Swagger model
:param dict swaggerTypes: The key is attribute name and the value is attribute type.
:param dict attributeMap: The key is attribute name and the value is json key in definition.
"""
self.swagger_types = {
'status': 'str',
'message': 'str... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.