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
osxrelocator.py
#!/usr/bin/env python3 # cerbero - a multi-platform build system for Open Source software # Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free S...
(self, object_file, id=None): id = id or object_file.replace(self.lib_prefix, '@rpath') filename = os.path.basename(object_file) if not self._is_mach_o_file(filename): return cmd = [INT_CMD, '-id', id, object_file] shell.new_call(cmd, fail=False, logfile=self.logfile)...
change_id
identifier_name
en-ca.js
/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'image', 'en-ca', { alt: 'Alternative Text', border: 'Border', btnUpload: 'Send it to the Server', button2Img: 'Do you want to transform the selec...
validateVSpace: 'VSpace must be a whole number.' // MISSING } );
random_line_split
__init__.py
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT # OF SUBSTITUTE GOODS OR SERVI...
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
random_line_split
__init__.py
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (IN...
Presentation.__init__(self, instance_connexion, modele) if personnage and modele: self.construire(modele) def __getnewargs__(self): return (None, None) def construire(self, modele): """Construction de l'éditeur""" # nom nom = self.ajouter_choix("nom", "n", ...
connexion = None
conditional_block
__init__.py
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (IN...
entation): """Classe définissant l'éditeur de modèle de navires 'shedit'. """ nom = "shedit" def __init__(self, personnage, modele): """Constructeur de l'éditeur""" if personnage: instance_connexion = personnage.instance_connexion else: instance_connex...
edit(Pres
identifier_name
__init__.py
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (IN...
construire(self, modele): """Construction de l'éditeur""" # nom nom = self.ajouter_choix("nom", "n", Uniligne, modele, "nom") nom.parent = self nom.prompt = "Nom du navire : " nom.apercu = "{objet.nom}" nom.aide_courte = \ "Entrez le |ent|nom|ff| du n...
one, None) def
identifier_body
minecraft.js
const mat4 = require('gl-mat4') const camera = require('canvas-orbit-camera')(canvas) window.addEventListener('resize', fit(canvas), false) // configure intial camera view. camera.rotate([0.0, 0.0], [0.0, -0.4]) camera.zoom(15.0) // all the positions of a single block. var blockPosition = [ // side faces [[-0.5, ...
} // add normals. for (j = 0; j < blockNormal[i].length; j++) { var n = blockNormal[i][j] normal.push([n[0], n[1], n[2]]) } // add uvs. for (j = 0; j < blockUv[i].length; j++) { var a = blockUv[i][j] uv.push([a[0], a[1]]) } // add quad face. elements.push([...
{ if (i === 0 && y <= evalHeight(x, z + 1)) { // positive z face continue // not visible, skip } if (i === 1 && y <= evalHeight(x + 1, z)) { // positive x face continue // not visible, skip } if (i === 2 && y <= evalHeight(x, z - 1)) { // negative z face continue // not visible, sk...
conditional_block
minecraft.js
const mat4 = require('gl-mat4') const camera = require('canvas-orbit-camera')(canvas) window.addEventListener('resize', fit(canvas), false) // configure intial camera view. camera.rotate([0.0, 0.0], [0.0, -0.4]) camera.zoom(15.0) // all the positions of a single block. var blockPosition = [ // side faces [[-0.5, ...
[[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]], // top [[0.0, 0.0], [0.5, 0.0], [0.5, 0.5], [0.0, 0.5]] ] // all the normals of a single block. var blockNormal = [ // side faces [[0.0, 0.0, +1.0], [0.0, 0.0, +1.0], [0.0, 0.0, +1.0], [0.0, 0.0, +1.0]], [[+1.0, 0.0, 0.0], [+1.0, 0.0, 0.0], [+1.0, 0.0, 0.0]...
// side faces [[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]], [[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]], [[0.0, 0.5], [0.5, 0.5], [0.5, 1.0], [0.0, 1.0]],
random_line_split
urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings # Here, user contacts.profile will cause some 'mismatch' since contacts is also a module from profile import ProfileView from contacts import ContactsView from authen import Authenticate strid = settings.CONTACT_URL['strid'] user = settings.CONTACT_URL['user'] contact = settings.CONTA...
random_line_split
gulpfile.js
"use strict"; const gulp = require('gulp'); //build system const source = require('vinyl-source-stream'); //converts reatable stream from webpack into the gulp compatible stream const sass = require('gulp-sass'); //css preprocessor const notifier = require('node-notifier'); //desktop notifications on error const del =...
notifier.notify({title:'ERROR', message:'CSS'}); sass.logError.bind(this)(err); })) .pipe(gulp.dest(RAW_PATH + 'css/')); }); gulp.task('buildComponentStyles', function() { return gulp.src(COMPONENT_PATH + '**/styles.scss') .pipe(sass()) .pipe(gulp.dest(COMPONENT_PATH)); }); /* basic server f...
.pipe(sass().on('error', function(err){
random_line_split
admin.py
from __future__ import absolute_import import csv from django.contrib import admin from django.http import HttpResponse from .models import Donor, Donation class DonationInline(admin.TabularInline): model = Donation extra = 0 @admin.register(Donor) class DonorAdmin(admin.ModelAdmin): inlines = [ ...
(self, request, queryset): fields = ('name', 'business', 'when', 'amount', 'memo') response = HttpResponse(content_type="text/csv") response['Content-Disposition'] = 'attachment; filename=donations.csv' writer = csv.DictWriter(response, fields, extrasaction='ignore') writer.write...
make_csv
identifier_name
admin.py
from __future__ import absolute_import import csv from django.contrib import admin from django.http import HttpResponse from .models import Donor, Donation class DonationInline(admin.TabularInline): model = Donation extra = 0 @admin.register(Donor) class DonorAdmin(admin.ModelAdmin): inlines = [ ...
return response make_list.short_description = "Create email list (plain text)" actions.append(make_list) def make_csv(self, request, queryset): fields = ('name', 'business', 'email', 'phone', 'address', 'last_donation', 'notes') response = HttpResponse(content_type="text/csv") ...
response.write("{} <{}>\n".format(donor.name, donor.email))
conditional_block
admin.py
from __future__ import absolute_import import csv from django.contrib import admin from django.http import HttpResponse from .models import Donor, Donation class DonationInline(admin.TabularInline): model = Donation extra = 0 @admin.register(Donor) class DonorAdmin(admin.ModelAdmin):
response['Content-Disposition'] = 'attachment; filename=donors.txt' for donor in queryset: if donor.email: response.write("{} <{}>\n".format(donor.name, donor.email)) return response make_list.short_description = "Create email list (plain text)" actions.append...
inlines = [ DonationInline ] # date_hierarchy = 'last_donation' actions_on_bottom = True list_display = 'name', 'business', 'last_donation', 'last_amount' search_fields = 'name', 'business', 'email', 'address' @staticmethod def last_donation(obj): return obj.donation_set.lat...
identifier_body
admin.py
from __future__ import absolute_import import csv from django.contrib import admin from django.http import HttpResponse from .models import Donor, Donation class DonationInline(admin.TabularInline): model = Donation extra = 0 @admin.register(Donor) class DonorAdmin(admin.ModelAdmin): inlines = [ ...
for donor in queryset: row = {"last_donation": self.last_donation(donor)} row.update(vars(donor)) writer.writerow(row) return response make_csv.short_description = "Create CSV" actions.append(make_csv) @admin.register(Donation) class DonationAdmin(admin.Mode...
response = HttpResponse(content_type="text/csv") response['Content-Disposition'] = 'attachment; filename=donors.csv' writer = csv.DictWriter(response, fields, extrasaction='ignore') writer.writeheader()
random_line_split
data.py
# -*- coding: utf-8 -*- # # GoogleAppsAccountManager: group/data # Copyright (C) 2012-2013 KAMEI Yutaka # # License: GNU General Public License version 2 or later # Date: 2012-12-28, since 2012-12-28 # from GoogleAppsAccountManager import XMLNS_ATOM, XMLNS_APPS from GoogleAppsAccountManager import data, errors class ...
class GroupEntry(data.Entry): def getGroupId(self): group_id = self.getValueFromPropertyElement("groupId") return group_id.encode("utf-8") def getGroupName(self): group_name = self.getValueFromPropertyElement("groupName") return group_name.encode("utf-8") def getGroupDesc...
def __init__(self, status, xml_string): data.Feed.__init__(self, status, xml_string, GroupEntry)
identifier_body
data.py
# -*- coding: utf-8 -*- # # GoogleAppsAccountManager: group/data # Copyright (C) 2012-2013 KAMEI Yutaka # # License: GNU General Public License version 2 or later # Date: 2012-12-28, since 2012-12-28 # from GoogleAppsAccountManager import XMLNS_ATOM, XMLNS_APPS from GoogleAppsAccountManager import data, errors class ...
)
random_line_split
data.py
# -*- coding: utf-8 -*- # # GoogleAppsAccountManager: group/data # Copyright (C) 2012-2013 KAMEI Yutaka # # License: GNU General Public License version 2 or later # Date: 2012-12-28, since 2012-12-28 # from GoogleAppsAccountManager import XMLNS_ATOM, XMLNS_APPS from GoogleAppsAccountManager import data, errors class ...
(self, status, xml_string): data.Feed.__init__(self, status, xml_string, GroupEntry) class GroupEntry(data.Entry): def getGroupId(self): group_id = self.getValueFromPropertyElement("groupId") return group_id.encode("utf-8") def getGroupName(self): group_name = self.getValueFrom...
__init__
identifier_name
OrganizationTreeComponent.js
import React, {Component, PropTypes} from 'react'; import {Tree, Menu, Icon} from 'antd'; const TreeNode = Tree.TreeNode; import Animate from 'rc-animate'; import './OrganizationTreeComponent.scss'; export default class OrganizationTreeComponent extends Component { static PropTypes = { checkable: PropTypes.boo...
} onSelect = (selectedKeys, info) => { const setParentId = this.props.setParentId; if(setParentId) { const parentId = selectedKeys[0]; setParentId(parentId); } } genTreeNodes(orgs) { return orgs.map((org) => { if(org.children && org.children.length) { return( <TreeNode key={or...
{ setCheckedKeys(checkedKeys); }
conditional_block
OrganizationTreeComponent.js
import React, {Component, PropTypes} from 'react'; import {Tree, Menu, Icon} from 'antd'; const TreeNode = Tree.TreeNode; import Animate from 'rc-animate'; import './OrganizationTreeComponent.scss'; export default class
extends Component { static PropTypes = { checkable: PropTypes.bool, orgs: PropTypes.array, checkedKeys: PropTypes.array, setCheckedKeys: PropTypes.func, setParentId: PropTypes.func, } static defaultProps = { checkedKeys: [] }; constructor(props) { super(props); } onCheck = (che...
OrganizationTreeComponent
identifier_name
OrganizationTreeComponent.js
import React, {Component, PropTypes} from 'react'; import {Tree, Menu, Icon} from 'antd'; const TreeNode = Tree.TreeNode; import Animate from 'rc-animate'; import './OrganizationTreeComponent.scss'; export default class OrganizationTreeComponent extends Component { static PropTypes = { checkable: PropTypes.boo...
checkedKeys: PropTypes.array, setCheckedKeys: PropTypes.func, setParentId: PropTypes.func, } static defaultProps = { checkedKeys: [] }; constructor(props) { super(props); } onCheck = (checkedKeys, info) => { const setCheckedKeys = this.props.setCheckedKeys; if(setCheckedKeys) { ...
random_line_split
MessageAreaContainer.test.js
import React from 'react'; import { mount } from 'enzyme'; import localStorageMock from '../__mocks__/localStorageMock'; import * as data from '../__mocks__/mockData'; import { MessageAreaContainer } from '../../dev/js/containers/MessageAreaContainer.jsx'; window.localStorage = localStorageMock; jest.mock('react-...
const props = { match: { params: { id: 4 } }, groupData: data.groupData, allUsersData: data.userData, currentUser: data.currentUser, archiveData: data.archiveData, groupMessages: data.messageData, getGroupMessages: () => Promise.resolve(), getGroupUsers: jest.fn(() => Promise.resolve()...
const setup = () => {
random_line_split
app.js
//vendors let modules = []; if(process.env.npm_lifecycle_event === 'server')
if(process.env.npm_lifecycle_event === 'server' || process.env.npm_lifecycle_event === 'build') { //eonasdan-bootstrap-datetimepicker require('eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css'); require('eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js'); requir...
{ require('bootstrap-sass/eyeglass-exports'); require('./styles/bootstrap.scss'); require('angular'); require('angular-vs-repeat/src/angular-vs-repeat.min.js'); modules.push(require('angular-animate')); modules.push('vs-repeat'); var _ = require('lodash'); var moment = require('moment/moment.js'); }
conditional_block
app.js
//vendors let modules = []; if(process.env.npm_lifecycle_event === 'server') { require('bootstrap-sass/eyeglass-exports'); require('./styles/bootstrap.scss'); require('angular'); require('angular-vs-repeat/src/angular-vs-repeat.min.js'); modules.push(require('angular-animate')); modules.push('vs-repeat'); ...
export default MODULE_NAME;
.directive('cellDatepicker', cellDatepicker) .directive('checkerDates', checkerDates) .directive('dateTimePicker', dateTimePicker) ;
random_line_split
move.js
function move(Restangular, $uibModal, $q, notification, $state,$http) { 'use strict'; return { restrict: 'E', scope: { selection: '=', type: '@', ngConfirmMessage: '@', ngConfirm: '&' }, link: function(scope, element, attrs) { ...
},function (data, status, headers, config) { notification.log('Something Wrong', { addnCls: 'humane-flatty-error' }); }).on(error, function(error){ winston.error("The error during post request is ") ...
} else { $http.post("../api/package_vod", newarray).then(function (response,data, status, headers, config,file) { notification.log('Vod successfully added', { addnCls: 'humane-flatty-success' }); window.location.replace(...
random_line_split
move.js
function move(Restangular, $uibModal, $q, notification, $state,$http)
if (attrs.type == 'move_to_package') scope.button = 'Move to Package'; var vods_array = []; $http.get('../api/vodpackages?package_type_id=3&package_type_id=4').then(function(response) { var data = response.data; for(var i=0;i<data.length;i++){ ...
{ 'use strict'; return { restrict: 'E', scope: { selection: '=', type: '@', ngConfirmMessage: '@', ngConfirm: '&' }, link: function(scope, element, attrs) { scope.myFunction = function(){ var spanDropd...
identifier_body
move.js
function
(Restangular, $uibModal, $q, notification, $state,$http) { 'use strict'; return { restrict: 'E', scope: { selection: '=', type: '@', ngConfirmMessage: '@', ngConfirm: '&' }, link: function(scope, element, attrs) { sco...
move
identifier_name
functions_12.js
var searchData=
['_7emesh',['~Mesh',['../classthewizardplusplus_1_1anna_1_1graphics_1_1_mesh.html#a5d57b290621dea7bae044a18beac008a',1,'thewizardplusplus::anna::graphics::Mesh']]], ['_7eobject',['~Object',['../classthewizardplusplus_1_1anna_1_1graphics_1_1_object.html#ac9ec2177266554587e8ddb40eb72ae1c',1,'thewizardplusplus::anna::...
[ ['_7econsole',['~Console',['../classthewizardplusplus_1_1utils_1_1_console.html#a3f2c8232f58fcbe5cbd826419dbd190d',1,'thewizardplusplus::utils::Console']]], ['_7egraphicapi',['~GraphicApi',['../classthewizardplusplus_1_1anna_1_1graphics_1_1_graphic_api.html#ae2403ea4d117c29e5070a50b8a418897',1,'thewizardplusplus:...
random_line_split
test_instance_fault.py
# Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
self.context, ['fake-uuid']) self.assertEqual(0, len(faults)) get_mock.assert_called_once_with(self.context, ['fake-uuid']) @mock.patch('nova.db.api.instance_fault_create') def test_create(self, mock_create): mock_create.return_value = fake_faults['fake-uuid'][1] fau...
faults = instance_fault.InstanceFaultList.get_by_instance_uuids(
random_line_split
test_instance_fault.py
# Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
(self, get_mock): fault = instance_fault.InstanceFault.get_latest_for_instance( self.context, 'fake-uuid') for key in fake_faults['fake-uuid'][0]: self.assertEqual(fake_faults['fake-uuid'][0][key], fault[key]) get_mock.assert_called_once_with(self.context, ['fake-uuid']) ...
test_get_latest_for_instance
identifier_name
test_instance_fault.py
# Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
get_mock.assert_called_once_with(self.context, ['fake-uuid']) @mock.patch.object(db, 'instance_fault_get_by_instance_uuids', return_value={}) def test_get_by_instance_with_none(self, get_mock): faults = instance_fault.InstanceFaultList.get_by_instance_uuids( ...
self.assertEqual(fake_faults['fake-uuid'][index][key], faults[index][key])
conditional_block
test_instance_fault.py
# Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
@mock.patch('nova.db.api.instance_fault_create') def test_create(self, mock_create): mock_create.return_value = fake_faults['fake-uuid'][1] fault = instance_fault.InstanceFault(context=self.context) fault.instance_uuid = uuids.faults_instance fault.code = 456 fault.mess...
faults = instance_fault.InstanceFaultList.get_by_instance_uuids( self.context, ['fake-uuid']) self.assertEqual(0, len(faults)) get_mock.assert_called_once_with(self.context, ['fake-uuid'])
identifier_body
backlog-approve-fail.ts
import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { NativeService } from '../../../../providers/NativeService'; import { BacklogService } from '../backlogService'; import { ViewController } from 'ionic-angular/navigation/view-controller'; import { Glo...
}); } ionViewDidLoad() { console.log('ionViewDidLoad BacklogApproveSuccussPage'); } getuser(value) { this.backlogService.reviewersLs({"selected": value, "status": 1}).subscribe(resJson => { if (resJson.Result){ this.personLs = resJson.Data; if (this.personLs.length == 1) { ...
{ this.item = resJson.Data; // this.stepLs = [...resJson.Data]; // if (this.item.ls instanceof Array){ this.stepLs = [...this.item.ls]; if (this.stepLs.length == 1) { this.selected = this.stepLs[0].ID; this.getuser(this.selected); } console.log...
conditional_block
backlog-approve-fail.ts
import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { NativeService } from '../../../../providers/NativeService'; import { BacklogService } from '../backlogService'; import { ViewController } from 'ionic-angular/navigation/view-controller'; import { Glo...
}; this.backlogService.failData(data).subscribe(resJson => { if (resJson.Result) { this.item = resJson.Data; // this.stepLs = [...resJson.Data]; // if (this.item.ls instanceof Array){ this.stepLs = [...this.item.ls]; if (this.stepLs.length == 1) { this.se...
this.content = this.navParams.get("content"); this.param = this.navParams.get("param"); let data = {"Number": this.content.Number, "acid": this.param.acid, "strbkNextNodeNum": this.content.strbkNextNodeNum, "FlowNumber": this.content.FlowNumber
random_line_split
backlog-approve-fail.ts
import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { NativeService } from '../../../../providers/NativeService'; import { BacklogService } from '../backlogService'; import { ViewController } from 'ionic-angular/navigation/view-controller'; import { Glo...
() { console.log('ionViewDidLoad BacklogApproveSuccussPage'); } getuser(value) { this.backlogService.reviewersLs({"selected": value, "status": 1}).subscribe(resJson => { if (resJson.Result){ this.personLs = resJson.Data; if (this.personLs.length == 1) { this.userIDs = this.p...
ionViewDidLoad
identifier_name
most_free_time.py
''' Have the function MostFreeTime(strArr) read the strArr parameter being passed which will represent a full day and will be filled with events that span from time X to time Y in the day. The format of each event will be hh:mmAM/PM-hh:mmAM/PM. For example, strArr may be ["10:00AM-12:30PM", "02:00PM-02:45PM","09:10A...
(times): ams = [] pms = [] for i in times: if i[5].lower() == 'p' and int(i[0:2])<12: pms.append(i) else: ams.append(i) full = sort_timeList(ams)+sort_timeList(pms) return full def sort_timeList(times): sortedTimes = sorted(times, cmp=make_comparator(less_than), reverse=False)#[::-1] return sortedT...
sort_times
identifier_name
most_free_time.py
''' Have the function MostFreeTime(strArr) read the strArr parameter being passed which will represent a full day and will be filled with events that span from time X to time Y in the day. The format of each event will be hh:mmAM/PM-hh:mmAM/PM. For example, strArr may be ["10:00AM-12:30PM", "02:00PM-02:45PM","09:10A...
sen = ["12:15PM-02:00PM","09:00AM-12:11PM","02:02PM-04:00PM"] print MostFreeTime(sen)
times = sort_times(times) #print times maxt = 0 for i in range (0,len(times)-1): free = times[i][8:]+"-"+times[i+1][:7] maxt = max(maxt,CountingMinutesI(free)) #print maxt #print "FInal result: "+str(maxt ) return str(maxt/60).zfill(2) +":"+str(maxt%60).zfill(2)
identifier_body
most_free_time.py
''' Have the function MostFreeTime(strArr) read the strArr parameter being passed which will represent a full day and will be filled with events that span from time X to time Y in the day. The format of each event will be hh:mmAM/PM-hh:mmAM/PM. For example, strArr may be ["10:00AM-12:30PM", "02:00PM-02:45PM","09:10A...
elif (pm==1): if(hh<12): hh += 12 return (hh*60)+mm def CountingMinutesI(sen): sen = sen.replace('M','') sen = sen.replace(':',' ') sen = sen.replace('P',' 1') sen = sen.replace('A',' 0') lit = sen.split("-") lit = lit[0].split(" ") +lit[1].split(" ") lita=[] for i in lit: lita.append(int(i)) #pr...
return 0
conditional_block
most_free_time.py
''' Have the function MostFreeTime(strArr) read the strArr parameter being passed which will represent a full day and will be filled with events that span from time X to time Y in the day. The format of each event will be hh:mmAM/PM-hh:mmAM/PM. For example, strArr may be ["10:00AM-12:30PM", "02:00PM-02:45PM","09:10A...
return (hh*60)+mm def CountingMinutesI(sen): sen = sen.replace('M','') sen = sen.replace(':',' ') sen = sen.replace('P',' 1') sen = sen.replace('A',' 0') lit = sen.split("-") lit = lit[0].split(" ") +lit[1].split(" ") lita=[] for i in lit: lita.append(int(i)) #print lita if(lita[2] == lita[5]): res ...
elif (pm==1): if(hh<12): hh += 12
random_line_split
Hooks.ts
/** * Hooks.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ import Arr from '../util/Arr'; import NodeType from '../dom/NodeType'; import $ from '../api/dom/DomQuery'...
if (!hooks) { postProcessHooks[name] = hooks = []; } postProcessHooks[name].push(hook); }; const postProcess = function (name, editor) { each(postProcessHooks[name], function (hook) { hook(editor); }); }; addPostProcessHook('pre', function (editor) { const rng = editor.selection.getRng(); let i...
const postProcessHooks = {}, filter = Arr.filter, each = Arr.each; const addPostProcessHook = function (name, hook) { let hooks = postProcessHooks[name];
random_line_split
Hooks.ts
/** * Hooks.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ import Arr from '../util/Arr'; import NodeType from '../dom/NodeType'; import $ from '../api/dom/DomQuery'...
postProcessHooks[name].push(hook); }; const postProcess = function (name, editor) { each(postProcessHooks[name], function (hook) { hook(editor); }); }; addPostProcessHook('pre', function (editor) { const rng = editor.selection.getRng(); let isPre, blocks; const hasPreSibling = function (pre) { ...
{ postProcessHooks[name] = hooks = []; }
conditional_block
worker.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMe...
pub fn release(&self) { let refcount = self.refcount.get(); assert!(refcount > 0) self.refcount.set(refcount - 1); if refcount == 1 { let cx = self.global.root().root_ref().get_cx(); unsafe { JS_RemoveObjectRoot(cx, self.reflector().rootable(...
{ let refcount = self.refcount.get(); if refcount == 0 { let cx = self.global.root().root_ref().get_cx(); unsafe { JS_AddObjectRoot(cx, self.reflector().rootable()); } } self.refcount.set(refcount + 1); TrustedWorkerAddress(self...
identifier_body
worker.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMe...
} fn SetOnmessage(self, listener: Option<EventHandlerNonNull>) { let eventtarget: JSRef<EventTarget> = EventTargetCast::from_ref(self); eventtarget.set_event_handler_common("message", listener) } } impl Reflectable for Worker { fn reflector<'a>(&'a self) -> &'a Reflector { self...
random_line_split
worker.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMe...
<'a>(&'a self) -> &'a Reflector { self.eventtarget.reflector() } }
reflector
identifier_name
worker.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerBinding; use dom::bindings::codegen::Bindings::WorkerBinding::WorkerMe...
self.refcount.set(refcount + 1); TrustedWorkerAddress(self as *const Worker as *const c_void) } pub fn release(&self) { let refcount = self.refcount.get(); assert!(refcount > 0) self.refcount.set(refcount - 1); if refcount == 1 { let cx = self.global...
{ let cx = self.global.root().root_ref().get_cx(); unsafe { JS_AddObjectRoot(cx, self.reflector().rootable()); } }
conditional_block
uppercase_pipe.ts
import {isString, StringWrapper, CONST, isBlank} from 'angular2/src/facade/lang'; import {Injectable} from 'angular2/di'; import {PipeTransform, WrappedValue} from 'angular2/change_detection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; import {Pipe} from '../core/metadata'; /** ...
}
{ if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(UpperCasePipe, value); } return StringWrapper.toUpperCase(value); }
identifier_body
uppercase_pipe.ts
import {isString, StringWrapper, CONST, isBlank} from 'angular2/src/facade/lang'; import {Injectable} from 'angular2/di'; import {PipeTransform, WrappedValue} from 'angular2/change_detection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; import {Pipe} from '../core/metadata'; /** ...
return StringWrapper.toUpperCase(value); } }
{ throw new InvalidPipeArgumentException(UpperCasePipe, value); }
conditional_block
uppercase_pipe.ts
import {isString, StringWrapper, CONST, isBlank} from 'angular2/src/facade/lang'; import {Injectable} from 'angular2/di'; import {PipeTransform, WrappedValue} from 'angular2/change_detection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; import {Pipe} from '../core/metadata'; /** ...
(value: string, args: List<any> = null): string { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(UpperCasePipe, value); } return StringWrapper.toUpperCase(value); } }
transform
identifier_name
uppercase_pipe.ts
import {isString, StringWrapper, CONST, isBlank} from 'angular2/src/facade/lang'; import {Injectable} from 'angular2/di'; import {PipeTransform, WrappedValue} from 'angular2/change_detection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; import {Pipe} from '../core/metadata'; /** ...
* * ``` */ @CONST() @Pipe({name: 'uppercase'}) @Injectable() export class UpperCasePipe implements PipeTransform { transform(value: string, args: List<any> = null): string { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(UpperCasePipe, value); } ...
* }) * class Username { * user:string; * }
random_line_split
app.module.ts
import { NgModule } from '@angular/core'
import { AppComponent } from './app.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule, JsonpModule } from '@angular/http'; import {TagSearchService} from "./flickr/service/data.service"; import {TagSearchCompone...
import { RouterModule } from '@angular/router'; import { rootRouterConfig } from './app.routes';
random_line_split
app.module.ts
import { NgModule } from '@angular/core' import { RouterModule } from '@angular/router'; import { rootRouterConfig } from './app.routes'; import { AppComponent } from './app.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import {...
{ }
AppModule
identifier_name
roc.js
define( //begin v1.x content { "field-sat-relative+0": "tuto sobotu", "field-sat-relative+1": "příští sobotu", "field-dayperiod": "AM/PM", "field-sun-relative+-1": "minulou neděli", "field-mon-relative+-1": "minulé pondělí", "field-minute": "Minuta", "field-day-relative+-1": "včera", "field-weekday": "Den v týd...
"field-fri-relative+1": "příští pátek", "field-week": "Týden", "field-week-relative+0": "tento týden", "field-week-relative+1": "příští týden", "field-month-relative+0": "tento měsíc", "field-month": "Měsíc", "field-month-relative+1": "příští měsíc", "field-fri-relative+-1": "minulý pátek", "field-second": "Se...
"field-year-relative+-1": "minulý rok", "field-year": "Rok", "field-fri-relative+0": "tento pátek",
random_line_split
builtin.rs
use lexer::Span; use interpreter::*; use std::io; use std::io::prelude::*; impl<'a> Interpreter<'a> { pub fn builtin_print(&'a self, context: *mut InterpreterContext<'a>, args: &[Box<Expression>], span: Span) -> Res...
use parser::ast::*;
random_line_split
builtin.rs
use parser::ast::*; use lexer::Span; use interpreter::*; use std::io; use std::io::prelude::*; impl<'a> Interpreter<'a> { pub fn builtin_print(&'a self, context: *mut InterpreterContext<'a>, args: &[Box<Expression>], span: Span) ...
}; Ok(Value::Nil) } pub fn builtin_readln(&self, args: &[Box<Expression>], span: Span) -> Result<Value> { if args.len() != 0 { return Err(Error { kind: ErrorKind::InvalidArgCount, span: span, }); }; let mut line ...
{ if args.len() != 1 { return Err(Error { kind: ErrorKind::InvalidArgCount, span: span, }); }; match try!(self.value_from_expression(context, args.get(0).unwrap())) { Value::String(s) => print!("{}", s), Value::Inte...
identifier_body
builtin.rs
use parser::ast::*; use lexer::Span; use interpreter::*; use std::io; use std::io::prelude::*; impl<'a> Interpreter<'a> { pub fn
(&'a self, context: *mut InterpreterContext<'a>, args: &[Box<Expression>], span: Span) -> Result<Value> { if args.len() != 1 { return Err(Error { kind: ErrorKind::InvalidArgCount, ...
builtin_print
identifier_name
env.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD License. """This script is some boilerplate needed by Alembic to do its fancy database migration stuff. """ # A hack so that we can get the librarian_server module. import sys sys.path.insert(0, '.') fro...
(): """Run migrations in 'offline' mode -- all we need is a URL. """ url = app.config['SQLALCHEMY_DATABASE_URI'] context.configure( url=url, target_metadata=target_metadata, literal_binds=True ) with context.begin_transaction(): context.run_migrations() def ru...
run_migrations_offline
identifier_name
env.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD License. """This script is some boilerplate needed by Alembic to do its fancy database migration stuff. """ # A hack so that we can get the librarian_server module. import sys sys.path.insert(0, '.') fro...
def run_migrations_online(): """Run migrations in 'online' mode -- using the actual Librarian database connection. """ with db.engine.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata ) with context.beg...
"""Run migrations in 'offline' mode -- all we need is a URL. """ url = app.config['SQLALCHEMY_DATABASE_URI'] context.configure( url=url, target_metadata=target_metadata, literal_binds=True ) with context.begin_transaction(): context.run_migrations()
identifier_body
env.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD License. """This script is some boilerplate needed by Alembic to do its fancy database migration stuff. """ # A hack so that we can get the librarian_server module. import sys sys.path.insert(0, '.') fro...
""" with db.engine.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata ) with context.begin_transaction(): context.run_migrations() if context.is_offline_mode(): run_migrations_offline() else: ...
def run_migrations_online(): """Run migrations in 'online' mode -- using the actual Librarian database connection.
random_line_split
env.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2016 the HERA Collaboration # Licensed under the 2-clause BSD License. """This script is some boilerplate needed by Alembic to do its fancy database migration stuff. """ # A hack so that we can get the librarian_server module. import sys sys.path.insert(0, '.') fro...
run_migrations_online()
conditional_block
name.rs
use lazy_static::lazy_static; use regex::Regex; use serde::Deserialize; use std::fs; #[derive(Debug, Deserialize)] struct FirstName { male: Vec<Vec<String>>, female: Vec<Vec<String>>, } #[derive(Debug, Deserialize)] struct Data { first_name: FirstName, last_name: Vec<Vec<String>>, } lazy_static! { static r...
() { let name = gimei::name(); let items = &DATA.last_name; assert!(items.iter().any(|x| x[0] == name.last.kanji)); assert!(items.iter().any(|x| x[1] == name.last.hiragana)); assert!(items.iter().any(|x| x[2] == name.last.katakana)); } #[test] fn to_kanji() { let name = gimei::name(); let re = Regex::ne...
last_name
identifier_name
name.rs
use lazy_static::lazy_static; use regex::Regex; use serde::Deserialize; use std::fs; #[derive(Debug, Deserialize)] struct FirstName { male: Vec<Vec<String>>, female: Vec<Vec<String>>, } #[derive(Debug, Deserialize)] struct Data { first_name: FirstName, last_name: Vec<Vec<String>>, } lazy_static! { static r...
fn female_first_name() { let name = gimei::female(); let items = &DATA.first_name.female; assert!(items.iter().any(|x| x[0] == name.first.kanji)); assert!(items.iter().any(|x| x[1] == name.first.hiragana)); assert!(items.iter().any(|x| x[2] == name.first.katakana)); } #[test] fn last_name() { let name = g...
assert!(items.iter().any(|x| x[2] == name.first.katakana)); } #[test]
random_line_split
name.rs
use lazy_static::lazy_static; use regex::Regex; use serde::Deserialize; use std::fs; #[derive(Debug, Deserialize)] struct FirstName { male: Vec<Vec<String>>, female: Vec<Vec<String>>, } #[derive(Debug, Deserialize)] struct Data { first_name: FirstName, last_name: Vec<Vec<String>>, } lazy_static! { static r...
#[test] fn is_male() { let male_name = gimei::male(); assert!(male_name.is_male()); let female_name = gimei::female(); assert!(!female_name.is_male()); } #[test] fn is_female() { let male_name = gimei::male(); assert!(!male_name.is_female()); let female_name = gimei::female(); assert!(female_name.i...
{ let name = gimei::name(); let re = Regex::new(r"^\p{Katakana}+\s\p{Katakana}+$").unwrap(); assert!(re.is_match(&name.to_katakana())); }
identifier_body
0002_add_categories.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_categories(apps, schema_editor): Category = apps.get_model('niqati', 'Category') # We are going to add categories only if none already exists. if not Category.objects.exists(): Category...
on(migrations.Migration): dependencies = [ ('niqati', '0001_initial'), ] operations = [ migrations.RunPython( add_categories, reverse_code=remove_categories), ]
.get_model('niqati', 'Category') Category.objects.filter(label__in=["Idea", "Organizer", "Participation"]).delete() class Migrati
identifier_body
0002_add_categories.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_categories(apps, schema_editor): Category = apps.get_model('niqati', 'Category') # We are going to add categories only if none already exists. if not Category.objects.exists(): Category...
ar_label="تنظيم", points=2) Category.objects.create(label="Participation", ar_label="مشاركة", points=1) def remove_categories(apps, schema_editor): Category = apps.get_model('niqa...
ar_label="فكرة", points=3) Category.objects.create(label="Organizer",
random_line_split
0002_add_categories.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_categories(apps, schema_editor): Category = apps.get_model('niqati', 'Category') # We are going to add categories only if none already exists. if not Category.objects.exists(): Category...
ration): dependencies = [ ('niqati', '0001_initial'), ] operations = [ migrations.RunPython( add_categories, reverse_code=remove_categories), ]
tions.Mig
identifier_name
0002_add_categories.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def add_categories(apps, schema_editor): Category = apps.get_model('niqati', 'Category') # We are going to add categories only if none already exists. if not Category.objects.exists():
tegories(apps, schema_editor): Category = apps.get_model('niqati', 'Category') Category.objects.filter(label__in=["Idea", "Organizer", "Participation"]).delete() class Migration(migrations.Migration): dependencies = [ ('niqati', '0001_initial'), ] operations = [ migrations.RunPytho...
Category.objects.create(label="Idea", ar_label="فكرة", points=3) Category.objects.create(label="Organizer", ar_label="تنظيم", points=2) Category.objects.create(label="Participa...
conditional_block
zz_placehold.client.directive.js
/** * Created by Wayne on 15/7/9. */ 'use strict'; zhuzhuqs.directive('zzplacehold', function() { return { restrict: 'A', require: 'ngModel', link: function(scope, element, attr, ctrl) {
element.val(attr.zzplacehold) }; var unplacehold = function () { element.val(''); }; scope.$watch(attr.ngModel, function (val) { value = val || ''; }); element.bind('focus', function () { if(value == '') unplacehold(); }); element.bind(...
var value; var placehold = function () {
random_line_split
model_box.py
name=name) return boxes @under_name_scope() def decode_bbox_target(box_predictions, anchors): """ Args: box_predictions: (..., 4), logits anchors: (..., 4), floatbox. Must have the same shape Returns: box_decoded: (..., 4), float32. With the same shape. """ orig_shape...
anchors_x1y1x2y2 = tf.reshape(anchors, (-1, 2, 2)) anchors_x1y1, anchors_x2y2 = tf.split(anchors_x1y1x2y2, 2, axis=1) waha = anchors_x2y2 - anchors_x1y1 xaya = (anchors_x2y2 + anchors_x1y1) * 0.5 clip = np.log(config.PREPROC.MAX_SIZE / 16.) wbhb = tf.exp(tf.minimum(box_pred_twth, clip)) * waha...
# each is (...)x1x2
random_line_split
model_box.py
0.5 clip = np.log(config.PREPROC.MAX_SIZE / 16.) wbhb = tf.exp(tf.minimum(box_pred_twth, clip)) * waha xbyb = box_pred_txty * waha + xaya x1y1 = xbyb - wbhb * 0.5 x2y2 = xbyb + wbhb * 0.5 # (...)x1x2 out = tf.concat([x1y1, x2y2], axis=-2) return tf.reshape(out, orig_shape) @under_name...
""" Demonstrate what's wrong with tf.image.crop_and_resize: """ import tensorflow.contrib.eager as tfe tfe.enable_eager_execution() # want to crop 2x2 out of a 5x5 image, and resize to 4x4 image = np.arange(25).astype('float32').reshape(5, 5) boxes = np.asarray([[1, 1, 3, 3]], dtype='float3...
conditional_block
model_box.py
(boxes, window, name=None): """ Args: boxes: nx4, xyxy window: [h, w] """ boxes = tf.maximum(boxes, 0.0) m = tf.tile(tf.reverse(window, [0]), [2]) # (4,) boxes = tf.minimum(boxes, tf.to_float(m), name=name) return boxes @under_name_scope() def decode_bbox_target(box_pred...
clip_boxes
identifier_name
model_box.py
=name) return boxes @under_name_scope() def decode_bbox_target(box_predictions, anchors): """ Args: box_predictions: (..., 4), logits anchors: (..., 4), floatbox. Must have the same shape Returns: box_decoded: (..., 4), float32. With the same shape. """ orig_shape = tf...
gt_labels = tf.slice(self.gt_labels, [0, 0, 0], slice3d) gt_boxes = tf.slice(self.gt_boxes, [0, 0, 0, 0
""" boxes (FS x FS x NA x 4): The anchor boxes. gt_labels (FS x FS x NA): gt_boxes (FS x FS x NA x 4): Groundtruth boxes corresponding to each anchor. """ def encoded_gt_boxes(self): return encode_bbox_target(self.gt_boxes, self.boxes) def decode_logits(self, logits): return dec...
identifier_body
Gruntfile.js
module.exports = function( grunt ) { 'use strict'; var sass = require( 'node-sass' ); grunt.initConfig({ // Setting folder templates. dirs: { css: 'assets/css', fonts: 'assets/fonts', images: 'assets/images', js: 'assets/js', php: 'includes' }, // JavaScript linting with ESLint. eslint: {...
'!*-rtl.css' ], dest: '<%= dirs.css %>/', ext: '-rtl.css' } }, // Minify all .css files. cssmin: { minify: { files: [ { expand: true, cwd: '<%= dirs.css %>/', src: ['*.css'], dest: '<%= dirs.css %>/', ext: '.css' }, { expand: true, ...
src: [ '*.css', '!select2.css',
random_line_split
runner.ts
skipTests: this._skipTests, tests: this._tests, wctFlags: this._wctFlags, workspaceDir: this._workspace.dir }); } } /** * Given all the repos defined in the workspace, lets iterate through them * and either clone them or update their clones and set them to the specif...
* TODO(usergenic): Should this method explode if it results in no repos to * test? */ async _determineWorkspaceRepos() { const excludes: git.GitHubRepoRef[] = this._excludes.map(git.parseGitHubRepoRefString); const skipTests: git.GitHubRepoRef[] = this._skipTests.map(git.parseGitHubRe...
* employed) and then reduce the set with excludes, and set the workspace * repos appropriately. * TODO(usergenic): This method is getting long. Break it up into sub-methods * perhaps one for expanding the set of repos by going to github etc and * another to remove items.
random_line_split
runner.ts
(options: RunnerOptions) { this._color = options.color !== 'off'; this._excludes = options.excludes || []; this._fresh = !!options.fresh; // TODO(usergenic): Pass an option to gitUtil.connectToGitHub for the // rate limiter it uses. this._github = new git.GitHubConnection(options.githubToken); ...
constructor
identifier_name
runner.ts
skipTests: this._skipTests, tests: this._tests, wctFlags: this._wctFlags, workspaceDir: this._workspace.dir }); } } /** * Given all the repos defined in the workspace, lets iterate through them * and either clone them or update their clones and set them to the specif...
.filter( repo => !excludes.some(exclude => git.matchRepoRef(exclude, repo))); // TODO(usergenic): Maybe we should be obtaining the package name here // from the repository's bower.json or package.json. // Need to download all the GitHub.Repo representations ...
{ const excludes: git.GitHubRepoRef[] = this._excludes.map(git.parseGitHubRepoRefString); const skipTests: git.GitHubRepoRef[] = this._skipTests.map(git.parseGitHubRepoRefString); // Expand all tests and filter out the excluded repos const expandedTests: git.GitHubRepoRef[] = (a...
identifier_body
runner.ts
come back // without enough context for users to debug. await util.promiseAllWithProgress(promises, 'Cloning/Updating repos...'); if (checkoutFails.length > 0) { for (const checkoutFail of checkoutFails) { const repo = this._workspace.repos.get(checkoutFail.name); const ref = git.se...
{ console.log(`Removing workspace folder ${workspaceDir}...`); }
conditional_block
makebookfrompgn.py
#!/usr/bin/env python #coding: utf8 """ Restore the saved list of documents that were being read """ from __future__ import print_function, absolute_import, division import sys, os import logging import subprocess DefaultExecutable = 'smallpotato' DefaultBook = 'book.opn' DefaultMaxPly = 20 class EngineConnector(ob...
# if we get a result, game is done currentply = self.maxPly + 1 break dot = move.find('.') if dot >= 0: move = move[dot + 1:].strip() if move == '': ...
if move in Results:
random_line_split
makebookfrompgn.py
#!/usr/bin/env python #coding: utf8 """ Restore the saved list of documents that were being read """ from __future__ import print_function, absolute_import, division import sys, os import logging import subprocess DefaultExecutable = 'smallpotato' DefaultBook = 'book.opn' DefaultMaxPly = 20 class EngineConnector(ob...
engine = EngineConnector(parameters.executable, parameters.book, parameters.ply) for gameFilename in parameters.games: try: fin = open(os.path.expanduser(gameFilename)) except (OSError, IOError) as e: logging.error("Cannot open %s: %s. Skipping" % (gameFilename, e)) ...
from argparse import ArgumentParser from simplelogger import configureLogging parser = ArgumentParser(description=__doc__) parser.add_argument("-v", "--verbose", dest="verbosity", default=0, action="count", help="Verbosity. Invoke many times for higher verbosity") parser.add...
identifier_body
makebookfrompgn.py
#!/usr/bin/env python #coding: utf8 """ Restore the saved list of documents that were being read """ from __future__ import print_function, absolute_import, division import sys, os import logging import subprocess DefaultExecutable = 'smallpotato' DefaultBook = 'book.opn' DefaultMaxPly = 20 class EngineConnector(ob...
(self, executable, book, maxPly): self.games = 0 self.maxPly = maxPly logging.info("Starting %s" % executable) self.process = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) self.process.stdin.write('new\n') logging.info("Mo...
__init__
identifier_name
makebookfrompgn.py
#!/usr/bin/env python #coding: utf8 """ Restore the saved list of documents that were being read """ from __future__ import print_function, absolute_import, division import sys, os import logging import subprocess DefaultExecutable = 'smallpotato' DefaultBook = 'book.opn' DefaultMaxPly = 20 class EngineConnector(ob...
self.process.stdin.write('sp_sanmove %s\n' % move) currentply += 1 if currentply > self.maxPly: break def main(args): from argparse import ArgumentParser from simplelogger import configureLogging parser = ArgumentPar...
continue
conditional_block
gulpfile.js
var gulp = require('gulp'), jshintStylish = require('jshint-stylish'), gutil = require('gulp-util'),// Currently unused, but gulp strongly suggested I install... jshint = require('gulp-jshint'), jsHintOptions = { "trailing": true, "nonbsp": true, "noarg": true, "latedef": true,
"esnext": true, "node": true, "eqeqeq": false, "globals": { "fs": false, "Config": false, "ResourceMonitor": false, "toId": false, "toUserid": false, "toName": false, "sanitize": false, "string": false, "clampIntRange": false, "LoginServer": false, "Users": false, "Rooms": f...
"sub": true, "smarttabs": true, "evil": true,
random_line_split
experimenter.py
import multiprocessing import logging class Experimenter(object):
self.logger = logging.getLogger(log_name) self.logger.setLevel(logging.INFO) self.logger.addHandler(file_handler) self.logger.addHandler(stream_handler) # Setup parallel execution limit self.cpu_limit = min(cpu_limit, multiprocessing.cpu_count()) self.semaphore ...
""" Coordinated, parallel execution of Experiments with logging. """ def __init__(self, log_name, experiments, cpu_limit=2**16): """ :param experiments: A list of pypuf.experiments.experiment.base.Experiment :param log_name: A unique file path where to output should be logged. ...
identifier_body
experimenter.py
import multiprocessing import logging class Experimenter(object): """ Coordinated, parallel execution of Experiments with logging. """ def __init__(self, log_name, experiments, cpu_limit=2**16): """ :param experiments: A list of pypuf.experiments.experiment.base.Experiment :pa...
# wait for all processes to be finished for job in jobs: job.join()
def run_experiment(semaphore): exp.execute() # run the actual experiment semaphore.release() # release CPU job = multiprocessing.Process( target=run_experiment, args=(self.semaphore,) ) # run experiment s...
conditional_block
experimenter.py
import multiprocessing import logging class Experimenter(object): """ Coordinated, parallel execution of Experiments with logging. """ def __init__(self, log_name, experiments, cpu_limit=2**16): """ :param experiments: A list of pypuf.experiments.experiment.base.Experiment :pa...
# Setup logging to both file and console file_handler = logging.FileHandler(filename='%s.log' % log_name, mode='w') file_handler.setLevel(logging.INFO) stream_handler = logging.StreamHandler() stream_handler.setLevel(logging.INFO) self.logger = logging.getLogger(log_nam...
# Store experiments list self.experiments = experiments
random_line_split
experimenter.py
import multiprocessing import logging class Experimenter(object): """ Coordinated, parallel execution of Experiments with logging. """ def __init__(self, log_name, experiments, cpu_limit=2**16): """ :param experiments: A list of pypuf.experiments.experiment.base.Experiment :pa...
(semaphore): exp.execute() # run the actual experiment semaphore.release() # release CPU job = multiprocessing.Process( target=run_experiment, args=(self.semaphore,) ) # run experiment self.semaphore.acqu...
run_experiment
identifier_name
11-TreeNodeDelete.py
# Week 5 - 11) Based on the Python Code or the C++ Code Provided in class as a # starting point, implement the binary search tree node, delete # function. class Node(object): def
(self, value): self.value=value self.next=None self.prev=None class List(object): def __init__(self): self.head=None self.tail=None def insert(self,n,x): #Not actually perfect: how do we prepend to an existing list? if n!=None: x.next...
__init__
identifier_name
11-TreeNodeDelete.py
# Week 5 - 11) Based on the Python Code or the C++ Code Provided in class as a # starting point, implement the binary search tree node, delete # function. class Node(object):
class List(object): def __init__(self): self.head=None self.tail=None def insert(self,n,x): #Not actually perfect: how do we prepend to an existing list? if n!=None: x.next=n.next n.next=x x.prev=n if x.next!=None: ...
def __init__(self, value): self.value=value self.next=None self.prev=None
identifier_body
11-TreeNodeDelete.py
# Week 5 - 11) Based on the Python Code or the C++ Code Provided in class as a # starting point, implement the binary search tree node, delete # function. class Node(object): def __init__(self, value): self.value=value self.next=None self.prev=None class List(obje...
''' Added remove function. ''' def remove(self, node): '''Remove an item from a linked list data structure.''' # Example: n=3 # Sets the delete pointer to the first node deletePointer = self.head # O(1) --> O(1) # U...
self.tail=x
conditional_block
11-TreeNodeDelete.py
def __init__(self, value): self.value=value self.next=None self.prev=None class List(object): def __init__(self): self.head=None self.tail=None def insert(self,n,x): #Not actually perfect: how do we prepend to an existing list? if n!=None: ...
# Week 5 - 11) Based on the Python Code or the C++ Code Provided in class as a # starting point, implement the binary search tree node, delete # function. class Node(object):
random_line_split
colorHelper.ts
export class ColorHelper { contrastColor(color) { var d = 0; if (this.isBright(color)) d = 0; // bright colors - black font else d = 255; // dark colors - white font return this.rgbToHex(d, d, d); } hexToRgb(hex) { var result = /^#?([a-f\d]{2...
isBright(color) { color = this.hexToRgb(color); // Counting the perceptive luminance - human eye favors green color... var a = 1 - (0.299 * color.r + 0.587 * color.g + 0.114 * color.b) / 255; return a < 0.5; } }
{ var m = str.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i); if (m) { return this.rgbToHex(m[1], m[2], m[3]); } }
identifier_body
colorHelper.ts
export class ColorHelper {
(color) { var d = 0; if (this.isBright(color)) d = 0; // bright colors - black font else d = 255; // dark colors - white font return this.rgbToHex(d, d, d); } hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); ...
contrastColor
identifier_name
colorHelper.ts
export class ColorHelper { contrastColor(color) { var d = 0; if (this.isBright(color)) d = 0; // bright colors - black font else d = 255; // dark colors - white font return this.rgbToHex(d, d, d); } hexToRgb(hex) { var result = /^#?([a-f\d]{2...
var m = str.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i); if (m) { return this.rgbToHex(m[1], m[2], m[3]); } } isBright(color) { color = this.hexToRgb(color); // Counting the perceptive luminance - human eye favors green color... var a ...
rgbStrToHex(str) {
random_line_split
for_kv_map.rs
use super::FOR_KV_MAP; use clippy_utils::diagnostics::{multispan_sugg, span_lint_and_then}; use clippy_utils::source::snippet; use clippy_utils::sugg; use clippy_utils::ty::is_type_diagnostic_item; use clippy_utils::visitors::LocalUsedVisitor; use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, Pat, PatKind}; use r...
{ match *pat { PatKind::Wild => true, PatKind::Binding(_, id, ident, None) if ident.as_str().starts_with('_') => { !LocalUsedVisitor::new(cx, id).check_expr(body) }, _ => false, } }
identifier_body
for_kv_map.rs
use super::FOR_KV_MAP; use clippy_utils::diagnostics::{multispan_sugg, span_lint_and_then}; use clippy_utils::source::snippet; use clippy_utils::sugg; use clippy_utils::ty::is_type_diagnostic_item; use clippy_utils::visitors::LocalUsedVisitor; use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, Pat, PatKind}; use r...
<'tcx>(cx: &LateContext<'tcx>, pat: &'tcx PatKind<'_>, body: &'tcx Expr<'_>) -> bool { match *pat { PatKind::Wild => true, PatKind::Binding(_, id, ident, None) if ident.as_str().starts_with('_') => { !LocalUsedVisitor::new(cx, id).check_expr(body) }, _ => false, } }
pat_is_wild
identifier_name
for_kv_map.rs
use super::FOR_KV_MAP; use clippy_utils::diagnostics::{multispan_sugg, span_lint_and_then}; use clippy_utils::source::snippet; use clippy_utils::sugg; use clippy_utils::ty::is_type_diagnostic_item; use clippy_utils::visitors::LocalUsedVisitor; use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, Pat, PatKind}; use r...
let (new_pat_span, kind, ty, mutbl) = match *cx.typeck_results().expr_ty(arg).kind() { ty::Ref(_, ty, mutbl) => match (&pat[0].kind, &pat[1].kind) { (key, _) if pat_is_wild(cx, key, body) => (pat[1].span, "value", ty, mutbl), (_, value) if pat_is_wild(...
if let PatKind::Tuple(pat, _) = pat.kind { if pat.len() == 2 { let arg_span = arg.span;
random_line_split
borrowck-uniq-via-box.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 ...
fn borrow(_v: &int) {} fn box_mut(v: @mut ~int) { borrow(*v); //~ ERROR illegal borrow unless pure } fn box_mut_rec(v: @mut Rec) { borrow(v.f); //~ ERROR illegal borrow unless pure } fn box_mut_recs(v: @mut Outer) { borrow(v.f.g.h); //~ ERROR illegal borrow unless pure } fn box_imm(v: @~int) { borro...
h: ~int, }
random_line_split
borrowck-uniq-via-box.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 ...
{ }
identifier_body
borrowck-uniq-via-box.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 ...
(v: @Rec) { borrow(v.f); // OK } fn box_imm_recs(v: @Outer) { borrow(v.f.g.h); // OK } fn main() { }
box_imm_rec
identifier_name
build.rs
extern crate serde_codegen; extern crate serde_json; extern crate glob; use std::env; use std::fs; use std::path::Path; /// generate an enum of Events fn main() { for entry in glob::glob("src/**/*.rs.in").expect("Failed to read glob pattern") { println!("cargo:rerun-if-changed={}", entry.unwrap().display(...
for entry in glob::glob("**/*.rs.in").expect("Failed to read glob pattern") { match entry { Ok(src) => { let mut dst = Path::new(&out_dir).join(&src); // Change ".rs.in" to ".rs". dst.set_file_name(src.file_stem().expect("Failed to get file stem"...
// Switch to our `src` directory so that we have the right base for our // globs, and so that we won't need to strip `src/` off every path. env::set_current_dir("src").unwrap();
random_line_split
build.rs
extern crate serde_codegen; extern crate serde_json; extern crate glob; use std::env; use std::fs; use std::path::Path; /// generate an enum of Events fn main() { for entry in glob::glob("src/**/*.rs.in").expect("Failed to read glob pattern") { println!("cargo:rerun-if-changed={}", entry.unwrap().display(...
Err(e) => { panic!("Error globbing: {}", e); } } } }
{ let mut dst = Path::new(&out_dir).join(&src); // Change ".rs.in" to ".rs". dst.set_file_name(src.file_stem().expect("Failed to get file stem")); dst.set_extension("rs"); // Make sure our target directory exists. We only need ...
conditional_block
build.rs
extern crate serde_codegen; extern crate serde_json; extern crate glob; use std::env; use std::fs; use std::path::Path; /// generate an enum of Events fn main()
// Make sure our target directory exists. We only need // this if there are extra nested sudirectories under src/. fs::create_dir_all(dst.parent().unwrap()).unwrap(); // Process our source file. serde_codegen::expand(&src, &dst).unwrap();...
{ for entry in glob::glob("src/**/*.rs.in").expect("Failed to read glob pattern") { println!("cargo:rerun-if-changed={}", entry.unwrap().display()); } let out_dir = env::var_os("OUT_DIR").unwrap(); // Switch to our `src` directory so that we have the right base for our // globs, and so tha...
identifier_body