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 |
|---|---|---|---|---|
city.rs | use iron::prelude::*;
use hyper::status::StatusCode;
use super::request_body;
use ::proto::response::*;
use ::proto::schema::NewCity;
use ::db::schema::*;
use ::db::*;
pub fn get_cities(_: &mut Request) -> IronResult<Response> |
pub fn put_city(req: &mut Request) -> IronResult<Response> {
let new_city: NewCity = request_body(req)?;
info!("request PUT /city {{ {:?} }}", new_city);
let conn = get_db_connection();
let query = City::insert_query();
conn.execute(&query, &[&new_city.Name]).unwrap();
Ok(Response::with(St... | {
let query = City::select_builder().build();
let conn = get_db_connection();
info!("request GET /city");
let rows = conn.query(&query, &[]).unwrap();
let cities = rows.into_iter()
.map(City::from)
.collect::<Vec<City>>();
Ok(cities.as_response())
} | identifier_body |
roles.py | ):
roles_by_user = defaultdict(set)
get_cache(cls.CACHE_NAMESPACE)[cls.CACHE_KEY] = roles_by_user
for role in CourseAccessRole.objects.filter(user__in=users).select_related('user'):
roles_by_user[role.user.id].add(role)
users_without_roles = filter(lambda u: u.id not in rol... |
class RoleBase(AccessRole):
"""
Roles by type (e.g., instructor, beta_user) and optionally org, course_key
"""
def __init__(self, role_name, org='', course_key=None):
"""
Create role from required role_name w/ optional org and course_key. You may just provide a role
name if it... | raise Exception("This operation is un-indexed, and shouldn't be used") | identifier_body |
roles.py | ):
roles_by_user = defaultdict(set)
get_cache(cls.CACHE_NAMESPACE)[cls.CACHE_KEY] = roles_by_user
for role in CourseAccessRole.objects.filter(user__in=users).select_related('user'):
roles_by_user[role.user.id].add(role)
users_without_roles = filter(lambda u: u.id not in rol... |
class OrgInstructorRole(OrgRole):
"""An organization instructor"""
def __init__(self, *args, **kwargs):
super(OrgInstructorRole, self).__init__('instructor', *args, **kwargs)
class OrgLibraryUserRole(OrgRole):
"""
A user who can view any libraries in an org and import content from them, but n... | class OrgStaffRole(OrgRole):
"""An organization staff member"""
def __init__(self, *args, **kwargs):
super(OrgStaffRole, self).__init__('staff', *args, **kwargs)
| random_line_split |
roles.py | users):
roles_by_user = defaultdict(set)
get_cache(cls.CACHE_NAMESPACE)[cls.CACHE_KEY] = roles_by_user
for role in CourseAccessRole.objects.filter(user__in=users).select_related('user'):
roles_by_user[role.user.id].add(role)
users_without_roles = filter(lambda u: u.id not ... |
def users_with_role(self):
"""
Return a django QuerySet for all of the users with this role
"""
# Org roles don't query by CourseKey, so use CourseKeyField.Empty for that query
if self.course_key is None:
self.course_key = CourseKeyField.Empty
entries = ... | if hasattr(user, '_roles'):
del user._roles | conditional_block |
roles.py | ):
roles_by_user = defaultdict(set)
get_cache(cls.CACHE_NAMESPACE)[cls.CACHE_KEY] = roles_by_user
for role in CourseAccessRole.objects.filter(user__in=users).select_related('user'):
roles_by_user[role.user.id].add(role)
users_without_roles = filter(lambda u: u.id not in rol... | (CourseRole):
"""A course staff member with privileges to perform sales operations. """
ROLE = 'sales_admin'
def __init__(self, *args, **kwargs):
super(CourseSalesAdminRole, self).__init__(self.ROLE, *args, **kwargs)
@register_access_role
class CourseBetaTesterRole(CourseRole):
"""A course Be... | CourseSalesAdminRole | identifier_name |
dj.js | $(document).ready(function () {
});
var play = function () {
mopidy.playback.play({ "tl_track": null }).then(function (data) {
});
}
var pause = function () {
mopidy.playback.pause({}).then(function (data) {
});
}
var resume = function () {
mopidy.playback.resume({}).then(function (data) {
... | ewVol) {
window.mopidy.playback.getVolume().then(function (vol) {
var currentVolume = vol;
console.log('curent vol: ' + currentVolume);
currentVolume = currentVolume + newVol;
mopidy.mixer.setVolume({ "volume": currentVolume }).then(function (data) {
console.log(data);
... | angeVolume(n | identifier_name |
dj.js | $(document).ready(function () {
});
var play = function () {
mopidy.playback.play({ "tl_track": null }).then(function (data) {
});
}
var pause = function () {
mopidy.playback.pause({}).then(function (data) {
});
}
var resume = function () {
mopidy.playback.resume({}).then(function (data) {
... |
var shuffleTracklist = function () {
window.mopidy.tracklist.getTracks()
// => tracklist
.then(function (tracklist) {
mopidy.playback.getCurrentTlTrack({}).then(function (currentTlTrack) {
mopidy.tracklist.index({ "tl_track": currentT... | window.mopidy.playback.getVolume().then(function (vol) {
var currentVolume = vol;
console.log('curent vol: ' + currentVolume);
currentVolume = currentVolume + newVol;
mopidy.mixer.setVolume({ "volume": currentVolume }).then(function (data) {
console.log(data);
});... | identifier_body |
dj.js | $(document).ready(function () {
});
var play = function () {
mopidy.playback.play({ "tl_track": null }).then(function (data) {
});
}
var pause = function () {
mopidy.playback.pause({}).then(function (data) {
});
}
var resume = function () {
mopidy.playback.resume({}).then(function (data) {
... | // currentTlTrackIndex +1 = next track (dont shuffle)
// currentTlTrackIndex +2 = 2nd next track (dont shuffle)
// currentTlTrackIndex +3 = 3rd next track (can be shuffled)
if ((tracklist.length - currentTlT... |
//shuffle tracklist starting from 4 after the current track so:
// currentTlTrackIndex = current track (dont shuffle) | random_line_split |
dj.js | $(document).ready(function () {
});
var play = function () {
mopidy.playback.play({ "tl_track": null }).then(function (data) {
});
}
var pause = function () {
mopidy.playback.pause({}).then(function (data) {
});
}
var resume = function () {
mopidy.playback.resume({}).then(function (data) {
... | }
});
} | $('#tblTracklist tr:last').after('<tr><td>' + tracklist[i].name + '</td><td> </td><td><input type="button" value="X" style="font-size:10px" onclick=RemoveTrackFromTracklist(' + i + ') /></td></tr>');
}
| conditional_block |
error_handler_spec.ts | /**
* @license | *
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ERROR_DEBUG_CONTEXT} from '@angular/core/src/errors';
import {DebugContext} from '@angular/core/src/linker/debug_context';
import {viewWrappedError} from '@angular/core/s... | * Copyright Google Inc. All Rights Reserved. | random_line_split |
error_handler_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ERROR_DEBUG_CONTEXT} from '@angular/core/src/errors';
import {DebugContext} from '@angular/core/src/linker/d... | () {
function errorToString(error: any) {
const logger = new MockConsole();
const errorHandler = new ErrorHandler(false);
errorHandler._console = logger as any;
errorHandler.handleError(error);
return logger.res.join('\n');
}
function getStack(error: Error): string {
try {
throw err... | main | identifier_name |
error_handler_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ERROR_DEBUG_CONTEXT} from '@angular/core/src/errors';
import {DebugContext} from '@angular/core/src/linker/d... |
});
});
});
}
| {
const original = wrappedError('wrapped', realOriginal);
const e = errorToString(wrappedError('wrappedwrapped', original));
expect(e).toContain(stack);
} | conditional_block |
error_handler_spec.ts | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ERROR_DEBUG_CONTEXT} from '@angular/core/src/errors';
import {DebugContext} from '@angular/core/src/linker/d... |
}
export function main() {
function errorToString(error: any) {
const logger = new MockConsole();
const errorHandler = new ErrorHandler(false);
errorHandler._console = logger as any;
errorHandler.handleError(error);
return logger.res.join('\n');
}
function getStack(error: Error): string {
... | { this.res.push(s); } | identifier_body |
.eslintrc.js | module.exports = {
env: {
browser: true,
es2020: true,
greasemonkey: true,
jquery: true,
node: true,
webextensions: true,
},
rules: {},
overrides: [
{
files: ['**/*.{js,jsx}'],
parserOptions: {
sourceType: 'module',
},
extends: [
'eslint:recommended',
'plugin:react/recommended'... | plugins: ['prefer-arrow'],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint', // Disables TypeScript rules that conflict with Prettier.
'plugin:prettier/recommended', // Displays Prettier errors as ESLint errors.... | },
},
{
files: ['**/*.{ts,tsx}'], | random_line_split |
sample_test.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
def testProvidedMetadataSet(self):
metadata = {'origin': 'unit test'}
instance = sample.Sample(metric='Test', value=1.0, unit='Mbps',
metadata=metadata.copy())
self.assertDictEqual(metadata, instance.metadata)
| instance = sample.Sample(metric='Test', value=1.0, unit='Mbps')
self.assertDictEqual({}, instance.metadata) | identifier_body |
sample_test.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | (self):
metadata = {'origin': 'unit test'}
instance = sample.Sample(metric='Test', value=1.0, unit='Mbps',
metadata=metadata.copy())
self.assertDictEqual(metadata, instance.metadata)
| testProvidedMetadataSet | identifier_name |
sample_test.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | def testProvidedMetadataSet(self):
metadata = {'origin': 'unit test'}
instance = sample.Sample(metric='Test', value=1.0, unit='Mbps',
metadata=metadata.copy())
self.assertDictEqual(metadata, instance.metadata) | self.assertDictEqual({}, instance.metadata)
| random_line_split |
runTask.js | /*jshint node:true */
"use strict";
var extend = require('util')._extend;
module.exports = function (task, args, done) {
var that = this, params, finish, cb, isDone = false, start, r, streamReturn = [];
finish = function (err, results, runMethod) {
var hrDuration = process.hrtime(start);
if (isDone) {
ret... | try {
start = process.hrtime();
r = task.apply(this, params);
} catch (err) {
finish(err, null, 'catch');
}
if (r && typeof r.done === 'function') {
// wait for promise to resolve
// FRAGILE: ASSUME: Promises/A+, see http://promises-aplus.github.io/promises-spec/
r.done(function (results) {
finish(n... | params.push(cb);
| random_line_split |
findARestaurant.py | # -*- coding: utf-8 -*-
import json
import httplib2
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
foursquare_client_id = 'SMQNYZFVCIOYIRAIXND2D5SYBLQUOPDB4HZTV13TT22AGACD'
foursquare_client_secret = 'IHBS4VBHYWJL53NLIY2HSVI5A1144GJ3MDTYYY1... | #print "Restaurant Address: %s " % restaurantInfo['address']
#print "Image: %s \n " % restaurantInfo['image']
return restaurantInfo
else:
#print "No Restaurants Found for %s" % location
return "No Restaurants Found"
if __name__ == '__main__':
findARestaurant("Pizza",... | else:
imageURL = "http://pixabay.com/get/8926af5eb597ca51ca4c/1433440765/cheeseburger-34314_1280.png?direct"
restaurantInfo = {'name':restaurant_name, 'address':restaurant_address, 'image':imageURL}
#print "Restaurant Name: %s " % restaurantInfo['name'] | random_line_split |
findARestaurant.py | # -*- coding: utf-8 -*-
import json
import httplib2
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
foursquare_client_id = 'SMQNYZFVCIOYIRAIXND2D5SYBLQUOPDB4HZTV13TT22AGACD'
foursquare_client_secret = 'IHBS4VBHYWJL53NLIY2HSVI5A1144GJ3MDTYYY1... |
#This function takes in a string representation of a location and cuisine type, geocodes the location, and then pass in the latitude and longitude coordinates to the Foursquare API
def findARestaurant(mealType, location):
latitude, longitude = getGeocodeLocation(location)
url = ('https://api.foursquare.com/v2... | locationString = inputString.replace(" ", "+")
url = ('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s'% (locationString, google_api_key))
h = httplib2.Http()
result = json.loads(h.request(url,'GET')[1])
#print response
latitude = result['results'][0]['geometry']['location']['lat... | identifier_body |
findARestaurant.py | # -*- coding: utf-8 -*-
import json
import httplib2
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
foursquare_client_id = 'SMQNYZFVCIOYIRAIXND2D5SYBLQUOPDB4HZTV13TT22AGACD'
foursquare_client_secret = 'IHBS4VBHYWJL53NLIY2HSVI5A1144GJ3MDTYYY1... |
restaurantInfo = {'name':restaurant_name, 'address':restaurant_address, 'image':imageURL}
#print "Restaurant Name: %s " % restaurantInfo['name']
#print "Restaurant Address: %s " % restaurantInfo['address']
#print "Image: %s \n " % restaurantInfo['image']
return restaurantInfo
... | imageURL = "http://pixabay.com/get/8926af5eb597ca51ca4c/1433440765/cheeseburger-34314_1280.png?direct" | conditional_block |
findARestaurant.py | # -*- coding: utf-8 -*-
import json
import httplib2
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
foursquare_client_id = 'SMQNYZFVCIOYIRAIXND2D5SYBLQUOPDB4HZTV13TT22AGACD'
foursquare_client_secret = 'IHBS4VBHYWJL53NLIY2HSVI5A1144GJ3MDTYYY1... | (mealType, location):
latitude, longitude = getGeocodeLocation(location)
url = ('https://api.foursquare.com/v2/venues/search?client_id=%s&client_secret=%s&v=20130815&ll=%s,%s&query=%s' % (foursquare_client_id, foursquare_client_secret,latitude,longitude,mealType))
h = httplib2.Http()
result = json.loads... | findARestaurant | identifier_name |
mouse.rs | // The MIT License (MIT)
//
// Copyright (c) 2014 Jeremy Letang
//
// 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, c... | (window: &WindowImpl) -> (i32, i32) {
let point = ffi::ve_mouse_get_location(window.window_handler);
(point.x as i32, point.y as i32)
}
pub fn screen_location() -> (i32, i32) {
let point = ffi::ve_mouse_get_global_location();
(point.x as i32, point.y as i32)
} | location | identifier_name |
mouse.rs | // The MIT License (MIT)
//
// Copyright (c) 2014 Jeremy Letang
//
// 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, c... | {
let point = ffi::ve_mouse_get_global_location();
(point.x as i32, point.y as i32)
} | identifier_body | |
mouse.rs | // The MIT License (MIT)
//
// Copyright (c) 2014 Jeremy Letang
//
// 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, c... | (point.x as i32, point.y as i32)
} | random_line_split | |
tips.js | angular.module('tips.tips').controller('TipsController', ['$scope', '$routeParams', '$location', 'Global', 'Tips', function ($scope, $routeParams, $location, Global, Tips) {
$scope.global = Global;
$scope.createTip = function () {
var tips = new Tips({
text: this.text,
likes: th... |
function startIsotope(){
var el = $('#isotope-container');
el.isotope({
itemSelector: '.isotope-element',
layoutMode: 'fitRows',
sortBy: 'number',
sortAscending: true,
});
... | {
var that = this;
that.size = {
min: 26,
max: 300
};
that.maxLikes = maxLikes;
that.minLikes = tips[0].likes;
that.valueOfdivision = (function(){
return (that.size... | identifier_body |
tips.js | angular.module('tips.tips').controller('TipsController', ['$scope', '$routeParams', '$location', 'Global', 'Tips', function ($scope, $routeParams, $location, Global, Tips) {
$scope.global = Global;
$scope.createTip = function () {
var tips = new Tips({
text: this.text,
likes: th... | tips.settingsView = new Settings(minLikes, maxLikes);
$scope.$watch('tips', function () {
$scope.$evalAsync(function () {
var isotope = startIsotope();
});
})
});
};
$scope.updateTip = function (tip) {
var... | if(maxLikes <= tips[i].likes)maxLikes = tips[i].likes;
if(minLikes >= tips[i].likes)minLikes = tips[i].likes;
}; | random_line_split |
tips.js | angular.module('tips.tips').controller('TipsController', ['$scope', '$routeParams', '$location', 'Global', 'Tips', function ($scope, $routeParams, $location, Global, Tips) {
$scope.global = Global;
$scope.createTip = function () {
var tips = new Tips({
text: this.text,
likes: th... | (){
var el = $('#isotope-container');
el.isotope({
itemSelector: '.isotope-element',
layoutMode: 'fitRows',
sortBy: 'number',
sortAscending: true,
});
return el;
}
... | startIsotope | identifier_name |
helloworld_grpc_pb.js | // GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must ... | (buffer_arg) {
return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_HelloRequest(arg) {
if (!(arg instanceof helloworld_pb.HelloRequest)) {
throw new Error('Expected argument of type HelloRequest');
}
return new Buffer(arg.serializeBinary());
}
function deser... | deserialize_HelloReply | identifier_name |
helloworld_grpc_pb.js | // GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must ... | sayHello: {
path: '/helloworld.Greeter/SayHello',
requestStream: false,
responseStream: false,
requestType: helloworld_pb.HelloRequest,
responseType: helloworld_pb.HelloReply,
requestSerialize: serialize_HelloRequest,
requestDeserialize: deserialize_HelloRequest,
responseSerialize: ser... |
// The greeting service definition.
var GreeterService = exports.GreeterService = {
// Sends a greeting | random_line_split |
helloworld_grpc_pb.js | // GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must ... |
return new Buffer(arg.serializeBinary());
}
function deserialize_HelloReply(buffer_arg) {
return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_HelloRequest(arg) {
if (!(arg instanceof helloworld_pb.HelloRequest)) {
throw new Error('Expected argument of type He... | {
throw new Error('Expected argument of type HelloReply');
} | conditional_block |
helloworld_grpc_pb.js | // GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must ... |
// The greeting service definition.
var GreeterService = exports.GreeterService = {
// Sends a greeting
sayHello: {
path: '/helloworld.Greeter/SayHello',
requestStream: false,
responseStream: false,
requestType: helloworld_pb.HelloRequest,
responseType: helloworld_pb.HelloReply,
requestSe... | {
return helloworld_pb.HelloRequest.deserializeBinary(new Uint8Array(buffer_arg));
} | identifier_body |
extshadertexturelod.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_d... |
fn enable(_ext: &WebGLExtensions) {}
fn name() -> &'static str {
"EXT_shader_texture_lod"
}
} | !ext.is_gles() || ext.supports_gl_extension("GL_EXT_shader_texture_lod")
} | random_line_split |
extshadertexturelod.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_d... |
}
| {
"EXT_shader_texture_lod"
} | identifier_body |
extshadertexturelod.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
use crate::dom::bindings::reflector::{reflect_d... | (ext: &WebGLExtensions) -> bool {
// This extension is always available on desktop GL.
!ext.is_gles() || ext.supports_gl_extension("GL_EXT_shader_texture_lod")
}
fn enable(_ext: &WebGLExtensions) {}
fn name() -> &'static str {
"EXT_shader_texture_lod"
}
}
| is_supported | identifier_name |
home.py | """
This page is in the table of contents.
Plugin to home the tool at beginning of each layer.
The home manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home
==Operation==
The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not... |
if __name__ == "__main__":
main() | random_line_split | |
home.py | """
This page is in the table of contents.
Plugin to home the tool at beginning of each layer.
The home manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home
==Operation==
The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not... |
def parseInitialization( self, repository ):
'Parse gcode initialization and store the parameters.'
for self.lineIndex in xrange(len(self.lines)):
line = self.lines[self.lineIndex]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
firstWord = gcodec.getFirstWord(splitLine)
self.distanceFeed... | "Parse gcode text and store the home gcode."
self.repository = repository
self.homeLines = settings.getAlterationFileLines(repository.nameOfHomeFile.value)
if len(self.homeLines) < 1:
return gcodeText
self.lines = archive.getTextLines(gcodeText)
self.parseInitialization( repository )
for self.lineIndex i... | identifier_body |
home.py | """
This page is in the table of contents.
Plugin to home the tool at beginning of each layer.
The home manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home
==Operation==
The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not... |
elif firstWord == 'M103':
self.extruderActive = False
self.distanceFeedRate.addLine(line)
def main():
"Display the home dialog."
if len(sys.argv) > 1:
writeOutput(' '.join(sys.argv[1 :]))
else:
settings.startMainLoopFromConstructor(getNewRepository())
if __name__ == "__main__":
main()
| self.extruderActive = True | conditional_block |
home.py | """
This page is in the table of contents.
Plugin to home the tool at beginning of each layer.
The home manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home
==Operation==
The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not... | ( self, splitLine ):
"Add the home travel gcode."
location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine)
self.highestZ = max( self.highestZ, location.z )
if not self.shouldHome:
return
self.shouldHome = False
if self.oldLocation == None:
return
if self.extruderActive:
self.distan... | addHomeTravel | identifier_name |
iconDirective.js | img>` or a CSS `background-image` is that you can't take
* advantage of some SVG features, such as styling specific parts of the icon with CSS or SVG
* animation.
*
* `md-icon` makes it easier to use SVG icons by *inlining* the SVG into an `<svg>` element in the
* document. The most straightforward way of referenc... | * When using SVGs, both external SVGs (via URLs) or sets of SVGs [from icon sets] can be
* easily loaded and used. When using font-icons, developers must follow three (3) simple steps:
*
* <ol>
* <li>Load the font library. e.g.<br/>
* `<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
* ... | * like `"social:cake"`.
* | random_line_split |
iconDirective.js | * </li>
* <li> Use any of the following templates: <br/>
* <ul>
* <li>`<md-icon md-font-icon="classname"></md-icon>`</li>
* <li>`<md-icon md-font-set="font library classname or alias">textual_name</md-icon>`</li>
* <li>`<md-icon> numerical_character_reference </md-icon>`</li>
* <li>`<md-icon ng... | parentsHaveText | identifier_name | |
iconDirective.js | <md-icon ng-bind="scopeVariable"></md-icon>`</li>
* </ul>
* </li>
* </ol>
*
* Full details for these steps can be found:
*
* <ul>
* <li>http://google.github.io/material-design-icons/</li>
* <li>http://google.github.io/material-design-icons/#icon-font-for-the-web</li>
* </ul>
*
* The Material Design icon s... | {
if (!attr.mdSvgIcon && !attr.mdSvgSrc) {
if (attr.mdFontIcon) {
element.addClass('md-font ' + attr.mdFontIcon);
}
element.addClass(lastFontSet);
}
} | identifier_body | |
iconDirective.js | =Material+Icons"
* rel="stylesheet">`
* </li>
* <li>
* Use either (a) font-icon class names or (b) a fontset and a font ligature to render the font glyph by
* using its textual name _or_ numerical character reference. Note that `material-icons` is the default fontset when
* none is specified.
* </li>
*... | {
// If not a font-icon with ligature, then
// hide from the accessibility layer.
$mdAria.expect(element, 'aria-hidden', 'true');
} | conditional_block | |
admin.py | from django.contrib import admin
from .models import Lesson, Course, CourseLead, QA
# from django.utils.translation import ugettext_lazy as _
from ordered_model.admin import OrderedModelAdmin
from core.models import User
# from adminfilters.models import Species, Breed
class UserAdminInline(admin.TabularInline):
... | (OrderedModelAdmin):
list_display = (
'order',
'question',
'move_up_down_links',
)
# list_filter = ('status', )
list_display_links = ('question', )
ordering = ['order']
| QAAdmin | identifier_name |
admin.py | from django.contrib import admin
from .models import Lesson, Course, CourseLead, QA
# from django.utils.translation import ugettext_lazy as _
from ordered_model.admin import OrderedModelAdmin
from core.models import User
# from adminfilters.models import Species, Breed
class UserAdminInline(admin.TabularInline):
... |
@admin.register(QA)
class QAAdmin(OrderedModelAdmin):
list_display = (
'order',
'question',
'move_up_down_links',
)
# list_filter = ('status', )
list_display_links = ('question', )
ordering = ['order'] | )
list_filter = ('status', )
ordering = ['status']
| random_line_split |
admin.py | from django.contrib import admin
from .models import Lesson, Course, CourseLead, QA
# from django.utils.translation import ugettext_lazy as _
from ordered_model.admin import OrderedModelAdmin
from core.models import User
# from adminfilters.models import Species, Breed
class UserAdminInline(admin.TabularInline):
... | list_display = (
'order',
'question',
'move_up_down_links',
)
# list_filter = ('status', )
list_display_links = ('question', )
ordering = ['order'] | identifier_body | |
structured-compare.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 ... |
}
pub fn main() {
let a = (1i, 2i, 3i);
let b = (1i, 2i, 3i);
assert_eq!(a, b);
assert!((a != (1, 2, 4)));
assert!((a < (1, 2, 4)));
assert!((a <= (1, 2, 4)));
assert!(((1i, 2i, 4i) > a));
assert!(((1i, 2i, 4i) >= a));
let x = foo::large;
let y = foo::small;
assert!((x != y... | { !(*self).eq(other) } | identifier_body |
structured-compare.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 ... | () {
let a = (1i, 2i, 3i);
let b = (1i, 2i, 3i);
assert_eq!(a, b);
assert!((a != (1, 2, 4)));
assert!((a < (1, 2, 4)));
assert!((a <= (1, 2, 4)));
assert!(((1i, 2i, 4i) > a));
assert!(((1i, 2i, 4i) >= a));
let x = foo::large;
let y = foo::small;
assert!((x != y));
assert_... | main | identifier_name |
structured-compare.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 ... | pub fn main() {
let a = (1i, 2i, 3i);
let b = (1i, 2i, 3i);
assert_eq!(a, b);
assert!((a != (1, 2, 4)));
assert!((a < (1, 2, 4)));
assert!((a <= (1, 2, 4)));
assert!(((1i, 2i, 4i) > a));
assert!(((1i, 2i, 4i) >= a));
let x = foo::large;
let y = foo::small;
assert!((x != y));
... | }
fn ne(&self, other: &foo) -> bool { !(*self).eq(other) }
}
| random_line_split |
utils.py | from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... |
def split_path(path):
"""
Returns a normalized list of the path's components.
"""
path = os.path.normpath(path)
return [x for x in path.split(os.path.sep) if x]
def generate_id(size=10, chars=string.ascii_uppercase + string.digits):
"""
Generate a string of random alphanumeric character... | """
Returns expanded, absolute paths for all valid paths in a list of arguments.
"""
assert isinstance(args, list)
valid_paths = []
for path in args:
abs_path = valid_path(path)
if abs_path is not None:
valid_paths.append(abs_path)
return valid_paths | identifier_body |
utils.py | from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... |
# Get a list of the archive's contents
contents = list_contents(rar_file_path)
extracted_files = []
# Extract the archive
command = '"{unrar}" x -o+ -- "{file}" "{destination}"'
command = command.format(unrar=config.UNRAR_PATH, file=rar_file_path, destination=destination_dir)
logging.debu... | destination_dir = os.path.split(rar_file_path)[0] | conditional_block |
utils.py | from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... | (args):
"""
Returns expanded, absolute paths for all valid paths in a list of arguments.
"""
assert isinstance(args, list)
valid_paths = []
for path in args:
abs_path = valid_path(path)
if abs_path is not None:
valid_paths.append(abs_path)
return valid_paths
def... | get_paths | identifier_name |
utils.py | from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... | elif parse:
# Parse every other line (only the file paths)
if count % 2 == 0:
contents.append(line_list[0])
count += 1
return contents
def unrar(rar_file_path, destination_dir=None):
"""
Get a list of the ... | count = 0
# If we're in the section of the output we want to parse... | random_line_split |
symbol_analysis.rs | use tokens::*;
use symbols::*;
use support::*;
use plp::PLPWriter;
use symbols::commons::*;
use symbols::symbol_table::*;
pub fn get_accessor_namespace(symbol: &Symbol, symbol_table: &StaticSymbolTable) -> Option<String>
{
match symbol.symbol_class
{
SymbolClass::Variable(ref variable_type) => {
... |
}
}
/// @return ([arg1] [, arg2] {, arg3..})
pub fn get_arg_signature_of(method_symbol: &Symbol) -> String
{
let types: &Vec<String> = match method_symbol.symbol_class
{
SymbolClass::Variable(_) => {
panic!("Expected Function found Variable");
},
SymbolClass::Fu... | {
panic!("Expected Function found {}", subtype);
} | conditional_block |
symbol_analysis.rs | use tokens::*;
use symbols::*;
use support::*;
use plp::PLPWriter;
use symbols::commons::*;
use symbols::symbol_table::*;
pub fn get_accessor_namespace(symbol: &Symbol, symbol_table: &StaticSymbolTable) -> Option<String>
{
match symbol.symbol_class
{
SymbolClass::Variable(ref variable_type) => {
... | let namespace = concatenate_namespace(&*type_symbol.namespace, &*type_symbol.name);
return Some(namespace);
},
SymbolClass::Structure(_, _) => {
panic!("get_accessor_namespace: Structure access not currently supported");
},
SymbolClass::Function(_, _, ... | if potential_matches.is_empty() { return None; }
let type_symbol = potential_matches[0];
| random_line_split |
symbol_analysis.rs | use tokens::*;
use symbols::*;
use support::*;
use plp::PLPWriter;
use symbols::commons::*;
use symbols::symbol_table::*;
pub fn get_accessor_namespace(symbol: &Symbol, symbol_table: &StaticSymbolTable) -> Option<String>
{
match symbol.symbol_class
{
SymbolClass::Variable(ref variable_type) => {
... | (method_symbol: &Symbol) -> (String, u16)
{
match method_symbol.symbol_class {
SymbolClass::Variable(_) => {
panic!("Expected Function found Variable");
},
SymbolClass::Function(_, _, ref label_name, var_count) => (label_name.clone(), var_count as u16),
... | get_static_allocation | identifier_name |
symbol_analysis.rs | use tokens::*;
use symbols::*;
use support::*;
use plp::PLPWriter;
use symbols::commons::*;
use symbols::symbol_table::*;
pub fn get_accessor_namespace(symbol: &Symbol, symbol_table: &StaticSymbolTable) -> Option<String>
{
match symbol.symbol_class
{
SymbolClass::Variable(ref variable_type) => {
... |
/// @return ([arg1] [, arg2] {, arg3..})
pub fn get_arg_signature_of(method_symbol: &Symbol) -> String
{
let types: &Vec<String> = match method_symbol.symbol_class
{
SymbolClass::Variable(_) => {
panic!("Expected Function found Variable");
},
SymbolClass::Function(_... | {
match method_symbol.symbol_class
{
SymbolClass::Variable(_) => {
panic!("Expected Function found Variable");
},
SymbolClass::Function(ref return_type, _, _, _) => return_type.clone(),
SymbolClass::Structure(ref subtype, _) => {
panic!("Expect... | identifier_body |
configure.py | #!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pi... | installs = [(python_files, dest_pkg_dir)]
).generate()
sys.exit() |
sipconfig.ParentMakefile(
configuration = config,
subdirs = output_dirs, | random_line_split |
configure.py | #!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pi... | qt_pkg_dir = os.getenv("qt_pkg_dir")
python_diana_pkg_dir = os.getenv("python_diana_pkg_dir")
dest_pkg_dir = os.path.join(python_diana_pkg_dir, "metno")
config = pyqtconfig.Configuration()
# The name of the SIP build file generated by SIP and used by the build
# system.
sip_files_dir =... | if len(sys.argv) not in (1, 3, 5):
sys.stderr.write("Usage: %s [<directory containing diana headers> <directory containing libdiana>] "
"[<directory containing metlibs headers> <directory containing metlibs libraries>]\n" % sys.argv[0])
sys.exit(1)
if len(sys.argv)... | conditional_block |
configure.py | #!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pi... |
if __name__ == "__main__":
if len(sys.argv) not in (1, 3, 5):
sys.stderr.write("Usage: %s [<directory containing diana headers> <directory containing libdiana>] "
"[<directory containing metlibs headers> <directory containing metlibs libraries>]\n" % sys.argv[0])
sy... | line = open("debian/changelog").readline()
pieces = line.split()
return pieces[1][1:-1] | identifier_body |
configure.py | #!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def | ():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pieces:
name_pieces = piece.strip(",").split("-")
if len(name_pieces) == 2 and name_pieces... | get_diana_version | identifier_name |
SvgIcon.d.ts | import * as React from 'react';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
export interface SvgIconTypeMap<P = {}, D extends React.ElementType = 'svg'> {
props: P & {
/**
* Node passed into the SVG element.
*/
children?: React.ReactNode;
/**
* The color ... | > = OverrideProps<SvgIconTypeMap<P, D>, D>;
export default SvgIcon; | P = {} | random_line_split |
torrentz.py | #VERSION: 2.14
#AUTHORS: Diego de las Heras (diegodelasheras@gmail.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... | self.current_item['leech'] = data.strip().replace(',', '')
# display item
self.td_counter = None
self.current_item['engine_url'] = self.url
if self.current_item['name'].find(' \xc2'):
self.current_item['name'] = sel... | random_line_split | |
torrentz.py | #VERSION: 2.14
#AUTHORS: Diego de las Heras (diegodelasheras@gmail.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... |
self.current_item['link'] += '&' + urlencode({'dn' : self.current_item['name']})
if not self.current_item['seeds'].isdigit():
self.current_item['seeds'] = 0
if not self.current_item['leech'].isdigit():
self.current_item['leech'] = ... | self.current_item['name'] = self.current_item['name'].split(' \xc2')[0] | conditional_block |
torrentz.py | #VERSION: 2.14
#AUTHORS: Diego de las Heras (diegodelasheras@gmail.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... | (self, what, cat='all'):
# initialize trackers for magnet links
trackers = '&' + '&'.join(urlencode({'tr' : tracker}) for tracker in self.trackers_list)
i = 0
while i < 6:
results_list = []
# "what" is already urlencoded
html = retrieve_url('%s/any?f=... | search | identifier_name |
torrentz.py | #VERSION: 2.14
#AUTHORS: Diego de las Heras (diegodelasheras@gmail.com)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... |
def search(self, what, cat='all'):
# initialize trackers for magnet links
trackers = '&' + '&'.join(urlencode({'tr' : tracker}) for tracker in self.trackers_list)
i = 0
while i < 6:
results_list = []
# "what" is already urlencoded
html = retriev... | print(download_file(info)) | identifier_body |
config.rs | //! The configuration format for the program container
use typedef::*;
pub const DEFAULT_SCALE: f64 = 4.0;
pub const DEFAULT_SCREEN_WIDTH: usize = 160;
pub const DEFAULT_SCREEN_HEIGHT: usize = 100;
pub const DEFAULT_WINDOW_TITLE: &str = "bakerVM";
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayC... |
}
| {
Config {
title: DEFAULT_WINDOW_TITLE.into(),
display: Default::default(),
input_enabled: true,
}
} | identifier_body |
config.rs | //! The configuration format for the program container
use typedef::*;
pub const DEFAULT_SCALE: f64 = 4.0;
pub const DEFAULT_SCREEN_WIDTH: usize = 160;
pub const DEFAULT_SCREEN_HEIGHT: usize = 100;
pub const DEFAULT_WINDOW_TITLE: &str = "bakerVM";
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayC... | () -> Self {
DisplayConfig {
resolution: Default::default(),
default_scale: DEFAULT_SCALE,
hide_cursor: true,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayResolution {
pub width: usize,
pub height: usize,
}
impl Default for Dis... | default | identifier_name |
config.rs | //! The configuration format for the program container
use typedef::*; | pub const DEFAULT_SCREEN_HEIGHT: usize = 100;
pub const DEFAULT_WINDOW_TITLE: &str = "bakerVM";
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DisplayConfig {
#[serde(default)]
pub resolution: DisplayResolution,
pub default_scale: Float,
#[serde(default)]
pub hide_cursor: bool,
}
impl... |
pub const DEFAULT_SCALE: f64 = 4.0;
pub const DEFAULT_SCREEN_WIDTH: usize = 160; | random_line_split |
web.dom.iterable.js | var $iterators = require('./es6.array.iterator')
, redefine = require('./_redefine')
, global = require('./_global')
, hide = require('./_hide')
, Iterators = require('./_iterators')
, wks = require('./_wks')
, CORRECT_SYMBOL = require('./_correct-symbol')
, ITE... | 'MimeTypeArray,NamedNodeMap,NodeList,NodeListOf,Plugin,PluginArray,StyleSheetList,TouchList'
).split(','), function(NAME){
var Collection = global[NAME]
, proto = Collection && Collection.prototype
, key;
if(proto){
if(!proto[ITERATOR])hide(proto, ITERATOR, ArrayValues);
if(!proto[TO_STRING_T... | require('./_').each.call((
'CSSRuleList,CSSStyleDeclaration,DOMStringList,DOMTokenList,FileList,HTMLCollection,MediaList,' + | random_line_split |
imgupload_ostest.py | ():
"""
Test file upload
"""
# setup logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
debug_stream = logging.StreamHandler()
logger.addHandler(debug_stream)
##############################################################
# common
paxes_ip = "9.5.1... | runtest | identifier_name | |
imgupload_ostest.py | 93a-4274-ac33-6ef3257bc9d2" # billsco001
# "83a167d6-3d9e-4f14-bdcc-5f87e2361cee" # Bill 1
# x_imgupload_cinder_volume_id = \
# "5b4d33c0-b2fb-414c-bfbf-5023add3ad99" # Sadek 2
# x_imgupload_cinder_volume_id = \
# "81107edc-06c9-4c8b-9706-214809ea97d7" # Harish
###################... |
else:
raise Exception("Programming error")
image_file = {}
image_size = {} # for image_file only
copy_from = {}
# 2MB
image_file["2MB"] = "/tmp/testfile2MB.txt"
image_size["2MB"] = os.path.getsize(image_file["2MB"])
copy_from["2MB"] = 'http://9.47.161.56:8080/testfile2MB.txt'... | ws = line.split()
sha256[ws[0]] = ws[1] | conditional_block |
imgupload_ostest.py |
XFER_TYPE = enum('URL', 'FILE')
def runtest():
"""
Test file upload
"""
# setup logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
debug_stream = logging.StreamHandler()
logger.addHandler(debug_stream)
###################################################... | enums = dict(zip(sequential, range(len(sequential))), **named)
return type('Enum', (), enums) | identifier_body | |
imgupload_ostest.py | def runtest():
"""
Test file upload
"""
# setup logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
debug_stream = logging.StreamHandler()
logger.addHandler(debug_stream)
##############################################################
# common
paxes_... | random_line_split | ||
VersionInfo.py | and to
## permit persons to whom the Software is furnished to do so, subject to
## the following conditions:
##
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## E... |
class VarFileInfo(VS_STRUCT):
wType = 1
name = "VarFileInfo"
def __init__(self, *names):
self.items = map(Var, names)
def get_value(self):
return ""
class VS_VERSIONINFO(VS_STRUCT):
wType = 0 # 0: binary data, 1: text data
name = "VS_VERSION_INFO"
def __init__(se... | Type = 0
name = "Translation"
def __init__(self, value):
self.value = value
def get_value(self):
return struct.pack("l", self.value)
| identifier_body |
VersionInfo.py | and to
## permit persons to whom the Software is furnished to do so, subject to
## the following conditions:
##
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## E... | if product_name is not None:
strings.append(("ProductName", product_name))
strings | trings.append(("PrivateBuild", private_build))
| conditional_block |
VersionInfo.py | , and to
## permit persons to whom the Software is furnished to do so, subject to | ## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## 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 PU... | ## the following conditions:
## | random_line_split |
VersionInfo.py | and to
## permit persons to whom the Software is furnished to do so, subject to
## the following conditions:
##
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## E... | self):
return struct.pack("l", self.value)
class VarFileInfo(VS_STRUCT):
wType = 1
name = "VarFileInfo"
def __init__(self, *names):
self.items = map(Var, names)
def get_value(self):
return ""
class VS_VERSIONINFO(VS_STRUCT):
wType = 0 # 0: binary data, 1: text dat... | et_value( | identifier_name |
info.py | # DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... | (Script, VariantTreePrinter):
def __init__(self):
Script.__init__(self, "info")
VariantTreePrinter.__init__(self)
self.loader = loader.loader()
self.tm = TaskManager()
self.cm = ConfigManager.Get()
def show_config(self, modname):
conf = self.cm.configByName(modname)
res = "\n\tConfig:"
... | INFO | identifier_name |
info.py | # DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... | Module.__init__(self, "info", INFO)
self.tags = "builtins"
self.conf.addArgument({"name": "modules",
"description": "Display information concerning provided modules",
"input": Argument.Optional|Argument.List|typeId.String}) | random_line_split | |
info.py | # DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
def show_config(self, modname):
conf = self.cm.configByName(modname)
res = "\n\tConfig:"
arguments = conf.arguments()
for argument in arguments:
res += "\n\t\tname: " + str(argument.name())
res += "\n\t\tdescription: " + str(argument.description())
if argument.inputType() == Argum... | Script.__init__(self, "info")
VariantTreePrinter.__init__(self)
self.loader = loader.loader()
self.tm = TaskManager()
self.cm = ConfigManager.Get() | identifier_body |
info.py | # DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
return res
def show_res(self, results):
res = self.fillMap(3, results, "\n\n\t\tResults:")
return res
def c_display(self):
print self.info
def getmodinfo(self, modname):
conf = self.cm.configByName(modname)
if conf == None:
return
self.lproc = self.tm.lprocessus
self.... | res += "\n\t\t\tname: " + argname
res += "\n\t\t\tparameters: "
val = args[argname]
if val.type() == typeId.List:
vlist = val.value()
vlen = len(vlist)
for item in vlist:
if item.type == typeId.Node:
res += str(val.value().absolute())
... | conditional_block |
svg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Generic types for CSS values in SVG
use cssparser::Parser;
use parser::{Parse, ParserContext};
use style_trai... | /// The paint source
pub kind: SVGPaintKind<ColorType, UrlPaintServer>,
/// The fallback color. It would be empty, the `none` keyword or <color>.
pub fallback: Option<Either<ColorType, None_>>,
}
/// An SVG paint value without the fallback
///
/// Whereas the spec only allows PaintServer
/// to have a ... | random_line_split | |
svg.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Generic types for CSS values in SVG
use cssparser::Parser;
use parser::{Parse, ParserContext};
use style_trai... | <'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(num) = input.try(|i| NumberType::parse(context, i)) {
return Ok(SvgLengthOrPercentageOrNumber::Number(num));
}
if let Ok(lop) = input.try(|i| LengthOrPerc... | parse | identifier_name |
issue-14182.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // ignore-test FIXME(japari) remove test
struct Foo {
f: for <'b> |&'b isize|:
'b -> &'b isize //~ ERROR use of undeclared lifetime name `'b`
}
fn main() {
let mut x: Vec< for <'a> ||
:'a //~ ERROR use of undeclared lifetime name `'a`
> = Vec::new();
x.push(|| {});
let foo = Foo {
... | // option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z parse-only
| random_line_split |
issue-14182.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let mut x: Vec< for <'a> ||
:'a //~ ERROR use of undeclared lifetime name `'a`
> = Vec::new();
x.push(|| {});
let foo = Foo {
f: |x| x
};
}
| main | identifier_name |
issue-14182.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let mut x: Vec< for <'a> ||
:'a //~ ERROR use of undeclared lifetime name `'a`
> = Vec::new();
x.push(|| {});
let foo = Foo {
f: |x| x
};
} | identifier_body | |
tasks.py | from invoke import task, run
#from fabric.api import local, lcd, get, env
#from fabric.operations import require, prompt
#from fabric.utils import abort
import requests
import rdflib
import getpass
import os.path
import os
import setlr
from os import listdir
from rdflib import *
import logging
CHEAR_DIR='chear.d/'
H... |
print('Adding fragment', filename)
fragment = setl_graph.resource(BNode())
for ontology_output_file in ontology_output_files:
print(ontology_output_file.identifier, list(ontology_output_file[prov.wasGeneratedBy]))
ontology_output_file.value(prov.wasGeneratedBy).add(prov... | continue | conditional_block |
tasks.py | from invoke import task, run
#from fabric.api import local, lcd, get, env
#from fabric.operations import require, prompt
#from fabric.utils import abort
import requests
import rdflib
import getpass
import os.path
import os
import setlr
from os import listdir
from rdflib import *
import logging
CHEAR_DIR='chear.d/'
H... |
setlr._setl(setl_graph)
@task
def buildhhear(ctx):
setl_graph = Graph()
setl_graph.parse('hhear-ontology.setl.ttl',format="turtle")
cwd = os.getcwd()
formats = ['ttl','owl','json']
ontology_output_files = [setl_graph.resource(URIRef('file://'+cwd+'/hhear.'+x)) for x in formats]
print (len... | setl_graph = Graph()
setl_graph.parse(SETL_FILE,format="turtle")
cwd = os.getcwd()
formats = ['ttl','owl','json']
ontology_output_files = [setl_graph.resource(URIRef('file://'+cwd+'/chear.'+x)) for x in formats]
print (len(setl_graph))
for filename in os.listdir(CHEAR_DIR):
if not filena... | identifier_body |
tasks.py | from invoke import task, run
#from fabric.api import local, lcd, get, env
#from fabric.operations import require, prompt
#from fabric.utils import abort
import requests
import rdflib
import getpass
import os.path
import os
import setlr
from os import listdir
from rdflib import *
import logging
CHEAR_DIR='chear.d/'
H... | prov = Namespace('http://www.w3.org/ns/prov#')
dc = Namespace('http://purl.org/dc/terms/')
pv = Namespace('http://purl.org/net/provenance/ns#')
logging_level = logging.INFO
logging.basicConfig(level=logging_level)
@task
def buildchear(ctx):
setl_graph = Graph()
setl_graph.parse(SETL_FILE,format="turtle")
... | SETL_FILE='ontology.setl.ttl'
ontology_setl = Namespace('https://hadatac.org/setl/')
setl = Namespace('http://purl.org/twc/vocab/setl/') | random_line_split |
tasks.py | from invoke import task, run
#from fabric.api import local, lcd, get, env
#from fabric.operations import require, prompt
#from fabric.utils import abort
import requests
import rdflib
import getpass
import os.path
import os
import setlr
from os import listdir
from rdflib import *
import logging
CHEAR_DIR='chear.d/'
H... | (ctx):
setl_graph = Graph()
setl_graph.parse(SETL_FILE,format="turtle")
cwd = os.getcwd()
formats = ['ttl','owl','json']
ontology_output_files = [setl_graph.resource(URIRef('file://'+cwd+'/chear.'+x)) for x in formats]
print (len(setl_graph))
for filename in os.listdir(CHEAR_DIR):
if... | buildchear | identifier_name |
flavor-link.component.ts | import { Component, Input, OnDestroy } from '@angular/core';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { Flavor } from '../flavor';
import { KalturaStorageProfile } from 'kaltura-ngx-client';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Kaltu... |
return asset.assetParamsId === this.flavor.flavorParams.id;
}
private _performAction(): void {
const linkAction = this.flavor.flavorAsset && this.flavor.flavorAsset.id ? this._updateFlavorAction() : this._uploadFlavorAction();
linkAction
.pipe(tag('block-shell'))
... | {
return true;
} | conditional_block |
flavor-link.component.ts | import { Component, Input, OnDestroy } from '@angular/core';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { Flavor } from '../flavor';
import { KalturaStorageProfile } from 'kaltura-ngx-client';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Kaltu... |
this._filePathField = this._form.controls['filePath'];
}
private _updateFlavorAction(): Observable<void> {
this._logger.info(`handle update flavor request`, {
fileUrl: this._form.value.filePath,
flavorAssetId: this.flavor.flavorAsset.id
});
return this._... | }); | random_line_split |
flavor-link.component.ts | import { Component, Input, OnDestroy } from '@angular/core';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { Flavor } from '../flavor';
import { KalturaStorageProfile } from 'kaltura-ngx-client';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Kaltu... |
private _uploadFlavorAction(): Observable<void> {
this._logger.info(`handle upload flavor request, create asset and set its content`, {
fileUrl: this._form.value.filePath,
});
const entryId = this._widgetService.data.id;
const flavorAsset = new KalturaFlavorAsset({ flav... | {
this._logger.info(`handle update flavor request`, {
fileUrl: this._form.value.filePath,
flavorAssetId: this.flavor.flavorAsset.id
});
return this._kalturaClient
.request(new FlavorAssetSetContentAction({
id: this.flavor.flavorAsset.id,
... | identifier_body |
flavor-link.component.ts | import { Component, Input, OnDestroy } from '@angular/core';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui';
import { Flavor } from '../flavor';
import { KalturaStorageProfile } from 'kaltura-ngx-client';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Kaltu... | (): void {
const linkAction = this.flavor.flavorAsset && this.flavor.flavorAsset.id ? this._updateFlavorAction() : this._uploadFlavorAction();
linkAction
.pipe(tag('block-shell'))
.pipe(cancelOnDestroy(this))
.subscribe(
() => {
thi... | _performAction | identifier_name |
express-server.js | module.exports = function(grunt) {
var express = require('express'),
lockFile = require('lockfile'),
Helpers = require('./helpers'),
fs = require('fs'),
path = require('path'),
request = require('request');
/**
Task for serving the static files.
Note: The expressServer:debug task... | (target) {
return function(req, res) {
req.pipe(request(target+req.url)).pipe(res);
};
}
};
| passThrough | identifier_name |
express-server.js | module.exports = function(grunt) {
var express = require('express'),
lockFile = require('lockfile'),
Helpers = require('./helpers'),
fs = require('fs'),
path = require('path'),
request = require('request');
/**
Task for serving the static files.
Note: The expressServer:debug task... | // For `expressServer:dist`
app.use(lock);
app.use(static({ directory: 'dist' }));
app.use(static({ file: 'dist/index.html', ignoredFileExtensions: /\.\w{1,5}$/ })); // Gotta catch 'em all
}
var port = parseInt(process.env.PORT || 8000, 10);
if (isNaN(port) || port < 1 || port > 65... | app.use(static({ file: 'tmp/result/index.html', ignoredFileExtensions: /\.\w{1,5}$/ })); // Gotta catch 'em all
} else { | random_line_split |
express-server.js | module.exports = function(grunt) {
var express = require('express'),
lockFile = require('lockfile'),
Helpers = require('./helpers'),
fs = require('fs'),
path = require('path'),
request = require('request');
/**
Task for serving the static files.
Note: The expressServer:debug task... | else if (proxyMethod === 'proxy') {
var proxyURL = grunt.config('express-server.options.proxyURL'),
proxyPath = grunt.config('express-server.options.proxyPath') || '/api';
grunt.log.writeln('Proxying API requests matching ' + proxyPath + '/* to: ' + proxyURL);
// Use API proxy
app.al... | {
grunt.log.writeln('Using API Stub');
// Load API stub routes
app.use(express.json());
app.use(express.urlencoded());
require('../api-stub/routes')(app);
} | conditional_block |
express-server.js | module.exports = function(grunt) {
var express = require('express'),
lockFile = require('lockfile'),
Helpers = require('./helpers'),
fs = require('fs'),
path = require('path'),
request = require('request');
/**
Task for serving the static files.
Note: The expressServer:debug task... | }
// Is it a directory? If so, search for an index.html in it.
if (stats.isDirectory()) { filePath = path.join(filePath, 'index.html'); }
// Serve the file
res.sendfile(filePath, function(err) {
if (err) { next(); return; }
grunt.verbose.ok('Served: ' + file... | {
return function(req, res, next) { // Gotta catch 'em all (and serve index.html)
var filePath = "";
if (options.directory) {
var regex = new RegExp('^' + (options.urlRoot || ''));
// URL must begin with urlRoot's value
if (!req.path.match(regex)) { next(); return; }
file... | identifier_body |
ee.carousel.component.spec.ts | import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { IconLoaderService } from '../../../index';
import { AmexioImageComponent } from '../../media/image/image.component';
import { MultiMediaCarouselComponent } from './ee.carousel.component';
import { A... | declarations: [MultiMediaCarouselComponent, ContentComponent, AmexioRatingComponent, AmexioImageComponent],
providers: [IconLoaderService],
});
fixture = TestBed.createComponent(MultiMediaCarouselComponent);
comp = fixture.componentInstance;
});
it('playVideo me... | beforeEach(() => {
TestBed.configureTestingModule({
imports: [FormsModule], | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.