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
test_logdir.py
#!/usr/bin/python import apt_pkg import logging import os import mock import sys import tempfile import unittest sys.path.insert(0, "..") from unattended_upgrade import _setup_logging class MockOptions: dry_run = False debug = False class TestLogdir(unittest.TestCase): def setUp(self): self.tem...
if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) unittest.main()
_setup_logging(self.mock_options) self.assertTrue(os.path.exists(logdir)) self.assertFalse(os.path.exists(logdir2))
random_line_split
setup.py
from setuptools import setup, find_packages setup( name='django-facebook-comments', version=__import__('facebook_comments').__version__, description='Django implementation for Facebook Graph API Comments', long_description=open('README.md').read(), author='ramusus', author_email='ramusus@gmail....
install_requires=[ 'django-facebook-api>=0.5.0', 'django-facebook-users>=0.3.0', 'django-m2m-history>=0.1.2', ], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approv...
zip_safe=False, # because we're including media that Django needs
random_line_split
method-missing-call.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn get_x(&self) -> isize { self.x } } fn main() { let point: Point = Point::new(); let px: isize = point .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` //~^ HELP maybe a `()` to call it is missing // Ensure the s...
{ Point{x:0, y:0} }
identifier_body
method-missing-call.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let ys = &[1,2,3,4,5,6,7]; let a = ys.iter() .map(|x| x) .filter(|&&x| x == 1) .filter_map; //~ ERROR attempted to take value of method `filter_map` on type //~^ HELP maybe a `()` to call it is missing }
let px: isize = point .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` //~^ HELP maybe a `()` to call it is missing // Ensure the span is useful
random_line_split
method-missing-call.rs
// Copyright 2014 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 ...
() -> Point { Point{x:0, y:0} } fn get_x(&self) -> isize { self.x } } fn main() { let point: Point = Point::new(); let px: isize = point .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` //~^ HELP maybe a `()`...
new
identifier_name
lifelines.py
import time import RPi.GPIO as GPIO GPIO.VERSION GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.setup(12,GPIO.OUT) from smbus import SMBus bus = SMBus(1) def read_ain(i): global bus #bus.write_byte_data(0x48, 0x40 | ((i) & 0x03), 0) bus.write_byte(0x48, i) bus.read_byte(0x48)#first 2 are l...
print("Heart Rate Sensor: {0:.0f} BPM\n".format(heartrate)) time.sleep(1)#sec
GPIO.output(11,1) GPIO.output(12,0)
conditional_block
lifelines.py
import time import RPi.GPIO as GPIO GPIO.VERSION GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.setup(12,GPIO.OUT) from smbus import SMBus bus = SMBus(1) def read_ain(i):
while(True): alcohol = read_ain(2)*0.001 heartrate = read_ain(1) print "-------------------------\n" print("Alcohol Sensor: {0:.3f}%".format(alcohol)) if(heartrate<60) or (heartrate>100): GPIO.output(11,0) GPIO.output(12,1) else: GPIO.output(11,1) GPIO.output(12,0) print("Heart Rate S...
global bus #bus.write_byte_data(0x48, 0x40 | ((i) & 0x03), 0) bus.write_byte(0x48, i) bus.read_byte(0x48)#first 2 are last state, and last state repeated. bus.read_byte(0x48) return bus.read_byte(0x48)
identifier_body
lifelines.py
import time import RPi.GPIO as GPIO GPIO.VERSION GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.setup(12,GPIO.OUT) from smbus import SMBus bus = SMBus(1) def read_ain(i): global bus #bus.write_byte_data(0x48, 0x40 | ((i) & 0x03), 0) bus.write_byte(0x48, i) bus.read_byte(0x48)#first 2 are l...
return bus.read_byte(0x48) while(True): alcohol = read_ain(2)*0.001 heartrate = read_ain(1) print "-------------------------\n" print("Alcohol Sensor: {0:.3f}%".format(alcohol)) if(heartrate<60) or (heartrate>100): GPIO.output(11,0) GPIO.output(12,1) else: GPIO.output(11,1) GPIO.output...
random_line_split
lifelines.py
import time import RPi.GPIO as GPIO GPIO.VERSION GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) GPIO.setup(12,GPIO.OUT) from smbus import SMBus bus = SMBus(1) def
(i): global bus #bus.write_byte_data(0x48, 0x40 | ((i) & 0x03), 0) bus.write_byte(0x48, i) bus.read_byte(0x48)#first 2 are last state, and last state repeated. bus.read_byte(0x48) return bus.read_byte(0x48) while(True): alcohol = read_ain(2)*0.001 heartrate = read_ain(1) print ...
read_ain
identifier_name
boundary_modelling.py
from math import pi, sin, cos, tan, sqrt from recordclass import recordclass import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt from functools import reduce def db2a(db): return np.power(10, (db / 20.0)) def a2db(a): return 20 * np.log10(a) def series_coeffs(c): return redu...
(cutoff, sr): wcT = pi * cutoff / sr return 1 / tan(wcT) def get_lopass_coeffs(gain, cutoff, sr): c = get_c(cutoff, sr) a0 = c * c + c * sqrt(2) + 1 b = [gain / a0, 2 * gain / a0, gain / a0] a = [1, (-2 * (c * c - 1)) / a0, (c * c - c * sqrt(2) + 1) / a0] ret...
get_c
identifier_name
boundary_modelling.py
from math import pi, sin, cos, tan, sqrt from recordclass import recordclass import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt from functools import reduce def db2a(db): return np.power(10, (db / 20.0)) def a2db(a): return 20 * np.log10(a) def series_coeffs(c): return redu...
main()
conditional_block
boundary_modelling.py
from math import pi, sin, cos, tan, sqrt from recordclass import recordclass import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt from functools import reduce def db2a(db): return np.power(10, (db / 20.0)) def a2db(a): return 20 * np.log10(a) def series_coeffs(c): return redu...
def impedance_filter(c): num = c[0] den = c[1] summed = [a + b for a, b in zip(den, num)] subbed = [a - b for a, b in zip(den, num)] norm = 1 / subbed[0] summed = [i * norm for i in summed] subbed = [i * norm for i in subbed] return [summed, subbed] def eighth_order_step(i, m, c)...
for m, c in zip(bm, bc): i = biquad_step(i, m, c) return i
identifier_body
boundary_modelling.py
from math import pi, sin, cos, tan, sqrt from recordclass import recordclass import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt from functools import reduce def db2a(db): return np.power(10, (db / 20.0)) def a2db(a): return 20 * np.log10(a) def series_coeffs(c): return redu...
c.append(series_coeffs(c)) # c.append(impedance_filter(c[-1])) wh = [signal.freqz(b, a) for b, a in c] plt.subplot(111) plt.title("Frequency response - reflection filter") for w, h in wh: plt.semilogx(w, 20 * np.log10(np.abs(h))) plt.ylabel('Amplitude Response (dB)') plt.xlabel...
random_line_split
figure_ml_vs_vf.py
#!/usr/bin/env python3 import click import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import numpy as np import pandas as pd prop1range = [0.0, 1.0] # VF prop2range = [0.0, 800.0] # ML num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx fsl = fs = 8 rc('font',**{'family':'sans-serif','...
figure_ml_vs_vf()
conditional_block
figure_ml_vs_vf.py
#!/usr/bin/env python3 import click import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import numpy as np import pandas as pd prop1range = [0.0, 1.0] # VF prop2range = [0.0, 800.0] # ML num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx fsl = fs = 8 rc('font',**{'family':'sans-serif','...
(csv_path): num_bins = 40 # figure has to be a little "oversized" so that mpl makes it big enough to fill a 1-column fig. fig = plt.figure(figsize=(4.5,4.5)) # we only want 5 colors for ch4/uc, where each color is centered at 0,1,2,3,4 +-0.5. cm = matplotlib.cm.get_cmap("viridis",5) points = ...
figure_ml_vs_vf
identifier_name
figure_ml_vs_vf.py
#!/usr/bin/env python3 import click import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import numpy as np import pandas as pd prop1range = [0.0, 1.0] # VF prop2range = [0.0, 800.0] # ML num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx fsl = fs = 8 rc('font',**{'family':'sans-serif','...
ax.tick_params(axis='y', which='major', labelsize=fs) ax.grid(which='major', axis='both', linestyle='-', color='0.9', zorder=0) sc = ax.scatter(points.void_fraction_geo, points.absolute_volumetric_loading, zorder=2, alpha=0.6, s=points.a, edgecolors=None, linewidths=0, c=points.ch4_uc, ...
num_bins = 40 # figure has to be a little "oversized" so that mpl makes it big enough to fill a 1-column fig. fig = plt.figure(figsize=(4.5,4.5)) # we only want 5 colors for ch4/uc, where each color is centered at 0,1,2,3,4 +-0.5. cm = matplotlib.cm.get_cmap("viridis",5) points = pd.read_csv(csv_...
identifier_body
figure_ml_vs_vf.py
#!/usr/bin/env python3 import click import matplotlib import matplotlib.pyplot as plt from matplotlib import rc import numpy as np import pandas as pd prop1range = [0.0, 1.0] # VF prop2range = [0.0, 800.0] # ML num_ch4_a3 = 2.69015E-05 # from methane-comparison.xlsx fsl = fs = 8 rc('font',**{'family':'sans-serif','...
ax.set_xlabel('Void Fraction', fontsize=fsl) ax.set_ylabel('Methane Loading [V/V]', fontsize=fsl) # cb = fig.colorbar(sc, ax=ax) # cb.ax.tick_params(labelsize=fs) output_path = "figure.png" fig.savefig(output_path, dpi=1200, bbox_inches='tight') plt.close(fig) if __name__ == '__main__'...
cmap=cm, vmin=-0.5, vmax=4.5)
random_line_split
JpmtlParser.js
"use strict"; parserFactory.register("jpmtl.com", () => new JpmtlParser()); class JpmtlParser extends Parser{ constructor() { super(); } async getChapterUrls(dom) { let chapters = [...dom.querySelectorAll("a.book-ccontent__content")] return chapters.map(this.linkToChapter); } ...
}
{ [...node.querySelectorAll("svg")] .forEach(p => p.remove()); return node; }
identifier_body
JpmtlParser.js
"use strict"; parserFactory.register("jpmtl.com", () => new JpmtlParser()); class JpmtlParser extends Parser{ constructor() { super(); } async getChapterUrls(dom) { let chapters = [...dom.querySelectorAll("a.book-ccontent__content")] return chapters.map(this.linkToChapter); } ...
} } findChapterTitle(dom) { return dom.querySelector("div.chapter-content__title").textContent; } findCoverImageUrl(dom) { return util.getFirstImgSrc(dom, "div.book-sidebar__cover"); } getInformationEpubItemChildNodes(dom) { return [...dom.querySelectorAll("di...
{ if (text[++index] !== " ") { if (++count === watermarkLength) { paragraph.textContent = paragraph.textContent.substring(index + 1); return; } } }
conditional_block
JpmtlParser.js
"use strict"; parserFactory.register("jpmtl.com", () => new JpmtlParser()); class JpmtlParser extends Parser{ constructor() { super(); } async getChapterUrls(dom) { let chapters = [...dom.querySelectorAll("a.book-ccontent__content")] return chapters.map(this.linkToChapter); } ...
(dom) { return dom.querySelector("div.chapter-content__content"); } extractTitleImpl(dom) { return dom.querySelector("h1.book-sidebar__title"); } removeUnwantedElementsFromContentElement(element) { [...element.querySelectorAll("p")] .filter(p => p.textContent.includ...
findContent
identifier_name
JpmtlParser.js
"use strict"; parserFactory.register("jpmtl.com", () => new JpmtlParser()); class JpmtlParser extends Parser{ constructor() { super(); } async getChapterUrls(dom) { let chapters = [...dom.querySelectorAll("a.book-ccontent__content")] return chapters.map(this.linkToChapter); } ...
} getInformationEpubItemChildNodes(dom) { return [...dom.querySelectorAll("div.main-book__container")]; } cleanInformationNode(node) { [...node.querySelectorAll("svg")] .forEach(p => p.remove()); return node; } }
} findCoverImageUrl(dom) { return util.getFirstImgSrc(dom, "div.book-sidebar__cover");
random_line_split
trigrams.py
#!/usr/bin/env python """Trigrams assignment""" import re import random test_fragment = """ One night--it was on the twentieth of March, 1888--I was returning from a journey to a patient (for I had now returned to civil practice), when my way led me through Baker Street. As I passed the well-remembered door, which mu...
def update_dictlist(dict1, dict2): """Update dict1 in-place using key, values in dict2 if key doesn't yet exist""" for key, item in dict2.iteritems(): if not dict1.has_key(key): dict1.setdefault(key, []).extend(item) else: pass if __name__ == "__main__": # Using ...
""" Split string such that alpha blocks are isalpha; retain whitespace if True example >>>str = "why, hello?!" >>>print split(str) ['why', ',', 'hello', '?', '!'] >>>print str.split() ['why,', 'hello?!'] """ if not retain_whitespace: return re.findall(r"\w+|[^\w\s]", st...
identifier_body
trigrams.py
#!/usr/bin/env python """Trigrams assignment""" import re import random test_fragment = """ One night--it was on the twentieth of March, 1888--I was returning from a journey to a patient (for I had now returned to civil practice), when my way led me through Baker Street. As I passed the well-remembered door, which mu...
(string): """ Generate a trigrams dictionary from a string. This particular version retains punctuation; i.e. it keys verbatim n-word phrases with adjacent non-whitespace punctuation and returns values that may contain ending punctuation as well. """ bits = string.split() trigrams = d...
generate_trigram
identifier_name
trigrams.py
#!/usr/bin/env python """Trigrams assignment""" import re import random test_fragment = """ One night--it was on the twentieth of March, 1888--I was returning from a journey to a patient (for I had now returned to civil practice), when my way led me through Baker Street. As I passed the well-remembered door, which mu...
return " ".join(bits) def read_file_as_string(filename): with open(filename) as file: epic_string = file.read() return epic_string def split_all(string, retain_whitespace=False): """ Split string such that alpha blocks are isalpha; retain whitespace if True example >>>str...
key = " ".join(bits[i: i + 2]) try: alternates = trigrams[key] except (NameError, KeyError): pass else: bits[i + 2] = random.choice(alternates)
conditional_block
trigrams.py
#!/usr/bin/env python """Trigrams assignment""" import re import random test_fragment = """ One night--it was on the twentieth of March, 1888--I was returning from a journey to a patient (for I had now returned to civil practice), when my way led me through Baker Street. As I passed the well-remembered door, which mu...
return " ".join(bits) def read_file_as_string(filename): with open(filename) as file: epic_string = file.read() return epic_string def split_all(string, retain_whitespace=False): """ Split string such that alpha blocks are isalpha; retain whitespace if True example >>>str ...
pass else: bits[i + 2] = random.choice(alternates)
random_line_split
alternate_formats_country_code_set.rs
// Copyright (C) 2015 Guillaume Gomez // // 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 agreed to...
_countryCodeSet.insert(66); _countryCodeSet.insert(81); _countryCodeSet.insert(84); _countryCodeSet.insert(90); _countryCodeSet.insert(91); _countryCodeSet.insert(94); _countryCodeSet.insert(95); _countryCodeSet.insert(255); _countryCodeSet.insert(350); _countryCodeSet.insert(351...
{ // The capacity is set to 57 as there are 43 different entries, // and this offers a load factor of roughly 0.75. let mut _countryCodeSet = HashSet::with_capacity(57); _countryCodeSet.insert(7); _countryCodeSet.insert(27); _countryCodeSet.insert(30); _countryCodeSet.insert(31); _countryCode...
identifier_body
alternate_formats_country_code_set.rs
// Copyright (C) 2015 Guillaume Gomez // // 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 agreed to...
// and this offers a load factor of roughly 0.75. let mut _countryCodeSet = HashSet::with_capacity(57); _countryCodeSet.insert(7); _countryCodeSet.insert(27); _countryCodeSet.insert(30); _countryCodeSet.insert(31); _countryCodeSet.insert(34); _countryCodeSet.insert(36); _countryCodeSet.in...
// The capacity is set to 57 as there are 43 different entries,
random_line_split
alternate_formats_country_code_set.rs
// Copyright (C) 2015 Guillaume Gomez // // 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 agreed to...
() -> HashSet<u32> { // The capacity is set to 57 as there are 43 different entries, // and this offers a load factor of roughly 0.75. let mut _countryCodeSet = HashSet::with_capacity(57); _countryCodeSet.insert(7); _countryCodeSet.insert(27); _countryCodeSet.insert(30); _countryCodeSet.insert(31...
get_country_code_set
identifier_name
Circle.ts
/// <reference path="../../../references.ts" /> /** * Creates a Circle object * * @class Circle */ class Circle { /** * The position (x and y). * The circle position currently goes from the top left of the circle. * This is so when it comes to rendering sprites you won't have to offset * the...
collides(pos: Point, radius: number): boolean; collides(obj: any, radius?:number): boolean { // Is given a rectangle if(obj instanceof Rectangle) { return obj.collides(this); } // Is given a Circle else if(obj instanceof Circle) { return this.colli...
collides(rectangle: Rectangle): boolean; collides(circle: Circle): boolean; collides(pos: Point): boolean;
random_line_split
Circle.ts
/// <reference path="../../../references.ts" /> /** * Creates a Circle object * * @class Circle */ class Circle { /** * The position (x and y). * The circle position currently goes from the top left of the circle. * This is so when it comes to rendering sprites you won't have to offset * the...
(x: number, y: number, radius?: number) { let r1 = this.radius; // Only need second radius for circle on circle collisin let r2 = radius != null ? radius : 0; let bb = this.center().x - x; bb = bb * bb; let cc = this.center().y - y; cc = cc * cc; let d = M...
collision
identifier_name
Circle.ts
/// <reference path="../../../references.ts" /> /** * Creates a Circle object * * @class Circle */ class Circle { /** * The position (x and y). * The circle position currently goes from the top left of the circle. * This is so when it comes to rendering sprites you won't have to offset * the...
// Is not colliding else { return false; } } }
{ return true; }
conditional_block
event-target.js
'use strict'; /** * Class representing an event. * * @private */ class Event { /** * Create a new `Event`. * * @param {String} type The name of the event * @param {Object} target A reference to the target to which the event was dispatched */ constructor(type, target) { this.target = target; ...
function onOpen() { listener.call(this, new OpenEvent(this)); } if (method === 'message') { onMessage._listener = listener; this.on(method, onMessage); } else if (method === 'close') { onClose._listener = listener; this.on(method, onClose); } else if (method === 'err...
{ listener.call(this, new ErrorEvent(error, this)); }
identifier_body
event-target.js
'use strict'; /** * Class representing an event. * * @private */ class Event { /** * Create a new `Event`. * * @param {String} type The name of the event * @param {Object} target A reference to the target to which the event was dispatched */ constructor(type, target) { this.target = target; ...
onError._listener = listener; this.on(method, onError); } else if (method === 'open') { onOpen._listener = listener; this.on(method, onOpen); } else { this.on(method, listener); } }, /** * Remove an event listener. * * @param {String} method A string representing ...
} else if (method === 'error') {
random_line_split
event-target.js
'use strict'; /** * Class representing an event. * * @private */ class Event { /** * Create a new `Event`. * * @param {String} type The name of the event * @param {Object} target A reference to the target to which the event was dispatched */ constructor(type, target) { this.target = target; ...
() { listener.call(this, new OpenEvent(this)); } if (method === 'message') { onMessage._listener = listener; this.on(method, onMessage); } else if (method === 'close') { onClose._listener = listener; this.on(method, onClose); } else if (method === 'error') { onError....
onOpen
identifier_name
it.js
{ "VALIDATOR.FIELDREQUIRED": "Completare il campo \"%s\", che è obbligatorio.", "HASMANYFILEFIELD.UPLOADING": "Invio file... %s", "TABLEFIELD.DELETECONFIRMMESSAGE": "Si è sicuri di voler eliminare questo elemento?", "LOADING": "caricamento...", "UNIQUEFIELD.SUGGESTED": "Cambiare il valore di '%s': %...
"TreeDropdownField.SearchFieldTitle": "Choose or Search" }
"UploadField.Uploaded": "Uploaded", "UploadField.OVERWRITEWARNING": "File with the same name already exists", "TreeDropdownField.ENTERTOSEARCH": "Press enter to search", "TreeDropdownField.OpenLink": "Open", "TreeDropdownField.FieldTitle": "Choose",
random_line_split
Button.tsx
import * as Radium from "radium"; import * as React from "react"; import {ICSSProperties} from "../css_types"; import {AEButton, AECssActive, AECssDisabled, CssActive, CssBase, CssDisabled, CssPBase} from "./css_eb_button"; export interface IButtonProps { /** Callback function to be invoked when button is clicked */...
() { const onClick: any = this.state.isDisabled ? null : this.onClickHandler; const stylesArr: ICSSProperties[] = (this.props.UIType === "AE") ? this.state.isDisabled ? [AEButton, AECssDisabled] : [AEButton, AECssActive] : this.state.isDisabled ? [CssBase, CssDisabled] : [CssBase, CssActive]; ...
render
identifier_name
Button.tsx
import * as Radium from "radium"; import * as React from "react"; import {ICSSProperties} from "../css_types"; import {AEButton, AECssActive, AECssDisabled, CssActive, CssBase, CssDisabled, CssPBase} from "./css_eb_button"; export interface IButtonProps { /** Callback function to be invoked when button is clicked */...
public render() { const onClick: any = this.state.isDisabled ? null : this.onClickHandler; const stylesArr: ICSSProperties[] = (this.props.UIType === "AE") ? this.state.isDisabled ? [AEButton, AECssDisabled] : [AEButton, AECssActive] : this.state.isDisabled ? [CssBase, CssDisabled] : [CssBas...
{ super(props); this.state = { buttonText: props.text || "Button", isDisabled: !!props.disabled, }; this.onClickHandler = this.onClickHandler.bind(this); }
identifier_body
Button.tsx
import * as Radium from "radium"; import * as React from "react"; import {ICSSProperties} from "../css_types";
/** Text to appear on button */ text?: string, /** Specify if button should be non clickable */ disabled?: any, /** Extra parameter to specify if button should be used without styling */ UIType?: string } export interface IButtonState { buttonText?: string isDisabled?: boolean } /** * Button componen...
import {AEButton, AECssActive, AECssDisabled, CssActive, CssBase, CssDisabled, CssPBase} from "./css_eb_button"; export interface IButtonProps { /** Callback function to be invoked when button is clicked */ onClickHandler?: any,
random_line_split
xmlrpc.py
RPC self.__configured = True def register_command(self, command): """Register a command with the server. This will register the command under the name *group_name*.*command_name*. The command's execute method is expected to return a CommandResult, so we need to tu...
https_open
identifier_name
xmlrpc.py
match.split('=', 1)] if key not in allowed: _LOGGER.error("Illegal key in digest auth: {0}".format(key)) return {} if value[0] in ('"', "'"): value = value.replace(value[0], '') attrs[key] = value return attrs class MyRequestHan...
self.__lock.wait()
conditional_block
xmlrpc.py
LOGGER.error( "Illegal digest authentication from {host}".format( host=self._client_address)) self.send_response(400) return nonce = attrs['nonce'] store = _persistence.current_persister() user = credentials...
"""Create session threads. """ _LOGGER.info("Setting %s XML-RPC session(s).", self.__number_threads) for thread_number in range(0, self.__number_threads): thread = SessionThread("XML-RPC-Session-%s" % (thread_number, ), self) try: ...
identifier_body
xmlrpc.py
) def shutdown(self): """Shutdown the server. """ thread = SessionThread.get_reference() assert(thread is not None) if self.__auth_clients_purge_timer: self.__auth_clients_purge_timer.cancel() thread.shutdown() def shutdown_now(self): """Shut...
random_line_split
karma.conf.js
// Karma configuration // Generated on Sat Oct 18 2014 22:09:29 GMT-0400 (EDT) var webpackConfig = require( "./webpack.config.js" ); var _ = require( "lodash" ); _.extend( webpackConfig, { cache: true, watch: false, debug: true, devtool: "inline-source-map"
delete webpackConfig.output; delete webpackConfig.entry; module.exports = function( config ) { config.set( { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: "", // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: [...
} ); var reporters = [ "spec" ];
random_line_split
Popup.js
Main.k.CreatePopup = function() { var popup = {}; popup.dom = $("<td>").attr("id", "usPopup").addClass("usPopup chat_box"); popup.mask = $("<div>").addClass("usPopupMask").attr('onclick','Main.k.ClosePopup();').appendTo(popup.dom); popup.content = $("<div>").addClass("usPopupContent chattext").css({ ...
}; exportFunction(Main.k.ClosePopup, unsafeWindow.Main.k, {defineAs: "ClosePopup"});
{ tgt.focus(); tgt.attr("id", ""); }
conditional_block
PersonOutlineRounded.js
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v2c0 .55.45 1 1 1h14c.55 0 1-.4...
random_line_split
HomeScreen.tsx
import React from 'react'; import { connect } from 'react-redux'; import { View, Text, FlatList } from 'react-native'; import sb from 'react-native-style-block'; import dateHelper from '@shared/utils/date-helper'; import appConfig from '../config.app'; import ConvItem from '../components/ConvItem'; import { reloadConve...
const NetworkContainer = styled(animated.View as any)<{ isOnline: boolean; tryReconnect: boolean; }>` position: absolute; top: -26px; left: 0; right: 0; height: 26px; background-color: ${({ isOnline, tryReconnect }) => isOnline ? '#2ecc71' : tryReconnect ? '#f39c12' : '#c0392b'}; color: white; a...
random_line_split
HomeScreen.tsx
import React from 'react'; import { connect } from 'react-redux'; import { View, Text, FlatList } from 'react-native'; import sb from 'react-native-style-block'; import dateHelper from '@shared/utils/date-helper'; import appConfig from '../config.app'; import ConvItem from '../components/ConvItem'; import { reloadConve...
() { if (_size(this.props.converses) > 0) { const arr: any[] = _sortBy( _values(this.props.converses), (item) => new Date(item.lastTime || 0) ) .reverse() .map((item, index) => { const uuid = item.uuid; const defaultIcon = uuid === 'trpgsys...
getList
identifier_name
HomeScreen.tsx
import React from 'react'; import { connect } from 'react-redux'; import { View, Text, FlatList } from 'react-native'; import sb from 'react-native-style-block'; import dateHelper from '@shared/utils/date-helper'; import appConfig from '../config.app'; import ConvItem from '../components/ConvItem'; import { reloadConve...
else if (item.type === 'group') { const group = this.props.groups.find((g) => g.uuid === uuid); avatar = group ? group.avatar : ''; } return { icon: item.icon || avatar || defaultIcon, title: item.name, content: item.lastMsg, ...
{ avatar = _get(this.props.usercache, [uuid, 'avatar']); }
conditional_block
HomeScreen.tsx
import React from 'react'; import { connect } from 'react-redux'; import { View, Text, FlatList } from 'react-native'; import sb from 'react-native-style-block'; import dateHelper from '@shared/utils/date-helper'; import appConfig from '../config.app'; import ConvItem from '../components/ConvItem'; import { reloadConve...
return { icon: item.icon || avatar || defaultIcon, title: item.name, content: item.lastMsg, time: item.lastTime ? dateHelper.getShortDiff(item.lastTime) : '', uuid, unread: item.unread, onPress: () => { this.han...
{ if (_size(this.props.converses) > 0) { const arr: any[] = _sortBy( _values(this.props.converses), (item) => new Date(item.lastTime || 0) ) .reverse() .map((item, index) => { const uuid = item.uuid; const defaultIcon = uuid === 'trpgsystem...
identifier_body
enter.rs
use crate::errors::Result; use crate::kernel::execve; use crate::kernel::groups::syscall_group_from_sysnum; use crate::kernel::groups::SyscallGroup::*; use crate::kernel::heap::*; use crate::kernel::ptrace::*; use crate::kernel::socket::*; use crate::kernel::standard::*; use crate::process::proot::InfoBag; use crate::p...
(info_bag: &InfoBag, tracee: &mut Tracee) -> Result<()> { let sys_num = tracee.regs.get_sys_num(Original); let sys_type = syscall_group_from_sysnum(sys_num); match sys_type { Accept => accept::enter(), BindConnect => bind_connect::enter(), Brk => brk::enter(), Chdir => chdir...
translate
identifier_name
enter.rs
use crate::errors::Result; use crate::kernel::execve; use crate::kernel::groups::syscall_group_from_sysnum; use crate::kernel::groups::SyscallGroup::*; use crate::kernel::heap::*; use crate::kernel::ptrace::*; use crate::kernel::socket::*; use crate::kernel::standard::*; use crate::process::proot::InfoBag; use crate::p...
PivotRoot => pivot_root::enter(), Ptrace => ptrace::enter(), ReadLink => dir_link_attr::enter(tracee), ReadLinkAt => unlink_mkdir_at::enter(tracee), Rename => link_rename::enter(tracee), RenameAt => rename_at::enter(tracee), SocketCall => socketcall::enter(), ...
{ let sys_num = tracee.regs.get_sys_num(Original); let sys_type = syscall_group_from_sysnum(sys_num); match sys_type { Accept => accept::enter(), BindConnect => bind_connect::enter(), Brk => brk::enter(), Chdir => chdir::enter(tracee), ChmodAccessMkNodAt => chmod_acc...
identifier_body
enter.rs
use crate::errors::Result; use crate::kernel::execve; use crate::kernel::groups::syscall_group_from_sysnum; use crate::kernel::groups::SyscallGroup::*; use crate::kernel::heap::*; use crate::kernel::ptrace::*; use crate::kernel::socket::*; use crate::kernel::standard::*; use crate::process::proot::InfoBag; use crate::p...
RenameAt => rename_at::enter(tracee), SocketCall => socketcall::enter(), StandardSyscall => standard_syscall::enter(tracee), StatAt => stat_at::enter(tracee), SymLink => sym_link::enter(tracee), SymLinkAt => sym_link_at::enter(tracee), Wait => wait::enter(), ...
Rename => link_rename::enter(tracee),
random_line_split
ROGUE.js
import ITEM_QUALITIES from '../ITEM_QUALITIES'; export default { // Shared legendaries SOUL_OF_THE_SHADOWBLADE: { id: 150936, name: 'Soul of the Shadowblade', icon: 'inv_jewelry_ring_56', quality: ITEM_QUALITIES.LEGENDARY, }, MANTLE_OF_THE_MASTER_ASSASSIN: { id: 144236, name: 'Mantle of...
}, THE_CURSE_OF_RESTLESSNESS: { id: 151817, name: 'The Curse of Restlessness', icon: 'inv_qiraj_draperegal', quality: ITEM_QUALITIES.LEGENDARY, }, // Subtlety legendaries SHADOW_SATYRS_WALK: { id: 137032, name: 'Shadow Satyr\'s Walk', icon: 'inv_boots_mail_dungeonmail_c_04', q...
random_line_split
ufcs-explicit-self-bad.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 ...
} struct Bar<T> { f: T, } impl<T> Bar<T> { fn foo(self: Bar<int>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } fn bar(self: &Bar<uint>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } } fn ...
{ //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` self.f + x }
identifier_body
ufcs-explicit-self-bad.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 ...
impl<T> Bar<T> { fn foo(self: Bar<int>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } fn bar(self: &Bar<uint>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } } fn main() { let foo = box Foo { ...
struct Bar<T> { f: T, }
random_line_split
ufcs-explicit-self-bad.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 ...
<T> { f: T, } impl<T> Bar<T> { fn foo(self: Bar<int>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } fn bar(self: &Bar<uint>, x: int) -> int { //~ ERROR mismatched self type //~^ ERROR not a valid type for `self` x } } fn main() { l...
Bar
identifier_name
conversions.py
from pgshovel.interfaces.common_pb2 import ( Column, Row, Snapshot, Timestamp, ) from pgshovel.utilities.conversions import ( RowConverter, to_snapshot, to_timestamp, ) from tests.pgshovel.streams.fixtures import reserialize def test_row_conversion(): converter = RowConverter(sorted=Tr...
def test_snapshot_conversion_in_progress(): assert to_snapshot('1:10:2,3,4') == Snapshot( min=1, max=10, active=[2, 3, 4], ) def test_timetamp_conversion(): assert to_timestamp(1438814328.940597) == Timestamp( seconds=1438814328, nanos=940597057, # this is diffe...
assert to_snapshot('1:10:') == Snapshot( min=1, max=10, )
identifier_body
conversions.py
from pgshovel.interfaces.common_pb2 import ( Column, Row, Snapshot, Timestamp, ) from pgshovel.utilities.conversions import ( RowConverter, to_snapshot, to_timestamp, ) from tests.pgshovel.streams.fixtures import reserialize def test_row_conversion(): converter = RowConverter(sorted=Tr...
(): assert to_timestamp(1438814328.940597) == Timestamp( seconds=1438814328, nanos=940597057, # this is different due to floating point arithmetic )
test_timetamp_conversion
identifier_name
conversions.py
from pgshovel.interfaces.common_pb2 import (
Snapshot, Timestamp, ) from pgshovel.utilities.conversions import ( RowConverter, to_snapshot, to_timestamp, ) from tests.pgshovel.streams.fixtures import reserialize def test_row_conversion(): converter = RowConverter(sorted=True) # maintain sort order for equality checks row = reserial...
Column, Row,
random_line_split
try-dict.py
import plt, ipp import os, string print "Starting try-trace.py: dir() = %s" % dir() # try-trace.py: test program for pypy plt print "- - - - -" print "NO_COMRESSION = %d" % plt.NO_COMPRESSION #base = "/Users/jbro111" # OSX base = "/home/nevil" # Ubuntu #fn = "pypy/small-sample.erf" #fn = "tcp-analyse/fdt-p5...
for n,pkt in enumerate(t): ip = pkt.ip print "--- n=%d ---" % n print "pkt linktype %d, ethertype %04x, vlan_id %d" % ( pkt.linktype, pkt.ethertype, pkt.vlan_id) print "ip.seconds = %.6f, ip.ts_sec = %d, ip.time = %s" % ( ip.seconds, ip.ts_sec, ip.time) print "ip.erf_time = %s"...
for x in range(n): if x%8 == 0: print "", print "%02x" % ord(s[x]),
identifier_body
try-dict.py
import plt, ipp import os, string print "Starting try-trace.py: dir() = %s" % dir() # try-trace.py: test program for pypy plt print "- - - - -" print "NO_COMRESSION = %d" % plt.NO_COMPRESSION #base = "/Users/jbro111" # OSX base = "/home/nevil" # Ubuntu #fn = "pypy/small-sample.erf" #fn = "tcp-analyse/fdt-p5....
print "%8d %s -> %s" % (test_dict[k], ka[0], ka[1])
random_line_split
try-dict.py
import plt, ipp import os, string print "Starting try-trace.py: dir() = %s" % dir() # try-trace.py: test program for pypy plt print "- - - - -" print "NO_COMRESSION = %d" % plt.NO_COMPRESSION #base = "/Users/jbro111" # OSX base = "/home/nevil" # Ubuntu #fn = "pypy/small-sample.erf" #fn = "tcp-analyse/fdt-p5...
if n == 0: # Zero-org break print "EOF - - -" #exit() def ca2str(cdata_array): s = string.join(cdata_array, '') n = string.find(s, '\x00') return s[0:n] keys = sorted(test_dict) for k in keys: print "%8d %s" % (test_dict[k], k) ka = k.split('*') for j in range(0,4): ...
test_dict[s] = v+1
conditional_block
try-dict.py
import plt, ipp import os, string print "Starting try-trace.py: dir() = %s" % dir() # try-trace.py: test program for pypy plt print "- - - - -" print "NO_COMRESSION = %d" % plt.NO_COMPRESSION #base = "/Users/jbro111" # OSX base = "/home/nevil" # Ubuntu #fn = "pypy/small-sample.erf" #fn = "tcp-analyse/fdt-p5...
(s, n): for x in range(n): if x%8 == 0: print "", print "%02x" % ord(s[x]), for n,pkt in enumerate(t): ip = pkt.ip print "--- n=%d ---" % n print "pkt linktype %d, ethertype %04x, vlan_id %d" % ( pkt.linktype, pkt.ethertype, pkt.vlan_id) print "ip.seconds = %...
print_first
identifier_name
wtf.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function(global: any) { interface Wtf { trace: WtfTrace; } interface WtfScope {} interface WtfRange {} ...
( parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, delegate: Function, applyThis: any, applyArgs: any[], source: string): any { let scope = WtfZoneSpec.invokeScope[source]; if (!scope) { scope = WtfZoneSpec.invokeScope[source] = wtfEvents.createScope...
onInvoke
identifier_name
wtf.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function(global: any) { interface Wtf { trace: WtfTrace; } interface WtfScope {} interface WtfRange {} ...
for (const key in obj) { if (obj.hasOwnProperty(key)) { let value = obj[key]; switch (typeof value) { case 'object': const name = value && value.constructor && (<any>value.constructor).name; value = name == (<any>Object).name ? shallowObj(value, depth - 1) : n...
random_line_split
wtf.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function(global: any) { interface Wtf { trace: WtfTrace; } interface WtfScope {} interface WtfRange {} ...
onHandleError( parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, error: any): boolean { return parentZoneDelegate.handleError(targetZone, error); } onScheduleTask( parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone, task: Task): any {...
{ let scope = WtfZoneSpec.invokeScope[source]; if (!scope) { scope = WtfZoneSpec.invokeScope[source] = wtfEvents.createScope(`Zone:invoke:${source}(ascii zone)`); } return wtfTrace.leaveScope( scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targ...
identifier_body
grouped-data-team-monthly.js
module.exports = [ { startDate: '04-01-2021', endDate: '31-01-2021', totalCases: 215, totalPoints: 13523, availablePoints: 16191, contractedHours: '290.3', hoursReduction: '14.9', cmsPoints: -99, gsPoints: 0,
paromsPoints: 228, sdrPoints: 0, sdrConversionPoints: 0, nominalTarget: 21651, capacity: '83.5%', cmsPercentage: '-0.6%', gsPercentage: '0.0%', regionName: 'Region 1', lduName: 'PDU 1', teamName: 'Team 1', omName: 'N/A', grade: 'N/A', daysWithData: 20 }, { sta...
armsTotalCases: 0,
random_line_split
searchbar.js
import React,{Component} from 'react'; import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; import { fetchWheater } from '../actions/index'; class SearchBar extends Component { constructor(props) { super(props); this.state = {term:''}; this.onInputChange = this.onInpu...
() { return ( <form onSubmit={this.onFormSubmit} className="navbar-form navbar-left"> <div className="form-group"> <input value={this.state.term} onChange={this.onInputChange} className="form-control input-search" placeholder="Get a five-day foreca...
render
identifier_name
searchbar.js
import React,{Component} from 'react'; import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; import { fetchWheater } from '../actions/index'; class SearchBar extends Component { constructor(props) { super(props); this.state = {term:''}; this.onInputChange = this.onInpu...
this.props.fetchWheater(this.state.term); this.setState({term:''}); } render() { return ( <form onSubmit={this.onFormSubmit} className="navbar-form navbar-left"> <div className="form-group"> <input value={this.state.term} onChange={this.onInputChange} ...
onFormSubmit(event) { event.preventDefault(); // we need to go and fetch weather data, console.log(event);
random_line_split
searchbar.js
import React,{Component} from 'react'; import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; import { fetchWheater } from '../actions/index'; class SearchBar extends Component { constructor(props)
onInputChange(event) { this.setState({term: event.target.value}); } onFormSubmit(event) { event.preventDefault(); // we need to go and fetch weather data, console.log(event); this.props.fetchWheater(this.state.term); this.setState({term:''}); } render() { return ( ...
{ super(props); this.state = {term:''}; this.onInputChange = this.onInputChange.bind(this); this.onFormSubmit = this.onFormSubmit.bind(this); }
identifier_body
trycmd.py
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
(config): from buildbot.clients import tryclient t = tryclient.Try(config) t.run() return 0
trycmd
identifier_name
trycmd.py
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
from buildbot.clients import tryclient t = tryclient.Try(config) t.run() return 0
identifier_body
trycmd.py
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
# Copyright Buildbot Team Members from __future__ import absolute_import from __future__ import print_function def trycmd(config): from buildbot.clients import tryclient t = tryclient.Try(config) t.run() return 0
# this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #
random_line_split
__init__.py
"""Tests for the canary component.""" from unittest.mock import MagicMock, PropertyMock from canary.api import SensorType def mock_device(device_id, name, is_online=True, device_type_name=None): """Mock Canary Device class.""" device = MagicMock() type(device).device_id = PropertyMock(return_value=device...
(sensor_type, sensor_value): """Mock Canary Reading class.""" reading = MagicMock() type(reading).sensor_type = SensorType(sensor_type) type(reading).value = PropertyMock(return_value=sensor_value) return reading
mock_reading
identifier_name
__init__.py
"""Tests for the canary component.""" from unittest.mock import MagicMock, PropertyMock from canary.api import SensorType def mock_device(device_id, name, is_online=True, device_type_name=None): """Mock Canary Device class.""" device = MagicMock() type(device).device_id = PropertyMock(return_value=device...
type(mode).name = PropertyMock(return_value=name) type(mode).resource_url = PropertyMock(return_value=f"/v1/modes/{mode_id}") return mode def mock_reading(sensor_type, sensor_value): """Mock Canary Reading class.""" reading = MagicMock() type(reading).sensor_type = SensorType(sensor_type) ...
type(mode).mode_id = PropertyMock(return_value=mode_id)
random_line_split
__init__.py
"""Tests for the canary component.""" from unittest.mock import MagicMock, PropertyMock from canary.api import SensorType def mock_device(device_id, name, is_online=True, device_type_name=None): """Mock Canary Device class.""" device = MagicMock() type(device).device_id = PropertyMock(return_value=device...
def mock_reading(sensor_type, sensor_value): """Mock Canary Reading class.""" reading = MagicMock() type(reading).sensor_type = SensorType(sensor_type) type(reading).value = PropertyMock(return_value=sensor_value) return reading
"""Mock Canary Mode class.""" mode = MagicMock() type(mode).mode_id = PropertyMock(return_value=mode_id) type(mode).name = PropertyMock(return_value=name) type(mode).resource_url = PropertyMock(return_value=f"/v1/modes/{mode_id}") return mode
identifier_body
settings.py
import os # Django settings for mysite project. DEBUG = True BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS SITE_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..') DATABASES = { 'default': { 'ENGINE...
'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages' ], 'debug': DEBUG, }, }, ] INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.co...
'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media',
random_line_split
foundation.dropdown.js
; (function($, window, document, undefined) { 'use strict'; Foundation.libs.dropdown = { name: 'dropdown', version: '5.0.0',
is_hover: false, opened: function() {}, closed: function() {} }, init: function(scope, method, options) { Foundation.inherit(this, 'throttle'); this.bindings(method, options); }, events: function(scope) { var self = this; $(this.scope) .off('.dropdow...
settings: { active_class: 'open',
random_line_split
foundation.dropdown.js
; (function($, window, document, undefined) { 'use strict'; Foundation.libs.dropdown = { name: 'dropdown', version: '5.0.0', settings: { active_class: 'open', is_hover: false, opened: function() {}, closed: function() {} }, init: function(scope, method, options) { ...
else { this.close.call(this, $('[data-dropdown-content]')) this.open.call(this, dropdown, target); } }, resize: function() { var dropdown = $('[data-dropdown-content].open'), target = $("[data-dropdown='" + dropdown.attr('id') + "']"); if (dropdown.length && target.l...
{ this.close.call(this, dropdown); }
conditional_block
parallel.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/. */ //! Implements parallel traversals over the DOM and flow trees. //! //! This code is highly unsafe. Keep this file...
}); }, shared_layout_context); }
random_line_split
parallel.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/. */ //! Implements parallel traversals over the DOM and flow trees. //! //! This code is highly unsafe. Keep this file...
} } } /// A parallel top-down flow traversal. trait ParallelPreorderFlowTraversal : PreorderFlowTraversal { fn run_parallel(&self, unsafe_flows: UnsafeFlowList, proxy: &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>); fn should_record_thread_ids(&self...
{ // Stop. break }
conditional_block
parallel.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/. */ //! Implements parallel traversals over the DOM and flow trees. //! //! This code is highly unsafe. Keep this file...
pub type UnsafeFlowList = (Box<Vec<UnsafeNode>>, usize); pub type ChunkedFlowTraversalFunction = extern "Rust" fn(UnsafeFlowList, &mut WorkerProxy<SharedLayoutContext, UnsafeFlowList>); pub type FlowTraversalFunction = extern "Rust" fn(UnsafeFlow, &SharedLayoutContext); /// Information that we need stored in e...
{ unsafe { mem::transmute::<&Flow, UnsafeFlow>(flow) } }
identifier_body
parallel.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/. */ //! Implements parallel traversals over the DOM and flow trees. //! //! This code is highly unsafe. Keep this file...
{ /// The number of children that still need work done. pub children_count: AtomicIsize, /// The address of the parent flow. pub parent: UnsafeFlow, } impl FlowParallelInfo { pub fn new() -> FlowParallelInfo { FlowParallelInfo { children_count: AtomicIsize::new(0), ...
FlowParallelInfo
identifier_name
app.js
define([ 'angular',
'./character/module', './story/module', './universe/module', './core/module' ], function (angular, _, authModule, authorModule, characterModule, storyModule, universeModule, coreModule) { "use strict"; var appModuleName = 'rootApp'; angular.module(appModuleName, [ 'ui.router', ...
'underscore', './auth/module', './author/module',
random_line_split
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
// Authentication js.open_object("authentication")?; if let Some(chosen_security_type) = tx.chosen_security_type { js.set_uint("security_type", chosen_security_type as u64)?; } match tx.chosen_security_type { Some(2) => { js.open_object("vnc")?; if let Some(re...
random_line_split
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
js.close()?; } _ => () } if let Some(security_result) = &tx.tc_security_result { let _ = match security_result.status { 0 => js.set_string("security_result", "OK")?, 1 => js.set_string("security-result", "FAIL")?, 2 => js.set_string("secur...
{ let mut s = String::new(); for &byte in &sr.secret[..] { write!(&mut s, "{:02x}", byte).expect("Unable to write"); } js.set_string("response", &s)?; }
conditional_block
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
js.set_uint("security_type", chosen_security_type as u64)?; } match tx.chosen_security_type { Some(2) => { js.open_object("vnc")?; if let Some(ref sc) = tx.tc_vnc_challenge { let mut s = String::new(); for &byte in &sc.secret[..] { ...
{ js.open_object("rfb")?; // Protocol version if let Some(tx_spv) = &tx.tc_server_protocol_version { js.open_object("server_protocol_version")?; js.set_string("major", &tx_spv.major)?; js.set_string("minor", &tx_spv.minor)?; js.close()?; } if let Some(tx_cpv) = &tx.t...
identifier_body
logger.rs
/* Copyright (C) 2020 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
(_state: &mut RFBState, tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool { let tx = cast_pointer!(tx, RFBTransaction); log_rfb(tx, js).is_ok() }
rs_rfb_logger_log
identifier_name
flagship.js
datasource url this.api = "/dashboard/api/flagship.json"; // select this.graph = undefined; this.table = undefined; this.dashboard = dashboard; // data holder this.data = undefined; if (this.dashboard) { this.margin = {top: 20, right: 20, bottom: 40, left: 100}; this.width = 540 - this.margi...
var time_axis = d3.svg.axis() .scale(this.time_scale) .orient("bottom"); if(this.dashboard) { time_axis.tickFormat(d3.time.format('%-m')); } else { if (split == 'year') { time_axis.tickFormat(d3.time.format('%Y')); } else if (split == 'quarter') { time_axis.tick...
}
random_line_split
flagship.js
datasource url this.api = "/dashboard/api/flagship.json"; // select this.graph = undefined; this.table = undefined; this.dashboard = dashboard; // data holder this.data = undefined; if (this.dashboard) { this.margin = {top: 20, right: 20, bottom: 40, left: 100}; this.width = 540 - this.margin...
/ //
identifier_name
flagship.js
url this.api = "/dashboard/api/flagship.json"; // select this.graph = undefined; this.table = undefined; this.dashboard = dashboard; // data holder this.data = undefined; if (this.dashboard) { this.margin = {top: 20, right: 20, bottom: 40, left: 100}; this.width = 540 - this.margin.left - th...
(split == 'week') { time_axis.tickFormat(d3.time.format('%Y/%m/%d')); } else if (split == 'day') { time_axis.tickFormat(d3.time.format('%Y/%m/%d')); } // ticks var tickValues = []; this.data[0].counts.forEach(function(d) { console.log(d); tickValues.push(n...
time_axis.tickFormat(d3.time.format('%Y/%m')); } else if
conditional_block
flagship.js
url this.api = "/dashboard/ap
// d3 elements this.time_scale = d3.time.scale(); this.count_scale = d3.scale.linear() .range([this.height, 0]); this.color_scale = d3.scale.category20(); this.attachTo(graphSelector, tableSelector); this.load(); } /** * attachTo * */ Flagship.prototype.attachTo = function(graphSelector, tableSe...
i/flagship.json"; // select this.graph = undefined; this.table = undefined; this.dashboard = dashboard; // data holder this.data = undefined; if (this.dashboard) { this.margin = {top: 20, right: 20, bottom: 40, left: 100}; this.width = 540 - this.margin.left - this.margin.right; this.height...
identifier_body
Transition.ts
module n3Charts.Factory { 'use strict'; export class Transition extends Utils.BaseFactory { static defaultDuration: number = 250; static duration: number = Transition.defaultDuration; static ease: string = 'cubic'; static enabled: Boolean = true; off() { Transition.duration = 0; } ...
var delay = 0; t.duration(duration) .delay(delay) .ease(ease); } } }
exit(t: D3.Transition.Transition) { var duration = Transition.duration; var ease = Transition.ease;
random_line_split
Transition.ts
module n3Charts.Factory { 'use strict'; export class
extends Utils.BaseFactory { static defaultDuration: number = 250; static duration: number = Transition.defaultDuration; static ease: string = 'cubic'; static enabled: Boolean = true; off() { Transition.duration = 0; } on() { Transition.duration = Transition.defaultDuration; ...
Transition
identifier_name
Transition.ts
module n3Charts.Factory { 'use strict'; export class Transition extends Utils.BaseFactory { static defaultDuration: number = 250; static duration: number = Transition.defaultDuration; static ease: string = 'cubic'; static enabled: Boolean = true; off() { Transition.duration = 0; } ...
} }
{ var duration = Transition.duration; var ease = Transition.ease; var delay = 0; t.duration(duration) .delay(delay) .ease(ease); }
identifier_body
karma.conf.js
module.exports = function(config) {
// frameworks to use frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ '../src/**/*.js', '../test/**/*.js' ], // list of files to exclude exclude: [ ], // test results reporter to use ...
config.set({ // base path, that will be used to resolve files and exclude //basePath: '../src/',
random_line_split
views.py
# coding: utf-8 from __future__ import unicode_literals from django.conf import settings from django.core.mail import send_mass_mail from django.db import IntegrityError from django.forms import (Form, CharField, TextInput, Textarea, Select, ChoiceField) from django.views.generic import Temp...
return Response({'detail': mail_form.errors}, status=status.HTTP_400_BAD_REQUEST) class POSTMultipleFieldLookupMixin(object): def get_object(self): queryset = self.get_queryset() queryset = self.filter_queryset(queryset) filter = {} for field in sel...
mail_form.send_mail() return Response({'detail': "Okay!"}, status=status.HTTP_200_OK)
conditional_block
views.py
# coding: utf-8 from __future__ import unicode_literals from django.conf import settings from django.core.mail import send_mass_mail from django.db import IntegrityError from django.forms import (Form, CharField, TextInput, Textarea, Select, ChoiceField) from django.views.generic import Temp...
(serializers.ModelSerializer): class Meta: model = Player fields = ('sciper', 'name', 'email', 'contaminations', 'zombie', 'token_spent', 'faction', 'weapon', 'classe', ) class PlayerTokenSerializer(serializers.ModelSerializer): def create(self, validated_data): retur...
PlayerSerializer
identifier_name
views.py
# coding: utf-8 from __future__ import unicode_literals from django.conf import settings from django.core.mail import send_mass_mail from django.db import IntegrityError from django.forms import (Form, CharField, TextInput, Textarea, Select, ChoiceField) from django.views.generic import Temp...
class AdminView(FormView): """ Main view displaying admin panel """ template_name = 'svz/admin.html' form_class = MailForm context_object_name = 'mail_form' class InfoView(TemplateView): template_name = 'svz/index.html' def get_context_data(self): context = super(InfoView, se...
me = self.kwargs['name'] queryset = Player.objects.filter(name__contains=name) return Response(queryset)
identifier_body
views.py
# coding: utf-8 from __future__ import unicode_literals from django.conf import settings from django.core.mail import send_mass_mail from django.db import IntegrityError from django.forms import (Form, CharField, TextInput, Textarea, Select, ChoiceField) from django.views.generic import Temp...
class InfoView(TemplateView): template_name = 'svz/index.html' def get_context_data(self): context = super(InfoView, self).get_context_data() context['sponsors'] = Sponsor.objects.all() context['gazettes'] = Gazette.objects.all() context['rewards'] = Reward.objects.all().order...
Main view displaying admin panel """ template_name = 'svz/admin.html' form_class = MailForm context_object_name = 'mail_form'
random_line_split