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
mod.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 ...
//! There is built-in support for a RNG associated with each thread stored //! in thread-local storage. This RNG can be accessed via `thread_rng`, or //! used implicitly via `random`. This RNG is normally randomly seeded //! from an operating-system source of randomness, e.g. `/dev/urandom` on //! Unix systems, and wil...
//! # Thread-local RNG //!
random_line_split
views.py
from django.views.generic import TemplateView from regions.views import RegionMixin from pages.models import Page, slugify from .models import Link class
(RegionMixin, TemplateView): template_name = 'links/links_for_page.html' def get_context_data(self, *args, **kwargs): context = super(LinksForPageView, self) .get_context_data(*args, **kwargs) page = Page.objects.get( slug=slugify(self.kwargs.get('slug')), region=self.ge...
LinksForPageView
identifier_name
views.py
from django.views.generic import TemplateView from regions.views import RegionMixin from pages.models import Page, slugify from .models import Link class LinksForPageView(RegionMixin, TemplateView): template_name = 'links/links_for_page.html' def get_context_data(self, *args, **kwargs): context = s...
return context
random_line_split
views.py
from django.views.generic import TemplateView from regions.views import RegionMixin from pages.models import Page, slugify from .models import Link class LinksForPageView(RegionMixin, TemplateView): template_name = 'links/links_for_page.html' def get_context_data(self, *args, **kwargs):
class OrphanedPagesView(RegionMixin, TemplateView): template_name = 'links/orphaned_pages.html' def get_context_data(self, *args, **kwargs): context = super(OrphanedPagesView, self) .get_context_data(*args, **kwargs) return context
context = super(LinksForPageView, self) .get_context_data(*args, **kwargs) page = Page.objects.get( slug=slugify(self.kwargs.get('slug')), region=self.get_region() ) context['page'] = page context['links_to_page'] = page.links_to_here.all() context['links_...
identifier_body
utils.py
#!/bin/python # gofed-ng - Golang system # Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at y...
(service_path): basename = os.path.basename(service_path) return basename[:-len('.py')] if __name__ == "__main__": sys.exit(1)
service_path2service_name
identifier_name
utils.py
#!/bin/python # gofed-ng - Golang system # Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com # # This program is free software; you can redistribute it and/or
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # alon...
# modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version.
random_line_split
utils.py
#!/bin/python # gofed-ng - Golang system # Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at y...
sys.exit(1)
conditional_block
utils.py
#!/bin/python # gofed-ng - Golang system # Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at y...
if __name__ == "__main__": sys.exit(1)
basename = os.path.basename(service_path) return basename[:-len('.py')]
identifier_body
monitor-list.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { MonitorApiService } from '../../services/monitor-api/monitor-api.service'; import { Monitor } from '../../models/monitor'; @Component({ selector: 'app-monitor-list', templateUrl: './monitor-list.component.html', styleUrls: ['./monitor-list.comp...
} private shouldDisplayDeleteMonitorAlertText(): boolean { return this.shouldShowDeleteMonitorAlert === true && this.deleteMonitorAlertText !== null && this.deleteMonitorAlertText !== undefined && this.deleteMonitorAlertText.length > 0; } }
{ this.monitorApiService .deleteMonitor(monitor._id) .subscribe(data => { console.log('deleted'); this.shouldShowDeleteMonitorAlert = true; this.didDeleteMonitorFail = false; this.deleteMonitorAlertText = 'Monitor deleted successfully.'; this.load...
conditional_block
monitor-list.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { MonitorApiService } from '../../services/monitor-api/monitor-api.service'; import { Monitor } from '../../models/monitor'; @Component({ selector: 'app-monitor-list', templateUrl: './monitor-list.component.html', styleUrls: ['./monitor-list.comp...
implements OnInit { private isLoading: boolean; private didLoadingFail: boolean; private responseStatusCode: any; private monitors: Monitor[]; private didDeleteMonitorFail: boolean; private shouldShowDeleteMonitorAlert: boolean; private deleteMonitorAlertText: string; constructor(private monitorApiS...
MonitorListComponent
identifier_name
monitor-list.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { MonitorApiService } from '../../services/monitor-api/monitor-api.service'; import { Monitor } from '../../models/monitor'; @Component({ selector: 'app-monitor-list', templateUrl: './monitor-list.component.html', styleUrls: ['./monitor-list.comp...
this.monitorApiService .getMonitors() .subscribe(data => { this.finishLoading(data); }, err => { this.onLoadError(err); }); } private finishLoading(data) { this.isLoading = false; this.didLoadingFail = false; this.monitors = data; } private onLoadError(e...
random_line_split
monitor-list.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { MonitorApiService } from '../../services/monitor-api/monitor-api.service'; import { Monitor } from '../../models/monitor'; @Component({ selector: 'app-monitor-list', templateUrl: './monitor-list.component.html', styleUrls: ['./monitor-list.comp...
ngOnInit() { this.loadMonitors(); } private loadMonitors() { this.isLoading = true; this.monitorApiService .getMonitors() .subscribe(data => { this.finishLoading(data); }, err => { this.onLoadError(err); }); } private finishLoading(data) { this.isLo...
{ }
identifier_body
DirectoryWatcher.js
module('lively.ide.DirectoryWatcher').requires('lively.Network').toRun(function() { // depends on the DirectoryWatcherServer Object.extend(lively.ide.DirectoryWatcher, { watchServerURL: new URL(Config.nodeJSURL+'/DirectoryWatchServer/'), dirs: {}, reset: function() { // lively.ide.DirectoryWatch...
} }); }) // end of module
{ // convert date string into a date object if (!statObj) statObj = {}; statObj.isDirectory = !!(statObj.mode & 0x4000); ['atime', 'mtime', 'ctime'].forEach(function(field) { if (statObj[field]) statObj[field] = new Date(statObj[field]); }); return statObj...
identifier_body
DirectoryWatcher.js
module('lively.ide.DirectoryWatcher').requires('lively.Network').toRun(function() { // depends on the DirectoryWatcherServer Object.extend(lively.ide.DirectoryWatcher, { watchServerURL: new URL(Config.nodeJSURL+'/DirectoryWatchServer/'), dirs: {}, reset: function() { // lively.ide.DirectoryWatch...
watchState.updateInProgress = true; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- if (!watchState.files) { // first time called this.getFiles(dir, function(err, result) { if (err) show("dir watch error: %s", err); result.files && Proper...
{ return; }
conditional_block
DirectoryWatcher.js
module('lively.ide.DirectoryWatcher').requires('lively.Network').toRun(function() { // depends on the DirectoryWatcherServer Object.extend(lively.ide.DirectoryWatcher, { watchServerURL: new URL(Config.nodeJSURL+'/DirectoryWatchServer/'), dirs: {}, reset: function() { // lively.ide.DirectoryWatch...
getChanges: function(dir, since, startWatchTime, thenDo) { this.request(this.watchServerURL.withFilename('changes').withQuery({ startWatchTime: startWatchTime, since: since, dir: dir}), thenDo); }, withFilesOfDir: function(dir, doFunc) { // Retrieves efficiently the files of dir...
getFiles: function(dir, thenDo) { this.request(this.watchServerURL.withFilename('files').withQuery({dir: dir}), thenDo); },
random_line_split
DirectoryWatcher.js
module('lively.ide.DirectoryWatcher').requires('lively.Network').toRun(function() { // depends on the DirectoryWatcherServer Object.extend(lively.ide.DirectoryWatcher, { watchServerURL: new URL(Config.nodeJSURL+'/DirectoryWatchServer/'), dirs: {}, reset: function() { // lively.ide.DirectoryWatch...
(statObj) { // convert date string into a date object if (!statObj) statObj = {}; statObj.isDirectory = !!(statObj.mode & 0x4000); ['atime', 'mtime', 'ctime'].forEach(function(field) { if (statObj[field]) statObj[field] = new Date(statObj[field]); }); retu...
extend
identifier_name
Twitter.js
// core
import Loading from '../../components/loading/Loading'; // styles var style = require('./_index.scss'); // data var Timeline = require('react-twitter-widgets').Timeline; var Twitter = React.createClass({ getInitialState: function(){ return { isLoading: true } }, componentWillMount: function(){ ...
import React from 'react'; import PropTypes from 'react'; // components
random_line_split
Twitter.js
// core import React from 'react'; import PropTypes from 'react'; // components import Loading from '../../components/loading/Loading'; // styles var style = require('./_index.scss'); // data var Timeline = require('react-twitter-widgets').Timeline; var Twitter = React.createClass({ getInitialState: function()...
} }); export default Twitter;
{ return ( <div className='twitter-container'> <Timeline className='twitter-component' dataSource={{ sourceType: 'widget', widgetId: '844245316706566144' }} /> </div> ) }
conditional_block
app.module.ts
/** * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
{ }
AppModule
identifier_name
app.module.ts
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WA...
/** * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License");
random_line_split
app.module.ts
/** * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
@NgModule({ declarations: [ AppComponent, MainComponent, MapComponent, TermsComponent, RuleInputComponent, FileSizePipe, ], imports: [ BrowserModule, BrowserAnimationsModule, CodemirrorModule, RouterModule.forRoot(routes), MatInputModule, MatSidenavModule, M...
{ enableProdMode(); }
conditional_block
metrics.js
/* Copyright 2010-2011 Vodafone Group Services GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
id: 100, name: "Millimeters", instructions: "This test displays a box with <code>width</code> set to <code>3cm</code>. <br><br>Please measure the width with the ruler.", expectedResult: "Is the width of the box exactly 3&nbsp;cm? (1&nbsp;cm = 0.3937&nbsp;in)", test: function(){ dohx.showInfo('<...
{
random_line_split
web_driver_extension_spec.js
import { afterEach, AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit, } from 'changular2/test_lib'; import { StringMap, ListWrapper } from 'changular2/src/facade/collection'; import { isPresent, StringWrapper } from 'changular2/src/facade/lang'; import { PromiseWrap...
return new Injector([ ListWrapper.map(ids, (id) => bind(id).toValue(new MockExtension(id)) ), bind(Options.CAPABILITIES).toValue(caps), WebDriverExtension.bindTo(ids) ]).asyncGet(WebDriverExtension); } describe('WebDriverExtension.bindTo', () => { it('should bind the extension that m...
random_line_split
web_driver_extension_spec.js
import { afterEach, AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit, } from 'changular2/test_lib'; import { StringMap, ListWrapper } from 'changular2/src/facade/collection'; import { isPresent, StringWrapper } from 'changular2/src/facade/lang'; import { PromiseWrap...
() { function createExtension(ids, caps) { return new Injector([ ListWrapper.map(ids, (id) => bind(id).toValue(new MockExtension(id)) ), bind(Options.CAPABILITIES).toValue(caps), WebDriverExtension.bindTo(ids) ]).asyncGet(WebDriverExtension); } describe('WebDriverExtension.bindTo', () =...
main
identifier_name
web_driver_extension_spec.js
import { afterEach, AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it, xit, } from 'changular2/test_lib'; import { StringMap, ListWrapper } from 'changular2/src/facade/collection'; import { isPresent, StringWrapper } from 'changular2/src/facade/lang'; import { PromiseWrap...
}
{ return StringWrapper.equals(capabilities['browser'], this.id); }
identifier_body
const-vecs-and-slices.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 ...
}
random_line_split
const-vecs-and-slices.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 ...
() { println!("{:?}", x[1]); println!("{:?}", y[1]); assert_eq!(x[1], 2); assert_eq!(x[3], 4); assert_eq!(x[3], y[3]); }
main
identifier_name
const-vecs-and-slices.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 ...
{ println!("{:?}", x[1]); println!("{:?}", y[1]); assert_eq!(x[1], 2); assert_eq!(x[3], 4); assert_eq!(x[3], y[3]); }
identifier_body
stage0-clone-contravariant-lifetime.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 ...
{ }
identifier_body
stage0-clone-contravariant-lifetime.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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // A zero-depend...
random_line_split
stage0-clone-contravariant-lifetime.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 ...
<'a>; impl <'a> ::std::clone::Clone for ContravariantLifetime<'a> { #[inline] fn clone(&self) -> ContravariantLifetime<'a> { match *self { ContravariantLifetime => ContravariantLifetime, } } } fn main() { }
ContravariantLifetime
identifier_name
photo.js
}), initialize: function() { this.enableMood = +constants.get('conf.enablemood'); if ( !this.enableMood ) this.subviews = $.omit( this.subviews, 'mood' ); DefaultView.prototype.initialize.apply( this ); }, render: function() { DefaultView.prototype.render.apply( this ); this.$initial = thi...
this.uploader.init(); if ( $.ie ) { this.$uploader.hide(); this.$uploader.appendTo( this.$uploaderParent ); } return this; }, showInitialState: function() { this.$main.hide(); this.$initial.show(); $.ie && ($.ieVersion < 10) && this.ieUploadButtonFix( true ); this.inputbox && this...
this.uploader.onUploaded = $.bind( this.onPhotoUploaded, this );
random_line_split
migrations.rs
use failure::format_err; use log::info; use rusqlite::{Connection, Transaction}; use crate::db::migrations_code; use crate::errors::*; const CREATE_VERSIONS: &str = r#" create table __version ( current_version integer primary key ) "#; pub trait Migration { fn run(&self, tx: &Transaction) -> Result<()>; } struc...
} else { tx.execute( "UPDATE __version set current_version = ?1", &[&next_version], ) } .map_err(|e| format_err!("Error updating version: {}", e))?; tx.commit()?; next_version += 1; } Ok(()) } #[cfg(test)] mod te...
tx.execute("INSERT INTO __version VALUES (?1)", &[&next_version])
random_line_split
migrations.rs
use failure::format_err; use log::info; use rusqlite::{Connection, Transaction}; use crate::db::migrations_code; use crate::errors::*; const CREATE_VERSIONS: &str = r#" create table __version ( current_version integer primary key ) "#; pub trait Migration { fn run(&self, tx: &Transaction) -> Result<()>; } struc...
() { let temp_dir = TempDir::new("users.rs").unwrap(); let db_file = temp_dir.path().join("db.sqlite3"); let mut conn = Connection::open(&db_file).expect("create temp database"); migrate(&mut conn).unwrap(); assert_eq!( Some((all_migrations().len() as i32) - 1), ...
test_migration_versions
identifier_name
migrations.rs
use failure::format_err; use log::info; use rusqlite::{Connection, Transaction}; use crate::db::migrations_code; use crate::errors::*; const CREATE_VERSIONS: &str = r#" create table __version ( current_version integer primary key ) "#; pub trait Migration { fn run(&self, tx: &Transaction) -> Result<()>; } struc...
} }
{ panic!("Failed: expected second migration to be a noop: {}", e); }
conditional_block
migrations.rs
use failure::format_err; use log::info; use rusqlite::{Connection, Transaction}; use crate::db::migrations_code; use crate::errors::*; const CREATE_VERSIONS: &str = r#" create table __version ( current_version integer primary key ) "#; pub trait Migration { fn run(&self, tx: &Transaction) -> Result<()>; } struc...
}
{ let temp_dir = TempDir::new("users.rs").unwrap(); let db_file = temp_dir.path().join("db.sqlite3"); let mut conn = Connection::open(&db_file).expect("create temp database"); // migration #1 migrate(&mut conn).unwrap(); // migration #2 if let Err(e) = migrate(&...
identifier_body
test_openstack.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
from collections import namedtuple from unittest.mock import Mock, call, patch from instance import openstack from instance.tests.base import TestCase # Tests ####################################################################### class OpenStackTestCase(TestCase): """ Test cases for OpenStack helper funct...
import requests
random_line_split
test_openstack.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
(TestCase): """ Test cases for OpenStack helper functions """ def setUp(self): super().setUp() self.nova = Mock() def test_create_server(self): """ Create a VM via nova """ self.nova.flavors.find.return_value = 'test-flavor' self.nova.images....
OpenStackTestCase
identifier_name
test_openstack.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
def test_delete_servers_by_name(self): """ Delete all servers with a given name """ server_class = namedtuple('server_class', 'name pk') self.nova.servers.list.return_value = [ server_class(name='server-a', pk=1), server_class(name='server-a', pk=2),...
""" Create a VM via nova """ self.nova.flavors.find.return_value = 'test-flavor' self.nova.images.find.return_value = 'test-image' openstack.create_server(self.nova, 'test-vm', {"ram": 4096, "disk": 40}, {"name": "Ubuntu 12.04"}) self.assertEqual(self.nova.mock_calls, [ ...
identifier_body
Sphere.d.ts
import { Vector3 } from './Vector3'; import { Box3 } from './Box3'; import { Plane } from './Plane'; import { Matrix4 } from './Matrix4'; export class
{ constructor(center?: Vector3, radius?: number); center: Vector3; radius: number; set(center: Vector3, radius: number): Sphere; setFromPoints(points: Vector3[], optionalCenter?: Vector3): Sphere; clone(): this; copy(sphere: Sphere): this; empty(): boolean; containsPoint(point: Vector3): boolean; ...
Sphere
identifier_name
Sphere.d.ts
import { Vector3 } from './Vector3'; import { Box3 } from './Box3'; import { Plane } from './Plane'; import { Matrix4 } from './Matrix4'; export class Sphere {
constructor(center?: Vector3, radius?: number); center: Vector3; radius: number; set(center: Vector3, radius: number): Sphere; setFromPoints(points: Vector3[], optionalCenter?: Vector3): Sphere; clone(): this; copy(sphere: Sphere): this; empty(): boolean; containsPoint(point: Vector3): boolean; di...
random_line_split
skl.component.ts
import {Component, OnInit} from '@angular/core'; import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgStyle} from '@angular/common'; import {AlertComponent, PROGRESSBAR_DIRECTIVES} from 'ng2-bootstrap'; import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload'; import {MahasiswaService} from '../service'; im...
getDataMahasiswa(){ this.authHttp.get('http://simak.apps.cs.ipb.ac.id:2016/ta/') .map(res => res.json()) .subscribe(data => { this.topik = data[0]['topik']; this.lab = data[0]['lab']; this.dosen_1 = data[0]['dosen1']; this.dosen_2 = data[0]['dosen2']; }) } ...
{ this.toastr.warning("No Internet Connection", 'Error'); }
identifier_body
skl.component.ts
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgStyle} from '@angular/common'; import {AlertComponent, PROGRESSBAR_DIRECTIVES} from 'ng2-bootstrap'; import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload'; import {MahasiswaService} from '../service'; import {AuthHttp, JwtHelper, tokenNotExpired} from ...
import {Component, OnInit} from '@angular/core';
random_line_split
skl.component.ts
import {Component, OnInit} from '@angular/core'; import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgStyle} from '@angular/common'; import {AlertComponent, PROGRESSBAR_DIRECTIVES} from 'ng2-bootstrap'; import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload'; import {MahasiswaService} from '../service'; im...
() { this.getConnection(); this.getStatus(); } // DASHBOARD SERVICE getStatus() { this.authHttp.get(this.service.urlStatus) .map(res => res.json()) .subscribe( data => { this.statusProfile = data[0]['statusProfile']; this.statusSidang = data[0]['statusSidang']; i...
refresh
identifier_name
skl.component.ts
import {Component, OnInit} from '@angular/core'; import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgStyle} from '@angular/common'; import {AlertComponent, PROGRESSBAR_DIRECTIVES} from 'ng2-bootstrap'; import {FILE_UPLOAD_DIRECTIVES, FileUploader} from 'ng2-file-upload'; import {MahasiswaService} from '../service'; im...
// console.log(this.statusProfile); }) } showNoConn() { this.toastr.warning("No Internet Connection", 'Error'); } getDataMahasiswa(){ this.authHttp.get('http://simak.apps.cs.ipb.ac.id:2016/ta/') .map(res => res.json()) .subscribe(data => { this.topik = data[0]['topik...
{ this.getDataMahasiswa(); }
conditional_block
settings.py
""" Django settings for CatyHIS project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
# Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'FormGen', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionM...
random_line_split
role.rs
use super::ArgumentConvert; use crate::{model::prelude::*, prelude::*}; /// Error that can be returned from [`Role::convert`]. #[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum RoleParseError { /// When the operation was invoked outside a guild. NotInGuild, /// When the guild's ...
}
{ let roles = ctx .cache .guild_roles(guild_id.ok_or(RoleParseError::NotInGuild)?) .await .ok_or(RoleParseError::NotInCache)?; if let Some(role_id) = s.parse::<u64>().ok().or_else(|| crate::utils::parse_role(s)) { if let Some(role) = roles.get...
identifier_body
role.rs
use super::ArgumentConvert; use crate::{model::prelude::*, prelude::*}; /// Error that can be returned from [`Role::convert`]. #[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum RoleParseError { /// When the operation was invoked outside a guild. NotInGuild, /// When the guild's ...
Err(RoleParseError::NotFoundOrMalformed) } }
{ return Ok(role.clone()); }
conditional_block
role.rs
use super::ArgumentConvert; use crate::{model::prelude::*, prelude::*}; /// Error that can be returned from [`Role::convert`]. #[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum RoleParseError { /// When the operation was invoked outside a guild. NotInGuild, /// When the guild's ...
( ctx: &Context, guild_id: Option<GuildId>, _channel_id: Option<ChannelId>, s: &str, ) -> Result<Self, Self::Err> { let roles = ctx .cache .guild_roles(guild_id.ok_or(RoleParseError::NotInGuild)?) .await .ok_or(RoleParseError::N...
convert
identifier_name
role.rs
use super::ArgumentConvert; use crate::{model::prelude::*, prelude::*}; /// Error that can be returned from [`Role::convert`]. #[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum RoleParseError { /// When the operation was invoked outside a guild. NotInGuild, /// When the guild's ...
type Err = RoleParseError; async fn convert( ctx: &Context, guild_id: Option<GuildId>, _channel_id: Option<ChannelId>, s: &str, ) -> Result<Self, Self::Err> { let roles = ctx .cache .guild_roles(guild_id.ok_or(RoleParseError::NotInGuild)?) ...
random_line_split
historicalBar.ts
nv.addGraph({ generate: function() { var chart = nv.models.historicalBar(); d3.select("#test1") .datum(sinData()) .datum(sinData()) .transition() .call(chart); return chart; }, callback: function(graph) { graph.dispatch.on('el...
{ var sin = []; for (var i = 0; i < 100; i++) { sin.push({x: i, y: Math.sin(i/10)}); } return [{ values: sin, key: "Sine Wave", color: "#ff7f0e" }]; }
identifier_body
historicalBar.ts
nv.addGraph({ generate: function() { var chart = nv.models.historicalBar(); d3.select("#test1") .datum(sinData()) .datum(sinData()) .transition() .call(chart); return chart; }, callback: function(graph) { graph.dispatch.on('el...
() { var sin = []; for (var i = 0; i < 100; i++) { sin.push({x: i, y: Math.sin(i/10)}); } return [{ values: sin, key: "Sine Wave", color: "#ff7f0e" }]; }
sinData
identifier_name
historicalBar.ts
nv.addGraph({
d3.select("#test1") .datum(sinData()) .datum(sinData()) .transition() .call(chart); return chart; }, callback: function(graph) { graph.dispatch.on('elementMouseover', function(e) { var offsetElement = document.getElementById("c...
generate: function() { var chart = nv.models.historicalBar();
random_line_split
historicalBar.ts
nv.addGraph({ generate: function() { var chart = nv.models.historicalBar(); d3.select("#test1") .datum(sinData()) .datum(sinData()) .transition() .call(chart); return chart; }, callback: function(graph) { graph.dispatch.on('el...
return [{ values: sin, key: "Sine Wave", color: "#ff7f0e" }]; }
{ sin.push({x: i, y: Math.sin(i/10)}); }
conditional_block
small map.ts
/// <reference path="../../Phaser/gameobjects/Tilemap.ts" /> /// <reference path="../../Phaser/Game.ts" /> (function () { var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update); function init() {
myGame.loader.addImageFile('jsontiles', 'assets/tiles/platformer_tiles.png'); myGame.loader.addImageFile('overlay', 'assets/pics/scrollframe.png'); myGame.loader.addImageFile('car', 'assets/sprites/car90.png'); myGame.loader.load(); } var car: Phaser.Sprite; var map: Phase...
myGame.loader.addTextFile('jsontest', 'assets/maps/multi-layer-test.json');
random_line_split
small map.ts
/// <reference path="../../Phaser/gameobjects/Tilemap.ts" /> /// <reference path="../../Phaser/Game.ts" /> (function () { var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update); function
() { myGame.loader.addTextFile('jsontest', 'assets/maps/multi-layer-test.json'); myGame.loader.addImageFile('jsontiles', 'assets/tiles/platformer_tiles.png'); myGame.loader.addImageFile('overlay', 'assets/pics/scrollframe.png'); myGame.loader.addImageFile('car', 'assets/sprites/car90.pn...
init
identifier_name
small map.ts
/// <reference path="../../Phaser/gameobjects/Tilemap.ts" /> /// <reference path="../../Phaser/Game.ts" /> (function () { var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update); function init()
var car: Phaser.Sprite; var map: Phaser.Tilemap; var overlay: Phaser.Sprite; var smallCam: Phaser.Camera; function create() { map = myGame.add.tilemap('jsontiles', 'jsontest', Phaser.Tilemap.FORMAT_TILED_JSON); car = myGame.add.sprite(300, 100, 'car'); car.setBounds(0, 0...
{ myGame.loader.addTextFile('jsontest', 'assets/maps/multi-layer-test.json'); myGame.loader.addImageFile('jsontiles', 'assets/tiles/platformer_tiles.png'); myGame.loader.addImageFile('overlay', 'assets/pics/scrollframe.png'); myGame.loader.addImageFile('car', 'assets/sprites/car90.png')...
identifier_body
production.py
# -*- coding: utf-8 -*- """ Production Configurations - Use Redis for cache """ from __future__ import absolute_import, unicode_literals from boto.s3.connection import OrdinaryCallingFormat from django.utils import six from .common import * # noqa # SECRET CONFIGURATION # ---------------------------------------...
'CLIENT_CLASS': 'django_redis.client.DefaultClient', 'IGNORE_EXCEPTIONS': True, # mimics memcache behavior. # http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior } } } # Custom Admin URL, use {% url 'admin:index' %} AD...
'OPTIONS': {
random_line_split
test_utils.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import inf import pytest import numpy as np from astropy.cosmology.utils import inf_like, vectorize_if_needed, vectorize_redshift_method from astropy.utils.exceptions import AstropyDeprecationWarning def test_vectorize_redshift_method(): ...
: @vectorize_redshift_method def method(self, z): return z c = Class() assert hasattr(c.method, "__vectorized__") assert isinstance(c.method.__vectorized__, np.vectorize) # calling with Number assert c.method(1) == 1 assert isinstance(c.method(1), int) # call...
Class
identifier_name
test_utils.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import inf import pytest import numpy as np from astropy.cosmology.utils import inf_like, vectorize_if_needed, vectorize_redshift_method from astropy.utils.exceptions import AstropyDeprecationWarning def test_vectorize_redshift_method(): ...
c = Class() assert hasattr(c.method, "__vectorized__") assert isinstance(c.method.__vectorized__, np.vectorize) # calling with Number assert c.method(1) == 1 assert isinstance(c.method(1), int) # calling with a numpy scalar assert c.method(np.float64(1)) == np.float64(1) assert ...
return z
identifier_body
test_utils.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from math import inf import pytest import numpy as np from astropy.cosmology.utils import inf_like, vectorize_if_needed, vectorize_redshift_method from astropy.utils.exceptions import AstropyDeprecationWarning
@vectorize_redshift_method def method(self, z): return z c = Class() assert hasattr(c.method, "__vectorized__") assert isinstance(c.method.__vectorized__, np.vectorize) # calling with Number assert c.method(1) == 1 assert isinstance(c.method(1), int) # callin...
def test_vectorize_redshift_method(): """Test :func:`astropy.cosmology.utils.vectorize_redshift_method`.""" class Class:
random_line_split
BookmarkCollection.ts
import {IPosition} from "../Interfaces/IPosition"; import {BookmarkBindType, BookmarkId, BookmarkType, IBookmark} from "../Interfaces/IBookmark"; import {generateGUID} from "../GUID"; import {Bookmark} from "./Bookmark"; import {IBookmarkCollection} from "../Interfaces/IBookmarkCollection"; class UserBookmark extends ...
remove(id: BookmarkId): IBookmark | null { let bookmark = this.bookmarks.get(id); if (bookmark) { this.bookmarks.delete(id); } return bookmark || null; } }
{ return this.bookmarks.get(id) || null; }
identifier_body
BookmarkCollection.ts
import {IPosition} from "../Interfaces/IPosition"; import {BookmarkBindType, BookmarkId, BookmarkType, IBookmark} from "../Interfaces/IBookmark"; import {generateGUID} from "../GUID"; import {Bookmark} from "./Bookmark"; import {IBookmarkCollection} from "../Interfaces/IBookmarkCollection"; class UserBookmark extends ...
implements IBookmarkCollection { private bookmarks: Map<BookmarkId, IBookmark> = new Map(); add(position: IPosition, bindType: BookmarkBindType, id?: BookmarkId): IBookmark { if (!id) { id = generateGUID(); } let bookmark = new UserBookmark(position, bindType, id); ...
BookmarkCollection
identifier_name
BookmarkCollection.ts
import {IPosition} from "../Interfaces/IPosition"; import {BookmarkBindType, BookmarkId, BookmarkType, IBookmark} from "../Interfaces/IBookmark"; import {generateGUID} from "../GUID"; import {Bookmark} from "./Bookmark"; import {IBookmarkCollection} from "../Interfaces/IBookmarkCollection"; class UserBookmark extends ...
return bookmark || null; } }
{ this.bookmarks.delete(id); }
conditional_block
BookmarkCollection.ts
import {IPosition} from "../Interfaces/IPosition"; import {BookmarkBindType, BookmarkId, BookmarkType, IBookmark} from "../Interfaces/IBookmark";
constructor(position: IPosition, bindType: BookmarkBindType, id: BookmarkId) { super(position, bindType, id); } get type(): BookmarkType { return BookmarkType.User; } } export class BookmarkCollection implements IBookmarkCollection { private bookmarks: Map<BookmarkId, IBookmark> = ...
import {generateGUID} from "../GUID"; import {Bookmark} from "./Bookmark"; import {IBookmarkCollection} from "../Interfaces/IBookmarkCollection"; class UserBookmark extends Bookmark {
random_line_split
private.rs
// This file was borrowed from https://github.com/nikomatsakis/rayon/blob/master/src/private.rs // and is subject to the license and copyright from that project. //! The public parts of this private module are used to create traits //! that cannot be implemented outside of our own crate. This way we //! can feel free...
; macro_rules! private_decl { () => { /// This trait is private; this method exists to make it /// impossible to implement outside the crate. #[doc(hidden)] fn __rayon_private__(&self) -> ::private::PrivateMarker; } } macro_rules! private_impl { () => { fn __rayon_p...
PrivateMarker
identifier_name
private.rs
// This file was borrowed from https://github.com/nikomatsakis/rayon/blob/master/src/private.rs // and is subject to the license and copyright from that project. //! The public parts of this private module are used to create traits //! that cannot be implemented outside of our own crate. This way we //! can feel free...
} } macro_rules! private_impl { () => { fn __rayon_private__(&self) -> ::private::PrivateMarker { ::private::PrivateMarker } } }
/// impossible to implement outside the crate. #[doc(hidden)] fn __rayon_private__(&self) -> ::private::PrivateMarker;
random_line_split
macros.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 ...
match $e { Ok(e) => e, Err(e) => return Err(e), } }) } /// Use the `format!` syntax to write data into a buffer of type `&mut Write`. /// See `std::fmt` for more information. /// /// # Examples /// /// ``` /// # #![allow(unused_must_use)] /// use std::io::Write; /// /// let ...
($e:expr) => ({ use $crate::result::Result::{Ok, Err};
random_line_split
AVSwitch.py
os import path as os_path class AVSwitch: def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def
(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAspectRatio(value) def setSystem(self, value): eAVSwitch.getInstance().setVideomode(value) def getOutputAspect(self): valstr = config.av.aspectratio.value if valstr in ("4_3_letterbox...
setColorFormat
identifier_name
AVSwitch.py
os import path as os_path class AVSwitch: def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAsp...
config.av.downmix_aac = ConfigYesNo(default = True) config.av.downmix_aac.addNotifier(setAACDownmix) try: can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False except: can_osd_alpha = False SystemInfo["CanChangeOsdAlpha"] = can_osd_alpha def setAlpha(config): open("/proc/stb/video/alpha...
open("/proc/stb/audio/aac", "w").write(configElement.value and "downmix" or "passthrough")
identifier_body
AVSwitch.py
os import path as os_path class AVSwitch: def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAsp...
elif valstr in ("16_9_always", "16_9_letterbox"): # 16:9 pass elif valstr in ("16_10_letterbox", "16_10_panscan"): # 16:10 return (16,10) return (16,9) def getFramebufferScale(self): aspect = self.getOutputAspect() fb_size = getDesktop(0).size() return (aspect[0] * fb_size.height(), aspect[1] * fb_...
try: aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read() if aspect_str == "1": # 4:3 return (4,3) except IOError: pass
conditional_block
AVSwitch.py
os import path as os_path class AVSwitch: def setInput(self, input): INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 } eAVSwitch.getInstance().setInput(INPUT[input]) def setColorFormat(self, value): eAVSwitch.getInstance().setColorFormat(value) def setAspectRatio(self, value): eAVSwitch.getInstance().setAsp...
if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"): def setScaler_sharpness(config): myval = int(config.value) try: print "--> setting scaler_sharpness to: %0.8
if can_osd_alpha: config.av.osd_alpha = ConfigSlider(default=255, limits=(0,255)) config.av.osd_alpha.addNotifier(setAlpha)
random_line_split
main.rs
extern crate dotenv; extern crate ctrlc; extern crate chrono; extern crate chrono_tz; extern crate url; extern crate linkify; #[macro_use] extern crate html5ever; extern crate reqwest; #[macro_use] extern crate slog; extern crate slog_async; extern crate slog_envlogger; extern crate slog_scope; extern crate slog_s...
_ => error!(root_logger, "Problem with starting the client."; "error" => e.to_string()), } } }); }
{ info!(root_logger, "Shutting down.") }
conditional_block
main.rs
extern crate dotenv; extern crate ctrlc; extern crate chrono; extern crate chrono_tz; extern crate url; extern crate linkify; #[macro_use] extern crate html5ever; extern crate reqwest; #[macro_use] extern crate slog; extern crate slog_async; extern crate slog_envlogger; extern crate slog_scope; extern crate slog_s...
() { dotenv::dotenv().ok(); let decorator = slog_term::TermDecorator::new().stderr().build(); let formatter = slog_term::CompactFormat::new(decorator).build().fuse(); let logger = slog_envlogger::new(formatter); let drain = slog_async::Async::default(logger); let root_logger = slog::Logger::ro...
main
identifier_name
main.rs
extern crate dotenv; extern crate ctrlc; extern crate chrono; extern crate chrono_tz; extern crate url; extern crate linkify; #[macro_use] extern crate html5ever; extern crate reqwest; #[macro_use] extern crate slog; extern crate slog_async; extern crate slog_envlogger; extern crate slog_scope; extern crate slog_s...
serenity::Error::Client(serenity::client::ClientError::Shutdown) => { info!(root_logger, "Shutting down.") } _ => error!(root_logger, "Problem with starting the client."; "error" => e.to_string()), } } }); }
// Start client. if let Err(e) = client.start_autosharded() { match e {
random_line_split
main.rs
extern crate dotenv; extern crate ctrlc; extern crate chrono; extern crate chrono_tz; extern crate url; extern crate linkify; #[macro_use] extern crate html5ever; extern crate reqwest; #[macro_use] extern crate slog; extern crate slog_async; extern crate slog_envlogger; extern crate slog_scope; extern crate slog_s...
let _global_logger_guard = slog_stdlog::init().expect("Couldn't initialize global slog-stdlog logger."); slog_scope::scope(&root_logger, || { // Create client. let token = env::var("DISCORD_TOKEN").expect("token"); let mut bot = Bot::new(root_logger.new(o!("scope" => "Bot"))); ...
{ dotenv::dotenv().ok(); let decorator = slog_term::TermDecorator::new().stderr().build(); let formatter = slog_term::CompactFormat::new(decorator).build().fuse(); let logger = slog_envlogger::new(formatter); let drain = slog_async::Async::default(logger); let root_logger = slog::Logger::root(...
identifier_body
page-loader.ts
/** * A function that loads an explicit page of results, given an ordinal page * number. */ export interface PageRequest<T> { (page: number): Promise<T[]>; } /** * A function that loads a page of results where the pagination is determined by * an optional maximum ID. If the ID is provided, then the returned lis...
return this.getPage(page + 1).then(nextResult => { // FIXME de-duplicate results if page contents shift between calls return result.concat(nextResult); }); } }); } } class MaxIDLoader<T> implements PaginatedLoader<T> { constructor(private fetch: MaxIDRequest<T>, privat...
} else { // Fetch the next page and then concatenate
random_line_split
page-loader.ts
/** * A function that loads an explicit page of results, given an ordinal page * number. */ export interface PageRequest<T> { (page: number): Promise<T[]>; } /** * A function that loads a page of results where the pagination is determined by * an optional maximum ID. If the ID is provided, then the returned lis...
() { return this.getPage(1); } private getPage(page: number): Promise<T[]> { return this.fetch(page).then(result => { if ((this.pageLength && result.length < this.pageLength) || result.length == 0) { // End of the data if the page length is fewer than the expected // amounts...
getAll
identifier_name
page-loader.ts
/** * A function that loads an explicit page of results, given an ordinal page * number. */ export interface PageRequest<T> { (page: number): Promise<T[]>; } /** * A function that loads a page of results where the pagination is determined by * an optional maximum ID. If the ID is provided, then the returned lis...
getAll() { return this.getPage(1); } private getPage(page: number): Promise<T[]> { return this.fetch(page).then(result => { if ((this.pageLength && result.length < this.pageLength) || result.length == 0) { // End of the data if the page length is fewer than the expected ...
{ }
identifier_body
page-loader.ts
/** * A function that loads an explicit page of results, given an ordinal page * number. */ export interface PageRequest<T> { (page: number): Promise<T[]>; } /** * A function that loads a page of results where the pagination is determined by * an optional maximum ID. If the ID is provided, then the returned lis...
}); } } class MaxIDLoader<T> implements PaginatedLoader<T> { constructor(private fetch: MaxIDRequest<T>, private resolve: IDResolver<T>, private resultLength?: number) { } getAll() { return this.getPrior(undefined); } private getPrior(maxId: number | undefined) :Promise<T[]> { return t...
{ // Fetch the next page and then concatenate return this.getPage(page + 1).then(nextResult => { // FIXME de-duplicate results if page contents shift between calls return result.concat(nextResult); }); }
conditional_block
index.js
$(function() { var postsLoaded = false; $.ajax({ method: 'get', url: '/feed/', dataType: 'json', success: function(result) { for (var i = 0; i < result.posts.length; i++) { $(getPost(result.posts[i])).appendTo('.posts'); } ...
} $('body').data('last-update', result.last_update); postsLoaded = true; loadAttachments(); } }); } }; setInterval(updatePosts, 10000); });
{ $(getPost(result.posts[i])).prependTo('.posts'); }
conditional_block
index.js
$(function() { var postsLoaded = false; $.ajax({ method: 'get', url: '/feed/', dataType: 'json', success: function(result) {
$(getPost(result.posts[i])).appendTo('.posts'); } $('body').data('last-update', result.last_update); postsLoaded = true; loadAttachments(); } }); var updatePosts = function() { if (postsLoaded) { var oPosts = {}; ...
for (var i = 0; i < result.posts.length; i++) {
random_line_split
container_service_diagnostics_profile.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
(self, vm_diagnostics): super(ContainerServiceDiagnosticsProfile, self).__init__() self.vm_diagnostics = vm_diagnostics
__init__
identifier_name
container_service_diagnostics_profile.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
super(ContainerServiceDiagnosticsProfile, self).__init__() self.vm_diagnostics = vm_diagnostics
identifier_body
container_service_diagnostics_profile.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
} def __init__(self, vm_diagnostics): super(ContainerServiceDiagnosticsProfile, self).__init__() self.vm_diagnostics = vm_diagnostics
'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'},
random_line_split
ar-BH.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; fun...
plural ];
}, 'rtl',
random_line_split
ar-BH.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; fun...
export default [ 'ar-BH', [['ص', 'م'], u, u], [['ص', 'م'], u, ['صباحًا', 'مساءً']], [ ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], [ 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت' ], u, ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'] ], u, [ [...
{ if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; }
identifier_body
ar-BH.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js const u = undefined; fun...
(n: number): number { if (n === 0) return 0; if (n === 1) return 1; if (n === 2) return 2; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return 3; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return 4; return 5; } export default [ 'ar-BH', [['ص', 'م'], ...
plural
identifier_name
services.ts
import { ContainerModule} from "inversify"; import {TYPES} from "../constants"; import { DiskDbUserRepository } from "../repositories/disk-db-user-repository"; import { IUserRepository } from "../repositories/user-repository"; import {EventService} from "../services/event-service";
import { ISpectacleService } from "./../services/spectacle/spectacle-service"; import { Auth0TokenRepository } from "../repositories/auth0-token-repository"; import { Auth0Service } from "../services/auth0-service"; export default new ContainerModule(bind => { bind(EventService).toSelf().inSingletonScope(); //...
import { IHttpService, SuperAgentHttpService } from "../services/http-service"; import { GifSelectionStrategy, GifStoreSpectacleService } from "../services/spectacle/gif-store-spectacle-service"; import { GiphySpectacleService } from "../services/spectacle/giphy-spectacle-service";
random_line_split
suggestionDiagnostics.ts
/* @internal */ namespace ts { const visitedNestedConvertibleFunctions = createMap<true>(); export function computeSuggestionDiagnostics(sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): DiagnosticWithLocation[] { program.getSemanticDiagnostics(sourceFile, cancellati...
(exp: FunctionLikeDeclaration) { return `${exp.pos.toString()}:${exp.end.toString()}`; } }
getKeyFromNode
identifier_name
suggestionDiagnostics.ts
/* @internal */ namespace ts { const visitedNestedConvertibleFunctions = createMap<true>(); export function computeSuggestionDiagnostics(sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): DiagnosticWithLocation[] { program.getSemanticDiagnostics(sourceFile, cancellati...
return false; } } function getKeyFromNode(exp: FunctionLikeDeclaration) { return `${exp.pos.toString()}:${exp.end.toString()}`; } }
default:
random_line_split
suggestionDiagnostics.ts
/* @internal */ namespace ts { const visitedNestedConvertibleFunctions = createMap<true>(); export function computeSuggestionDiagnostics(sourceFile: SourceFile, program: Program, cancellationToken: CancellationToken): DiagnosticWithLocation[] { program.getSemanticDiagnostics(sourceFile, cancellati...
function propertyAccessLeftHandSide(node: Expression): Expression { return isPropertyAccessExpression(node) ? propertyAccessLeftHandSide(node.expression) : node; } function importNameForConvertToDefaultImport(node: AnyValidImportOrReExport): Identifier | undefined { switch (node.ki...
{ return sourceFile.statements.some(statement => { switch (statement.kind) { case SyntaxKind.VariableStatement: return (statement as VariableStatement).declarationList.declarations.some(decl => !!decl.initializer && isRequireCall(prope...
identifier_body
query-milestones.py
#!/usr/bin/python3 import argparse as ap import shared ACTIONS = dict() def action(key): def wrapper(function): ACTIONS[key] = function return function return wrapper def get_closed_issues(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") iss...
parser = create_parser() args = parser.parse_args() gh = shared.get_github(args) repo = shared.get_repo(gh, "OpenSCAP") milestone = shared.get_milestone(repo, args.version) ACTIONS[args.what](repo, milestone)
conditional_block
query-milestones.py
#!/usr/bin/python3 import argparse as ap import shared ACTIONS = dict() def action(key): def wrapper(function): ACTIONS[key] = function return function return wrapper def get_closed_issues(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") iss...
print(issue.title) @action("prs-merged") def print_closed_prs(repo, milestone): for pr in get_closed_prs(repo, milestone): print(pr.title) def create_parser(): parser = ap.ArgumentParser() parser.add_argument("version", type=shared.version_type) parser.add_argument("what", choices=(A...
@action("issues-closed") def print_closed_issues(repo, milestone): for issue in get_closed_issues(repo, milestone):
random_line_split
query-milestones.py
#!/usr/bin/python3 import argparse as ap import shared ACTIONS = dict() def action(key): def wrapper(function): ACTIONS[key] = function return function return wrapper def get_closed_issues(repo, milestone):
def get_closed_prs(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") prs_only = [i for i in issues_and_prs if i.pull_request is not None] return prs_only @action("issues-closed") def print_closed_issues(repo, milestone): for issue in get_closed_issues(repo, mil...
issues_and_prs = repo.get_issues(milestone=milestone, state="closed") issues_only = [i for i in issues_and_prs if i.pull_request is None] return issues_only
identifier_body
query-milestones.py
#!/usr/bin/python3 import argparse as ap import shared ACTIONS = dict() def action(key): def wrapper(function): ACTIONS[key] = function return function return wrapper def
(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") issues_only = [i for i in issues_and_prs if i.pull_request is None] return issues_only def get_closed_prs(repo, milestone): issues_and_prs = repo.get_issues(milestone=milestone, state="closed") prs_only = [i f...
get_closed_issues
identifier_name
day_4.rs
use std::iter::Peekable; use std::str::Chars; #[derive(PartialEq)] enum SymbolGroup { AlphaNumeric, WhiteSpace, Else } pub struct Lexer<'a> { iter: Peekable<Chars<'a>> } impl <'a> Lexer<'a> { pub fn new(line: &'a str) -> Lexer { Lexer { iter: line.chars().peekable() } } pub ...
(&mut self) -> Option<char> { self.iter.peek().cloned() } }
peek_next_symbol
identifier_name
day_4.rs
use std::iter::Peekable; use std::str::Chars; #[derive(PartialEq)] enum SymbolGroup { AlphaNumeric, WhiteSpace, Else } pub struct Lexer<'a> { iter: Peekable<Chars<'a>> } impl <'a> Lexer<'a> {
pub fn next_lexem(&mut self) -> Option<String> { let mut value = vec![]; let expected = self.define_symbol_group(); if expected == SymbolGroup::Else { return None; } loop { let actual = self.define_symbol_group(); let symbol = self.peek_nex...
pub fn new(line: &'a str) -> Lexer { Lexer { iter: line.chars().peekable() } }
random_line_split
day_4.rs
use std::iter::Peekable; use std::str::Chars; #[derive(PartialEq)] enum SymbolGroup { AlphaNumeric, WhiteSpace, Else } pub struct Lexer<'a> { iter: Peekable<Chars<'a>> } impl <'a> Lexer<'a> { pub fn new(line: &'a str) -> Lexer { Lexer { iter: line.chars().peekable() } } pub ...
fn peek_next_symbol(&mut self) -> Option<char> { self.iter.peek().cloned() } }
{ match self.peek_next_symbol() { Some('a' ...'z') | Some('A'...'Z') | Some('_') | Some('0'...'9') => SymbolGroup::AlphaNumeric, Some(' ') => SymbolGroup::WhiteSpace, Some(_) | None => SymbolGroup::Else, } }
identifier_body
logout.spec.js
'use strict'; var config = browser.params; var UserModel = require(config.serverConfig.root + '/server/api/user/user.model'); describe('Logout View', function() { var login = function(user) { let promise = browser.get(config.baseUrl + '/login'); require('../login/login.po').login(user); return promise; ...
.then(function() { return login(testUser); }); }); after(function() { return UserModel.removeAsync(); }) describe('with local auth', function() { it('should logout a user and redirecting to "/"', function() { var navbar = require('../../components/navbar/navbar.po'); ...
random_line_split