file_name large_stringlengths 4 140 | prefix large_stringlengths 0 39k | suffix large_stringlengths 0 36.1k | middle large_stringlengths 0 29.4k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
extern-call.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (n: uint) -> uint {
unsafe {
debug!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10u);
debug!("result = %?", result);
assert_eq!(result, 3628800u);
}
| fact | identifier_name |
extern-call.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | } else {
fact(data - 1u) * data
}
}
fn fact(n: uint) -> uint {
unsafe {
debug!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
pub fn main() {
let result = fact(10u);
debug!("result = %?", result);
assert_eq!(result, 3628800u);
} | extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
if data == 1u {
data | random_line_split |
DBPoolManager.ts | export declare function require(name: string): any
let pg = require("pg")
import { CannotCreateInstanceError, SqlExecFailError, TableNotFoundError } from "../define/Error"
import Table, {Record} from "../model/db/table/Table"
import Column from "../model/db/column/Column"
/**
* DBPoolManager
*/
export default clas... |
/**
* @param {String} psql 実行psqlテキスト
* @param {Array} varray 実行psqlテキストに付随する変数配列
* @return {Promise} resolve(result), reject(error)
*/
public exec(psql: string, varray?: any[]): Promise<any> {
console.log("exec-psql: " + psql)
return new Promise((resolve, reject) => {
... | {
if (this.instance == null) {
this.instance = new DBPoolManager()
}
return new Promise((resolve, reject) => {
if (this.instance.client) {
resolve(this.instance)
return
}
this.instance.pool.connect((error, client, ... | identifier_body |
DBPoolManager.ts | export declare function require(name: string): any
let pg = require("pg")
import { CannotCreateInstanceError, SqlExecFailError, TableNotFoundError } from "../define/Error"
import Table, {Record} from "../model/db/table/Table"
import Column from "../model/db/column/Column"
/**
* DBPoolManager
*/
export default clas... | return Object.keys(value).reduce((prev: any, key: string) => {
prev[key] = escape(value[key])
return prev
}, {})
} else if (value == null || typeof value != String.name.toLowerCase()) {
return value
}
return value.replace(/'/g, "''")
}
| > {
return escape(value1)
})
} else if (value instanceof Object) {
| conditional_block |
DBPoolManager.ts | export declare function require(name: string): any
let pg = require("pg")
import { CannotCreateInstanceError, SqlExecFailError, TableNotFoundError } from "../define/Error"
import Table, {Record} from "../model/db/table/Table"
import Column from "../model/db/column/Column"
/**
* DBPoolManager
*/
export default clas... | {
private static instance: DBPoolManager
private pool: any
private client: any
private static DB_CONF = {
user: "root",
database: "open_ishinomaki",
password: "KsJaA4uQ",
host: "localhost",
port: 5432,
max: 10,
idleTimeoutMillis: 30000
}
... | DBPoolManager | identifier_name |
DBPoolManager.ts | export declare function require(name: string): any
let pg = require("pg")
import { CannotCreateInstanceError, SqlExecFailError, TableNotFoundError } from "../define/Error"
import Table, {Record} from "../model/db/table/Table"
import Column from "../model/db/column/Column"
/**
* DBPoolManager
*/
export default clas... | return new Promise((resolve, reject) => {
if (this.instance.client) {
resolve(this.instance)
return
}
this.instance.pool.connect((error, client, done) => {
if (error) {
reject(error)
retu... | public static getInstance(): Promise<DBPoolManager> {
if (this.instance == null) {
this.instance = new DBPoolManager()
}
| random_line_split |
locale.js | /**
* Retrieves the devices location.
* @see extend
*
* @author Joseph Fehrman
* @since 07/09/2016
* @return Promise chain representing coordinates.
*/ | this.longitude = longitude;
this.latitude = latitude;
this.options = options;
}
this.geo_options = {
enableHighAccuracy: true,
maximumAge : 30000,
timeout : 27000
};
extend(geo_options, options);
return new Promise(function(resolve, reject){
// Evaluat... | function locale(options){
/**
* Private object designed to house coordinates.
*/
var Location = function(latitude, longitude , options){ | random_line_split |
locale.js | /**
* Retrieves the devices location.
* @see extend
*
* @author Joseph Fehrman
* @since 07/09/2016
* @return Promise chain representing coordinates.
*/
function locale(options){
/**
* Private object designed to house coordinates.
*/
var Location = function(latitude, longitude , options){
this.long... | else{
// Evaluate that the browser does not support GPS location show the following error message.
reject(Error("Can not locate device's location. Browser does not support GPS locations."));
alert("Could not locate device's location.");
}
/**
* Private function for succes... | {
// Get the current location.
navigator.geolocation.getCurrentPosition(locationSuccess, locationFailed, geo_options);
} | conditional_block |
locale.js | /**
* Retrieves the devices location.
* @see extend
*
* @author Joseph Fehrman
* @since 07/09/2016
* @return Promise chain representing coordinates.
*/
function locale(options){
/**
* Private object designed to house coordinates.
*/
var Location = function(latitude, longitude , options){
this.long... |
});
} | {
console.error("Location error " + error.code + ": " + error.message);
alert("Could not locate device's location.")
} | identifier_body |
locale.js | /**
* Retrieves the devices location.
* @see extend
*
* @author Joseph Fehrman
* @since 07/09/2016
* @return Promise chain representing coordinates.
*/
function | (options){
/**
* Private object designed to house coordinates.
*/
var Location = function(latitude, longitude , options){
this.longitude = longitude;
this.latitude = latitude;
this.options = options;
}
this.geo_options = {
enableHighAccuracy: true,
maximumAge : 30000,
t... | locale | identifier_name |
AboutDialog.js | /*
* Copyright (C) Zing contributors.
*
* This file is a part of the Zing project. It is distributed under the GPL3
* or later license. See the LICENSE file for a copy of the license and the
* AUTHORS file for copyright and authorship information.
*/
import React from 'react';
import { showModal } from './Modal'... | ;
| {
return (
<div>
<div className="side-column">
<img src={s('images/logo.svg')} />
</div>
<div className="main-content">
<h1>Zing</h1>
<p>
{tct(
'This server is powered by %(zing)s — ' +
'online translation softwar... | identifier_body |
AboutDialog.js | /*
* Copyright (C) Zing contributors.
*
* This file is a part of the Zing project. It is distributed under the GPL3
* or later license. See the LICENSE file for a copy of the license and the
* AUTHORS file for copyright and authorship information.
*/
import React from 'react';
import { showModal } from './Modal'... | {t('© 2016 Pootle Contributors')}
</p>
</div>
</div>
);
},
}); | <br /> | random_line_split |
AboutDialog.js | /*
* Copyright (C) Zing contributors.
*
* This file is a part of the Zing project. It is distributed under the GPL3
* or later license. See the LICENSE file for a copy of the license and the
* AUTHORS file for copyright and authorship information.
*/
import React from 'react';
import { showModal } from './Modal'... | () {
showModal({
title: t('About this translation server...'),
children: <AboutDialogContent />,
className: 'about-dialog-component',
});
}
const AboutDialogContent = React.createClass({
render() {
return (
<div>
<div className="side-column">
<img src={s('images/logo.svg')... | showAboutDialog | identifier_name |
useLokiSyntaxAndLabels.ts | import { useState, useEffect } from 'react';
import Prism, { Grammar } from 'prismjs';
import { AbsoluteTimeRange } from '@grafana/data';
import LokiLanguageProvider from 'app/plugins/datasource/loki/language_provider';
import { useLokiLabels } from 'app/plugins/datasource/loki/components/useLokiLabels';
import { useRe... |
}, [languageProviderInitialized, languageProvider]);
return {
isSyntaxReady: !!syntax,
syntax,
};
};
/**
* Initializes given language provider, exposes Loki syntax and enables loading label option values
*/
export const useLokiSyntaxAndLabels = (languageProvider: LokiLanguageProvider, absoluteRange: ... | {
const syntax = languageProvider.getSyntax();
Prism.languages[PRISM_SYNTAX] = syntax;
setSyntax(syntax);
} | conditional_block |
useLokiSyntaxAndLabels.ts | import { useState, useEffect } from 'react';
import Prism, { Grammar } from 'prismjs';
import { AbsoluteTimeRange } from '@grafana/data';
import LokiLanguageProvider from 'app/plugins/datasource/loki/language_provider';
import { useLokiLabels } from 'app/plugins/datasource/loki/components/useLokiLabels';
import { useRe... | );
const { isSyntaxReady, syntax } = useLokiSyntax(languageProvider, languageProviderInitialized);
return {
isSyntaxReady,
syntax,
logLabelOptions,
setActiveOption,
refreshLabels,
};
}; | const { logLabelOptions, refreshLabels, setActiveOption } = useLokiLabels(
languageProvider,
languageProviderInitialized,
absoluteRange | random_line_split |
deploy.js | /*
* 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/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
/*
* lib/deploy.js: common functions for deploying instances of M... |
/*
* Given a list of SAPI instances for storage nodes, return an unused Manta
* storage id. If we're at all unsure, we return an error rather than
* potentially returning a conflicting name.
*/
function pickNextStorageId(instances, svcname)
{
var max, inst, instname, numpart;
var i, p, n;
var err = null;
ma... | {
var sapi = self.SAPI;
var log = self.log;
assert.string(self.config.datacenter_name,
'self.config.datacenter_name');
assert.object(app, 'app');
assert.object(app.metadata, 'app.metadata');
assert.string(app.metadata.REGION, 'app.metadata.REGION');
assert.string(app.metadata.DNS_DOMAIN, 'app.metadata.DN... | identifier_body |
deploy.js | /*
* 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/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
/*
* lib/deploy.js: common functions for deploying instances of M... | self.service = svcs[0];
log.debug({ svc: self.service },
'found %s service', self.svcname);
return (cb(null));
},
function ensureZk(cb) {
var app = self.manta_app;
var log = self.log;
if (self.svcname === 'nameservice') {
return (cb(null));
}
log.info('ensuring ZK servers have ... | random_line_split | |
deploy.js | /*
* 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/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
/*
* lib/deploy.js: common functions for deploying instances of M... |
if (self.svcname === 'webapi' || self.svcname === 'loadbalancer')
metadata.SERVICE_NAME = app.metadata['MANTA_SERVICE'];
if (self.svcname === 'marlin')
params.tags.manta_role = 'compute';
/*
* This zone should get its configuration the local (i.e. same
* datacenter) SAPI instance, as well as use the loca... | {
metadata.SERVICE_NAME = sprintf('stor.%s', service_root);
} | conditional_block |
deploy.js | /*
* 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/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
/*
* lib/deploy.js: common functions for deploying instances of M... | () {
log.debug({
serverUuid: serverUuid
}, 'server uuid for looking up compute id');
var m = 'Error getting compute id';
common.getOrCreateComputeId.call(
self, serverUuid, function (err, cid) {
if (err) {
return (cb(err));
}
if (!cid) {
var e = new Error(m);
... | getComputeId | identifier_name |
_changedsince.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
#
# 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 2 of the License, or
# (at you... | (ChangedSinceBase):
"""Rule that checks for persons changed since a specific time."""
labels = [ _('Changed after:'), _('but before:') ]
name = _('Persons changed after <date time>')
description = _("Matches person records changed after a specified "
"date-time (yyyy-mm-dd hh:m... | ChangedSince | identifier_name |
_changedsince.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
#
# 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 2 of the License, or
# (at you... | #-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from .._changedsincebase import ChangedSinceBase
#-------------------------------------------------------------------------
#
# ChangedSince
#
#----... | #-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
| random_line_split |
_changedsince.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
#
# 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 2 of the License, or
# (at you... | """Rule that checks for persons changed since a specific time."""
labels = [ _('Changed after:'), _('but before:') ]
name = _('Persons changed after <date time>')
description = _("Matches person records changed after a specified "
"date-time (yyyy-mm-dd hh:mm:ss) or in the range, i... | identifier_body | |
redux-helpers.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.provider = undefined;
exports.shallowEqual = shallowEqual;
exports.observeStore = observeStore;
exports.configureStore = configureStore;
var _redux = require('redux');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { f... |
//# sourceMappingURL=redux-helpers.js.map
| {
var middleware = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
return (0, _redux.createStore)(reducer, preloadedState, composeEnhancers(_redux.applyMiddleware.apply(undefined, _toConsumableArray(middleware))));
} | identifier_body |
redux-helpers.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.provider = undefined;
exports.shallowEqual = shallowEqual;
exports.observeStore = observeStore;
exports.configureStore = configureStore;
var _redux = require('redux');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { f... | }
var provider = exports.provider = {
set store(store) {
this._store = store;
},
get store() {
return this._store;
}
};
function configureStore(reducer, preloadedState) {
var middleware = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
return (0, _redux.createStore)(reduc... | random_line_split | |
redux-helpers.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.provider = undefined;
exports.shallowEqual = shallowEqual;
exports.observeStore = observeStore;
exports.configureStore = configureStore;
var _redux = require('redux');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { f... |
}
var unsubscribe = store.subscribe(handleChange);
handleChange();
return unsubscribe;
}
var provider = exports.provider = {
set store(store) {
this._store = store;
},
get store() {
return this._store;
}
};
function configureStore(reducer, preloadedState) {
var middleware = arguments.leng... | {
var previousState = currentState;
currentState = nextState;
onChange(currentState, previousState);
} | conditional_block |
redux-helpers.js | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.provider = undefined;
exports.shallowEqual = shallowEqual;
exports.observeStore = observeStore;
exports.configureStore = configureStore;
var _redux = require('redux');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { f... | () {
var nextState = select(store.getState());
if (!shallowEqual(currentState, nextState)) {
var previousState = currentState;
currentState = nextState;
onChange(currentState, previousState);
}
}
var unsubscribe = store.subscribe(handleChange);
handleChange();
return unsubscribe;
... | handleChange | identifier_name |
ssh_session.py | #!/usr/bin/env python
#
# Eric S. Raymond
#
# Greatly modified by Nigel W. Moriarty
# April 2003
#
from pexpect import *
import os, sys
import getpass
import time
class ssh_session:
"Session with extra state including the password to be used."
def __init__(self, user, host, password=None, verbose=0):
... | sys.stderr.write("<- " + child.before + "|\n")
try:
self.f.write(str(child.before) + str(child.after)+'\n')
except:
pass
self.f.close()
return child.before
def ssh(self, command):
return self.__exec("ssh -l %s %s \"%s\"" \
... | random_line_split | |
ssh_session.py | #!/usr/bin/env python
#
# Eric S. Raymond
#
# Greatly modified by Nigel W. Moriarty
# April 2003
#
from pexpect import *
import os, sys
import getpass
import time
class ssh_session:
"Session with extra state including the password to be used."
def __init__(self, user, host, password=None, verbose=0):
... |
try:
self.f.write(str(child.before) + str(child.after)+'\n')
except:
pass
self.f.close()
return child.before
def ssh(self, command):
return self.__exec("ssh -l %s %s \"%s\"" \
% (self.user,self.host,comma... | sys.stderr.write("<- " + child.before + "|\n") | conditional_block |
ssh_session.py | #!/usr/bin/env python
#
# Eric S. Raymond
#
# Greatly modified by Nigel W. Moriarty
# April 2003
#
from pexpect import *
import os, sys
import getpass
import time
class ssh_session:
"Session with extra state including the password to be used."
def __init__(self, user, host, password=None, verbose=0):
... | (self, file):
"Retrieve file permissions of specified remote file."
seen = self.ssh("/bin/ls -ld %s" % file)
if string.find(seen, "No such file") > -1:
return None # File doesn't exist
else:
return seen.split()[0] # Return permission field of listing.
| exists | identifier_name |
ssh_session.py | #!/usr/bin/env python
#
# Eric S. Raymond
#
# Greatly modified by Nigel W. Moriarty
# April 2003
#
from pexpect import *
import os, sys
import getpass
import time
class ssh_session:
"Session with extra state including the password to be used."
def __init__(self, user, host, password=None, verbose=0):
... |
def __repr__(self):
outl = 'class :'+self.__class__.__name__
for attr in self.__dict__:
if attr == 'password':
outl += '\n\t'+attr+' : '+'*'*len(self.password)
else:
outl += '\n\t'+attr+' : '+str(getattr(self, attr))
retu... | self.user = user
self.host = host
self.verbose = verbose
self.password = password
self.keys = [
'authenticity',
'assword:',
'@@@@@@@@@@@@',
'Command not found.',
EOF,
]
self.f = open('ssh.out','w') | identifier_body |
teamtreehouse.py | ################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | "" A <Platform> object for Teamtreehouse"""
def __init__(self):
self.platformName = "Teamtreehouse"
self.tags = ["social", "news"]
########################
# Defining valid modes #
########################
self.isValidMode = {}
self.isValidMode["phonefy"] = F... | identifier_body | |
teamtreehouse.py | ################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... |
# Definition of regular expressions to be searched in usufy mode
self.fieldsRegExp["usufy"] = {}
# Example of fields:
#self.fieldsRegExp["usufy"]["i3visio.location"] = ""
# Definition of regular expressions to be searched in searchfy mode
#self.fieldsRegExp["searchfy"] =... | #self.fieldsRegExp["phonefy"]["i3visio.location"] = "" | random_line_split |
teamtreehouse.py | ################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | self):
self.platformName = "Teamtreehouse"
self.tags = ["social", "news"]
########################
# Defining valid modes #
########################
self.isValidMode = {}
self.isValidMode["phonefy"] = False
self.isValidMode["usufy"] = True
self.is... | _init__( | identifier_name |
test_behave.py | #!/usr/bin/python -tt
from behave import *
import os
import subprocess
import glob
import re
import shutil
DNF_FLAGS = ['-y', '--disablerepo=*', '--nogpgcheck']
RPM_INSTALL_FLAGS = ['-Uvh']
RPM_ERASE_FLAGS = ['-e']
def _left_decorator(item):
""" Removed packages """
return u'-' + item
def _right_decorator... |
@when('I execute command "{command}" with "{result}"')
def when_action_command(context, command, result):
assert command
context.pre_rpm_packages = get_rpm_package_list()
assert context.pre_rpm_packages
context.pre_rpm_packages_version = get_rpm_package_version_list()
assert context.pre_rpm_packa... | assert pkgs
context.pre_rpm_packages = get_rpm_package_list()
assert context.pre_rpm_packages
context.pre_rpm_packages_version = get_rpm_package_version_list()
assert context.pre_rpm_packages_version
context.pre_dnf_packages_version = get_dnf_package_version_list()
assert context.pre_dnf_package... | identifier_body |
test_behave.py | #!/usr/bin/python -tt
from behave import *
import os
import subprocess
import glob
import re
import shutil
DNF_FLAGS = ['-y', '--disablerepo=*', '--nogpgcheck']
RPM_INSTALL_FLAGS = ['-Uvh']
RPM_ERASE_FLAGS = ['-e']
def _left_decorator(item):
""" Removed packages """
return u'-' + item
def _right_decorator... | (context, action, pkgs, manager):
assert pkgs
context.pre_rpm_packages = get_rpm_package_list()
assert context.pre_rpm_packages
context.pre_rpm_packages_version = get_rpm_package_version_list()
assert context.pre_rpm_packages_version
context.pre_dnf_packages_version = get_dnf_package_version_lis... | when_action_package | identifier_name |
test_behave.py | #!/usr/bin/python -tt
from behave import *
import os
import subprocess
import glob
import re
import shutil
DNF_FLAGS = ['-y', '--disablerepo=*', '--nogpgcheck']
RPM_INSTALL_FLAGS = ['-Uvh']
RPM_ERASE_FLAGS = ['-e']
def _left_decorator(item):
""" Removed packages """
return u'-' + item
def _right_decorator... | assert context.pre_dnf_packages_version
cmd_output = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
context.cmd_rc = cmd_output.returncode
if result == "success":
assert context.cmd_rc == 0
elif result == "fail":
assert context.cmd_rc != 0
else:
raise Asser... | random_line_split | |
test_behave.py | #!/usr/bin/python -tt
from behave import *
import os
import subprocess
import glob
import re
import shutil
DNF_FLAGS = ['-y', '--disablerepo=*', '--nogpgcheck']
RPM_INSTALL_FLAGS = ['-Uvh']
RPM_ERASE_FLAGS = ['-e']
def _left_decorator(item):
""" Removed packages """
return u'-' + item
def _right_decorator... |
elif state == 'downgraded':
pre_rpm_ver = package_version_lists(n, context.pre_rpm_packages_version)
post_rpm_ver = package_version_lists(n, pkgs_rpm_ver)
assert post_rpm_ver
assert pre_rpm_ver
assert post_rpm_ver < pre_rpm_ver
elif state == '... | pre_rpm_ver = package_version_lists(n, context.pre_rpm_packages_version)
post_rpm_ver = package_version_lists(n, pkgs_rpm_ver)
assert post_rpm_ver
assert pre_rpm_ver
assert post_rpm_ver == pre_rpm_ver | conditional_block |
preferences.py | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.utils import (
TR,
HelpPage,
disable_help_butt... |
def updateCollection(self) -> None:
f = self.form
d = self.mw.col
self.update_video_driver()
qc = d.conf
qc["addToCur"] = not f.useCurrent.currentIndex()
s = self.prefs.sched
s.show_remaining_due_counts = f.showProgress.isChecked()
s.show_interval... | new_driver = self.video_drivers[self.form.video_driver.currentIndex()]
if new_driver != self.mw.pm.video_driver():
self.mw.pm.set_video_driver(new_driver)
showInfo(tr(TR.PREFERENCES_CHANGES_WILL_TAKE_EFFECT_WHEN_YOU)) | identifier_body |
preferences.py | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.utils import (
TR,
HelpPage,
disable_help_butt... |
if restart_required:
showInfo(tr(TR.PREFERENCES_CHANGES_WILL_TAKE_EFFECT_WHEN_YOU))
| self.mw.pm.set_recording_driver(new_audio_driver)
if new_audio_driver == RecordingDriver.PyAudio:
showInfo(
"""\
The PyAudio driver will likely be removed in a future update. If you find it works better \
for you than the default driver, please let us know on the Anki for... | conditional_block |
preferences.py | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.utils import (
TR,
HelpPage,
disable_help_butt... | (self) -> None:
self.prof["numBackups"] = self.form.numBackups.value()
# Basic & Advanced Options
######################################################################
def setupOptions(self) -> None:
self.form.pastePNG.setChecked(self.prof.get("pastePNG", False))
self.form.uiScale... | updateBackup | identifier_name |
preferences.py | # Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.utils import (
TR,
HelpPage,
disable_help_butt... | def __init__(self, mw: AnkiQt) -> None:
QDialog.__init__(self, mw, Qt.Window)
self.mw = mw
self.prof = self.mw.pm.profile
self.form = aqt.forms.preferences.Ui_Preferences()
self.form.setupUi(self)
disable_help_button(self)
self.form.buttonBox.button(QDialogBut... | class Preferences(QDialog): | random_line_split |
TracePageHeader.tsx | // Copyright (c) 2017 Uber Technologies, Inc.
//
// 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 a... |
const summaryItems =
!hideSummary &&
!slimView &&
HEADER_ITEMS.map((item) => {
const { renderer, ...rest } = item;
return { ...rest, value: renderer(trace, timeZone, styles) };
});
const title = (
<h1 className={cx(styles.TracePageHeaderTitle, canCollapse && styles.TracePageHeader... | {
return null;
} | conditional_block |
TracePageHeader.tsx | // Copyright (c) 2017 Uber Technologies, Inc.
//
// 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 a... | (trace: Trace, timeZone: TimeZone, styles: ReturnType<typeof getStyles>) {
// Convert date from micro to milli seconds
const dateStr = dateTimeFormat(trace.startTime / 1000, { timeZone, defaultWithMS: true });
const match = dateStr.match(/^(.+)(:\d\d\.\d+)$/);
return match ? (
<span clas... | renderer | identifier_name |
TracePageHeader.tsx | // Copyright (c) 2017 Uber Technologies, Inc.
//
// 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 a... | TracePageHeaderOverviewItems: css`
label: TracePageHeaderOverviewItems;
border-bottom: 1px solid #e4e4e4;
padding: 0.25rem 0.5rem !important;
`,
TracePageHeaderOverviewItemValueDetail: cx(
css`
label: TracePageHeaderOverviewItemValueDetail;
color: #aaa;
`,
... | `,
TracePageHeaderTitleCollapsible: css`
label: TracePageHeaderTitleCollapsible;
margin-left: 0;
`, | random_line_split |
TracePageHeader.tsx | // Copyright (c) 2017 Uber Technologies, Inc.
//
// 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 a... | ,
},
{
key: 'duration',
label: 'Duration:',
renderer: (trace: Trace) => formatDuration(trace.duration),
},
{
key: 'service-count',
label: 'Services:',
renderer: (trace: Trace) => new Set(_values(trace.processes).map((p) => p.serviceName)).size,
},
{
key: 'depth',
label: 'Dept... | {
// Convert date from micro to milli seconds
const dateStr = dateTimeFormat(trace.startTime / 1000, { timeZone, defaultWithMS: true });
const match = dateStr.match(/^(.+)(:\d\d\.\d+)$/);
return match ? (
<span className={styles.TracePageHeaderOverviewItemValue}>
{match[1]}
... | identifier_body |
__init__.py | ##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFT... |
def stx2htmlWithReferences(text, level=1, header=1):
text = re.sub(
r'[\000\n]\.\. \[([0-9_%s-]+)\]' % letters,
r'\n <a name="\1">[\1]</a>',
text)
text = re.sub(
r'([\000- ,])\[(?P<ref>[0-9_%s-]+)\]([\000- ,.:])' % letters,
r'\1<a href="#\2">[\2]</a>\3',
tex... | st = stng.structurize(aStructuredString)
doc = document.DocumentWithImages()(st)
return html.HTMLWithImages()(doc, header=header, level=level) | identifier_body |
__init__.py | ##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFT... | __docformat__ = 'restructuredtext'
import re
from zope.structuredtext import stng, document, html
from string import letters
def stx2html(aStructuredString, level=1, header=1):
st = stng.structurize(aStructuredString)
doc = document.DocumentWithImages()(st)
return html.HTMLWithImages()(doc, header=header,... | random_line_split | |
__init__.py | ##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFT... | (aStructuredString, level=1, header=1):
st = stng.structurize(aStructuredString)
doc = document.DocumentWithImages()(st)
return html.HTMLWithImages()(doc, header=header, level=level)
def stx2htmlWithReferences(text, level=1, header=1):
text = re.sub(
r'[\000\n]\.\. \[([0-9_%s-]+)\]' % letters,
... | stx2html | identifier_name |
encoding.py | import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030... | (encoding):
"""Overrides encoding when charset declaration
or charset determination is a subset of a larger
charset. Created because of issues with Chinese websites"""
encoding = encoding.lower()
return CHARSETS.get(encoding, encoding)
def get_encoding(page):
# Regex for XML and HTML Me... | fix_charset | identifier_name |
encoding.py | import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030... |
# Fallback to chardet if declared encodings fail
# Remove all HTML tags, and leave only text for chardet
text = re.sub(b'(\s*</?[^>]*>)+\s*', b' ', page).strip()
enc = 'utf-8'
if len(text) < 10:
return enc # can't guess
res = chardet.detect(text)
enc = res['encoding'] or 'utf-8'
... | try:
if sys.version_info[0] == 3:
# declared_encoding will actually be bytes but .decode() only
# accepts `str` type. Decode blindly with ascii because no one should
# ever use non-ascii characters in the name of an encoding.
declared_encoding ... | conditional_block |
encoding.py | import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030... |
def get_encoding(page):
# Regex for XML and HTML Meta charset declaration
declared_encodings = (RE_CHARSET.findall(page) +
RE_PRAGMA.findall(page) +
RE_XML.findall(page))
# Try any declared encodings
for declared_encoding in declared_encodings:
try:
if sys... | """Overrides encoding when charset declaration
or charset determination is a subset of a larger
charset. Created because of issues with Chinese websites"""
encoding = encoding.lower()
return CHARSETS.get(encoding, encoding) | identifier_body |
encoding.py | import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
| 'ascii': 'utf-8',
'maccyrillic': 'cp1251',
'win1251': 'cp1251',
'win-1251': 'cp1251',
'windows-1251': 'cp1251',
}
def fix_charset(encoding):
"""Overrides encoding when charset declaration
or charset determination is a subset of a larger
charset. Created because of issues with Chi... | CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030', | random_line_split |
budget_schema.js | module.exports = `
type SimpleBudgetDetail {
account_type: String,
account_name: String,
fund_name: String,
department_name: String,
division_name: String,
costcenter_name: String,
function_name: String,
charcode_name: String,
organization_name: String,
category_name: String,
budget_section_name: ... | budget_section_id: String,
proj_id: String,
is_proposed: String
use_actual: String
}
type SimpleBudgetSummary {
account_type: String,
category_name: String,
year: Int,
total_budget: Float,
total_actual: Float
use_actual: String
}
type BudgetCashFlow {
account_type: String,
category_name: Strin... | div_id: String,
cost_id: String,
func_id: String,
charcode: String,
category_id: String, | random_line_split |
retinanet_segmentation_main.py | # Copyright 2018 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 applica... |
# Run evaluation when there's a new checkpoint
for ckpt in contrib_training.checkpoints_iterator(
FLAGS.model_dir,
min_interval_secs=FLAGS.min_eval_interval,
timeout=FLAGS.eval_timeout,
timeout_fn=terminate_eval):
tf.logging.info('Starting to evaluate.')
try:
... | tf.logging.info('Terminating eval after %d seconds of no checkpoints' %
FLAGS.eval_timeout)
return True | identifier_body |
retinanet_segmentation_main.py | # Copyright 2018 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 applica... |
elif FLAGS.mode == 'train_and_eval':
train_estimator = contrib_tpu.TPUEstimator(
model_fn=retinanet_segmentation_model.segmentation_model_fn,
use_tpu=FLAGS.use_tpu,
train_batch_size=FLAGS.train_batch_size,
config=run_config,
params=params)
eval_estimator = contrib_tp... | tf.logging.info('Starting to evaluate.')
try:
# Note that if the eval_samples size is not fully divided by the
# eval_batch_size. The remainder will be dropped and result in
# differet evaluation performance than validating on the full set.
eval_results = eval_estimator.evaluate(
... | conditional_block |
retinanet_segmentation_main.py | # Copyright 2018 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 applica... | (argv):
del argv # Unused.
if FLAGS.use_tpu:
tpu_cluster_resolver = contrib_cluster_resolver.TPUClusterResolver(
FLAGS.tpu, zone=FLAGS.tpu_zone, project=FLAGS.gcp_project)
tpu_grpc_url = tpu_cluster_resolver.get_master()
tf.Session.reset(tpu_grpc_url)
if FLAGS.mode in ('train',
... | main | identifier_name |
retinanet_segmentation_main.py | # Copyright 2018 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 applica... | 'used when creating the Cloud TPU, or a grpc://ip.address.of.tpu:8470 '
'url.')
flags.DEFINE_string(
'gcp_project', default=None,
help='Project name for the Cloud TPU-enabled project. If not specified, we '
'will attempt to automatically detect the GCE project from metadata.')
flags.DEFINE_string(
... |
# Cloud TPU Cluster Resolvers
flags.DEFINE_string(
'tpu', default=None,
help='The Cloud TPU to use for training. This should be either the name ' | random_line_split |
document.rs | use common::{ApiError, Body, Credentials, Query, discovery_api};
use hyper::method::Method::{Delete, Get, Post};
use serde_json::Value;
pub fn detail(creds: &Credentials,
env_id: &str,
collection_id: &str,
document_id: &str)
-> Result<Value, ApiError> {
let p... | };
Ok(discovery_api(creds, Post, &path, q, &Body::Filename(filename))?)
} | let q = match configuration_id {
Some(id) => Query::Config(id.to_string()),
None => Query::None, | random_line_split |
document.rs | use common::{ApiError, Body, Credentials, Query, discovery_api};
use hyper::method::Method::{Delete, Get, Post};
use serde_json::Value;
pub fn | (creds: &Credentials,
env_id: &str,
collection_id: &str,
document_id: &str)
-> Result<Value, ApiError> {
let path = "/v1/environments/".to_string() + env_id + "/collections/" +
collection_id +
"/documents/" + document_id;
Ok(d... | detail | identifier_name |
document.rs | use common::{ApiError, Body, Credentials, Query, discovery_api};
use hyper::method::Method::{Delete, Get, Post};
use serde_json::Value;
pub fn detail(creds: &Credentials,
env_id: &str,
collection_id: &str,
document_id: &str)
-> Result<Value, ApiError> {
let p... | {
let path = match document_id {
Some(id) => {
"/v1/environments/".to_string() + env_id + "/collections/" +
collection_id + "/documents/" + id
}
None => {
"/v1/environments/".to_string() + env_id + "/collections/" +
collection_id + "/documents"... | identifier_body | |
configuration.component.ts | import { Store, select } from '@ngrx/store';
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ActivationEnd, Router } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { filter, takeUntil, map } from 'rxjs/... | this.unsubscribe$.complete();
}
private subscribeToRouterEvents() {
this.titleService.setTitle(
this.router.routerState.snapshot.root,
this.translate
);
this.router.events
.pipe(
filter(event => event instanceof ActivationEnd),
map((event: ActivationEnd) => event.s... | random_line_split | |
configuration.component.ts | import { Store, select } from '@ngrx/store';
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ActivationEnd, Router } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { filter, takeUntil, map } from 'rxjs/... |
//@ViewChild('increment') increment;
increment($event) {
console.log('incremnent');
console.log($event);
console.log(this);
this.store.dispatch(new ActionIncrement({incCount: 2}));
//this.increment.focus();
}
incrementAsync($event) {
console.log('incremnentas');
console.log($event);
//this.in... | {
console.log(main);
//this.count = main.count;
} | identifier_body |
configuration.component.ts | import { Store, select } from '@ngrx/store';
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ActivationEnd, Router } from '@angular/router';
import { Observable, Subject } from 'rxjs';
import { filter, takeUntil, map } from 'rxjs/... | (main: MainState) {
console.log(main);
//this.count = main.count;
}
//@ViewChild('increment') increment;
increment($event) {
console.log('incremnent');
console.log($event);
console.log(this);
this.store.dispatch(new ActionIncrement({incCount: 2}));
//this.increment.focus();
}
incrementAsync(... | setCount | identifier_name |
call_borders.py | #!/usr/bin/env python
"""
Generate BED files with TAD borders of particular width.
TAD border of width 2r between two TADs is defined as a region consisting of
r bp to the left and r bp to the right of the point separating the two TADs.
Usage:
call_borders.py (-f <TADs_filename> | -d <input_directory>) -w <border_w... |
right_coord = int(line_list[1]) + half_width
border_name = chrom_name + '.border.' + str(i)
score = 0 # Just to fill in the field
strand = '.' # Just to fill in the field
color = '0,255,0' # green
border_line = chrom_name + '\t' + str(left_coord) ... | left_coord = int(line_list[2]) - half_width
i = 0
prev_chrom_name = chrom_name
continue | conditional_block |
call_borders.py | #!/usr/bin/env python
"""
Generate BED files with TAD borders of particular width.
TAD border of width 2r between two TADs is defined as a region consisting of
r bp to the left and r bp to the right of the point separating the two TADs.
Usage:
call_borders.py (-f <TADs_filename> | -d <input_directory>) -w <border_w... | (filename, output_directory, half_width):
name, ext = splitext(filename)
file_basename = basename(name)
if output_directory == '':
file_name = name
else:
file_name = file_basename
output_filename = join(output_directory, file_name + '_borders_' + str(border_width) + '.bed')
... | call_borders | identifier_name |
call_borders.py | #!/usr/bin/env python
"""
Generate BED files with TAD borders of particular width.
TAD border of width 2r between two TADs is defined as a region consisting of
r bp to the left and r bp to the right of the point separating the two TADs.
Usage:
call_borders.py (-f <TADs_filename> | -d <input_directory>) -w <border_w... |
if __name__ == '__main__':
arguments = docopt(__doc__, version='call_borders 0.3')
if arguments["-f"] != None:
filename = arguments["-f"]
if not exists(filename):
print "Error: Can't find BED file with TAD coordinates: no such file '" + \
filename + "'. Exit.\n"
... | name, ext = splitext(filename)
file_basename = basename(name)
if output_directory == '':
file_name = name
else:
file_name = file_basename
output_filename = join(output_directory, file_name + '_borders_' + str(border_width) + '.bed')
prev_chrom_name = ''
with open(filename, '... | identifier_body |
call_borders.py | #!/usr/bin/env python
"""
Generate BED files with TAD borders of particular width.
TAD border of width 2r between two TADs is defined as a region consisting of
r bp to the left and r bp to the right of the point separating the two TADs.
Usage:
call_borders.py (-f <TADs_filename> | -d <input_directory>) -w <border_w... | try:
border_width = int(arguments["-w"])
except ValueError:
print "Error: Border width must be an integer greater than 0. Exit.\n"
sys.exit(1)
if border_width <= 0:
print "Error: Border width must be an integer greater than 0. Exit.\n"
half_width = border_width / 2
i... | if not isdir(input_directory):
print "Error: Input directory must be a directory:). Something else given. Exit.\n"
sys.exit(1)
| random_line_split |
colorSchemeSettingsTab.component.ts | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import deepEqual from 'deep-equal'
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core'
import { ConfigService, PlatformService, TranslateService } from 'tabby-core'
import { TerminalColo... |
update () {
this.currentCustomScheme = this.findMatchingScheme(this.config.store.terminal.colorScheme, this.customColorSchemes)
this.currentStockScheme = this.findMatchingScheme(this.config.store.terminal.colorScheme, this.stockColorSchemes)
this.allColorSchemes = this.customColorSchemes.c... | {
this.config.store.terminal.colorScheme = { ...scheme }
this.config.save()
this.cancelEditing()
this.update()
} | identifier_body |
colorSchemeSettingsTab.component.ts | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import deepEqual from 'deep-equal'
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core'
import { ConfigService, PlatformService, TranslateService } from 'tabby-core'
import { TerminalColo... | () {
this.editing = true
}
saveScheme () {
this.customColorSchemes = this.customColorSchemes.filter(x => x.name !== this.config.store.terminal.colorScheme.name)
this.customColorSchemes.push(this.config.store.terminal.colorScheme)
this.config.store.terminal.customColorSchemes = ... | editScheme | identifier_name |
colorSchemeSettingsTab.component.ts | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import deepEqual from 'deep-equal'
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core'
import { ConfigService, PlatformService, TranslateService } from 'tabby-core'
import { TerminalColo... | })
export class ColorSchemeSettingsTabComponent {
@Input() stockColorSchemes: TerminalColorScheme[] = []
@Input() customColorSchemes: TerminalColorScheme[] = []
@Input() allColorSchemes: TerminalColorScheme[] = []
@Input() filter = ''
@Input() editing = false
colorIndexes = [...new Array(16).key... | /** @hidden */
@Component({
template: require('./colorSchemeSettingsTab.component.pug'),
styles: [require('./colorSchemeSettingsTab.component.scss')],
changeDetection: ChangeDetectionStrategy.OnPush, | random_line_split |
colorSchemeSettingsTab.component.ts | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import deepEqual from 'deep-equal'
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core'
import { ConfigService, PlatformService, TranslateService } from 'tabby-core'
import { TerminalColo... |
}
getCurrentSchemeName () {
return (this.currentCustomScheme ?? this.currentStockScheme)?.name ?? 'Custom'
}
findMatchingScheme (scheme: TerminalColorScheme, schemes: TerminalColorScheme[]) {
return schemes.find(x => deepEqual(x, scheme)) ?? null
}
colorsTrackBy (index) {
... | {
this.customColorSchemes = this.customColorSchemes.filter(x => x.name !== scheme.name)
this.config.store.terminal.customColorSchemes = this.customColorSchemes
this.config.save()
this.update()
} | conditional_block |
0011_auto_20201109_1100.py | # Generated by Django 2.2.11 on 2020-11-09 17:00
import daphne_context.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class | (migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('daphne_context', '0010_userinformation_mycroft_connection'),
]
operations = [
migrations.RemoveField(
model_name='userinformation',
name='mycroft_session',
... | Migration | identifier_name |
0011_auto_20201109_1100.py | # Generated by Django 2.2.11 on 2020-11-09 17:00
import daphne_context.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
| dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('daphne_context', '0010_userinformation_mycroft_connection'),
]
operations = [
migrations.RemoveField(
model_name='userinformation',
name='mycroft_session',
),
migrations... | identifier_body | |
0011_auto_20201109_1100.py | # Generated by Django 2.2.11 on 2020-11-09 17:00
import daphne_context.utils
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | ),
] | fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mycroft_session', models.CharField(default=daphne_context.utils.generate_mycroft_session, max_length=9)),
('user', models.OneToOneField(on_delete=djan... | random_line_split |
asarUtil.ts | import { AsyncTaskManager, log } from "builder-util"
import { FileCopier, Filter, MAX_FILE_REQUESTS } from "builder-util/out/fs"
import { symlink, createReadStream, createWriteStream, Stats } from "fs"
import { writeFile, readFile, mkdir } from "fs/promises"
import * as path from "path"
import { AsarOptions } from "../... |
if (currentDirPath !== fileParent) {
if (fileParent.startsWith("..")) {
throw new Error(`Internal error: path must not start with "..": ${fileParent}`)
}
currentDirPath = fileParent
currentDirNode = this.fs.getOrCreateNode(fileParent)
// do not check for root
... | if (fileParent === ".") {
fileParent = ""
} | random_line_split |
asarUtil.ts | import { AsyncTaskManager, log } from "builder-util"
import { FileCopier, Filter, MAX_FILE_REQUESTS } from "builder-util/out/fs"
import { symlink, createReadStream, createWriteStream, Stats } from "fs"
import { writeFile, readFile, mkdir } from "fs/promises"
import * as path from "path"
import { AsarOptions } from "../... | (filenames: Array<string>, orderingFile: string, src: string) {
const orderingFiles = (await readFile(orderingFile, "utf8")).split("\n").map(line => {
if (line.indexOf(":") !== -1) {
line = line.split(":").pop()!
}
line = line.trim()
if (line[0] === "/") {
line = line.slice(1)
}
re... | order | identifier_name |
asarUtil.ts | import { AsyncTaskManager, log } from "builder-util"
import { FileCopier, Filter, MAX_FILE_REQUESTS } from "builder-util/out/fs"
import { symlink, createReadStream, createWriteStream, Stats } from "fs"
import { writeFile, readFile, mkdir } from "fs/promises"
import * as path from "path"
import { AsarOptions } from "../... | else {
await correctDirNodeUnpackedFlag(fileParent, currentDirNode)
}
}
}
const dirNode = currentDirNode!
const newData = transformedFiles == null ? undefined : transformedFiles.get(i)
const isUnpacked = dirNode.unpacked || (this.unpackPattern != null && this.unpa... | {
currentDirNode.unpacked = true
} | conditional_block |
lpushx.spec.ts | import Store from '../../Store';
import Expires from '../../Expires';
import { lpush } from '../lpush';
import { lpushx } from '../lpushx';
describe('Test lpushx command', () => {
it('should prepend values to list', () => {
const redis = new MockRedis();
redis.set('mylist', []);
expect((<any>redis).lpush... | (key: string, value: any) {
return this.data.set(key, value);
}
}
| set | identifier_name |
lpushx.spec.ts | import Store from '../../Store';
import Expires from '../../Expires';
import { lpush } from '../lpush';
import { lpushx } from '../lpushx';
describe('Test lpushx command', () => {
it('should prepend values to list', () => {
const redis = new MockRedis();
redis.set('mylist', []);
expect((<any>redis).lpush... |
set(key: string, value: any) {
return this.data.set(key, value);
}
}
| {
return this.data.get(key) || null;
} | identifier_body |
lpushx.spec.ts | import Store from '../../Store';
import Expires from '../../Expires';
import { lpush } from '../lpush';
import { lpushx } from '../lpushx';
describe('Test lpushx command', () => {
it('should prepend values to list', () => {
const redis = new MockRedis();
redis.set('mylist', []);
expect((<any>redis).lpush... | });
class MockRedis {
private data: Store;
constructor() {
this.data = new Store(new Expires());
(<any>this)['lpush'] = lpush.bind(this);
(<any>this)['lpushx'] = lpushx.bind(this);
}
get(key: string) {
return this.data.get(key) || null;
}
set(key: string, value: any) {
return this.data.... | }); | random_line_split |
ui.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/. */
//! Generic values for UI properties.
use std::fmt::{self, Write};
use style_traits::cursor::CursorKind;
use styl... |
Ok(())
}
}
/// A generic value for `scrollbar-color` property.
///
/// https://drafts.csswg.org/css-scrollbars-1/#scrollbar-color
#[derive(
Animate,
Clone,
ComputeSquaredDistance,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZ... | {
dest.write_str(" ")?;
x.to_css(dest)?;
dest.write_str(" ")?;
y.to_css(dest)?;
} | conditional_block |
ui.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/. */
//! Generic values for UI properties.
use std::fmt::{self, Write};
use style_traits::cursor::CursorKind;
use styl... | <W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
for image in &*self.images {
image.to_css(dest)?;
dest.write_str(", ")?;
}
self.keyword.to_css(dest)
}
}
/// A generic value for item of `image cursors`.
#[derive(Clone, Debug, Mallo... | to_css | identifier_name |
ui.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/. */
//! Generic values for UI properties.
use std::fmt::{self, Write};
use style_traits::cursor::CursorKind;
use styl... | ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToCss,
)]
pub enum ScrollbarColor<Color> {
/// `auto`
Auto,
/// `<color>{2}`
Colors {
/// First `<color>`, for color of the scrollbar thumb.
thumb: Color,
/// Second `<color>`, for color of the scrollbar track.
... | SpecifiedValueInfo, | random_line_split |
styled.rs | use super::*;
use ascii_canvas::AsciiView;
use std::fmt::{Debug, Error, Formatter};
use style::Style;
pub struct Styled {
style: Style,
content: Box<Content>,
}
impl Styled {
pub fn new(style: Style, content: Box<Content>) -> Self {
Styled {
style: style,
content: content,
... |
fn emit(&self, view: &mut AsciiView) {
self.content.emit(&mut view.styled(self.style))
}
fn into_wrap_items(self: Box<Self>, wrap_items: &mut Vec<Box<Content>>) {
let style = self.style;
super::into_wrap_items_map(self.content, wrap_items, |item| Styled::new(style, item))
}
}
... | {
self.content.min_width()
} | identifier_body |
styled.rs | use super::*;
use ascii_canvas::AsciiView;
use std::fmt::{Debug, Error, Formatter};
use style::Style;
pub struct Styled {
style: Style,
content: Box<Content>, | pub fn new(style: Style, content: Box<Content>) -> Self {
Styled {
style: style,
content: content,
}
}
}
impl Content for Styled {
fn min_width(&self) -> usize {
self.content.min_width()
}
fn emit(&self, view: &mut AsciiView) {
self.content.e... | }
impl Styled { | random_line_split |
styled.rs | use super::*;
use ascii_canvas::AsciiView;
use std::fmt::{Debug, Error, Formatter};
use style::Style;
pub struct Styled {
style: Style,
content: Box<Content>,
}
impl Styled {
pub fn new(style: Style, content: Box<Content>) -> Self {
Styled {
style: style,
content: content,
... | (&self, fmt: &mut Formatter) -> Result<(), Error> {
fmt.debug_struct("Styled")
.field("content", &self.content)
.finish()
}
}
| fmt | identifier_name |
const-impl.rs | #![feature(adt_const_params)]
#![crate_name = "foo"]
#[derive(PartialEq, Eq)]
pub enum Order {
Sorted,
Unsorted,
}
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T... | <const S: &'static str>;
// @has foo/struct.Escape.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<{ r#"<script>alert("Escape");</script>"# }>'
impl Escape<{ r#"<script>alert("Escape");</script>"# }> {
pub fn f() {}
}
| Escape | identifier_name |
const-impl.rs | #![feature(adt_const_params)]
#![crate_name = "foo"]
#[derive(PartialEq, Eq)]
pub enum Order {
Sorted,
Unsorted,
}
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T... | }
// @has foo/struct.VSet.html '//div[@id="impl-1"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, {Order::Unsorted}>'
impl <T> VSet<T, {Order::Unsorted}> {
pub fn new() -> Self {
Self { inner: Vec::new() }
}
}
pub struct Escape<const S: &'static str>;
// @has foo/struct.Escape.html '//div[@id="i... | impl <T> VSet<T, {Order::Sorted}> {
pub fn new() -> Self {
Self { inner: Vec::new() }
} | random_line_split |
dock-spawn-tests.ts | /// <reference path="dock-spawn.d.ts" />
var dockManagerDiv = document.createElement('div'),
panelDiv1 = document.createElement('div'),
panelDiv2 = document.createElement('div'),
panelDiv3 = document.createElement('div');
document.body.appendChild(dockManagerDiv);
var dockManager = new dockspawn.DockMana... |
var documentNode = dockManager.context.model.documentManagerNode;
var panelNode1 = dockManager.dockLeft(documentNode, panelContainer1, 0.33),
panelNode2 = dockManager.dockRight(documentNode, panelContainer2, 0.33),
panelNode3 = dockManager.dockFill(documentNode, panelContainer3); | random_line_split | |
instr_shufps.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
#[test]
fn shufps_1() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XM... | () {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XMM7)), operand2: Some(IndirectScaledIndexedDisplaced(EBX, ESI, Eight, 909533252, Some(OperandSize::Xmmword), None)), operand3: Some(Literal8(46)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: Non... | shufps_2 | identifier_name |
instr_shufps.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
#[test]
fn shufps_1() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XM... |
#[test]
fn shufps_3() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XMM6)), operand2: Some(Direct(XMM1)), operand3: Some(Literal8(66)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 198, 241, 66], OperandSize::Qwo... | {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XMM7)), operand2: Some(IndirectScaledIndexedDisplaced(EBX, ESI, Eight, 909533252, Some(OperandSize::Xmmword), None)), operand3: Some(Literal8(46)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, ... | identifier_body |
instr_shufps.rs | use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
use ::RegType::*;
use ::instruction_def::*;
use ::Operand::*;
use ::Reg::*;
use ::RegScale::*;
use ::test::run_test;
#[test]
fn shufps_1() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XM... |
#[test]
fn shufps_3() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XMM6)), operand2: Some(Direct(XMM1)), operand3: Some(Literal8(66)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 198, 241, 66], OperandSize::Qwor... | #[test]
fn shufps_2() {
run_test(&Instruction { mnemonic: Mnemonic::SHUFPS, operand1: Some(Direct(XMM7)), operand2: Some(IndirectScaledIndexedDisplaced(EBX, ESI, Eight, 909533252, Some(OperandSize::Xmmword), None)), operand3: Some(Literal8(46)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sa... | random_line_split |
TorrentProvider.py | # coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... |
def is_active(self):
return bool(sickbeard.USE_TORRENTS) and self.is_enabled()
@property
def _custom_trackers(self):
if not (sickbeard.TRACKERS_LIST and self.public):
return ''
return '&tr=' + '&tr='.join({x.strip() for x in sickbeard.TRACKERS_LIST.split(',') if x.str... | results = []
db = DBConnection()
placeholder = ','.join([str(x) for x in Quality.DOWNLOADED + Quality.SNATCHED + Quality.SNATCHED_BEST])
sql_results = db.select(
'SELECT s.show_name, e.showid, e.season, e.episode, e.status, e.airdate'
' FROM tv_episodes AS e'
... | identifier_body |
TorrentProvider.py | # coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... | download_url = item[1]
title = item[0]
else:
download_url = ''
title = ''
if title.endswith('DIAMOND'):
logger.log('Skipping DIAMOND release for mass fake releases.')
download_url = title = 'FAKERELEASE'
if download_url:
... |
if not download_url:
download_url = item.get('link', '')
elif isinstance(item, (list, tuple)) and len(item) > 1: | random_line_split |
TorrentProvider.py | # coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... |
if download_url:
download_url = download_url.replace('&', '&')
if title:
title = title.replace(' ', '.')
return title, download_url
def _verify_download(self, file_name=None):
try:
parser = createParser(file_name)
if parser:
... | logger.log('Skipping DIAMOND release for mass fake releases.')
download_url = title = 'FAKERELEASE' | conditional_block |
TorrentProvider.py | # coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... | (self, file_name=None):
try:
parser = createParser(file_name)
if parser:
# pylint: disable=protected-access
# Access to a protected member of a client class
mime_type = parser._getMimeType()
try:
parser... | _verify_download | identifier_name |
web.module.ts | // angular
import { NgModule } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { Http } from '@angular/http';
// libs
import { StoreModule } from '@ngrx/store';
import { EffectsModul... | useValue: '<%= APP_BASE %>'
},
// override with supported languages
{
provide: Languages,
useValue: Config.GET_SUPPORTED_LANGUAGES()
}
],
bootstrap: [MutuaAppComponent]
})
export class WebModule { } | provide: APP_BASE_HREF, | random_line_split |
web.module.ts | // angular
import { NgModule } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { Http } from '@angular/http';
// libs
import { StoreModule } from '@ngrx/store';
import { EffectsModul... | () {
return window;
}
export function storage() {
return localStorage;
}
export function cons() {
return console;
}
export function consoleLogTarget(consoleService: ConsoleService) {
return new ConsoleTarget(consoleService, { minLogLevel: LogLevel.Debug });
}
let DEV_IMPORTS: any[] = [];
if (String('<%= BUILD... | win | identifier_name |
web.module.ts | // angular
import { NgModule } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { Http } from '@angular/http';
// libs
import { StoreModule } from '@ngrx/store';
import { EffectsModul... |
declare var window, console, localStorage;
// For AoT compilation to work:
export function win() {
return window;
}
export function storage() {
return localStorage;
}
export function cons() {
return console;
}
export function consoleLogTarget(consoleService: ConsoleService) {
return new ConsoleTarget(console... | {
Config.PLATFORM_TARGET = Config.PLATFORMS.DESKTOP;
// desktop (electron) must use hash
routerModule = RouterModule.forRoot(MutuaExportedRoutes, { useHash: true });
} | conditional_block |
web.module.ts | // angular
import { NgModule } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { Http } from '@angular/http';
// libs
import { StoreModule } from '@ngrx/store';
import { EffectsModul... |
export function cons() {
return console;
}
export function consoleLogTarget(consoleService: ConsoleService) {
return new ConsoleTarget(consoleService, { minLogLevel: LogLevel.Debug });
}
let DEV_IMPORTS: any[] = [];
if (String('<%= BUILD_TYPE %>') === 'dev') {
DEV_IMPORTS = [
...DEV_IMPORTS,
StoreDevto... | {
return localStorage;
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.