file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
Scene.ts | import {Frame} from "./Frame";
export interface SceneParameters {
label: string;
frames: Frame[];
}
/**
* シーンデータ。
*/
export class Scene {
private _index: number;
private _label: string;
frames: Frame[];
constructor(params: SceneParameters) {
this._index = 0;
this._label = params.label;
this... | * フレームインデックスを再設定する。
*
* @param index
*/
reset(index?: number) {
this._index = index ? index : 0;
}
} | random_line_split | |
Scene.ts | import {Frame} from "./Frame";
export interface SceneParameters {
label: string;
frames: Frame[];
}
/**
* シーンデータ。
*/
export class Scene {
private _index: number;
private _label: string;
frames: Frame[];
constructor(params: SceneParameters) {
this._index = 0;
this._label = params.label;
this... | return undefined;
}
}
/**
* 次のフレームに遷移する。
*/
next() {
if (this._index < this.frames.length) {
this._index++;
}
}
/**
* フレームインデックスを再設定する。
*
* @param index
*/
reset(index?: number) {
this._index = index ? index : 0;
}
}
| this.frames[this._index];
} else {
| conditional_block |
Scene.ts | import {Frame} from "./Frame";
export interface SceneParameters {
label: string;
frames: Frame[];
}
/**
* シーンデータ。
*/
export class Scene {
private _index: number;
private _label: string;
frames: Frame[];
constructor(pa | Parameters) {
this._index = 0;
this._label = params.label;
this.frames = params.frames;
}
get index() {
return this._index;
}
get label() {
return this._label;
}
get frame() {
if (this._index < this.frames.length) {
return this.frames[this._index];
} else {
return ... | rams: Scene | identifier_name |
Ashkhabad.py | '''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Ashkhabad(DstTzInfo):
|
Ashkhabad = Ashkhabad()
| '''Asia/Ashkhabad timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Ashkhabad'
_utc_transition_times = [
d(1,1,1,0,0,0),
d(1924,5,1,20,6,28),
d(1930,6,20,20,0,0),
d(1981,3,31,19,0,0),
d(1981,9,30,18,0,0),
d(1982,3,31,19,0,0),
d(1982,9,30,18,0,0),
d(1983,3,31,19,0,0),
d(1983,9,30,18,0,0),
d(... | identifier_body |
Ashkhabad.py | '''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Ashkhabad(DstTzInfo):
'''Asia/Ashkhabad timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Ashkhabad'
... | d(1987,9,26,21,0,0),
d(1988,3,26,21,0,0),
d(1988,9,24,21,0,0),
d(1989,3,25,21,0,0),
d(1989,9,23,21,0,0),
d(1990,3,24,21,0,0),
d(1990,9,29,21,0,0),
d(1991,3,30,21,0,0),
d(1991,9,28,22,0,0),
d(1991,10,26,20,0,0),
d(1992,1,18,22,0,0),
]
_transition_info = [
i(14040,0,'LMT'),
i(14400,0,'ASHT'),
i(18000,0,'ASHT... | random_line_split | |
Ashkhabad.py | '''tzinfo timezone information for Asia/Ashkhabad.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class | (DstTzInfo):
'''Asia/Ashkhabad timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Ashkhabad'
_utc_transition_times = [
d(1,1,1,0,0,0),
d(1924,5,1,20,6,28),
d(1930,6,20,20,0,0),
d(1981,3,31,19,0,0),
d(1981,9,30,18,0,0),
d(1982,3,31,19,0,0),
d(1982,9,30,18,0,0),
d(1983,3,31,19,0,0),
d(1983... | Ashkhabad | identifier_name |
views.py | # 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 writing, software
# distributed under t... | (self, *args, **kwargs):
rbac_policy_id = self.kwargs['rbac_policy_id']
try:
return api.neutron.rbac_policy_get(self.request, rbac_policy_id)
except Exception:
redirect = self.success_url
msg = _('Unable to retrieve rbac policy details.')
exception... | _get_object | identifier_name |
views.py | # 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 writing, software
# distributed under t... | from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from horizon import tables
from horizon import tabs
from horizon.utils import memoized
from openstack_dashboard import api
from openstack_d... | random_line_split | |
views.py | # 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 writing, software
# distributed under t... |
def get_data(self):
try:
rbac_policies = api.neutron.rbac_policy_list(self.request)
except Exception:
rbac_policies = []
messages.error(self.request,
_("Unable to retrieve RBAC policies."))
if rbac_policies:
tenant_... | qos_policies = []
try:
if api.neutron.is_extension_supported(self.request,
extension_alias='qos'):
qos_policies = api.neutron.policy_list(self.request)
except Exception:
msg = _("Unable to retrieve information abou... | identifier_body |
views.py | # 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 writing, software
# distributed under t... |
except Exception:
msg = _("Unable to retrieve information about the "
"policies' qos policies.")
exceptions.handle(self.request, msg)
return dict((q.id, q.name) for q in qos_policies)
def get_data(self):
try:
rbac_policies = api.neutr... | qos_policies = api.neutron.policy_list(self.request) | conditional_block |
checkbox-button.spec.ts | import { TestBed, ComponentFixture } from '@angular/core/testing'; | import { NglCheckboxesModule } from '../module';
const createTestComponent = (html?: string, detectChanges?: boolean) =>
createGenericTestComponent(TestComponent, html, detectChanges) as ComponentFixture<TestComponent>;
function getInputElement(element: Element): HTMLInputElement {
return <HTMLInputElement>elemen... | import { Component } from '@angular/core';
import { createGenericTestComponent } from '../../../../test/util'; | random_line_split |
checkbox-button.spec.ts | import { TestBed, ComponentFixture } from '@angular/core/testing';
import { Component } from '@angular/core';
import { createGenericTestComponent } from '../../../../test/util';
import { NglCheckboxesModule } from '../module';
const createTestComponent = (html?: string, detectChanges?: boolean) =>
createGenericTestC... | (element: Element): HTMLLabelElement {
return <HTMLLabelElement>element.querySelector('.slds-assistive-text');
}
describe('`NglCheckboxButton`', () => {
beforeEach(() => TestBed.configureTestingModule({ declarations: [TestComponent], imports: [NglCheckboxesModule]}));
it('should render correctly', () => {
... | getAssistiveElement | identifier_name |
bbc-radio.js | (function (exports) {
'use strict';
var obj = {
playlistFormat: 'http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/$station/format/pls.pls',
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: fun... | else {
console.log('o', obj);
playlistUrl = obj.playlistFormat.replace('$station', station);
resolve(playlistUrl);
}
});
},
extractStreamForUrl: function (url) {
return obj.fetchPlsForUrl(url)
.then(obj.parseStreamFromPls);
},
fetchPlsForU... | {
reject(playlistUrl);
} | conditional_block |
bbc-radio.js | (function (exports) {
'use strict';
var obj = {
playlistFormat: 'http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/vpid/$station/format/pls.pls',
playableLinks: function (container) {
return container.querySelectorAll('a[data-player-html5-stream]');
},
playlistUrl: fun... | })(window.bbc = window.bbc || {}) | }
exports.radio = obj;
| random_line_split |
sub-unsub.js | // Helper functions that converts some common sub/unsub patterns
// to useEffect model (i. e. make them return a unsubscripion function)
import { useEffect } from 'react'; | element.addEventListener(event, handler);
return () => element.removeEventListener(event, handler);
}
export function withListener(emitter, event, handler) {
emitter.addListener(event, handler);
return () => emitter.removeListener(event, handler);
}
export function withTimeout(handler, timeout) {
const time... |
export function withEventListener(element, event, handler) { | random_line_split |
sub-unsub.js | // Helper functions that converts some common sub/unsub patterns
// to useEffect model (i. e. make them return a unsubscripion function)
import { useEffect } from 'react';
export function withEventListener(element, event, handler) {
element.addEventListener(event, handler);
return () => element.removeEventListene... |
export function withInterval(handler, timeout) {
const timer = window.setInterval(handler, timeout);
return () => window.clearInterval(timer);
}
export function useEventListener(ref, eventName, handler) {
useEffect(() => {
const el = ref.current;
return el ? withEventListener(el, eventName, handler) : ... | {
const timer = window.setTimeout(handler, timeout);
return () => window.clearTimeout(timer);
} | identifier_body |
sub-unsub.js | // Helper functions that converts some common sub/unsub patterns
// to useEffect model (i. e. make them return a unsubscripion function)
import { useEffect } from 'react';
export function withEventListener(element, event, handler) {
element.addEventListener(event, handler);
return () => element.removeEventListene... | (ref, eventName, handler) {
useEffect(() => {
const el = ref.current;
return el ? withEventListener(el, eventName, handler) : undefined;
}, [ref, eventName, handler]);
}
| useEventListener | identifier_name |
test.py | 3.Declare with square brackets: [ ]
4.Can be nested. [x, y, [z1, z2]]
"""
myStr1 = 'aabbcc'
myStr2 = 'aabbcc'
print('myStr1 = ', myStr1)
print('myStr2 = ', myStr2)
print('myStr1 is myStr2 = ', myStr1 is myStr2, ' (Equivalent + Identical)')
myList1 = [10, 20, 30]
myList2 = [10, 20, 30]
print('myList1 = ', myList1)
p... | """
A list is a sequence
1.Can be any type
2.The values in a list are called elements or sometimes items | random_line_split | |
models.py | #!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
#
# Copyright (C) 2007 Adam Folmert <afolmert@gmail.com>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
#... | return QVariant('%s' % str(card.question_hint).strip())
elif index.column() == 3:
return QVariant('%s' % str(card.answer_hint).strip())
elif index.column() == 4:
return QVariant('%s' % str(card.score))
else:
return QVari... | random_line_split | |
models.py | #!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
#
# Copyright (C) 2007 Adam Folmert <afolmert@gmail.com>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
#... |
def flags(self, index):
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
def addCard(self, card):
self.emit(SIGNAL('modelAboutToBeReset()'))
self.cards.append(card)
self.reset()
def clear(self):
self.emit(SIGNAL('modelAboutToBeReset()'))
self.cards.clear()
... | return QVariant(str(section))
# return QAbstractItemModel.headerData(self, section, orientation, role) | identifier_body |
models.py | #!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
#
# Copyright (C) 2007 Adam Folmert <afolmert@gmail.com>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
#... | (self, index):
return QModelIndex()
def rowCount(self, parent=QModelIndex()):
if parent.isValid():
return 0
else:
if self.cards.isOpen():
return self.cards.getCardsCount()
else:
return 0
def columnCount(self, parent=... | parent | identifier_name |
models.py | #!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
#
# Copyright (C) 2007 Adam Folmert <afolmert@gmail.com>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
#... |
elif index.column() == 4:
return QVariant('%s' % str(card.score))
else:
return QVariant()
def flags(self, index):
return QAbstractListModel.flags(self, index) | Qt.ItemIsEnabled | Qt.ItemIsSelectable
def headerData(self, section, orientation, ... | return QVariant('%s' % str(card.answer_hint).strip()) | conditional_block |
MobileMenu.tsx | import * as React from 'react'
import { MarkdownRemark, Step } from '../types'
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock'
import Icon from 'graphcool-styles/dist/components/Icon/Icon'
import * as cn from 'classnames'
import Sidebar from './Tutorials/Sidebar'
interfa... |
componentWillUnmount() {
clearAllBodyScrollLocks()
}
render() {
const { menuOpen } = this.state
const { steps, location } = this.props
if (location.pathname === '/') {
return null
}
return (
<div className="mobile-menu">
<style jsx={true}>{`
.mobile-menu ... | {
super(props)
this.state = {
menuOpen: false,
}
} | identifier_body |
MobileMenu.tsx | import * as React from 'react'
import { MarkdownRemark, Step } from '../types'
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock'
import Icon from 'graphcool-styles/dist/components/Icon/Icon'
import * as cn from 'classnames'
import Sidebar from './Tutorials/Sidebar'
interfa... | background-color: rgba(0, 0, 0, .03);
top: -790px;
right: -290px;
width: 481px;
height: 909px;
transform: rotate(-9deg);
}
.close {
@p: .absolute, .top0, .right0, .pa25, .z2;
}
@media (min-width: ... | random_line_split | |
MobileMenu.tsx | import * as React from 'react'
import { MarkdownRemark, Step } from '../types'
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock'
import Icon from 'graphcool-styles/dist/components/Icon/Icon'
import * as cn from 'classnames'
import Sidebar from './Tutorials/Sidebar'
interfa... | else {
enableBodyScroll(this.sidebarRef)
}
}
}
)
}
}
| {
disableBodyScroll(this.sidebarRef)
} | conditional_block |
MobileMenu.tsx | import * as React from 'react'
import { MarkdownRemark, Step } from '../types'
import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock'
import Icon from 'graphcool-styles/dist/components/Icon/Icon'
import * as cn from 'classnames'
import Sidebar from './Tutorials/Sidebar'
interfa... | (props) {
super(props)
this.state = {
menuOpen: false,
}
}
componentWillUnmount() {
clearAllBodyScrollLocks()
}
render() {
const { menuOpen } = this.state
const { steps, location } = this.props
if (location.pathname === '/') {
return null
}
return (
<di... | constructor | identifier_name |
people-api.ts | export default function(app) {
app.service('peopleApi', class PeopleApi {
static $inject = ['$http', 'config', 'notificationService'];
constructor(public $http, public config, public notificationService) {}
get(personId) {
return this.$http.get(`${this.config.apiUrl}/people/${personId}`)
.t... | (personId, email, setAsDefault, frontendUrl, returnUrl) {
return this.$http.post(
`${this.config.apiUrl}/people/${personId}/emails`,
{email, setAsDefault, frontendUrl, returnUrl},
)
.then(
response => response.data,
this.notificationService.httpError('could not ad... | emailAdd | identifier_name |
people-api.ts | export default function(app) {
app.service('peopleApi', class PeopleApi {
static $inject = ['$http', 'config', 'notificationService'];
constructor(public $http, public config, public notificationService) {}
get(personId) {
return this.$http.get(`${this.config.apiUrl}/people/${personId}`)
.t... |
emailGetPending(personId) {
return this.$http.get(`${this.config.apiUrl}/people/${personId}/emails/pending`)
.then(
response => response.data,
this.notificationService.httpError('could not get pending emails'),
);
}
update(personId, person) {
return this.$h... | {
return this.$http.post(
`${this.config.apiUrl}/people/${personId}/emails`,
{email, setAsDefault, frontendUrl, returnUrl},
)
.then(
response => response.data,
this.notificationService.httpError('could not add email'),
);
} | identifier_body |
people-api.ts | export default function(app) {
app.service('peopleApi', class PeopleApi {
static $inject = ['$http', 'config', 'notificationService'];
constructor(public $http, public config, public notificationService) {}
get(personId) {
return this.$http.get(`${this.config.apiUrl}/people/${personId}`)
.t... | this.notificationService.httpError('could not get person'),
);
}
emailAdd(personId, email, setAsDefault, frontendUrl, returnUrl) {
return this.$http.post(
`${this.config.apiUrl}/people/${personId}/emails`,
{email, setAsDefault, frontendUrl, returnUrl},
)
.t... | random_line_split | |
setup.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | "wheel<0.36.0",
"click==7.0.0",
]
setuptools.setup(
name="invalid-package",
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",... | random_line_split | |
models.py | # Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | "ns1.id":3,
"ns1.sortOrder":0
},
{
"@xsi.type":"ns1:CodeValue",
"ns1.description":"Inactive",
"ns1.id":2,
"ns1.sortOrder":0
... | "ns1.description":"Disabled", | random_line_split |
models.py | # Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... |
return super(ArrayOfCodeValue, self).update_from_dict(data)
| data = data["ns1.ArrayOfCodeValue"][0]["ns1.CodeValue"]
# Because this JSON is BadgerFish-translated XML
# (http://ajaxian.com/archives/badgerfish-translating-xml-to-json)
# length-1 lists are not sent as lists, so we re-listify.
if "@xsi.type" in data:
da... | conditional_block |
models.py | # Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | api_base_url = urlparse.urljoin(conf.CC_API_BASE, "staticData/values/")
entries = fields.List(fields.Object(CodeValue))
def update_from_dict(self, data):
"""
Unwrap the JSON data.
We expect to get data in a form like this:
{
"ns1.ArrayOfCodeValue":[
... | identifier_body | |
models.py | # Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | (ObjectMixin, remoteobjects.ListObject):
api_base_url = urlparse.urljoin(conf.CC_API_BASE, "staticData/values/")
entries = fields.List(fields.Object(CodeValue))
def update_from_dict(self, data):
"""
Unwrap the JSON data.
We expect to get data in a form like this:
{
... | ArrayOfCodeValue | identifier_name |
managers.py | """
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... |
def __del__(self, instance):
self.tag_model.objects.update_tags(instance, []) | self.tag_model.objects.update_tags(instance, value) | random_line_split |
managers.py | """
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... |
class TagDescriptor(object):
"""
A descriptor which provides access to a ``ModelTagManager`` for
model classes and simple retrieval, updating and deletion of tags
for model instances.
"""
def __init__(self, tag_model):
self.tag_model = tag_model
def __get__(self, instance, ow... | return self.intermediary_table_model.objects.get_union_by_model(queryset, tags) | conditional_block |
managers.py | """
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... | (self, tags, *args, **kwargs):
return self.tag_model.objects.related_for_model(tags, self.model, *args, **kwargs)
def usage(self, *args, **kwargs):
return self.tag_model.objects.usage_for_model(self.model, *args, **kwargs)
class ModelTaggedItemManager(models.Manager):
"""
A manager fo... | related | identifier_name |
managers.py | """
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... |
class TagDescriptor(object):
"""
A descriptor which provides access to a ``ModelTagManager`` for
model classes and simple retrieval, updating and deletion of tags
for model instances.
"""
def __init__(self, tag_model):
self.tag_model = tag_model
def __get__(self, instance, ow... | if queryset is None:
return self.intermediary_table_model.objects.get_union_by_model(self.model, tags)
else:
return self.intermediary_table_model.objects.get_union_by_model(queryset, tags) | identifier_body |
fxrstor.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
|
fn fxrstor_2() {
run_test(&Instruction { mnemonic: Mnemonic::FXRSTOR, operand1: Some(IndirectScaledIndexedDisplaced(EDI, EDX, Two, 1303234622, Some(OperandSize::Unsized), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: N... | fn fxrstor_1() {
run_test(&Instruction { mnemonic: Mnemonic::FXRSTOR, operand1: Some(Indirect(DI, Some(OperandSize::Unsized), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 174, 13], OperandSize::Word)
} | random_line_split |
fxrstor.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn | () {
run_test(&Instruction { mnemonic: Mnemonic::FXRSTOR, operand1: Some(Indirect(DI, Some(OperandSize::Unsized), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 174, 13], OperandSize::Word)
}
fn fxrstor_2(... | fxrstor_1 | identifier_name |
fxrstor.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
fn fxrstor_1() {
run_test(&Instruction { mnemonic: Mnemonic::FXRSTOR, operand1: Some(Indirect(DI, Some(OperandSize::Unsize... | {
run_test(&Instruction { mnemonic: Mnemonic::FXRSTOR, operand1: Some(IndirectScaledIndexedDisplaced(RBX, RDI, Eight, 468169493, Some(OperandSize::Unsized), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 17... | identifier_body | |
fromArg.ts | /// <reference path="../nodes.d.ts" />
/// <reference path="base_exp.d.ts" />
'use strict';
import * as Utils from '../nodes_utils';
import BaseExp from './base_exp';
var assert = require('assert');
var dbg = require('debug')('node:exp:default');
class FromArg extends BaseExp {
fromArg: string;
fromArgValue:... | };
}
static getProp(): ExpPropType {
return {singleVerbEdge : true};
}
exec(globalBucket: GlobalBucket): ExpExecReturn {
let r = {};
r[this.fromArg] = this.fromArgValue;
dbg('fromArg::EXEC = ' + JSON.stringify(r));
return r;
}
}
export default FromAr... | dtName: { type: 'string' },
dtValue: { type: 'Number' }
} | random_line_split |
fromArg.ts | /// <reference path="../nodes.d.ts" />
/// <reference path="base_exp.d.ts" />
'use strict';
import * as Utils from '../nodes_utils';
import BaseExp from './base_exp';
var assert = require('assert');
var dbg = require('debug')('node:exp:default');
class FromArg extends BaseExp {
fromArg: string;
fromArgValue:... | (nodes: Nodes, matchResult: ExpMatch) {
super(nodes, matchResult);
this.fromArg = this.result.getArgStr('fromArg');
this.fromArgValue = this.result.getArgStr('fromArgValue');
this.name = FromArg.getName();
}
static getName(): string {
return 'fromArg';
}
static ge... | constructor | identifier_name |
index.ts | import * as island from 'island';
import * as _ from 'lodash';
import deprecate from 'deprecated-decorator';
import { sanitize, validate } from './schema.middleware';
import * as qs from 'qs';
import { compileURL, matchURL } from './router';
type MethodTypes = 'GET' | 'PUT' | 'POST' | 'DEL';
export interface Endpoin... | }
return results;
}
} | random_line_split | |
index.ts | import * as island from 'island';
import * as _ from 'lodash';
import deprecate from 'deprecated-decorator';
import { sanitize, validate } from './schema.middleware';
import * as qs from 'qs';
import { compileURL, matchURL } from './router';
type MethodTypes = 'GET' | 'PUT' | 'POST' | 'DEL';
export interface Endpoin... |
static DEL(uri: string, input: Input, sanitizeOnly = false) {
const splits = Tester.splitUri(uri);
return Tester.execute('DEL', splits.path, {
query: splits.query,
body: {},
session: input.session,
result: input.result
}, sanitizeOnly);
}
private static execute(method: Metho... | {
const splits = Tester.splitUri(uri);
return Tester.execute('POST', splits.path, {
query: splits.query,
body: input.body,
session: input.session,
result: input.result
}, sanitizeOnly);
} | identifier_body |
index.ts | import * as island from 'island';
import * as _ from 'lodash';
import deprecate from 'deprecated-decorator';
import { sanitize, validate } from './schema.middleware';
import * as qs from 'qs';
import { compileURL, matchURL } from './router';
type MethodTypes = 'GET' | 'PUT' | 'POST' | 'DEL';
export interface Endpoin... | {
private static endpoints: {[method: string]: Endpoint[]} = {};
private static installed = false;
private static origin: {_module?, method?} = {};
static install(islandModule: typeof island): void {
if (Tester.installed) return;
// save previous
Tester.origin._module = islandModule;
Tester.o... | Tester | identifier_name |
km.js | /*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'div', 'km', {
IdInputLabel: 'Id', | advisoryTitleInputLabel: 'ចំណងជើងប្រឹក្សា',
cssClassInputLabel: 'Stylesheet Classes',
edit: 'កែ Div',
inlineStyleInputLabel: 'ស្ទីលក្នុងបន្ទាត់',
langDirLTRLabel: 'ពីឆ្វេងទៅស្តាំ(LTR)',
langDirLabel: 'ទិសដៅភាសា',
langDirRTLLabel: 'ពីស្តាំទៅឆ្វេង(RTL)',
languageCodeInputLabel: 'កូដភាសា',
remove: 'ដក Div ចេ... | random_line_split | |
cli_utils.py | # Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | (parser):
parser.add_argument("--path",
help="the directory that the parsed data is written into")
parser.add_argument("--transport", default="http",
choices=["http", "https"],
help="transport for connections")
parser.add_argument("-i",... | add_common_args | identifier_name |
cli_utils.py | # Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | choices=["http", "https"],
help="transport for connections")
parser.add_argument("-i", "--ip", default="localhost",
help="OpenDaylight ip address")
parser.add_argument("-t", "--port", default="8181",
help="OpenDaylig... | parser.add_argument("--path",
help="the directory that the parsed data is written into")
parser.add_argument("--transport", default="http", | random_line_split |
cli_utils.py | # Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | parser.add_argument("--path",
help="the directory that the parsed data is written into")
parser.add_argument("--transport", default="http",
choices=["http", "https"],
help="transport for connections")
parser.add_argument("-i", "--ip", defau... | identifier_body | |
cli_utils.py | # Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
if not os.path.isfile(path):
logger.error('File "%s" not found' % path)
raise argparse.ArgumentError
return path
def add_common_args(parser):
parser.add_argument("--path",
help="the directory that the parsed data is written into")
parser.add_argument("--trans... | return path | conditional_block |
orderterm.component.ts | import { Component, OnDestroy, OnInit, Self } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { ActivatedRoute, Router, UrlSegment } from '@angular/router';
import { BehaviorSubject, Observable, Subscription, combineLatest } from 'rxjs';
import { ErrorService, Saved, ContextService, Meta... |
public ngOnInit(): void {
const { m, pull, x } = this.metaService;
this.subscription = combineLatest(this.route.url, this.refresh$)
.pipe(
switchMap(([urlSegments, date]) => {
const id: string = this.route.snapshot.paramMap.get('id');
const termId: string = this.route.sn... | {
this.m = this.metaService.m;
this.refresh$ = new BehaviorSubject<Date>(undefined);
} | identifier_body |
orderterm.component.ts | import { Component, OnDestroy, OnInit, Self } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { ActivatedRoute, Router, UrlSegment } from '@angular/router';
import { BehaviorSubject, Observable, Subscription, combineLatest } from 'rxjs';
import { ErrorService, Saved, ContextService, Meta... | implements OnInit, OnDestroy {
public m: MetaDomain;
public title = 'Edit Sales Order Incoterm';
public subTitle: string;
public order: SalesOrder;
public salesTerm: SalesTerm;
public orderTermTypes: OrderTermType[];
private refresh$: BehaviorSubject<Date>;
private subscription: Subscription;
con... | OrderTermEditComponent | identifier_name |
orderterm.component.ts | import { Component, OnDestroy, OnInit, Self } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { ActivatedRoute, Router, UrlSegment } from '@angular/router';
import { BehaviorSubject, Observable, Subscription, combineLatest } from 'rxjs';
import { ErrorService, Saved, ContextService, Meta... |
}, this.errorService.handler);
}
public ngOnDestroy(): void {
if (this.subscription) {
this.subscription.unsubscribe();
}
}
public save(): void {
this.allors.context
.save()
.subscribe((saved: Saved) => {
this.router.navigate(['/orders/salesOrder/' + this.order.id... | {
this.title = 'Add Sales Order Order Term';
this.salesTerm = this.allors.context.create('OrderTerm') as SalesTerm;
this.order.AddSalesTerm(this.salesTerm);
} | conditional_block |
orderterm.component.ts | import { Component, OnDestroy, OnInit, Self } from '@angular/core';
import { MatSnackBar } from '@angular/material';
import { ActivatedRoute, Router, UrlSegment } from '@angular/router';
import { BehaviorSubject, Observable, Subscription, combineLatest } from 'rxjs';
import { ErrorService, Saved, ContextService, Meta... | const { m, pull, x } = this.metaService;
this.subscription = combineLatest(this.route.url, this.refresh$)
.pipe(
switchMap(([urlSegments, date]) => {
const id: string = this.route.snapshot.paramMap.get('id');
const termId: string = this.route.snapshot.paramMap.get('termId');
... | random_line_split | |
axis.rs | // Copyright 2016 bluss and ndarray developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// ex... | ze);
impl Axis {
/// Return the index of the axis.
#[inline(always)]
pub fn index(&self) -> usize { self.0 }
#[deprecated(note = "Renamed to .index()")]
#[inline(always)]
pub fn axis(&self) -> usize { self.0 }
}
copy_and_clone!{Axis}
macro_rules! derive_cmp {
($traitname:ident for $typena... | usi | identifier_name |
axis.rs | // Copyright 2016 bluss and ndarray developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// ex... | /// correctly and easier to understand.
#[derive(Eq, Ord, Hash, Debug)]
pub struct Axis(pub usize);
impl Axis {
/// Return the index of the axis.
#[inline(always)]
pub fn index(&self) -> usize { self.0 }
#[deprecated(note = "Renamed to .index()")]
#[inline(always)]
pub fn axis(&self) -> usize {... | /// Axis *0* is the array’s outermost axis and *n*-1 is the innermost.
///
/// All array axis arguments use this type to make the code easier to write | random_line_split |
datasource-polling.js | /*
YUI 3.16.0 (build 76f0e08)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('datasource-polling', function (Y, NAME) {
/**
* Extends DataSource with polling functionality.
*
* @module datasource
* @submodule datasource-polling
*/
/**
*... | this._intervals[x.id] = x;
// First call happens immediately, but async
Y.later(0, this, this.sendRequest, [request]);
return x.id;
},
/**
* Disables polling mechanism associated with the given interval ID.
*
* @method clearInterval
* @param id {Number} Inter... | */
setInterval: function(msec, request) {
var x = Y.later(msec, this, this.sendRequest, [ request ], true); | random_line_split |
datasource-polling.js | /*
YUI 3.16.0 (build 76f0e08)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('datasource-polling', function (Y, NAME) {
/**
* Extends DataSource with polling functionality.
*
* @module datasource
* @submodule datasource-polling
*/
/**
*... |
},
/**
* Clears all intervals.
*
* @method clearAllIntervals
*/
clearAllIntervals: function() {
Y.each(this._intervals, this.clearInterval, this);
}
};
Y.augment(Y.DataSource.Local, Pollable);
}, '3.16.0', {"requires": ["datasource-local"]});
| {
// Clear the interval
this._intervals[id].cancel();
// Clear from tracker
delete this._intervals[id];
} | conditional_block |
datasource-polling.js | /*
YUI 3.16.0 (build 76f0e08)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('datasource-polling', function (Y, NAME) {
/**
* Extends DataSource with polling functionality.
*
* @module datasource
* @submodule datasource-polling
*/
/**
*... | () {
this._intervals = {};
}
Pollable.prototype = {
/**
* @property _intervals
* @description Hash of polling interval IDs that have been enabled,
* stored here to be able to clear all intervals.
* @private
*/
_intervals: null,
/**
* Sets up a polling mechanism to send reques... | Pollable | identifier_name |
datasource-polling.js | /*
YUI 3.16.0 (build 76f0e08)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('datasource-polling', function (Y, NAME) {
/**
* Extends DataSource with polling functionality.
*
* @module datasource
* @submodule datasource-polling
*/
/**
*... |
Pollable.prototype = {
/**
* @property _intervals
* @description Hash of polling interval IDs that have been enabled,
* stored here to be able to clear all intervals.
* @private
*/
_intervals: null,
/**
* Sets up a polling mechanism to send requests at set intervals and
* f... | {
this._intervals = {};
} | identifier_body |
utils.ts | 'use strict';
import * as path from 'path';
import * as _ from 'lodash';
import * as iconv from 'iconv-lite';
import * as express from 'express';
import * as csvtojson from 'csvtojson';
import * as session from 'express-session';
import * as session_file_store from 'session-file-store';
import concat = require('concat... |
export const post = (url: string, body: string, options: simpleGet.Options) : Promise<string> => {
options = _.assign({ url, body, ca: conf.http_client_CAs }, options);
return new Promise((resolve: (string) => void, reject: (any) => void) => {
simpleGet.post(options, (err, res) => {
if (er... | {
const FileStore = session_file_store(session);
return session({
store: new FileStore({ retries: 0, ...conf.session_store }),
resave: false, saveUninitialized: false,
...conf.session,
});
} | identifier_body |
utils.ts | 'use strict';
import * as path from 'path';
import * as _ from 'lodash';
import * as iconv from 'iconv-lite';
import * as express from 'express';
import * as csvtojson from 'csvtojson';
import * as session from 'express-session';
import * as session_file_store from 'session-file-store';
import concat = require('concat... | else {
return overrides;
}
}
export const findStepAttr = (attrs: StepAttrsOption, f: (StepAttrOption, key) => boolean): { key: string, opts: StepAttrOption } => {
for (const key in attrs) {
const opts = attrs[key];
if (f(opts, key)) return { key, opts };
if (opts.oneOf) {
... | {
const r = { ...o, ...overrides };
for (const attr of _.intersection(Object.keys(o), Object.keys(overrides))) {
r[attr] = deep_extend(o[attr], overrides[attr]);
}
return r;
} | conditional_block |
utils.ts | 'use strict';
import * as path from 'path';
import * as _ from 'lodash';
import * as iconv from 'iconv-lite';
import * as express from 'express';
import * as csvtojson from 'csvtojson';
import * as session from 'express-session';
import * as session_file_store from 'session-file-store';
import concat = require('concat... | (req: req, res: express.Response, p: Promise<response>) {
let logPrefix = req.method + " " + req.path + ":";
p.then(r => {
//console.log(logPrefix, r);
res.json(r);
}, err => {
console.error(logPrefix, err);
const errMsg = err.code || "" + err;
res.status(errMsg === "... | respondJson | identifier_name |
utils.ts | 'use strict';
import * as path from 'path';
import * as _ from 'lodash';
import * as iconv from 'iconv-lite';
import * as express from 'express';
import * as csvtojson from 'csvtojson';
import * as session from 'express-session';
import * as session_file_store from 'session-file-store';
import concat = require('concat... |
export const index_html = (_req: req, res: express.Response, _next): void => {
res.sendFile(path.join(__dirname, "../app/dist/index.html"), console.error)
};
const toString = (buffer : Buffer) => {
let r = buffer.toString('utf8');
if (r.match("\uFFFD")) r = iconv.decode(buffer, 'win1252'); // fallback
... | res.json(err.code ? err : {error: errMsg, stack: err.stack});
});
} | random_line_split |
dpar-print-transitions.rs | use std::env::args;
use std::io::{BufRead, BufWriter, Write};
use std::process;
use colored::*;
use conllx::{DisplaySentence, HeadProjectivizer, Projectivize, ReadSentence};
use dpar::guide::Guide;
use dpar::system::{sentence_to_dependencies, ParserState, Transition, TransitionSystem};
use dpar::systems::{
ArcEage... | while !S::is_terminal(&state) {
let next_transition = oracle.best_transition(&state);
next_transition.apply(&mut state);
// Print transition and state.
writeln!(writer, "{}", format!("{:?}", next_transition).purple())?;
print_tokens(&mut writer, &stat... | print_tokens(&mut writer, &state, Source::Buffer)?;
| random_line_split |
dpar-print-transitions.rs | use std::env::args;
use std::io::{BufRead, BufWriter, Write};
use std::process;
use colored::*;
use conllx::{DisplaySentence, HeadProjectivizer, Projectivize, ReadSentence};
use dpar::guide::Guide;
use dpar::system::{sentence_to_dependencies, ParserState, Transition, TransitionSystem};
use dpar::systems::{
ArcEage... | <W>(writer: &mut W, state: &ParserState<'_>, source: Source) -> Result<(), Error>
where
W: Write,
{
let prefix = match source {
Source::Buffer => "Buffer",
Source::Stack => "Stack",
};
let indices = match source {
Source::Buffer => state.buffer(),
Source::Stack => state.... | print_tokens | identifier_name |
dpar-print-transitions.rs | use std::env::args;
use std::io::{BufRead, BufWriter, Write};
use std::process;
use colored::*;
use conllx::{DisplaySentence, HeadProjectivizer, Projectivize, ReadSentence};
use dpar::guide::Guide;
use dpar::system::{sentence_to_dependencies, ParserState, Transition, TransitionSystem};
use dpar::systems::{
ArcEage... |
let input = Input::from(matches.free.get(1));
let reader = conllx::Reader::new(input.buf_read().or_exit("Cannot open treebank", 1));
let output = Output::from(matches.free.get(2));
let writer = BufWriter::new(output.write().or_exit("Cannot create transition output", 1));
parse(&matches.free[0], ... | {
print_usage(&program, opts);
return;
} | conditional_block |
dpar-print-transitions.rs | use std::env::args;
use std::io::{BufRead, BufWriter, Write};
use std::process;
use colored::*;
use conllx::{DisplaySentence, HeadProjectivizer, Projectivize, ReadSentence};
use dpar::guide::Guide;
use dpar::system::{sentence_to_dependencies, ParserState, Transition, TransitionSystem};
use dpar::systems::{
ArcEage... |
fn parse_with_system<R, W, S>(
reader: conllx::Reader<R>,
mut writer: BufWriter<W>,
) -> Result<(), Error>
where
R: BufRead,
W: Write,
S: TransitionSystem,
{
let projectivizer = HeadProjectivizer::new();
for sentence in reader.sentences() {
let sentence = projectivizer.projectiviz... | {
match system {
"arceager" => parse_with_system::<R, W, ArcEagerSystem>(reader, writer),
"archybrid" => parse_with_system::<R, W, ArcHybridSystem>(reader, writer),
"arcstandard" => parse_with_system::<R, W, ArcStandardSystem>(reader, writer),
"stackproj" => parse_with_system::<R, W,... | identifier_body |
HolyPowerBreakdown.js | import React from 'react';
import PropTypes from 'prop-types';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
class HolyPowerBreakdown extends React.Component {
static propTypes = {
hpGeneratedAndWasted: PropTypes.object.isRequi... | style={{ width: `${(ability.wasted / totalWasted) * 100}%` }}
/>
</td>
</tr>
))}
</tbody>
</table>
{/* Add Spent here if i ever need to. */}
</div>
);
}
}
export default HolyPowerBreakdown; | </td>
<td style={{ width: '30%' }}>
<div
className={'performance-bar '} | random_line_split |
HolyPowerBreakdown.js | import React from 'react';
import PropTypes from 'prop-types';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
class HolyPowerBreakdown extends React.Component {
static propTypes = {
hpGeneratedAndWasted: PropTypes.object.isRequi... | () {
const { hpGeneratedAndWasted } = this.props;
const generated = this.prepareGenerated(hpGeneratedAndWasted);
let totalGenerated = 0;
let totalWasted = 0;
generated.forEach((ability) => {
totalGenerated += ability.generated;
totalWasted += ability.wasted;
});
totalGenerated = (totalGenerated... | render | identifier_name |
player.rs | use crate::{
entity::{Character, Entity, EntityId, EntityPersistence, EntityRef, EntityType, StatsItem},
entity_copy_prop, entity_string_prop,
sessions::SignUpData,
};
use pbkdf2::{pbkdf2_check, pbkdf2_simple};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(ren... |
pub fn matches_password(&self, password: &str) -> bool {
matches!(pbkdf2_check(password, &self.password), Ok(()))
}
pub fn new(id: EntityId, sign_up_data: &SignUpData) -> Self {
let character = Character::from_sign_up_data(sign_up_data);
Self {
id,
characte... | {
let mut player = serde_json::from_str::<Player>(json)
.map_err(|error| format!("parse error: {}", error))?;
player.id = id;
Ok(Box::new(player))
} | identifier_body |
player.rs | use crate::{
entity::{Character, Entity, EntityId, EntityPersistence, EntityRef, EntityType, StatsItem},
entity_copy_prop, entity_string_prop,
sessions::SignUpData,
};
use pbkdf2::{pbkdf2_check, pbkdf2_simple};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(ren... | (&mut self, password: &str) {
match pbkdf2_simple(password, 10) {
Ok(password) => {
self.password = password;
self.set_needs_sync(true);
}
Err(error) => panic!("Cannot create password hash: {:?}", error),
}
}
}
impl Entity for Play... | set_password | identifier_name |
player.rs | use crate::{
entity::{Character, Entity, EntityId, EntityPersistence, EntityRef, EntityType, StatsItem},
entity_copy_prop, entity_string_prop,
sessions::SignUpData,
};
use pbkdf2::{pbkdf2_check, pbkdf2_simple};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(ren... | }
}
impl Entity for Player {
entity_string_prop!(name, set_name);
entity_string_prop!(description, set_description);
fn as_character(&self) -> Option<&Character> {
Some(&self.character)
}
fn as_character_mut(&mut self) -> Option<&mut Character> {
Some(&mut self.character)
... | self.set_needs_sync(true);
}
Err(error) => panic!("Cannot create password hash: {:?}", error),
} | random_line_split |
worker.py | # vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# 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 ... | def initiate(self):
"""
Connects to phone.
"""
self._thread = GammuThread(
self._queue, self._config, self._callback, self._pull_func
)
self._thread.start()
def terminate(self, timeout=None):
"""
Terminates phone connection.
"""... |
Aborts any remaining operations.
"""
raise NotImplementedError
| identifier_body |
worker.py | # vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# 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 ... | errcode = info.args[0]["Code"]
error = gammu.ErrorNumbers[errcode]
self._callback(name, result, error, percentage)
def run(self):
"""
Thread body, which handles phone communication. This should not
be used from outside.
"""
start = True
... | result = func(**params)
else:
result = func(*params)
except gammu.GSMError as info: | random_line_split |
worker.py | # vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# 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 ... | lf):
"""
Returns percentage of current task.
"""
return self._percentage
def __str__(self):
"""
Returns textual representation.
"""
if self._params is not None:
return f"{self._command} {self._params}"
else:
return f"{s... | _percentage(se | identifier_name |
worker.py | # vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# 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 ... | except (AttributeError, ValueError):
pass
except queue.Empty:
if self._terminate:
break
# Read the device to catch possible incoming events
try:
self._pull_func(self._sm)
... | f._queue.task_done()
| conditional_block |
GobanTest.tsx | /*
* Copyright (C) 2012-2022 Online-Go.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This pr... |
}
| {
return (
<div className={`GobanTest`}>
<div className={"center-col"}>
<div ref="goban_container" className="goban-container">
<PersistentElement className="Goban" elt={this.goban_div} />
</div>
</div>
... | identifier_body |
GobanTest.tsx | /*
* Copyright (C) 2012-2022 Online-Go.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This pr... |
this.state = {
move_string: "",
};
this.goban_div = document.createElement("div");
this.goban_div.className = "Goban";
const opts: GobanConfig = {
board_div: this.goban_div,
interactive: true,
mode: "puzzle",
player_i... | super(props); | random_line_split |
GobanTest.tsx | /*
* Copyright (C) 2012-2022 Online-Go.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This pr... | extends React.Component<{}, any> {
refs: {
goban_container;
};
goban: Goban;
goban_div: HTMLDivElement;
goban_opts: any = {};
constructor(props) {
super(props);
this.state = {
move_string: "",
};
this.goban_div = document.createElement("di... | GobanTest | identifier_name |
local.py |
from .base import *
# DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# END DEBUG CONFIGURATION
# EMAIL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/... | """Development settings and globals."""
from __future__ import absolute_import
from os.path import join, normpath | random_line_split | |
ngrams.js | /**
* Talisman tokenizers/ngrams tests
* =================================
*
*/
import assert from 'assert';
import ngrams, { | trigrams,
quadrigrams
} from '../../src/tokenizers/ngrams';
describe('ngrams', function() {
it('should throw if n is < 1.', function() {
assert.throws(function() {
ngrams(-1, [1, 2, 3]);
}, Error);
});
it('should properly compute ngrams.', function() {
const solutions = {
1: [['h'],... | bigrams, | random_line_split |
tls_publish.rs | extern crate cloudpubsub;
extern crate pretty_env_logger;
extern crate rand;
use std::thread;
use std::time::Duration;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use rand::{thread_rng, Rng};
use cloudpubsub::{MqttOptions, MqttClient, MqttCallback};
fn main() | {
pretty_env_logger::init().unwrap();
let options = MqttOptions::new().set_client_id("tls-publisher-1")
.set_clean_session(false)
.set_ca("/userdata/certs/dev/ca-chain.cert.pem")
.set_client_certs("/user... | identifier_body | |
tls_publish.rs | extern crate cloudpubsub;
extern crate pretty_env_logger;
extern crate rand;
use std::thread;
use std::time::Duration;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use rand::{thread_rng, Rng};
use cloudpubsub::{MqttOptions, MqttClient, MqttCallback};
fn main() {
pretty_env_logger::init().... |
for i in 0..100 {
let len: usize = thread_rng().gen_range(0, 100_000);
let mut v = vec![0; len];
thread_rng().fill_bytes(&mut v);
client.publish("hello/world", v);
}
// verifies pingreqs and responses
thread::sleep(Duration::from_secs(30));
// disconnections becau... | };
let on_publish = MqttCallback::new().on_publish(counter_cb);
let mut client = MqttClient::start(options, Some(on_publish)).expect("Start Error"); | random_line_split |
tls_publish.rs | extern crate cloudpubsub;
extern crate pretty_env_logger;
extern crate rand;
use std::thread;
use std::time::Duration;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use rand::{thread_rng, Rng};
use cloudpubsub::{MqttOptions, MqttClient, MqttCallback};
fn | () {
pretty_env_logger::init().unwrap();
let options = MqttOptions::new().set_client_id("tls-publisher-1")
.set_clean_session(false)
.set_ca("/userdata/certs/dev/ca-chain.cert.pem")
.set_client_certs("/u... | main | identifier_name |
DefaultPage.tsx | import { useState } from "react";
import logo from "../logo.svg";
import { css, keyframes } from "@emotion/react";
import { Tooltip } from "../components/Tooltip";
import { Barrier } from "../infrastructures/Barrier";
import { Button } from "../components/Button";
export const DefaultPage = () => {
const [count, set... | target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
{" | "}
<a
css={appLink}
href="https://vitejs.dev/guide/features.html"
target="_blank"
rel="noopener noreferrer"
>
... | <p>
<a
css={appLink}
href="https://reactjs.org" | random_line_split |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! This module provides constants which are specific to the implementation
//! of the `... | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | random_line_split |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | t turns out the safety issues with sNaN were overblown! Hooray!
unsafe { mem::transmute(v) }
}
}
| identifier_body | |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | ) * 1.0
}
/// Returns the minimum of the two numbers.
///
/// ```
/// let x = 1.0_f64;
/// let y = 2.0_f64;
///
/// assert_eq!(x.min(y), x);
/// ```
///
/// If one of the arguments is NaN, then the other argument is returned.
#[stable(feature = "rust1", since = "1.0.0")]... | { self } | conditional_block |
f64.rs | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | {
let value: f64 = consts::PI;
self * (value / 180.0)
}
/// Returns the maximum of the two numbers.
///
/// ```
/// let x = 1.0_f64;
/// let y = 2.0_f64;
///
/// assert_eq!(x.max(y), y);
/// ```
///
/// If one of the arguments is NaN, then the other argument ... | f) -> f64 | identifier_name |
new-chapter-title-modal.controller.ts | // Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... |
$scope.updateTitle();
$scope.updateExplorationId();
};
}
]);
| {
$scope.errorMsg = 'A chapter with this title already exists';
return;
} | conditional_block |
new-chapter-title-modal.controller.ts | // Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by ap... | $scope.story = StoryEditorStateService.getStory();
$scope.nodeId = $scope.story.getStoryContents().getNextNodeId();
$scope.editableThumbnailFilename = '';
$scope.editableThumbnailBgColor = '';
$scope.allowedBgColors = (
newChapterConstants.ALLOWED_THUMBNAIL_BG_COLORS.chapter);
... | $scope.MAX_CHARS_IN_EXPLORATION_TITLE = MAX_CHARS_IN_EXPLORATION_TITLE; | random_line_split |
xul.mako.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 https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import Method %>
// Non-standard properties t... | spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-box-ordinal-group)",
)} | engines="gecko",
parse_method="parse_non_negative",
alias="-webkit-box-ordinal-group",
gecko_ffi_name="mBoxOrdinal",
animation_value_type="discrete", | random_line_split |
Main.ts | /**
Créer par Jimmy Latour, 2016
http://labodudev.fr
*/
class MainScene extends Scene {
/**
* Le personnage
* @type {Character}
*/
public character: Character = undefined;
/**
* Le sprite qui permet de livré un humain sur Terre
* @type {SpriteClickable}
*/
private spriteClickableTerre: Sprit... | oid {
super.Start();
this.countdown = new Countdown();
this.countdown.SetEndFuncToCall(this.ChangeScene);
this.score = new Score();
}
public Update(deltaTime: number):void {
super.Update(deltaTime);
if (this.character) {
this.character.Update();
}
if (this.bodyManager) {
t... | t():v | identifier_name |
Main.ts | /**
Créer par Jimmy Latour, 2016
http://labodudev.fr
*/
class MainScene extends Scene {
/**
* Le personnage
* @type {Character}
*/
public character: Character = undefined;
/**
* Le sprite qui permet de livré un humain sur Terre
* @type {SpriteClickable}
*/
private spriteClickableTerre: Sprit... | ublic Clear():void {
super.Clear();
this.score.Clear();
delete this.score;
}
public InitCharacter(triggerElement: any):void {
this.character = new Character();
this.spriteClickableTrash.SetClickable({w: 111, h: 119}, {x: 0, y: 0}, this.character.GoTrash);
this.spriteClickableTerre.SetClicka... | this.bodyManager.Draw(context);
super.Draw(context);
if (this.countdown) {
this.countdown.Draw(context);
}
if (this.orderManager) {
this.orderManager.Draw(context);
}
if (this.character) {
this.character.Draw(context);
}
}
p | identifier_body |
Main.ts | /**
Créer par Jimmy Latour, 2016
http://labodudev.fr
*/
class MainScene extends Scene {
/**
* Le personnage
* @type {Character}
*/
public character: Character = undefined;
/**
* Le sprite qui permet de livré un humain sur Terre
* @type {SpriteClickable}
*/
private spriteClickableTerre: Sprit... | this.character.Clear();
delete this.character;
Data.Sounds.PlaySound('poubelle', false);
}
}
public Delivery():void {
if (this.character) {
let order = this.character.CheckElement(this.orderManager);
if (order) {
Data.Sounds.PlaySound('send', false);
order.SetC... | random_line_split | |
Main.ts | /**
Créer par Jimmy Latour, 2016
http://labodudev.fr
*/
class MainScene extends Scene {
/**
* Le personnage
* @type {Character}
*/
public character: Character = undefined;
/**
* Le sprite qui permet de livré un humain sur Terre
* @type {SpriteClickable}
*/
private spriteClickableTerre: Sprit... |
public Clear():void {
super.Clear();
this.score.Clear();
delete this.score;
}
public InitCharacter(triggerElement: any):void {
this.character = new Character();
this.spriteClickableTrash.SetClickable({w: 111, h: 119}, {x: 0, y: 0}, this.character.GoTrash);
this.spriteClickableTerre.SetCl... | this.character.Draw(context);
}
} | conditional_block |
aarch64_gen_tests.py |
import ast
import random
import re
def main():
import sys
infile = sys.argv[1]
attempts = int(sys.argv[2])
outfile = sys.argv[3]
with open(infile, "r", encoding="utf-8") as f:
templates = read_opdata_file(f)
buf = []
for template in templates:
for _ in range(attempts):
... |
elif self.family in "BHSDQV":
return "{}{}".format(self.family.lower(), value)
else:
raise NotImplementedError(self.family)
def emit_dynasm(self, value, allow_dynamic=True):
# randomly choose dynamic vs static notation
if random.choice((True, False)) or not ... | if value == 31:
return "sp"
return "x{}".format(value) | conditional_block |
aarch64_gen_tests.py |
import ast
import random
import re
def main():
import sys
infile = sys.argv[1]
attempts = int(sys.argv[2])
outfile = sys.argv[3]
with open(infile, "r", encoding="utf-8") as f:
templates = read_opdata_file(f)
buf = []
for template in templates:
for _ in range(attempts):
... |
REGLIST_RE = re.compile(r"\{v([0-9]+)(\.[^ ]+) *\* *([1234])\}")
def reformat_reglist(m):
start = int(m.group(1))
format = m.group(2)
amount = int(m.group(3))
items = []
for i in range(amount):
items.append("v{}{}".format((start + i) % 32, format))
return "{{{}}}".format(", ".join(i... | history = History()
for (arg, i) in self.args:
constraint = self.constraints[i]
value = constraint.create_value(history)
gas = arg.emit_gas(value)
emitted = arg.emit_dynasm(value)
if isinstance(constraint, RNext):
if "(" in history.emit... | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.