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
set_up_android.py
#!/usr/bin/python import os, sys, shutil, collections from optparse import OptionParser # Fix for python 2 try: input = raw_input except NameError: pass def find_recursive(root, subpath, maxdepth=4): queue = collections.deque([(root, 0)]) if 'PATH' in os.environ: envpath = os.environ['PATH'].split(':') ...
(title, option, default, subpath): default = '' if not default else os.path.abspath(default) searchHint = ', "s" to search' while True: path = input('Path to {0}{1} [{2}]:'.format(title, searchHint, default)) or default if len(searchHint) > 0 and path.lower().strip() == 's': found = find_recursive(o...
query_path
identifier_name
set_up_android.py
#!/usr/bin/python import os, sys, shutil, collections from optparse import OptionParser # Fix for python 2 try: input = raw_input except NameError: pass def find_recursive(root, subpath, maxdepth=4): queue = collections.deque([(root, 0)]) if 'PATH' in os.environ: envpath = os.environ['PATH'].split(':') ...
def query_path(title, option, default, subpath): default = '' if not default else os.path.abspath(default) searchHint = ', "s" to search' while True: path = input('Path to {0}{1} [{2}]:'.format(title, searchHint, default)) or default if len(searchHint) > 0 and path.lower().strip() == 's': found = ...
androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android') propsFile = os.path.join(androidRoot, 'local.properties') sdkDir = None ndkDir = None if os.path.exists(propsFile): with open(propsFile, 'r') as f: for line in f: line = line.strip() if line.startswith('sdk...
identifier_body
set_up_android.py
#!/usr/bin/python import os, sys, shutil, collections from optparse import OptionParser # Fix for python 2 try: input = raw_input except NameError: pass def find_recursive(root, subpath, maxdepth=4): queue = collections.deque([(root, 0)]) if 'PATH' in os.environ: envpath = os.environ['PATH'].split(':') ...
fullname = os.path.join(item[0], name) if os.path.isdir(fullname) and '.' not in name: queue.append((fullname, item[1] + 1)) return None def read_local_properties(): androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android') propsFile = os.path.join(androidRoot, 'lo...
random_line_split
set_up_android.py
#!/usr/bin/python import os, sys, shutil, collections from optparse import OptionParser # Fix for python 2 try: input = raw_input except NameError: pass def find_recursive(root, subpath, maxdepth=4): queue = collections.deque([(root, 0)]) if 'PATH' in os.environ: envpath = os.environ['PATH'].split(':') ...
return None def read_local_properties(): androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android') propsFile = os.path.join(androidRoot, 'local.properties') sdkDir = None ndkDir = None if os.path.exists(propsFile): with open(propsFile, 'r') as f: for line in f: line...
item = queue.popleft() if os.path.isfile(os.path.join(item[0], *subpath)): return os.path.abspath(item[0]) if item[1] < maxdepth: for name in os.listdir(item[0]): fullname = os.path.join(item[0], name) if os.path.isdir(fullname) and '.' not in name: queue.append((fullname, ...
conditional_block
mod.rs
stacks_and_queues::bag::Bag; use super::super::fundamentals::stacks_and_queues::{Stack, Queue}; use super::super::fundamentals::stacks_and_queues::linked_stack; use super::super::fundamentals::stacks_and_queues::resizing_array_queue::ResizingArrayQueue; #[derive(Clone, Debug)] pub struct Graph { v: usize, e: u...
pub fn path_to(&self, v: usize) -> Option<Vec<usize>> { if !self.has_path_to(v) { None } else { let mut path = linked_stack::LinkedStack::new(); let mut x = v; while x != self.s { path.push(x); x = self.edge_to[x].unwr...
{ self.marked[v] }
identifier_body
mod.rs
stacks_and_queues::bag::Bag; use super::super::fundamentals::stacks_and_queues::{Stack, Queue}; use super::super::fundamentals::stacks_and_queues::linked_stack; use super::super::fundamentals::stacks_and_queues::resizing_array_queue::ResizingArrayQueue; #[derive(Clone, Debug)] pub struct Graph { v: usize, e: u...
} } fn bfs(&mut self, s: usize) { let mut q = ResizingArrayQueue::new(); q.enqueue(s); self.marked[s] = true; while !q.is_empty() { let v = q.dequeue().unwrap(); for w in self.graph.adj(v) { if !self.marked[w] { ...
{ self.dfs(w); self.edge_to[w] = Some(v); }
conditional_block
mod.rs
stacks_and_queues::bag::Bag; use super::super::fundamentals::stacks_and_queues::{Stack, Queue}; use super::super::fundamentals::stacks_and_queues::linked_stack; use super::super::fundamentals::stacks_and_queues::resizing_array_queue::ResizingArrayQueue; #[derive(Clone, Debug)] pub struct Graph { v: usize, e: u...
(&self, v: usize) -> usize { self.validate_vertex(v); self.adj[v].len() } pub fn max_degree(&self) -> usize { (0 .. self.v()).map(|v| self.degree(v)).max().unwrap_or(0) } pub fn average_degree(&self) -> f64 { // (0 .. self.v()) .map(|v| self.degree(v)).sum::<usize>() as...
degree
identifier_name
mod.rs
::stacks_and_queues::bag::Bag; use super::super::fundamentals::stacks_and_queues::{Stack, Queue}; use super::super::fundamentals::stacks_and_queues::linked_stack; use super::super::fundamentals::stacks_and_queues::resizing_array_queue::ResizingArrayQueue; #[derive(Clone, Debug)] pub struct Graph { v: usize, e:...
} pub fn add_edge(&mut self, v: usize, w: usize) { self.validate_vertex(v); self.validate_vertex(w); self.e += 1; self.adj[v].add(w); self.adj[w].add(v); } // FIXME: should this be a global function pub fn degree(&self, v: usize) -> usize { self.val...
self.e
random_line_split
dat.py
import os.path import gwt from ...weights import W from warnings import warn __author__ = "Myunghwa Hwang <mhwang4@gmail.com>" __all__ = ["DatIO"] class DatIO(gwt.GwtIO): """ Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Ec...
Open .dat file and read it into a pysal weights object >>> w = pysal.open(pysal.examples.get_path('wmat.dat'),'r').read() Get the number of observations from the header >>> w.n 49 Get the mean number of neighbors >>> w.mean_neighbors 4.734693877551020...
random_line_split
dat.py
import os.path import gwt from ...weights import W from warnings import warn __author__ = "Myunghwa Hwang <mhwang4@gmail.com>" __all__ = ["DatIO"] class
(gwt.GwtIO): """ Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Econ library. This DAT format is a simple text file with DAT or dat extension. Without header line, it includes three data columns for origin id, desti...
DatIO
identifier_name
dat.py
import os.path import gwt from ...weights import W from warnings import warn __author__ = "Myunghwa Hwang <mhwang4@gmail.com>" __all__ = ["DatIO"] class DatIO(gwt.GwtIO): """ Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Ec...
id_type = float weights, neighbors = self._readlines(id_type) self.pos += 1 return W(neighbors, weights) def write(self, obj): """ Parameters ---------- .write(weightsObject) accepts a weights object Returns ------ ...
raise StopIteration
conditional_block
dat.py
import os.path import gwt from ...weights import W from warnings import warn __author__ = "Myunghwa Hwang <mhwang4@gmail.com>" __all__ = ["DatIO"] class DatIO(gwt.GwtIO): """ Opens, reads, and writes file objects in DAT format. Spatial weights objects in DAT format are used in Dr. LeSage's MatLab Ec...
Get neighbor distances for a single observation >>> w[1] {2.0: 0.3333, 5.0: 0.3333, 6.0: 0.3333} """ if self.pos > 0: raise StopIteration id_type = float weights, neighbors = self._readlines(id_type) self.pos += 1 return W(neighbor...
"""Reads .dat file Returns a pysal.weights.weights.W object Examples -------- Type 'dir(w)' at the interpreter to see what methods are supported. Open .dat file and read it into a pysal weights object >>> w = pysal.open(pysal.examples.get_path('wmat.dat'),'r').read() ...
identifier_body
DOMRouter-test.js
/** * @jest-environment jsdom */ /* eslint import/extensions: [0, {}] */ /* eslint import/no-unresolved: [0, {}] */ import DOMRouter from 'core/DOMRouter'; describe('DOMRouter', () => { test('can trigger the right controller using data attributes on the <body> tag', async () => { const testController01 = { ...
const testController02 = { init: jest.fn(), doSomethingElseAgain: jest.fn() }; const controllers = { test01: () => testController01, test02: () => testController02 }; const router = new DOMRouter(controllers); // Set up our document body document.body.setAttribute('data-controller', 'test01'); d...
};
random_line_split
list.js
Template.orderListItem.helpers({ //statusName: function(status) { // var names = { // ongoing: '进行', // finished: '完成', // canceled: '终止' // }; // return names[status] || '未知'; //}, statusColor: function () { var colors = { '进行': 'bg-primary', '完成': 'bg-success', '终止'...
Template.orderManagement.onCreated(function () { Session.set('orderManagementSubmitErrors', {}); }); Template.orderManagement.onRendered(function () { var key = this.data.filterKey; //console.log('key: ' + key); this.$('.order-keyword').val(key); var target = $('#add-order'); target.hide(); }); Template.o...
});
random_line_split
list.js
Template.orderListItem.helpers({ //statusName: function(status) { // var names = { // ongoing: '进行', // finished: '完成', // canceled: '终止' // }; // return names[status] || '未知'; //}, statusColor: function () { var colors = { '进行': 'bg-primary', '完成': 'bg-success', '终止'...
ne]').val(data.phone); form.find('[name=address]').val(data.address); form.find('[name=stationId]').val(data.stationId); form.find('[name=comment]').val(data.comment); // 将id保存到隐藏的文本框,表示本次操作会强行覆盖对应的数据库条目 form.find('[name=overlap]').val(_id); }
faultStationId()); form.find('[name=comment]').val(''); // 清空隐藏文本框中保存的数据库条目Id,即清空覆盖标识 form.find('[name=overlap]').val(''); } function fillForm(_id) { var data = Orders.findOne(_id); //console.log('data: ' + JSON.stringify(data)); var form = $('#add-order'); form.find('[name=code]').val(data.code); form.f...
identifier_body
list.js
Template.orderListItem.helpers({ //statusName: function(status) { // var names = { // ongoing: '进行', // finished: '完成', // canceled: '终止' // }; // return names[status] || '未知'; //}, statusColor: function () { var colors = { '进行': 'bg-primary', '完成': 'bg-success', '终止'...
}, stationName: function () { var station = Stations.findOne(this.stationId); return station && station.name; } }); Template.addOrder.helpers({ hasError: function (field) { return !!Session.get('orderManagementSubmitErrors')[field] ? 'has-error' : ''; } }); Template.orderManagement.onCrea...
; } return this.customer;
conditional_block
list.js
Template.orderListItem.helpers({ //statusName: function(status) { // var names = { // ongoing: '进行', // finished: '完成', // canceled: '终止' // }; // return names[status] || '未知'; //}, statusColor: function () { var colors = { '进行': 'bg-primary', '完成': 'bg-success', '终止'...
e); form.find('[name=address]').val(data.address); form.find('[name=stationId]').val(data.stationId); form.find('[name=comment]').val(data.comment); // 将id保存到隐藏的文本框,表示本次操作会强行覆盖对应的数据库条目 form.find('[name=overlap]').val(_id); }
ata.phon
identifier_name
index.js
import Image from 'next/image' import styles from '../styles/Home.module.scss' import About from '../components/About/About' import Header from '../components/Header/Header' import Photo from '../components/Photo/Photo' import { HomeContextProvider } from '../contexts/HomeContext/HomeContext' import Events from '../com...
<Header /> <div className={styles.items}> <About /> <Photo src={casualImg} /> <Photo src={scrumImg} /> <Photo src={presentationImg} /> <Events /> <Photo src={anniversaryImg} /> </div> <Social /> </div> </HomeContextPro...
objectFit="cover" objectPosition="center" /> </div> <div className={styles.scrim} />
random_line_split
index.js
import Image from 'next/image' import styles from '../styles/Home.module.scss' import About from '../components/About/About' import Header from '../components/Header/Header' import Photo from '../components/Photo/Photo' import { HomeContextProvider } from '../contexts/HomeContext/HomeContext' import Events from '../com...
() { return ( <HomeContextProvider> <div className={styles.container}> <div className={styles.bg}> <Image src={bgImg} placeholder="blur" layout="fill" objectFit="cover" objectPosition="center" /> </div> <...
Home
identifier_name
index.js
import Image from 'next/image' import styles from '../styles/Home.module.scss' import About from '../components/About/About' import Header from '../components/Header/Header' import Photo from '../components/Photo/Photo' import { HomeContextProvider } from '../contexts/HomeContext/HomeContext' import Events from '../com...
<Events /> <Photo src={anniversaryImg} /> </div> <Social /> </div> </HomeContextProvider> ) }
{ return ( <HomeContextProvider> <div className={styles.container}> <div className={styles.bg}> <Image src={bgImg} placeholder="blur" layout="fill" objectFit="cover" objectPosition="center" /> </div> <div...
identifier_body
pdfgeom.py
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pdfgeom.py __version__=''' $Id: pdfgeom.py 3959 2012-09-27 14:39:39Z robin $ ''' __doc__=""" This module includes any mathematical methods ...
(x1,y1, x2,y2, startAng=0, extent=90): """bezierArc(x1,y1, x2,y2, startAng=0, extent=90) --> List of Bezier curve control points. (x1, y1) and (x2, y2) are the corners of the enclosing rectangle. The coordinate system has coordinates that increase to the right and down. Angles, measured in degress, start wi...
bezierArc
identifier_name
pdfgeom.py
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pdfgeom.py __version__=''' $Id: pdfgeom.py 3959 2012-09-27 14:39:39Z robin $ ''' __doc__=""" This module includes any mathematical methods ...
else: arcList = [] Nfrag = int(ceil(abs(extent)/90.)) fragAngle = float(extent) / Nfrag x_cen = (x1+x2)/2. y_cen = (y1+y2)/2. rx = (x2-x1)/2. ry = (y2-y1)/2. halfAng = fragAngle * pi / 360. kappa = abs(4. / 3. * (1. - cos(halfAng)) / sin(halfAng)) if...
"""bezierArc(x1,y1, x2,y2, startAng=0, extent=90) --> List of Bezier curve control points. (x1, y1) and (x2, y2) are the corners of the enclosing rectangle. The coordinate system has coordinates that increase to the right and down. Angles, measured in degress, start with 0 to the right (the positive X axis) and...
identifier_body
pdfgeom.py
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pdfgeom.py __version__=''' $Id: pdfgeom.py 3959 2012-09-27 14:39:39Z robin $ ''' __doc__=""" This module includes any mathematical methods ...
return pointList
pointList.append((x_cen + rx * cos(theta0), y_cen - ry * sin(theta0), x_cen + rx * (cos(theta0) + kappa * sin(theta0)), y_cen - ry * (sin(theta0) - kappa * cos(theta0)), x_cen + rx * (cos(theta1) ...
conditional_block
pdfgeom.py
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/pdfgeom.py __version__=''' $Id: pdfgeom.py 3959 2012-09-27 14:39:39Z robin $ ''' __doc__=""" This module includes any mathematical methods ...
for i in range(Nfrag): theta0 = (startAng + i*fragAngle) * pi / 180. theta1 = (startAng + (i+1)*fragAngle) *pi / 180. if fragAngle > 0: pointList.append((x_cen + rx * cos(theta0), y_cen - ry * sin(theta0), x_cen + ...
else: sign = 1 pointList = []
random_line_split
applicable_declarations.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/. */ //! Applicable declarations management. use properties::PropertyDeclarationBlock; use rule_tree::{CascadeLevel, S...
}
random_line_split
applicable_declarations.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/. */ //! Applicable declarations management. use properties::PropertyDeclarationBlock; use rule_tree::{CascadeLevel, S...
fn order(&self) -> u32 { self.0 & SOURCE_ORDER_MASK } fn level(&self) -> CascadeLevel { unsafe { // Transmute rather than shifting so that we're sure the compiler // emits a simple byte-aligned load. let as_bytes: [u8; 4] = mem::transmute(self.0); ...
{ let mut bits = ::std::cmp::min(source_order, SOURCE_ORDER_MAX); bits |= (cascade_level as u8 as u32) << SOURCE_ORDER_BITS; SourceOrderAndCascadeLevel(bits) }
identifier_body
applicable_declarations.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/. */ //! Applicable declarations management. use properties::PropertyDeclarationBlock; use rule_tree::{CascadeLevel, S...
(&self) -> u32 { self.order_and_level.order() } /// Returns the cascade level of the block. #[inline] pub fn level(&self) -> CascadeLevel { self.order_and_level.level() } /// Convenience method to consume self and return the source alongside the /// level. #[inline] ...
source_order
identifier_name
MINISTM32_STRIVE.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
'pin_d13' : 'D8', 'pin_d14' : 'D9', 'pin_d15' : 'D10', 'pin_rd' : 'D4', 'pin_wr' : 'D5', 'pin_cs' : 'D7', 'pin_rs' : 'D11', 'pin_reset' : 'E1', 'pin_bl' : 'D13' }, 'JTAG' : { 'pin_MS' : 'A13',...
'pin_d9' : 'E12', 'pin_d10' : 'E13', 'pin_d11' : 'E14', 'pin_d12' : 'E15',
random_line_split
MINISTM32_STRIVE.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11) return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
identifier_body
MINISTM32_STRIVE.py
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk> # # 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 h...
(): pins = pinutils.scan_pin_file([], 'stm32f103xe.csv', 6, 10, 11) return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
get_pins
identifier_name
auth.py
from annoying.functions import get_object_or_None from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.db.models import Q # Class to permit the authentication using email or username, with case sensitive and insensitive matches. class
(ModelBackend): def authenticate(self, request, username=None, password=None, **kwargs): UserModel = get_user_model() case_sensitive = UserModel.objects.filter(Q(username__exact=username) | Q(email__iexact=username)).distinct() case_insensitive = UserModel.objects.filter(Q(username__iexact=u...
CustomBackend
identifier_name
auth.py
from annoying.functions import get_object_or_None from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.db.models import Q # Class to permit the authentication using email or username, with case sensitive and insensitive matches. class CustomBackend(ModelBack...
return get_object_or_None(get_user_model(), pk=user_id)
identifier_body
auth.py
from annoying.functions import get_object_or_None from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.db.models import Q # Class to permit the authentication using email or username, with case sensitive and insensitive matches.
def authenticate(self, request, username=None, password=None, **kwargs): UserModel = get_user_model() case_sensitive = UserModel.objects.filter(Q(username__exact=username) | Q(email__iexact=username)).distinct() case_insensitive = UserModel.objects.filter(Q(username__iexact=username) | Q(ema...
class CustomBackend(ModelBackend):
random_line_split
auth.py
from annoying.functions import get_object_or_None from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.db.models import Q # Class to permit the authentication using email or username, with case sensitive and insensitive matches. class CustomBackend(ModelBack...
if user and user.check_password(password): return user return None def get_user(self, user_id): return get_object_or_None(get_user_model(), pk=user_id)
count = case_insensitive.count() if count == 1: user = case_insensitive.first()
conditional_block
cmdtext.py
import sys MAX_NUM_STORED_LINES = 200 MAX_NUM_LINES = 10 LINEWIDTH = 80 class CmdText(object): """ Represents a command line text device. Text is split into lines corresponding to the linewidth of the device. """ def __init__(self): """ Construct empty object. """ s...
(): assert len(get_lines("a"*(LINEWIDTH-1))) == 1 def test_get_lines_with_long_string(): assert len(get_lines("a"*(2*LINEWIDTH-1))) == 2 def test_get_lines_with_very_long_string(): assert len(get_lines("a"*(4*LINEWIDTH-1))) == 4 def test_get_lines_with_long_text_string...
test_get_lines_with_short_string
identifier_name
cmdtext.py
import sys MAX_NUM_STORED_LINES = 200 MAX_NUM_LINES = 10 LINEWIDTH = 80 class CmdText(object): """ Represents a command line text device. Text is split into lines corresponding to the linewidth of the device. """ def __init__(self): """ Construct empty object. """ s...
fill = max_len - len(key) sys.stdout.write("Testing {} ...{} ".format(key, '.'*fill)) try: cls.__dict__[key]() except: raise else: print("Test passed!") print("All tests pa...
random_line_split
cmdtext.py
import sys MAX_NUM_STORED_LINES = 200 MAX_NUM_LINES = 10 LINEWIDTH = 80 class CmdText(object): """ Represents a command line text device. Text is split into lines corresponding to the linewidth of the device. """ def __init__(self): """ Construct empty object. """ s...
def print_screen(self): """ Return MAX_NUM_LINES lines. """ return self.lines[-MAX_NUM_LINES:] def __iter__(self): """ Iterator for CmdText object. """ for l in self.lines: yield l def __getitem__(self, ind): ...
raise IndexError("Line index out of range.")
conditional_block
cmdtext.py
import sys MAX_NUM_STORED_LINES = 200 MAX_NUM_LINES = 10 LINEWIDTH = 80 class CmdText(object): """ Represents a command line text device. Text is split into lines corresponding to the linewidth of the device. """ def __init__(self): """ Construct empty object. """ s...
def test_get_lines_with_very_long_string(): assert len(get_lines("a"*(4*LINEWIDTH-1))) == 4 def test_get_lines_with_long_text_string(): text = "This is a test string, which should simulate real text. The command should" \ + " correctly split this text into two lines." ...
assert len(get_lines("a"*(2*LINEWIDTH-1))) == 2
identifier_body
FilterByID_dict_parse.py
: module1 # Purpose: # # Author: Eli # # Created: 06/04/2014 # Copyright: (c) Eli 2014 # Licence: <your licence> #------------------------------------------------------------------------------- def main(): pass if __name__ == '__main__': main() import sys #This script...
elif len(name) > 0: idlist1[name] = [values] #id_count+=1 #if id_count%1000==0: # print id_count ids.close #Debugging code below: #print 'idlist1:', len(idlist1) #sorted(idlist1) #print idlist1 idlist1 = ['miR-216'] data = open("C:/rnaseq/coexpression/mirna-mrna/logfc_pears...
idlist1[name].append(values)
conditional_block
FilterByID_dict_parse.py
: module1 # Purpose: # # Author: Eli # # Created: 06/04/2014 # Copyright: (c) Eli 2014 # Licence: <your licence> #------------------------------------------------------------------------------- def
(): pass if __name__ == '__main__': main() import sys #This script filters a data file by id's listed one per line in another file ids = open("C:/rnaseq/mirna_data/clusters/10rep_redo_deseq-edger/DEseq2_1cpm3redo_nopara2_logFCall.txt", "r") #Take header from ID file & initialize empty dict hea...
main
identifier_name
FilterByID_dict_parse.py
: module1 # Purpose: # # Author: Eli # # Created: 06/04/2014 # Copyright: (c) Eli 2014 # Licence: <your licence> #------------------------------------------------------------------------------- def main(): pass if __name__ == '__main__': main() import sys #This script...
#for item in idlist1[name].split(' '): sys.stdout.write('\t'.join(idlist1[0]) + '\t' + line) #EXCHANGE ID'S BUT KEEP REST OF LINE/DESCRIPTION # sys.stdout.write(descr + '\t' + '\t'.join(idlist1[name]) + '\n') #else: # sys.stdout.write(descr + '\t' + nam...
random_line_split
FilterByID_dict_parse.py
: module1 # Purpose: # # Author: Eli # # Created: 06/04/2014 # Copyright: (c) Eli 2014 # Licence: <your licence> #------------------------------------------------------------------------------- def main():
if __name__ == '__main__': main() import sys #This script filters a data file by id's listed one per line in another file ids = open("C:/rnaseq/mirna_data/clusters/10rep_redo_deseq-edger/DEseq2_1cpm3redo_nopara2_logFCall.txt", "r") #Take header from ID file & initialize empty dict head_ids = ids.r...
pass
identifier_body
file-drop.directive.ts
import { Directive, EventEmitter, ElementRef, HostListener, Input, Output } from '@angular/core'; import { FileUploader } from './file-uploader.class'; @Directive({selector: '[ng2FileDrop]'}) export class FileDropDirective { @Input() public uploader:FileUploader; @Output() public fileOver:EventEmitter<any> = new ...
(types:any):any { if (!types) { return false; } if (types.indexOf) { return types.indexOf('Files') !== -1; } else if (types.contains) { return types.contains('Files'); } else { return false; } } /* _addOverClass(item:any):any { item.addOverClass(); } _remove...
_haveFiles
identifier_name
file-drop.directive.ts
import { Directive, EventEmitter, ElementRef, HostListener, Input, Output } from '@angular/core'; import { FileUploader } from './file-uploader.class'; @Directive({selector: '[ng2FileDrop]'}) export class FileDropDirective { @Input() public uploader:FileUploader; @Output() public fileOver:EventEmitter<any> = new ...
public getFilters():any { return {}; } @HostListener('drop', ['$event']) public onDrop(event:any):void { let transfer = this._getTransfer(event); if (!transfer) { return; } let options = this.getOptions(); let filters = this.getFilters(); this._preventAndStop(event); th...
{ return this.uploader.options; }
identifier_body
file-drop.directive.ts
import { Directive, EventEmitter, ElementRef, HostListener, Input, Output } from '@angular/core'; import { FileUploader } from './file-uploader.class'; @Directive({selector: '[ng2FileDrop]'}) export class FileDropDirective { @Input() public uploader:FileUploader; @Output() public fileOver:EventEmitter<any> = new ...
} /* _addOverClass(item:any):any { item.addOverClass(); } _removeOverClass(item:any):any { item.removeOverClass(); }*/ }
{ return false; }
conditional_block
file-drop.directive.ts
import { Directive, EventEmitter, ElementRef, HostListener, Input, Output } from '@angular/core'; import { FileUploader } from './file-uploader.class'; @Directive({selector: '[ng2FileDrop]'}) export class FileDropDirective { @Input() public uploader:FileUploader; @Output() public fileOver:EventEmitter<any> = new ...
return; } transfer.dropEffect = 'copy'; this._preventAndStop(event); this.fileOver.emit(true); } @HostListener('dragleave', ['$event']) public onDragLeave(event:any):any { if (event.currentTarget === (this as any).element[0]) { return; } this._preventAndStop(event); ...
random_line_split
ExclamationCircle.tsx
/** * @file ExclamationCircle exclamation-circle * @author Auto Generated by IconPark */ /* tslint:disable: max-line-length */ /* eslint-disable max-len */ import React from 'react'; import { ISvgIconProps, IconWrapper } from '../runtime';
export default IconWrapper( 'exclamation-circle', false, (props: ISvgIconProps) => ( <svg t="1561635094775" className="icon" viewBox="0 0 1024 1024" p-id="331919" width={props.size} height={props.size} > <defs /> <path d="M511.650988 930.464894a418.8...
random_line_split
facebook-provider.service.spec.ts
// std import { deepStrictEqual, strictEqual } from 'assert'; import { Server } from 'http'; // 3p import { Config, Context, createApp, createService, Get, HttpResponseBadRequest, HttpResponseOK } from '@foal/core'; // FoalTS import { SocialTokens } from './abstract-provider.service'; import { FacebookProvider } from...
error: 'bad request' }); } }); }); });
} deepStrictEqual(error.error, {
random_line_split
facebook-provider.service.spec.ts
// std import { deepStrictEqual, strictEqual } from 'assert'; import { Server } from 'http'; // 3p import { Config, Context, createApp, createService, Get, HttpResponseBadRequest, HttpResponseOK } from '@foal/core'; // FoalTS import { SocialTokens } from './abstract-provider.service'; import { FacebookProvider } from...
}); it('should send a request with the access token and the default fields and return the response body.', async () => { const userInfo = { email: 'john@foalts.org' }; class AppController { @Get('/users/me') token(ctx: Context) { const { access_token, fields } = ctx.requ...
{ server.close(); }
conditional_block
facebook-provider.service.spec.ts
// std import { deepStrictEqual, strictEqual } from 'assert'; import { Server } from 'http'; // 3p import { Config, Context, createApp, createService, Get, HttpResponseBadRequest, HttpResponseOK } from '@foal/core'; // FoalTS import { SocialTokens } from './abstract-provider.service'; import { FacebookProvider } from...
{ @Get('/users/me') token(ctx: Context) { const { access_token, fields } = ctx.request.query; strictEqual(access_token, 'an_access_token'); strictEqual(fields, 'id,name,email'); return new HttpResponseOK(userInfo); } } server = (await createA...
AppController
identifier_name
wp_page.component.ts
/** * Created by Moiz.Kachwala on 02-06-2016. */ import {Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import {WpUser} from "../../models/wpUser"; import {ProjectService} from "../../services/project.service"; import { Observable } from 'rxjs/Observable'; @Component({
export class WpPageComponent implements OnInit { private users: any[] = []; constructor( private router: Router, private projectService: ProjectService) { } ngOnInit() { this.projectService.getWpUsers() .subscribe((data) => { this.users.push(data); ...
selector: 'my-wppage', templateUrl: './app/components/wpPage/wp_page.component.html', styleUrls: ['./app/components/wpPage/wp_page.component.css'] })
random_line_split
wp_page.component.ts
/** * Created by Moiz.Kachwala on 02-06-2016. */ import {Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; import {WpUser} from "../../models/wpUser"; import {ProjectService} from "../../services/project.service"; import { Observable } from 'rxjs/Observable'; @Component({ selec...
implements OnInit { private users: any[] = []; constructor( private router: Router, private projectService: ProjectService) { } ngOnInit() { this.projectService.getWpUsers() .subscribe((data) => { this.users.push(data); }, err...
WpPageComponent
identifier_name
os_str.rs
// // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. /// The underlyi...
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.
random_line_split
os_str.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self.as_slice(), formatter) } } impl fmt::Display for Buf { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self.as_slice(), formatter) } } impl IntoInner<Vec<u8>> for Buf { fn int...
fmt
identifier_name
os_str.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn push_slice(&mut self, s: &Slice) { self.inner.extend_from_slice(&s.inner) } #[inline] pub fn into_box(self) -> Box<Slice> { unsafe { mem::transmute(self.inner.into_boxed_slice()) } } #[inline] pub fn from_box(boxed: Box<Slice>) -> Buf { let inner: Box<[u8]>...
{ String::from_utf8(self.inner).map_err(|p| Buf { inner: p.into_bytes() } ) }
identifier_body
validator.js
'use strict'; jQuery(function($) { var validator = {form: '#validator', input: '#validator input:text'} var result = {valid: '#9effb1', invalid: '#f01818'} $(validator.input).keyup(function() { if ($(this).val().length > 0) { $(this).css('color', ($(this).isIsbn()) ? result.valid : res...
} return (num % 11 === 0 && num > 0); } }); });
{ cur = isbn.charAt(i); cur = (cur === 'X') ? 10 : cur; num += cur * (10 - i); }
conditional_block
validator.js
'use strict'; jQuery(function($) { var validator = {form: '#validator', input: '#validator input:text'} var result = {valid: '#9effb1', invalid: '#f01818'} $(validator.input).keyup(function() { if ($(this).val().length > 0) { $(this).css('color', ($(this).isIsbn()) ? result.valid : res...
}); $.fn.extend({ isIsbn: function() { var isbn = this.val().replace(/[^0-9X.]/g, ''); var num = 0; var cur = 0; if (isbn.length == 10) { for (var i = 0; i < isbn.length; i++) { cur = isbn.charAt(i); ...
return false;
random_line_split
presale.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
use ethcore::account_provider::{AccountProvider, AccountProviderSettings}; use helpers::{password_prompt, password_from_file}; use params::SpecType; #[derive(Debug, PartialEq)] pub struct ImportWallet { pub iterations: u32, pub path: String, pub spec: SpecType, pub wallet_path: String, pub password_file: Option<S...
random_line_split
presale.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
{ pub iterations: u32, pub path: String, pub spec: SpecType, pub wallet_path: String, pub password_file: Option<String>, } pub fn execute(cmd: ImportWallet) -> Result<String, String> { let password: String = match cmd.password_file { Some(file) => password_from_file(file)?, None => password_prompt()?, }; ...
ImportWallet
identifier_name
presale.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
{ let password: String = match cmd.password_file { Some(file) => password_from_file(file)?, None => password_prompt()?, }; let dir = Box::new(RootDiskDirectory::create(cmd.path).unwrap()); let secret_store = Box::new(EthStore::open_with_iterations(dir, cmd.iterations).unwrap()); let acc_provider = AccountProv...
identifier_body
connectivity-changed.ts
/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
} export function observeConnectivityChanges() { window.addEventListener('offline', onConnectivityChanged); window.addEventListener('online', onConnectivityChanged); } export function unobserveConnectivityChanges() { window.removeEventListener('offline', onConnectivityChanged); window.removeEventListener('on...
{ hideOverlay(); }
conditional_block
connectivity-changed.ts
/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
export function unobserveConnectivityChanges() { window.removeEventListener('offline', onConnectivityChanged); window.removeEventListener('online', onConnectivityChanged); }
{ window.addEventListener('offline', onConnectivityChanged); window.addEventListener('online', onConnectivityChanged); }
identifier_body
connectivity-changed.ts
/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
showOverlay('Currently offline. Please reconnect to the network.'); } else { hideOverlay(); } } export function observeConnectivityChanges() { window.addEventListener('offline', onConnectivityChanged); window.addEventListener('online', onConnectivityChanged); } export function unobserveConnectivityCha...
if (!navigator.onLine) {
random_line_split
connectivity-changed.ts
/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law ...
() { if (!navigator.onLine) { showOverlay('Currently offline. Please reconnect to the network.'); } else { hideOverlay(); } } export function observeConnectivityChanges() { window.addEventListener('offline', onConnectivityChanged); window.addEventListener('online', onConnectivityChanged); } export f...
onConnectivityChanged
identifier_name
converter.ts
/** * Copyright (C) 2017-present Vincent Cheung * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Convert objects to and from their representation in http request. */ export interface Converter<F, T> { convert(value: F): T; }...
(): Converter<any, string> { return new BuiltInJsonSerializer(); } deserializer(): Converter<string, any> { return new BuiltInJsonParser(); } } /** * Built in json serializer used in {@link BuiltInConverterFactory}. */ class BuiltInJsonSerializer implements Converter<any, string> { convert(value: an...
serializer
identifier_name
converter.ts
/** * Copyright (C) 2017-present Vincent Cheung * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Convert objects to and from their representation in http request. */ export interface Converter<F, T> { convert(value: F): T; }...
}
{ return JSON.parse(value); }
identifier_body
converter.ts
/** * Copyright (C) 2017-present Vincent Cheung * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Convert objects to and from their representation in http request.
/** * A converter factory to create serialize and parse {@link Converter}. */ export interface ConverterFactory { /** * Create a serializer to serialize request body. * * @returns serialize converter */ serializer(): Converter<any, string>; /** * Create a deserializer to serialize response body...
*/ export interface Converter<F, T> { convert(value: F): T; }
random_line_split
russian-peasant-by-author-testing-fasting.py
#!/usr/bin/python ## Lecture 6 ## Fasting using a cache as empty dict ##: AKA - Mediation and DUplication ##: ##: Inouts -> two numbers #Output - > the solution to those two numbers # multiplied together using the Russian Peason # 192 x 13 = 2496 import time CACHE = {} def russian(a,b):
print russian(192,13) #2496 # 17 in base 2: 10001 = 17 10001 # >> 1 << 1 ## 1000 = 8 100010 = 34 def test_russian(): start_time = time.time() print russian(357,16) print "Russian Algorithm took %f seconds" % (time.time()-start_time) ...
key = (a,b) # define tuple if key in CACHE: z = CACHE[key] else: print 'Not in Cache' x = a; y = b ## Semicolon -> Compund Statement z = 0 ## Acumulator while x > 0: ## While loop Begins if x % 2 == 1: ...
identifier_body
russian-peasant-by-author-testing-fasting.py
#!/usr/bin/python ## Lecture 6 ## Fasting using a cache as empty dict ##: AKA - Mediation and DUplication ##: ##: Inouts -> two numbers #Output - > the solution to those two numbers # multiplied together using the Russian Peason # 192 x 13 = 2496 import time CACHE = {} def
(a,b): key = (a,b) # define tuple if key in CACHE: z = CACHE[key] else: print 'Not in Cache' x = a; y = b ## Semicolon -> Compund Statement z = 0 ## Acumulator while x > 0: ## While loop Begins if x % ...
russian
identifier_name
russian-peasant-by-author-testing-fasting.py
#!/usr/bin/python ## Lecture 6 ## Fasting using a cache as empty dict ##: AKA - Mediation and DUplication ##: ##: Inouts -> two numbers #Output - > the solution to those two numbers # multiplied together using the Russian Peason # 192 x 13 = 2496 import time CACHE = {} def russian(a,b): key = (a,b) # define tuple...
else: print 'Not in Cache' x = a; y = b ## Semicolon -> Compund Statement z = 0 ## Acumulator while x > 0: ## While loop Begins if x % 2 == 1: z = z + y ## Modulo Operator y = y << 1 ...
z = CACHE[key]
conditional_block
russian-peasant-by-author-testing-fasting.py
#!/usr/bin/python ## Lecture 6 ## Fasting using a cache as empty dict ##: AKA - Mediation and DUplication ##: ##: Inouts -> two numbers #Output - > the solution to those two numbers # multiplied together using the Russian Peason
def russian(a,b): key = (a,b) # define tuple if key in CACHE: z = CACHE[key] else: print 'Not in Cache' x = a; y = b ## Semicolon -> Compund Statement z = 0 ## Acumulator while x > 0: ## While loop Begins ...
# 192 x 13 = 2496 import time CACHE = {}
random_line_split
bootstrap.js
/** * Default admin */ new User({ firstName: 'Admin', lastName: 'Admin', username: 'admin', type: 'admin', password: 'admin', email: 'admin@admin.com', subscribed: false, }).save((u) => { }) /** * Test users */ new User({ firstName: 'Jonathan', lastName: 'Santos', username: ...
firstName: 'Test' + i, lastName: '' + i, username: 'testuser' + i, type: 'user', password: 'test', email: 'test' + i + '@test.br', gender: (i % 2 === 0) ? 'Male' : 'Female', subscribed: true }).save((u) => { UserController.updateUser(u) }) ...
for (i = 0; i < 5; i++) { new User({
random_line_split
bootstrap.js
/** * Default admin */ new User({ firstName: 'Admin', lastName: 'Admin', username: 'admin', type: 'admin', password: 'admin', email: 'admin@admin.com', subscribed: false, }).save((u) => { }) /** * Test users */ new User({ firstName: 'Jonathan', lastName: 'Santos', username: ...
Subscription.findAll().forEach((s) => { s.status = true s.update(s) })
new User({ firstName: 'Test' + i, lastName: '' + i, username: 'testuser' + i, type: 'user', password: 'test', email: 'test' + i + '@test.br', gender: (i % 2 === 0) ? 'Male' : 'Female', subscribed: true }).save((u) => { UserController.updat...
conditional_block
mysql_impl.py
import trove.guestagent.datastore.mysql.service as dbaas from trove.common.i18n import _ # noqa LOG = logging.getLogger(__name__) class MySQLRestoreMixin(object): """Common utils for restoring MySQL databases.""" RESET_ROOT_RETRY_TIMEOUT = 100 RESET_ROOT_SLEEP_INTERVAL = 10 # Reset the root passwo...
(self, init_file, err_log_file): child = pexpect.spawn("sudo mysqld_safe" " --skip-grant-tables" " --skip-networking" " --init-file='%s'" " --log-error='%s'" % (i...
_start_mysqld_safe_with_init_file
identifier_name
mysql_impl.py
import trove.guestagent.datastore.mysql.service as dbaas from trove.common.i18n import _ # noqa LOG = logging.getLogger(__name__) class MySQLRestoreMixin(object): """Common utils for restoring MySQL databases.""" RESET_ROOT_RETRY_TIMEOUT = 100 RESET_ROOT_SLEEP_INTERVAL = 10 # Reset the root passwo...
def _start_mysqld_safe_with_init_file(self, init_file, err_log_file): child = pexpect.spawn("sudo mysqld_safe" " --skip-grant-tables" " --skip-networking" " --init-file='%s'" " --log-err...
try: utils.poll_until(event, sleep_time=self.RESET_ROOT_SLEEP_INTERVAL, time_out=self.RESET_ROOT_RETRY_TIMEOUT) except exception.PollTimeOut: raise exc
identifier_body
mysql_impl.py
import trove.guestagent.datastore.mysql.service as dbaas from trove.common.i18n import _ # noqa LOG = logging.getLogger(__name__) class MySQLRestoreMixin(object): """Common utils for restoring MySQL databases.""" RESET_ROOT_RETRY_TIMEOUT = 100 RESET_ROOT_SLEEP_INTERVAL = 10 # Reset the root passwo...
args = { 'restore_location': self.restore_location, 'incremental_args': incremental_arg, } return self.incremental_prep % args def _incremental_prepare(self, incremental_dir): prepare_cmd = self._incremental_prepare_cmd(incremental_dir) LOG.debug("...
incremental_arg = ''
conditional_block
mysql_impl.py
import trove.guestagent.datastore.mysql.service as dbaas from trove.common.i18n import _ # noqa LOG = logging.getLogger(__name__) class MySQLRestoreMixin(object): """Common utils for restoring MySQL databases.""" RESET_ROOT_RETRY_TIMEOUT = 100 RESET_ROOT_SLEEP_INTERVAL = 10 # Reset the root passwo...
# This is a suffix MySQL appends to the file name given in # the '--log-error' startup parameter. _ERROR_LOG_SUFFIX = '.err' _ERROR_MESSAGE_PATTERN = re.compile("^ERROR:\s+.+$") def mysql_is_running(self): try: utils.execute_with_timeout("/usr/bin/mysqladmin", "ping") ...
"COMMIT;")
random_line_split
app.ts
/// <reference path='./Scripts/DlhSoft.ProjectData.GanttChart.HTML.Controls.d.ts'/> import GanttChartView = DlhSoft.Controls.GanttChartView; import GanttChartItem = GanttChartView.Item; import PredecessorItem = GanttChartView.PredecessorItem; import NetworkDiagramView = DlhSoft.Controls.Pert.NetworkDiagramView; import...
var theme = queryString ? queryString.substr(1) : null; declare var initializeGanttChartTemplates; declare var initializeGanttChartTheme; declare var initializePertChartTemplates; declare var initializePertChartTheme; // Retrieve and store the control and container elements for reference purposes. var ganttChartViewCo...
// Query string syntax: ?theme // Supported themes: Default, Generic-bright, Generic-blue, DlhSoft-gray, Purple-green, Steel-blue, Dark-black, Cyan-green, Blue-navy, Orange-brown, Teal-green, Purple-beige, Gray-blue, Aero. var queryString = window.location.search;
random_line_split
app.ts
/// <reference path='./Scripts/DlhSoft.ProjectData.GanttChart.HTML.Controls.d.ts'/> import GanttChartView = DlhSoft.Controls.GanttChartView; import GanttChartItem = GanttChartView.Item; import PredecessorItem = GanttChartView.PredecessorItem; import NetworkDiagramView = DlhSoft.Controls.Pert.NetworkDiagramView; import...
{ networkDiagramViewContainerElement.style.display = 'none'; ganttChartViewContainerElement.style.display = null; }
deNetworkDiagram()
identifier_name
app.ts
/// <reference path='./Scripts/DlhSoft.ProjectData.GanttChart.HTML.Controls.d.ts'/> import GanttChartView = DlhSoft.Controls.GanttChartView; import GanttChartItem = GanttChartView.Item; import PredecessorItem = GanttChartView.PredecessorItem; import NetworkDiagramView = DlhSoft.Controls.Pert.NetworkDiagramView; import...
networkDiagramViewContainerElement.style.display = 'none'; ganttChartViewContainerElement.style.display = null; }
identifier_body
shift_request.py
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import formatdate, getdate class Overla...
(self): shift_assignment_list = frappe.get_list("Shift Assignment", {'employee': self.employee, 'shift_request': self.name}) if shift_assignment_list: for shift in shift_assignment_list: shift_assignment_doc = frappe.get_doc("Shift Assignment", shift['name']) shift_assignment_doc.cancel() def validate_...
on_cancel
identifier_name
shift_request.py
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import formatdate, getdate class Overla...
def validate_default_shift(self): default_shift = frappe.get_value("Employee", self.employee, "default_shift") if self.shift_type == default_shift: frappe.throw(_("You can not request for your Default Shift: {0}").format(frappe.bold(self.shift_type))) def validate_approver(self): department = frappe.get_v...
for shift in shift_assignment_list: shift_assignment_doc = frappe.get_doc("Shift Assignment", shift['name']) shift_assignment_doc.cancel()
conditional_block
shift_request.py
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import formatdate, getdate class Overla...
assignment_doc.shift_request = self.name assignment_doc.insert() assignment_doc.submit() frappe.msgprint(_("Shift Assignment: {0} created for Employee: {1}").format(frappe.bold(assignment_doc.name), frappe.bold(self.employee))) def on_cancel(self): shift_assignment_list = frappe.get_list("Shift Assignm...
if self.to_date: assignment_doc.end_date = self.to_date
random_line_split
shift_request.py
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import formatdate, getdate class Overla...
def validate_default_shift(self): default_shift = frappe.get_value("Employee", self.employee, "default_shift") if self.shift_type == default_shift: frappe.throw(_("You can not request for your Default Shift: {0}").format(frappe.bold(self.shift_type))) def validate_approver(self): department = frappe.get_v...
shift_assignment_list = frappe.get_list("Shift Assignment", {'employee': self.employee, 'shift_request': self.name}) if shift_assignment_list: for shift in shift_assignment_list: shift_assignment_doc = frappe.get_doc("Shift Assignment", shift['name']) shift_assignment_doc.cancel()
identifier_body
update-project.ts
// Third party modules import { firestore, Change, EventContext } from 'firebase-functions'; // Dashboard hub firebase functions models/mappers import { Logger } from '../client/logger'; import { RepositoryModel } from '../models/index.model'; import { DocumentData, DocumentSnapshot, WriteResult } from './../client/fi...
for (const item of add) { const repoData: DocumentData = (await RepositoryModel.getRepositoryReference(item).get()).data(); if (Array.isArray(repoData.projects)) { const foundIndex: number = repoData.projects.findIndex((element: string) => element === projectUid); if (foundIndex === -1) { ...
{ add = []; remove = isArrayPreviousDataRepositories ? previousData.repositories : []; }
conditional_block
update-project.ts
// Third party modules import { firestore, Change, EventContext } from 'firebase-functions'; // Dashboard hub firebase functions models/mappers import { Logger } from '../client/logger'; import { RepositoryModel } from '../models/index.model'; import { DocumentData, DocumentSnapshot, WriteResult } from './../client/fi...
} catch (err) { Logger.error(err); throw new Error(err); } });
const newData: DocumentData = change.after.data(); const previousData: DocumentData = change.before.data(); return updateRepositories(context.params.projectUid, newData, previousData);
random_line_split
update-project.ts
// Third party modules import { firestore, Change, EventContext } from 'firebase-functions'; // Dashboard hub firebase functions models/mappers import { Logger } from '../client/logger'; import { RepositoryModel } from '../models/index.model'; import { DocumentData, DocumentSnapshot, WriteResult } from './../client/fi...
(projectUid: string, newData: DocumentData, previousData: DocumentData): Promise<WriteResult[]> { const isArrayNewDataRepositories: boolean = Array.isArray(newData.repositories) && newData.repositories.length > 0; const isArrayPreviousDataRepositories: boolean = Array.isArray(previousData.repositories) && previousD...
updateRepositories
identifier_name
update-project.ts
// Third party modules import { firestore, Change, EventContext } from 'firebase-functions'; // Dashboard hub firebase functions models/mappers import { Logger } from '../client/logger'; import { RepositoryModel } from '../models/index.model'; import { DocumentData, DocumentSnapshot, WriteResult } from './../client/fi...
for (const item of add) { const repoData: DocumentData = (await RepositoryModel.getRepositoryReference(item).get()).data(); if (Array.isArray(repoData.projects)) { const foundIndex: number = repoData.projects.findIndex((element: string) => element === projectUid); if (foundIndex === -1) { ...
{ const isArrayNewDataRepositories: boolean = Array.isArray(newData.repositories) && newData.repositories.length > 0; const isArrayPreviousDataRepositories: boolean = Array.isArray(previousData.repositories) && previousData.repositories.length > 0; let add: string[], remove: string[]; const promiseList: Promis...
identifier_body
kernel_ridge_regression.py
from pylab import figure,pcolor,scatter,contour,colorbar,show,subplot,plot,connect from numpy import array,meshgrid,reshape,linspace,min,max from numpy import concatenate,transpose,ravel from modshogun import * from modshogun import * from modshogun import * import util util.set_title('KernelRidgeRegression') width=2...
krr.set_kernel(gk) krr.set_tau(1e-3) krr.train() # compute output plot iso-lines x, y, z=util.compute_output_plot_isolines(krr, gk, train, regression=True) pcolor(x, y, z, shading='interp') contour(x, y, z, linewidths=1, colors='black', hold=True) connect('key_press_event', util.quit) show()
krr.set_labels(labels)
random_line_split
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from distutils.core import setup setup(name = "palabre", version = "0.6b", description = "XML Socket Python Server", long_description = "Flash XML Multiuser Socket Server", author = "Célio Conort", author_email = "palabre-dev@lists...
("doc",["doc/README.txt"]), ("./",["AUTHORS","COPYING","MANIFEST","MANIFEST.in","PKG-INFO"]), ("/usr/local/share/doc/palabre", ["doc/README.txt"]) ] )
),
random_line_split
Main.js
/* * /MathJax/jax/output/SVG/fonts/TeX/Fraktur/Bold/Main.js * * Copyright (c) 2009-2015 The MathJax Consortium * * 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
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the ...
* * http://www.apache.org/licenses/LICENSE-2.0
random_line_split
Flyby.py
import Gears as gears from .. import * try: from OpenGL.GL import * from OpenGL.GLU import * except: print ('ERROR: PyOpenGL not installed properly.') import random def box() : glBegin(GL_QUADS) glColor3f(0.0,1.0,0.0) glVertex3f(1.0, 1.0,-1.0) glVertex3f(-1.0, 1.0,-1.0) glVertex3f(-1.0, 1....
def finish( self, event ): glDeleteLists(self.glist, 1) def render(self, iFrame): glEnable(GL_DEPTH_TEST) glDepthMask(GL_TRUE); glClearColor(0.0, 0.0, 0.0, 1.0 ) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_PROJECTION) glLoadIdenti...
print('hello start flyby') self.glist = glGenLists(1) glNewList(self.glist, GL_COMPILE) for i in range(0, 400) : glPushMatrix() glTranslated( random.uniform( a = -20, b = 20), random.uniform( a = -20, b = 20), ra...
identifier_body
Flyby.py
import Gears as gears from .. import * try: from OpenGL.GL import * from OpenGL.GLU import * except: print ('ERROR: PyOpenGL not installed properly.') import random def box() : glBegin(GL_QUADS) glColor3f(0.0,1.0,0.0) glVertex3f(1.0, 1.0,-1.0) glVertex3f(-1.0, 1.0,-1.0) glVertex3f(-1.0, 1....
glEndList() def finish( self, event ): glDeleteLists(self.glist, 1) def render(self, iFrame): glEnable(GL_DEPTH_TEST) glDepthMask(GL_TRUE); glClearColor(0.0, 0.0, 0.0, 1.0 ) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_PROJECTION) ...
glPushMatrix() glTranslated( random.uniform( a = -20, b = 20), random.uniform( a = -20, b = 20), random.uniform( a = -20, b = 20), ) box() glPopMatrix()
conditional_block
Flyby.py
import Gears as gears from .. import * try: from OpenGL.GL import * from OpenGL.GLU import * except: print ('ERROR: PyOpenGL not installed properly.') import random def box() : glBegin(GL_QUADS) glColor3f(0.0,1.0,0.0) glVertex3f(1.0, 1.0,-1.0) glVertex3f(-1.0, 1.0,-1.0) glVertex3f(-1.0, 1....
(self, stimulus) : self.applyWithArgs(stimulus, **self.args) def applyWithArgs( self, stimulus, ) : stimulus.enableColorMode() stimulus.setForwardRenderingCallback(self.render) stimulus.registerCallback(gears.StimulusStartEvent.typeId, self.start)...
apply
identifier_name
Flyby.py
import Gears as gears from .. import * try: from OpenGL.GL import * from OpenGL.GLU import * except: print ('ERROR: PyOpenGL not installed properly.') import random def box() :
glVertex3f(-1.0, 1.0,-1.0) glVertex3f(-1.0, 1.0, 1.0) glVertex3f(1.0, 1.0, 1.0) glColor3f(1.0,0.5,0.0) glVertex3f(1.0,-1.0, 1.0) glVertex3f(-1.0,-1.0, 1.0) glVertex3f(-1.0,-1.0,-1.0) glVertex3f(1.0,-1.0,-1.0) glColor3f(1.0,0.0,0.0) glVertex3f(1.0, 1.0, 1.0) glVertex3f(-1.0, 1...
glBegin(GL_QUADS) glColor3f(0.0,1.0,0.0) glVertex3f(1.0, 1.0,-1.0)
random_line_split
eagleplatform.py
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, ) class EaglePlatformIE(InfoExtractor): _VALID_URL = r'''(?x) (?: eagleplatform:(?P<custom_host>[^/]+):| ...
elf._download_json( media['sources']['secure_m3u8']['auto'], video_id, 'Downloading m3u8 JSON') formats = self._extract_m3u8_formats( m3u8_data['data'][0], video_id, 'mp4', entry_protocol='m3u8_native') self._sort_formats(formats) return { ...
striction == 'allow_all' else 18 m3u8_data = s
conditional_block
eagleplatform.py
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, ) class EaglePlatformIE(InfoExtractor): _VALID_URL = r'''(?x) (?: eagleplatform:(?P<custom_host>[^/]+):| ...
n(self, url_or_request, video_id, note='Downloading JSON metadata'): response = super(EaglePlatformIE, self)._download_json(url_or_request, video_id, note) self._handle_error(response) return response def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) host, ...
sponse.get('status', 200)) if status != 200: raise ExtractorError(' '.join(response['errors']), expected=True) def _download_jso
identifier_body
eagleplatform.py
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, ) class EaglePlatformIE(InfoExtractor): _VALID_URL = r'''(?x) (?: eagleplatform:(?P<custom_host>[^/]+):| ...
'title': title, 'description': description, 'thumbnail': thumbnail, 'duration': duration, 'view_count': view_count, 'age_limit': age_limit, 'formats': formats, }
self._sort_formats(formats) return { 'id': video_id,
random_line_split
eagleplatform.py
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, ) class
(InfoExtractor): _VALID_URL = r'''(?x) (?: eagleplatform:(?P<custom_host>[^/]+):| https?://(?P<host>.+?\.media\.eagleplatform\.com)/index/player\?.*\brecord_id= ) (?P<id>\d+) ''' _TESTS = ...
EaglePlatformIE
identifier_name
config-test.js
var expect = require('chai').expect; var assert = require('chai').assert; var sinon = require('sinon'); var Config = require('../lib/config'); describe('config', function() { describe('#constructor', function() { it('creates a new object with the config defaults', function() { sinon.spy(Config.prototyp...
}); expect(config.source).to.equal('./foo'); expect(config.destination).to.equal('./bar'); // a default expect(config.env).to.equal('production'); // a new value expect(config.fizz).to.equal('buzz'); }); it('always includes certain default, even if overridden', func...
config.set({ source: './foo', destination: './bar', fizz: 'buzz'
random_line_split