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
_base.py
class PluginBase(object): name = '' doc = 'doc about this class' methods_subclass = {} def __init__(self, **kwargs): self.methods = { 'help': 'doc about help method', 'get_methods': 'doc about get_methods method' } self.methods.update(self.methods_subclas...
if strings_found: last_end = 0 for start, end in strings_found: before = text[last_end:start] for x in before.split(' '): if x: args_found.append(x) args_found.append(text[start:end]) ...
start_str = (char, i)
conditional_block
propTypes.ts
/** PropTypes for documentation purpose (not tested yet) */ import PropTypes from 'prop-types'; export const fieldProps = { // defaultValue: PropTypes.any, help: PropTypes.string, description: PropTypes.string, // initial fields name: PropTypes.string, datatype: PropTypes.any, // ? layout: PropTypes.an...
order: PropTypes.number, fields: PropTypes.arrayOf(PropTypes.shape(fieldProps)) }; export const callbackProps = { changeCallback: PropTypes.func, submitCallback: PropTypes.func, successCallback: PropTypes.func, removeSuccessCallback: PropTypes.func, errorCallback: PropTypes.func, cancelCallback: PropTy...
random_line_split
token_client.rs
extern crate apns2; extern crate argparse; use argparse::{ArgumentParser, Store, StoreTrue}; use apns2::client::TokenClient; use apns2::apns_token::APNSToken; use apns2::payload::{Payload, APSAlert}; use apns2::notification::{Notification, NotificationOptions}; use std::fs::File; use std::time::Duration; // An exampl...
() { let mut der_file_location = String::new(); let mut team_id = String::new(); let mut key_id = String::new(); let mut device_token = String::new(); let mut message = String::from("Ch-check it out!"); let mut ca_certs = String::from("/etc/ssl/cert.pem"); let mut sandbox = false; { ...
main
identifier_name
token_client.rs
extern crate apns2; extern crate argparse; use argparse::{ArgumentParser, Store, StoreTrue}; use apns2::client::TokenClient; use apns2::apns_token::APNSToken; use apns2::payload::{Payload, APSAlert}; use apns2::notification::{Notification, NotificationOptions}; use std::fs::File; use std::time::Duration; // An exampl...
} // Read the private key from disk let der_file = File::open(der_file_location).unwrap(); // Create a new token struct with the private key, team id and key id // The token is valid for an hour and needs to be renewed after that let apns_token = APNSToken::new(der_file, team_id.as_ref(), key_...
{ let mut der_file_location = String::new(); let mut team_id = String::new(); let mut key_id = String::new(); let mut device_token = String::new(); let mut message = String::from("Ch-check it out!"); let mut ca_certs = String::from("/etc/ssl/cert.pem"); let mut sandbox = false; { ...
identifier_body
token_client.rs
extern crate apns2; extern crate argparse; use argparse::{ArgumentParser, Store, StoreTrue}; use apns2::client::TokenClient; use apns2::apns_token::APNSToken; use apns2::payload::{Payload, APSAlert}; use apns2::notification::{Notification, NotificationOptions}; use std::fs::File; use std::time::Duration;
let mut key_id = String::new(); let mut device_token = String::new(); let mut message = String::from("Ch-check it out!"); let mut ca_certs = String::from("/etc/ssl/cert.pem"); let mut sandbox = false; { let mut ap = ArgumentParser::new(); ap.set_description("APNs token-based pus...
// An example client connectiong to APNs with a JWT token fn main() { let mut der_file_location = String::new(); let mut team_id = String::new();
random_line_split
invalidation_map.rs
use {Atom, LocalName, Namespace}; use context::QuirksMode; use element_state::ElementState; use selector_map::{MaybeCaseInsensitiveHashMap, SelectorMap, SelectorMapEntry}; use selector_parser::SelectorImpl; use selectors::attr::NamespaceConstraint; use selectors::parser::{Combinator, Component}; use selectors::parser:...
//! Code for invalidations due to state or attribute changes.
random_line_split
invalidation_map.rs
[u16; 4] = [b'r' as u16, b't' as u16, b'l' as u16, 0]; if LTR == *s { IN_LTR_STATE } else if RTL == *s { IN_RTL_STATE } else { // :dir(something-random) is a valid selector, but shouldn't // match anything. ElementState::empty() } } /// Mapping between (partial...
(&self) -> bool { matches!(self.combinator(), Some(Combinator::NextSibling) | Some(Combinator::LaterSibling)) } } impl SelectorMapEntry for Dependency { fn selector(&self) -> SelectorIter<SelectorImpl> { self.selector.iter_from(self.selector_offset) } } ...
affects_later_siblings
identifier_name
invalidation_map.rs
[u16; 4] = [b'r' as u16, b't' as u16, b'l' as u16, 0]; if LTR == *s { IN_LTR_STATE } else if RTL == *s { IN_RTL_STATE } else { // :dir(something-random) is a valid selector, but shouldn't // match anything. ElementState::empty() } } /// Mapping between (partial...
} /// A map where we store invalidations. /// /// This is slightly different to a SelectorMap, in the sense of that the same /// selector may appear multiple times. /// /// In particular, we want to lookup as few things as possible to get the fewer /// selectors the better, so this looks up by id, class, or looks at ...
{ self.dep.selector() }
identifier_body
event-storage.ts
import path from "path" import Configstore from "configstore" import createFetch from "@turist/fetch" import { Store } from "./store" import { ensureDirSync } from "fs-extra" import { isTruthy } from "gatsby-core-utils" import { InMemoryConfigStore } from "./in-memory-store" const fetch = createFetch() /* The events ...
(): Promise<boolean> { return this.store.startFlushEvents(async (eventsData: string) => { const events = eventsData .split(`\n`) .filter(e => e && e.length > 2) // drop empty lines .map(e => JSON.parse(e)) return this.submitEvents(events) }) } async submitEvents(events:...
sendEvents
identifier_name
event-storage.ts
import path from "path" import Configstore from "configstore" import createFetch from "@turist/fetch" import { Store } from "./store" import { ensureDirSync } from "fs-extra" import { isTruthy } from "gatsby-core-utils" import { InMemoryConfigStore } from "./in-memory-store" const fetch = createFetch() /* The events ...
} this.store.appendToBuffer(eventString + `\n`) } async sendEvents(): Promise<boolean> { return this.store.startFlushEvents(async (eventsData: string) => { const events = eventsData .split(`\n`) .filter(e => e && e.length > 2) // drop empty lines .map(e => JSON.parse(e))...
{ // Bail because we don't want to send debug events return }
conditional_block
event-storage.ts
import path from "path" import Configstore from "configstore" import createFetch from "@turist/fetch" import { Store } from "./store" import { ensureDirSync } from "fs-extra" import { isTruthy } from "gatsby-core-utils" import { InMemoryConfigStore } from "./in-memory-store" const fetch = createFetch() /* The events ...
isTrackingDisabled(): boolean { return this.disabled } addEvent(event: unknown): void { if (this.disabled) { return } const eventString = JSON.stringify(event) if (this.debugEvents || this.verbose) { console.log(`Captured event:`, JSON.parse(eventString)) if (this.debug...
{ try { this.config = new Configstore(`gatsby`, {}, { globalConfigPath: true }) } catch (e) { this.config = new InMemoryConfigStore() } const baseDir = path.dirname(this.config.path) try { ensureDirSync(baseDir) } catch (e) { // TODO: Log this event } this.stor...
identifier_body
event-storage.ts
import path from "path" import Configstore from "configstore" import createFetch from "@turist/fetch" import { Store } from "./store" import { ensureDirSync } from "fs-extra" import { isTruthy } from "gatsby-core-utils" import { InMemoryConfigStore } from "./in-memory-store" const fetch = createFetch() /* The events ...
return res.ok } catch (e) { return false } } getUserAgent(): string { try { const { name, version } = require(`../package.json`) return `${name}:${version}` } catch (e) { return `Gatsby Telemetry` } } getConfig(key: string): string | boolean | Record<string, u...
})
random_line_split
index.d.ts
import Koa from 'koa'; import { Server as ServerTypes, Game, StorageAPI } from '../types'; export declare type KoaServer = ReturnType<Koa['listen']>; interface ServerConfig { port?: number; callback?: () => void; lobbyConfig?: { apiPort: number; apiCallback?: () => void; }; } ...
* @param generateCredentials - Method for API to generate player credentials. * @param https - HTTPS configuration options passed through to the TLS module. */ export declare function Server({ games, db, transport, authenticateCredentials, generateCredentials, https, }: ServerOpts): { app: any; db: Stor...
* @param games - The games that this server will handle. * @param db - The interface with the database. * @param transport - The interface with the clients. * @param authenticateCredentials - Function to test player credentials.
random_line_split
epics.test.js
/// // Dependencies /// import { fromJS } from 'immutable'; import configureMockStore from 'redux-mock-store'; import { ActionsObservable } from 'redux-observable'; import nock from 'nock'; import url from 'url'; import { baseURL } from '../../app/__mocks__/api'; import epic from '../epics'; import * as actions from ...
]; const friendsTo = [ {id: 3}, {id: 4} ]; nock(baseHost) .get(/^\/people\/1\/friendsFrom.*$/) .reply(200, friendsFrom); nock(baseHost) .get(/^\/people\/1\/friendsTo.*$/) .reply(200, friendsTo); const state = fromJS(defaultState); store = mockStore(state); const action$ = ActionsObservable.of( a...
{id: 1}, {id: 2}
random_line_split
bbcodetag.py
# -*- coding: utf-8 -*- """Copyright (c) 2009 Sergio Gabriel Teves All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any...
@register.filter def smiley(value): img = '<img src="%s"/>' for item in settings.SMILEYS_PACK: code = string.replace(string.replace(item[0], "(", "\("),")","\)") pattern = r"(?i)%s" % code value = re.sub(pattern, img % (settings.SMILEYS_ROOT + item[1]),value) return mark_s...
list = [] for item in settings.SMILEYS_PACK: list.append({'code': item[0],'img': settings.SMILEYS_ROOT + item[1]}) return {'list': list}
identifier_body
bbcodetag.py
# -*- coding: utf-8 -*- """Copyright (c) 2009 Sergio Gabriel Teves All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any...
return force_unicode(value) else: return mark_safe(render_bbcode(value)) bbcode.is_save = True @register.filter def strip_bbcode(value): """ Strips BBCode tags from a string By using the postmark lib from: @see: http://code.google.com/p/postmarkup/ """ ...
raise template.TemplateSyntaxError, "Error in {% bbcode %} filter: The Python postmarkup library isn't installed."
conditional_block
bbcodetag.py
# -*- coding: utf-8 -*- """Copyright (c) 2009 Sergio Gabriel Teves All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any...
from postmarkup import strip_bbcode except ImportError: if settings.DEBUG: raise template.TemplateSyntaxError, "Error in {% bbcode %} filter: The Python postmarkup library isn't installed." return force_unicode(value) else: return mark_safe(strip_bbcode(value)) ...
By using the postmark lib from: @see: http://code.google.com/p/postmarkup/ """ try:
random_line_split
bbcodetag.py
# -*- coding: utf-8 -*- """Copyright (c) 2009 Sergio Gabriel Teves All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any...
(): list = [] for item in settings.SMILEYS_PACK: list.append({'code': item[0],'img': settings.SMILEYS_ROOT + item[1]}) return {'list': list} @register.filter def smiley(value): img = '<img src="%s"/>' for item in settings.SMILEYS_PACK: code = string.replace(string.replace(...
smileyrender
identifier_name
app.js
/* ----------------------------------------------------------------------------------------------- * BuddyTok Application * ----------------------------------------------------------------------------------------------*/ /* global jQuery, _, OT, Backbone, log, alert */ /* global LocalUser, BuddyList, InvitationList, ...
App.connectModalView.show(); App.userInfoView.render().$el.appendTo('.navbar-right'); App.buddyListView.render().$el.appendTo('.sidebar-left'); App.invitationListView.render().$el.appendTo('.row-top'); App.chatView.render().$el.appendTo('.content-right'); }, }; _.extend(App, Backb...
}, domReady: function() { log.info('App: domReady'); // NOTE: App.connectModalView is already in the DOM and does not need to be rendered
random_line_split
main.rs
extern crate nanomsg; use nanomsg::{Socket, Protocol}; use std::io::{Read, Write}; const ADDRESS: &'static str = "ipc:///tmp/a.ipc"; fn main() { let mut socket = Socket::new(Protocol::Rep).unwrap(); println!("Connecting to address '{}'", ADDRESS); let mut endpoint = socket.bind(ADDRESS).unwrap(); ...
(socket: &mut Socket, reply: &str) { socket.write_all(reply.as_bytes()).expect("Failed to send reply"); println!("Replied with '{}'", reply) }
reply
identifier_name
main.rs
extern crate nanomsg; use nanomsg::{Socket, Protocol}; use std::io::{Read, Write}; const ADDRESS: &'static str = "ipc:///tmp/a.ipc"; fn main() { let mut socket = Socket::new(Protocol::Rep).unwrap(); println!("Connecting to address '{}'", ADDRESS); let mut endpoint = socket.bind(ADDRESS).unwrap(); ...
{ socket.write_all(reply.as_bytes()).expect("Failed to send reply"); println!("Replied with '{}'", reply) }
identifier_body
main.rs
extern crate nanomsg; use nanomsg::{Socket, Protocol}; use std::io::{Read, Write}; const ADDRESS: &'static str = "ipc:///tmp/a.ipc"; fn main() { let mut socket = Socket::new(Protocol::Rep).unwrap(); println!("Connecting to address '{}'", ADDRESS); let mut endpoint = socket.bind(ADDRESS).unwrap(); ...
} "STOP" => { reply(&mut socket, "OK"); println!("Shutting down"); break; }, _ => reply(&mut socket, "UNKNOWN REQUEST") } request.clear(); } endpoint.shutdown().expect("Failed to shutdown graceful...
random_line_split
camera3.py
#! /usr/bin/env python3 import asyncio import subprocess import numpy as np import time comm = None class Camera: def __init__(self, notify): self._process = None self._now_pos = np.array([0., 0., 0.]) self._running = False self._notify = notify @asyncio.coroutine def con...
(self): self._running = False self._process.terminate()
stop
identifier_name
camera3.py
#! /usr/bin/env python3 import asyncio import subprocess import numpy as np import time comm = None class Camera: def __init__(self, notify): self._process = None self._now_pos = np.array([0., 0., 0.]) self._running = False self._notify = notify @asyncio.coroutine def con...
def stop(self): self._running = False self._process.terminate()
data = yield from self._process.stdout.readline() print(data) self._now_pos = np.array(list(map(float, data.split()))) yield from self._notify(time.time(), self._now_pos)
conditional_block
camera3.py
#! /usr/bin/env python3 import asyncio import subprocess import numpy as np import time comm = None class Camera: def __init__(self, notify): self._process = None self._now_pos = np.array([0., 0., 0.]) self._running = False self._notify = notify @asyncio.coroutine def con...
print(data) self._now_pos = np.array(list(map(float, data.split()))) yield from self._notify(time.time(), self._now_pos) def stop(self): self._running = False self._process.terminate()
@asyncio.coroutine def run(self): while self._running: data = yield from self._process.stdout.readline()
random_line_split
camera3.py
#! /usr/bin/env python3 import asyncio import subprocess import numpy as np import time comm = None class Camera: def __init__(self, notify): self._process = None self._now_pos = np.array([0., 0., 0.]) self._running = False self._notify = notify @asyncio.coroutine def con...
def stop(self): self._running = False self._process.terminate()
while self._running: data = yield from self._process.stdout.readline() print(data) self._now_pos = np.array(list(map(float, data.split()))) yield from self._notify(time.time(), self._now_pos)
identifier_body
memory_io.rs
extern crate openexr; use std::io::Cursor; use openexr::{FrameBuffer, FrameBufferMut, Header, InputFile, PixelType, ScanlineOutputFile}; #[test] fn
() { // Target memory for writing let mut in_memory_buffer = Cursor::new(Vec::<u8>::new()); // Write file to memory { let pixel_data = vec![(0.82f32, 1.78f32, 0.21f32); 256 * 256]; let mut exr_file = ScanlineOutputFile::new( &mut in_memory_buffer, Header::new() ...
memory_io
identifier_name
memory_io.rs
extern crate openexr; use std::io::Cursor; use openexr::{FrameBuffer, FrameBufferMut, Header, InputFile, PixelType, ScanlineOutputFile}; #[test] fn memory_io()
exr_file.write_pixels(&fb).unwrap(); } // Read file from memory, and verify its contents { let mut pixel_data = vec![(0.0f32, 0.0f32, 0.0f32); 256 * 256]; let mut exr_file = InputFile::from_slice(in_memory_buffer.get_ref()).unwrap(); let (width, height) = exr_file.header()...
{ // Target memory for writing let mut in_memory_buffer = Cursor::new(Vec::<u8>::new()); // Write file to memory { let pixel_data = vec![(0.82f32, 1.78f32, 0.21f32); 256 * 256]; let mut exr_file = ScanlineOutputFile::new( &mut in_memory_buffer, Header::new() ...
identifier_body
memory_io.rs
extern crate openexr; use std::io::Cursor; use openexr::{FrameBuffer, FrameBufferMut, Header, InputFile, PixelType, ScanlineOutputFile}; #[test] fn memory_io() { // Target memory for writing let mut in_memory_buffer = Cursor::new(Vec::<u8>::new()); // Write file to memory { let pixel_data = ...
exr_file.write_pixels(&fb).unwrap(); } // Read file from memory, and verify its contents { let mut pixel_data = vec![(0.0f32, 0.0f32, 0.0f32); 256 * 256]; let mut exr_file = InputFile::from_slice(in_memory_buffer.get_ref()).unwrap(); let (width, height) = exr_file.header()....
let mut fb = FrameBuffer::new(256, 256); fb.insert_channels(&["R", "G", "B"], &pixel_data);
random_line_split
example_long_selafin.py
#!/usr/bin/env python """ Use Telemac (selafin) output ================================== """ from datetime import timedelta, datetime from os import sep from pyproj import Proj from opendrift.readers import reader_telemac_selafin from opendrift.models.oceandrift import OceanDrift o = OceanDrift(loglevel=0) filename=...
o.plot(fast = True)
time= start_time) o.run(time_step=time_step/10, duration=length)
random_line_split
scenarios.js
'use strict'; /* https://github.com/angular/protractor/blob/master/docs/toc.md */ describe('my app', function() { it('should automatically redirect to /view1 when location hash/fragment is empty', function() { browser.get('index.html'); expect(browser.getLocationAbsUrl()).toMatch("/home"); }); descr...
browser.get('index.html#!/view2'); }); // it('should render view2 when user navigates to /view2', function() { // expect(element.all(by.css('[ng-view] p')).first().getText()). // toMatch(/partial for view 2/); // }); }); });
beforeEach(function() {
random_line_split
column.rs
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0. use super::*; use tidb_query_datatype::codec::{datum, Datum}; use tidb_query_datatype::expr::EvalContext; use tipb::{ColumnInfo, FieldType}; pub const TYPE_VAR_CHAR: i32 = 1; pub const TYPE_LONG: i32 = 2; #[derive(Clone)] pub struct Column { pub...
pub fn as_field_type(&self) -> FieldType { let mut ft = FieldType::default(); ft.set_tp(self.col_field_type()); ft } pub fn col_field_type(&self) -> i32 { match self.col_type { TYPE_LONG => 8, // FieldTypeTp::LongLong TYPE_VAR_CHAR => 15, // Fiel...
}
random_line_split
column.rs
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0. use super::*; use tidb_query_datatype::codec::{datum, Datum}; use tidb_query_datatype::expr::EvalContext; use tipb::{ColumnInfo, FieldType}; pub const TYPE_VAR_CHAR: i32 = 1; pub const TYPE_LONG: i32 = 2; #[derive(Clone)] pub struct
{ pub id: i64, pub(crate) col_type: i32, // negative means not a index key, 0 means primary key, positive means normal index key. pub index: i64, pub(crate) default_val: Option<Datum>, } impl Column { pub fn as_column_info(&self) -> ColumnInfo { let mut c_info = ColumnInfo::default(); ...
Column
identifier_name
tag.post.json.js
function main() { // Get the store reference var store = url.templateArgs.store_type + "://" + url.templateArgs.store_id; // Get the details of the tag if (json.has("name") == false || json.get("name").length == 0) { status.setCode(status.STATUS_BAD_REQUEST, "Name missing when creating tag"); ...
tagExists = (tag != null); if (!tagExists) { tag = taggingService.createTag(store, tagName); if (tag == null) { status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "error.cannotCreateTag"); return; } } // Put the created tag into the model model.tag...
// See if the tag already exists var tag = taggingService.getTag(store, tagName),
random_line_split
tag.post.json.js
function
() { // Get the store reference var store = url.templateArgs.store_type + "://" + url.templateArgs.store_id; // Get the details of the tag if (json.has("name") == false || json.get("name").length == 0) { status.setCode(status.STATUS_BAD_REQUEST, "Name missing when creating tag"); return; ...
main
identifier_name
tag.post.json.js
function main()
{ status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "error.cannotCreateTag"); return; } } // Put the created tag into the model model.tag = tag; model.tagExists = tagExists; } main();
{ // Get the store reference var store = url.templateArgs.store_type + "://" + url.templateArgs.store_id; // Get the details of the tag if (json.has("name") == false || json.get("name").length == 0) { status.setCode(status.STATUS_BAD_REQUEST, "Name missing when creating tag"); return; } ...
identifier_body
tag.post.json.js
function main() { // Get the store reference var store = url.templateArgs.store_type + "://" + url.templateArgs.store_id; // Get the details of the tag if (json.has("name") == false || json.get("name").length == 0)
var tagName = json.get("name"); // See if the tag already exists var tag = taggingService.getTag(store, tagName), tagExists = (tag != null); if (!tagExists) { tag = taggingService.createTag(store, tagName); if (tag == null) { status.setCode(status.STATUS_INTERNAL...
{ status.setCode(status.STATUS_BAD_REQUEST, "Name missing when creating tag"); return; }
conditional_block
procedural_mbe_matching.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
$arm _ => false } ) } _ => unreachable!() } } Failure(_, s) | Error(_, s) => { panic!("expected Success, but got Error/Failure: {}", s); } ...
{ let mbe_matcher = quote_matcher!(cx, $matched:expr, $($pat:pat)|+); let mac_expr = match TokenTree::parse(cx, &mbe_matcher[..], args) { Success(map) => { match (&*map[str_to_ident("matched")], &*map[str_to_ident("pat")]) { (&MatchedNonterminal(NtExpr(ref matched_expr)), ...
identifier_body
procedural_mbe_matching.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
reg.register_macro("matches", expand_mbe_matches); }
#[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) {
random_line_split
procedural_mbe_matching.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) -> Box<MacResult + 'static> { let mbe_matcher = quote_matcher!(cx, $matched:expr, $($pat:pat)|+); let mac_expr = match TokenTree::parse(cx, &mbe_matcher[..], args) { Success(map) => { match (&*map[str_to_ident("matched")], &*map[str_...
expand_mbe_matches
identifier_name
procedural_mbe_matching.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
).collect(); let arm = cx.arm(seq_sp, pats, cx.expr_bool(seq_sp, true)); quote_expr!(cx, match $matched_expr { $arm _ => false } ) ...
{ unreachable!() }
conditional_block
Json.js
/** * Copyright 2012 Google Inc. 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 app...
canParse = false; } jsData = jsData.replace(/,\]/g, ",null]"); jsData = jsData.replace(/\[,/g, "[null,"); jsData = jsData.replace(/,,/g, ",null,"); jsData = jsData.replace(/,,/g, ",null,"); jsData = jsData.replace(/{([\w_]+):/g, "{\"$1\":"); jsData = jsData.repla...
JSON.parse(jsData); } catch (e) {
random_line_split
Json.js
/** * Copyright 2012 Google Inc. 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 app...
return jsData.substring(idx); } }
{ idx = aIdx; }
conditional_block
DropdownTimePicker.js
dojo.html.*"); dojo.require("dojo.date.format"); dojo.require("dojo.date.serialize"); dojo.require("dojo.i18n.common"); dojo.requireLocalization("dojo.widget", "DropdownTimePicker"); dojo.widget.defineWidget( "dojo.widget.DropdownTimePicker", dojo.widget.DropdownContainer, { /* summary: A form input for ent...
dojo.deprecated("dojo.widget.DropdownTimePicker", "Cannot parse user input. Must use displayFormat attribute instead of dateFormat. See dojo.date.format for specification.", "0.5"); }else{ var input = dojo.string.trim(this.inputNode.value); if(input){ var inputTime = dojo.date.parse(input, ...
// summary: callback when user manually types a time into the <input> field if(this.dateFormat){
random_line_split
DropdownTimePicker.js
dojo.html.*"); dojo.require("dojo.date.format"); dojo.require("dojo.date.serialize"); dojo.require("dojo.i18n.common"); dojo.requireLocalization("dojo.widget", "DropdownTimePicker"); dojo.widget.defineWidget( "dojo.widget.DropdownTimePicker", dojo.widget.DropdownContainer, { /* summary: A form input for ent...
this._syncValueNode(); this.onValueChanged(this.getTime()); this.hideContainer(); }, onValueChanged: function(/*Date*/dateObj){ // summary: triggered when this.value is changed }, onInputChange: function(){ // summary: callback when user manually types a time into the <input> field if(thi...
{ this.inputNode.value = dojo.date.format(this.timePicker.time, {formatLength:this.formatLength, timePattern:this.displayFormat, selector:'timeOnly', locale:this.lang}); }
conditional_block
0004_auto_20170307_0605.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-07 06:05 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ ('news', '0003_auto_20170228_2249'), ] operations = [ migrations.CreateModel( name='Location', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
Migration
identifier_name
0004_auto_20170307_0605.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-07 06:05 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
name='prev_paper', field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='news.Newspaper'), ), migrations.AlterField( model_name='newspaper', name='date_ended', field=models.DateField(blank=True...
dependencies = [ ('news', '0003_auto_20170228_2249'), ] operations = [ migrations.CreateModel( name='Location', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('city', models.Cha...
identifier_body
0004_auto_20170307_0605.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-07 06:05
class Migration(migrations.Migration): dependencies = [ ('news', '0003_auto_20170228_2249'), ] operations = [ migrations.CreateModel( name='Location', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_nam...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion
random_line_split
kana_table_test.py
#!/usr/bin/env python3 # coding: utf-8 romaji = [] hiragana = [] katakana = [] def num_permuts(N): """Permutation of 0 -- 46 """ from random import shuffle as shf from random import seed seed() a = [i for i in range(N)] shf(a) return a[:] def main(ts): import time # ---------...
elif ts == 4: nums = num_permuts(46 * 3) l_test = romaji + hiragana + katakana else: print(' Wrong testing style!') exit() # Begin testing, log time spent on memory test ----------------------------- t0 = time.time() t1 = t0 t_log = {} # time...
nums = num_permuts(46) l_test = hiragana
conditional_block
kana_table_test.py
#!/usr/bin/env python3 # coding: utf-8 romaji = [] hiragana = [] katakana = [] def num_permuts(N): """Permutation of 0 -- 46 """ from random import shuffle as shf from random import seed seed() a = [i for i in range(N)] shf(a) return a[:] def main(ts): import time # ---------...
if __name__ == '__main__': hint_str = ''' ======================== 日语假名记忆测试: 请选择测试类型: 1. 看罗马字回忆假名 2. 看片假名回忆读音 3. 看平假名回忆读音 4. 混乱回忆 ... ''' try: test_style = int(input(hint_str)) except: print(' Please choose from the list! ') exit() while test_sty...
random_line_split
kana_table_test.py
#!/usr/bin/env python3 # coding: utf-8 romaji = [] hiragana = [] katakana = [] def num_permuts(N):
def main(ts): import time # -------------------- read in kana data -------------------- with open("share/kana_list.dat", 'r') as fin: for lines in fin: words = lines.split() if lines.startswith('#') or len(words) <= 1: continue if not words[1].i...
"""Permutation of 0 -- 46 """ from random import shuffle as shf from random import seed seed() a = [i for i in range(N)] shf(a) return a[:]
identifier_body
kana_table_test.py
#!/usr/bin/env python3 # coding: utf-8 romaji = [] hiragana = [] katakana = [] def num_permuts(N): """Permutation of 0 -- 46 """ from random import shuffle as shf from random import seed seed() a = [i for i in range(N)] shf(a) return a[:] def
(ts): import time # -------------------- read in kana data -------------------- with open("share/kana_list.dat", 'r') as fin: for lines in fin: words = lines.split() if lines.startswith('#') or len(words) <= 1: continue if not words[1].isdigit(): ...
main
identifier_name
addressconf.py
"bluffs":"blfs", "bot":"btm", "bottm":"btm", "bottom":"btm", "boul":"blvd", "boulevard":"blvd", "boulv":"blvd", "branch":"br", "brdge":"brg", "bridge":"brg", "brnch":"br", "brook":"brk", "brooks":"brks", "burg":"bg", "burgs":"bgs", "bypa":"byp", "bypas":"byp", "bypass":"byp", "byps...
STREET_TYPES = { "allee":"aly", "alley":"aly", "ally":"aly", "anex":"anx", "annex":"anx", "annx":"anx", "arcade":"arc", "av":"ave", "aven":"ave", "avenu":"ave", "avenue":"ave", "avn":"ave", "avnue":"ave", "bayoo":"byu", "bayou":"byu", "beach":"bch", "bend":"bnd", "bluf":"blf", "blu...
identifier_body
addressconf.py
(object): DIRECTIONAL = { "north":"N", "northeast":"NE", "east":"E", "southeast":"SE", "south":"S", "southwest":"SW", "west":"W", "northwest":"NW"} DIRECTIONAL_CODES = dict((v,k) for k,v in DIRECTIONAL.iteritems()) class Streets(object): STREET_TYPES = { "allee":"aly", "alley":"aly", "ally":"a...
Directions
identifier_name
addressconf.py
crsnt":"cres", "crssing":"xing", "crssng":"xing", "crt":"ct", "curve":"curv", "dale":"dl", "dam":"dm", "div":"dv", "divide":"dv", "driv":"dr", "drive":"dr", "drives":"drs", "drv":"dr", "dvd":"dv", "estate":"est", "estates":"ests", "exp":"expy", "expr":"expy", "express":"expy", "exp...
"extension":"ext", "extensions":"exts", "extn":"ext", "extnsn":"ext", "falls":"fls", "ferry":"fry", "field":"fld", "fields":"flds", "flat":"flt", "flats":"flts", "ford":"frd", "fords":"frds", "forest":"frst", "forests":"frst", "forg":"frg", "forge":"frg", "forges":"frgs", "fork":"frk...
random_line_split
fetch.rs
copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::ResponseBinding:...
/// Obtain an IpcReceiver to send over to Fetch, and initialize /// the internal sender pub fn initialize(&mut self) -> ipc::IpcReceiver<()> { // cancel previous fetch self.cancel(); let (rx, tx) = ipc::channel().unwrap(); self.cancel_chan = Some(rx); tx } ...
{ Default::default() }
identifier_body
fetch.rs
copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::ResponseBinding:...
(&mut self) { self.cancel() } } fn from_referrer_to_referrer_url(request: &NetTraitsRequest) -> Option<ServoUrl> { request.referrer.to_url().map(|url| url.clone()) } fn request_init_from_request(request: NetTraitsRequest) -> NetTraitsRequestInit { NetTraitsRequestInit { method: request.met...
drop
identifier_name
fetch.rs
copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::ResponseBinding:...
// Step 5 let (action_sender, action_receiver) = ipc::channel().unwrap(); let fetch_context = Arc::new(Mutex::new(FetchContext { fetch_promise: Some(TrustedPromise::new(promise.clone())), response_object: Trusted::new(&*response), body: vec![], })); let listener = NetworkLis...
// Step 4 response.Headers().set_guard(Guard::Immutable);
random_line_split
fetch.rs
copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInfo; use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestInit; use crate::dom::bindings::codegen::Bindings::ResponseBinding:...
, // Step 4.2 Ok(metadata) => match metadata { FetchMetadata::Unfiltered(m) => { fill_headers_with_metadata(self.response_object.root(), m); self.response_object .root() .set_type(DOMResponseT...
{ promise.reject_error(Error::Type("Network error occurred".to_string())); self.fetch_promise = Some(TrustedPromise::new(promise)); self.response_object.root().set_type(DOMResponseType::Error); return; }
conditional_block
asap.js
/** PURE_IMPORTS_START ._AsapAction,._AsapScheduler PURE_IMPORTS_END */ import { AsapAction } from './AsapAction'; import { AsapScheduler } from './AsapScheduler'; /** * * Asap Scheduler * * <span class="informal">Perform task as fast as it can be performed asynchronously</span> * * `asap` scheduler behaves the s...
* `asap` scheduler will do its best to minimize time between end of currently executing code * and start of scheduled task. This makes it best candidate for performing so called "deferring". * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves * some (although mini...
*
random_line_split
selfkeyword.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Function: 【整理】Python中:self和init__的含义 + 为何要有self和__init__ http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them Author: Crifan Verison: 2012-11-27 -...
name print 'name within class Person is actually the global name: %s'%(name); #-> whole global name print "only access Person's name via Person.name=%s"%(Person.name); # -> class global name #def __init__(self): def selfAndInitDemo(): persionInstance = Person("crifan"); persio...
-> class global
identifier_name
selfkeyword.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Function: 【整理】Python中:self和init__的含义 + 为何要有self和__init__ http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them Author: Crifan Verison: 2012-11-27 -...
conditional_block
selfkeyword.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Function: 【整理】Python中:self和init__的含义 + 为何要有self和__init__ http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them Author: Crifan Verison: 2012-11-27 -...
name = "class global name" def __init__(self, newPersionName): #self.name = newPersionName; #此处,没有使用self.name #而使得此处的name,实际上仍是局部变量name #虽然此处赋值了,但是后面没有被利用到,属于被浪费了的局部变量name self.name = newPersionName; def sayYourName(self): #此处,之所以没有像之前一样出现: ...
class Person:
random_line_split
selfkeyword.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Function: 【整理】Python中:self和init__的含义 + 为何要有self和__init__ http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them Author: Crifan Verison: 2012-11-27 -...
码的 #对应的,此处的self.name,实际上是Person.name print 'My name is %s'%(self.name); # -> class global name print 'name within class Person is actually the global name: %s'%(name); #-> whole global name print "only access Person's name via Person.name=%s"%(Person.name); # -> class global name ...
rson,有对应的name变量,所以也是可以正常执行代
identifier_body
knock-rgb-led-smd.py
import RPi.GPIO as GPIO KnockPin = 11 LedPin = 12 Led_status = 1 def setup(): GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(...
(): GPIO.output(LedPin, GPIO.LOW) # led off GPIO.cleanup() # Release resource if __name__ == '__main__': # Program start from here setup() try: loop() except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be executed. destroy()
destroy
identifier_name
knock-rgb-led-smd.py
import RPi.GPIO as GPIO KnockPin = 11 LedPin = 12 Led_status = 1 def setup(): GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(...
pass # Don't do anything def destroy(): GPIO.output(LedPin, GPIO.LOW) # led off GPIO.cleanup() # Release resource if __name__ == '__main__': # Program start from here setup() try: loop() except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be ...
def loop(): GPIO.add_event_detect(KnockPin, GPIO.FALLING, callback=swLed, bouncetime=200) # wait for falling while True:
random_line_split
knock-rgb-led-smd.py
import RPi.GPIO as GPIO KnockPin = 11 LedPin = 12 Led_status = 1 def setup():
def swLed(ev=None): global Led_status Led_status = not Led_status GPIO.output(LedPin, Led_status) # switch led status(on-->off; off-->on) print "LED: " + ("on" if Led_status else "off") def loop(): GPIO.add_event_detect(KnockPin, GPIO.FALLING, callback=swLed, bouncetime=200) # wait for falling while Tr...
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(+3.3V) to off led
identifier_body
knock-rgb-led-smd.py
import RPi.GPIO as GPIO KnockPin = 11 LedPin = 12 Led_status = 1 def setup(): GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(...
def destroy(): GPIO.output(LedPin, GPIO.LOW) # led off GPIO.cleanup() # Release resource if __name__ == '__main__': # Program start from here setup() try: loop() except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be executed. destroy()
pass # Don't do anything
conditional_block
details_window.rs
// Copyright 2015 Virgil Dupras // // This software is licensed under the "GPLv3" License as described in the "LICENSE" file, // which should be included with this package. The terms are also available at // http://www.gnu.org/licenses/gpl-3.0.html // use rustty::{CellAccessor, Cell, HasSize}; use rustty::ui::{Painter...
{ window: Widget, } impl DetailsWindow { pub fn new(parent: &HasSize) -> DetailsWindow { let mut window = Widget::new(16, 7); window.align(parent, HorizontalAlign::Right, VerticalAlign::Bottom, 0); DetailsWindow { window: window } } pub fn draw_into(&self, cells: &mut CellAcce...
DetailsWindow
identifier_name
details_window.rs
// Copyright 2015 Virgil Dupras // // This software is licensed under the "GPLv3" License as described in the "LICENSE" file, // which should be included with this package. The terms are also available at // http://www.gnu.org/licenses/gpl-3.0.html // use rustty::{CellAccessor, Cell, HasSize}; use rustty::ui::{Painter...
pub fn draw_into(&self, cells: &mut CellAccessor) { self.window.draw_into(cells); } pub fn update(&mut self, selected_pos: Option<Pos>, map: &LiveMap, turn: u16, movemode: &str) { let turn_line = format!("Turn {}", turn); let (terrain_name, maybe_unit_id) = match selected_pos { ...
{ let mut window = Widget::new(16, 7); window.align(parent, HorizontalAlign::Right, VerticalAlign::Bottom, 0); DetailsWindow { window: window } }
identifier_body
details_window.rs
// Copyright 2015 Virgil Dupras // // This software is licensed under the "GPLv3" License as described in the "LICENSE" file, // which should be included with this package. The terms are also available at // http://www.gnu.org/licenses/gpl-3.0.html // use rustty::{CellAccessor, Cell, HasSize}; use rustty::ui::{Painter...
("", "".to_owned()) }; let lines = [unit_name, &unit_stats[..], &terrain_name[..], &turn_line[..], movemode]; self.window.clear(Cell::default()); for (index, line) in lines.iter().enumerate() { self.window.printline(2, index + 1, line); } self.wind...
(unit.name(), format!("MV {} / HP {}", unit.movements(), unit.hp())) } else {
random_line_split
conf.py
# -*- coding: utf-8 -*- # # testgdt documentation build configuration file, created by # sphinx-quickstart on Sun Feb 12 17:11:03 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
# The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #to...
version = '0.1' # The full version, including alpha/beta/rc tags. release = '0.1'
random_line_split
TestClient.py
#-*- encoding:UTF-8 -*- __author__ = 'gzs2478' from netstream import * import json import time if __name__ == '__main__':
print "Get:",data except BaseException, e: print e client.close()
try: client = netstream(8) client.connect('127.0.0.1',12345) if client.state != NET_STATE_ESTABLISHED: print "connect failed!" print "First Status :",client.status() command = {} command['sid'] = 0 command['cid'] = 1 command['time'] = time....
conditional_block
TestClient.py
#-*- encoding:UTF-8 -*- __author__ = 'gzs2478' from netstream import * import json import time if __name__ == '__main__': try: client = netstream(8) client.connect('127.0.0.1',12345) if client.state != NET_STATE_ESTABLISHED: print "connect failed!" print "First Statu...
client.close()
random_line_split
011_Container_With_Most_Water.py
#!/usr/bin/env python class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while hei...
return maxArea sol = Solution() height_list = [ [1,8,6,2,5,4,8,3,7], [1,2], [1,2,4,3], [2,3,4,5,18,17,6], ] for height in height_list: print(sol.maxArea(height))
maxArea = area
conditional_block
011_Container_With_Most_Water.py
#!/usr/bin/env python class
: def maxArea(self, height): """ :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while height[i] <= l: i +=...
Solution
identifier_name
011_Container_With_Most_Water.py
class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while height[i] <= l: ...
#!/usr/bin/env python
random_line_split
011_Container_With_Most_Water.py
#!/usr/bin/env python class Solution: def maxArea(self, height):
maxArea = area return maxArea sol = Solution() height_list = [ [1,8,6,2,5,4,8,3,7], [1,2], [1,2,4,3], [2,3,4,5,18,17,6], ] for height in height_list: print(sol.maxArea(height))
""" :type height: List[int] :rtype: int """ i, j = 0, len(height)-1 l, r = height[i], height[j] maxArea = (j - i) * min(l, r) while j > i: if l < r: while height[i] <= l: i += 1 elif r < l: ...
identifier_body
column.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="columns" sub_properties="column-c...
} </%helpers:shorthand>
{ self.column_rule_width.to_css(dest)?; dest.write_str(" ")?; self.column_rule_style.to_css(dest)?; dest.write_str(" ")?; self.column_rule_color.to_css(dest) }
identifier_body
column.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="columns" sub_properties="column-c...
<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Longhands, ParseError<'i>> { % for name in "width style color".split(): let mut column_rule_${name} = None; % endfor let mut any = false; loop { % for name in "widt...
parse_value
identifier_name
column.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="columns" sub_properties="column-c...
// Leave the options to None, 'auto' is the initial value. autos += 1; continue } if column_count.is_none() { if let Ok(value) = input.try(|input| column_count::parse(context, input)) { column_count = Some(value...
loop { if input.try(|input| input.expect_ident_matching("auto")).is_ok() {
random_line_split
column.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="columns" sub_properties="column-c...
} impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { try!(self.column_width.to_css(dest)); try!(write!(dest, " ")); self.column_count.to_css(dest) } } </%helpers:shorthand> <%helpers:sh...
{ Ok(expanded! { column_count: unwrap_or_initial!(column_count), column_width: unwrap_or_initial!(column_width), }) }
conditional_block
NSMachPort.py
""" LLDB AppKit formatters part of The LLVM Compiler Infrastructure This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details. """ # example summary provider for NSMachPort # the real summary is now C++ code built into LLDB import lldb import ctypes import lldb.runtime....
(self): pass def __init__(self, valobj, params): logger = lldb.formatters.Logger.Logger() self.valobj = valobj; self.sys_params = params self.update(); def update(self): logger = lldb.formatters.Logger.Logger() self.adjust_for_architecture(); def port(self): logger = lldb.formatters.Logger.Logger(...
adjust_for_architecture
identifier_name
NSMachPort.py
""" LLDB AppKit formatters part of The LLVM Compiler Infrastructure This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details. """ # example summary provider for NSMachPort # the real summary is now C++ code built into LLDB import lldb import ctypes import lldb.runtime....
# one pointer is the ISA # then we have one other internal pointer, plus # 4 bytes worth of flags. hence, these values def offset(self): logger = lldb.formatters.Logger.Logger() if self.sys_params.is_64_bit: return 20 else: return 12 def port(self): logger = lldb.formatters.Logger.Logger() vport...
logger = lldb.formatters.Logger.Logger() self.adjust_for_architecture();
identifier_body
NSMachPort.py
""" LLDB AppKit formatters part of The LLVM Compiler Infrastructure This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details. """ # example summary provider for NSMachPort # the real summary is now C++ code built into LLDB import lldb import ctypes import lldb.runtime....
return 20 else: return 12 def port(self): logger = lldb.formatters.Logger.Logger() vport = self.valobj.CreateChildAtOffset("port", self.offset(), self.sys_params.types_cache.NSUInteger) return vport.GetValueAsUnsigned(0) class NSMachPortUnknown_SummaryProvider: def adjust_for_architectu...
def offset(self): logger = lldb.formatters.Logger.Logger() if self.sys_params.is_64_bit:
random_line_split
NSMachPort.py
""" LLDB AppKit formatters part of The LLVM Compiler Infrastructure This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details. """ # example summary provider for NSMachPort # the real summary is now C++ code built into LLDB import lldb import ctypes import lldb.runtime....
try: summary = provider.port(); except: summary = None logger >> "got summary " + str(summary) if summary == None: summary = '<variable is not NSMachPort>' if isinstance(summary, basestring): return summay return 'mach port: ' + str(summary) return 'Summary Unavailable' def __lldb_init_module...
return provider.message()
conditional_block
simple.cost.import.setup.ts
import {Component, OnInit, ElementRef,} from '@angular/core'; import {FileSelect} from './file.select'; import {NgIf} from '@angular/common'; import {NgForm} from '@angular/common'; import {CostImport, CostImportService} from '../../../services/cost-import-service'; import {FourcastService} from '../../../services/f...
break; case event.target[1].selected: this.model.isPayrollWeekly = true; break; case event.target[2].selected: this.model.isPayrollMonthly = true; break; } } testUpdate(){ let url:string = "http://127.0.0.1:8081/processImport"; let xhr=new XMLHttpRequest(); let form...
this.model.isSupplierInvoices = true;
random_line_split
simple.cost.import.setup.ts
import {Component, OnInit, ElementRef,} from '@angular/core'; import {FileSelect} from './file.select'; import {NgIf} from '@angular/common'; import {NgForm} from '@angular/common'; import {CostImport, CostImportService} from '../../../services/cost-import-service'; import {FourcastService} from '../../../services/f...
onFileSelected(event){ console.log('File selected', event); this._file = event['file']; this.isFileSelected = true this.model.importFileName = this._file.name; //console.log('File selected 2: ', this.model.importFileName) } updateCostImport(fileId:string){ console.log('FileId (update): ', fileId) this....
{ this.model.division = '' }
identifier_body
simple.cost.import.setup.ts
import {Component, OnInit, ElementRef,} from '@angular/core'; import {FileSelect} from './file.select'; import {NgIf} from '@angular/common'; import {NgForm} from '@angular/common'; import {CostImport, CostImportService} from '../../../services/cost-import-service'; import {FourcastService} from '../../../services/f...
(fileId:string){ console.log('FileId (update): ', fileId) this.importService.updateCostImportHdr(this.model, fileId) .subscribe((res) =>{ var temp = JSON.stringify(res); console.log("Update cost import header result: ",res); this.importId = res['id']; this.isUploaded = true; //console.log('Fil...
updateCostImport
identifier_name
mod.rs
//! Various code related to computing outlives relations. pub mod env; pub mod obligations; pub mod verify; use rustc_middle::traits::query::OutlivesBound; use rustc_middle::ty;
param_env: ty::ParamEnv<'tcx>, ) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx { debug!("explicit_outlives_bounds()"); param_env .caller_bounds() .into_iter() .map(ty::Predicate::kind) .filter_map(ty::Binder::no_bound_vars) .filter_map(move |kind| match kind { ...
pub fn explicit_outlives_bounds<'tcx>(
random_line_split
mod.rs
//! Various code related to computing outlives relations. pub mod env; pub mod obligations; pub mod verify; use rustc_middle::traits::query::OutlivesBound; use rustc_middle::ty; pub fn explicit_outlives_bounds<'tcx>( param_env: ty::ParamEnv<'tcx>, ) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx
Some(OutlivesBound::RegionSubRegion(r_b, r_a)) } }) }
{ debug!("explicit_outlives_bounds()"); param_env .caller_bounds() .into_iter() .map(ty::Predicate::kind) .filter_map(ty::Binder::no_bound_vars) .filter_map(move |kind| match kind { ty::PredicateKind::Projection(..) | ty::PredicateKind::Trait(..) ...
identifier_body
mod.rs
//! Various code related to computing outlives relations. pub mod env; pub mod obligations; pub mod verify; use rustc_middle::traits::query::OutlivesBound; use rustc_middle::ty; pub fn
<'tcx>( param_env: ty::ParamEnv<'tcx>, ) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx { debug!("explicit_outlives_bounds()"); param_env .caller_bounds() .into_iter() .map(ty::Predicate::kind) .filter_map(ty::Binder::no_bound_vars) .filter_map(move |kind| match ...
explicit_outlives_bounds
identifier_name
brokerlib.py
ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import w...
def remove_consumer(self, link): assert link.is_sender try: self.consumers.remove(link) except ValueError: return self.broker.info("Removed consumer for {0} from {1}", link.connection, self) def store_message(self, delivery, message): self.messa...
self.broker.info("Added consumer for {0} to {1}", link.connection, self)
random_line_split
brokerlib.py
ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import w...
def remove_consumer(self, link): assert link.is_sender try: self.consumers.remove(link) except ValueError: return self.broker.info("Removed consumer for {0} from {1}", link.connection, self) def store_message(self, delivery, message): self.mes...
assert link.is_sender assert link not in self.consumers self.consumers.append(link) self.broker.info("Added consumer for {0} to {1}", link.connection, self)
identifier_body
brokerlib.py
ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import w...
(_handlers.MessagingHandler): def __init__(self, broker): super(_Handler, self).__init__() self.broker = broker self.queues = dict() self.verbose = False def on_start(self, event): interface = "{0}://{1}:{2}".format(self.broker.scheme, self.broker.host, self.broker.port...
_Handler
identifier_name
brokerlib.py
ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import w...
else: address = event.link.remote_source.address assert address is not None event.link.source.address = address queue = self.get_queue(address) queue.add_consumer(event.link) if event.link.is_receiver: address = event.l...
address = "{0}/{1}".format(event.connection.remote_container, event.link.name)
conditional_block
fuzzytestcase.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from collections import Mapping import unittes...
(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) self.default_places=15 def set_default_places(self, places): """ WHEN COMPARING float, HOW MANY DIGITS ARE SIGNIFICANT BY DEFAULT """ self.default_places=places def assertAlmostEqual(sel...
__init__
identifier_name
fuzzytestcase.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from collections import Mapping import unittes...
else: yield output[1] def assertAlmostEqual(test, expected, digits=None, places=None, msg=None, delta=None): show_detail=True try: if test==None and expected==None: return elif isinstance(expected, Mapping): for k, v2 in expected.items(): ...
while True: output = zip(*(_next(a) for a in iters)) if all(output[0]): return
random_line_split
fuzzytestcase.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from collections import Mapping import unittes...
assertAlmostEqual(v1, v2, msg=msg, digits=digits, places=places, delta=delta) elif isinstance(test, set) and isinstance(expected, set): if test != expected: Log.error("Sets do not match") elif hasattr(test, "__iter__") and hasattr(expected, "__iter__"): ...
show_deta=False v1 = test[k]
conditional_block
fuzzytestcase.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from collections import Mapping import unittes...
while True: output = zip(*(_next(a) for a in iters)) if all(output[0]): return else: yield output[1] def assertAlmostEqual(test, expected, digits=None, places=None, msg=None, delta=None): show_detail=True try: if test==None and expected==None: ...
try: return False, _iter.next() except: return True, None
identifier_body