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
node_curves.py
Dr. D Studios - Software Disclaimer # # Copyright 2009 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios), its # affiliates and/or its licensors. # ############################################################################### """ This module will help TD's to convert houdini animation curve to nuke or maya ...
class NodeCurves(): """ Creating houdini curve node class *Parents:* None *Children:* * :func:`getCurves` * :func:`animCurvesFromNode` """ def __init__(self): """ Base init function for houdini cuve create Class. """ self.supported_tan...
rodin_logger = logging.get_logger('kipHoudini') GLOBAL_FPS = 24 GLOBAL_TIME = 1
random_line_split
node_curves.py
Dr. D Studios - Software Disclaimer # # Copyright 2009 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios), its # affiliates and/or its licensors. # ############################################################################### """ This module will help TD's to convert houdini animation curve to nuke or maya ...
for each_prm in all_parms: if each_prm.isTimeDependent(): if len(each_prm.keyframes()) > 0: curve_dict = {} if not curve_dict.has_key(each_prm.name()): curve_dict[each_prm.name()]=each_prm.keyfram...
""" This is simple function for grabing all animation curve from a houdini node. .. note:: This function is checking data is isTimeDependent command so if any kind of curve attached to a node with frame data it will treate as a animation curve. :param node_path: houdini node path ...
identifier_body
node_curves.py
Dr. D Studios - Software Disclaimer # # Copyright 2009 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios), its # affiliates and/or its licensors. # ############################################################################### """ This module will help TD's to convert houdini animation curve to nuke or maya ...
(): """ Creating houdini curve node class *Parents:* None *Children:* * :func:`getCurves` * :func:`animCurvesFromNode` """ def __init__(self): """ Base init function for houdini cuve create Class. """ self.supported_tan_types = ["splin...
NodeCurves
identifier_name
globalconnect.d.ts
declare module "diagram-js/lib/features/global-connect/GlobalConnect" { import EventBus from "diagram-js/lib/core/EventBus"; import { Base } from "diagram-js/lib/model"; import Canvas from "diagram-js/lib/core/Canvas"; import Dragging from "diagram-js/lib/features/dragging/Dragging"; export default class Glo...
export interface IGlobalConnectProvider { /** * Check if source shape can initiate connection. * * @param {Base} startTarget * @return {Boolean} */ canStartConnect(startTarget: Base): boolean; } }
}
random_line_split
globalconnect.d.ts
declare module "diagram-js/lib/features/global-connect/GlobalConnect" { import EventBus from "diagram-js/lib/core/EventBus"; import { Base } from "diagram-js/lib/model"; import Canvas from "diagram-js/lib/core/Canvas"; import Dragging from "diagram-js/lib/features/dragging/Dragging"; export default class
{ public _dragging: Dragging; constructor(eventBus: EventBus, dragging: {}, connect: {}, canvas: Canvas, toolManager: {}); public registerProvider(provider: IGlobalConnectProvider): void; public isActive(): boolean; public toggle(): void; /** * Initiates tool activity. */ publi...
GlobalConnect
identifier_name
send_via_pyxmpp.py
#!/usr/bin/python3 # https://bugzilla.altlinux.org/show_bug.cgi?id=33532 #!/usr/bin/env -S python3 -u # -*- coding: utf-8 -*- # # A simple message-sending script # TODO: When error: No handlers could be found for logger "pyxmpp.Client" import os, sys # python-module-pyxmpp from pyxmpp2.jid import JID from pyxmpp2.ja...
recpt,subject,body=sys.argv[1:] jid = JID(jid) if not jid.resource: jid = JID(jid.node,jid.domain,"korinf") recpt = JID(recpt) send_message(jid,password,recpt,body,subject)
print("Usage:") print("\t%s recipient_jid subject body" % (sys.argv[0],)) print("example:") print("\t%s test1@localhost Test 'this is test'" % (sys.argv[0],)) sys.exit(1)
conditional_block
send_via_pyxmpp.py
#!/usr/bin/python3 # https://bugzilla.altlinux.org/show_bug.cgi?id=33532 #!/usr/bin/env -S python3 -u # -*- coding: utf-8 -*- # # A simple message-sending script # TODO: When error: No handlers could be found for logger "pyxmpp.Client" import os, sys
# python-module-pyxmpp from pyxmpp2.jid import JID from pyxmpp2.jabber.simple import send_message # set in korinf config file jid = os.environ['KORINFERJID'] password = os.environ['KORINFERJIDPASSWD'] if len(sys.argv)!=4: print("Usage:") print("\t%s recipient_jid subject body" % (sys.argv[0],)) print("exa...
random_line_split
route-resources.js
/* global before, describe, it */ var async = require('async') var base = '/api/route-resources' var supertest = require('./supertest')
var resources = require('../fixtures/route-resources') var agent = supertest.agent() describe(base, function () { before(function (done) { RouteResources.remove({}, done) }) before(function (done) { async.each(resources, function (resource, done) { RouteResources.create(resource, done) }, don...
var RouteResources = require('../../lib/route-resource/model')
random_line_split
main.rs
; use clioptions::CliOptions; use regex::Regex; use rustc_serialize::json::Json; use chrono::*; use std::io::{BufRead, BufReader, Write}; use std::fs::File; use std::process::exit; fn is_date(v: &str) -> bool { let re = Regex::new(r"\d{4}-\d{2}-\d{2}.*").unwrap(); let mut date = false; if re.is_match(&v) {...
(signature: &str, input: &str, output: &str, db: &str, comments: bool, verbose: bool) { let mut records = Vec::new(); let f = File::open(input).unwrap(); let file = BufReader::new(&f); for line in file.lines() { records.push(Json::from_str(&line.unwrap()).unwrap()); } let mut table = St...
convert_json_to_sql
identifier_name
main.rs
} date } fn parse_date(v: &str) -> String { let mut re = Regex::new("T").unwrap(); let mut p = v.to_string(); p = re.replace(&p, " "); re = Regex::new(r"\.\d{3}Z").unwrap(); p = re.replace(&p, ""); re = Regex::new(r"\.\d{3}\+\d{4}").unwrap(); p = re.replace(&p, ""); p } fn convert...
{ for (i, a) in cli.get_args().iter().enumerate() { match a.trim() { "-h" | "--help" => display_usage(&program, 0), "-v" | "--version" => display_version(&signature), "-f" | "--file" => input = cli.next_argument(i), "-o" | "--out" => ou...
conditional_block
main.rs
use clioptions::CliOptions; use regex::Regex; use rustc_serialize::json::Json; use chrono::*; use std::io::{BufRead, BufReader, Write}; use std::fs::File; use std::process::exit; fn is_date(v: &str) -> bool { let re = Regex::new(r"\d{4}-\d{2}-\d{2}.*").unwrap(); let mut date = false; if re.is_match(&v) { ...
fn display_version(signature: &str) { println!("{}", signature); exit(0); } fn display_usage(program: &str, code: i32) { println!("\ncmongo2sql"); println!("Utility to convert a MongoDB JSON dump to a SQL dump."); println!("\nCopyright 2016 Sam Saint-Pettersen."); println!("Licensed under the...
{ println!("Error: {}.", err); display_usage(&program, -1); }
identifier_body
main.rs
d{2}-\d{2}.*").unwrap(); let mut date = false; if re.is_match(&v) { date = true; } date } fn parse_date(v: &str) -> String { let mut re = Regex::new("T").unwrap(); let mut p = v.to_string(); p = re.replace(&p, " "); re = Regex::new(r"\.\d{3}Z").unwrap(); p = re.replace(&p, "...
if input.is_empty() {
random_line_split
primeng-fullcalendar.js
import { ElementRef, Input, Component, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Calendar } from '@fullcalendar/core'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === nul...
FullCalendarModule = __decorate([ NgModule({ imports: [CommonModule], exports: [FullCalendar], declarations: [FullCalendar] }) ], FullCalendarModule); return FullCalendarModule; }()); /** * Generated bundle index. Do not edit. */ export { FullCalendar...
{ }
identifier_body
primeng-fullcalendar.js
import { ElementRef, Input, Component, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Calendar } from '@fullcalendar/core'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === nul...
configurable: true }); Object.defineProperty(FullCalendar.prototype, "options", { get: function () { return this._options; }, set: function (value) { this._options = value; if (this._options && this.calendar) { for (var prop in ...
this.calendar.addEventSource(this._events); } }, enumerable: true,
random_line_split
primeng-fullcalendar.js
import { ElementRef, Input, Component, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Calendar } from '@fullcalendar/core'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === nul...
(el) { this.el = el; } FullCalendar.prototype.ngOnInit = function () { this.config = { theme: true }; if (this.options) { for (var prop in this.options) { this.config[prop] = this.options[prop]; } } }; FullCalend...
FullCalendar
identifier_name
primeng-fullcalendar.js
import { ElementRef, Input, Component, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Calendar } from '@fullcalendar/core'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === nul...
}; Object.defineProperty(FullCalendar.prototype, "events", { get: function () { return this._events; }, set: function (value) { this._events = value; if (this._events && this.calendar) { this.calendar.removeAllEventSources(); ...
{ this.initialize(); }
conditional_block
terminal.ts
/** A context key that is set when the find widget in integrated terminal is visible. */ export const KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('terminalFindWidgetVisible', undefined); /** A context key that is set when the find widget in integrated terminal is not visible. */ expo...
/** A keybinding context key that is set when the integrated terminal does not have text selected. */ export const KEYBINDING_CONTEXT_TERMINAL_TEXT_NOT_SELECTED: ContextKeyExpr = KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED.toNegated();
random_line_split
base.js
/* Copyright (c) 2014 Joseph B. Hall [@groundh0g] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
(name, isDefault) { var self = this; this.name = name || "Null"; this.isDefault = isDefault || false; this.version = "0.1.0"; // collections of messages, cleared again in init() this.msgErrors = []; this.msgWarnings = []; this.msgInfos = []; // a valid, do-nothing placeholder method var doNothing = funct...
BaseExporter
identifier_name
base.js
/* Copyright (c) 2014 Joseph B. Hall [@groundh0g] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
} else { // errors were set in self.DoInit(); don't process frames fnComplete( { success: false } ); } }; // manage the various types of messages this.addWarning = function(msg) { self.msgWarnings.push(msg); }; this.addError = function(msg) { self.msgErrors.push(msg); }; this.addInfo = function(m...
{ // oops. not sure what to do. exporter isn't implemented. self.addError("DoExport() not yet implemented in this exporter."); fnComplete( { success: false } ); }
conditional_block
base.js
/* Copyright (c) 2014 Joseph B. Hall [@groundh0g] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
}
this.register = function() { exporters[this.name] = this; };
random_line_split
base.js
/* Copyright (c) 2014 Joseph B. Hall [@groundh0g] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
self.msgWarnings = []; self.msgInfos = []; if(self.DoInit && typeof self.DoInit === "function") { self.DoInit(); } }; var URI_PREAMBLE = { "gif" : "data:image/gif;base64,", "jpg" : "data:image/jpeg;base64,", "png" : "data:image/png;base64,", }; var DetectImageType = function(packer) { // TODO: ...
{ var self = this; this.name = name || "Null"; this.isDefault = isDefault || false; this.version = "0.1.0"; // collections of messages, cleared again in init() this.msgErrors = []; this.msgWarnings = []; this.msgInfos = []; // a valid, do-nothing placeholder method var doNothing = function () { }; // ...
identifier_body
settings.py
""" Django settings for snippets_project project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ impor...
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates'),], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.templa...
] ROOT_URLCONF = 'snippets_project.urls'
random_line_split
incremental.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/. */ use flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
special_damage.insert(kid.compute_layout_damage()); } self_base.restyle_damage .insert(flow::base(kid).restyle_damage.damage_for_parent( child_is_absolutely_positioned)); has_counter_affecting_...
{ let mut special_damage = SpecialRestyleDamage::empty(); let is_absolutely_positioned = flow::base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED); // In addition to damage, we use this phase to compute whether nodes affect CSS counters. let mut has_counter_affecting_children...
identifier_body
incremental.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/. */ use flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
}
self_base.restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW); for kid in self_base.children.iter_mut() { kid.reflow_entire_document(); } }
random_line_split
incremental.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/. */ use flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
{ Incremental, Force } bitflags! { pub struct SpecialRestyleDamage: u8 { #[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \ temporary hack to deal with cases that we don't handle incrementally yet."] const REFLOW_ENTIRE_DOCUMENT =...
RelayoutMode
identifier_name
incremental.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/. */ use flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
else { self_base.flags.remove(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN) } special_damage } fn reflow_entire_document(self) { let self_base = flow::mut_base(self); self_base.restyle_damage.insert(RestyleDamage::rebuild_and_reflow()); self_base.restyle_damag...
{ self_base.flags.insert(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN) }
conditional_block
basic_sniff.py
''' The MIT License (MIT) Copyright (c) 2015 Dan Gunter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
a = sniff(count=2) # Convert the captured packets to json json_data = pcap_to_json(a,json_indent=2) print(json_data)
conditional_block
basic_sniff.py
''' The MIT License (MIT) Copyright (c) 2015 Dan Gunter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
if __name__ == '__main__': # Sniff two packets using scapy a = sniff(count=2) # Convert the captured packets to json json_data = pcap_to_json(a,json_indent=2) print(json_data)
random_line_split
domain_coloring.py
#!/home/bolt/.python_compiled/bin/python3 import math from PIL import Image def complex_wrapper(func, scale_factor=1): """ Modifies a complex function that takes a complex argument and returns a complex number to take a tuple and return a tuple. """ def inner(real, imag): complex_num=c...
def color_intensity(position, radius, gradient): """ This function assigns an intensity based on the radial distance and the gradient """ x,y=position shade_tuple=assign_color_shade(position) if x**2+y**2<radius**2: r,b,g=shade_tuple ratio=((x**2+y**2)/(radius**2))**gradient ...
""" This function assigns a unique color shade to each angle in [0, 2*pi) """ x,y=position if (x,y)==(0,0): return (255, 255, 255) angle=atan(y,x) mod_angle=angle%(2/3*math.pi) mixing=mod_angle/(2/3*math.pi)*255 if angle<=2/3*math.pi: return (255-mixing, mixing, 0) el...
identifier_body
domain_coloring.py
#!/home/bolt/.python_compiled/bin/python3 import math from PIL import Image def
(func, scale_factor=1): """ Modifies a complex function that takes a complex argument and returns a complex number to take a tuple and return a tuple. """ def inner(real, imag): complex_num=complex(real, imag) return_value=func(complex_num/scale_factor) return return_valu...
complex_wrapper
identifier_name
domain_coloring.py
#!/home/bolt/.python_compiled/bin/python3 import math from PIL import Image def complex_wrapper(func, scale_factor=1): """ Modifies a complex function that takes a complex argument and returns a complex number to take a tuple and return a tuple. """ def inner(real, imag): complex_num=c...
return image def map_function(plane_image, func, radius, gradient): """ This function maps the function on the domain plane """ image=Image.new('RGB', plane_image.size) x_size,y_size=plane_image.size x_c,y_c=x_size//2, y_size//2 for x in range(x_size): for y in range(y_size): ...
for y in range(y_size): image.putpixel((x,y), colorize_point((x-x_c, y-y_c), radius, gradient))
conditional_block
domain_coloring.py
#!/home/bolt/.python_compiled/bin/python3 import math from PIL import Image def complex_wrapper(func, scale_factor=1): """ Modifies a complex function that takes a complex argument and returns a complex number to take a tuple and return a tuple. """ def inner(real, imag):
def decorate_atan(func): """ A decorator to modify the range of atan from -pi to pi to 0 to 2*pi """ def inner(y, x): return_val=func(y, x) if return_val>=0: return return_val else: return 2*math.pi+return_val return inner atan=decorate_atan(math.atan...
complex_num=complex(real, imag) return_value=func(complex_num/scale_factor) return return_value.real, return_value.imag return inner
random_line_split
isobands_matplotlib.py
#!/usr/bin/env python ''' isobands_matplotlib.py is a script for creating isobands. Works in a similar way as gdal_contour, but creating polygons instead of polylines This version requires matplotlib, but there is another one, isobands_gdal.py that uses only GDAL python Originally created by Roger Veciana i Rovira, m...
else: out_val = contours.levels[level] feat_out.SetField( attr_name, out_val ) pol = ogr.Geometry(ogr.wkbPolygon) ring = None for i in range(len(path.vertices)): point = path.vertices[i] ...
out_val = contours.levels[level] + interval
conditional_block
isobands_matplotlib.py
#!/usr/bin/env python ''' isobands_matplotlib.py is a script for creating isobands. Works in a similar way as gdal_contour, but creating polygons instead of polylines This version requires matplotlib, but there is another one, isobands_gdal.py that uses only GDAL python Originally created by Roger Veciana i Rovira, m...
dst_layer = dst_ds.CreateLayer(layer_name, geom_type = ogr.wkbPolygon, srs = srs) fdef = ogr.FieldDefn( attr_name, ogr.OFTReal ) dst_layer.CreateField( fdef ) # Use the geotransform pixel size value to avoid weird rounding errors in # original approach. x_pos = [geotransform_in[0]+geo...
''' The method that calculates the isobands ''' ds_in = gdal.Open(in_file) band_in = ds_in.GetRasterBand(band) xsize_in = band_in.XSize ysize_in = band_in.YSize geotransform_in = ds_in.GetGeoTransform() srs = osr.SpatialReference() srs.ImportFromWkt( ds_in.GetProjectionRef() ) ...
identifier_body
isobands_matplotlib.py
#!/usr/bin/env python ''' isobands_matplotlib.py is a script for creating isobands. Works in a similar way as gdal_contour, but creating polygons instead of polylines This version requires matplotlib, but there is another one, isobands_gdal.py that uses only GDAL python Originally created by Roger Veciana i Rovira, m...
(v): return v.lower() in ("yes", "true", "t", "1") def isobands(in_file, band, out_file, out_format, layer_name, attr_name, offset, interval, min_level = None, upper_val_output = False): ''' The method that calculates the isobands ''' ds_in = gdal.Open(in_file) band_in = ds_in.GetRasterBan...
str2bool
identifier_name
isobands_matplotlib.py
#!/usr/bin/env python ''' isobands_matplotlib.py is a script for creating isobands. Works in a similar way as gdal_contour, but creating polygons instead of polylines This version requires matplotlib, but there is another one, isobands_gdal.py that uses only GDAL python Originally created by Roger Veciana i Rovira, m...
fdef = ogr.FieldDefn( attr_name, ogr.OFTReal ) dst_layer.CreateField( fdef ) # Use the geotransform pixel size value to avoid weird rounding errors in # original approach. x_pos = [geotransform_in[0]+geotransform_in[1]*ii \ for ii in range(xsize_in)] y_pos = [geotransform_in[3]+geotran...
dst_layer = dst_ds.CreateLayer(layer_name, geom_type = ogr.wkbPolygon, srs = srs)
random_line_split
setup.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals # -*- coding: utf-8 -*- import os from django_nyt import VERSION from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, be...
include_package_data=True, )
random_line_split
setup.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals # -*- coding: utf-8 -*- import os from django_nyt import VERSION from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, be...
packages = find_packages() try: import pypandoc long_description = pypandoc.convert(get_path('README.md'), 'rst') long_description = long_description.split( '<!---Illegal PyPi RST data -->')[0] f = open(get_path('README.rst'), 'w') f.write(long_description) f.close() print("Succes...
return open(get_path(fname)).read()
identifier_body
setup.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals # -*- coding: utf-8 -*- import os from django_nyt import VERSION from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, be...
(fname): return os.path.join(os.path.dirname(os.path.abspath(__file__)), fname) def read(fname): return open(get_path(fname)).read() packages = find_packages() try: import pypandoc long_description = pypandoc.convert(get_path('README.md'), 'rst') long_description = long_description.split( ...
get_path
identifier_name
SearchAlbum.js
let React = require('react'), SearchItem = require('./SearchItem'); let SearchAlbum = React.createClass({ contextTypes: { updateRoute: React.PropTypes.func, goBack: React.PropTypes.func, data: React.PropTypes.array, addTrack: React.PropTypes.func, getAlbum: React.PropTypes.func }, compone...
, render () { let tracks, albumName, artistName, albumUrl, albumId; if (this.context.data.length > 0) { tracks = this.context.data[0].data.map((d, i) => { return ( <SearchItem key={i} data={ d } btnSrc="something.png" onClic...
{ this.context.getAlbum(); }
identifier_body
SearchAlbum.js
let React = require('react'), SearchItem = require('./SearchItem'); let SearchAlbum = React.createClass({ contextTypes: { updateRoute: React.PropTypes.func, goBack: React.PropTypes.func, data: React.PropTypes.array, addTrack: React.PropTypes.func, getAlbum: React.PropTypes.func }, compone...
return ( <div> <div className="album-header"> <img src={ albumUrl } /> <div className="title"> <p>{ albumName }</p> <p>{ artistName }</p> </div> </div> <div className="searchResults"> <div className="searchListContainer">...
{ tracks = this.context.data[0].data.map((d, i) => { return ( <SearchItem key={i} data={ d } btnSrc="something.png" onClick={ this.context.addTrack.bind(null, d.id) } type="album-track" /> ); }); albumId = this.context...
conditional_block
SearchAlbum.js
let React = require('react'), SearchItem = require('./SearchItem'); let SearchAlbum = React.createClass({ contextTypes: { updateRoute: React.PropTypes.func, goBack: React.PropTypes.func, data: React.PropTypes.array, addTrack: React.PropTypes.func, getAlbum: React.PropTypes.func }, compone...
<ul className="list song-title-tile"> { tracks } </ul> </div> </div> </div> ); } }); module.exports = SearchAlbum;
random_line_split
SearchAlbum.js
let React = require('react'), SearchItem = require('./SearchItem'); let SearchAlbum = React.createClass({ contextTypes: { updateRoute: React.PropTypes.func, goBack: React.PropTypes.func, data: React.PropTypes.array, addTrack: React.PropTypes.func, getAlbum: React.PropTypes.func },
() { this.context.getAlbum(); }, render () { let tracks, albumName, artistName, albumUrl, albumId; if (this.context.data.length > 0) { tracks = this.context.data[0].data.map((d, i) => { return ( <SearchItem key={i} data={ d } btn...
componentWillMount
identifier_name
sendfn-spawn-with-fn-arg.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 ...
(f: ~fn(int)) { f(22); } fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); }); }
test05_start
identifier_name
sendfn-spawn-with-fn-arg.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 ...
fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); }); }
{ f(22); }
identifier_body
sendfn-spawn-with-fn-arg.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 ...
fn test05_start(f: ~fn(int)) { f(22); } fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); ...
random_line_split
luxi.py
ProtocolError): """The master cannot be reached. This means that the master daemon is not running or the socket has been removed. """ class PermissionError(ProtocolError): """Permission denied while connecting to the master socket. This means the user doesn't have the proper rights. """ class Tran...
old_transp = self.transport self.transport = None old_transp.Close() except Exception: # pylint: disable=W0703
random_line_split
luxi.py
pylint: disable=E1103 version = request.get(KEY_VERSION, None) # pylint: disable=E1103 if method is None or args is None: logging.error("LUXI request missing method or arguments: %r", msg) raise ProtocolError(("Invalid LUXI request (no method or arguments" " in request): %r") % ms...
return self.CallMethod(REQ_QUERY_GROUPS, (names, fields, use_locking))
identifier_body
luxi.py
This is used on the client side. This could be replace by any other class that provides the same semantics to the Client. This means: - can send messages and receive messages - safe for multithreading """ def __init__(self, address, timeouts=None): """Constructor for the Client class. Argum...
CallMethod
identifier_name
luxi.py
I_REQ_SET_WATCHER_PAUSE REQ_ALL = constants.LUXI_REQ_ALL DEF_CTMO = constants.LUXI_DEF_CTMO DEF_RWTO = constants.LUXI_DEF_RWTO WFJC_TIMEOUT = constants.LUXI_WFJC_TIMEOUT class ProtocolError(errors.LuxiError): """Denotes an error in the LUXI protocol.""" class ConnectionClosedError(ProtocolError): """Connection...
if not data: raise ConnectionClosedError("Connection closed while reading") new_msgs = (self._buffer + data).split(constants.LUXI_EOM) self._buffer = new_msgs.pop() self._msgs.extend(new_msgs) return self._msgs.popleft() def Call(self, msg): """Send a message and wait for the...
try: data = self.socket.recv(4096) except socket.timeout, err: raise TimeoutError("Receive timeout: %s" % str(err)) except socket.error, err: if err.args and err.args[0] == errno.EAGAIN: continue raise break
conditional_block
uoccin_lookup.py
from __future__ import unicode_literals, division, absolute_import import os from flexget import plugin from flexget.event import event from flexget.utils import json def load_uoccin_data(path): udata = {} ufile = os.path.join(path, 'uoccin.json') if os.path.exists(ufile): try: with o...
udata = load_uoccin_data(config) movies = udata['movies'] series = udata['series'] for entry in task.entries: entry['uoccin_watchlist'] = False entry['uoccin_collected'] = False entry['uoccin_watched'] = False entry['uoccin_rating'] = None...
return
conditional_block
uoccin_lookup.py
from __future__ import unicode_literals, division, absolute_import import os from flexget import plugin from flexget.event import event from flexget.utils import json def
(path): udata = {} ufile = os.path.join(path, 'uoccin.json') if os.path.exists(ufile): try: with open(ufile, 'r') as f: udata = json.load(f) except Exception as err: raise plugin.PluginError('error reading %s: %s' % (ufile, err)) udata.setdefault('...
load_uoccin_data
identifier_name
uoccin_lookup.py
from __future__ import unicode_literals, division, absolute_import import os from flexget import plugin from flexget.event import event from flexget.utils import json def load_uoccin_data(path): udata = {} ufile = os.path.join(path, 'uoccin.json') if os.path.exists(ufile): try: with o...
- uoccin_watchlist (true|false) - uoccin_collected (true|false) - uoccin_watched (true|false) - uoccin_rating (integer) - uoccin_tags (list) - uoccin_subtitles (list of language codes) """ if not task.entries: return udata = lo...
"""Retrieves all the information found in the uoccin.json file for the entries. Example:: uoccin_lookup: /path/to/gdrive/uoccin Resulting fields on entries: on series (requires tvdb_id): - uoccin_watchlist (true|false) - uoccin_...
identifier_body
uoccin_lookup.py
from __future__ import unicode_literals, division, absolute_import import os from flexget import plugin from flexget.event import event from flexget.utils import json def load_uoccin_data(path): udata = {} ufile = os.path.join(path, 'uoccin.json') if os.path.exists(ufile): try: with o...
uoccin_lookup: /path/to/gdrive/uoccin Resulting fields on entries: on series (requires tvdb_id): - uoccin_watchlist (true|false) - uoccin_rating (integer) - uoccin_tags (list) on episodes (requires tvdb_id, series_season...
Example::
random_line_split
webpack.prod.js
*/ const DefinePlugin = require('webpack/lib/DefinePlugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const IgnorePlugin = require('webpack/lib/IgnorePlugin'); const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); const NormalModuleReplacementPlugin = require('webpack/...
/** * Plugin: CompressionPlugin * Description: Prepares compressed versions of assets to serve * them with Content-Encoding * * See: https://github.com/webpack/compression-webpack-plugin */ // install compression-webpack-plugin // new CompressionPlugi...
// new NormalModuleReplacementPlugin( // /src(\\|\/)debug(\\|\/)debug_renderer/, // helpers.root('config/empty.js') // ),
random_line_split
install_linux_sysroot.py
#!/usr/bin/env python3 # Copyright 2018 The Crashpad Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
(): url = '%s/%s/%s/%s' % (SERVER, PATH, REVISION, FILENAME) sysroot = os.path.join(SCRIPT_DIR, os.pardir, 'third_party', 'linux', 'sysroot') stamp = os.path.join(sysroot, '.stamp') if os.path.exists(stamp): with open(stamp) as s: if s.read() == url: ...
main
identifier_name
install_linux_sysroot.py
#!/usr/bin/env python3 # Copyright 2018 The Crashpad Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
os.mkdir(sysroot) tarball = os.path.join(sysroot, FILENAME) print('Downloading %s' % url) for _ in range(3): response = urllib.request.urlopen(url) with open(tarball, 'wb') as f: f.write(response.read()) break else: raise Exception('Failed to download %s...
shutil.rmtree(sysroot)
conditional_block
install_linux_sysroot.py
#!/usr/bin/env python3 # Copyright 2018 The Crashpad Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
response = urllib.request.urlopen(url) with open(tarball, 'wb') as f: f.write(response.read()) break else: raise Exception('Failed to download %s' % url) subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot]) os.remove(tarball) with open(stamp, 'w') a...
url = '%s/%s/%s/%s' % (SERVER, PATH, REVISION, FILENAME) sysroot = os.path.join(SCRIPT_DIR, os.pardir, 'third_party', 'linux', 'sysroot') stamp = os.path.join(sysroot, '.stamp') if os.path.exists(stamp): with open(stamp) as s: if s.read() == url: ...
identifier_body
install_linux_sysroot.py
#!/usr/bin/env python3 # Copyright 2018 The Crashpad Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
url = '%s/%s/%s/%s' % (SERVER, PATH, REVISION, FILENAME) sysroot = os.path.join(SCRIPT_DIR, os.pardir, 'third_party', 'linux', 'sysroot') stamp = os.path.join(sysroot, '.stamp') if os.path.exists(stamp): with open(stamp) as s: if s.read() == url: ...
REVISION = '43a87bbebccad99325fdcf34166295b121ee15c7' FILENAME = 'debian_sid_amd64_sysroot.tar.xz' def main():
random_line_split
rotate.js
//@AddComponentMenu("planet/CloudsRotate") //partial class CloudsRotate{ } private var amtx : float = 0.0; private var amty : float = 0.0; private var amtz : float = 0.0; //private var amtx : float = Random.Range(.2,-.2); //private var amtz : float = Random.Range(.2,-.2); private var this_transform : Transform...
() { this_transform.Rotate(Time.deltaTime *amtx, Time.deltaTime *amty, Time.deltaTime *amtz); }
Update
identifier_name
rotate.js
//@AddComponentMenu("planet/CloudsRotate") //partial class CloudsRotate{ } private var amtx : float = 0.0; private var amty : float = 0.0; private var amtz : float = 0.0; //private var amtx : float = Random.Range(.2,-.2); //private var amtz : float = Random.Range(.2,-.2); private var this_transform : Transform...
{ this_transform.Rotate(Time.deltaTime *amtx, Time.deltaTime *amty, Time.deltaTime *amtz); }
identifier_body
rotate.js
//@AddComponentMenu("planet/CloudsRotate") //partial class CloudsRotate{ } private var amtx : float = 0.0; private var amty : float = 0.0; private var amtz : float = 0.0; //private var amtx : float = Random.Range(.2,-.2); //private var amtz : float = Random.Range(.2,-.2); private var this_transform : Transform...
amty = Random.Range(Random.Range(4.0,7.0),-Random.Range(4.0,8.0)); this_transform = transform; } function Update () { this_transform.Rotate(Time.deltaTime *amtx, Time.deltaTime *amty, Time.deltaTime *amtz); }
random_line_split
jquery.tagging_menu.js
agged"). removeClass("idl-untagged"); /* Fire custom event to have the tagging menu update siblings */ base.$elem.parent().trigger( "tm_itl_sensesel", event); /* Inform a listener of the selection. Listener can prevent * default operation of updating the te...
if (typeof base.options.sensedesel === "function") { upd = base.options.sensedesel.call(this, event) !== false; } if (upd) { base.$elem.text(base.$elem.data('tok')); } }, /** * Public method for a client to mark a sense as selected ...
var upd = true;
random_line_split
jquery.tagging_menu.js
() {} F.prototype = obj; return new F(); }; } (function ($, window, document) { /* Prevents the installed html click handler from closing the menu. This flag is true * only momentarily and in two distinct scenarios: * 1.the html click handler is installed on a click event that will be seen by the ...
F
identifier_name
jquery.tagging_menu.js
/* Inform a listener of the selection. Listener can prevent * default operation of updating the text. */ var upd = true; /* should set to options - default should be to use the skToLemma */ if (typeof base.options.sensesel === "function") { upd = base.options...
{ // If showing tiles and there is no sense, synthesize one $tile = $('<div class="idl-tile-container idl-menu-sensecard idl-sensesel idl-tile-text idl-tmplt-menu_image_v3" data-grp="1"><div class="idl-sensetile"><div class="idl-tile-sum"><h1>' + base.$elem.data("tok") + '</h1></div><div class="idl-...
conditional_block
jquery.tagging_menu.js
F.prototype = obj; return new F(); }; } (function ($, window, document) { /* Prevents the installed html click handler from closing the menu. This flag is true * only momentarily and in two distinct scenarios: * 1.the html click handler is installed on a click event that will be seen by the * ...
{}
identifier_body
index.tsx
import * as React from "react"; import { graphql, Link } from "gatsby"; import Layout from "../components/Layout"; const Posts = ({ data }: any) => ( <section css={{ flex: "1 1 auto", padding: "0 40px" }}> {/* <h4>{data.allMarkdownRemark.totalCount} Posts</h4> */} {data.allMarkdownRemark.edges.map(({ node }:...
node { id frontmatter { title date(formatString: "MMMM DD, YYYY") tags } excerpt fields { slug } } } } } `;
edges {
random_line_split
utils.ts
/** * Flatten a list of lists * * @param {Array<Array<T>>} lists * @return {Array<T>} */ export function flatten<T>(list: Array<Array<T>>): Array<T> { return list.reduce((prev: Array<T>, next: Array<T>): Array<T> => { return prev.concat(next); }, []); } /** * Prevent a function from being called multiple...
timeout = setTimeout(later, wait); }; } export function compose(...funcs: Array<Function>) { return funcs.reduce((f, g) => (...args: Array<any>) => f(g(...args))); }
}; clearTimeout(timeout);
random_line_split
utils.ts
/** * Flatten a list of lists * * @param {Array<Array<T>>} lists * @return {Array<T>} */ export function flatten<T>(list: Array<Array<T>>): Array<T> { return list.reduce((prev: Array<T>, next: Array<T>): Array<T> => { return prev.concat(next); }, []); } /** * Prevent a function from being called multiple...
export function compose(...funcs: Array<Function>) { return funcs.reduce((f, g) => (...args: Array<any>) => f(g(...args))); }
{ let timeout: NodeJS.Timer = null; return (...args: Array<any>) => { const ctx = this; const later = () => { timeout = null; fn.apply(ctx, args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; }
identifier_body
utils.ts
/** * Flatten a list of lists * * @param {Array<Array<T>>} lists * @return {Array<T>} */ export function
<T>(list: Array<Array<T>>): Array<T> { return list.reduce((prev: Array<T>, next: Array<T>): Array<T> => { return prev.concat(next); }, []); } /** * Prevent a function from being called multiple times * repeatedly within a short time frame. * * @param {Function} fn * @param {number} wait * @return {Functi...
flatten
identifier_name
login_details.py
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHET...
#
random_line_split
powerline.py
import os.path from fabric.api import env from fabsetup.fabutils import checkup_git_repo_legacy, needs_packages from fabsetup.fabutils import needs_repo_fabsetup_custom, suggest_localhost from fabsetup.fabutils import install_file_legacy, run, subtask, subsubtask, task from fabsetup.utils import flo, update_or_append...
(bindings_dir): pass # TODO @subtask def powerline_for_i3(bindings_dir): pass # TODO
powerline_for_tmux
identifier_name
powerline.py
import os.path from fabric.api import env from fabsetup.fabutils import checkup_git_repo_legacy, needs_packages from fabsetup.fabutils import needs_repo_fabsetup_custom, suggest_localhost from fabsetup.fabutils import install_file_legacy, run, subtask, subsubtask, task from fabsetup.utils import flo, update_or_append...
@subtask def powerline_for_bash(bindings_dir): bash_snippet = '~/.bashrc_powerline_bash' install_file_legacy(path=bash_snippet, bindings_dir=bindings_dir) prefix = flo('if [ -f {bash_snippet} ]; ') enabler = flo('if [ -f {bash_snippet} ]; then source {bash_snippet}; fi') uncomment_or_update_or_ap...
'''Set up the bash extension of powerline or powerline_shell (another task). ''' question = '\nSet up powerline-shell instead of powerline bash extension?' if query_yes_no(question, default='yes'): from setup import powerline_shell powerline_shell() # disable powerline bash extension...
identifier_body
powerline.py
import os.path from fabric.api import env from fabsetup.fabutils import checkup_git_repo_legacy, needs_packages from fabsetup.fabutils import needs_repo_fabsetup_custom, suggest_localhost from fabsetup.fabutils import install_file_legacy, run, subtask, subsubtask, task from fabsetup.utils import flo, update_or_append...
ERROR: type should be large_string, got " https://powerline.readthedocs.io/en/latest/installation.html\n https://github.com/powerline/fonts\n https://youtu.be/_D6RkmgShvU\n http://www.tecmint.com/powerline-adds-powerful-statuslines-and-prompts-to-vim-and-bash/\n '''\n bindings_dir, scripts_dir = install_upgrade_powerline()\n set_up_powerline_fonts()\n set_up_powerline_daemon(scripts_dir)\n powerline_for_vim(bindings_dir)\n powerline_for_bash_or_powerline_shell(bindings_dir)\n powerline_for_tmux(bindings_dir)\n powerline_for_i3(bindings_dir)\n print('\\nYou may have to reboot for make changes take effect')\n\n\n@subsubtask\ndef install_special_glyphs():\n '''\n More infos:\n https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation\n https://wiki.archlinux.org/index.php/Font_configuration\n $XDG_CONFIG_HOME: http://superuser.com/a/365918\n '''\n from_dir = '~/repos/powerline/font'\n\n run('mkdir -p ~/.local/share/fonts')\n run(flo('cp {from_dir}/PowerlineSymbols.otf ~/.local/share/fonts'))\n\n to_dir = '~/.config/fontconfig/conf.d/'\n run(flo('mkdir -p {to_dir}'))\n run(flo('cp {from_dir}/10-powerline-symbols.conf {to_dir}'))\n\n\n@subtask\ndef install_upgrade_powerline():\n '''\n More infos:\n https://powerline.readthedocs.io/en/latest/installation.html#pip-installation\n '''\n checkup_git_repo_legacy('https://github.com/powerline/powerline.git')\n path_to_powerline = os.path.expanduser('~/repos/powerline')\n run(flo('pip install --user --editable={path_to_powerline}'))\n run('pip show powerline-status') # only for information\n install_special_glyphs()\n bindings_dir = '~/repos/powerline/powerline/bindings'\n scripts_dir = '~/repos/powerline/scripts'\n return bindings_dir, scripts_dir\n\n\n@subtask\ndef set_up_powerline_fonts():\n checkup_git_repo_legacy('https://github.com/powerline/fonts.git',\n name='powerline-fonts')\n # install fonts into ~/.local/share/fonts\n run('cd ~/repos/powerline-fonts && ./install.sh')\n prefix = 'URxvt*font: '\n from config import fontlist\n line = prefix + fontlist\n update_or_append_line(filename='~/.Xresources', prefix=prefix,\n new_line=line)\n if env.host_string == 'localhost':\n run('xrdb ~/.Xresources')\n\n\n@subtask\ndef set_up_powerline_daemon(scripts_dir):\n bash_snippet = '~/.bashrc_powerline_daemon'\n install_file_legacy(path=bash_snippet, scripts_dir=scripts_dir)\n prefix = flo('if [ -f {bash_snippet} ]; ')\n enabler = flo('if [ -f {bash_snippet} ]; then source {bash_snippet}; fi')\n update_or_append_line(filename='~/.bashrc', prefix=prefix, new_line=enabler)\n\n\n@subtask\ndef powerline_for_vim(bindings_dir):\n pass # TODO\n\n\ndef powerline_for_bash_or_powerline_shell(bindings_dir):\n '''Set up the bash extension of powerline or powerline_shell (another task).\n '''\n question = '\\nSet up powerline-shell instead of powerline bash extension?'\n if query_yes_no(question, default='yes'):\n from setup import powerline_shell\n powerline_shell()\n # disable powerline bash extension if it has been set up\n powerline_bash_enabler = 'if [ -f ~/.bashrc_powerline_bash ]; then ' \\\n 'source ~/.bashrc_powerline_bash; fi'\n comment_out_line(filename='~/.bashrc', line=powerline_bash_enabler)\n else:\n powerline_for_bash(bindings_dir)\n # disable powerline_shell if it has been set up\n powerline_shell_enabler = 'if [ -f ~/.bashrc_powerline_shell ]; then ' \\\n 'source ~/.bashrc_powerline_shell; fi'\n comment_out_line(filename='~/.bashrc', line=powerline_shell_enabler)\n\n\n@subtask\ndef powerline_for_bash(bindings_dir):\n bash_snippet = '~/.bashrc_powerline_bash'\n install_file_legacy(path=bash_snippet, bindings_dir=bindings_dir)\n prefix = flo('if [ -f {bash_snippet} ]; ')\n enabler = flo('if [ -f {bash_snippet} ]; then source {bash_snippet}; fi')\n uncomment_or_update_or_append_line(filename='~/.bashrc', prefix=prefix,\n new_line=enabler, comment='#')\n\n\n@subtask\ndef powerline_for_tmux(bindings_dir):\n pass # TODO\n\n\n@subtask\ndef powerline_for_i3(bindings_dir):\n pass # TODO"
More infos: https://github.com/powerline/powerline
random_line_split
powerline.py
import os.path from fabric.api import env from fabsetup.fabutils import checkup_git_repo_legacy, needs_packages from fabsetup.fabutils import needs_repo_fabsetup_custom, suggest_localhost from fabsetup.fabutils import install_file_legacy, run, subtask, subsubtask, task from fabsetup.utils import flo, update_or_append...
@subtask def set_up_powerline_daemon(scripts_dir): bash_snippet = '~/.bashrc_powerline_daemon' install_file_legacy(path=bash_snippet, scripts_dir=scripts_dir) prefix = flo('if [ -f {bash_snippet} ]; ') enabler = flo('if [ -f {bash_snippet} ]; then source {bash_snippet}; fi') update_or_append_line...
run('xrdb ~/.Xresources')
conditional_block
logstream_test.py
import zerorpc import gevent.queue import logging import sys logging.basicConfig() # root logger logger = logging.getLogger() # set the mimimum level for root logger so it will be possible for a client # to subscribe and receive logs for any log level logger.setLevel(0)
def __init__(self, queue, level, formatter): super(QueueingLogHandler, self).__init__() self._queue = queue self.setLevel(level) self.setFormatter(formatter) def emit(self, record): msg = self.format(record) self._queue.put_nowait(msg) def close(sel...
class QueueingLogHandler(logging.Handler): """ A simple logging handler which puts all emitted logs into a gevent queue. """
random_line_split
logstream_test.py
import zerorpc import gevent.queue import logging import sys logging.basicConfig() # root logger logger = logging.getLogger() # set the mimimum level for root logger so it will be possible for a client # to subscribe and receive logs for any log level logger.setLevel(0) class QueueingLogHandler(logging.Handler): ...
def close_log_streams(self): """ Closes all log_stream streams. """ while self._logging_handlers: self._logging_handlers.pop().close() @zerorpc.stream def log_stream(self, logger_name, level_name, format_str): """ Attaches a log handler to the specified logger and ...
""" List of initalized loggers """ return logging.getLogger().manager.loggerDict.keys()
identifier_body
logstream_test.py
import zerorpc import gevent.queue import logging import sys logging.basicConfig() # root logger logger = logging.getLogger() # set the mimimum level for root logger so it will be possible for a client # to subscribe and receive logs for any log level logger.setLevel(0) class QueueingLogHandler(logging.Handler): ...
yield msg finally: self._logging_handlers.discard(handler) handler.close() self.logger.debug("subscription finished for {0}/{1}".format(logger_name or "root", level_name_upper)) if __name__ == "__main__": service = TestService() server = zer...
return
conditional_block
logstream_test.py
import zerorpc import gevent.queue import logging import sys logging.basicConfig() # root logger logger = logging.getLogger() # set the mimimum level for root logger so it will be possible for a client # to subscribe and receive logs for any log level logger.setLevel(0) class QueueingLogHandler(logging.Handler): ...
(self): return self._queue class TestService(object): _HANDLER_CLASS = QueueingLogHandler _DEFAULT_FORMAT = '%(name)s - %(levelname)s - %(asctime)s - %(message)s' logger = logging.getLogger("service") def __init__(self): self._logging_handlers = set() def test(self,...
emitted
identifier_name
serviceworkerglobalscope.rs
event::MessageEvent; use dom::serviceworker::TrustedServiceWorkerAddress; use dom::workerglobalscope::WorkerGlobalScope; use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; use ipc_channel::router::ROUTER; use js::jsapi::{JS_SetInterruptCallback, JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; use js::r...
CommonWorker(WorkerScriptMsg::DOMMessage(data)) => { let scope = self.upcast::<WorkerGlobalScope>(); let target = self.upcast(); let _ac = JSAutoCompartment::new(scope.get_cx(), scope.reflector().get_jsobject()....
match msg {
random_line_split
serviceworkerglobalscope.rs
event::MessageEvent; use dom::serviceworker::TrustedServiceWorkerAddress; use dom::workerglobalscope::WorkerGlobalScope; use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; use ipc_channel::router::ROUTER; use js::jsapi::{JS_SetInterruptCallback, JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; use js::r...
let reports = get_reports(cx, path_seg); reports_chan.send(reports); }, Response(mediator) => { // TODO XXXcreativcoder This will eventually use a FetchEvent interface to fire event // when we have the Request and Response dom api's...
{ use self::ServiceWorkerScriptMsg::*; match msg { CommonWorker(WorkerScriptMsg::DOMMessage(data)) => { let scope = self.upcast::<WorkerGlobalScope>(); let target = self.upcast(); let _ac = JSAutoCompartment::new(scope.get_cx(), ...
identifier_body
serviceworkerglobalscope.rs
event::MessageEvent; use dom::serviceworker::TrustedServiceWorkerAddress; use dom::workerglobalscope::WorkerGlobalScope; use ipc_channel::ipc::{self, IpcSender, IpcReceiver}; use ipc_channel::router::ROUTER; use js::jsapi::{JS_SetInterruptCallback, JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; use js::r...
(init: WorkerGlobalScopeInit, worker_url: Url, id: PipelineId, from_devtools_receiver: Receiver<DevtoolScriptControlMsg>, runtime: Runtime, own_sender: Sender<ServiceWorkerScriptMsg>, receiver: Receiver<ServiceWorkerScriptMsg>, ...
new
identifier_name
serviceworkerglobalscope.rs
util::prefs::PREFS; use util::thread::spawn_named; /// Messages used to control service worker event loop pub enum ServiceWorkerScriptMsg { /// Message common to all workers CommonWorker(WorkerScriptMsg), // Message to request a custom response by the service worker Response(CustomResponseMediator) } ...
{ Ok(MixedMessage::FromServiceWorker(try!(worker_port.recv()))) }
conditional_block
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
fn dangling_references() { // let reference = dangle(); // // fn dangle() -> &String { // let s = String::from("Hello"); // &s // s is deallocated while the reference is returned // } } fn calculate_length(s: &String) -> usize { s.len() } // The follo...
{ // It's okay to have multiple immutable references in the same scope let s = String::from("Hello"); let r = &s; // OK! let r2 = &s; // OK! }
identifier_body
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
() { // let reference = dangle(); // // fn dangle() -> &String { // let s = String::from("Hello"); // &s // s is deallocated while the reference is returned // } } fn calculate_length(s: &String) -> usize { s.len() } // The following function will cause...
dangling_references
identifier_name
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
} fn mutable_reference_scope_valid() { let mut s = String::from("Hello"); { let r = &mut s; r.push_str("GG"); } // r goes out of scope let r2 = &mut s; // And now it's okay to create a new mutable reference } fn immutable_references() { // It's okay to have multiple immutable ref...
{ // let r2 = &mut s; // Same as above }
random_line_split
i16.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 ...
if y { None } else { Some(x) } } } }
#[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v);
random_line_split
i16.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { Some(x) } } } } impl CheckedMul for i16 { #[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v); if y { None } else { Some(x) } } } }
{ None }
conditional_block
i16.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 ...
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. #[inline] fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self) } } /// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. #[inline] fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::ctt...
{ unsafe { intrinsics::ctpop16(*self) } }
identifier_body
i16.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 ...
(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v); if y { None } else { Some(x) } } } } impl CheckedMul for i16 { #[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = in...
checked_sub
identifier_name
ua.js
(function ($) { $.Redactor.opts.langs['ua'] = { html: 'Код', video: 'Відео', image: 'Зображення', table: 'Таблиця', link: 'Посилання', link_insert: 'Вставити посилання ...', link_edit: 'Edit link', unlink: 'Видалити посилання', formatting: 'Стилі', paragraph: 'Звичайний текст', quote: 'Цитата', code: 'Код',...
horizontalrule: 'Горизонтальная лінійка', fullscreen: 'На весь екран', deleted: 'Закреслений', anchor: 'Anchor', link_new_tab: 'Open link in new tab', underline: 'Underline', alignment: 'Alignment', filename: 'Name (optional)' }; })( jQuery );
drop_file_here: 'Перетягніть файл сюди', align_left: 'По лівому краю', align_center: 'По центру', align_right: 'По правому краю', align_justify: 'Вирівняти текст по ширині',
random_line_split
__init__.py
from genc.regions import ( Region, REGIONS, ) try: basestring except NameError: # pragma: no cover basestring = str def _build_cache(name): idx = Region._fields.index(name) return dict([(reg[idx].upper(), reg) for reg in REGIONS if reg[idx] is not None]) _alpha2 = _build_c...
def region_by_name(name, default=None): if isinstance(name, basestring): name = name.upper() return _name.get(name, default) __all__ = ( 'region_by_alpha2', 'region_by_alpha3', 'region_by_name', 'REGIONS', )
if isinstance(code, basestring): code = code.upper() return _alpha3.get(code, default)
identifier_body
__init__.py
from genc.regions import ( Region, REGIONS, ) try: basestring except NameError: # pragma: no cover basestring = str def _build_cache(name): idx = Region._fields.index(name) return dict([(reg[idx].upper(), reg) for reg in REGIONS if reg[idx] is not None]) _alpha2 = _build_c...
if isinstance(code, basestring): code = code.upper() return _alpha2.get(code, default) def region_by_alpha3(code, default=None): if isinstance(code, basestring): code = code.upper() return _alpha3.get(code, default) def region_by_name(name, default=None): if isinstance(name, base...
def region_by_alpha2(code, default=None):
random_line_split
__init__.py
from genc.regions import ( Region, REGIONS, ) try: basestring except NameError: # pragma: no cover basestring = str def _build_cache(name): idx = Region._fields.index(name) return dict([(reg[idx].upper(), reg) for reg in REGIONS if reg[idx] is not None]) _alpha2 = _build_c...
(code, default=None): if isinstance(code, basestring): code = code.upper() return _alpha3.get(code, default) def region_by_name(name, default=None): if isinstance(name, basestring): name = name.upper() return _name.get(name, default) __all__ = ( 'region_by_alpha2', 'region_by...
region_by_alpha3
identifier_name
__init__.py
from genc.regions import ( Region, REGIONS, ) try: basestring except NameError: # pragma: no cover basestring = str def _build_cache(name): idx = Region._fields.index(name) return dict([(reg[idx].upper(), reg) for reg in REGIONS if reg[idx] is not None]) _alpha2 = _build_c...
return _name.get(name, default) __all__ = ( 'region_by_alpha2', 'region_by_alpha3', 'region_by_name', 'REGIONS', )
name = name.upper()
conditional_block
extern-stress.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 ...
() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
main
identifier_name
extern-stress.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { task::yield(); count(data - 1u) + count(data - 1u) } } fn count(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
{ data }
conditional_block
extern-stress.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 ...
for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
pub fn main() {
random_line_split
extern-stress.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 ...
fn count(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
{ if data == 1u { data } else { task::yield(); count(data - 1u) + count(data - 1u) } }
identifier_body
hawkular.py
# # Copyright 2016-2017 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
_queue.append(_STOP) _cond.notify() def send(report): metrics_list = [_get_gauge_metric(name, value) for name, value in six.iteritems(report)] _queue.append(metrics_list) with _cond: _cond.notify() def _get_gauge_metric(name, value): return metrics.create_...
def stop(): logging.info("Stopping hawkular reporter") with _cond: _queue.clear()
random_line_split