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 |
|---|---|---|---|---|
bgmacro.rs | lang_args.push(path);
}
// Set the working dir to the directory containing the invoking rs file so
// that clang searches for headers relative to it rather than the crate root
let filename = cx.codemap().span_to_filename(sp);
let mod_dir = Path::new(&filename).parent().unwrap();
let cwd = match... | }
}
if parser.check(&token::Eof) {
return args_good
}
if parser.eat(&token::Comma).is_err() {
cx.span_err(parser.span, "invalid argument format");
return false
}
}
}
// I'm sure there's a nicer way of doing it
fn as_str<'a>(o... | random_line_split | |
bgmacro.rs | information due to reparsing
let mut parser = parse::new_parser_from_source_str(cx.parse_sess(), cx.cfg(), "(Auto-generated bindings)".to_string(), bindings_str);
let mut items = Vec::new();
while let Some(item) = parser.parse_item() {
items.push(item);
... | MacroLogger | identifier_name | |
bgmacro.rs | lang_args.push(path);
}
// Set the working dir to the directory containing the invoking rs file so
// that clang searches for headers relative to it rather than the crate root
let filename = cx.codemap().span_to_filename(sp);
let mod_dir = Path::new(&filename).parent().unwrap();
let cwd = match... |
},
_ => {
cx.span_err(span, "invalid argument format");
return false
}
}
}
}
if parser.check(&token::Eof) {
return args_good
}
if parser.... | {
cx.span_err(span, "invalid argument");
args_good = false;
} | conditional_block |
SuggestBox_test.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as UI from '../../../../../front_end/ui/legacy/legacy.js';
const {assert} = chai;
class MockSuggestBoxDelegate implements UI.SuggestBox.Suggest... |
this.appliedSuggestions.push({suggestion: suggestion.text, isIntermediateSuggestion});
this.lastAppliedSuggestion = suggestion;
}
acceptSuggestion() {
this.accceptedSuggestions.push(this.lastAppliedSuggestion.text);
}
ariaControlledBy() {
return this.element;
}
}
const createKeyEvent = (ke... | {
throw new Error('All tests should pass a real suggestion to `applySuggestion`');
} | conditional_block |
SuggestBox_test.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as UI from '../../../../../front_end/ui/legacy/legacy.js';
const {assert} = chai;
class MockSuggestBoxDelegate implements UI.SuggestBox.Suggest... | (readonly element: HTMLElement) {
}
applySuggestion(suggestion: UI.SuggestBox.Suggestion|null, isIntermediateSuggestion?: boolean) {
if (!suggestion) {
throw new Error('All tests should pass a real suggestion to `applySuggestion`');
}
this.appliedSuggestions.push({suggestion: suggestion.text, isI... | constructor | identifier_name |
SuggestBox_test.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as UI from '../../../../../front_end/ui/legacy/legacy.js';
const {assert} = chai;
class MockSuggestBoxDelegate implements UI.SuggestBox.Suggest... |
applySuggestion(suggestion: UI.SuggestBox.Suggestion|null, isIntermediateSuggestion?: boolean) {
if (!suggestion) {
throw new Error('All tests should pass a real suggestion to `applySuggestion`');
}
this.appliedSuggestions.push({suggestion: suggestion.text, isIntermediateSuggestion});
this.las... | {
} | identifier_body |
SuggestBox_test.ts | // Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as UI from '../../../../../front_end/ui/legacy/legacy.js';
const {assert} = chai;
class MockSuggestBoxDelegate implements UI.SuggestBox.Suggest... | assert.deepStrictEqual(delegate.appliedSuggestions, []);
});
it('selects the highest priority item', () => {
suggestBox.updateSuggestions(
anchorBox, [{text: 'First'}, {text: 'Hello', priority: 2}, {text: 'The best suggestion', priority: 5}], true,
true, 'e');
assert.deepStrictEqual(
... | anchorBox, [{text: 'First'}, {text: 'Hello', priority: 2}, {text: 'The best suggestion', priority: 5}], false,
true, 'e');
| random_line_split |
consultingchange.ts | /**
* Created by InSuJeong on 2016-09-13.
*/
import { Component, AfterViewInit } from '@angular/core';
import { Router, ROUTER_DIRECTIVES, ActivatedRoute, Params } from '@angular/router';
import { CORE_DIRECTIVES, FORM_DIRECTIVES } from '@angular/common';
import { Http } from '@angular/http';
import { contentHeaders ... | implements AfterViewInit {
jwt:string;
decodedJwt: any;
public data;
idx: number;
public selectedId:number;
currentTitle: string;
currentPrefBizMemberIdx: number;
currentUserName: string;
currentTelephone: string;
currentEmail: string;
currentBuildType: string;
currentBuildPlace: string;
cur... | ConsultingChange | identifier_name |
consultingchange.ts | /**
* Created by InSuJeong on 2016-09-13.
*/
import { Component, AfterViewInit } from '@angular/core';
import { Router, ROUTER_DIRECTIVES, ActivatedRoute, Params } from '@angular/router';
import { CORE_DIRECTIVES, FORM_DIRECTIVES } from '@angular/common';
import { Http } from '@angular/http';
import { contentHeaders ... |
consultingchanging(event, title, buildType, userName, telephone, email, expectBuildPrice, buildPlace, buildPostCode, buildPlaceDetail, expectBuildTotalArea, expectBuildStartDate, expectConsultDate, reqContents){
event.preventDefault();
//lived에 들어갈 radio버튼에서 체크된 값 가져오기
var lived = $(':radio[name="opti... | }
);
} | random_line_split |
consultingchange.ts | /**
* Created by InSuJeong on 2016-09-13.
*/
import { Component, AfterViewInit } from '@angular/core';
import { Router, ROUTER_DIRECTIVES, ActivatedRoute, Params } from '@angular/router';
import { CORE_DIRECTIVES, FORM_DIRECTIVES } from '@angular/common';
import { Http } from '@angular/http';
import { contentHeaders ... | this.currentExpectBuildPrice = this.data.consult.expectBuildPrice;
this.currentExpectConsultDate = this.data.consult.expectConsultDate;
this.currentExpectBuildStartDate = this.data.consult.expectBuildStartDate;
this.currentReqContents = this.data.consult.reqContents;
},
... | L = [config.serverHost, config.path.consulting, this.selectedId].join('/');
this.http.get(URL, {headers:contentHeaders}) //서버로부터 필요한 값 받아오기
.map(res => res.json())//받아온 값을 json형식으로 변경
.subscribe(
response => {
this.data = response; // 해당값이 제대로 넘어오는지 확인후 프론트단에 내용추가
this.idx ... | identifier_body |
1_room_mentions_counter.py | ##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import UpdateHandler
from cspark.SQLiteContextEngine import SQLiteContextEngin... |
class Router(EventTypeRouter):
"""
Router should decide which message should be processed by which handler.
This router is inherited from EventTypeRouter which divide updates by their type.
For example this router set RoomMentionsCounterUpdateHandler for updates which are messages.
"""
new_mes... | )
| random_line_split |
1_room_mentions_counter.py | ##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import UpdateHandler
from cspark.SQLiteContextEngine import SQLiteContextEngin... |
else:
self.context.room['counter'] += 1
self.send_response(
MessageResponse("Room counter: " + str(self.context.room['counter']))
)
class Router(EventTypeRouter):
"""
Router should decide which message should be processed by which handler.
This router is ... | self.context.room['counter'] = 1 | conditional_block |
1_room_mentions_counter.py | ##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import UpdateHandler
from cspark.SQLiteContextEngine import SQLiteContextEngin... | (EventTypeRouter):
"""
Router should decide which message should be processed by which handler.
This router is inherited from EventTypeRouter which divide updates by their type.
For example this router set RoomMentionsCounterUpdateHandler for updates which are messages.
"""
new_message_handler ... | Router | identifier_name |
1_room_mentions_counter.py | ##########################################
# Check examples/0_simple_echo.py before #
##########################################
from cspark.Updater import Updater
from cspark.EventTypeRouter import EventTypeRouter
from cspark.UpdateHandler import UpdateHandler
from cspark.SQLiteContextEngine import SQLiteContextEngin... |
# Now we need to register router
updater.add_router(Router)
# And start "event loop"
updater.idle()
| """
Router should decide which message should be processed by which handler.
This router is inherited from EventTypeRouter which divide updates by their type.
For example this router set RoomMentionsCounterUpdateHandler for updates which are messages.
"""
new_message_handler = RoomMentionsCounterUp... | identifier_body |
sr-Latn.js | /*
* Globalize Culture sr-Latn
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this... | ".": ",",
symbol: "Din."
}
},
calendars: {
standard: {
"/": ".",
firstDay: 1,
days: {
names: ["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],
namesAbbr: ["ned","pon","uto","sre","čet","pet","sub"],
namesShort: ["ne","po","ut","sr","če","pe","su"]
},
... | currency: {
pattern: ["-n $","n $"],
",": ".",
| random_line_split |
entity-view.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import {CORE_DIRECTIVES} from '@angular/common';
import {TAB_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
import { EntitySummaryComponent } from... | directives: [
ROUTER_DIRECTIVES, TAB_DIRECTIVES, SectionComponent, EntitySummaryComponent, GridComponent
],
viewProviders: [EntityService, ContractsService],
})
export class EntityViewComponent implements OnInit {
entity: Object = {};
contracts: Object[];
constructor(private route: ActivatedRoute, pri... | templateUrl: 'entity-view.component.html',
styleUrls: ['entity-view.component.css'], | random_line_split |
entity-view.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import {CORE_DIRECTIVES} from '@angular/common';
import {TAB_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
import { EntitySummaryComponent } from... | (): void {
}
loadContracts(): void {
this.contractsService.getAll().subscribe((contracts: Object[]) => {
this.contracts = contracts;
});
}
config = {
"columns": [{ "name": "name", "header": "Name" },
{ "name": "description", "header": "Description" },
{ "name": "counterparty", "h... | ngAfterViewInit | identifier_name |
entity-view.component.ts | import { Component, OnInit, ViewChild } from '@angular/core';
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import {CORE_DIRECTIVES} from '@angular/common';
import {TAB_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
import { EntitySummaryComponent } from... |
loadContracts(): void {
this.contractsService.getAll().subscribe((contracts: Object[]) => {
this.contracts = contracts;
});
}
config = {
"columns": [{ "name": "name", "header": "Name" },
{ "name": "description", "header": "Description" },
{ "name": "counterparty", "header": "Count... | {
} | identifier_body |
dialog.module.js | (function (module) {
'use strict';
module.service("Dialog", dialogService);
module.constant("dialogMap", dialogMap());
function dialogMap() {
return {
'product-details': {
controller: 'ProductDetailsController',
templateUrl: '/views/widgets/product-d... | }
}
}).result;
}
};
}
})(ng.module('korann.modal', [])); | data: function () {
return ng.copy(data); | random_line_split |
dialog.module.js | (function (module) {
'use strict';
module.service("Dialog", dialogService);
module.constant("dialogMap", dialogMap());
function dialogMap() |
dialogService.$inject = ['$rootScope', '$modal', 'dialogMap'];
function dialogService($rootScope, $modal, dialogMap) {
return {
open: function (id, data, options) {
var dialogContext = dialogMap[id];
var scope = ng.extend($rootScope.$new(), {options: optio... | {
return {
'product-details': {
controller: 'ProductDetailsController',
templateUrl: '/views/widgets/product-details.html'
},
'category-details': {
controller: 'CategoryDetailsController',
templateUrl: '/views/wi... | identifier_body |
dialog.module.js | (function (module) {
'use strict';
module.service("Dialog", dialogService);
module.constant("dialogMap", dialogMap());
function | () {
return {
'product-details': {
controller: 'ProductDetailsController',
templateUrl: '/views/widgets/product-details.html'
},
'category-details': {
controller: 'CategoryDetailsController',
templateUrl: '/views... | dialogMap | identifier_name |
rule.ts | 3 Palantir Technologies, Inc.
*
* 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 to in ... |
public getFix() {
return this.fix;
}
public getRawLines() {
return this.rawLines;
}
public getRuleSeverity() {
return this.ruleSeverity;
}
public setRuleSeverity(value: RuleSeverity) {
this.ruleSeverity = value;
}
public toJson(): IRuleFailureJso... | {
return this.fix !== undefined;
} | identifier_body |
rule.ts | 3 Palantir Technologies, Inc.
*
* 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 to in ... |
/**
* A rule deprecation message, if applicable.
*/
deprecationMessage?: string;
/**
* A short, one line description of what the rule does.
*/
description: string;
/**
* More elaborate details about the rule.
*/
descriptionDetails?: string;
/**
* Whethe... | /**
* The type of the rule - its overall purpose
*/
type: RuleType; | random_line_split |
rule.ts | 3 Palantir Technologies, Inc.
*
* 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 to in ... |
return a.startPosition.getPosition() - b.startPosition.getPosition();
}
private readonly fileName: string;
private readonly startPosition: RuleFailurePosition;
private readonly endPosition: RuleFailurePosition;
private readonly rawLines: string;
private ruleSeverity: RuleSeverity;
... | {
return a.fileName < b.fileName ? -1 : 1;
} | conditional_block |
rule.ts | 3 Palantir Technologies, Inc.
*
* 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 to in ... | () {
return this.fix !== undefined;
}
public getFix() {
return this.fix;
}
public getRawLines() {
return this.rawLines;
}
public getRuleSeverity() {
return this.ruleSeverity;
}
public setRuleSeverity(value: RuleSeverity) {
this.ruleSeverity = v... | hasFix | identifier_name |
matrix.py | ):
"""
Data matrix class.
Methods:
- build: Build data matrix according to user input file specifications.
- reduce_dimension: Perform dimensionality reduction.
- cross_val: Perform cross-validation.
Attributes:
- user_choices: dict, user input choices
- snid: ... |
def plot(self, pcs, file_out, show=False, test=None):
"""
Plot 2-dimensional scatter of data matrix in kPCA space.
input: pcs, vector of int
kernel PCs to be used as horizontal and vertical axis
file_out, str
file name to store final pl... | """Determine final configuraton based on cross-validation results."""
#update optimized hyper-parameters
for par in self.user_choices['cross_val_par']:
indx = self.user_choices['cross_val_par'].index(par)
self.user_choices[par] = self.final[par]
#update low dimensional m... | identifier_body |
matrix.py | transf_test: function, project argument into KernelPC space
- final: vector, optimize parameter values
"""
def __init__(self, input_file=None):
"""
Read user input file.
input: input_file -> str
name of user input file
"""
self.datam = None
... | if len(test.samples_for_matrix) > 0:
plt.title('prob_Ia = ' + str(round(test['prob_Ia'], 2)))
if test.raw['SIM_NON1a:'][0] == '0':
sntype = 'Ia'
else:
sntype = 'nonIa'
plt.scatter([test.test_proj[0][pcs[0]]], [test.test_proj[0][pcs[1]... | conditional_block | |
matrix.py | = None
self.low_dim_matrix = None
self.transf_test = None
self.final = None
self.test_projection = []
if input_file is not None:
self.user_choices = read_user_input(input_file)
def check_file(self, filename, epoch=True, ref_filter=None):
"""
Con... | main | identifier_name | |
matrix.py | ):
"""
Data matrix class.
Methods:
- build: Build data matrix according to user input file specifications.
- reduce_dimension: Perform dimensionality reduction.
- cross_val: Perform cross-validation.
Attributes:
- user_choices: dict, user input choices
- snid: ... | Default is None
"""
screen('Fitting ' + filename, self.user_choices)
# translate identifier
self.user_choices['path_to_lc'] = [translate_snid(filename, self.user_choices['photon_flag'][0])[0]]
# read light curve raw data
raw = read_snana_lc(self.user_ch... | Reference filter for peak MJD calculation | random_line_split |
skipUntil.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { MonoTypeOper... | (value: T) {
if (this.hasValue) {
super._next(value);
}
}
notifyNext(outerValue: T, innerValue: R,
outerIndex: number, innerIndex: number,
innerSub: InnerSubscriber<T, R>): void {
this.hasValue = true;
if (this.innerSubscription) {
this.innerSubscription.unsubs... | _next | identifier_name |
skipUntil.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { MonoTypeOper... |
}
notifyNext(outerValue: T, innerValue: R,
outerIndex: number, innerIndex: number,
innerSub: InnerSubscriber<T, R>): void {
this.hasValue = true;
if (this.innerSubscription) {
this.innerSubscription.unsubscribe();
}
}
notifyComplete() {
/* do nothing */
}
}
| {
super._next(value);
} | conditional_block |
skipUntil.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { MonoTypeOper... |
constructor(destination: Subscriber<R>, notifier: ObservableInput<any>) {
super(destination);
this.add(this.innerSubscription = subscribeToResult(this, notifier));
}
protected _next(value: T) {
if (this.hasValue) {
super._next(value);
}
}
notifyNext(outerValue: T, innerValue: R,
... | */
class SkipUntilSubscriber<T, R> extends OuterSubscriber<T, R> {
private hasValue: boolean = false;
private innerSubscription: Subscription; | random_line_split |
skipUntil.ts | import { Operator } from '../Operator';
import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { MonoTypeOper... |
protected _next(value: T) {
if (this.hasValue) {
super._next(value);
}
}
notifyNext(outerValue: T, innerValue: R,
outerIndex: number, innerIndex: number,
innerSub: InnerSubscriber<T, R>): void {
this.hasValue = true;
if (this.innerSubscription) {
this.inner... | {
super(destination);
this.add(this.innerSubscription = subscribeToResult(this, notifier));
} | identifier_body |
http_api.py | #!/usr/bin/env python
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
from django import http
from werkzeug import exceptions as werkzeug_exceptions
from werkzeug import routing
import logging
from grr.gui import api_call_renderers
from grr.lib import access_control
from grr.lib i... | (request, supported_types):
"""Creates arguments objects from a given request dictionary."""
results = {}
for key, value in request.items():
try:
request_arg_type, request_attr = key.split(".", 1)
except ValueError:
continue
arg_class = None
for key, supported_type in supported_types... | FillAdditionalArgsFromRequest | identifier_name |
http_api.py | #!/usr/bin/env python
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
from django import http
from werkzeug import exceptions as werkzeug_exceptions
from werkzeug import routing
import logging
from grr.gui import api_call_renderers
from grr.lib import access_control
from grr.lib i... |
def RenderHttpResponse(request):
"""Handles given HTTP request with one of the available API renderers."""
renderer, route_args = GetRendererForHttpRequest(request)
if request.method == "GET":
if renderer.args_type:
unprocessed_request = request.GET
if hasattr(unprocessed_request, "dict"):
... | """Builds HTTPResponse object from rendered data and HTTP status."""
response = http.HttpResponse(status=status, content_type="application/json")
response.write(")]}'\n") # XSSI protection
response.write(json.dumps(rendered_data,
cls=JSONEncoderWithRDFPrimitivesSupport))
return res... | identifier_body |
http_api.py | #!/usr/bin/env python
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
from django import http
from werkzeug import exceptions as werkzeug_exceptions
from werkzeug import routing
import logging
from grr.gui import api_call_renderers
from grr.lib import access_control
from grr.lib i... |
return token
HTTP_ROUTING_MAP = routing.Map()
def RegisterHttpRouteHandler(method, route, renderer_cls):
"""Registers given ApiCallRenderer for given method and route."""
HTTP_ROUTING_MAP.add(routing.Rule(
route, methods=[method],
endpoint=renderer_cls))
def GetRendererForHttpRequest(request):
... | remote_addr = request.META.get(field, "")
if remote_addr:
token.source_ips.append(remote_addr) | conditional_block |
http_api.py | #!/usr/bin/env python
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
from django import http
from werkzeug import exceptions as werkzeug_exceptions
from werkzeug import routing
import logging
from grr.gui import api_call_renderers
from grr.lib import access_control
from grr.lib i... |
for field in ["REMOTE_ADDR", "HTTP_X_FORWARDED_FOR"]:
remote_addr = request.META.get(field, "")
if remote_addr:
token.source_ips.append(remote_addr)
return token
HTTP_ROUTING_MAP = routing.Map()
def RegisterHttpRouteHandler(method, route, renderer_cls):
"""Registers given ApiCallRenderer for gi... | token = access_control.ACLToken(
username=request.user,
reason=reason,
process="GRRAdminUI",
expiry=rdfvalue.RDFDatetime().Now() + execution_time) | random_line_split |
item.rs | // Evelyn: Your personal assistant, project manager and calendar
// Copyright (C) 2017 Gregory Jensen
//
// 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 3 of the License, or
//... | pub struct TodoListItemExternalModel {
pub text: String,
pub is_done: bool,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct AddItemTodoListRequestModel {
pub token: String,
pub todo_list_id: String,
pub todo_list_item: TodoListItemExternalModel,
}
#[derive... | random_line_split | |
item.rs | // Evelyn: Your personal assistant, project manager and calendar
// Copyright (C) 2017 Gregory Jensen
//
// 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 3 of the License, or
//... | {
pub text: String,
pub is_done: bool,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct TodoListItemExternalModel {
pub text: String,
pub is_done: bool,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct AddItemTodoListRe... | TodoListItemModel | identifier_name |
overloaded-calls-bad.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let mut s = S {
x: 3,
y: 3,
};
let ans = s("what"); //~ ERROR mismatched types
let ans = s(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
let ans = s("burma", "shave");
//~^ ERROR this function takes 1 parameter but 2 parameters were supplied
} | identifier_body | |
overloaded-calls-bad.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 ... | extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize {
self.x * self.y * z
}
}
fn main() {
let mut s = S {
x: 3,
y: 3,
};
let ans = s("what"); //~ ERROR mismatched types
let ans = s(); //~ ERROR this function takes 1 parameter but 0 parameters were supp... | y: isize,
}
impl FnMut<(isize,),isize> for S { | random_line_split |
overloaded-calls-bad.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let mut s = S {
x: 3,
y: 3,
};
let ans = s("what"); //~ ERROR mismatched types
let ans = s(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
let ans = s("burma", "shave");
//~^ ERROR this function takes 1 parameter but 2 parameters were supplied... | main | identifier_name |
trailing_zeros.rs | use malachite_base::num::basic::integers::PrimitiveInt;
use malachite_base::num::conversion::traits::WrappingFrom;
use malachite_base::num::logic::traits::TrailingZeros;
use malachite_base::slices::slice_leading_zeros;
use natural::InnerNatural::{Large, Small};
use natural::Natural;
use platform::Limb;
/// Interpretin... |
}
| {
match *self {
natural_zero!() => None,
Natural(Small(small)) => Some(TrailingZeros::trailing_zeros(small)),
Natural(Large(ref limbs)) => Some(limbs_trailing_zeros(limbs)),
}
} | identifier_body |
trailing_zeros.rs | use malachite_base::num::basic::integers::PrimitiveInt;
use malachite_base::num::conversion::traits::WrappingFrom;
use malachite_base::num::logic::traits::TrailingZeros;
use malachite_base::slices::slice_leading_zeros;
use natural::InnerNatural::{Large, Small};
use natural::Natural;
use platform::Limb;
/// Interpretin... | /// Time: worst case O(n)
///
/// Additional memory: worst case O(1)
///
/// where n = `self.significant_bits()`
///
/// # Examples
/// ```
/// extern crate malachite_base;
/// extern crate malachite_nz;
///
/// use malachite_base::num::basic::traits::Zero;
/// use ma... | impl Natural {
/// Returns the number of trailing zeros in the binary expansion of a `Natural` (equivalently,
/// the multiplicity of 2 in its prime factorization) or `None` is the `Natural` is 0.
/// | random_line_split |
trailing_zeros.rs | use malachite_base::num::basic::integers::PrimitiveInt;
use malachite_base::num::conversion::traits::WrappingFrom;
use malachite_base::num::logic::traits::TrailingZeros;
use malachite_base::slices::slice_leading_zeros;
use natural::InnerNatural::{Large, Small};
use natural::Natural;
use platform::Limb;
/// Interpretin... | (xs: &[Limb]) -> u64 {
let zeros = slice_leading_zeros(xs);
let remaining_zeros = TrailingZeros::trailing_zeros(xs[zeros]);
(u64::wrapping_from(zeros) << Limb::LOG_WIDTH) + remaining_zeros
}
impl Natural {
/// Returns the number of trailing zeros in the binary expansion of a `Natural` (equivalently,
... | limbs_trailing_zeros | identifier_name |
flipflops.server.routes.js | 'use strict';
/**
* Module dependencies
*/
var flipflopsPolicy = require('../policies/flipflops.server.policy'),
flipflops = require('../controllers/flipflops.server.controller');
module.exports = function(app) {
// Flipflops Routes
app.route('/api/flipflops').all(flipflopsPolicy.isAllowed)
.get(flipflops... | }; |
// Finish by binding the Flipflop middleware
app.param('flipflopId', flipflops.flipflopByID);
app.param('topicId', flipflops.topicByID); | random_line_split |
foo.rs | // Like the `long-linker-command-lines` test this test attempts to blow
// a command line limit for running the linker. Unlike that test, however,
// this test is testing `cmd.exe` specifically rather than the OS.
//
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
// in the grand scheme of things ... | let me = env::current_exe().unwrap();
let bat = me.parent()
.unwrap()
.join("foo.bat");
let bat_linker = format!("linker={}", bat.display());
for i in (1..).map(|i| i * 10) {
println!("attempt: {}", i);
let file = tmpdir.join("bar.rs");
let mut f = BufWriter::new... | {
if !cfg!(windows) {
return
}
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let ok = tmpdir.join("ok");
let not_ok = tmpdir.join("not_ok");
if env::var("YOU_ARE_A_LINKER").is_ok() {
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
So... | identifier_body |
foo.rs | // Like the `long-linker-command-lines` test this test attempts to blow
// a command line limit for running the linker. Unlike that test, however,
// this test is testing `cmd.exe` specifically rather than the OS.
//
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
// in the grand scheme of things ... | () {
if !cfg!(windows) {
return
}
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let ok = tmpdir.join("ok");
let not_ok = tmpdir.join("not_ok");
if env::var("YOU_ARE_A_LINKER").is_ok() {
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
... | main | identifier_name |
foo.rs | // Like the `long-linker-command-lines` test this test attempts to blow
// a command line limit for running the linker. Unlike that test, however,
// this test is testing `cmd.exe` specifically rather than the OS.
//
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
// in the grand scheme of things ... | }
} | }
break | random_line_split |
foo.rs | // Like the `long-linker-command-lines` test this test attempts to blow
// a command line limit for running the linker. Unlike that test, however,
// this test is testing `cmd.exe` specifically rather than the OS.
//
// Unfortunately `cmd.exe` has a 8192 limit which is relatively small
// in the grand scheme of things ... |
let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let ok = tmpdir.join("ok");
let not_ok = tmpdir.join("not_ok");
if env::var("YOU_ARE_A_LINKER").is_ok() {
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
Some(file) => {
let file = file.... | {
return
} | conditional_block |
TestMetaChangeFromDefault.py | # pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule
from ansiblelint.testing import RunFromText
DEFAULT_GALAXY_INFO = '''
galaxy_info:
author: your... | results = self.runner.run_role_meta_main(DEFAULT_GALAXY_INFO)
self.assertIn("Should change default metadata: author",
str(results))
self.assertIn("Should change default metadata: description",
str(results))
self.assertIn("Should change default metadata... | identifier_body | |
TestMetaChangeFromDefault.py | # pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule
from ansiblelint.testing import RunFromText
DEFAULT_GALAXY_INFO = '''
galaxy_info:
author: your... | (unittest.TestCase):
collection = RulesCollection()
collection.register(MetaChangeFromDefaultRule())
def setUp(self):
self.runner = RunFromText(self.collection)
def test_default_galaxy_info(self):
results = self.runner.run_role_meta_main(DEFAULT_GALAXY_INFO)
self.assertIn("Shou... | TestMetaChangeFromDefault | identifier_name |
TestMetaChangeFromDefault.py | # pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule
from ansiblelint.testing import RunFromText | DEFAULT_GALAXY_INFO = '''
galaxy_info:
author: your name
description: your description
company: your company (optional)
license: license (GPLv2, CC-BY, etc)
'''
class TestMetaChangeFromDefault(unittest.TestCase):
collection = RulesCollection()
collection.register(MetaChangeFromDefaultRule())
def ... | random_line_split | |
test-carddav.py | #!/usr/bin/python
from config import hostname, port, username, password
import carddav
import sogotests
import unittest
import webdavlib
import time
class JsonDavEventTests(unittest.TestCase):
def setUp(self):
self._connect_as_user()
def _connect_as_user(self, newuser=username, newpassword=passwor... |
def _testMultiplePhones(self, phones):
""" Add Multiple Phones to Contact JSON and verify with DAV """
#- Use JSON to get CARD and add a phone and save it back
self._get_card()
oldphones = self.card['phones']
oldphones.extend(phones)
self._save_card()
#- Mak... | return "TEL;TYPE=%s:%s" % (phonedict['type'], phonedict['value']) | identifier_body |
test-carddav.py | #!/usr/bin/python
from config import hostname, port, username, password
import carddav
import sogotests
import unittest
import webdavlib
import time
class JsonDavEventTests(unittest.TestCase):
def setUp(self):
self._connect_as_user()
def _connect_as_user(self, newuser=username, newpassword=passwor... | (self):
self._testMultiplePhones(self.newphones_sametype)
if __name__ == "__main__":
sogotests.runTests()
| testMultipleSameTypePhones | identifier_name |
test-carddav.py | #!/usr/bin/python
from config import hostname, port, username, password
import carddav
import sogotests
import unittest
import webdavlib
import time
class JsonDavEventTests(unittest.TestCase):
def setUp(self):
self._connect_as_user()
def _connect_as_user(self, newuser=username, newpassword=passwor... |
def _get_dav_data(self, filename, user=username, passwd=password):
w = webdavlib.WebDAVClient(hostname, port, user, passwd)
query = webdavlib.HTTPGET("http://localhost/SOGo/dav/%s/Contacts/personal/%s" % (username, filename))
w.execute(query)
self.assertEquals(query.response['statu... | self.dv.save_card(self.card) | conditional_block |
test-carddav.py | #!/usr/bin/python
from config import hostname, port, username, password
import carddav
import sogotests
import unittest
import webdavlib
import time |
def _connect_as_user(self, newuser=username, newpassword=password):
self.dv = carddav.Carddav(newuser, newpassword)
def _create_new_event(self, path):
gid = self.dv.newguid(path)
event = {'startDate': "2015-12-25",
'startTime': "10:00",
'endDate': "2... |
class JsonDavEventTests(unittest.TestCase):
def setUp(self):
self._connect_as_user() | random_line_split |
PlasmidDetailsCard.tsx | import React from "react"
import Box from "@material-ui/core/Box"
import Grid from "@material-ui/core/Grid"
import Card from "@material-ui/core/Card"
import List from "@material-ui/core/List"
import ListItem from "@material-ui/core/ListItem"
import Typography from "@material-ui/core/Typography"
import DetailsListItem f... | <Grid item>
<Availability cartData={cartData} inStock={inStock} />
</Grid>
</Grid>
</Grid>
</ListItem>
{rows.map((data: DetailsRow) => (
<DetailsListItem
title={data.title}
... | random_line_split | |
hudsonMasterComputermonitorData.ts | /**
* Swaggy Jenkins
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: blah@cliffano.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not ed... | hudson_node_monitors_ResponseTimeMonitor?: ResponseTimeMonitorData;
hudson_node_monitors_ClockMonitor?: ClockDifference;
_class?: string;
} | hudson_node_monitors_SwapSpaceMonitor?: SwapSpaceMonitorMemoryUsage2;
hudson_node_monitors_TemporarySpaceMonitor?: DiskSpaceMonitorDescriptorDiskSpace;
hudson_node_monitors_DiskSpaceMonitor?: DiskSpaceMonitorDescriptorDiskSpace;
hudson_node_monitors_ArchitectureMonitor?: string; | random_line_split |
user.service.ts | import {Injectable} from '@angular/core';
import { User } from './user';
@Injectable()
export class UserService {
getUsers():User[] | address: {
street: "Solmsstr.",
streetnumber: "41",
city: "Frankfurt",
zipcode: "60486",
}
};
let homeless: User = {
id: 4,
avatar: "",
email: "",
name: "Nobody",
phone: "",
address: undefined
};
... | {
let christian: User = {
id: 1,
avatar: "",
email: " christian.scheil@pentasys.de",
name: "Christian",
phone: "",
address: {
street: "Rothenburger Straße",
streetnumber: "116",
city: "Nürnber... | identifier_body |
user.service.ts | import {Injectable} from '@angular/core';
import { User } from './user';
@Injectable()
export class UserService {
getUsers():User[] {
let christian: User = {
id: 1,
avatar: "",
email: " christian.scheil@pentasys.de",
name: "Christian",
phone: "",... | };
return [christian, dennis, homeless];
}
} | name: "Nobody",
phone: "",
address: undefined | random_line_split |
user.service.ts | import {Injectable} from '@angular/core';
import { User } from './user';
@Injectable()
export class | {
getUsers():User[] {
let christian: User = {
id: 1,
avatar: "",
email: " christian.scheil@pentasys.de",
name: "Christian",
phone: "",
address: {
street: "Rothenburger Straße",
streetnumber: "116",
... | UserService | identifier_name |
standard.rs | use std::sync::Arc;
use std::marker::PhantomData;
use par_exec::{Executor, WorkAmount, JobIterBuild, ExecutorJobError, JobExecuteError};
use super::PopulationFit;
use super::super::individual::IndividualManager;
use super::super::super::set::{Set, SetManager};
use super::super::super::set::union;
pub trait RetrieveFi... | <WA>(&self, population: Arc<Self::Pop>, exec: &mut Self::Exec) -> Result<Self::Fits, Self::Err>
where WA: WorkAmount, <Self::Exec as Executor>::JIB: JobIterBuild<WA>
{
let population_size = population.size();
match exec.try_execute_job(
WA::new(population_size),
move ... | fit | identifier_name |
standard.rs | use std::sync::Arc;
use std::marker::PhantomData;
use par_exec::{Executor, WorkAmount, JobIterBuild, ExecutorJobError, JobExecuteError};
use super::PopulationFit;
use super::super::individual::IndividualManager;
use super::super::super::set::{Set, SetManager};
use super::super::super::set::union;
pub trait RetrieveFi... |
}
| {
let exec: ParallelExecutor<_> = Default::default();
let mut exec = exec.start(|| LocalContext {
set_manager: set::vec::Manager::new(),
indiv_manager: IndivManager,
}).unwrap();
use std::sync::Arc;
let population = Arc::new((0 .. 1024).collect::<Vec<_>>(... | identifier_body |
standard.rs | use std::sync::Arc;
use std::marker::PhantomData;
use par_exec::{Executor, WorkAmount, JobIterBuild, ExecutorJobError, JobExecuteError};
use super::PopulationFit;
use super::super::individual::IndividualManager;
use super::super::super::set::{Set, SetManager};
use super::super::super::set::union;
pub trait RetrieveFi... | }
}
struct LocalContext {
set_manager: set::vec::Manager<(f64, usize)>,
indiv_manager: IndivManager,
}
impl RetrieveFitsManager for LocalContext {
type FitsM = set::vec::Manager<(f64, usize)>;
fn retrieve(&mut self) -> &mut Self::FitsM {
&mut self.s... | }
fn fitness(&mut self, indiv: &Self::I) -> Result<Self::FI, Self::E> {
Ok(1.0 / *indiv as f64) | random_line_split |
Cell.py | from Stimulant import *
import pandas as pd
class Cell(object):
"""docstring for Cell"""
def __init__(self):
self.stimulants = {}
self.stimulant = Stimulant()
self.p1 = Point()
self.p2 = Point()
self.p1.x = 0
self.p1.y = 0
self.p2.x = 0
self.... | return description | for s in self.stimulants:
description += ' >> ' + self.stimulants[s].description() + '\n' | random_line_split |
Cell.py | from Stimulant import *
import pandas as pd
class Cell(object):
"""docstring for Cell"""
def __init__(self):
self.stimulants = {}
self.stimulant = Stimulant()
self.p1 = Point()
self.p2 = Point()
self.p1.x = 0
self.p1.y = 0
self.p2.x = 0
self.... | (self, x, y, name):
self.p2.x = x
self.p2.y = y
self.stimulant.p2 = self.p2
self.stimulant.name = name
self.stimulants[name] = self.stimulant
del(self.stimulant)
del(self.p1)
del(self.p2)
self.stimulant = Stimulant()
self.p1 = Point()
... | addSecondPointWithName | identifier_name |
Cell.py | from Stimulant import *
import pandas as pd
class Cell(object):
"""docstring for Cell"""
def __init__(self):
self.stimulants = {}
self.stimulant = Stimulant()
self.p1 = Point()
self.p2 = Point()
self.p1.x = 0
self.p1.y = 0
self.p2.x = 0
self.... |
return {'bp': pd.DataFrame.from_dict({self.cellname: bpdict}), 'g': pd.DataFrame.from_dict({self.cellname: gdict})}
def describe(self):
description = ''
for s in self.stimulants:
description += ' >> ' + self.stimulants[s].description() + '\n'
return description
| bpdict[self.stimulants[s].name] = self.stimulants[s].basalToPeak()
gdict[self.stimulants[s].name] = self.stimulants[s].gradient() | conditional_block |
Cell.py | from Stimulant import *
import pandas as pd
class Cell(object):
"""docstring for Cell"""
def __init__(self):
self.stimulants = {}
self.stimulant = Stimulant()
self.p1 = Point()
self.p2 = Point()
self.p1.x = 0
self.p1.y = 0
self.p2.x = 0
self.... |
def makePandasDF(self):
bpdict = {}
gdict = {}
for s in self.stimulants:
bpdict[self.stimulants[s].name] = self.stimulants[s].basalToPeak()
gdict[self.stimulants[s].name] = self.stimulants[s].gradient()
return {'bp': pd.DataFrame.from_dict({self.cellname: bp... | self.p2.x = x
self.p2.y = y
self.stimulant.p2 = self.p2
self.stimulant.name = name
self.stimulants[name] = self.stimulant
del(self.stimulant)
del(self.p1)
del(self.p2)
self.stimulant = Stimulant()
self.p1 = Point()
self.p2 = Point() | identifier_body |
typeck-default-trait-impl-trait-where-clause.rs | // Copyright 2015 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 ... | {
foo::<i32>();
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
} | identifier_body | |
typeck-default-trait-impl-trait-where-clause.rs | // Copyright 2015 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 ... | //~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
}
fn main() {
foo::<i32>();
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
} | fn test() {
bar::<Option<i32>>(); | random_line_split |
typeck-default-trait-impl-trait-where-clause.rs | // Copyright 2015 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 ... | <T:NotImplemented>() { }
fn test() {
bar::<Option<i32>>();
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
}
fn main() {
foo::<i32>();
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
}
| bar | identifier_name |
template.py | import Logger
import os
# The following five lines of code MUST ABSOLUTELY appear in this order. DO NOT MOVE OR CHANGE THE FOLLOWING FOUR LINES OF CODE.
# Logger.initPins() Should never be called by the user. It should only be called when this script is automatically run.
Logger.init() # Initialzie the Logger Pytho... | # 9 Data Byte
# 10 Data Byte
# ... ...
if (dataTuple[0] == Logger.bufferMax()): # This means that the Pi was turned on by the Datalogger, not a user, so it should turn itself off.
Logger.setPowerOff() # Tell the AVR datalogger that the Raspberry Pi is shutting down.
os.system("sudo poweroff") # Shut down t... | # 4 Hour logging started
# 5 Minute logging started
# 6 Second logging started
# 7 Data Byte
# 8 Data Byte | random_line_split |
template.py | import Logger
import os
# The following five lines of code MUST ABSOLUTELY appear in this order. DO NOT MOVE OR CHANGE THE FOLLOWING FOUR LINES OF CODE.
# Logger.initPins() Should never be called by the user. It should only be called when this script is automatically run.
Logger.init() # Initialzie the Logger Pytho... | Logger.setPowerOff() # Tell the AVR datalogger that the Raspberry Pi is shutting down.
os.system("sudo poweroff") # Shut down the Raspberry Pi | conditional_block | |
crypto.js | /**
* Crypto module for Geierlein.
*
* @author Stefan Siegl
*
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
*
* 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 Software Foundation, either ve... | p7.decrypt(key.copy());
/* Covert Forge buffer to gzipJS buffer (array of bytes). */
var gzippedData = [];
while(!p7.content.isEmpty()) {
gzippedData.push(p7.content.getByte());
}
/* Gunzip and replace back into pieces. */
pieces[2] = gzipjs.charArra... | {
var pieces = data.split(regex);
if(pieces.length !== 5) {
return;
}
var encBlock = pieces[2].replace(/[\r\n]*/g, '');
if(encBlock === '') {
/* On error <DatenTeil> is in some cases returned empty. */
return;
}
/* Base64-deco... | identifier_body |
crypto.js | /**
* Crypto module for Geierlein.
*
* @author Stefan Siegl
*
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
*
* 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 Software Foundation, either ve... |
var crypto = geierlein.crypto = geierlein.crypto || {};
/**
* The X.509 certificate with the Elster project's public key.
*
* The public key is used to encrypt the tax case.
*/
var elsterPem = '-----BEGIN CERTIFICATE-----\n' +
'MIIDKjCCAhICAQAwDQYJKoZIhvcNAQEEBQAwWTELMAkGA1UEBhMCREUxDzANBgNV\n' +... | {
geierlein = {
};
module.exports = geierlein.crypto = {};
gzipjs = require('../gzip-js/lib/gzip.js');
forge = require('../forge/js/forge.js');
} | conditional_block |
crypto.js | /**
* Crypto module for Geierlein.
*
* @author Stefan Siegl
*
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
*
* 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 Software Foundation, either ve... | };
module.exports = geierlein.crypto = {};
gzipjs = require('../gzip-js/lib/gzip.js');
forge = require('../forge/js/forge.js');
}
var crypto = geierlein.crypto = geierlein.crypto || {};
/**
* The X.509 certificate with the Elster project's public key.
*
* The public key is used to encrypt the tax ... | else if(typeof(module) !== 'undefined' && module.exports) {
geierlein = {
| random_line_split |
crypto.js | /**
* Crypto module for Geierlein.
*
* @author Stefan Siegl
*
* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
*
* 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 Software Foundation, either ve... | (regex) {
var pieces = data.split(regex);
if(pieces.length !== 5) {
return;
}
var encBlock = pieces[2].replace(/[\r\n]*/g, '');
if(encBlock === '') {
/* On error <DatenTeil> is in some cases returned empty. */
return;
}
/* Bas... | decryptBlock | identifier_name |
mailgun.py | def | ():
return requests.post(
"https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages",
auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>",
"to": "ni... | send_simple_message | identifier_name |
mailgun.py | def send_simple_message():
|
# cURL command to send mail aith API key
# curl -s --user 'api:key-679dc79b890e700f11f001a6bf86f4a1' \
# https://api.mailgun.net/v3/mail.pdxpixel.com/messages \
# -F from='Excited User <mailgun@pdxpixel.com>' \
# -F to=nick@pdxpixel.com \
# -F subject='Hello' \
# -F text='Testing some Mailgun awe... | return requests.post(
"https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages",
auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>",
"to": "nick <nico... | identifier_body |
mailgun.py | def send_simple_message():
return requests.post(
"https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages",
auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>",
... | # -F text='Testing some Mailgun awesomness!' | # https://api.mailgun.net/v3/mail.pdxpixel.com/messages \
# -F from='Excited User <mailgun@pdxpixel.com>' \
# -F to=nick@pdxpixel.com \
# -F subject='Hello' \ | random_line_split |
dependentRegistration.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
private update(api: API) {
this._registration.update(api.gte(this.minVersion));
}
}
export class ConfigurationDependentRegistration extends Disposable {
private readonly _registration: ConditionalRegistration;
constructor(
private readonly language: string,
private readonly configValue: string,
registe... | {
super.dispose();
this._registration.dispose();
} | identifier_body |
dependentRegistration.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | ) { }
public dispose() {
if (this.registration) {
this.registration.dispose();
this.registration = undefined;
}
}
public update(enabled: boolean) {
if (enabled) {
if (!this.registration) {
this.registration = this._doRegister();
}
} else {
if (this.registration) {
this.registration.... | private registration: vscode.Disposable | undefined = undefined;
public constructor(
private readonly _doRegister: () => vscode.Disposable | random_line_split |
dependentRegistration.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}
}
}
export class VersionDependentRegistration extends Disposable {
private readonly _registration: ConditionalRegistration;
constructor(
private readonly client: ITypeScriptServiceClient,
private readonly minVersion: API,
register: () => vscode.Disposable,
) {
super();
this._registration = new Cond... | {
this.registration.dispose();
this.registration = undefined;
} | conditional_block |
dependentRegistration.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | () {
super.dispose();
this._registration.dispose();
}
private update() {
const config = vscode.workspace.getConfiguration(this.language, null);
this._registration.update(!!config.get<boolean>(this.configValue));
}
}
| dispose | identifier_name |
export_all_graphml.py | # Albert Cardona 2014-11-20
# This file is meant to be run from within ./manage.py shell in the environment, like:
# [1] load export_all_graphml.py
# [2] project_id = 12
# [2] export(project_id, "all.graphml")
#
# Will generate a gzip'ed file like "all.graphml.gz"
#
# Includes all skeletons with more than 1 treenode;
#... |
@transaction.atomic
def export(project_id, filename):
project_id = int(project_id)
cursor = connection.cursor()
with gzip.open(filename + '.gz', 'w') as file:
file.write('''<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www... | file.write('<edge id="e%s" directed="false" source="n%s" target="n%s" />\n' % (row[0], row[0], row[1])) | conditional_block |
export_all_graphml.py | # Albert Cardona 2014-11-20
# This file is meant to be run from within ./manage.py shell in the environment, like:
# [1] load export_all_graphml.py
# [2] project_id = 12
# [2] export(project_id, "all.graphml")
#
# Will generate a gzip'ed file like "all.graphml.gz"
#
# Includes all skeletons with more than 1 treenode;
#... | (project_id, filename):
project_id = int(project_id)
cursor = connection.cursor()
with gzip.open(filename + '.gz', 'w') as file:
file.write('''<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"... | export | identifier_name |
export_all_graphml.py | # Albert Cardona 2014-11-20
# This file is meant to be run from within ./manage.py shell in the environment, like:
# [1] load export_all_graphml.py
# [2] project_id = 12
# [2] export(project_id, "all.graphml")
#
# Will generate a gzip'ed file like "all.graphml.gz"
#
# Includes all skeletons with more than 1 treenode;
#... |
@transaction.atomic
def export(project_id, filename):
project_id = int(project_id)
cursor = connection.cursor()
with gzip.open(filename + '.gz', 'w') as file:
file.write('''<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www... | cursor.execute('''
select id, parent_id, location_x, location_y, location_z
from treenode
where skeleton_id=%s
''' % skid)
for row in cursor.fetchall():
file.write('''<node id="n%s">
<data key="skid">%s</data>
<data key="x">%s</data>
<data key="y">%s</data>
<data key="z">%s</data>
</node>\n... | identifier_body |
export_all_graphml.py | # Albert Cardona 2014-11-20
# This file is meant to be run from within ./manage.py shell in the environment, like:
# [1] load export_all_graphml.py
# [2] project_id = 12
# [2] export(project_id, "all.graphml") | #
# Includes all skeletons with more than 1 treenode;
# each skeleton is an undirected graph, where each treenode is a node
# (with the skeleton ID and the location as extra attributes)
# and each relationship between child and parent treenodes is an undirected edge
# that has the skeleton ID as an extra attribute.
# E... | #
# Will generate a gzip'ed file like "all.graphml.gz" | random_line_split |
pagination.style.ts | export const PAGINATION_STYLE = `
.pagination-box {
position: relative;
margin-top: -10px;
display: block;
height: 30px;
}
.pagination-range {
margin-top: 7px;
margin-left: 3px;
display: inline-block;
}
.pagination-controllers {
float: right;
}
.pagination-controllers input { | min-width: 60px;
/*padding: 1px 0px 0px 5px;*/
text-align: right;
}
.pagination-limit {
margin-right: 25px;
display: inline-table;
width: 150px;
float: left;
}
.pagination-pages {
display: inline-block;
}
.pagination-page {
display: inline-table;
}
.pagination-box button {
outli... | random_line_split | |
connection.rs | use std::ptr;
use std::ffi::CString;
use error::{RuntimeError, ErrorKind};
use super::super::x11::ScreenID;
use super::ffi;
use super::screen::Screen;
use super::XID;
use super::event::{Event, EventIterator};
use super::atom::{InternAtomCookie, InternAtomReply};
pub struct Connection {
pub ptr: *mut ffi::xcb_co... |
pub fn flush(&self) {
unsafe {
ffi::xcb_flush(self.ptr);
}
}
pub fn intern_atom(&self, name: &str, existing_only: bool) -> InternAtomCookie {
let c_name = CString::new(name).unwrap();
let xcb_cookie = unsafe {
ffi::xcb_intern_atom(
self.ptr,
... | {
EventIterator::new(self.ptr)
} | identifier_body |
connection.rs | use std::ptr;
use std::ffi::CString;
use error::{RuntimeError, ErrorKind};
use super::super::x11::ScreenID;
use super::ffi;
use super::screen::Screen;
use super::XID;
use super::event::{Event, EventIterator};
use super::atom::{InternAtomCookie, InternAtomReply};
pub struct Connection {
pub ptr: *mut ffi::xcb_co... | (&self, screen_id: &ScreenID) -> Result<Screen, RuntimeError> {
let setup = unsafe { ffi::xcb_get_setup(self.ptr) };
if setup == ptr::null() {
return Err(RuntimeError::new(
ErrorKind::XCB,
"Getting XCB connection setup failed".to_string()
));
}
let mut... | screen_of_display | identifier_name |
connection.rs | use std::ptr;
use std::ffi::CString;
use error::{RuntimeError, ErrorKind};
use super::super::x11::ScreenID;
use super::ffi;
use super::screen::Screen;
use super::XID;
use super::event::{Event, EventIterator};
use super::atom::{InternAtomCookie, InternAtomReply};
pub struct Connection {
pub ptr: *mut ffi::xcb_co... |
None
}
}
| {
return Some(
unsafe {
(*error).error_code
}
)
} | conditional_block |
connection.rs | use std::ptr;
use std::ffi::CString;
use error::{RuntimeError, ErrorKind};
use super::super::x11::ScreenID;
use super::ffi;
use super::screen::Screen;
use super::XID;
use super::event::{Event, EventIterator};
use super::atom::{InternAtomCookie, InternAtomReply};
pub struct Connection {
pub ptr: *mut ffi::xcb_co... | Ok(XID {
id: id
})
}
pub fn wait_for_event(&self) -> Option<Event> {
let event_ptr = unsafe {
ffi::xcb_wait_for_event(self.ptr)
};
if event_ptr.is_null() {
return None;
}
Some(
Event::new(event_ptr)
)
}
pub fn poll_event... | ErrorKind::XCB,
"Generating XID failed".to_string()
));
}
| random_line_split |
ssdp.py | """Automatically generated by hassfest.
To update, run python3 -m script.hassfest
"""
# fmt: off
SSDP = {
"deconz": [
{
"manufacturer": "Royal Philips Electronics"
}
],
"heos": [
{
"st": "urn:schemas-denon-com:device:ACT-Denon:1"
}
],
"huawe... | ],
"wemo": [
{
"manufacturer": "Belkin International Inc."
}
]
} | random_line_split | |
forums.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: forums.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2016-12-17 13:12:23 (CST)
# Last Update:星期五 2017-11-10 11:04:16 (CST)
# By:
#... | s TagView(BaseView):
column_searchable_list = ['name']
form_excluded_columns = ('topics', 'followers')
def init_admin(admin):
admin.add_view(
BoardView(
Board,
db.session,
name='管理版块',
endpoint='admin_board',
category='管理社区'))
admin.a... | cluded_columns = ('topics')
clas | identifier_body |
forums.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: forums.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2016-12-17 13:12:23 (CST)
# Last Update:星期五 2017-11-10 11:04:16 (CST)
# By:
#... | category='管理社区'))
admin.add_view(
TagView(
Tags,
db.session,
name='管理节点',
endpoint='admin_tag',
category='管理社区')) | Board,
db.session,
name='管理版块',
endpoint='admin_board', | random_line_split |
forums.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: forums.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2016-12-17 13:12:23 (CST)
# Last Update:星期五 2017-11-10 11:04:16 (CST)
# By:
#... | ew):
column_searchable_list = ['name']
form_excluded_columns = ('topics', 'followers')
def init_admin(admin):
admin.add_view(
BoardView(
Board,
db.session,
name='管理版块',
endpoint='admin_board',
category='管理社区'))
admin.add_view(
... | (BaseVi | identifier_name |
resource_thread.rs | -> ProgressSender {
start_sending_sniffed_opt(start_chan, metadata, classifier, partial_body, context).ok().unwrap()
}
/// For use by loaders in responding to a Load message that allows content sniffing.
pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadata,... | network_error: Option<NetworkError>) -> Result<ProgressSender, ()> {
match start_chan {
LoadConsumer::Channel(start_chan) => {
let (progress_chan, progress_port) = ipc::channel().unwrap();
let result = start_chan.send(LoadResponse {
metadata: meta... | fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata, | random_line_split |
resource_thread.rs | .content_type = Some(ContentType(Mime(mime_tp, mime_sb, vec![])));
}
start_sending_opt(start_chan, metadata, None)
}
/// For use by loaders in responding to a Load message.
/// It takes an optional NetworkError, so that we can extract the SSL Validation errors
/// and take it to the HTML parser
fn start_sendi... | CancellableResource | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.