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
control.py
(gl.COLOR_BUFFER_BIT) Platform.SwapBuffers() if Fullscreen and (os.name == 'nt'): # very ugly Win32-specific hack: in -wid embedding mode, # video display only works if we briefly minimize and restore # the window ... and that's the good case: in -fs, keyboar...
ZoomAnimation
identifier_name
control.py
) # create an instance of a transition class def InstantiateTransition(trans_class): if isinstance(trans_class, basestring): index = dict((c.__name__.lower(), c) for c in AllTransitions) try: trans_class = index[trans_class.lower()] except KeyError: print("E...
global ZoomMode, ViewZoomFactor, ZoomArea, ZoomX0, ZoomY0 px, py = MouseToScreen(mousepos) log_zf = log(ViewZoomFactor) dlog = log(target_factor) - log_zf t0 = Platform.GetTicks() dt = -1 while dt < WheelZoomDuration: dt = Platform.GetTicks() - t0 rel = min(1.0, float(dt)...
identifier_body
control.py
") else: print("Sorry, but Impressive only supports video on your operating system if fullscreen", file=sys.stderr) print("mode is used.", file=sys.stderr) VideoPlaying = False MPlayerProcess = None return if not isin...
trans.start() t0 = Platform.GetTicks() while not(VideoPlaying): if Platform.CheckAnimationCancelEvent(): skip = 1 break t = (Platform.GetTicks() - t0) * transtime if t >= 1.0: break TransitionPhase = t ...
if not(skip) and transtime: transtime = 1.0 / transtime TransitionRunning = True
random_line_split
control.py
else: print("Sorry, but Impressive only supports video on your operating system if fullscreen", file=sys.stderr) print("mode is used.", file=sys.stderr) VideoPlaying = False MPlayerProcess = None return if not isinstan...
else: skip = 0 # some housekeeping Marking = False Tracing = False UpdateCaption(page) # check if the transition is valid tpage = max(Pcurrent, Pnext) trans = None if allow_transition: trans = GetPageProp(tpage, 'transition', GetPageProp(tpage, '_trans...
skip = BoxFade(lambda t: 1.0 - t)
conditional_block
p39.py
#TODO: make under 1 min. #SOLVED import math MAX_P = 1000 best_p = 120 best_num_sides = 3 for p in range(2, MAX_P+1): num_sides = 0 if p % 30 == 0: print(p) for a in range(1, MAX_P/2 + 2): for b in range(1, MAX_P/2 + 2): c = p - a - b if a > b and b > c and c**2 + ...
# print("Change to p={}".format(p)) # import pdb; pdb.set_trace() best_num_sides = num_sides best_p = p print("Done") print(best_p)
random_line_split
p39.py
#TODO: make under 1 min. #SOLVED import math MAX_P = 1000 best_p = 120 best_num_sides = 3 for p in range(2, MAX_P+1): num_sides = 0 if p % 30 == 0:
for a in range(1, MAX_P/2 + 2): for b in range(1, MAX_P/2 + 2): c = p - a - b if a > b and b > c and c**2 + b**2 == a**2 and a + b + c == p and c > 0: # print("sides {} {} {}".format(a,b,c)) # print("P={}".format(p)) num_sides += 1 ...
print(p)
conditional_block
app.py
import os import tornado.httpserver import tornado.ioloop import tornado.web from creds import * from requests import Request import requests import json import re import tempfile import redis import uuid from pydub import AudioSegment def gettoken(uid): red = redis.from_url(redis_url) token = red.get(uid+"-access...
(BaseHandler): @tornado.web.authenticated @tornado.web.asynchronous def get(self): uid = tornado.escape.xhtml_escape(self.current_user) red = redis.from_url(redis_url) red.delete(uid+"-access_token") red.delete(uid+"-refresh_token") self.clear_cookie("user") self.set_header('Content-Type', 'text/plain') ...
LogoutHandler
identifier_name
app.py
import os import tornado.httpserver import tornado.ioloop import tornado.web from creds import * from requests import Request import requests import json import re import tempfile import redis import uuid from pydub import AudioSegment def gettoken(uid): red = redis.from_url(redis_url) token = red.get(uid+"-access...
"namespace": "AudioPlayer", "payload": { "streamId": "", "offsetInMilliseconds": "0", "playerActivity": "IDLE" } } ] }, "messageBody": { "profile": ...
uid = tornado.escape.xhtml_escape(self.current_user) token = gettoken(uid) if (token == False): self.set_status(403) else: rxfile = self.request.files['data'][0]['body'] tf = tempfile.NamedTemporaryFile(suffix=".wav") tf.write(rxfile) _input = AudioSegment.from_wav(tf.name) tf.close() tf = te...
identifier_body
app.py
import os import tornado.httpserver import tornado.ioloop import tornado.web from creds import * from requests import Request import requests import json import re import tempfile import redis import uuid from pydub import AudioSegment def gettoken(uid): red = redis.from_url(redis_url) token = red.get(uid+"-access...
static_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static') application = tornado.web.Application([(r"/", MainHandler), (r"/start", StartAuthHandler), (r"/code", CodeAuthHandler), (r"/logout", LogoutHandler), (r"/audio", AudioHandler), (r'/(f...
settings = { "cookie_secret": "parisPOLANDbroadFENCEcornWOULD", "login_url": "/static/welcome.html", }
random_line_split
app.py
import os import tornado.httpserver import tornado.ioloop import tornado.web from creds import * from requests import Request import requests import json import re import tempfile import redis import uuid from pydub import AudioSegment def gettoken(uid): red = redis.from_url(redis_url) token = red.get(uid+"-access...
else: rxfile = self.request.files['data'][0]['body'] tf = tempfile.NamedTemporaryFile(suffix=".wav") tf.write(rxfile) _input = AudioSegment.from_wav(tf.name) tf.close() tf = tempfile.NamedTemporaryFile(suffix=".wav") output = _input.set_channels(1).set_frame_rate(16000) f = output.export(tf.n...
self.set_status(403)
conditional_block
datasource-get-debug.js
/* YUI 3.13.0 (build 508226d) Copyright 2013 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('datasource-get', function (Y, NAME) { /** * Provides a DataSource implementation which can be used to retrieve data via the Get Utility. * * @module d...
}; Y.DataSource.Get = Y.extend(DSGet, Y.DataSource.Local, { /** * Passes query string to Get Utility. Fires <code>response</code> event when * response is received asynchronously. * * @method _defRequestFn * @param e {Event.Facade} Event Facade with the following properties: ...
* @constructor */ var DSGet = function() { DSGet.superclass.constructor.apply(this, arguments);
random_line_split
datasource-get-debug.js
/* YUI 3.13.0 (build 508226d) Copyright 2013 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('datasource-get', function (Y, NAME) { /** * Provides a DataSource implementation which can be used to retrieve data via the Get Utility. * * @module d...
else { Y.log("DataSource ignored stale response for id " + e.tId + "(" + e.request + ")", "info", "datasource-get"); } }; // Add the callback param to the request url uri += e.request + generateRequest.call( this, guid ); Y.log("DataSource is quer...
{ payload.data = response; self.fire("data", payload); }
conditional_block
contrived_std_string_find.py
#!/usr/bin/python """Do not call std::string::find_first_of or std::string::find with a string of characters to locate that has the size 1. Use the version of std::string::find that takes a single character to locate instead. Same for find_last_of/rfind. """ error_msg = "Do not use find(\"a\"), use find('a')." reg...
r'find_first_of("\n")', r'find_last_of("\n")', r'find("\n")', r'rfind("\n")', r'find_first_of("\t")', r'find_last_of("\t")', r'find("\t")', r'rfind("\t")', r'find_first_of("\\")', r'find_last_of("\\")', r'find("\\")', r'rfind("\\")', r'find_first_of("\"")', r'find...
r'find("a")', r'rfind("a")',
random_line_split
http.rs
use hyper::{Client, Error}; use hyper::client::Response; use hyper::header::ContentType; use hyper::method::Method; /// Makes a DELETE request to etcd. pub fn delete(url: String) -> Result<Response, Error> { request(Method::Delete, url) } /// Makes a GET request to etcd. pub fn
(url: String) -> Result<Response, Error> { request(Method::Get, url) } /// Makes a POST request to etcd. pub fn post(url: String, body: String) -> Result<Response, Error> { request_with_body(Method::Post, url, body) } /// Makes a PUT request to etcd. pub fn put(url: String, body: String) -> Result<Response, E...
get
identifier_name
http.rs
use hyper::{Client, Error}; use hyper::client::Response; use hyper::header::ContentType; use hyper::method::Method; /// Makes a DELETE request to etcd. pub fn delete(url: String) -> Result<Response, Error>
/// Makes a GET request to etcd. pub fn get(url: String) -> Result<Response, Error> { request(Method::Get, url) } /// Makes a POST request to etcd. pub fn post(url: String, body: String) -> Result<Response, Error> { request_with_body(Method::Post, url, body) } /// Makes a PUT request to etcd. pub fn put(url...
{ request(Method::Delete, url) }
identifier_body
http.rs
use hyper::{Client, Error}; use hyper::client::Response; use hyper::header::ContentType; use hyper::method::Method; /// Makes a DELETE request to etcd. pub fn delete(url: String) -> Result<Response, Error> { request(Method::Delete, url) } /// Makes a GET request to etcd. pub fn get(url: String) -> Result<Response...
/// Makes a PUT request to etcd. pub fn put(url: String, body: String) -> Result<Response, Error> { request_with_body(Method::Put, url, body) } // private /// Makes a request to etcd. fn request(method: Method, url: String) -> Result<Response, Error> { let client = Client::new(); let request = client.requ...
random_line_split
include.rs
/* * Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
{ counter: i32, } // The messages that can be sent to the update function. #[derive(Msg)] pub enum Msg { Decrement, Increment, Quit, } #[widget] impl Widget for Win { // The initial model. fn model() -> Model { Model { counter: 0, } } // Update the model a...
Model
identifier_name
include.rs
/* * Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
#[cfg(test)] mod tests { use gtk::prelude::{ButtonExt, LabelExt}; use gtk_test::{assert_label, assert_text}; use relm_test::click; use crate::Win; #[test] fn label_change() { let (_component, _, widgets) = relm::init_test::<Win>(()).expect("init_test failed"); let inc_button...
{ Win::run(()).expect("Win::run failed"); }
identifier_body
include.rs
/*
* * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell...
* Copyright (c) 2017-2020 Boucher, Antoni <bouanto@zoho.com>
random_line_split
index.js
var _ = require('underscore'); var keystone = require('../../'); var utils = keystone.utils; /** * Content Class * * Accessed via `Keystone.content` * * @api public */ var Content = function () {}; /** * Loads page content by page key (optional). * * If page key is not provided, returns a hash of all page c...
* * Called automatically when pages are added. * * @api private */ Content.prototype.editable = function (user, options) { if (!user || !user.canAccessKeystone) { return undefined; } if (options.list) { var list = keystone.list(options.list); if (!list) { return JSON.stringify({ type: 'error', err...
random_line_split
index.js
var _ = require('underscore'); var keystone = require('../../'); var utils = keystone.utils; /** * Content Class * * Accessed via `Keystone.content` * * @api public */ var Content = function () {}; /** * Loads page content by page key (optional). * * If page key is not provided, returns a hash of all page c...
this.initModel(); if (this.pages[key]) { throw new Error('keystone.content.page() Error: page ' + key + ' cannot be registered more than once.'); } this.pages[key] = page; return page; }; /** * Ensures the Mongoose model for storing content is initialised. * * Called automatically when pages are added....
{ if (!this.pages[key]) { throw new Error('keystone.content.page() Error: page ' + key + ' cannot be registered more than once.'); } return this.pages[key]; }
conditional_block
test_access_compilation.py
from tests.compiler import compile_snippet, A_ID, LST_ID, SELF_ID, VAL1_ID, internal_call, A_INST, INNER_ID, \ CONTAINER_INNER_ID, STATIC_START from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushMember, OpcodePushStatic, OpcodePop, \ OpcodeDereference, OpcodeCallVirtual def test_direct_member_a...
def test_local_list_non_immediate_index(): assert compile_snippet('lst[a]') == [ OpcodePushLocal(A_ID), OpcodePushLocal(LST_ID), internal_call('list.get') ] assert compile_snippet('lst[self.val1]') == [ OpcodePushMember(SELF_ID, VAL1_ID), OpcodePushLocal(LST_ID), ...
internal_call('list.get') ]
random_line_split
test_access_compilation.py
from tests.compiler import compile_snippet, A_ID, LST_ID, SELF_ID, VAL1_ID, internal_call, A_INST, INNER_ID, \ CONTAINER_INNER_ID, STATIC_START from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushMember, OpcodePushStatic, OpcodePop, \ OpcodeDereference, OpcodeCallVirtual def test_direct_member_a...
def test_local_list_immediate_index(): assert compile_snippet('lst[123]') == [ OpcodePushStatic(STATIC_START), OpcodePushLocal(LST_ID), internal_call('list.get') ] def test_local_list_non_immediate_index(): assert compile_snippet('lst[a]') == [ OpcodePushLocal(A_ID), ...
assert compile_snippet('a_inst.me().a1') == [ OpcodePushLocal(A_INST), OpcodeCallVirtual(1), OpcodeDereference(0) ] assert compile_snippet('a_inst.me().me().a1') == [ OpcodePushLocal(A_INST), OpcodeCallVirtual(1), OpcodeCallVirtual(1), OpcodeDereference(0...
identifier_body
test_access_compilation.py
from tests.compiler import compile_snippet, A_ID, LST_ID, SELF_ID, VAL1_ID, internal_call, A_INST, INNER_ID, \ CONTAINER_INNER_ID, STATIC_START from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushMember, OpcodePushStatic, OpcodePop, \ OpcodeDereference, OpcodeCallVirtual def test_direct_member_a...
(): assert compile_snippet('lst[123]') == [ OpcodePushStatic(STATIC_START), OpcodePushLocal(LST_ID), internal_call('list.get') ] def test_local_list_non_immediate_index(): assert compile_snippet('lst[a]') == [ OpcodePushLocal(A_ID), OpcodePushLocal(LST_ID), ...
test_local_list_immediate_index
identifier_name
solver.worker.service.ts
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Craft, CrafterStats, CraftingAction, CraftingActionsRegistry } from '@ffxiv-teamcraft/simulator'; import { first } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class SolverWorkerService { private w...
else { // Web Workers are not supported in this environment. // You should add a fallback so that your program still executes correctly. } } public solveRotation(recipe: Craft, stats: CrafterStats, seed?: CraftingAction[]): Observable<CraftingAction[]> { this.worker.postMessage({ recipe,...
{ // Create a new const worker = new Worker('./solver.worker', { type: 'module' }); worker.onmessage = ({ data }) => { this._result$.next(CraftingActionsRegistry.deserializeRotation(data)); }; }
conditional_block
solver.worker.service.ts
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs';
import { Craft, CrafterStats, CraftingAction, CraftingActionsRegistry } from '@ffxiv-teamcraft/simulator'; import { first } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class SolverWorkerService { private worker: Worker; private _result$: Subject<CraftingAction[]> = new Subject<CraftingActi...
random_line_split
solver.worker.service.ts
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Craft, CrafterStats, CraftingAction, CraftingActionsRegistry } from '@ffxiv-teamcraft/simulator'; import { first } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class SolverWorkerService { private w...
(recipe: Craft, stats: CrafterStats, seed?: CraftingAction[]): Observable<CraftingAction[]> { this.worker.postMessage({ recipe, stats, seed }); return this.result$.pipe(first()); } public isSupported(): boolean { return this.worker !== undefined; } }
solveRotation
identifier_name
solver.worker.service.ts
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Craft, CrafterStats, CraftingAction, CraftingActionsRegistry } from '@ffxiv-teamcraft/simulator'; import { first } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class SolverWorkerService { private w...
public isSupported(): boolean { return this.worker !== undefined; } }
{ this.worker.postMessage({ recipe, stats, seed }); return this.result$.pipe(first()); }
identifier_body
test_mongoengine.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 Romain Command& # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mod...
self.assertIsNotNone(std1.id)
random_line_split
test_mongoengine.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 Romain Command& # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mod...
std1 = PersonFactory.create() self.assertEqual('name1', std1.name) self.assertEqual('street1', std1.address.street) self.assertIsNotNone(std1.id)
identifier_body
test_mongoengine.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 Romain Command& # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mod...
if mongoengine: from factory.mongoengine import MongoEngineFactory class Address(mongoengine.EmbeddedDocument): street = mongoengine.StringField() class Person(mongoengine.Document): name = mongoengine.StringField() address = mongoengine.EmbeddedDocumentField(Address) class ...
mongoengine = None
conditional_block
test_mongoengine.py
# -*- coding: utf-8 -*- # Copyright (c) 2013 Romain Command& # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, mod...
(mongoengine.EmbeddedDocument): street = mongoengine.StringField() class Person(mongoengine.Document): name = mongoengine.StringField() address = mongoengine.EmbeddedDocumentField(Address) class AddressFactory(MongoEngineFactory): class Meta: model = Address ...
Address
identifier_name
index.ts
be given in order to continue. */ required: { type: ParameterType.BOOL, pretty_name: "Required", default: false, }, /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */ name: { type: ParameterTyp...
else { display_element .querySelector<HTMLInputElement>("#jspsych-survey-multi-select-" + i + " input") .setCustomValidity(""); } } } trial_form.reportValidity(); }); trial_form.addEventListener("submit", (event) => { ...
{ display_element .querySelector<HTMLInputElement>("#jspsych-survey-multi-select-" + i + " input") .setCustomValidity(trial.required_message); }
conditional_block
index.ts
: { type: ParameterType.STRING, pretty_name: "Question Name", default: "", }, }, }, /** If true, the order of the questions in the 'questions' array will be randomized. */ randomize_question_order: { type: ParameterType.BOOL, pretty_name: "Randomize Qu...
{ n_answers = this.jsPsych.randomization.randomInt(1, q.options.length); }
identifier_body
index.ts
be given in order to continue. */ required: { type: ParameterType.BOOL, pretty_name: "Required", default: false, }, /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */ name: { type: ParameterTyp...
) { display_element .querySelector<HTMLInputElement>("#jspsych-survey-multi-select-" + i + " input") .setCustomValidity(trial.required_message); } else { display_element .querySelector<HTMLInputElement>("#jspsych-survey-...
) == null
random_line_split
index.ts
be given in order to continue. */ required: { type: ParameterType.BOOL, pretty_name: "Required", default: false, }, /** Name of the question in the trial data. If no name is given, the questions are named Q0, Q1, etc. */ name: { type: ParameterTyp...
(simulation_mode == "data-only") { load_callback(); this.simulate_data_only(trial, simulation_options); } if (simulation_mode == "visual") { this.simulate_visual(trial, simulation_options, load_callback); } } private create_simulation_data(trial: TrialType
if
identifier_name
video_bench_ovl.py
#! /bin/env python import sys, time, os import pymedia.muxer as muxer import pymedia.video.vcodec as vcodec import pymedia.audio.acodec as acodec import pymedia.audio.sound as sound if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb': import pydfb as pygame
import pygame YV12= pygame.YV12_OVERLAY def videoDecodeBenchmark( inFile, opt ): pygame.init() pygame.display.set_mode( (800,600), 0 ) ovl= None dm= muxer.Demuxer( inFile.split( '.' )[ -1 ] ) f= open( inFile, 'rb' ) s= f.read( 400000 ) r= dm.parse( s ) v= filter( lambda x: x[ 'type' ]== muxer.CO...
YV12= pygame.PF_YV12 else:
random_line_split
video_bench_ovl.py
#! /bin/env python import sys, time, os import pymedia.muxer as muxer import pymedia.video.vcodec as vcodec import pymedia.audio.acodec as acodec import pymedia.audio.sound as sound if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb': import pydfb as pygame YV12= pygame.PF_YV12 ...
a_id= a[ 0 ][ 'index' ] t= time.time() vc= vcodec.Decoder( dm.streams[ v_id ] ) print dm.streams[ v_id ] if opt!= 'noaudio': ac= acodec.Decoder( dm.streams[ a_id ] ) resampler= None frames= 0 q= [] while len( s )> 0: for fr in r: if fr[ 0 ]== v_id: d= vc.decode( fr[ 1 ] )...
pygame.init() pygame.display.set_mode( (800,600), 0 ) ovl= None dm= muxer.Demuxer( inFile.split( '.' )[ -1 ] ) f= open( inFile, 'rb' ) s= f.read( 400000 ) r= dm.parse( s ) v= filter( lambda x: x[ 'type' ]== muxer.CODEC_TYPE_VIDEO, dm.streams ) if len( v )== 0: raise 'There is no video stream in a...
identifier_body
video_bench_ovl.py
#! /bin/env python import sys, time, os import pymedia.muxer as muxer import pymedia.video.vcodec as vcodec import pymedia.audio.acodec as acodec import pymedia.audio.sound as sound if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb': import pydfb as pygame YV12= pygame.PF_YV12 ...
( inFile, opt ): pygame.init() pygame.display.set_mode( (800,600), 0 ) ovl= None dm= muxer.Demuxer( inFile.split( '.' )[ -1 ] ) f= open( inFile, 'rb' ) s= f.read( 400000 ) r= dm.parse( s ) v= filter( lambda x: x[ 'type' ]== muxer.CODEC_TYPE_VIDEO, dm.streams ) if len( v )== 0: raise 'There is n...
videoDecodeBenchmark
identifier_name
video_bench_ovl.py
#! /bin/env python import sys, time, os import pymedia.muxer as muxer import pymedia.video.vcodec as vcodec import pymedia.audio.acodec as acodec import pymedia.audio.sound as sound if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb': import pydfb as pygame YV12= pygame.PF_YV12 ...
q.append( d ) if len( q )> 4: try: ovl.set_data( q[0].data ) ovl.display() except: ovl.display(q[0].data) del( q[0] ) elif opt!= 'noaudio' and fr[ 0 ]== a_id: d= ac.decode( fr[ 1 ] ) if ...
ovl= pygame.Overlay( YV12, d.size )
conditional_block
resetCameraIfNewFileIsLoaded.service.ts
import { StoreService, StoreSubscriber } from "../../../store.service" import { IRootScopeService } from "angular" import { ResetCameraIfNewFileIsLoadedActions } from "./resetCameraIfNewFileIsLoaded.actions" import { isActionOfType } from "../../../../util/reduxHelper" export interface ResetCameraIfNewFileIsLoadedSubs...
() { return this.storeService.getState().appSettings.resetCameraIfNewFileIsLoaded } private notify(newState: boolean) { this.$rootScope.$broadcast(ResetCameraIfNewFileIsLoadedService.RESET_CAMERA_IF_NEW_FILE_IS_LOADED_CHANGED_EVENT, { resetCameraIfNewFileIsLoaded: newState }) } static subscribe($rootScop...
select
identifier_name
resetCameraIfNewFileIsLoaded.service.ts
import { StoreService, StoreSubscriber } from "../../../store.service" import { IRootScopeService } from "angular" import { ResetCameraIfNewFileIsLoadedActions } from "./resetCameraIfNewFileIsLoaded.actions" import { isActionOfType } from "../../../../util/reduxHelper" export interface ResetCameraIfNewFileIsLoadedSubs...
}) } static subscribe($rootScope: IRootScopeService, subscriber: ResetCameraIfNewFileIsLoadedSubscriber) { $rootScope.$on(ResetCameraIfNewFileIsLoadedService.RESET_CAMERA_IF_NEW_FILE_IS_LOADED_CHANGED_EVENT, (_event_, data) => { subscriber.onResetCameraIfNewFileIsLoadedChanged(data.resetCameraIfNewFileIsLoade...
private notify(newState: boolean) { this.$rootScope.$broadcast(ResetCameraIfNewFileIsLoadedService.RESET_CAMERA_IF_NEW_FILE_IS_LOADED_CHANGED_EVENT, { resetCameraIfNewFileIsLoaded: newState
random_line_split
resetCameraIfNewFileIsLoaded.service.ts
import { StoreService, StoreSubscriber } from "../../../store.service" import { IRootScopeService } from "angular" import { ResetCameraIfNewFileIsLoadedActions } from "./resetCameraIfNewFileIsLoaded.actions" import { isActionOfType } from "../../../../util/reduxHelper" export interface ResetCameraIfNewFileIsLoadedSubs...
} private select() { return this.storeService.getState().appSettings.resetCameraIfNewFileIsLoaded } private notify(newState: boolean) { this.$rootScope.$broadcast(ResetCameraIfNewFileIsLoadedService.RESET_CAMERA_IF_NEW_FILE_IS_LOADED_CHANGED_EVENT, { resetCameraIfNewFileIsLoaded: newState }) } static...
{ this.notify(this.select()) }
conditional_block
resetCameraIfNewFileIsLoaded.service.ts
import { StoreService, StoreSubscriber } from "../../../store.service" import { IRootScopeService } from "angular" import { ResetCameraIfNewFileIsLoadedActions } from "./resetCameraIfNewFileIsLoaded.actions" import { isActionOfType } from "../../../../util/reduxHelper" export interface ResetCameraIfNewFileIsLoadedSubs...
private notify(newState: boolean) { this.$rootScope.$broadcast(ResetCameraIfNewFileIsLoadedService.RESET_CAMERA_IF_NEW_FILE_IS_LOADED_CHANGED_EVENT, { resetCameraIfNewFileIsLoaded: newState }) } static subscribe($rootScope: IRootScopeService, subscriber: ResetCameraIfNewFileIsLoadedSubscriber) { $rootSco...
{ return this.storeService.getState().appSettings.resetCameraIfNewFileIsLoaded }
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime import photolib.models import taggit.managers class Migration(migrations.Migration): dependencies = [ ('taggit', '0001_initial'), ] operations = [ migrations.CreateMo...
('notes', models.TextField(help_text='Any other notable information about this photo.', blank=True)), ('credits', models.TextField(help_text='Credits and copyright/left.', blank=True)), ('source', models.CharField(choices=[('Flickr', 'Flickr'), ('iStockphoto', 'iStockphot...
('alt', models.CharField(help_text='alt attribute text for accessibility', max_length=255, blank=True)), ('caption', models.TextField(help_text='Recommended text to be used as photo caption.', blank=True)),
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime import photolib.models import taggit.managers class Migration(migrations.Migration):
('photo_tags', taggit.managers.TaggableManager(verbose_name='Tags', to='taggit.Tag', help_text='A comma-separated list of tags.', through='taggit.TaggedItem', blank=True)), ], options={ 'ordering': ('-uploaded',), }, bases=(models.Model,), ...
dependencies = [ ('taggit', '0001_initial'), ] operations = [ migrations.CreateModel( name='Photo', fields=[ ('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)), ('uuid', models.CharField(max_l...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime import photolib.models import taggit.managers class
(migrations.Migration): dependencies = [ ('taggit', '0001_initial'), ] operations = [ migrations.CreateModel( name='Photo', fields=[ ('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)), ('...
Migration
identifier_name
module-loader.test.ts
// The MIT License (MIT) // Copyright (c) 2016-3016 Infinite Red, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the right...
expect(keys(m)).toEqual([]) }) test('export default function', () => { const m = loadModule(`${__dirname}/../fixtures/good-modules/module-exports-function.js`) expect(typeof m).toBe('function') expect(m()).toBe('hi') }) test('export default {}', async () => { const m = loadModule(`${__dirname}/../fixtures/g...
random_line_split
main.rs
extern crate gtk; pub mod stack; pub mod calc; // use gdk::prelude::*; use gtk::prelude::*; use gtk::{Builder, Button, Window, TextView, TextBuffer}; fn map_number_btns(text_view: &TextView, nums_vec: &Vec<Button>) { let mut idx = 0; for num in nums_vec { let tv = text_view.clone(); num.con...
// let btn: Button = builder.get_object("btn1").unwrap(); // let image: Image = builder.get_object("image1").unwrap(); window.connect_delete_event(|_, _| { gtk::main_quit(); Inhibit(false) }); //Clear output view on input view changed let tv = text_view.clone(); let tv_ou...
let btn_par_left: Button = builder.get_object("btn_par_left").unwrap(); let btn_par_right: Button = builder.get_object("btn_par_right").unwrap();
random_line_split
main.rs
extern crate gtk; pub mod stack; pub mod calc; // use gdk::prelude::*; use gtk::prelude::*; use gtk::{Builder, Button, Window, TextView, TextBuffer}; fn map_number_btns(text_view: &TextView, nums_vec: &Vec<Button>) { let mut idx = 0; for num in nums_vec { let tv = text_view.clone(); num.con...
(text_view: &TextView, btn: &Button, txt: &str) { let tv = text_view.clone(); let txt_cpy: String = (*txt).to_string(); btn.connect_clicked(move |_| { let buf = tv.get_buffer().unwrap(); buf.insert_at_cursor(&txt_cpy); }); } fn calc_and_set_result(in_buf: &TextBuffer, out_buf: &TextBuf...
map_btn_insert_at_cursor
identifier_name
main.rs
extern crate gtk; pub mod stack; pub mod calc; // use gdk::prelude::*; use gtk::prelude::*; use gtk::{Builder, Button, Window, TextView, TextBuffer}; fn map_number_btns(text_view: &TextView, nums_vec: &Vec<Button>) { let mut idx = 0; for num in nums_vec { let tv = text_view.clone(); num.con...
let glade_src = include_str!("calc_win.glade"); let builder = Builder::new_from_string(glade_src); let window: Window = builder.get_object("calc_app_win").unwrap(); let text_view: TextView = builder.get_object("input_view").unwrap(); let output_view: TextView = builder.get_object("output_view")...
{ println!("Failed to initialize GTK."); return; }
conditional_block
main.rs
extern crate gtk; pub mod stack; pub mod calc; // use gdk::prelude::*; use gtk::prelude::*; use gtk::{Builder, Button, Window, TextView, TextBuffer}; fn map_number_btns(text_view: &TextView, nums_vec: &Vec<Button>) { let mut idx = 0; for num in nums_vec { let tv = text_view.clone(); num.con...
builder.get_object("btn_4").unwrap(), builder.get_object("btn_5").unwrap(), builder.get_object("btn_6").unwrap(), builder.get_object("btn_7").unwrap(), ...
{ if gtk::init().is_err() { println!("Failed to initialize GTK."); return; } let glade_src = include_str!("calc_win.glade"); let builder = Builder::new_from_string(glade_src); let window: Window = builder.get_object("calc_app_win").unwrap(); let text_view: TextView = builder....
identifier_body
build.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
{ gcc::compile_library("libtinykeccak.a", &["src/tinykeccak.c"]); }
identifier_body
build.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
() { gcc::compile_library("libtinykeccak.a", &["src/tinykeccak.c"]); }
main
identifier_name
build.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
fn main() { gcc::compile_library("libtinykeccak.a", &["src/tinykeccak.c"]); }
// Bring in a dependency on an externally maintained `gcc` package which manages // invoking the C compiler. extern crate gcc;
random_line_split
test_server_with_multiple_hostname.ts
import { nodesets } from "node-opcua-nodesets"; import { OPCUAServer } from ".."; // tslint:disable:no-var-requires const describe = require("node-opcua-leak-detector").describeWithLeakDetector; describe("OPCUAServerEndpoint#addEndpointDescription multiple hostname", () => { it("should be possible to create endpo...
server.dispose(); }); });
random_line_split
test_server_with_multiple_hostname.ts
import { nodesets } from "node-opcua-nodesets"; import { OPCUAServer } from ".."; // tslint:disable:no-var-requires const describe = require("node-opcua-leak-detector").describeWithLeakDetector; describe("OPCUAServerEndpoint#addEndpointDescription multiple hostname", () => { it("should be possible to create endpo...
if (ed.endpointUrl!.match(/MyName/)) { matchingMyName++; } } } matching1234Count.should.eql(7, "we should have 7 endpoints matches the IP address"); matchingMyName.should.eql(7, "we should have 7 endpoints matches the Hostname"); ...
{ matching1234Count++; }
conditional_block
music.rs
//! This module provides the music struct, which allows to play and control a music from a file. use libc; use mpv; use std::rc::Rc; use std::cell::RefCell; /// The music struct. pub struct Music { /// Indicates wether the music is playing, paused or stopped. status: MusicStatus, /// The mpv handler to...
/// /// Tells MPV to set the pause property to true, and to reset the playback-time. pub fn stop(&mut self) { self.status = MusicStatus::Stopped; let _ = self.mpv.as_ref().unwrap().borrow_mut().set_property("playback-time", 0); let _ = self.mpv.as_ref().unwrap().borrow_mut().set_prop...
let _ = self.mpv.as_ref().unwrap().borrow_mut().set_property("pause", false); } /// Stops the current music.
random_line_split
music.rs
//! This module provides the music struct, which allows to play and control a music from a file. use libc; use mpv; use std::rc::Rc; use std::cell::RefCell; /// The music struct. pub struct Music { /// Indicates wether the music is playing, paused or stopped. status: MusicStatus, /// The mpv handler to...
if ended { self.stop(); } ended } } #[derive(Copy, Clone)] /// The different possible music statuses. pub enum MusicStatus { Stopped, Playing, Paused } impl MusicStatus { /// Returns a UTF-8 icon representing the music status. pub fn get_icon(&self) -> St...
{ let mut ended = false; if ! self.mpv.is_none() { let mpv = self.mpv.as_mut().unwrap(); loop { match mpv.borrow_mut().wait_event(0.0) { Some(mpv::Event::EndFile(_)) => { ended = true; }, ...
identifier_body
music.rs
//! This module provides the music struct, which allows to play and control a music from a file. use libc; use mpv; use std::rc::Rc; use std::cell::RefCell; /// The music struct. pub struct Music { /// Indicates wether the music is playing, paused or stopped. status: MusicStatus, /// The mpv handler to...
(path: &str) -> Result<Music, ()> { // Set locale, because apparently, mpv needs it unsafe { libc::setlocale(libc::LC_NUMERIC, &('C' as i8)); } let mpv_builder = mpv::MpvHandlerBuilder::new().expect("Failed to init MPV builder"); let mut mpv = mpv_builder.build().exp...
new
identifier_name
util.rs
use std::io::{self, Result, Read, Write, ErrorKind}; //copy with length limiting pub fn copy<R: Read, W: Write>(r: &mut R, w: &mut W, len_max: u64) -> io::Result<u64> { let mut buf = [0; 1024]; let mut written : u64 = 0; while written < len_max { let len = match r.read(&mut buf) { Ok(0) => return Ok(written...
} else { let to_write : usize = len_max as usize - written as usize; let to_write = if to_write > len {len} else {to_write}; //required? try!(w.write_all(&buf[..to_write])); written += to_write as u64; } } Ok(written) }
}; if (written+len as u64) < len_max { try!(w.write_all(&buf[..len])); written += len as u64;
random_line_split
util.rs
use std::io::{self, Result, Read, Write, ErrorKind}; //copy with length limiting pub fn copy<R: Read, W: Write>(r: &mut R, w: &mut W, len_max: u64) -> io::Result<u64>
written += to_write as u64; } } Ok(written) }
{ let mut buf = [0; 1024]; let mut written : u64 = 0; while written < len_max { let len = match r.read(&mut buf) { Ok(0) => return Ok(written), Ok(len) => len, Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, Err(e) => return Err(e), }; if (written+len as u64) < len_max { try!(...
identifier_body
util.rs
use std::io::{self, Result, Read, Write, ErrorKind}; //copy with length limiting pub fn
<R: Read, W: Write>(r: &mut R, w: &mut W, len_max: u64) -> io::Result<u64> { let mut buf = [0; 1024]; let mut written : u64 = 0; while written < len_max { let len = match r.read(&mut buf) { Ok(0) => return Ok(written), Ok(len) => len, Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, Err(...
copy
identifier_name
htmlimageelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::AttrValue; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codege...
} fn before_remove_attr(&self, name: &Atom, value: DOMString) { match self.super_type() { Some(ref s) => s.before_remove_attr(name, value.clone()), _ => (), } if "src" == name.as_slice() { self.update_image(None); } } fn parse_plain...
{ let window = window_from_node(*self).root(); let url = window.deref().get_url(); self.update_image(Some((value, &url))); }
conditional_block
htmlimageelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::AttrValue; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codege...
let element = HTMLImageElement::new_inherited(localName, document); Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap) } } pub trait LayoutHTMLImageElementHelpers { unsafe fn image(&self) -> Option<Url>; } impl LayoutHTMLImageElementHelpers for JS<HTMLImageElement> { ...
#[allow(unrooted_must_root)] pub fn new(localName: DOMString, document: JSRef<Document>) -> Temporary<HTMLImageElement> {
random_line_split
htmlimageelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::AttrValue; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codege...
}
{ self.htmlelement.reflector() }
identifier_body
htmlimageelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::AttrValue; use dom::bindings::codegen::Bindings::HTMLImageElementBinding; use dom::bindings::codege...
(&self, name: &Atom, value: DOMString) { match self.super_type() { Some(ref s) => s.before_remove_attr(name, value.clone()), _ => (), } if "src" == name.as_slice() { self.update_image(None); } } fn parse_plain_attribute(&self, name: &str, val...
before_remove_attr
identifier_name
middleware.py
"""Pylons middleware initialization""" from beaker.middleware import CacheMiddleware, SessionMiddleware from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.middleware imp...
else: app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) # Establish the Registry for this application app = RegistryManager(app) if asbool(static_files): # Serve static files static_app = StaticURLParser(config['pylons.paths']['static_files']) app = Casc...
app = StatusCodeRedirect(app)
conditional_block
middleware.py
"""Pylons middleware initialization""" from beaker.middleware import CacheMiddleware, SessionMiddleware from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.middleware imp...
""" # Configure the Pylons environment load_environment(global_conf, app_conf) # The Pylons WSGI app app = PylonsApp() # Routing/Session/Cache Middleware app = RoutesMiddleware(app, config['routes.map']) app = SessionMiddleware(app, config) app = CacheMiddleware(app, config) ...
"""Create a Pylons WSGI application and return it ``global_conf`` The inherited configuration for this application. Normally from the [DEFAULT] section of the Paste ini file. ``full_stack`` Whether this application provides a full WSGI stack (by default, meaning it handles its ...
identifier_body
middleware.py
"""Pylons middleware initialization""" from beaker.middleware import CacheMiddleware, SessionMiddleware from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.middleware imp...
``static_files`` Whether this application serves its own static files; disable when another web server is responsible for serving them. ``app_conf`` The application's local configuration. Normally specified in the [app:<name>] section of the Paste ini file (where <name> ...
random_line_split
middleware.py
"""Pylons middleware initialization""" from beaker.middleware import CacheMiddleware, SessionMiddleware from paste.cascade import Cascade from paste.registry import RegistryManager from paste.urlparser import StaticURLParser from paste.deploy.converters import asbool from pylons import config from pylons.middleware imp...
(global_conf, full_stack=True, static_files=True, **app_conf): """Create a Pylons WSGI application and return it ``global_conf`` The inherited configuration for this application. Normally from the [DEFAULT] section of the Paste ini file. ``full_stack`` Whether this application prov...
make_app
identifier_name
lib.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let mut r = rand::task_rng(); let mut words = vec!(); for _ in range(0, 20) { let range = r.gen_range(1u, 10); words.push(r.gen_vec::<u8>(range)); } for _ in range(0, 20) { let mut input = vec![]; for _ in range(0, 2000) { ...
#[allow(deprecated_owned_vector)] fn test_flate_round_trip() {
random_line_split
lib.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> { unsafe { let mut outsz : size_t = 0; let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *c_void, bytes.len() as size_t, ...
{ deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER) }
identifier_body
lib.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(bytes: &[u8]) -> Option<CVec<u8>> { deflate_bytes_internal(bytes, LZ_NORM) } /// Compress a buffer, using a header that zlib can understand. pub fn deflate_bytes_zlib(bytes: &[u8]) -> Option<CVec<u8>> { deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER) } fn inflate_bytes_internal(bytes: &[u8],...
deflate_bytes
identifier_name
lib.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { None } } } /// Compress a buffer, without writing any sort of header on the output. pub fn deflate_bytes(bytes: &[u8]) -> Option<CVec<u8>> { deflate_bytes_internal(bytes, LZ_NORM) } /// Compress a buffer, using a header that zlib can understand. pub fn deflate_bytes_zlib(bytes: &[u...
{ Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, proc() libc::free(res))) }
conditional_block
student-join.component.js
System.register(['angular2/core', 'angular2/router', './classroom.service'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? tar...
StudentJoinComponent.prototype.submitSecretCode = function (secretCode) { console.log("submit secret code"); this._classroomService.submitSecretCode(secretCode); // if (this._classroomService.correctSecretCode) { // this....
{ this._router = _router; this._classroomService = _classroomService; this.errorCodeState = this._classroomService.getErrorState(); // end of constructor }
identifier_body
student-join.component.js
System.register(['angular2/core', 'angular2/router', './classroom.service'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? tar...
function (core_1_1) { core_1 = core_1_1; }, function (router_1_1) { router_1 = router_1_1; }, function (classroom_service_1_1) { classroom_service_1 = classroom_service_1_1; }], execute: funct...
}; var core_1, router_1, classroom_service_1; var StudentJoinComponent; return { setters:[
random_line_split
student-join.component.js
System.register(['angular2/core', 'angular2/router', './classroom.service'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? tar...
(_router, _classroomService) { this._router = _router; this._classroomService = _classroomService; this.errorCodeState = this._classroomService.getErrorState(); // end of constructor } StudentJoinComponent.pr...
StudentJoinComponent
identifier_name
login.ts
class Login { constructor() { this.loadBackground(); } loginPage() { } loadBackground() { if ($('#image-container').length > 0) { $.get($('#image-container').data('imageUrl'), this.renderImage.bind(this)) } } renderImage(images: any) { ...
else { $('#image-credit').hide(); } } } } new Login();
{ $('#image-container').attr('title', images[0].description); $('#image-container').css({ 'background-image': `url(${images[0].urls.regular})` }); $('#image-credit').html(`Image by <a href='${images[0].user.links.html}?utm_source=Hood%20CMS&utm_medium=referral'>${images[0...
conditional_block
login.ts
class Login { constructor() { this.loadBackground(); } loginPage() { } loadBackground() { if ($('#image-container').length > 0) { $.get($('#image-container').data('imageUrl'), this.renderImage.bind(this)) } }
} else { if (images.length > 0) { $('#image-container').attr('title', images[0].description); $('#image-container').css({ 'background-image': `url(${images[0].urls.regular})` }); $('#image-credit').html(`Image by <a href='${images[0].user.links.html}?u...
renderImage(images: any) { if (typeof images == "string") { $('#image-container').css({ 'background-image': `url(${images})` }); $('#image-credit').hide();
random_line_split
login.ts
class Login { constructor()
loginPage() { } loadBackground() { if ($('#image-container').length > 0) { $.get($('#image-container').data('imageUrl'), this.renderImage.bind(this)) } } renderImage(images: any) { if (typeof images == "string") { $('#image-container').css({ 'ba...
{ this.loadBackground(); }
identifier_body
login.ts
class Login {
() { this.loadBackground(); } loginPage() { } loadBackground() { if ($('#image-container').length > 0) { $.get($('#image-container').data('imageUrl'), this.renderImage.bind(this)) } } renderImage(images: any) { if (typeof images == "str...
constructor
identifier_name
vega-blue-green-1.js
// Creates and adds swatch group. var swatchGroup = addSwatchGroup(colorGroup); // Gets colors that belong to group. var groupColors = colors.filter(function (o) { return o.group === colorGroup; }); groupColors.forEach(function (groupColor, groupColorIndex) { // Creates RGB color. ...
(pt) { return pt / 2.834645; } /** * Polyfills methods that aren't available in Illustrator. */ function polyfill() { // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#Polyfill if (!Array.prototype.filter) { Array.prototype.filter = function (fun /*, thisArg*/ ) ...
ptToMm
identifier_name
vega-blue-green-1.js
// Creates and adds swatch group. var swatchGroup = addSwatchGroup(colorGroup); // Gets colors that belong to group. var groupColors = colors.filter(function (o) { return o.group === colorGroup; }); groupColors.forEach(function (groupColor, groupColorIndex) { // Creates RGB color.
var swatchColor = 'cmyk' === mode ? colorToCMYK(rgb) : rgb; // Creates and adds swatch to document. var swatch = addSwatch(groupColor.name, swatchColor); // Adds swatch to swatch group. swatchGroup.addSwatch(swatch); // Draws rectangle on artboard. drawSwatchRect(docHeight -...
var rgb = new RGBColor(); rgb.red = groupColor.rgb[0]; rgb.green = groupColor.rgb[1]; rgb.blue = groupColor.rgb[2];
random_line_split
vega-blue-green-1.js
Creates and adds swatch group. var swatchGroup = addSwatchGroup(colorGroup); // Gets colors that belong to group. var groupColors = colors.filter(function (o) { return o.group === colorGroup; }); groupColors.forEach(function (groupColor, groupColorIndex) { // Creates RGB color. ...
cmykColor.magenta = colors[1]; cmykColor.yellow = colors[2]; cmykColor.black = colors[3]; break; case 'GrayColor': colors = app.convertSampleColor(ImageColorSpace.GrayScale, [color.gray], ImageColorSpace.CMYK, ColorConvertPurpose.dummypurpose); cmykColor.cyan = colors[0]; cmykColor.magent...
{ var cmykColor = new CMYKColor(); var colors; switch (color.typename) { case 'CMYKColor': cmykColor = color; break; case 'RGBColor': colors = app.convertSampleColor(ImageColorSpace.RGB, [color.red, color.green, color.blue], ImageColorSpace.CMYK, ColorConvertPurpose.dummypurpose); cmykColor....
identifier_body
vega-blue-green-1.js
colors[0]; cmykColor.magenta = colors[1]; cmykColor.yellow = colors[2]; cmykColor.black = colors[3]; break; case 'LabColor': colors = app.convertSampleColor(ImageColorSpace.LAB, [color.l, color.a, color.b], ImageColorSpace.CMYK, ColorConvertPurpose.dummypurpose); cmykColor.cyan = colors[0]; ...
{ result.push(dontEnums[i]); }
conditional_block
wsgi.py
""" WSGI config for djdan project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` se...
middleware here, or combine a Django application with an application of another framework. """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djdan.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICA...
might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI
random_line_split
string-self-append.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
while i > 0 { println!("{}", a.len()); assert_eq!(a.len(), expected_len); a = format_strbuf!("{}{}", a, a); i -= 1; expected_len *= 2u; } }
let mut i = 20; let mut expected_len = 1u;
random_line_split
string-self-append.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { // Make sure we properly handle repeated self-appends. let mut a: StrBuf = "A".to_strbuf(); let mut i = 20; let mut expected_len = 1u; while i > 0 { println!("{}", a.len()); assert_eq!(a.len(), expected_len); a = format_strbuf!("{}{}", a, a); i -= 1; expe...
main
identifier_name
string-self-append.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ // Make sure we properly handle repeated self-appends. let mut a: StrBuf = "A".to_strbuf(); let mut i = 20; let mut expected_len = 1u; while i > 0 { println!("{}", a.len()); assert_eq!(a.len(), expected_len); a = format_strbuf!("{}{}", a, a); i -= 1; expecte...
identifier_body
test_validators.py
from collections.abc import Sequence import pytest from regolith.schemas import SCHEMAS, validate, EXEMPLARS from pprint import pprint @pytest.mark.parametrize("key", SCHEMAS.keys()) def test_validation(key):
@pytest.mark.parametrize("key", SCHEMAS.keys()) def test_exemplars(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: v = validate(key, e, SCHEMAS) assert v[0] else: v = validate(key, EXEMPLARS[key], SCHEMAS) if not v[0]: for vv...
if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: validate(key, e, SCHEMAS) else: validate(key, EXEMPLARS[key], SCHEMAS)
identifier_body
test_validators.py
from collections.abc import Sequence import pytest from regolith.schemas import SCHEMAS, validate, EXEMPLARS from pprint import pprint @pytest.mark.parametrize("key", SCHEMAS.keys()) def test_validation(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: validate(key, e, ...
(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: v = validate(key, e, SCHEMAS) assert v[0] else: v = validate(key, EXEMPLARS[key], SCHEMAS) if not v[0]: for vv, reason in v[1].items(): print(vv, reason) ...
test_exemplars
identifier_name
test_validators.py
from collections.abc import Sequence import pytest from regolith.schemas import SCHEMAS, validate, EXEMPLARS from pprint import pprint @pytest.mark.parametrize("key", SCHEMAS.keys()) def test_validation(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: validate(key, e, ...
else: v = validate(key, EXEMPLARS[key], SCHEMAS) if not v[0]: for vv, reason in v[1].items(): print(vv, reason) print(type(EXEMPLARS[key][vv])) pprint(EXEMPLARS[key][vv]) assert v[0]
for e in EXEMPLARS[key]: v = validate(key, e, SCHEMAS) assert v[0]
random_line_split
test_validators.py
from collections.abc import Sequence import pytest from regolith.schemas import SCHEMAS, validate, EXEMPLARS from pprint import pprint @pytest.mark.parametrize("key", SCHEMAS.keys()) def test_validation(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: validate(key, e, ...
v = validate(key, EXEMPLARS[key], SCHEMAS) if not v[0]: for vv, reason in v[1].items(): print(vv, reason) print(type(EXEMPLARS[key][vv])) pprint(EXEMPLARS[key][vv]) assert v[0]
conditional_block
controlflow.rs
<'a>(bcx: &'a Block<'a>, b: &ast::Block, dest: expr::Dest) -> &'a Block<'a> { let _icx = push_ctxt("trans_block"); let mut bcx = bcx; for s in b.stmts.iter() { bcx = trans_stmt(bcx, *s); } match b.expr { Some(e) => { bcx = expr::trans_into(bcx, e, dest)...
trans_block
identifier_name
controlflow.rs
Block<'a> { debug!("trans_if(bcx={}, cond={}, thn={:?}, dest={})", bcx.to_str(), bcx.expr_to_str(cond), thn.id, dest.to_str(bcx.ccx())); let _indenter = indenter(); let _icx = push_ctxt("trans_if"); let Result {bcx, val: cond_val} = expr::trans_to_datum(bcx, cond).to_res...
Some(inf) => inf.parent, None => { unwind = match unwind.parent { Some(bcx) => bcx, // This is a return from a loop body block None => { Store(bcx, C...
{ // If we're looking for a labeled loop, check the label... target = if to_end { brk } else { unwind }; match opt_label { Some(desired) => match l { Some(a...
conditional_block
controlflow.rs
Block<'a> { debug!("trans_if(bcx={}, cond={}, thn={:?}, dest={})", bcx.to_str(), bcx.expr_to_str(cond), thn.id, dest.to_str(bcx.ccx())); let _indenter = indenter(); let _icx = push_ctxt("trans_if"); let Result {bcx, val: cond_val} = expr::trans_to_datum(bcx, cond).to_res...
pub fn trans_break_cont<'a>( bcx: &'a Block<'a>, opt_label: Option<Name>, to_end: bool) -> &'a Block<'a> { let _icx = push_ctxt("trans_break_cont"); // Locate closest loop block, outputting cleanup as we go. let...
let body_bcx_out = trans_block(body_bcx_in, body, expr::Ignore); cleanup_and_Br(body_bcx_out, body_bcx_in, body_bcx_in.llbb); return next_bcx; }
random_line_split
controlflow.rs
pub fn trans_if<'a>( bcx: &'a Block<'a>, cond: &ast::Expr, thn: ast::P<ast::Block>, els: Option<@ast::Expr>, dest: expr::Dest) -> &'a Block<'a> { debug!("trans_if(bcx={}, cond={}, thn={:?}, dest={})", bcx.to...
{ let _icx = push_ctxt("trans_block"); let mut bcx = bcx; for s in b.stmts.iter() { bcx = trans_stmt(bcx, *s); } match b.expr { Some(e) => { bcx = expr::trans_into(bcx, e, dest); } None => { assert!(dest == expr::Ignore || bcx.unreachable.get()...
identifier_body
padd.lines.js
var utils = require("../../lib/utils"); var pad = utils.paddLines; var assert = require("chai").assert;
it("does not padd with empty string", function() { var input = "line 1\nline 2"; var actual = pad({content: input, count: 0}); assert.equal(input, actual); }); it("Does NOT padd the first line", function() { var input = "line 1\nline 2"; var actual = pad({cont...
describe("Padding content", function() {
random_line_split
toaiff.py
"""Convert "arbitrary" sound files to AIFF (Apple and SGI's audio format). Input may be compressed. Uncompressed file type may be AIFF, WAV, VOC, 8SVX, NeXT/Sun, and others. An exception is raised if the file is not of a recognized type. Returned filename is either the input filename or a temporary filename; in the la...
temp = tempfile.mktemp() temps.append(temp) sts = table[ftype].copy(fname, temp) if sts: raise error, filename + ': conversion to aiff failed' return temp
raise error, \ filename + ': unsupported audio file type ' + `ftype`
conditional_block