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
sortmerna.py
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
"pigz -p {thrds} -c {smr_nr_op}.fastq > {smr_nr_op_gz};" ) arguments = {'thrds': threads, 'ref_db': RNA_REF_DB, 'params': param_string} for run_prefix, sample, f_fp, r_fp in samples: prefix_path = join(out_dir, run_prefix) for index, fp in enum...
"--fastx {params} && " "pigz -p {thrds} -c {smr_r_op}.fastq > {smr_r_op_gz} && "
random_line_split
sortmerna.py
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
(qclient, job_id, parameters, out_dir): """Run Sortmerna with the given parameters Parameters ---------- qclient : tgp.qiita_client.QiitaClient The Qiita server client job_id : str The job id parameters : dict The parameter values out_dir : str The path to th...
sortmerna
identifier_name
counter.reducer.spec.ts
import { counterReducer } from './counter.reducer'; import {CounterActions} from "../../actions/counterActions/counter.actions"; import { ICounter } from './counter.types'; import { INITIAL_STATE } from './counter.initial-state' describe('counter reducer', () => { let initState: ICounter; beforeEach(() => { ...
expect(nextState.counter).toEqual(previousValue - 1); }); });
const previousValue = initState.counter; const nextState = counterReducer( initState, { type: CounterActions.DECREMENT_COUNTER });
random_line_split
mergeSort.py
''' Python program for implementation of Merge Sort l is left index, m is middle index and r is right index L[l...m] and R[m+1.....r] are respective left and right sub-arrays ''' def merge(arr, l, m, r): n1 = m - l + 1 n2 = r-m #create temporary arrays L = [0]*(n1) R = [0]*(n2) #Copy data to temp arrays L[...
(arr, l, r): if l < r: #Same as (l+r)/2, but avoid overflow for large l and h m = (l+(r-1))/2 # Sort first and second halves mergeSort(arr, l, m) mergeSort(arr, m+1, r) merge(arr, l, m, r)
mergeSort
identifier_name
mergeSort.py
''' Python program for implementation of Merge Sort l is left index, m is middle index and r is right index L[l...m] and R[m+1.....r] are respective left and right sub-arrays ''' def merge(arr, l, m, r): n1 = m - l + 1 n2 = r-m #create temporary arrays L = [0]*(n1) R = [0]*(n2) #Copy data to temp arrays L[...
# Merge the temp array back into arr[l...r] i = 0 # Initial index of first subarray j = 0 # Initial index of second subarray k = l # Initial index of merged subarray #Comparing the elements of the array and filling them into one array while i < n1 and j < n2 : if L[i] <= R[j] : arr[k] = L[i] i +=...
R[j] = arr[m+1+j]
conditional_block
mergeSort.py
''' Python program for implementation of Merge Sort l is left index, m is middle index and r is right index L[l...m] and R[m+1.....r] are respective left and right sub-arrays ''' def merge(arr, l, m, r):
#create temporary arrays L = [0]*(n1) R = [0]*(n2) #Copy data to temp arrays L[] and R[] for i in range(0, n1): L[i] = arr[l + i] for j in range(0, n2): R[j] = arr[m+1+j] # Merge the temp array back into arr[l...r] i = 0 # Initial index of first subarray j = 0 # Initial index of second subarray ...
n1 = m - l + 1 n2 = r-m
identifier_body
mergeSort.py
''' Python program for implementation of Merge Sort l is left index, m is middle index and r is right index L[l...m] and R[m+1.....r] are respective left and right sub-arrays ''' def merge(arr, l, m, r): n1 = m - l + 1 n2 = r-m #create temporary arrays L = [0]*(n1) R = [0]*(n2) #Copy data to temp arrays L[...
i += 1 else: arr[k] = R[j] j += 1 k += 1 # Copy the remaining element of L[], if there are any while i < n1: arr[k] = L[i] i += 1 k += 1 # Copy the remaining element of R[], if there are any while j < n2: arr[k] R[j] j += 1 k += 1 # l is for left index and r is for right index of the...
#Comparing the elements of the array and filling them into one array while i < n1 and j < n2 : if L[i] <= R[j] : arr[k] = L[i]
random_line_split
latex.js
/* @flow */ import React from "react"; import { typesetMath } from "mathjax-electron"; type Props = { children?: React$Node }; function
(): boolean { const MathJax: global = window ? window.MathJax : null; return ( !window.disableMathJax && typeof MathJax !== "undefined" && window.MathJax && window.MathJax.Hub.Queue ); } export default class LatexRenderer extends React.Component<Props> { rendered: ?HTMLElement; componentDidM...
isMathJaxOkYet
identifier_name
latex.js
/* @flow */ import React from "react"; import { typesetMath } from "mathjax-electron"; type Props = { children?: React$Node }; function isMathJaxOkYet(): boolean { const MathJax: global = window ? window.MathJax : null; return ( !window.disableMathJax && typeof MathJax !== "undefined" && window.Math...
); } }
random_line_split
latex.js
/* @flow */ import React from "react"; import { typesetMath } from "mathjax-electron"; type Props = { children?: React$Node }; function isMathJaxOkYet(): boolean
export default class LatexRenderer extends React.Component<Props> { rendered: ?HTMLElement; componentDidMount(): void { if (window && isMathJaxOkYet()) typesetMath(this.rendered); } componentDidUpdate(): void { if (isMathJaxOkYet()) typesetMath(this.rendered); } render(): ?React$Element<any> { ...
{ const MathJax: global = window ? window.MathJax : null; return ( !window.disableMathJax && typeof MathJax !== "undefined" && window.MathJax && window.MathJax.Hub.Queue ); }
identifier_body
runtime.rs
) } Err(e) => match e { DnsError::Status(RCode::NXDomain) => { Err(ResolveError::from(ResolveErrorKind::NoRecordsFound { query: q, valid_until: None, })) } _ => Err(ResolveError::from(ResolveErrorKind::Msg(format!( "error resolvin...
let mname = parts .next() .and_then(|n| n.parse::<Name>().ok()) .ok_or("invalid mname")?; let rname = parts .next() .and_then(|n| n.parse::<Name>().ok()) .ok_or("invalid rname")?; let serial = parts .next() .and_then(|n| n.parse::<u32>()....
{ let parse_error = |e| format!("error parsing: {}", e); let rdata = |data: &str, rtype: RecordType| match rtype { RecordType::A => Ok(RData::A(data.parse().map_err(parse_error)?)), RecordType::AAAA => Ok(RData::AAAA(data.parse().map_err(parse_error)?)), RecordType::CNAME => Ok(RData::CNAME(DomainName::...
identifier_body
runtime.rs
name).await, RecordType::SSHFP => resolver.resolve_sshfp(&name).await, // TODO: dnssec types // RecordType::DNSSEC(rtype) => match rtype { // } RecordType::Unknown(rtype) => { if rtype == 65 { // Reduce error log spam for this known issue on iOS 14. debug!("HTTPS record type no...
// } #[cfg(test)]
random_line_split
runtime.rs
() .and_then(|n| n.parse::<Name>().ok()) .ok_or("invalid target")?; Ok(RData::SRV(srv::SRV::new(priority, weight, port, target))) } // RecordType::TLSA => rr.set_rdata(RData::TLSA(r.data.parse().unwrap())), // RecordType::CAA => rr.set_rdata(RData::CAA(r.data.parse().unwrap())), /...
test_txt
identifier_name
attachment.js
/** * The Attachment module * an Attachment class inheriting from KeyValue * @module attachment * @copyright CHECKROOM NV 2015 */ define(['jquery', 'common/attachment'], /** Attachment */ function ($, attachmentHelper) { var PREVIEWS = ['jpg', 'jpeg', 'png', 'gif', 'pdf']; var DEFAULTS = { fileNam...
}; /** * _toJson, makes a dict of the object * @method * @param options * @returns {object} * @private */ Attachment.prototype._toJson = function(options) { return { fileName: this.fileName, fileSize: this.fileSize, value: this.value...
random_line_split
__main__.py
_logger(self) -> None: try: log_path = self.get_app_config_path() except AttributeError: if sys.platform == 'win32': log_path = os.path.join(QDir.homePath(), 'AppData', 'Local', qApp.applicationName().lower()) elif sys.platform == 'darwin': ...
vent.accept() try: if not self.isEnabled(): exitwarn = VCMessageBox('Warning', 'Media is currently being processed', 'Are you sure you want to exit now?', parent=self) exitwarn.addButton('Yes', QMessageBox.NoRole) ...
identifier_body
__main__.py
= 666 TEMP_PROJECT_FILE = 'vidcutter_reboot.vcp' WORKING_FOLDER = os.path.join(QDir.tempPath(), 'vidcutter') def __init__(self): super(MainWindow, self).__init__() self.video, self.resizeTimer = '', 0 self.parse_cmdline() self.init_settings() self.init_logger() ...
self) -> None: self.parser = QCommandLineParser() self.parser.setApplicationDescription('\nVidCutter - the simplest + fastest media cutter & joiner') self.parser.addPositionalArgument('video', 'Preload video file', '[video]') self.parser.addPositionalArgument('project', 'Open VidCutter p...
arse_cmdline(
identifier_name
__main__.py
= 666 TEMP_PROJECT_FILE = 'vidcutter_reboot.vcp' WORKING_FOLDER = os.path.join(QDir.tempPath(), 'vidcutter') def __init__(self): super(MainWindow, self).__init__() self.video, self.resizeTimer = '', 0 self.parse_cmdline() self.init_settings() self.init_logger() ...
else: self.cutter.loadMedia(filename) except (FileNotFoundError, PermissionError): QMessageBox.critical(self, 'Error loading file', sys.exc_info()[0]) logging.exception('Error loading file') qApp.restoreOverrideCursor() self.restart() ...
s.remove(os.path.join(QDir.tempPath(), MainWindow.TEMP_PROJECT_FILE))
conditional_block
__main__.py
', qApp.applicationName().lower()) else: settings_path = os.path.join(QDir.homePath(), '.config', qApp.applicationName().lower()) os.makedirs(settings_path, exist_ok=True) settings_file = '{}.ini'.format(qApp.applicationName().lowe...
exit_code = app.exec_() if exit_code == MainWindow.EXIT_CODE_REBOOT:
random_line_split
jquery.app.js
/** * Themes: Velonic Admin theme * **/ ! function($) { "use strict"; /** Sidebar Module */ var SideBar = function() { this.$body = $("body"), this.$sideBar = $('aside.left-panel'), this.$navbarToggle = $(".navbar-toggle"), this.$navbarItem = $("aside.left-pane...
}); //adding nicescroll to sidebar if ($.isFunction($.fn.niceScroll)) { $("aside.left-panel:not(.collapsed)").niceScroll({ cursorcolor: '#8e909a', cursorborder: '0px solid #fff', cursoropacitymax: '0.5', cursorborderra...
{ $("aside.left-panel nav.navigation > ul > li > ul").slideUp(300); $("aside.left-panel nav.navigation > ul > li").removeClass('active'); if (!$(this).next().is(":visible")) { $(this).next().slideToggle(300, function () { $("asi...
conditional_block
jquery.app.js
/** * Themes: Velonic Admin theme * **/ ! function($) { "use strict"; /** Sidebar Module */ var SideBar = function() { this.$body = $("body"), this.$sideBar = $('aside.left-panel'), this.$navbarToggle = $(".navbar-toggle"), this.$navbarItem = $("aside.left-pane...
//initializing tooltip VelonicApp.prototype.initTooltipPlugin = function() { $.fn.tooltip && $('[data-toggle="tooltip"]').tooltip() }, //initializing popover VelonicApp.prototype.initPopoverPlugin = function() { $.fn.popover && $('[data-toggle="popover"]').popover() }, /...
};
random_line_split
twisted-proxy.py
#!/usr/bin/python from twisted.internet import reactor from twisted.web import http from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient from PIL import ImageFile from PIL.ImageFile import Parser from StringIO import StringIO class InterceptingProxyClient(ProxyClient): def __init__(se...
(self): if self.image_parser: image = self.image_parser.close() try: format = image.format image = image.rotate(180) s = StringIO() image.save(s, format) buffer = s.getvalue() except: ...
handleResponseEnd
identifier_name
twisted-proxy.py
#!/usr/bin/python from twisted.internet import reactor from twisted.web import http from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient from PIL import ImageFile from PIL.ImageFile import Parser from StringIO import StringIO class InterceptingProxyClient(ProxyClient): def __init__(se...
if self.image_parser: self.image_parser.feed(buffer) else: ProxyClient.handleResponsePart(self, buffer) def handleResponseEnd(self): if self.image_parser: image = self.image_parser.close() try: format = image.format ...
def handleResponsePart(self, buffer):
random_line_split
twisted-proxy.py
#!/usr/bin/python from twisted.internet import reactor from twisted.web import http from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient from PIL import ImageFile from PIL.ImageFile import Parser from StringIO import StringIO class InterceptingProxyClient(ProxyClient): def __init__(se...
ProxyClient.handleResponseEnd(self) class InterceptingProxyClientFactory(ProxyClientFactory): protocol = InterceptingProxyClient class InterceptingProxyRequest(ProxyRequest): protocols = {'http': InterceptingProxyClientFactory} class InterceptingProxy(Proxy): requestFactory = InterceptingProxyRe...
image = self.image_parser.close() try: format = image.format image = image.rotate(180) s = StringIO() image.save(s, format) buffer = s.getvalue() except: buffer = "" ProxyClient.handleHead...
conditional_block
twisted-proxy.py
#!/usr/bin/python from twisted.internet import reactor from twisted.web import http from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient from PIL import ImageFile from PIL.ImageFile import Parser from StringIO import StringIO class InterceptingProxyClient(ProxyClient): def __init__(se...
class InterceptingProxy(Proxy): requestFactory = InterceptingProxyRequest factory = http.HTTPFactory() factory.protocol = InterceptingProxy reactor.listenTCP(8000, factory) reactor.run()
protocols = {'http': InterceptingProxyClientFactory}
identifier_body
pickle.py
# (c) 2017, Brian Coca # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' cache: pickle short_descript...
def _dump(self, value, filepath): with open(filepath, 'wb') as f: # Use pickle protocol 2 which is compatible with Python 2.3+. pickle.dump(value, f, protocol=2)
return pickle.load(f)
conditional_block
pickle.py
# (c) 2017, Brian Coca # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' cache: pickle short_descript...
- key: fact_caching_connection section: defaults _prefix: description: User defined prefix to use when creating the files env: - name: ANSIBLE_CACHE_PLUGIN_PREFIX ini: - key: fact_caching_prefix section: defaults _timeout: ...
random_line_split
pickle.py
# (c) 2017, Brian Coca # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' cache: pickle short_descript...
with open(filepath, 'wb') as f: # Use pickle protocol 2 which is compatible with Python 2.3+. pickle.dump(value, f, protocol=2)
identifier_body
pickle.py
# (c) 2017, Brian Coca # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' cache: pickle short_descript...
(self, filepath): # Pickle is a binary format with open(filepath, 'rb') as f: if PY3: return pickle.load(f, encoding='bytes') else: return pickle.load(f) def _dump(self, value, filepath): with open(filepath, 'wb') as f: # U...
_load
identifier_name
settings.py
# Customize django settings: DEBUG = True INSTALLED_APPS = ( 'django_translate', 'example_basic.translate' ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django_translate.middleware.LocaleMiddleware', ) SEC...
# By default only "json" and "yml" loaders are enabled, # but we want to use "po" files in this example from python_translate import loaders TRANZ_LOADERS = { "po": loaders.PoFileLoader(), "yml": loaders.YamlFileLoader() } # All settings below are the default ones: import os BASE_DIR = os.path.dirname(os.p...
from python_translate.translations import DebugTranslator TRANZ_TRANSLATOR_CLASS = DebugTranslator
conditional_block
settings.py
# Customize django settings: DEBUG = True INSTALLED_APPS = ( 'django_translate', 'example_basic.translate' ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django_translate.middleware.LocaleMiddleware', ) SECR...
], }, }, ] WSGI_APPLICATION = 'example_basic.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Internati...
'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages',
random_line_split
platform_x86_64.rs
#[cfg(not(test))] use alloc::format; #[cfg(not(test))] use alloc::prelude::v1::*; #[cfg(test)] use std::prelude::v1::*; use crate::debugshell::{Command, DebugShell}; pub fn builtin_exit_qemu(_sh: &mut DebugShell, _: Vec<String>) -> String {
format!("asked qemu nicely to exit!\n") } pub fn builtin_vga_scrollback_data(_sh: &mut DebugShell, _: Vec<String>) -> String { use x86_64::instructions::interrupts::without_interrupts; without_interrupts(|| { use crate::platform::x86_64::vga::VGA_WRITER; let vga = VGA_WRITER.get(); ...
use crate::platform::x86_64::exit_qemu; unsafe { exit_qemu(); }
random_line_split
platform_x86_64.rs
#[cfg(not(test))] use alloc::format; #[cfg(not(test))] use alloc::prelude::v1::*; #[cfg(test)] use std::prelude::v1::*; use crate::debugshell::{Command, DebugShell}; pub fn builtin_exit_qemu(_sh: &mut DebugShell, _: Vec<String>) -> String { use crate::platform::x86_64::exit_qemu; unsafe { exit_qemu();...
}) } pub fn register_platform_builtins(sh: &mut DebugShell) { sh.commands.push(Command { name: String::from("vga-scrollback?"), func: builtin_vga_scrollback_data, }); sh.commands.push(Command { name: String::from("exit-qemu!"), func: builtin_exit_qemu, }); }
{ "vga scrollback is not enabled!\n".into() }
conditional_block
platform_x86_64.rs
#[cfg(not(test))] use alloc::format; #[cfg(not(test))] use alloc::prelude::v1::*; #[cfg(test)] use std::prelude::v1::*; use crate::debugshell::{Command, DebugShell}; pub fn builtin_exit_qemu(_sh: &mut DebugShell, _: Vec<String>) -> String
pub fn builtin_vga_scrollback_data(_sh: &mut DebugShell, _: Vec<String>) -> String { use x86_64::instructions::interrupts::without_interrupts; without_interrupts(|| { use crate::platform::x86_64::vga::VGA_WRITER; let vga = VGA_WRITER.get(); if let Some(ref sb) = vga.scrollback { ...
{ use crate::platform::x86_64::exit_qemu; unsafe { exit_qemu(); } format!("asked qemu nicely to exit!\n") }
identifier_body
platform_x86_64.rs
#[cfg(not(test))] use alloc::format; #[cfg(not(test))] use alloc::prelude::v1::*; #[cfg(test)] use std::prelude::v1::*; use crate::debugshell::{Command, DebugShell}; pub fn builtin_exit_qemu(_sh: &mut DebugShell, _: Vec<String>) -> String { use crate::platform::x86_64::exit_qemu; unsafe { exit_qemu();...
(sh: &mut DebugShell) { sh.commands.push(Command { name: String::from("vga-scrollback?"), func: builtin_vga_scrollback_data, }); sh.commands.push(Command { name: String::from("exit-qemu!"), func: builtin_exit_qemu, }); }
register_platform_builtins
identifier_name
one_time_server.rs
//! A very simple HTTP server which responds to only one connection with the plain text "Hello, World!". #![crate_name = "one_time_server"] #![allow(unstable)] extern crate time; extern crate http; use std::io::net::ip::{SocketAddr, Ipv4Addr}; use std::io::Writer; use http::server::{Config, Server, Request, Respons...
Ok(_) => println!("done serving"), Err(e) => println!("failed to serve: {}", e) } }
} } fn main() { match HelloWorldServer.serve_once(true, None) {
random_line_split
one_time_server.rs
//! A very simple HTTP server which responds to only one connection with the plain text "Hello, World!". #![crate_name = "one_time_server"] #![allow(unstable)] extern crate time; extern crate http; use std::io::net::ip::{SocketAddr, Ipv4Addr}; use std::io::Writer; use http::server::{Config, Server, Request, Respons...
fn handle_request(&self, _r: Request, w: &mut ResponseWriter) { w.headers.date = Some(time::now_utc()); w.headers.content_length = Some(14); w.headers.content_type = Some(MediaType { type_: String::from_str("text"), subtype: String::from_str("plain"), pa...
{ Config { bind_address: SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 8001 } } }
identifier_body
one_time_server.rs
//! A very simple HTTP server which responds to only one connection with the plain text "Hello, World!". #![crate_name = "one_time_server"] #![allow(unstable)] extern crate time; extern crate http; use std::io::net::ip::{SocketAddr, Ipv4Addr}; use std::io::Writer; use http::server::{Config, Server, Request, Respons...
() { match HelloWorldServer.serve_once(true, None) { Ok(_) => println!("done serving"), Err(e) => println!("failed to serve: {}", e) } }
main
identifier_name
server.rs
use rocket; use rocket::http::RawStr; use rocket::request::{FromParam, Request}; use rocket::response::{self, NamedFile, Redirect, Responder}; use scheduled_executor::ThreadPoolExecutor; use cache::Cache; use config::Config; use error::*; use live_consumer::{self, LiveConsumerStore}; use metadata::ClusterId; use utils...
pub struct CachedFile { ttl: usize, file: NamedFile, } impl CachedFile { pub fn from(file: NamedFile) -> CachedFile { CachedFile::with_ttl(1800, file) } pub fn with_ttl(ttl: usize, file: NamedFile) -> CachedFile { CachedFile { ttl, file } } } impl<'a> Responder<'a> for Cache...
{ let _ = version; // just ignore version NamedFile::open(Path::new("resources/web_server/public/").join(file)) .map(CachedFile::from) .ok() }
identifier_body
server.rs
use rocket; use rocket::http::RawStr; use rocket::request::{FromParam, Request}; use rocket::response::{self, NamedFile, Redirect, Responder}; use scheduled_executor::ThreadPoolExecutor; use cache::Cache; use config::Config; use error::*; use live_consumer::{self, LiveConsumerStore}; use metadata::ClusterId; use utils...
} pub fn run_server(executor: &ThreadPoolExecutor, cache: Cache, config: &Config) -> Result<()> { let version = option_env!("CARGO_PKG_VERSION").unwrap_or("?"); info!( "Starting kafka-view v{}, listening on {}:{}.", version, config.listen_host, config.listen_port ); let rocket_env = ro...
"Cache-Control", format!("max-age={}, must-revalidate", self.ttl), ) .ok() }
random_line_split
server.rs
use rocket; use rocket::http::RawStr; use rocket::request::{FromParam, Request}; use rocket::response::{self, NamedFile, Redirect, Responder}; use scheduled_executor::ThreadPoolExecutor; use cache::Cache; use config::Config; use error::*; use live_consumer::{self, LiveConsumerStore}; use metadata::ClusterId; use utils...
{ ttl: usize, file: NamedFile, } impl CachedFile { pub fn from(file: NamedFile) -> CachedFile { CachedFile::with_ttl(1800, file) } pub fn with_ttl(ttl: usize, file: NamedFile) -> CachedFile { CachedFile { ttl, file } } } impl<'a> Responder<'a> for CachedFile { fn respond_...
CachedFile
identifier_name
op-qws.ts
<!DOCTYPE TS><TS> <context> <name>SyncAuthentication</name> <message> <source>Sync Connection</source> <translation type="unfinished"></translation> </message> <message> <source>&lt;p&gt;An unauthorized system is requesting access to this device.&lt;p&gt;If you are using a versio...
</context> </TS>
random_line_split
data-chip.ts
/* * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
// the web component + stylesheet apis (sheet as any).replace(styles); (shadow as any).adoptedStyleSheets = [sheet]; //////////////////////////////////////////////////// this.span = span; this.shadow = shadow; this.contentEditable = String(false); } updateContent() { const items = t...
// These are not recognized by vscode but are part of
random_line_split
data-chip.ts
/* * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
highlight(highlight: boolean) { if (this._highlighted === highlight) return; this.style.background = highlight ? `var(--cd-primary-color)` : ''; this._highlighted = highlight; } /** Added to page */ connectedCallback() { this.updateContent(); } disconnectedCallback() {} attributeChang...
{ return this._highlighted; }
identifier_body
data-chip.ts
/* * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
() { const items = this.lookup.split(DATASET_DELIMITER); this.span.textContent = items?.[items.length - 1]; } static get observedAttributes() { return [DATA_CHIP_SOURCE_ATTR, DATA_CHIP_LOOKUP_ATTR]; } /** * Ask the web component what was clicked inside since this * is a closed shadow dom... ...
updateContent
identifier_name
pagers.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
(self) -> Iterator[compute.NotificationEndpointList]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response d...
pages
identifier_name
pagers.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
def __iter__(self) -> Iterator[compute.NotificationEndpoint]: for page in self.pages: yield from page.items def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response
conditional_block
pagers.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
def __iter__(self) -> Iterator[compute.NotificationEndpoint]: for page in self.pages: yield from page.items def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
random_line_split
pagers.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
identifier_body
state.models.ts
export interface TixError { code: string; message: string; } export interface TixState<TModel> { fetching: boolean; saving: boolean; current?: TModel; error?: TixError; } export function setFetching<TModel>(state: TixState<TModel>): TixState<TModel> { return { ...state, fetching: true, }; } e...
export function setState<TModel>(state: TixState<TModel>, model?: TModel): TixState<TModel> { return { ...state, error: undefined, fetching: false, saving: false, current: model, }; } export function setFailed<TModel>(state: TixState<TModel>, code: string, message?: string): TixState<TModel> ...
{ return { ...state, saving: true, }; }
identifier_body
state.models.ts
export interface TixError { code: string; message: string; } export interface TixState<TModel> { fetching: boolean; saving: boolean; current?: TModel; error?: TixError; } export function setFetching<TModel>(state: TixState<TModel>): TixState<TModel> { return { ...state, fetching: true, }; } e...
<TModel>(): TixState<TModel> { return { fetching: false, saving: false, }; }
initState
identifier_name
state.models.ts
export interface TixError { code: string; message: string; } export interface TixState<TModel> { fetching: boolean; saving: boolean; current?: TModel; error?: TixError; } export function setFetching<TModel>(state: TixState<TModel>): TixState<TModel> { return { ...state, fetching: true, }; } e...
fetching: false, saving: false, current: model, }; } export function setFailed<TModel>(state: TixState<TModel>, code: string, message?: string): TixState<TModel> { return { ...state, error: { code, message: message || code, }, fetching: false, saving: false, }; } expo...
error: undefined,
random_line_split
informationCircled.js
Object.defineProperty(exports, "__esModule", { value: true }); var informationCircled = exports.informationCircled = { "viewBox": "0 0 512 512", "children": [{ "name": "g", "attribs": {}, "children": [{ "name": "path", "attribs": { "d": "M480,253C478.3,129.3,376.7,30.4,253,32S30.4,135.3,32,259c1.7,123.7,103.3,222.6,2...
"use strict";
random_line_split
py-mi-objfile-gdb.py
# 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 later version. # # This program is distributed in the hope that it will be useful, # bu...
# Copyright (C) 2015-2016 Free Software Foundation, Inc.
random_line_split
country.service.ts
/** * Created by aaron on 27/05/17. */ import {Injectable} from "@angular/core"; import {Http, Response} from "@angular/http"; import {Observable, Subscription} from "rxjs"; import {map} from "rxjs/operators" import {SearchParamService} from "./searchParam.service"; import {Logger} from "./logger.service"; import {Se...
}
{ let body = res.json(); return body.data || body || {}; }
identifier_body
country.service.ts
/** * Created by aaron on 27/05/17. */ import {Injectable} from "@angular/core"; import {Http, Response} from "@angular/http"; import {Observable, Subscription} from "rxjs"; import {map} from "rxjs/operators" import {SearchParamService} from "./searchParam.service"; import {Logger} from "./logger.service";
@Injectable() export class CountryService { private countryUrl = 'api/country'; // URL to web API subscription: Subscription; constructor(private http: Http, private callsignService: SearchParamService, private logger: Logger) { this.subscription = this.callsignService.update$.subscribe( update => {...
import {SearchParams} from "../models/search-params"; // todo This service should really cache these results.
random_line_split
country.service.ts
/** * Created by aaron on 27/05/17. */ import {Injectable} from "@angular/core"; import {Http, Response} from "@angular/http"; import {Observable, Subscription} from "rxjs"; import {map} from "rxjs/operators" import {SearchParamService} from "./searchParam.service"; import {Logger} from "./logger.service"; import {Se...
(tx: string, rx: string): Observable<any[]> { this.logger.log("tx: " + tx + " rx: " + rx); return this.http.get(this.countryUrl + '/time/' + tx + '/' + rx).pipe(map(this.extractData)) } public getBandData(tx: string, rx: string): Observable<any[]> { this.logger.log("tx: " + tx + " rx: " + rx); retu...
getTimeData
identifier_name
ExtendedErrorBar.py
statsResults): # *** Check if there is sufficient data to generate the plot if len(statsResults.activeData) <= 0: self.emptyAxis() return features = statsResults.getColumn('Features') if len(features) > 200: QtGui.QApplication.instance().setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) ...
if self.bShowCorrectedPvalues: pValueLabels = statsResults.getColumnAsStr('pValuesCorrected') if statsResults.multCompCorrection.method != 'No correction': pValueTitle += ' (corrected)' else: pValueLabels = statsResults.getColumnAsStr('pValues') effectSizes = statsResults.getColumn('EffectSize'...
pValueTitle = 'p-value'
conditional_block
ExtendedErrorBar.py
statsResults): # *** Check if there is sufficient data to generate the plot if len(statsResults.activeData) <= 0: self.emptyAxis() return features = statsResults.getColumn('Features') if len(features) > 200: QtGui.QApplication.instance().setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) ...
else: stdDev1 = [0] * len(meanRelFreqSeqs1) stdDev2 = [0] * len(meanRelFreqSeqs2) endCapSize = 0 axNumSeq.barh(np.arange(len(features))+0.0, meanRelFreqSeqs1, height = 0.3, xerr=stdDev1, color=group1Colour, ecolor='black', capsize=endCapSize) axNumSeq.barh(np.arange(len(features))-0.3, meanRelFreq...
stdDev1 = statsResults.getColumn('StdDevRelFreq1') stdDev2 = statsResults.getColumn('StdDevRelFreq2') endCapSize = self.endCapSize
random_line_split
ExtendedErrorBar.py
self.legendPos = plotToCopy.legendPos def plot(self, profile, statsResults): # *** Check if there is sufficient data to generate the plot if len(statsResults.activeData) <= 0: self.emptyAxis() return features = statsResults.getColumn('Features') if len(features) > 200: QtGui.QApplication.in...
self.name = plotToCopy.name self.figWidth = plotToCopy.figWidth self.figHeightPerRow = plotToCopy.figHeightPerRow self.sortingField = plotToCopy.sortingField self.bShowBarPlot = plotToCopy.bShowBarPlot self.bShowPValueLabels = plotToCopy.bShowPValueLabels self.bShowCorrectedPvalues = plotToCopy....
identifier_body
ExtendedErrorBar.py
(self, plotToCopy): self.name = plotToCopy.name self.figWidth = plotToCopy.figWidth self.figHeightPerRow = plotToCopy.figHeightPerRow self.sortingField = plotToCopy.sortingField self.bShowBarPlot = plotToCopy.bShowBarPlot self.bShowPValueLabels = plotToCopy.bShowPValueLabels self.bShowCorrecte...
mirrorProperties
identifier_name
scheduler.py
# Copyright (c) Mathias Kaerlev 2012. # This file is part of pyspades. # pyspades 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 later version. # ...
self.calls = WeakSet() self.loops = WeakSet()
loop.stop()
conditional_block
scheduler.py
# Copyright (c) Mathias Kaerlev 2012. # This file is part of pyspades. # pyspades 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 later version. # ...
def reset(self): for call in self.calls: if call.active(): call.cancel() for loop in self.loops: if loop.running: loop.stop() self.calls = WeakSet() self.loops = WeakSet()
def __init__(self, protocol): self.protocol = protocol self.calls = WeakSet() self.loops = WeakSet() def call_later(self, *arg, **kw): call = reactor.callLater(*arg, **kw) self.calls.add(call) return call def call_end(self, *arg, **kw): call = self.proto...
identifier_body
scheduler.py
# Copyright (c) Mathias Kaerlev 2012. # This file is part of pyspades. # pyspades 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 later version. # ...
(self, delay, func, *arg, **kw): loop = LoopingCall(func, *arg, **kw) loop.start(delay, False) self.loops.add(loop) return loop def reset(self): for call in self.calls: if call.active(): call.cancel() for loop in self.loops: if...
loop_call
identifier_name
scheduler.py
# Copyright (c) Mathias Kaerlev 2012. # This file is part of pyspades. # pyspades 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 later version. # ...
return call def loop_call(self, delay, func, *arg, **kw): loop = LoopingCall(func, *arg, **kw) loop.start(delay, False) self.loops.add(loop) return loop def reset(self): for call in self.calls: if call.active(): call.cancel() ...
return call def call_end(self, *arg, **kw): call = self.protocol.call_end(*arg, **kw) self.calls.add(call)
random_line_split
lenet_preprocessing.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ========================================================================...
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software
random_line_split
lenet_preprocessing.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
(image, output_height, output_width, is_training): """Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after preprocessing. is_training: `True` if we're pre...
preprocess_image
identifier_name
lenet_preprocessing.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
"""Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. output_height: The height of the image after preprocessing. output_width: The width of the image after preprocessing. is_training: `True` if we're preprocessing the image for training and `False` o...
identifier_body
fourier_transform.py
r""" Fourier transform ================= The graph Fourier transform :meth:`pygsp.graphs.Graph.gft` transforms a signal from the vertex domain to the spectral domain. The smoother the signal (see :meth:`pygsp.graphs.Graph.dirichlet_energy`), the lower in the frequencies its energy is concentrated. """ import numpy as...
fig.tight_layout()
axes[1, 0].set_ylabel(r'frequency content $\hat{x}(\lambda)$') # axes[0, 0].set_title(r'$x$: signal in the vertex domain') # axes[1, 0].set_title(r'$\hat{x}$: signal in the spectral domain')
random_line_split
fourier_transform.py
r""" Fourier transform ================= The graph Fourier transform :meth:`pygsp.graphs.Graph.gft` transforms a signal from the vertex domain to the spectral domain. The smoother the signal (see :meth:`pygsp.graphs.Graph.dirichlet_energy`), the lower in the frequencies its energy is concentrated. """ import numpy as...
axes[1, 0].set_ylabel(r'frequency content $\hat{x}(\lambda)$') # axes[0, 0].set_title(r'$x$: signal in the vertex domain') # axes[1, 0].set_title(r'$\hat{x}$: signal in the spectral domain') fig.tight_layout()
g = pg.filters.Heat(G, scale) x = g.filter(x0).squeeze() x /= np.linalg.norm(x) x_hat = G.gft(x).squeeze() assert np.all((-limit < x) & (x < limit)) G.plot(x, limits=[-limit, limit], ax=axes[0, i]) axes[0, i].set_axis_off() axes[0, i].set_title('$x^T L x = {:.2f}$'.format(G.dirichlet_energy...
conditional_block
timer.component.ts
import {Component, Input, OnChanges, SimpleChange, OnInit} from "angular2/core"; import {Observable} from "rxjs/Observable"; export enum TimerEvent { START, STOP, RESET } @Component({ selector: 'timer', template: ` <div [hidden]="!time" class="timer" [class.timer--urgent]="isOverTime" [class.timer--la...
let minutes = time % 60; result = (minutes >= 10 ? minutes : '0' + minutes) + ':' + result; time = Math.floor(time / 60); if (time === 0) { return prefix + result; } return prefix + time + ':' + result; } }
{ result = '00:' + result; return prefix + result; }
conditional_block
timer.component.ts
import {Component, Input, OnChanges, SimpleChange, OnInit} from "angular2/core"; import {Observable} from "rxjs/Observable"; export enum TimerEvent { START, STOP, RESET } @Component({ selector: 'timer', template: ` <div [hidden]="!time" class="timer" [class.timer--urgent]="isOverTime" [class.timer--la...
private toggle(run: boolean): void { if (run) { if (!this.isRunning) { this.reset(); this.isRunning = true; window.requestAnimationFrame(this.doStep); } } else { if (this.isRunning) { this.isRunning = false; } } } private step(timestamp: numbe...
{ this.isRunning = false; this.time = this.toTime(this.seconds); this.accurateSeconds = this.seconds; this.isOverTime = false; this.total = this.seconds; this.startTime = null; }
identifier_body
timer.component.ts
import {Component, Input, OnChanges, SimpleChange, OnInit} from "angular2/core"; import {Observable} from "rxjs/Observable"; export enum TimerEvent { START, STOP, RESET } @Component({ selector: 'timer', template: ` <div [hidden]="!time" class="timer" [class.timer--urgent]="isOverTime" [class.timer--la...
implements OnChanges, OnInit { public time: string; public accurateSeconds: number; public isOverTime: boolean; public total: number; @Input() public seconds: number; @Input() public control: Observable<TimerEvent>; @Input() public large: any; public isLarge: boolean; private isRunning: boo...
TimerComponent
identifier_name
timer.component.ts
import {Component, Input, OnChanges, SimpleChange, OnInit} from "angular2/core"; import {Observable} from "rxjs/Observable"; export enum TimerEvent { START, STOP, RESET } @Component({ selector: 'timer', template: ` <div [hidden]="!time" class="timer" [class.timer--urgent]="isOverTime" [class.timer--la...
@Input() public control: Observable<TimerEvent>; @Input() public large: any; public isLarge: boolean; private isRunning: boolean; private startTime: number; private doStep: (timestamp: number) => void; constructor() { this.doStep = this.step.bind(this); } ngOnInit() { this.setIsLarge()...
public seconds: number;
random_line_split
structure.rs
extern crate rand; use self::rand::Rng; // Read files use std::io::prelude::*; use std::fs; use core::renderer::RGB; use super::Filter; use core::world::dungeon::map::{self, Measurable, tile, Tile}; /// /// Structure placer /// /// Generate prefab structures based on files and place them on the grid /// #[derive(...
} impl Filter for Structure { type Output = Tile; fn apply(&mut self, grid: &mut map::Grid<Self::Output>) { self.add_rand_struct(grid); } }
{ Structure {} }
identifier_body
structure.rs
extern crate rand; use self::rand::Rng; // Read files use std::io::prelude::*; use std::fs; use core::renderer::RGB; use super::Filter; use core::world::dungeon::map::{self, Measurable, tile, Tile}; /// /// Structure placer /// /// Generate prefab structures based on files and place them on the grid /// #[derive(...
(&mut self, grid: &mut map::Grid<Self::Output>) { self.add_rand_struct(grid); } }
apply
identifier_name
structure.rs
extern crate rand; use self::rand::Rng; // Read files use std::io::prelude::*; use std::fs; use core::renderer::RGB; use super::Filter; use core::world::dungeon::map::{self, Measurable, tile, Tile}; /// /// Structure placer /// /// Generate prefab structures based on files and place them on the grid /// #[derive(...
strct = rot90(strct); } // Read details of vector let w = strct.width(); let h = strct.height(); // Read details of map let total_w = grid.width(); let total_h = grid.height(); // Add to map if possible let x = rng.gen_range(0, w + 1); let y = rng.gen_range(0, h + 1); ...
random_line_split
doReMiChordNotation.ts
module Inknote.ChordNotation { function getDoReMiTextFrom(index: Model.NoteValue) { return [ "Do", "Di", "Re", "Ri", "Me", "Mi", "Fa", "Fi", "Sol", "Si", "La", "L...
} }
// note: low priority. // todo: finish naming system; throw new Error("Not implemented"); return; }
identifier_body
doReMiChordNotation.ts
module Inknote.ChordNotation { function getDoReMiTextFrom(index: Model.NoteValue) { return [ "Do", "Di", "Re", "Ri", "Me", "Mi", "Fa", "Fi", "Sol", "Si", "La", "L...
: string { // note: low priority. // todo: finish naming system; throw new Error("Not implemented"); return; } } }
me()
identifier_name
doReMiChordNotation.ts
module Inknote.ChordNotation { function getDoReMiTextFrom(index: Model.NoteValue) { return [ "Do", "Di", "Re", "Ri", "Me", "Mi", "Fa", "Fi", "Sol", "Si", "La", "L...
minor: boolean; annotations: string; constructor(baseNote: Model.Note, rootNote: Model.Note, minor: boolean, annotations: string) { this.baseNote = baseNote; this.rootNote = rootNote; this.minor = minor; this.annotations = annotations; } ...
export class DoReMiChordNotation implements IChordable { baseNote: Model.Note; rootNote: Model.Note;
random_line_split
cli.py
# Copyright 2012 New Dream Network, LLC (DreamHost) # # 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 a...
parser = subparsers.add_parser('check_migration') parser.set_defaults(func=do_check_migration) for name in ['upgrade', 'downgrade']: parser = subparsers.add_parser(name) parser.add_argument('--delta', type=int) parser.add_argument('--sql', action='store_true') parser.add_a...
parser = subparsers.add_parser(name) parser.set_defaults(func=do_alembic_command)
conditional_block
cli.py
# Copyright 2012 New Dream Network, LLC (DreamHost) # # 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 a...
(): config = alembic_config.Config( os.path.join(os.path.dirname(__file__), 'alembic.ini') ) config.set_main_option('script_location', 'neutron.db.migration:alembic_migrations') # attach the Neutron conf to the Alembic conf config.neutron_config = CONF CONF() ...
main
identifier_name
cli.py
# Copyright 2012 New Dream Network, LLC (DreamHost) # # 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 a...
def do_check_migration(config, cmd): do_alembic_command(config, 'branches') def do_upgrade_downgrade(config, cmd): if not CONF.command.revision and not CONF.command.delta: raise SystemExit(_('You must provide a revision or relative delta')) revision = CONF.command.revision if CONF.command.d...
getattr(alembic_command, cmd)(config, *args, **kwargs) except alembic_util.CommandError as e: alembic_util.err(str(e))
random_line_split
cli.py
# Copyright 2012 New Dream Network, LLC (DreamHost) # # 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 a...
def do_revision(config, cmd): do_alembic_command(config, cmd, message=CONF.command.message, autogenerate=CONF.command.autogenerate, sql=CONF.command.sql) def add_command_parsers(subparsers): for name in ['current', 'history', 'branches']:...
do_alembic_command(config, cmd, CONF.command.revision, sql=CONF.command.sql)
identifier_body
promiserejectionevent.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
let promise = init.promise.clone(); let bubbles = EventBubbles::from(init.parent.bubbles); let cancelable = EventCancelable::from(init.parent.cancelable); let event = PromiseRejectionEvent::new( global, Atom::from(type_), bubbles, cancelab...
global: &GlobalScope, type_: DOMString, init: RootedTraceableBox<PromiseRejectionEventBinding::PromiseRejectionEventInit>, ) -> Fallible<DomRoot<Self>> { let reason = init.reason.handle();
random_line_split
promiserejectionevent.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
// https://dom.spec.whatwg.org/#dom-event-istrusted fn IsTrusted(&self) -> bool { self.event.IsTrusted() } }
{ self.reason.get() }
identifier_body
promiserejectionevent.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods; use crate::dom::bindings::codegen::Bindi...
( global: &GlobalScope, type_: DOMString, init: RootedTraceableBox<PromiseRejectionEventBinding::PromiseRejectionEventInit>, ) -> Fallible<DomRoot<Self>> { let reason = init.reason.handle(); let promise = init.promise.clone(); let bubbles = EventBubbles::from(init.par...
Constructor
identifier_name
common.js
/** * Common JavaScript functions that can be used on every page. * * Note that this script is loaded in the footer, so always wait for the * document ready event before accessing the DOM. */ /** * Link tags with the "history_back" function trigger "window.history.back()". */ $('body').on('click', 'a.history_ba...
function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $(document).ajaxStart(function() { $("#global-loader").show(); }); $(document).ajaxSend(function(event, xhr, settings) { if (!csrfSafeMethod(settings.type) && !...
{ var value = null; if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) === (name + '=')) { val...
identifier_body
common.js
/** * Common JavaScript functions that can be used on every page. * * Note that this script is loaded in the footer, so always wait for the * document ready event before accessing the DOM. */ /** * Link tags with the "history_back" function trigger "window.history.back()". */ $('body').on('click', 'a.history_ba...
} return value; } function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $(document).ajaxStart(function() { $("#global-loader").show(); }); $(document).ajaxSend(function(event, xhr, settings) { if (!csrfSafe...
{ var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) === (name + '=')) { value = decodeURIComponent(cookie.substring(name.length + 1)); break; } }
conditional_block
common.js
/** * Common JavaScript functions that can be used on every page. * * Note that this script is loaded in the footer, so always wait for the * document ready event before accessing the DOM. */ /** * Link tags with the "history_back" function trigger "window.history.back()". */ $('body').on('click', 'a.history_ba...
highlight: function (element) { $(element).closest('.form-group').addClass('has-error'); }, unhighlight: function(element) { $(element).closest('.form-group').removeClass('has-error'); } }; // delay the request, to reduce the amount of requests // --> the request is only sent if the qu...
// Default options for form validation var validationDefaults = { errorClass: 'help-block',
random_line_split
common.js
/** * Common JavaScript functions that can be used on every page. * * Note that this script is loaded in the footer, so always wait for the * document ready event before accessing the DOM. */ /** * Link tags with the "history_back" function trigger "window.history.back()". */ $('body').on('click', 'a.history_ba...
(name) { var value = null; if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) === (name + '=')) { ...
getCookie
identifier_name
base.ts
import { Duplex, DuplexOptions } from 'stream'; import { bind, readonly } from '../decorators'; import { fixPath } from '../pathutils'; export const ANSI_CLS: string = '\x1b[2J\x1b[1;1H'; export const ANSI_RESET: string = '\x1b[?1000l\x1b[?25h\x1b[0m'; export interface TerminalOptions extends DuplexOptions { path?:...
export abstract class TerminalBase<TPty> extends Duplex { public process?: string; public pty?: TPty; public path?: string; public rawPath?: string; public resolvedPath?: string; public argv?: string[]; public cols: number = 80; public rows: number = 30; public env: { [key: string]: string }; publi...
env?: { [key: string]: string }; cwd?: string; _rawPath?: string; }
random_line_split
base.ts
import { Duplex, DuplexOptions } from 'stream'; import { bind, readonly } from '../decorators'; import { fixPath } from '../pathutils'; export const ANSI_CLS: string = '\x1b[2J\x1b[1;1H'; export const ANSI_RESET: string = '\x1b[?1000l\x1b[?25h\x1b[0m'; export interface TerminalOptions extends DuplexOptions { path?:...
public spawn(): void | Promise<void> {} public _read() { if(!this.buffered) return; for(let i = 0; i < this.buffered.length; i++) if(!this.push(this.buffered[i], this.encoding)) { this.buffered = this.buffered.slice(i + 1); return; } delete this.buffered; } public res...
{ super(options); if(options) { this.encoding = options.encoding; this.env = Object.assign({}, process.env, options.env); this.cols = options.cols || 80; this.rows = options.rows || 30; this.path = options.path; this.rawPath = options._rawPath || ''; this.argv = options...
identifier_body
base.ts
import { Duplex, DuplexOptions } from 'stream'; import { bind, readonly } from '../decorators'; import { fixPath } from '../pathutils'; export const ANSI_CLS: string = '\x1b[2J\x1b[1;1H'; export const ANSI_RESET: string = '\x1b[?1000l\x1b[?25h\x1b[0m'; export interface TerminalOptions extends DuplexOptions { path?:...
(): void | Promise<void> {} public _read() { if(!this.buffered) return; for(let i = 0; i < this.buffered.length; i++) if(!this.push(this.buffered[i], this.encoding)) { this.buffered = this.buffered.slice(i + 1); return; } delete this.buffered; } public resize(cols: number...
spawn
identifier_name
markov.py
import wordtools import random from forms.form import Form class MarkovForm(Form):
else: self.data[a[i]][a[i+1]]=1 def build(self): self.limiter+=1 if self.limiter < 1000 or not self.limiter%300==0: return None s = "" lastWord = "" while True: total = 0 for word in self.data[lastWord]: total+=self.data[lastWord][word] choice = random.randint(0,total-1) total = 0 ...
def __init__(self): self.data={} self.data[""]={} self.limiter=0 def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None def save(self,a): a.insert(0,"") a.append("") for i in range(0,len(a)-1): if not...
identifier_body
markov.py
import wordtools import random from forms.form import Form class MarkovForm(Form): def __init__(self): self.data={} self.data[""]={} self.limiter=0 def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None def...
for i in range(0,len(a)-1): if not a[i] in self.data: self.data[a[i]]={} if a[i+1] in self.data[a[i]]: self.data[a[i]][a[i+1]]+=1 else: self.data[a[i]][a[i+1]]=1 def build(self): self.limiter+=1 if self.limiter < 1000 or not self.limiter%300==0: return None s = "" lastWord = "" whi...
random_line_split
markov.py
import wordtools import random from forms.form import Form class MarkovForm(Form): def
(self): self.data={} self.data[""]={} self.limiter=0 def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None def save(self,a): a.insert(0,"") a.append("") for i in range(0,len(a)-1): if not a[i] in sel...
__init__
identifier_name
markov.py
import wordtools import random from forms.form import Form class MarkovForm(Form): def __init__(self): self.data={} self.data[""]={} self.limiter=0 def validate(self,tweet): cleaned = wordtools.clean(tweet) if wordtools.validate(cleaned) and len(cleaned)>=2: return cleaned else: return None def...
if lastWord=="": break return s.lower()
total+=self.data[lastWord][word] if total>choice: lastWord=word s+=word+" " break
conditional_block
lib.rs
#[derive(Debug, PartialEq)] pub enum Comparison { Unequal, Equal, Sublist, Superlist } pub fn sublist<T>(first: &[T], second: &[T]) -> Comparison where T: PartialEq { let (shortest, longest) = if first.len() < second.len() { (first, second) } else { (second, first) }; let mut a...
.map(|length| length >= shortest.len()) .unwrap_or(false); } if !done { Comparison::Unequal } else if first.len() < second.len() { Comparison::Sublist } else if shortest.len() == longest.len() { Comparison::Equal } else { Comparison::Superlist } }
random_line_split
lib.rs
#[derive(Debug, PartialEq)] pub enum Comparison { Unequal, Equal, Sublist, Superlist } pub fn sublist<T>(first: &[T], second: &[T]) -> Comparison where T: PartialEq
position += 1; done = anchors.first().map(|&start| position - start) .map(|length| length >= shortest.len()) .unwrap_or(false); } if !done { Comparison::Unequal } else if first.len() < second.len() { Comparison::Sublist } else if shortest.len() == longest.len() { Compariso...
{ let (shortest, longest) = if first.len() < second.len() { (first, second) } else { (second, first) }; let mut anchors = Vec::new(); let mut position = 0; let mut done = first.len() * second.len() == 0; while !done && position < longest.len() { if let Some(start) = anchors....
identifier_body
lib.rs
#[derive(Debug, PartialEq)] pub enum
{ Unequal, Equal, Sublist, Superlist } pub fn sublist<T>(first: &[T], second: &[T]) -> Comparison where T: PartialEq { let (shortest, longest) = if first.len() < second.len() { (first, second) } else { (second, first) }; let mut anchors = Vec::new(); let mut position = 0; ...
Comparison
identifier_name