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
EFA19C34C9DC95F7511AF979CAD72884A6746A3B.js
this.NesDb = this.NesDb || {}; NesDb[ 'EFA19C34C9DC95F7511AF979CAD72884A6746A3B' ] = { "$": { "name": "Arkanoid", "altname": "アルカノイド", "class": "Licensed", "subclass": "3rd-Party", "catalog": "TFC-AN-5400-10", "publisher": "Taito", "developer": "Taito", "region": "Japan", "players": "1", "date": "...
"mapper": "3" }, "prg": [ { "$": { "size": "32k", "crc": "35893B67", "sha1": "7BB46BD1070F09DBBBA3AA9A05E6265FCF9A3376" } } ], "chr": [ { "$": { "size": "16k", "crc": "C5789B20", "sha1": "58551085A755781030E...
{ "$": { "type": "TAITO-CNROM", "pcb": "FC-010",
random_line_split
workqueue.rs
QueueData, WorkData>), /// Arbitrary data. pub data: WorkData, } /// Messages from the supervisor to the worker. enum WorkerMsg<QueueData: 'static, WorkData: 'static> { /// Tells the worker to start work. Start(Worker<WorkUnit<QueueData, WorkData>>, *mut AtomicUsize, *const QueueData), /// Tells th...
} Data(work) => { work_unit = work; back_off_sleep = 0 as u32; break } } ...
random_line_split
workqueue.rs
QueueData, WorkData>), /// Arbitrary data. pub data: WorkData, } /// Messages from the supervisor to the worker. enum WorkerMsg<QueueData: 'static, WorkData: 'static> { /// Tells the worker to start work. Start(Worker<WorkUnit<QueueData, WorkData>>, *mut AtomicUsize, *const QueueData), /// Tells th...
<QueueData: 'static, WorkData: 'static> { /// The communication channel to the workers. chan: Sender<WorkerMsg<QueueData, WorkData>>, /// The worker end of the deque, if we have it. deque: Option<Worker<WorkUnit<QueueData, WorkData>>>, /// The thief end of the work-stealing deque. thief: Stealer...
WorkerInfo
identifier_name
mountain_car.py
""" https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp """ import math import gym from gym import spaces from gym.utils import seeding import numpy as np class MountainCarEnv(gym.Env): metadata = { 'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 30 } def...
def _step(self, action): assert self.action_space.contains(action), "%r (%s) invalid" % (action, type(action)) position, velocity = self.state velocity += (action-1)*0.001 + math.cos(3*position)*(-0.0025) velocity = np.clip(velocity, -self.max_speed, self.max_speed) positi...
self.np_random, seed = seeding.np_random(seed) return [seed]
identifier_body
mountain_car.py
""" https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp """ import math import gym from gym import spaces from gym.utils import seeding import numpy as np class MountainCarEnv(gym.Env): metadata = { 'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 30 } def...
(self): self.min_position = -1.2 self.max_position = 0.6 self.max_speed = 0.07 self.goal_position = 0.5 self.low = np.array([self.min_position, -self.max_speed]) self.high = np.array([self.max_position, self.max_speed]) self.viewer = None self.action_sp...
__init__
identifier_name
mountain_car.py
""" https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp """ import math import gym from gym import spaces from gym.utils import seeding import numpy as np class MountainCarEnv(gym.Env): metadata = { 'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 30 } def...
return screen_width = 600 screen_height = 400 world_width = self.max_position - self.min_position scale = screen_width/world_width carwidth=40 carheight=20 if self.viewer is None: from gym.envs.classic_control import rendering ...
self.viewer.close() self.viewer = None
conditional_block
mountain_car.py
""" https://webdocs.cs.ualberta.ca/~sutton/MountainCar/MountainCar1.cp """ import math import gym from gym import spaces from gym.utils import seeding import numpy as np class MountainCarEnv(gym.Env): metadata = { 'render.modes': ['human', 'rgb_array'], 'video.frames_per_second': 30 } def...
carwidth=40 carheight=20 if self.viewer is None: from gym.envs.classic_control import rendering self.viewer = rendering.Viewer(screen_width, screen_height) xs = np.linspace(self.min_position, self.max_position, 100) ys = self._height(xs) ...
screen_width = 600 screen_height = 400 world_width = self.max_position - self.min_position scale = screen_width/world_width
random_line_split
rqenqueue.py
from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.utils.version import get_version from django_rq import get_queue class Command(BaseCommand): """ Queue a function with the given arguments. """ help = __doc__ args = '<function arg arg ...>...
(self, *args, **options): """ Queues the function given with the first argument with the parameters given with the rest of the argument list. """ verbosity = int(options.get('verbosity', 1)) timeout = options.get('timeout') queue = get_queue(options.get('queue')) ...
handle
identifier_name
rqenqueue.py
from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.utils.version import get_version from django_rq import get_queue class Command(BaseCommand): """ Queue a function with the given arguments. """ help = __doc__ args = '<function arg arg ...>...
def handle(self, *args, **options): """ Queues the function given with the first argument with the parameters given with the rest of the argument list. """ verbosity = int(options.get('verbosity', 1)) timeout = options.get('timeout') queue = get_queue(option...
parser.add_argument('--queue', '-q', dest='queue', default='default', help='Specify the queue [default]') parser.add_argument('--timeout', '-t', type=int, dest='timeout', help='A timeout in seconds') if LooseVersion(get_version()) >= LooseVersion(...
identifier_body
rqenqueue.py
from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.utils.version import get_version from django_rq import get_queue class Command(BaseCommand): """ Queue a function with the given arguments. """ help = __doc__ args = '<function arg arg ...>...
print('Job %s created' % job.id)
conditional_block
rqenqueue.py
from distutils.version import LooseVersion from django.core.management.base import BaseCommand from django.utils.version import get_version from django_rq import get_queue class Command(BaseCommand): """ Queue a function with the given arguments. """
def add_arguments(self, parser): parser.add_argument('--queue', '-q', dest='queue', default='default', help='Specify the queue [default]') parser.add_argument('--timeout', '-t', type=int, dest='timeout', help='A timeout in seconds') if...
help = __doc__ args = '<function arg arg ...>'
random_line_split
example_crbm.py
from models.sampler import DynamicBlockGibbsSampler from models.distribution import DynamicBernoulli from models.optimizer import DynamicSGD from utils.utils import prepare_frames from scipy import io as matio from data.gwtaylor.path import * import ipdb import numpy as np SIZE_BATCH = 10 EPOCHS = 100 SIZE_HIDDEN = 50...
hidden_0_probs, hidden_0_states, \ hidden_k_probs, hidden_k_states, \ visible_k_probs, visible_k_states = gibbs_sampler.sample(data[:, :, 0], data[:, :, 1:]) # compute deltas d_weight_update, d_bias_hidden_update, \ d_bias_visible_update, d_vis_vis,...
data[idx, :, :] = dataset[start:end, :].T
conditional_block
example_crbm.py
from models.sampler import DynamicBlockGibbsSampler from models.distribution import DynamicBernoulli from models.optimizer import DynamicSGD from utils.utils import prepare_frames from scipy import io as matio from data.gwtaylor.path import * import ipdb import numpy as np SIZE_BATCH = 10 EPOCHS = 100 SIZE_HIDDEN = 50...
# compute deltas d_weight_update, d_bias_hidden_update, \ d_bias_visible_update, d_vis_vis, d_vis_hid = sgd.optimize(data[:, :, 0], hidden_0_states, hidden_0_probs, hidden_k_probs, hidden_k_states, visible_k_probs, visible_k_states...
random_line_split
chart.service.js
(function () { 'use strict'; var chartMod = angular.module('cloudbrain') chartMod.value('API_URL', 'http://demo.apiserver.cloudbrain.rocks'); //Data Service chartMod.factory('dataService',['$http','$interval', 'API_URL', function ($http, $interval, API_URL) { var powerBandPromise = null; var DATA_SPEED =...
(deviceName, deviceId, callback) { var curTimestamp = new Date().getTime(); if (!powerBandPromise) { powerBandPromise = $interval(function() { $http.jsonp(API_URL + '/power_bands?device_name=' + deviceName + '&device_id=' + deviceId + '&callback=JSON_C...
startPowerBand
identifier_name
chart.service.js
(function () { 'use strict'; var chartMod = angular.module('cloudbrain') chartMod.value('API_URL', 'http://demo.apiserver.cloudbrain.rocks'); //Data Service chartMod.factory('dataService',['$http','$interval', 'API_URL', function ($http, $interval, API_URL) { var powerBandPromise = null; var DATA_SPEED =...
} // Public service interface return { startPowerBand: startPowerBand, stopPowerBand: stopPowerBand, }; }]); })();
{ $interval.cancel(powerBandPromise); powerBandPromise = null; }
conditional_block
chart.service.js
(function () { 'use strict'; var chartMod = angular.module('cloudbrain') chartMod.value('API_URL', 'http://demo.apiserver.cloudbrain.rocks'); //Data Service chartMod.factory('dataService',['$http','$interval', 'API_URL', function ($http, $interval, API_URL) { var powerBandPromise = null; var DATA_SPEED =...
$interval.cancel(powerBandPromise); powerBandPromise = null; } } // Public service interface return { startPowerBand: startPowerBand, stopPowerBand: stopPowerBand, }; }]); })();
} } function stopPowerBand() { if (powerBandPromise) {
random_line_split
chart.service.js
(function () { 'use strict'; var chartMod = angular.module('cloudbrain') chartMod.value('API_URL', 'http://demo.apiserver.cloudbrain.rocks'); //Data Service chartMod.factory('dataService',['$http','$interval', 'API_URL', function ($http, $interval, API_URL) { var powerBandPromise = null; var DATA_SPEED =...
// Public service interface return { startPowerBand: startPowerBand, stopPowerBand: stopPowerBand, }; }]); })();
{ if (powerBandPromise) { $interval.cancel(powerBandPromise); powerBandPromise = null; } }
identifier_body
utils.js
require('coffee-script'); var utils = require('../lib/utils'); /* ======== A Handy Little Nodeunit Reference ======== https://github.com/caolan/nodeunit Test methods: test.expect(numAssertions) test.done() Test assertions: test.ok(value, [message]) test.equal(actual, expected, [message]) test.notEqual(actua...
test.notStrictEqual(actual, expected, [message]) test.throws(block, [error], [message]) test.doesNotThrow(block, [error], [message]) test.ifError(value) */ exports['utils'] = { setUp:function (done) { // setup here done(); }, 'endsWith':function (test) { test.expect(5); ...
random_line_split
test_serializers.py
""" Test cases to cover Accounts-related serializers of the User API application """ import logging from django.test import TestCase from django.test.client import RequestFactory from testfixtures import LogCapture from openedx.core.djangoapps.user_api.accounts.serializers import UserReadOnlySerializer from common....
assert data['name'] is None
random_line_split
test_serializers.py
""" Test cases to cover Accounts-related serializers of the User API application """ import logging from django.test import TestCase from django.test.client import RequestFactory from testfixtures import LogCapture from openedx.core.djangoapps.user_api.accounts.serializers import UserReadOnlySerializer from common....
def test_serializer_data(self): """ Test serializer return data properly. """ UserProfile.objects.create(user=self.user, name='test name') data = UserReadOnlySerializer(self.user, configuration=self.config, context={'request': self.request}).data assert data['userna...
super(UserReadOnlySerializerTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments request_factory = RequestFactory() self.request = request_factory.get('/api/user/v1/accounts/') self.user = UserFactory.build(username='test_user', email='test_user@test.com') self.user....
identifier_body
test_serializers.py
""" Test cases to cover Accounts-related serializers of the User API application """ import logging from django.test import TestCase from django.test.client import RequestFactory from testfixtures import LogCapture from openedx.core.djangoapps.user_api.accounts.serializers import UserReadOnlySerializer from common....
(self): """ Test serializer return data properly when user does not have profile. """ with LogCapture(LOGGER_NAME, level=logging.DEBUG) as logger: data = UserReadOnlySerializer(self.user, configuration=self.config, context={'request': self.request}).data logger.ch...
test_user_no_profile
identifier_name
blinky.rs
//! Turns the user LED on #![feature(const_fn)] #![feature(used)] #![no_std] extern crate blue_pill; extern crate embedded_hal as hal; // version = "0.2.3" extern crate cortex_m_rt; // version = "0.1.0" #[macro_use] extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; use blue_pill::led::{self, Green}; use b...
// IDLE LOOP fn idle(_prio: P0, _thr: T0) -> ! { // Sleep loop { rtfm::wfi(); } } // TASKS tasks!(stm32f103xx, { blink: Task { interrupt: TIM1_UP_TIM10, priority: P1, enabled: true, }, }); fn blink(mut task: TIM1_UP_TIM10, ref prio: P1, ref thr: T1) { static S...
{ let gpioc = &GPIOC.access(prio, thr); let rcc = &RCC.access(prio, thr); let tim1 = TIM1.access(prio, thr); let timer = Timer(&*tim1); led::init(gpioc, rcc); timer.init(FREQUENCY.invert(), rcc); timer.resume(); }
identifier_body
blinky.rs
//! Turns the user LED on #![feature(const_fn)] #![feature(used)] #![no_std] extern crate blue_pill; extern crate embedded_hal as hal; // version = "0.2.3" extern crate cortex_m_rt; // version = "0.1.0" #[macro_use] extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; use blue_pill::led::{self, Green}; use b...
} else { Green.off(); } }
random_line_split
blinky.rs
//! Turns the user LED on #![feature(const_fn)] #![feature(used)] #![no_std] extern crate blue_pill; extern crate embedded_hal as hal; // version = "0.2.3" extern crate cortex_m_rt; // version = "0.1.0" #[macro_use] extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; use blue_pill::led::{self, Green}; use b...
(mut task: TIM1_UP_TIM10, ref prio: P1, ref thr: T1) { static STATE: Local<bool, TIM1_UP_TIM10> = Local::new(false); let tim1 = TIM1.access(prio, thr); let timer = Timer(&*tim1); // NOTE(wait) timeout should have already occurred timer.wait().unwrap(); let state = STATE.borrow_mut(&mut task)...
blink
identifier_name
blinky.rs
//! Turns the user LED on #![feature(const_fn)] #![feature(used)] #![no_std] extern crate blue_pill; extern crate embedded_hal as hal; // version = "0.2.3" extern crate cortex_m_rt; // version = "0.1.0" #[macro_use] extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; use blue_pill::led::{self, Green}; use b...
else { Green.off(); } }
{ Green.on(); }
conditional_block
inspections.js
import React, { Component } from 'react' import axios from 'axios' import { Button, Icon, Table } from 'semantic-ui-react' import { store } from './main' import actions from '../appConfig/actions' import { NODATA, statusConfig, severityConfig } from '../appConfig/inspectionconfg' import Urls from '../appConfig/urls' im...
<li>action: {i.action}</li> <li>outcome: {i.outcome}</li> <li>min inspections/yr: {i.mipy}</li> <li>version: {i.version}</li> <li>venue_id: {i.venue_id}</li> <li>created_at: {i.created_at}</li> <li>updated_at: {i.updated_at}</li> </ul> ) } render()...
<li>date: {i.date}</li> <li>severity: {i.severity}</li>
random_line_split
inspections.js
import React, { Component } from 'react' import axios from 'axios' import { Button, Icon, Table } from 'semantic-ui-react' import { store } from './main' import actions from '../appConfig/actions' import { NODATA, statusConfig, severityConfig } from '../appConfig/inspectionconfg' import Urls from '../appConfig/urls' im...
else { readMore.push(id) } this.setState( { readMore: readMore } ) } colapseAll = () => { this.setState( { readMore: [] } ) } expandAll = () => { const allIds = this.state.allIds this.setState( { readMore: allIds } ) } renderReadMore = (i) => { return ( <ul> ...
{ readMore = this.state.readMore.filter( (element) => { return element !== id } ) }
conditional_block
inspections.js
import React, { Component } from 'react' import axios from 'axios' import { Button, Icon, Table } from 'semantic-ui-react' import { store } from './main' import actions from '../appConfig/actions' import { NODATA, statusConfig, severityConfig } from '../appConfig/inspectionconfg' import Urls from '../appConfig/urls' im...
<Table.Cell><Icon onClick={ () => this.toggleReadMore(i.id) } name={chevron} />{iidData}</Table.Cell> <Table.Cell><StatusLabel text={statusText} config={statusCfg} /></Table.Cell> <Table.Cell singleLine>{i.date}</Table.Cell> <Table.Cell singleLine><StatusLabel text={severityFinal...
{ const inspections = store.getState().app.inspections const rows = inspections.map( (i) => { const key = `inspection_${i.iid}_${idify(i.created_at)}` const severityText = cap(nodata(i.severity.trim())) const severityFirstChar = severityText[0] const severityCfg = severityConfig[severity...
identifier_body
inspections.js
import React, { Component } from 'react' import axios from 'axios' import { Button, Icon, Table } from 'semantic-ui-react' import { store } from './main' import actions from '../appConfig/actions' import { NODATA, statusConfig, severityConfig } from '../appConfig/inspectionconfg' import Urls from '../appConfig/urls' im...
extends Component { state = { latest: null, vid: null, address: null, name: null, fullDetails: '', modalOpen: false, readMore: [], allIds: [] } componentDidMount = () => { const vid = getParameterByName('vid') const address = getParameterByName('address') const name = getParameterByName('name') con...
Inspections
identifier_name
P05_HihiAndCrazyBits.py
# Hihi is the grandfather of all geeks in IIITA. He and his crazy ideas.....Huh..... Currently, hihi is working on his most famous project # named 21 Lane, but he is stuck at a tricky segment of his code. # Hihi wants to assign some random IP addresses to users, but he won't use rand(). He wants to change the current...
a=int(input()) print(a|a+1)
conditional_block
P05_HihiAndCrazyBits.py
# Hihi is the grandfather of all geeks in IIITA. He and his crazy ideas.....Huh..... Currently, hihi is working on his most famous project # named 21 Lane, but he is stuck at a tricky segment of his code. # Hihi wants to assign some random IP addresses to users, but he won't use rand(). He wants to change the current...
# 14 # SAMPLE OUTPUT # 7 # 5 # 11 # 13 # 15 for _ in range(int(input())): a=int(input()) print(a|a+1)
# 6 # 4 # 10 # 12
random_line_split
litmail-nav-menu.ts
import {LitElement, css, html, customElement, property, query, PropertyValues} from 'lit-element'; import { LitMailNavMenuItem } from './litmail-nav-menu-item'; @customElement('litmail-nav-menu') export class LitMailNavMenu extends LitElement { static styles = [css` :host { display: block; padding: 8...
constructor() { super(); this.addEventListener('litmail-nav-select', (e: Event) => { console.log('litmail-nav-menu litmail-nav-select', (e.target as any).labelId); this.selectedItem = e.target as LitMailNavMenuItem; }); } render() { return html`<slot></slot>` } }
{ if (v === this._selectedItem) { return; } if (this._selectedItem) { this._selectedItem.selected = false; } this._selectedItem = v; if (this._selectedItem) { this._selectedItem.selected = true; } }
identifier_body
litmail-nav-menu.ts
import {LitElement, css, html, customElement, property, query, PropertyValues} from 'lit-element'; import { LitMailNavMenuItem } from './litmail-nav-menu-item'; @customElement('litmail-nav-menu') export class LitMailNavMenu extends LitElement { static styles = [css` :host { display: block; padding: 8...
if (this._selectedItem) { this._selectedItem.selected = false; } this._selectedItem = v; if (this._selectedItem) { this._selectedItem.selected = true; } } constructor() { super(); this.addEventListener('litmail-nav-select', (e: Event) => { console.log('litmail-nav-men...
{ return; }
conditional_block
litmail-nav-menu.ts
import {LitElement, css, html, customElement, property, query, PropertyValues} from 'lit-element'; import { LitMailNavMenuItem } from './litmail-nav-menu-item'; @customElement('litmail-nav-menu') export class LitMailNavMenu extends LitElement { static styles = [css` :host { display: block; padding: 8...
(): LitMailNavMenuItem|undefined { return this._selectedItem; } set selectedItem(v: LitMailNavMenuItem|undefined) { if (v === this._selectedItem) { return; } if (this._selectedItem) { this._selectedItem.selected = false; } this._selectedItem = v; if (this._selectedItem) { ...
selectedItem
identifier_name
litmail-nav-menu.ts
import {LitElement, css, html, customElement, property, query, PropertyValues} from 'lit-element'; import { LitMailNavMenuItem } from './litmail-nav-menu-item'; @customElement('litmail-nav-menu') export class LitMailNavMenu extends LitElement { static styles = [css` :host { display: block; padding: 8...
render() { return html`<slot></slot>` } }
random_line_split
size_hint.rs
#![feature(core, unboxed_closures)] extern crate core; #[cfg(test)] mod tests { use core::iter::Iterator; use core::iter::FlatMap; struct A<T> { begin: T, end: T } macro_rules! Iterator_impl { ($T:ty) => { impl Iterator for A<$T> { type Item = $T; fn next(&mut self) -> Option<Self::I...
} impl FnMut<Args> for F { extern "rust-call" fn call_mut(&mut self, (item,): Args) -> Self::Output { A { begin: 0, end: item } } } #[test] fn size_hint_test1() { let a: A<T> = A { begin: 0, end: 10 }; let f: F = F; let mut flat_map: FlatMap<A<T>, U, F> = a.flat_map::<U, F>(f); for n ...
{ A { begin: 0, end: item } }
identifier_body
size_hint.rs
#![feature(core, unboxed_closures)] extern crate core; #[cfg(test)] mod tests { use core::iter::Iterator; use core::iter::FlatMap; struct A<T> { begin: T, end: T } macro_rules! Iterator_impl { ($T:ty) => { impl Iterator for A<$T> { type Item = $T; fn next(&mut self) -> Option<Self::I...
for i in 0..n { let x: Option<<U as IntoIterator>::Item> = flat_map.next(); match x { Some(v) => { assert_eq!(v, i); } None => { assert!(false); } } let (lower, _): (usize, Option<usize>) = flat_map.size_hint(); assert_eq!(lower, (n - i - 1) as usize); } } assert_eq!(flat_map.next(),...
random_line_split
size_hint.rs
#![feature(core, unboxed_closures)] extern crate core; #[cfg(test)] mod tests { use core::iter::Iterator; use core::iter::FlatMap; struct
<T> { begin: T, end: T } macro_rules! Iterator_impl { ($T:ty) => { impl Iterator for A<$T> { type Item = $T; fn next(&mut self) -> Option<Self::Item> { if self.begin < self.end { let result = self.begin; self.begin = self.begin.wrapping_add(1); Some::<Self::Item>(result) } els...
A
identifier_name
size_hint.rs
#![feature(core, unboxed_closures)] extern crate core; #[cfg(test)] mod tests { use core::iter::Iterator; use core::iter::FlatMap; struct A<T> { begin: T, end: T } macro_rules! Iterator_impl { ($T:ty) => { impl Iterator for A<$T> { type Item = $T; fn next(&mut self) -> Option<Self::I...
} let (lower, _): (usize, Option<usize>) = flat_map.size_hint(); assert_eq!(lower, (n - i - 1) as usize); } } assert_eq!(flat_map.next(), None::<Item>); } }
{ assert!(false); }
conditional_block
index.d.ts
// Generated by typings // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/gulp-uglify/gulp-uglify.d.ts
interface Options { /** * Pass false to skip mangling names. */ mangle?: boolean; /** * Pass if you wish to specify additional output options. The defaults are optimized for best compression. */ output?: UglifyJ...
declare module "gulp-uglify" { import * as UglifyJS from 'uglify-js'; namespace GulpUglify {
random_line_split
webrtc.io.js
var io = require('socket.io'); var client = require('webrtc.io-client'); var rtc = {}; rtc._events = {}; var rooms = {}; module.exports.listen = function() { // delegate all arguments to socket.io.listen var manager = io.listen.apply(io, arguments); attachRoutes(manager); attachEvents(manager); return mana...
for (var i = 0, len = events.length; i < len; i++) { events[i].apply(null, args); } }; function attachRoutes(manager) { var server = manager.server; var oldHandlers = server.listeners('request').splice(0); server.on('request', function(req, res) { if (req.url !== '/webrtc.io/webrtc.io.js') { ...
{ return; }
conditional_block
webrtc.io.js
var io = require('socket.io'); var client = require('webrtc.io-client'); var rtc = {}; rtc._events = {}; var rooms = {}; module.exports.listen = function() { // delegate all arguments to socket.io.listen var manager = io.listen.apply(io, arguments); attachRoutes(manager); attachEvents(manager); return mana...
(manager) { var server = manager.server; var oldHandlers = server.listeners('request').splice(0); server.on('request', function(req, res) { if (req.url !== '/webrtc.io/webrtc.io.js') { // re-run old handlers for (var i = 0, len = oldHandlers.length; i < len; i++) { var handler = oldHandle...
attachRoutes
identifier_name
webrtc.io.js
var io = require('socket.io'); var client = require('webrtc.io-client'); var rtc = {}; rtc._events = {}; var rooms = {}; module.exports.listen = function() { // delegate all arguments to socket.io.listen var manager = io.listen.apply(io, arguments); attachRoutes(manager); attachEvents(manager); return mana...
res.writeHead(200, { 'Content-Type': 'text/javascript' }); res.end(req.method !== 'HEAD' && content ? content : ''); }); }); } function attachEvents(manager) { manager.sockets.on('connection', function(socket) { // TODO: let you join multiple rooms socket.on('join room', function(room) { ...
{ var server = manager.server; var oldHandlers = server.listeners('request').splice(0); server.on('request', function(req, res) { if (req.url !== '/webrtc.io/webrtc.io.js') { // re-run old handlers for (var i = 0, len = oldHandlers.length; i < len; i++) { var handler = oldHandlers[i]; ...
identifier_body
webrtc.io.js
var io = require('socket.io'); var client = require('webrtc.io-client'); var rtc = {}; rtc._events = {}; var rooms = {}; module.exports.listen = function() { // delegate all arguments to socket.io.listen var manager = io.listen.apply(io, arguments); attachRoutes(manager); attachEvents(manager); return mana...
socket.broadcast.to(room).emit('remove peer connected', { socketId: socket.id }); } } rtc.fire('disconnect'); }); socket.on('receive ice candidate', function(data) { var soc = getSocket(room, data.socketId); if (soc) { ...
if (id == socket.id) { connections.splice(i, 1); i--; socket.leave(room);
random_line_split
DateRangePicker.tsx
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { useUtils } from '../_shared/hooks/useUtils'; import { MobileWrapper } from '../wrappers/MobileWrapper'; import { withDefaultProps } from '../_shared/withDefaultProps'; import { useParsedDate } from '../_shared/hooks/date-helpers-hooks'; i...
minDate: __minDate = defaultMinDate as TDate, maxDate: __maxDate = defaultMaxDate as TDate, ...other }: BaseDateRangePickerProps<TDate> & AllSharedDateRangePickerProps<TDate> & ExtendWrapper<TWrapper>) { const utils = useUtils(); const minDate = useParsedDate(__minDate); const maxDate ...
{ const WrapperComponent = makeWrapperComponent<DateRangeInputProps>(Wrapper, { KeyboardDateInputComponent: DateRangePickerInput, PureDateInputComponent: DateRangePickerInput, }); const rangePickerValueManager: PickerStateValueManager<any, any> = { emptyValue: [null, null], parseInput: parseRange...
identifier_body
DateRangePicker.tsx
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { useUtils } from '../_shared/hooks/useUtils'; import { MobileWrapper } from '../wrappers/MobileWrapper'; import { withDefaultProps } from '../_shared/withDefaultProps'; import { useParsedDate } from '../_shared/hooks/date-helpers-hooks'; i...
>('start'); const pickerStateProps = { ...other, value, onChange, inputFormat: passedInputFormat || utils.formats.keyboardDate, }; const restProps = { ...other, minDate, maxDate, }; const { pickerProps, inputProps, wrapperProps } = usePickerState< ...
const maxDate = useParsedDate(__maxDate); const [currentlySelectingRangeEnd, setCurrentlySelectingRangeEnd] = React.useState< 'start' | 'end'
random_line_split
DateRangePicker.tsx
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { useUtils } from '../_shared/hooks/useUtils'; import { MobileWrapper } from '../wrappers/MobileWrapper'; import { withDefaultProps } from '../_shared/withDefaultProps'; import { useParsedDate } from '../_shared/hooks/date-helpers-hooks'; i...
<TWrapper extends SomeWrapper>( name: string, Wrapper: TWrapper ): RangePickerComponent<TWrapper> { const WrapperComponent = makeWrapperComponent<DateRangeInputProps>(Wrapper, { KeyboardDateInputComponent: DateRangePickerInput, PureDateInputComponent: DateRangePickerInput, }); const rangePickerValueM...
makeRangePicker
identifier_name
num.rs
COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option...
(&self, x: u8) -> u8 { match x { x @ 0 ... 9 => b'0' + x, x if x < self.base() => b'a' + (x - 10), x => panic!("number not in the range 0..{}: {}", self.base() - 1, x), } } } /// A helper type for formatting radixes. #[unstable(feature = "core", reaso...
digit
identifier_name
num.rs
// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This fil...
} /// A helper type for formatting radixes. #[unstable(feature = "core", reason = "may be renamed or move to a different module")] #[derive(Copy)] pub struct RadixFmt<T, R>(T, R); /// Constructs a radix formatter in the range of `2..36`. /// /// # Examples /// /// ``` /// use std::fmt::radix; /// assert_e...
{ match x { x @ 0 ... 9 => b'0' + x, x if x < self.base() => b'a' + (x - 10), x => panic!("number not in the range 0..{}: {}", self.base() - 1, x), } }
identifier_body
num.rs
COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option...
} } } } } radix! { Binary, 2, "0b", x @ 0 ... 2 => b'0' + x } radix! { Octal, 8, "0o", x @ 0 ... 7 => b'0' + x } radix! { Decimal, 10, "", x @ 0 ... 9 => b'0' + x } radix! { LowerHex, 16, "0x", x @ 0 ... 9 => b'0' + x, x @ 10 ... 15...
fn prefix(&self) -> &'static str { $prefix } fn digit(&self, x: u8) -> u8 { match x { $($x => $conv,)+ x => panic!("number not in the range 0..{}: {}", self.base() - 1, x),
random_line_split
num.rs
COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option...
else { // Do the same as above, but accounting for two's complement. for byte in buf.iter_mut().rev() { let n = zero - (x % base); // Get the current place value. x = x / base; // Deaccumulate the number. ...
{ // Accumulate each digit of the number from the least significant // to the most significant figure. for byte in buf.iter_mut().rev() { let n = x % base; // Get the current place value. x = x / base; ...
conditional_block
RandomGenerator.ts
/** * Copyright 2018 Google LLC. 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 applic...
return str; } static generateRandomOrderId(): string { // Generate a random number in the form of 'GPA.xxxx-xxxx-xxxx-xxxxx' return 'GPA.' + this.generateRandomZeroPaddedNumber(4) + '-' + this.generateRandomZeroPaddedNumber(4) + '-' + this.generateRandomZeroPaddedNumber(4) + '-' ...
{ str = '0' + str; }
conditional_block
RandomGenerator.ts
/** * Copyright 2018 Google LLC. 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 applic...
(): string { const nowInSeconds = new Date().getTime(); // use this method to avoid Date.now() being mocked const offset = 1523940836000; // April 17, 2018 1:53:56 PM GMT+09:00. Only use to reduce number of digits being used return (nowInSeconds - offset) + ''; } }
generateUniqueIdFromTimestamp
identifier_name
RandomGenerator.ts
/** * Copyright 2018 Google LLC. 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 applic...
static generateUniqueIdFromTimestamp(): string { const nowInSeconds = new Date().getTime(); // use this method to avoid Date.now() being mocked const offset = 1523940836000; // April 17, 2018 1:53:56 PM GMT+09:00. Only use to reduce number of digits being used return (nowInSeconds - offset) + ''; } }
{ // Generate a random number in the form of 'GPA.xxxx-xxxx-xxxx-xxxxx' return 'GPA.' + this.generateRandomZeroPaddedNumber(4) + '-' + this.generateRandomZeroPaddedNumber(4) + '-' + this.generateRandomZeroPaddedNumber(4) + '-' + this.generateRandomZeroPaddedNumber(5); }
identifier_body
RandomGenerator.ts
/** * Copyright 2018 Google LLC. 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 *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export default class RandomGenerator { static generateRandomZeroPaddedNumber(digits: number): string { const value = Math.floor(...
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
random_line_split
textutil.py
def gettext(node): """ Get node text """ if node is None: return None for child in node.childNodes: if child.nodeType == child.TEXT_NODE: return child.data return None def findtext(root, tag, namespace=None): """ Get text of node by tag and namespace und...
""" Get first node by tag and namespace under Node root. """ nodes = findall(root, tag, namespace=namespace) if nodes is not None and len(nodes) >= 1: return nodes[0] else: return None
identifier_body
textutil.py
Get first node by tag and namespace under Node root. """ nodes = findall(root, tag, namespace=namespace) if nodes is not None and len(nodes) >= 1: return nodes[0] else: return None def gettext(node): """ Get node text """ if node is None: return None fo...
result += " " j += 1 result += " " for j in range(i - (i % 16), i + 1): byte = buffer[j] if type(byte) == str: byte = str_to_ord(byte.decode('latin1')) k = '.' if is_printable(...
if ((i + 1) % 16) == 0 or (i + 1) == size: j = i while ((j + 1) % 16) != 0: result += " " if (j & 7) == 7:
random_line_split
textutil.py
Get first node by tag and namespace under Node root. """ nodes = findall(root, tag, namespace=namespace) if nodes is not None and len(nodes) >= 1: return nodes[0] else: return None def gettext(node): """ Get node text """ if node is None: return None fo...
j += 1 result += " " for j in range(i - (i % 16), i + 1): byte = buffer[j] if type(byte) == str: byte = str_to_ord(byte.decode('latin1')) k = '.' if is_printable(byte): k = ch...
result += " "
conditional_block
textutil.py
1) == size: j = i while ((j + 1) % 16) != 0: result += " " if (j & 7) == 7: result += " " j += 1 result += " " for j in range(i - (i % 16), i + 1): byte = buffer[j] if ty...
format_exception
identifier_name
plugin.py
5" pixmap="skin_default/progress_big.png" borderWidth="2" borderColor="#cccccc" /> </screen>""" def __init__(self, session, scanTuner, scanNetwork, scanFrequency, scanSymbolRate, scanModulation, keepNumbers, hdList): Screen.__init__(self, session) self.setTitle(_("Cable Scan")) self.scanTuner = scanTuner self...
Session.open(CableScanScreen, nimlist)
conditional_block
plugin.py
, self.scanSymbolRate, self.scanModulation, self.keepNumbers, self.hdList) self.scan.scanCompleted.get().append(self.scanCompleted) self.scan.scanProgress.get().append(self.scanProgress) self.scan.start(self.scanTuner) def execEnd(self): self.scan.scanCompleted.get().remove(self.scanCompleted) self.scan.sca...
self.onFirstExecBegin.append(self.doServiceScan) def doServiceScan(self): self["scan"] = CableScan(self["scan_state"], self["scan_progress"], self.scanTuner, self.scanNetwork, self.scanFrequency, self.scanSymbolRate, self.scanModulation, self.keepNumbers, self.hdList) def restoreService(self): if self.prevse...
{ "ok": self.ok, "cancel": self.cancel })
random_line_split
plugin.py
def execBegin(self): self.text.setText(_('Scanning...') + " " + _("please wait")) self.progressbar.setValue(0) self.scan = eCableScan(self.scanNetwork, self.scanFrequency, self.scanSymbolRate, self.scanModulation, self.keepNumbers, self.hdList) self.scan.scanCompleted.get().append(self.scanCompleted) self....
self.text = text; self.progressbar = progressbar; self.scanTuner = scanTuner self.scanNetwork = scanNetwork self.scanFrequency = scanFrequency self.scanSymbolRate = scanSymbolRate self.scanModulation = scanModulation self.keepNumbers = keepNumbers self.hdList = hdList self.done = False
identifier_body
plugin.py
, self.scanSymbolRate, self.scanModulation, self.keepNumbers, self.hdList) self.scan.scanCompleted.get().append(self.scanCompleted) self.scan.scanProgress.get().append(self.scanProgress) self.scan.start(self.scanTuner) def execEnd(self): self.scan.scanCompleted.get().remove(self.scanCompleted) self.scan.sca...
(self): self.restoreService() self.close() config.plugins.CableScan = ConfigSubsection() config.plugins.CableScan.keepnumbering = ConfigYesNo(default = True) config.plugins.CableScan.hdlist = ConfigYesNo(default = True) config.plugins.CableScan.frequency = ConfigFloat(default = [130, 0], limits = [(42, 870),(0, 99...
cancel
identifier_name
works.service.ts
import { Injectable } from '@angular/core'; import { AngularFireDatabase } from 'angularfire2/database'; import { Observable } from 'rxjs/Observable';
@Injectable() export class WorksService { constructor(private db: AngularFireDatabase, private tagsService: TagsService) { } /** * get all active works * @returns {Observable<IWork[]>} */ findAllActiveWorks(): Observable<IWork[]> { return this.db.list('/works', { query: { orde...
import { IWork } from '../../models/work.model'; import { TagsService } from '../tags-service/tags.service';
random_line_split
works.service.ts
import { Injectable } from '@angular/core'; import { AngularFireDatabase } from 'angularfire2/database'; import { Observable } from 'rxjs/Observable'; import { IWork } from '../../models/work.model'; import { TagsService } from '../tags-service/tags.service'; @Injectable() export class WorksService { constructor(p...
/** * get all active works * @returns {Observable<IWork[]>} */ findAllActiveWorks(): Observable<IWork[]> { return this.db.list('/works', { query: { orderByChild: 'active', equalTo: true } }) .take(1); } /** * given active works add the tag list to each work * @returns {Obse...
{ }
identifier_body
works.service.ts
import { Injectable } from '@angular/core'; import { AngularFireDatabase } from 'angularfire2/database'; import { Observable } from 'rxjs/Observable'; import { IWork } from '../../models/work.model'; import { TagsService } from '../tags-service/tags.service'; @Injectable() export class WorksService { constructor(p...
(): Observable<IWork[]> { return this.db.list('/works', { query: { orderByChild: 'active', equalTo: true } }) .take(1); } /** * given active works add the tag list to each work * @returns {Observable<R>} */ addTagListToWorks(): Observable<IWork[]> { return this.findAllActiveWorks...
findAllActiveWorks
identifier_name
short_generator_vows.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from pyvows import Vows, expect from tc_shortener.generators.short_generator import Generator from tc_core.context import Context from thumbor.config impo...
(self, short_generator): return short_generator.get('/unsafe/200x300/image.jpg') def should_preserve_image(self, topic): expect(topic).to_match(r'^.*/image.jpg$') def should_be_fixed_length(self, topic): expect(topic).to_length(22+len('/image.jpg...
topic
identifier_name
short_generator_vows.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from pyvows import Vows, expect from tc_shortener.generators.short_generator import Generator from tc_core.context import Context from thumbor.config impo...
def topic(self, short_generator): return short_generator.get('') def should_raise_error(self, topic): expect(topic).to_be_an_error_like(ValueError) class WhenShortening(Vows.Context): def topic(self, short_generator): return s...
random_line_split
short_generator_vows.py
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from pyvows import Vows, expect from tc_shortener.generators.short_generator import Generator from tc_core.context import Context from thumbor.config impo...
def should_be_fixed_length(self, topic): expect(topic).to_length(22+len('/image.jpg'))
expect(topic).to_match(r'^.*/image.jpg$')
identifier_body
index.js
var config = require('../lib/config')(); var Changeset = require('./Changeset'); var queries = require('./queries'); var helpers = require('../helpers'); require('../validators'); var validate = require('validate.js'); var errors = require('../errors'); var pgPromise = helpers.pgPromise; var promisifyQuery = helpers.pr...
if (changesetResult.rows.length === 0) { return Promise.reject(new errors.NotFoundError('Changeset not found')); } var changeset = new Changeset(results[0].rows[0], results[1].rows); return changeset.getGeoJSON(); }); }; function processSearchResu...
}) .then(function (results) { var changesetResult = results[0];
random_line_split
index.js
var config = require('../lib/config')(); var Changeset = require('./Changeset'); var queries = require('./queries'); var helpers = require('../helpers'); require('../validators'); var validate = require('validate.js'); var errors = require('../errors'); var pgPromise = helpers.pgPromise; var promisifyQuery = helpers.pr...
var featureCollection = { 'type': 'FeatureCollection', 'features': changesetsArray, 'total': count }; return featureCollection; } function validateParams(params) { var constraints = { 'from': { 'presence': false, 'datetime': true }, ...
{ count = 0; }
conditional_block
index.js
var config = require('../lib/config')(); var Changeset = require('./Changeset'); var queries = require('./queries'); var helpers = require('../helpers'); require('../validators'); var validate = require('validate.js'); var errors = require('../errors'); var pgPromise = helpers.pgPromise; var promisifyQuery = helpers.pr...
(params) { var constraints = { 'from': { 'presence': false, 'datetime': true }, 'to': { 'presence': false, 'datetime': true }, 'bbox': { 'presence': false, 'bbox': true } }; var errs = val...
validateParams
identifier_name
index.js
var config = require('../lib/config')(); var Changeset = require('./Changeset'); var queries = require('./queries'); var helpers = require('../helpers'); require('../validators'); var validate = require('validate.js'); var errors = require('../errors'); var pgPromise = helpers.pgPromise; var promisifyQuery = helpers.pr...
return errMsg; } return null; }
{ var constraints = { 'from': { 'presence': false, 'datetime': true }, 'to': { 'presence': false, 'datetime': true }, 'bbox': { 'presence': false, 'bbox': true } }; var errs = validate(par...
identifier_body
main.js
--- layout: null --- $(document).ready(function () { $('a.blog-button').click(function (e) { if ($('.panel-cover').hasClass('panel-cover--collapsed')){ return; } currentWidth = $('.panel-cover').width(); if (currentWidth < 960) { $('.panel-cover').addClass('panel-cover--collapsed'); ...
$('.btn-mobile-menu__icon').toggleClass('icon-list icon-x-circle animated fadeIn'); }); });
$('.navigation-wrapper').toggleClass('visible');
random_line_split
main.js
--- layout: null --- $(document).ready(function () { $('a.blog-button').click(function (e) { if ($('.panel-cover').hasClass('panel-cover--collapsed')){ return; } currentWidth = $('.panel-cover').width(); if (currentWidth < 960) { $('.panel-cover').addClass('panel-cover--collapsed'); ...
// if (window.location.pathname !== '{{ site.baseurl }}' && window.location.pathname !== '{{ site.baseurl }}index.html') { // $('.panel-cover').addClass('panel-cover--collapsed'); // } $('.btn-mobile-menu').click(function () { $('.navigation-wrapper').toggleClass('visible animated bounceInDown'); $...
{ $('.panel-cover').addClass('panel-cover--collapsed'); }
conditional_block
basebar.ts
//basebar.ts // import {BaseModel} from '../../basemodel' import {UserInfo} from '../../userinfo'; // export class BaseBar<T extends BaseModel> { // private _model: T; // constructor() { } public bind(s: T) { this._model = s; } protected get parent():T { return (this._model !== undefined) ? this._model ...
} }// class BaseBar
{ this.info.logout(); this.info.navigate_to('home'); }
conditional_block
basebar.ts
//basebar.ts // import {BaseModel} from '../../basemodel' import {UserInfo} from '../../userinfo'; // export class BaseBar<T extends BaseModel> { // private _model: T; // constructor() { } public bind(s: T) { this._model = s; } protected get parent():T { return (this._model !== undefined) ? this._model ...
(): UserInfo { return ((this._model !== undefined) && (this !== null)) ? this._model.userInfo : null; } public get is_connected(): boolean { return ((this.info !== undefined) && (this.info !== null)) ? this.info.is_connected : false; } public get is_notconnected(): boolean { return (!this.is_connected); } p...
info
identifier_name
basebar.ts
//basebar.ts // import {BaseModel} from '../../basemodel' import {UserInfo} from '../../userinfo'; // export class BaseBar<T extends BaseModel> {
public bind(s: T) { this._model = s; } protected get parent():T { return (this._model !== undefined) ? this._model : null; } protected get info(): UserInfo { return ((this._model !== undefined) && (this !== null)) ? this._model.userInfo : null; } public get is_connected(): boolean { return ((this.in...
// private _model: T; // constructor() { }
random_line_split
basebar.ts
//basebar.ts // import {BaseModel} from '../../basemodel' import {UserInfo} from '../../userinfo'; // export class BaseBar<T extends BaseModel> { // private _model: T; // constructor() { } public bind(s: T) { this._model = s; } protected get parent():T
protected get info(): UserInfo { return ((this._model !== undefined) && (this !== null)) ? this._model.userInfo : null; } public get is_connected(): boolean { return ((this.info !== undefined) && (this.info !== null)) ? this.info.is_connected : false; } public get is_notconnected(): boolean { return (!this....
{ return (this._model !== undefined) ? this._model : null; }
identifier_body
jquery.pngFix.js
/* $Id: jquery.pngFix.js,v 1.1.1.5 2009/02/04 19:23:30 gibbozer Exp $ */ /** * -------------------------------------------------------------------- * jQuery-Plugin "pngFix" * Version: 1.1, 11.09.2007 * by Andreas Eberhard, andreas.eberhard@gmail.com * http://jquery.andreaseberhard.de/ * * Co...
* 11.09.2007 Version 1.1 * - removed noConflict * - added png-support for input type=image * - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com * 31.05.2007 initial Version 1.0 * --------------------------------------------...
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php) * * Changelog:
random_line_split
jquery.pngFix.js
/* $Id: jquery.pngFix.js,v 1.1.1.5 2009/02/04 19:23:30 gibbozer Exp $ */ /** * -------------------------------------------------------------------- * jQuery-Plugin "pngFix" * Version: 1.1, 11.09.2007 * by Andreas Eberhard, andreas.eberhard@gmail.com * http://jquery.andreaseberhard.de/ * * Co...
if (this.style.padding) { prevStyle += 'padding:'+this.style.padding+';'; this.style.padding = ''; } if (this.style.margin) { prevStyle += 'margin:'+this.style.margin+';'; this.style.margin = ''; } var imgStyle = (this.style.cssText); strNewHTML += '<span '+imgId+imgClass+imgTitle+img...
{ //fix images with png-source jQuery(this).find("img[@src$=.png]").each(function() { jQuery(this).attr('width',jQuery(this).width()); jQuery(this).attr('height',jQuery(this).height()); var prevStyle = ''; var strNewHTML = ''; var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id'...
conditional_block
no-mixed-requires.js
/** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla * @deprecated in ESLint v7.0.0 */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //---------------------------------------------------------------...
(node) { if (isMixed(node.declarations)) { context.report({ node, messageId: "noMixRequire" }); } else if (grouping && !isGrouped(node.declarations)) { context.report({ ...
VariableDeclaration
identifier_name
no-mixed-requires.js
/** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla * @deprecated in ESLint v7.0.0 */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //---------------------------------------------------------------...
function getBuiltinModules() { /* * This list is generated using: * `require("repl")._builtinLibs.concat('repl').sort()` * This particular list is as per nodejs v0.12.2 and iojs v0.7.1 */ return [ "assert", "buffer", "c...
random_line_split
no-mixed-requires.js
/** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla * @deprecated in ESLint v7.0.0 */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //---------------------------------------------------------------...
// "var async = require('async');" return REQ_MODULE; } /** * Check if the list of variable declarations is mixed, i.e. whether it * contains both require and other declarations. * @param {ASTNode} declarations The list of VariableDeclarators. ...
{ // "var utils = require('./utils');" return REQ_FILE; }
conditional_block
no-mixed-requires.js
/** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla * @deprecated in ESLint v7.0.0 */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //---------------------------------------------------------------...
const BUILTIN_MODULES = getBuiltinModules(); const DECL_REQUIRE = "require", DECL_UNINITIALIZED = "uninitialized", DECL_OTHER = "other"; const REQ_CORE = "core", REQ_FILE = "file", REQ_MODULE = "module", REQ_COMPUTED = "computed"; ...
{ /* * This list is generated using: * `require("repl")._builtinLibs.concat('repl').sort()` * This particular list is as per nodejs v0.12.2 and iojs v0.7.1 */ return [ "assert", "buffer", "child_process", "cluster", "crypto", ...
identifier_body
benchmark.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ //! This benchmark generates linear stack with specified parameters, and then //! measures how log it takes to convert it from Bonsai to Hg...
.long(ARG_STACK_SIZE) .takes_value(true) .value_name(ARG_STACK_SIZE) .help("Size of the generated stack"), ) .arg( Arg::with_name(ARG_BLOBSTORE_PUT_MEAN_SECS) .long(ARG_BLOBSTORE_PUT_MEAN_SECS) .t...
{ let matches = args::MononokeAppBuilder::new("mononoke benchmark") .without_arg_types(vec![ ArgType::Config, ArgType::Repo, ArgType::Tunables, ArgType::Runtime, // we construct our own runtime, so these args would do nothing ]) .with_advanced_...
identifier_body
benchmark.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ //! This benchmark generates linear stack with specified parameters, and then //! measures how log it takes to convert it from Bonsai to Hg...
( ctx: CoreContext, repo: BlobRepo, rng_seed: u64, stack_size: usize, derived_data_type: &str, use_backfill_mode: bool, ) -> Result<(), Error> { println!("rng seed: {}", rng_seed); let mut rng = XorShiftRng::seed_from_u64(rng_seed); // reproducable Rng let mut gen = GenManifest::new...
run
identifier_name
benchmark.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ //! This benchmark generates linear stack with specified parameters, and then //! measures how log it takes to convert it from Bonsai to Hg...
let mut gen = GenManifest::new(); let settings = Default::default(); let (stats, csidq) = gen .gen_stack( ctx.clone(), repo.clone(), &mut rng, &settings, None, std::iter::repeat(16).take(stack_size), ) .timed() ...
println!("rng seed: {}", rng_seed); let mut rng = XorShiftRng::seed_from_u64(rng_seed); // reproducable Rng
random_line_split
QueueActions.ts
import store from '../store'; import types from '../constants/action-types'; import * as app from '../lib/app'; import Player from '../lib/player'; import * as utils from '../utils/utils'; import { Track } from '../../shared/types/interfaces'; /** * Start audio playback from the queue */ export const start = async...
await Player.play(); store.dispatch({ type: types.QUEUE_START, payload: { index } }); }; /** * Clear the queue */ export const clear = () => { store.dispatch({ type: types.QUEUE_CLEAR }); }; /** * Remove track from queue */ export const remove = (index: number) => { store.dispat...
random_line_split
log.py
import time def progress(index, size, for_what='当前进度', step=10): block_size = int(size / step) if index % block_size == 0: crt = int(index / block_size) print('%s ==> [%d / %d]' % (for_what, crt, step)) def log_time(): def _log_time(func): # func() def wrapper(*args, **kw...
return wrapper return _log_time def line(log_str, style='-'): print(style * 12 + str(log_str) + style * 12) def block(style="-",w=100,h=5): for _ in range(h): print(style*w)
tart") start_time = time.time() result = func() if len(args) == len(kwargs) == 0 else func(*args, **kwargs) end_time = time.time() cost_time = end_time - start_time print("[%s] cost time -> %s" % (func.__name__, cost_time)) return result
identifier_body
log.py
import time def
(index, size, for_what='当前进度', step=10): block_size = int(size / step) if index % block_size == 0: crt = int(index / block_size) print('%s ==> [%d / %d]' % (for_what, crt, step)) def log_time(): def _log_time(func): # func() def wrapper(*args, **kwargs): print("...
progress
identifier_name
log.py
import time def progress(index, size, for_what='当前进度', step=10): block_size = int(size / step) if index % block_size == 0: crt = int(index / block_size) print('%s ==> [%d / %d]' % (for_what, crt, step)) def log_time(): def _log_time(func): # func() def wrapper(*args, **kw...
return wrapper return _log_time def line(log_str, style='-'): print(style * 12 + str(log_str) + style * 12) def block(style="-",w=100,h=5): for _ in range(h): print(style*w)
cost_time = end_time - start_time print("[%s] cost time -> %s" % (func.__name__, cost_time)) return result
random_line_split
log.py
import time def progress(index, size, for_what='当前进度', step=10): block_size = int(size / step) if index % block_size == 0: crt = in
og_time(): def _log_time(func): # func() def wrapper(*args, **kwargs): print("start") start_time = time.time() result = func() if len(args) == len(kwargs) == 0 else func(*args, **kwargs) end_time = time.time() cost_time = end_time - start_t...
t(index / block_size) print('%s ==> [%d / %d]' % (for_what, crt, step)) def l
conditional_block
Less6_Lab11.js
// Задание 11 // Войти на главную страницу http://localhost/litecart // Зарегистрировать нового пользователя // Выйти - Logout // Авторизоваться пользователем и выйти var webdriver = require('selenium-webdriver'); var chrome = require('selenium-webdriver/chrome'); var By = webdriver.By; var until = webdriver.until; va...
selectElem.findElement(By.css("option[value='AK']")).click(); } })).then(()=> driver.findElement(By.css("input[name='newsletter']")).getAttribute("value") .then((text) =>{ if (text == "1")...
random_line_split
Less6_Lab11.js
// Задание 11 // Войти на главную страницу http://localhost/litecart // Зарегистрировать нового пользователя // Выйти - Logout // Авторизоваться пользователем и выйти var webdriver = require('selenium-webdriver'); var chrome = require('selenium-webdriver/chrome'); var By = webdriver.By; var until = webdriver.until; va...
driver.wait(driver.findElement(By.linkText("Logout")).click(),1000)); } ); }); test.it('Авторизация', function () { driver.findElement(By.name("email")).sendKeys(email).then(()=> driver.findElement(By.name("password")).sendKeys(password)).then(()=> ...
})).then(()=> driver.findElement(By.css("button[name='create_account']")).click()).then(()=>
conditional_block
subscription-licenses.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { React } from "../app-framework"; import { Example, LicenseExamples } from "./license-examples"; import { compute_cost, discount_pct, User, Upgrade, Subscript...
const p1data = { user: "academic" as User, upgrade: "custom" as Upgrade, quantity: 2, subscription: "monthly" as Subscription, start: new Date("2020-01-01T12:00Z"), end: new Date("2020-02-01T11:59:59.999Z"), custom_ram: 1, custom_cpu: 1, custom_disk: 1, custom_member: true, custom_dedicated_ram: ...
import { plural } from "@cocalc/util/misc";
random_line_split
subscription-licenses.tsx
/* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { React } from "../app-framework"; import { Example, LicenseExamples } from "./license-examples"; import { compute_cost, discount_pct, User, Upgrade, Subscript...
export const SubscriptionLicenses: React.FC<{}> = () => { return <LicenseExamples examples={EXAMPLES} show_discount_pct={true} />; };
ex.lines.push({ value: discount_pct, unit: "%", resource: "Academic Discount", }); } }
conditional_block
createSubmit.js
var createSubmit = function(name, primus, keyDict) { return function(event) { var message = $('#message').val(); if (message.length === 0) { event.preventDefault(); return; } $('#message').val(''); $('#message').focus(); var BigInteger = for...
}); event.preventDefault(); }; };
primus.substream('messageStream').write({'message': encryptedMessage, 'keys': keys, 'iv': iv, 'signature': signature, 'recipients': recipients});
random_line_split
createSubmit.js
var createSubmit = function(name, primus, keyDict) { return function(event) { var message = $('#message').val(); if (message.length === 0)
$('#message').val(''); $('#message').focus(); var BigInteger = forge.jsbn.BigInteger; var data = JSON.parse(sessionStorage[name]); var pem = data.pem; var privateKey = forge.pki.privateKeyFromPem(pem); var ownPublicKey = forge.pki.setRsaPublicKey(new BigInteg...
{ event.preventDefault(); return; }
conditional_block
constants.py
# ######## KADEMLIA CONSTANTS ########### BIT_NODE_ID_LEN = 160 HEX_NODE_ID_LEN = BIT_NODE_ID_LEN // 4 # Small number representing the degree of # parallelism in network calls ALPHA = 3
# Maximum number of contacts stored in the # replacement cache of a bucket # NOTE: Should be an even number. CACHE_K = 32 # Timeout for network operations # [seconds] RPC_TIMEOUT = 0.1 # Delay between iterations of iterative node lookups # (for loose parallelism) # [seconds] ITERATIVE_LOOKUP_DELAY = RPC_TIMEOUT / 2 ...
# Maximum number of contacts stored in a bucket # NOTE: Should be an even number. K = 8 # pylint: disable=invalid-name
random_line_split